Ejemplo n.º 1
0
def fromgff3(filename, region=None):
    """
    Extract feature rows from a GFF3 file. 

    .. versionadded:: 0.2

    .. versionchanged:: 0.15

    A region query string of the form '[seqid]' or '[seqid]:[start]-[end]' may be given
    for the ``region`` argument. If given, requires the GFF3 file to be bgzipped and
    tabix indexed.

    """

    if region is None:

        # parse file as tab-delimited
        tbl = fromtsv(filename)

    else:

        # extract via tabix
        tbl = fromtabix(filename, region=region)

    return convertgff3(tbl)
Ejemplo n.º 2
0
def test_fromtabix():
    actual = fromtabix('fixture/test.bed.gz', region='Pf3D7_02_v3:110000-120000')
    expect = (('#chrom', 'start', 'end', 'region'),
              ('Pf3D7_02_v3', '105800', '447300', 'Core'))
    ieq(expect, actual)
Ejemplo n.º 3
0
def test_fromtabix_noheader():
    actual = fromtabix('fixture/test_noheader.bed.gz', region='Pf3D7_02_v3:110000-120000')
    expect = (('Pf3D7_02_v3', '105800', '447300', 'Core'),)
    ieq(expect, actual)
Ejemplo n.º 4
0
def test_fromtabix():
    actual = fromtabix('fixture/test.bed.gz',
                       region='Pf3D7_02_v3:110000-120000')
    expect = (('#chrom', 'start', 'end', 'region'), ('Pf3D7_02_v3', '105800',
                                                     '447300', 'Core'))
    ieq(expect, actual)
Ejemplo n.º 5
0
def test_fromtabix_noheader():
    actual = fromtabix('fixture/test_noheader.bed.gz',
                       region='Pf3D7_02_v3:110000-120000')
    expect = (('Pf3D7_02_v3', '105800', '447300', 'Core'), )
    ieq(expect, actual)