def test_native_gff_header(self, gff_filename): gff_path = test_utils.genomics_core_testdata(gff_filename) with gff.GffReader(gff_path) as reader: self.assertEqual(EXPECTED_GFF_VERSION, reader.header.gff_version) with gff.NativeGffReader(gff_path) as native_reader: self.assertEqual(EXPECTED_GFF_VERSION, native_reader.header.gff_version)
def test_iterate_gff_reader(self, gff_filename): gff_path = test_utils.genomics_core_testdata(gff_filename) expected = [('ctg123', 999, 9000), ('ctg123', 999, 1012)] with gff.GffReader(gff_path) as reader: records = list(reader.iterate()) self.assertLen(records, 2) self.assertEqual([(r.range.reference_name, r.range.start, r.range.end) for r in records], expected)
def test_roundtrip_writer(self, filename): output_path = test_utils.test_tmpfile(filename) with gff.GffWriter(output_path, header=self.header) as writer: for record in self.records: writer.write(record) with gff.GffReader(output_path) as reader: v2_records = list(reader.iterate()) self.assertEqual(self.records, v2_records)