Beispiel #1
0
	def test_p1_Fetch(self):
		m5 = Meth5py(self.mr, self.fa, n_cores=1, verbose=True)
		self.assertTrue(all(m5.fetch('Chr1', 10, 10)[0] == [2,0,10,20,1,1]))
		self.assertTrue(all(m5.fetch('Chr1', end=1)[0] == [-1]*6))
		self.assertTrue(all(map(all, m5.fetch('Chr1', 10, 11) == [[2,0,10,20,1,1],[2,0,12,20,1,1]])))
		# All regions with no reads
		self.assertTrue(all(map(all, m5.fetch('Chr1', 1, 9) == [[-1]*6]*9)))
		self.assertTrue(all(map(all, m5.fetch('Chr1', 19,20) == [[-1]*6]*2)))
		self.assertTrue(all(map(all, m5.fetch('Chr2', 1,5) == [[-1]*6]*5)))
		self.assertTrue(all(map(all, m5.fetch('Chr2', 9,9) == [[-1]*6]*1)))
		self.assertTrue(all(map(all, m5.fetch('Chr2', 11,11) == [[-1]*6]*1)))
		self.assertTrue(all(map(all, m5.fetch('Chr2', 13,14) == [[-1]*6]*2)))
		self.assertTrue(all(map(all, m5.fetch('Chr2', 16,16) == [[-1]*6]*1)))
		self.assertTrue(all(map(all, m5.fetch('Chr2', 19,20) == [[-1]*6]*2)))
		m5.close()
Beispiel #2
0
 def __init__(self,
              fasta_file,
              meth_file,
              gff3_file='',
              quality=-1,
              ploidy=2,
              out_dim=len(gff3_f2i) + 2,
              stateful=False):
     self.fasta_file = fasta_file
     self.FA = FastaFile(fasta_file)
     self.meth_file = meth_file
     self.M5 = False if stateful else Meth5py(meth_file, fasta_file)
     self.gff3_file = gff3_file
     if gff3_file:
         self.GI = gff3_interval(gff3_file, out_dim=out_dim)
     self.RC = refcache(fasta_file)
     self.quality = quality
     self.ploidy = ploidy
     self.out_dim = out_dim
     if stateful:
         self.pool = mp.Pool(4, slicer_init, (self.fasta_file, self.meth_file, \
            self.gff3_file, self.quality, self.ploidy, self.out_dim))
     else:
         self.pool = False
Beispiel #3
0
	def test_p1_FaiReader(self):
		m5 = Meth5py(self.mr, self.fa, n_cores=1, verbose=True)
		self.assertEqual(m5.sorted_chroms, ['Chr1','Chr2'])
		self.assertEqual(m5.chrom_dict, {'Chr1':20, 'Chr2':20})
		m5.close()
Beispiel #4
0
	def test_p1_IndexCreation(self):
		m5 = Meth5py(self.mr, self.fa, n_cores=1, verbose=True)
		m5.close()