コード例 #1
0
 def test_to_pssm_pseudocount(self):
     """produces a PSSM array with pseudocount"""
     data = array([
         [10, 30, 50, 10],
         [25, 25, 25, 25],
         [5, 80, 0, 10],
         [70, 10, 10, 10],
         [60, 15, 0, 20],
     ])
     marr = MotifCountsArray(array(data), "ACGT")
     adj = data + 1
     got = marr.to_pssm(pseudocount=1)
     freqs = marr._to_freqs(pseudocount=1)
     expect = log2(freqs / 0.25)
     assert_allclose(got.array, expect, atol=1e-3)
コード例 #2
0
 def test_to_pssm(self):
     """produces a PSSM array"""
     data = array([
         [10, 30, 50, 10],
         [25, 25, 25, 25],
         [5, 80, 5, 10],
         [70, 10, 10, 10],
         [60, 15, 5, 20],
     ])
     marr = MotifCountsArray(array(data), "ACGT")
     got = marr.to_pssm()
     expect = array([
         [-1.322, 0.263, 1.0, -1.322],
         [0.0, 0.0, 0.0, 0.0],
         [-2.322, 1.678, -2.322, -1.322],
         [1.485, -1.322, -1.322, -1.322],
         [1.263, -0.737, -2.322, -0.322],
     ])
     assert_allclose(got.array, expect, atol=1e-3)