示例#1
0
文件: gff3.py 项目: hexatonics/petlx
def fromgff3(filename):
    """
    Extract feature rows from a GFF3 file. 
    
    .. versionadded:: 0.2

    """
    
    # parse file as tab-delimited
    t0 = fromtsv(filename)
    
    # push header
    t1 = pushheader(t0, ('seqid', 'source', 'type', 'start', 'end', 'score', 'strand', 'phase', 'attributes'))

    # skip comments
    t2 = skipcomments(t1, '#')
    
    # ignore any row not 9 values long (e.g., trailing fasta)
    t3 = rowlenselect(t2, 9)
    
    # parse attributes into a dict
    t4 = convert(t3, 'attributes', gff3_parse_attributes)
    
    # parse coordinates
    t5 = convert(t4, ('start', 'end'), int)

    return HybridRowView(t5)
示例#2
0
文件: gff3.py 项目: pombredanne/petlx
def convertgff3(tbl):

    # push header
    t1 = pushheader(tbl, ('seqid', 'source', 'type', 'start', 'end', 'score', 'strand', 'phase', 'attributes'))

    # skip comments
    t2 = skipcomments(t1, '#')

    # ignore any row not 9 values long (e.g., trailing fasta)
    t3 = rowlenselect(t2, 9)

    # parse attributes into a dict
    t4 = convert(t3, 'attributes', gff3_parse_attributes)

    # parse coordinates
    t5 = convert(t4, ('start', 'end'), int)

    return HybridRowView(t5)