scout/adapter/mongo/variant_loader.py
def update_mongo_compound_variants(self, bulk):
        """Update the compound information for a bulk of variants in the database

            Args:
                bulk(dict): {'_id': scout.models.Variant}

        """
        requests = []
        for var_id in bulk:
            var_obj = bulk[var_id]
            if not var_obj.get('compounds'):
                continue
            # Add a request to update compounds
            operation = pymongo.UpdateOne(
                {'_id': var_obj['_id']},
                {
                    '$set': {
                        'compounds': var_obj['compounds']
                    }
                })
            requests.append(operation)

        if not requests:
            return

        try:
            self.variant_collection.bulk_write(requests, ordered=False)
        except BulkWriteError as err:
            LOG.warning("Updating compounds failed")
            raise err
def update_mongo_compound_variants(self, bulk):
        """Update the compound information for a bulk of variants in the database

            Args:
                bulk(dict): {'_id': scout.models.Variant}

        """
        requests = []
        for var_id in bulk:
            var_obj = bulk[var_id]
            if not var_obj.get('compounds'):
                continue
            # Add a request to update compounds
            operation = pymongo.UpdateOne(
                {'_id': var_obj['_id']},
                {
                    '$set': {
                        'compounds': var_obj['compounds']
                    }
                })
            requests.append(operation)

        if not requests:
            return

        try:
            self.variant_collection.bulk_write(requests, ordered=False)
        except BulkWriteError as err:
            LOG.warning("Updating compounds failed")
            raise err
Update the compound information for a bulk of variants in the database

            Args:
                bulk(dict): {'_id': scout.models.Variant}