Example #1
0
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)
Example #2
0
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)