scout/adapter/mongo/hgnc.py
def hgnc_gene(self, hgnc_identifier, build='37'):
        """Fetch a hgnc gene

            Args:
                hgnc_identifier(int)

            Returns:
                gene_obj(HgncGene)
        """
        if not build in ['37', '38']:
            build = '37'
        query = {}
        try:
            # If the identifier is a integer we search for hgnc_id
            hgnc_identifier = int(hgnc_identifier)
            query['hgnc_id'] = hgnc_identifier
        except ValueError:
            # Else we seach for a hgnc_symbol
            query['hgnc_symbol'] = hgnc_identifier

        query['build'] = build
        LOG.debug("Fetching gene %s" % hgnc_identifier)
        gene_obj = self.hgnc_collection.find_one(query)
        if not gene_obj:
            return None
        
        # Add the transcripts:
        transcripts = []
        tx_objs = self.transcripts(build=build, hgnc_id=gene_obj['hgnc_id'])
        if tx_objs.count() > 0:
            for tx in tx_objs:
                transcripts.append(tx)
        gene_obj['transcripts'] = transcripts
        
        return gene_obj
def hgnc_gene(self, hgnc_identifier, build='37'):
        if not build in ['37', '38']:
            build = '37'
        query = {}
        try:
            # If the identifier is a integer we search for hgnc_id
            hgnc_identifier = int(hgnc_identifier)
            query['hgnc_id'] = hgnc_identifier
        except ValueError:
            # Else we seach for a hgnc_symbol
            query['hgnc_symbol'] = hgnc_identifier

        query['build'] = build
        LOG.debug("Fetching gene %s" % hgnc_identifier)
        gene_obj = self.hgnc_collection.find_one(query)
        if not gene_obj:
            return None
        
        # Add the transcripts:
        transcripts = []
        tx_objs = self.transcripts(build=build, hgnc_id=gene_obj['hgnc_id'])
        if tx_objs.count() > 0:
            for tx in tx_objs:
                transcripts.append(tx)
        gene_obj['transcripts'] = transcripts
        
        return gene_obj
def hgnc_gene ( self , hgnc_identifier , build = '37' ) : if not build in [ '37' , '38' ] : build = '37' query = { } try : # If the identifier is a integer we search for hgnc_id hgnc_identifier = int ( hgnc_identifier ) query [ 'hgnc_id' ] = hgnc_identifier except ValueError : # Else we seach for a hgnc_symbol query [ 'hgnc_symbol' ] = hgnc_identifier query [ 'build' ] = build LOG . debug ( "Fetching gene %s" % hgnc_identifier ) gene_obj = self . hgnc_collection . find_one ( query ) if not gene_obj : return None # Add the transcripts: transcripts = [ ] tx_objs = self . transcripts ( build = build , hgnc_id = gene_obj [ 'hgnc_id' ] ) if tx_objs . count ( ) > 0 : for tx in tx_objs : transcripts . append ( tx ) gene_obj [ 'transcripts' ] = transcripts return gene_obj
Fetch a hgnc gene

            Args:
                hgnc_identifier(int)

            Returns:
                gene_obj(HgncGene)
Fetch a hgnc gene