示例#1
0
文件: utils.py 项目: statcgx/xbrowse
def get_coding_regions_for_gene(gene):
    """
    Get list of sorted coding regions for gene
    (assuming gene['cds'] contains raw cds vals
    """
    cdr_list = []
    # map of coordinate tuple -> cdr
    cdrs = [(c['xstart'], c['xstop']) for c in gene['cds']]
    flattened_cdrs = region_utils.flatten_region_list(cdrs)
    for i, cdr_t in enumerate(flattened_cdrs):
        cdr_list.append(CodingRegion(gene_id=gene['gene_id'], index_in_gene=i, xstart=cdr_t[0], xstop=cdr_t[1]))
    return cdr_list
示例#2
0
文件: utils.py 项目: batsal/xbrowse
def get_coding_regions_from_gene_structure(gene_id, gene_structure):
    """
    Get list of sorted coding regions for gene
    (assuming gene['cds'] contains raw cds vals
    """
    cdr_list = []
    cdrs = [(c['cds_xstart'], c['cds_xstop']) for c in gene_structure['exons'] if 'cds_xstart' in c]
    cdrs = sorted(cdrs, key=lambda x: (x[0], x[1]))
    flattened_cdrs = region_utils.flatten_region_list(cdrs)
    for i, cdr_t in enumerate(flattened_cdrs):
        cdr_list.append(CodingRegion(gene_id=gene_id, index_in_gene=i, xstart=cdr_t[0], xstop=cdr_t[1]))
    return cdr_list
示例#3
0
文件: utils.py 项目: zmcv/seqr
def get_coding_regions_from_gene_structure(gene_id, gene_structure):
    """
    Get list of sorted coding regions for gene
    (assuming gene['cds'] contains raw cds vals
    """
    cdr_list = []
    cdrs = [(c['cds_xstart'], c['cds_xstop']) for c in gene_structure['exons']
            if 'cds_xstart' in c]
    cdrs = sorted(cdrs, key=lambda x: (x[0], x[1]))
    flattened_cdrs = region_utils.flatten_region_list(cdrs)
    for i, cdr_t in enumerate(flattened_cdrs):
        cdr_list.append(
            CodingRegion(gene_id=gene_id,
                         index_in_gene=i,
                         xstart=cdr_t[0],
                         xstop=cdr_t[1]))
    return cdr_list