예제 #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
     cnr = cnvlib.read("formats/tr95t.cns")
     theta_rows = export.export_theta(cnr, None)
     self.assertGreater(len(theta_rows), 0)
     ref = cnvlib.read("formats/reference-tr.cnn")
     theta_rows = export.export_theta(cnr, ref)
     self.assertGreater(len(theta_rows), 0)
     # Formats that calculate 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
         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))
예제 #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
     cnr = cnvlib.read("formats/tr95t.cns")
     theta_rows = export.export_theta(cnr, None)
     self.assertGreater(len(theta_rows), 0)
     ref = cnvlib.read("formats/reference-tr.cnn")
     theta_rows = export.export_theta(cnr, ref)
     self.assertGreater(len(theta_rows), 0)
     # Formats that calculate 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
         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))
예제 #3
0
 def test_export_theta(self):
     """The 'export theta' command."""
     segarr = cnvlib.read("formats/tr95t.cns")
     len_seg_auto = len(segarr.autosomes())
     table_theta = export.export_theta(segarr, None)
     self.assertEqual(len(table_theta), len_seg_auto)
     ref = cnvlib.read("formats/reference-tr.cnn")
     table_theta = export.export_theta(segarr, ref)
     self.assertEqual(len(table_theta), len_seg_auto)
     varr = commands.load_het_snps("formats/na12878_na12882_mix.vcf",
                                   "NA12882", "NA12878", 15, None)
     tumor_snps, normal_snps = export.export_theta_snps(varr)
     self.assertLess(len(tumor_snps), len(varr))
     self.assertGreater(len(tumor_snps), 0)
     self.assertLess(len(normal_snps), len(varr))
     self.assertGreater(len(normal_snps), 0)
예제 #4
0
 def test_export_theta(self):
     """The 'export theta' command."""
     segarr = cnvlib.read("formats/tr95t.cns")
     len_seg_auto = len(segarr.autosomes())
     table_theta = export.export_theta(segarr, None)
     self.assertEqual(len(table_theta), len_seg_auto)
     ref = cnvlib.read("formats/reference-tr.cnn")
     table_theta = export.export_theta(segarr, ref)
     self.assertEqual(len(table_theta), len_seg_auto)
     varr = commands.load_het_snps("formats/na12878_na12882_mix.vcf",
                                   "NA12882", "NA12878", 15, None)
     tumor_snps, normal_snps = export.export_theta_snps(varr)
     self.assertLess(len(tumor_snps), len(varr))
     self.assertGreater(len(tumor_snps), 0)
     self.assertLess(len(normal_snps), len(varr))
     self.assertGreater(len(normal_snps), 0)
예제 #5
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))