Permalink
Browse files

Test writer on bcftools output

  • Loading branch information...
1 parent a6f1fab commit 8f3c0a957a1c75ad96faacb0665eb7bdc1da1453 @martijnvermaat martijnvermaat committed Sep 22, 2012
Showing with 28 additions and 2 deletions.
  1. +28 −2 vcf/test/test_vcf.py
View
@@ -205,7 +205,7 @@ def test_issue_49(self):
pass
-class TestWriter(unittest.TestCase):
+class TestGatkOutputWriter(unittest.TestCase):
def testWrite(self):
@@ -228,6 +228,31 @@ def testWrite(self):
for l, r in zip(records, reader2):
self.assertEquals(l.samples, r.samples)
+
+class TestBcfToolsOutputWriter(unittest.TestCase):
+
+ def testWrite(self):
+
+ reader = vcf.Reader(fh('bcftools.vcf'))
+ out = StringIO()
+ writer = vcf.Writer(out, reader)
+
+ records = list(reader)
+
+ for record in records:
+ writer.write_record(record)
+ out.seek(0)
+ print (out.getvalue())
+ reader2 = vcf.Reader(out)
+
+ self.assertEquals(reader.samples, reader2.samples)
+ self.assertEquals(reader.formats, reader2.formats)
+ self.assertEquals(reader.infos, reader2.infos)
+
+ for l, r in zip(records, reader2):
+ self.assertEquals(l.samples, r.samples)
+
+
class TestRecord(unittest.TestCase):
def test_num_calls(self):
@@ -758,7 +783,8 @@ def test_trim(self):
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(TestFreebayesOutput))
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(TestSamtoolsOutput))
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(TestBcfToolsOutput))
-suite.addTests(unittest.TestLoader().loadTestsFromTestCase(TestWriter))
+suite.addTests(unittest.TestLoader().loadTestsFromTestCase(TestGatkOutputWriter))
+suite.addTests(unittest.TestLoader().loadTestsFromTestCase(TestBcfToolsOutputWriter))
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(TestTabix))
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(TestOpenMethods))
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(TestFilter))

0 comments on commit 8f3c0a9

Please sign in to comment.