def test_build_weights_dict_minimal(self): pwm = self.minimal_pwm() cw = CountsWeighter(k=2) kmer2weight = cw.build_weights_dict(pwm) 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
def test_build_weights_dict_minimal(self): pwm = self.minimal_pwm() cw = CountsWeighter(k=2) kmer2weight = cw.build_weights_dict(pwm) 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
def test_build_weights_dict_full(self): pwm = pkg_resources.resource_filename("seekr", "tests/data/pwms/M001_0.6.txt") pwm = pd.read_csv(pwm, sep="\t").rename(columns={"U": "T"}).to_dict() cw = CountsWeighter(k=2) kmer2weight = cw.build_weights_dict(pwm) assert kmer2weight["AA"] == 0.9749391864711447 assert kmer2weight["CG"] == 0.00473602191097646 assert kmer2weight["CT"] == 0.1186835711075973 assert kmer2weight["AG"] == 0.02190317370024123 assert len(kmer2weight) == 16
def test_build_weights_dict_full(self): pwm = pkg_resources.resource_filename('seekr', 'tests/data/pwms/M001_0.6.txt') pwm = pd.read_csv(pwm, sep='\t').rename(columns={'U': 'T'}).to_dict() cw = CountsWeighter(k=2) kmer2weight = cw.build_weights_dict(pwm) assert kmer2weight['AA'] == 0.9749391864711447 assert kmer2weight['CG'] == 0.00473602191097646 assert kmer2weight['CT'] == 0.1186835711075973 assert kmer2weight['AG'] == 0.02190317370024123 assert len(kmer2weight) == 16