Example #1
0
 def test_set_kmer2weight(self):
     kmer2weight = defaultdict(int)
     pwm = self.minimal_pwm()
     cw = CountsWeighter(k=2)
     for kmer in ("".join(p) for p in product("AGTC", repeat=2)):
         cw.set_kmer2weight(kmer2weight, pwm, kmer, kmer, 2)
     assert kmer2weight["AA"] == (0.5 * 0.5) + (0.5 * 0.95)
     assert kmer2weight["GG"] == (0.1 * 0.2) + (0.2 * 0.05)
     assert kmer2weight["CC"] == (0.1 * 0.3) + (0.3 * 0)
     assert kmer2weight["AG"] == (0.5 * 0.2) + (0.5 * 0.05)
     assert len(kmer2weight) == 16
Example #2
0
 def test_set_kmer2weight(self):
     kmer2weight = defaultdict(int)
     pwm = self.minimal_pwm()
     cw = CountsWeighter(k=2)
     for kmer in (''.join(p) for p in product('AGTC', repeat=2)):
         cw.set_kmer2weight(kmer2weight, pwm, kmer, kmer, 2)
     assert kmer2weight['AA'] == (.5 * .5) + (.5 * .95)
     assert kmer2weight['GG'] == (.1 * .2) + (.2 * .05)
     assert kmer2weight['CC'] == (.1 * .3) + (.3 * 0)
     assert kmer2weight['AG'] == (.5 * .2) + (.5 * 0.05)
     assert len(kmer2weight) == 16