scout/adapter/mongo/hgnc.py
def get_id_transcripts(self, hgnc_id, build='37'):
        """Return a set with identifier transcript(s)

        Choose all refseq transcripts with NM symbols, if none where found choose ONE with NR,
        if no NR choose ONE with XM. If there are no RefSeq transcripts identifiers choose the 
        longest ensembl transcript.

        Args:
            hgnc_id(int)
            build(str)

        Returns:
            identifier_transcripts(set)

        """
        transcripts = self.transcripts(build=build, hgnc_id=hgnc_id)

        identifier_transcripts = set()
        longest = None
        nr = []
        xm = []
        for tx in transcripts:
            enst_id = tx['transcript_id']
            # Should we not check if it is longest?
            if not longest:
                longest = enst_id
            refseq_id = tx.get('refseq_id')
            if not refseq_id:
                continue
            
            if 'NM' in refseq_id:
                identifier_transcripts.add(enst_id)
            elif 'NR' in refseq_id:
                nr.append(enst_id)
            elif 'XM' in refseq_id:
                xm.append(enst_id)
        
        if identifier_transcripts:
            return identifier_transcripts
        
        if nr:
            return set([nr[0]])

        if xm:
            return set([xm[0]])
        
        return set([longest])
def get_id_transcripts(self, hgnc_id, build='37'):
        """Return a set with identifier transcript(s)

        Choose all refseq transcripts with NM symbols, if none where found choose ONE with NR,
        if no NR choose ONE with XM. If there are no RefSeq transcripts identifiers choose the 
        longest ensembl transcript.

        Args:
            hgnc_id(int)
            build(str)

        Returns:
            identifier_transcripts(set)

        """
        transcripts = self.transcripts(build=build, hgnc_id=hgnc_id)

        identifier_transcripts = set()
        longest = None
        nr = []
        xm = []
        for tx in transcripts:
            enst_id = tx['transcript_id']
            # Should we not check if it is longest?
            if not longest:
                longest = enst_id
            refseq_id = tx.get('refseq_id')
            if not refseq_id:
                continue
            
            if 'NM' in refseq_id:
                identifier_transcripts.add(enst_id)
            elif 'NR' in refseq_id:
                nr.append(enst_id)
            elif 'XM' in refseq_id:
                xm.append(enst_id)
        
        if identifier_transcripts:
            return identifier_transcripts
        
        if nr:
            return set([nr[0]])

        if xm:
            return set([xm[0]])
        
        return set([longest])
Return a set with identifier transcript(s)

        Choose all refseq transcripts with NM symbols, if none where found choose ONE with NR,
        if no NR choose ONE with XM. If there are no RefSeq transcripts identifiers choose the 
        longest ensembl transcript.

        Args:
            hgnc_id(int)
            build(str)

        Returns:
            identifier_transcripts(set)