scout/parse/ensembl.py
def parse_ensembl_gene_request(result):
    """Parse a dataframe with ensembl gene information

    Args:
        res(pandas.DataFrame)

    Yields:
        gene_info(dict)
    """
    LOG.info("Parsing genes from request")

    for index, row in result.iterrows():
        # print(index, row)
        ensembl_info = {}

        # Pandas represents missing data with nan which is a float
        if type(row['hgnc_symbol']) is float:
            # Skip genes without hgnc information
            continue

        ensembl_info['chrom'] = row['chromosome_name']
        ensembl_info['gene_start'] = int(row['start_position'])
        ensembl_info['gene_end'] = int(row['end_position'])
        ensembl_info['ensembl_gene_id'] = row['ensembl_gene_id']
        ensembl_info['hgnc_symbol'] = row['hgnc_symbol']

        hgnc_id = row['hgnc_id']

        if type(hgnc_id) is float:
            hgnc_id = int(hgnc_id)
        else:
            hgnc_id = int(hgnc_id.split(':')[-1])

        ensembl_info['hgnc_id'] = hgnc_id

        yield ensembl_info
def parse_ensembl_gene_request(result):
    LOG.info("Parsing genes from request")

    for index, row in result.iterrows():
        # print(index, row)
        ensembl_info = {}

        # Pandas represents missing data with nan which is a float
        if type(row['hgnc_symbol']) is float:
            # Skip genes without hgnc information
            continue

        ensembl_info['chrom'] = row['chromosome_name']
        ensembl_info['gene_start'] = int(row['start_position'])
        ensembl_info['gene_end'] = int(row['end_position'])
        ensembl_info['ensembl_gene_id'] = row['ensembl_gene_id']
        ensembl_info['hgnc_symbol'] = row['hgnc_symbol']

        hgnc_id = row['hgnc_id']

        if type(hgnc_id) is float:
            hgnc_id = int(hgnc_id)
        else:
            hgnc_id = int(hgnc_id.split(':')[-1])

        ensembl_info['hgnc_id'] = hgnc_id

        yield ensembl_info
def parse_ensembl_gene_request ( result ) : LOG . info ( "Parsing genes from request" ) for index , row in result . iterrows ( ) : # print(index, row) ensembl_info = { } # Pandas represents missing data with nan which is a float if type ( row [ 'hgnc_symbol' ] ) is float : # Skip genes without hgnc information continue ensembl_info [ 'chrom' ] = row [ 'chromosome_name' ] ensembl_info [ 'gene_start' ] = int ( row [ 'start_position' ] ) ensembl_info [ 'gene_end' ] = int ( row [ 'end_position' ] ) ensembl_info [ 'ensembl_gene_id' ] = row [ 'ensembl_gene_id' ] ensembl_info [ 'hgnc_symbol' ] = row [ 'hgnc_symbol' ] hgnc_id = row [ 'hgnc_id' ] if type ( hgnc_id ) is float : hgnc_id = int ( hgnc_id ) else : hgnc_id = int ( hgnc_id . split ( ':' ) [ - 1 ] ) ensembl_info [ 'hgnc_id' ] = hgnc_id yield ensembl_info
Parse a dataframe with ensembl gene information

    Args:
        res(pandas.DataFrame)

    Yields:
        gene_info(dict)
Parse a dataframe with ensembl gene information