Exemplo n.º 1
0
 def test_export(self):
     """Run the 'export' command with each format."""
     # SEG
     seg_rows = export.export_seg(["formats/tr95t.cns"])
     self.assertGreater(len(seg_rows), 0)
     seg2_rows = export.export_seg(
         ["formats/tr95t.cns", "formats/cl_seq.cns"])
     self.assertGreater(len(seg2_rows), len(seg_rows))
     # THetA2
     _header, theta_rows = export.export_theta("formats/tr95t.cns",
                                               "formats/reference-tr.cnn")
     self.assertGreater(len(theta_rows), 0)
     for fname, ploidy, is_f in [("tr95t.cns", 2, True),
                                 ("cl_seq.cns", 6, True),
                                 ("amplicon.cns", 2, False)]:
         cns = cnvlib.read("formats/" + fname)
         # BED
         self.assertLess(
             len(
                 export.export_bed(cns, ploidy, True, is_f, cns.sample_id,
                                   "ploidy")), len(cns))
         self.assertLess(
             len(
                 export.export_bed(cns, ploidy, True, is_f, cns.sample_id,
                                   "variant")), len(cns))
         self.assertEqual(
             len(
                 export.export_bed(cns, ploidy, True, is_f, cns.sample_id,
                                   "all")), len(cns))
         # VCF
         _vheader, vcf_body = export.export_vcf(cns, ploidy, True, is_f)
         self.assertTrue(0 < len(vcf_body.splitlines()) < len(cns))
Exemplo n.º 2
0
 def test_export(self):
     """Run the 'export' command with each format."""
     # SEG
     seg_rows = export.export_seg(["formats/tr95t.cns"])
     self.assertGreater(len(seg_rows), 0)
     seg2_rows = export.export_seg(["formats/tr95t.cns",
                                    "formats/cl_seq.cns"])
     self.assertGreater(len(seg2_rows), len(seg_rows))
     # THetA2
     _header, theta_rows = export.export_theta("formats/tr95t.cns",
                                               "formats/reference-tr.cnn")
     self.assertGreater(len(theta_rows), 0)
     for fname, ploidy, is_f in [("tr95t.cns", 2, True),
                                 ("cl_seq.cns", 6, True),
                                 ("amplicon.cns", 2, False)]:
         cns = cnvlib.read("formats/" + fname)
         # BED
         self.assertLess(len(export.export_bed(cns, ploidy, True, is_f,
                                               cns.sample_id, "ploidy")),
                         len(cns))
         self.assertLess(len(export.export_bed(cns, ploidy, True, is_f,
                                               cns.sample_id, "variant")),
                         len(cns))
         self.assertEqual(len(export.export_bed(cns, ploidy, True, is_f,
                                                cns.sample_id, "all")),
                          len(cns))
         # VCF
         _vheader, vcf_body = export.export_vcf(cns, ploidy, True, is_f)
         self.assertTrue(0 < len(vcf_body.splitlines()) < len(cns))
Exemplo n.º 3
0
 def test_export(self):
     # SEG
     seg_rows = export.export_seg(["formats/tr95t.cns"])
     self.assertTrue(len(seg_rows) > 0)
     seg2_rows = export.export_seg(["formats/tr95t.cns",
                                    "formats/cl_seq.cns"])
     self.assertTrue(len(seg2_rows) > len(seg_rows))
     # THetA2
     _header, theta_rows = export.export_theta("formats/tr95t.cns",
                                               "formats/reference-tr.cnn")
     self.assertTrue(len(theta_rows) > 0)
     # VCF
     tr_cns = cnvlib.read("formats/tr95t.cns")
     _header, tr_vcf_body = export.export_vcf(tr_cns, 2, True, True)
     self.assertTrue(0 < len(tr_vcf_body.splitlines()) < len(tr_cns))
     cl_cns = cnvlib.read("formats/cl_seq.cns")
     _header, cl_vcf_body = export.export_vcf(cl_cns, 6, True, True)
     self.assertTrue(0 < len(cl_vcf_body.splitlines()) < len(cl_cns))
Exemplo n.º 4
0
 def test_export_bed_vcf(self):
     """The 'export' command for formats with absolute copy number."""
     for fname, ploidy, is_f in [("tr95t.cns", 2, True),
                                 ("cl_seq.cns", 6, True),
                                 ("amplicon.cns", 2, False)]:
         cns = cnvlib.read("formats/" + fname)
         # BED
         for show in ("ploidy", "variant", "all"):
             tbl_bed = export.export_bed(cns, ploidy, True, is_f,
                                         cns.sample_id, show)
             if show == "all":
                 self.assertEqual(len(tbl_bed), len(cns),
                                  "{} {}".format(fname, ploidy))
             else:
                 self.assertLess(len(tbl_bed), len(cns))
         # VCF
         _vheader, vcf_body = export.export_vcf(cns, ploidy, True, is_f)
         self.assertTrue(0 < len(vcf_body.splitlines()) < len(cns))
Exemplo n.º 5
0
 def test_export_bed_vcf(self):
     """The 'export' command for formats with absolute copy number."""
     for fname, ploidy, is_f in [("tr95t.cns", 2, True),
                                 ("cl_seq.cns", 6, True),
                                 ("amplicon.cns", 2, False)]:
         cns = cnvlib.read("formats/" + fname)
         # BED
         for show in ("ploidy", "variant", "all"):
             tbl_bed = export.export_bed(cns, ploidy, True, is_f,
                                         cns.sample_id, show)
             if show == "all":
                 self.assertEqual(len(tbl_bed), len(cns),
                                 "{} {}".format(fname, ploidy))
             else:
                 self.assertLess(len(tbl_bed), len(cns))
         # VCF
         _vheader, vcf_body = export.export_vcf(cns, ploidy, True, is_f)
         self.assertTrue(0 < len(vcf_body.splitlines()) < len(cns))