scout/server/blueprints/variants/controllers.py
def get_variant_info(genes):
    """Get variant information"""
    data = {'canonical_transcripts': []}
    for gene_obj in genes:
        if not gene_obj.get('canonical_transcripts'):
            tx = gene_obj['transcripts'][0]
            tx_id = tx['transcript_id']
            exon = tx.get('exon', '-')
            c_seq = tx.get('coding_sequence_name', '-')
        else:
            tx_id = gene_obj['canonical_transcripts']
            exon = gene_obj.get('exon', '-')
            c_seq = gene_obj.get('hgvs_identifier', '-')

        if len(c_seq) > 20:
            c_seq = c_seq[:20] + '...'

        if len(genes) == 1:
            value = ':'.join([tx_id,exon,c_seq])
        else:
            gene_id = gene_obj.get('hgnc_symbol') or str(gene_obj['hgnc_id'])
            value = ':'.join([gene_id, tx_id,exon,c_seq])
        data['canonical_transcripts'].append(value)

    return data
def get_variant_info(genes):
    data = {'canonical_transcripts': []}
    for gene_obj in genes:
        if not gene_obj.get('canonical_transcripts'):
            tx = gene_obj['transcripts'][0]
            tx_id = tx['transcript_id']
            exon = tx.get('exon', '-')
            c_seq = tx.get('coding_sequence_name', '-')
        else:
            tx_id = gene_obj['canonical_transcripts']
            exon = gene_obj.get('exon', '-')
            c_seq = gene_obj.get('hgvs_identifier', '-')

        if len(c_seq) > 20:
            c_seq = c_seq[:20] + '...'

        if len(genes) == 1:
            value = ':'.join([tx_id,exon,c_seq])
        else:
            gene_id = gene_obj.get('hgnc_symbol') or str(gene_obj['hgnc_id'])
            value = ':'.join([gene_id, tx_id,exon,c_seq])
        data['canonical_transcripts'].append(value)

    return data
def get_variant_info ( genes ) : data = { 'canonical_transcripts' : [ ] } for gene_obj in genes : if not gene_obj . get ( 'canonical_transcripts' ) : tx = gene_obj [ 'transcripts' ] [ 0 ] tx_id = tx [ 'transcript_id' ] exon = tx . get ( 'exon' , '-' ) c_seq = tx . get ( 'coding_sequence_name' , '-' ) else : tx_id = gene_obj [ 'canonical_transcripts' ] exon = gene_obj . get ( 'exon' , '-' ) c_seq = gene_obj . get ( 'hgvs_identifier' , '-' ) if len ( c_seq ) > 20 : c_seq = c_seq [ : 20 ] + '...' if len ( genes ) == 1 : value = ':' . join ( [ tx_id , exon , c_seq ] ) else : gene_id = gene_obj . get ( 'hgnc_symbol' ) or str ( gene_obj [ 'hgnc_id' ] ) value = ':' . join ( [ gene_id , tx_id , exon , c_seq ] ) data [ 'canonical_transcripts' ] . append ( value ) return data
Get variant information
Get variant information