scout/adapter/mongo/clinvar.py
def delete_submission(self, submission_id):
        """Deletes a Clinvar submission object, along with all associated clinvar objects (variants and casedata)

            Args:
                submission_id(str): the ID of the submission to be deleted

            Returns:
                deleted_objects(int): the number of associated objects removed (variants and/or casedata)
                deleted_submissions(int): 1 if it's deleted, 0 if something went wrong
        """
        LOG.info("Deleting clinvar submission %s", submission_id)
        submission_obj = self.clinvar_submission_collection.find_one({ '_id' : ObjectId(submission_id)})

        submission_variants = submission_obj.get('variant_data')
        submission_casedata = submission_obj.get('case_data')

        submission_objects = []

        if submission_variants and submission_casedata:
            submission_objects = submission_variants + submission_casedata
        elif submission_variants:
            submission_objects = submission_variants
        elif submission_casedata:
            submission_objects = submission_casedata

        # Delete all variants and casedata objects associated with this submission
        result = self.clinvar_collection.delete_many({'_id': { "$in": submission_objects} })
        deleted_objects = result.deleted_count

        # Delete the submission itself
        result = self.clinvar_submission_collection.delete_one({'_id': ObjectId(submission_id)})
        deleted_submissions = result.deleted_count

        #return deleted_count, deleted_submissions
        return deleted_objects,deleted_submissions
def delete_submission(self, submission_id):
        """Deletes a Clinvar submission object, along with all associated clinvar objects (variants and casedata)

            Args:
                submission_id(str): the ID of the submission to be deleted

            Returns:
                deleted_objects(int): the number of associated objects removed (variants and/or casedata)
                deleted_submissions(int): 1 if it's deleted, 0 if something went wrong
        """
        LOG.info("Deleting clinvar submission %s", submission_id)
        submission_obj = self.clinvar_submission_collection.find_one({ '_id' : ObjectId(submission_id)})

        submission_variants = submission_obj.get('variant_data')
        submission_casedata = submission_obj.get('case_data')

        submission_objects = []

        if submission_variants and submission_casedata:
            submission_objects = submission_variants + submission_casedata
        elif submission_variants:
            submission_objects = submission_variants
        elif submission_casedata:
            submission_objects = submission_casedata

        # Delete all variants and casedata objects associated with this submission
        result = self.clinvar_collection.delete_many({'_id': { "$in": submission_objects} })
        deleted_objects = result.deleted_count

        # Delete the submission itself
        result = self.clinvar_submission_collection.delete_one({'_id': ObjectId(submission_id)})
        deleted_submissions = result.deleted_count

        #return deleted_count, deleted_submissions
        return deleted_objects,deleted_submissions
Deletes a Clinvar submission object, along with all associated clinvar objects (variants and casedata)

            Args:
                submission_id(str): the ID of the submission to be deleted

            Returns:
                deleted_objects(int): the number of associated objects removed (variants and/or casedata)
                deleted_submissions(int): 1 if it's deleted, 0 if something went wrong