def main(): """ main function """ chrom = argv[0] chrom = 'chrT/chrT_A.tsv' chrom = get_matrix(chrom) out = tadbit(chrom, verbose=True, heuristic=True) print('{:>6} ' * len(out[0])).format(*out[0]) print('{:>6.1f} ' * len(out[1])).format(*out[1]) plt.imshow(log2(chrom.T), origin='lower') plt.vlines(out[0], 0, chrom.shape[0]) plt.hlines(out[0], 0, chrom.shape[0]) plt.show() chrom_path = 'chrT/' out_batch = batch_tadbit(chrom_path, n_cpus=1, heuristic=True) print('{:>6} ' * len(out_batch[0])).format(*out_batch[0]) print('{:>6.1f} ' * len(out_batch[1])).format(*out_batch[1]) plt.imshow(log2(chrom.T), origin='lower') plt.vlines(out[0], 0, chrom.shape[0]) plt.hlines(out[0], 0, chrom.shape[0]) plt.vlines(out_batch[0], 0, chrom.shape[0], color='red') plt.hlines(out_batch[0], 0, chrom.shape[0], color='red') plt.show()
def main(): """ main function """ chrom = argv[0] chrom = "chrT/chrT_A.tsv" chrom = get_matrix(chrom) out = tadbit(chrom, verbose=True, heuristic=True) print("{:>6} " * len(out[0])).format(*out[0]) print("{:>6.1f} " * len(out[1])).format(*out[1]) plt.imshow(log2(chrom.T), origin="lower") plt.vlines(out[0], 0, chrom.shape[0]) plt.hlines(out[0], 0, chrom.shape[0]) plt.show() chrom_path = "chrT/" out_batch = batch_tadbit(chrom_path, n_cpus=1, heuristic=True) print("{:>6} " * len(out_batch[0])).format(*out_batch[0]) print("{:>6.1f} " * len(out_batch[1])).format(*out_batch[1]) plt.imshow(log2(chrom.T), origin="lower") plt.vlines(out[0], 0, chrom.shape[0]) plt.hlines(out[0], 0, chrom.shape[0]) plt.vlines(out_batch[0], 0, chrom.shape[0], color="red") plt.hlines(out_batch[0], 0, chrom.shape[0], color="red") plt.show()
def test_02_batch_tadbit(self): global batch_exp batch_exp= batch_tadbit('20Kb/chrT/', max_tad_size=20, verbose=False, no_heuristic=True) breaks = [0, 4, 9, 15, 20, 29, 36, 44, 50, 62, 67, 76, 90, 95] scores = [4.0, 7.0, 3.0, 7.0, 4.0, 4.0, 6.0, 7.0, 10.0, 10.0, 8.0, 9.0, 7.0, None] self.assertEqual(batch_exp['start'], breaks) self.assertEqual(batch_exp['score'], scores)
def test_02_batch_tadbit(self): if ONLY and ONLY != "02": return if CHKTIME: t0 = time() global batch_exp batch_exp = batch_tadbit(PATH + "/20Kb/chrT/", max_tad_size=20, verbose=False, no_heuristic=True) # Breaks and scores with square root normalization. breaks = [0, 4, 14, 19, 34, 39, 44, 50, 62, 67, 72, 90, 95] scores = [4.0, 6.0, 5.0, 5.0, 4.0, 8.0, 5.0, 4.0, 6.0, 5.0, 6.0, 6.0, None] self.assertEqual(batch_exp["start"], breaks) self.assertEqual(batch_exp["score"], scores) if CHKTIME: print "2", time() - t0
def test_02_batch_tadbit(self): if CHKTIME: t0 = time() global batch_exp batch_exp = batch_tadbit(PATH + '/20Kb/chrT/', max_tad_size=20, verbose=False, no_heuristic=True) # Breaks and scores with square root normalization. breaks = [0, 4, 14, 19, 34, 39, 44, 50, 62, 67, 72, 90, 95] scores = [4.0, 6.0, 5.0, 5.0, 4.0, 8.0, 5.0, 4.0, 6.0, 5.0, 6.0, 6.0, None] self.assertEqual(batch_exp['start'], breaks) self.assertEqual(batch_exp['score'], scores) if CHKTIME: print '2', time() - t0
def test_02_batch_tadbit(self): if CHKTIME: t0 = time() global batch_exp batch_exp = batch_tadbit(PATH + '/20Kb/chrT/', max_tad_size=20, verbose=False, no_heuristic=True) # Breaks and scores with square root normalization. #breaks = [0, 4, 9, 15, 20, 29, 36, 44, 50, 62, 67, 76, 90, 95] #scores = [4.0, 7.0, 4.0, 8.0, 4.0, 4.0, 7.0, 7.0, 10.0, 10.0, 9.0, 8.0, 7.0, None] breaks = [0, 4, 14, 19, 34, 44, 50, 62, 67, 72, 90, 95] scores = [4.0, 6.0, 6.0, 6.0, 6.0, 6.0, 5.0, 6.0, 4.0, 6.0, 5.0, None] self.assertEqual(batch_exp['start'], breaks) self.assertEqual(batch_exp['score'], scores) if CHKTIME: print '2', time() - t0
def test_batch_tadbit(self): out = batch_tadbit("chrT/", max_tad_size=20, verbose=False, no_heuristic=True) breaks = [0, 3, 9, 14, 20, 36, 41, 46, 51, 56, 62, 67, 74, 79, 84] scores = [8.0, 10.0, 7.0, 7.0, 5.0, 5.0, 7.0, 7.0, 9.0, 10.0, 10.0, 5.0, 3.0, 6.0, None] self.assertEqual(out["start"], breaks) self.assertEqual(out["score"], scores)