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)
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)
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)
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)