コード例 #1
0
 def test_fast_unifrac_whole_tree(self):
     """ should correctly compute one p-val for whole tree """
     # "should test with fake permutation but using same as old envs nodefor now"
     result = []
     num_to_do = 10
     for i in range(num_to_do):
         real_ufracs, sim_ufracs = fast_unifrac_whole_tree(self.old_t, \
             self.old_env_counts, 1000, permutation_f=permutation)
         rawp, corp = mcarlo_sig(sum(real_ufracs), [sum(x) for x in \
             sim_ufracs], 1, tail='high')
         result.append(rawp)
     self.assertSimilarMeans(result, 0.047)
コード例 #2
0
 def test_mcarlo_sig(self):
     """test_mcarlo_sig should calculate monte carlo sig high/low"""
     self.assertEqual(mcarlo_sig(.5, self.mc_1, 1, 'high'), (5.0/10, 5.0/10))
     self.assertEqual(mcarlo_sig(.5, self.mc_1, 1, 'low'), (4.0/10, 4.0/10))
     self.assertEqual(mcarlo_sig(.5, self.mc_1, 5, 'high'), (5.0/10, 1.0))
     self.assertEqual(mcarlo_sig(.5, self.mc_1, 5, 'low'), (4.0/10, 1.0))
     self.assertEqual(mcarlo_sig(0, self.mc_1, 1, 'low'), (0.0, "<=%.1e" % (1.0/10)))
     self.assertEqual(mcarlo_sig(100, self.mc_1, 10, 'high'), (0.0, "<=%.1e" % (1.0/10)))
コード例 #3
0
 def test_mcarlo_sig(self):
     """test_mcarlo_sig should calculate monte carlo sig high/low"""
     self.assertEqual(mcarlo_sig(.5, self.mc_1, 1, 'high'), (5.0/10, 5.0/10))
     self.assertEqual(mcarlo_sig(.5, self.mc_1, 1, 'low'), (4.0/10, 4.0/10))
     self.assertEqual(mcarlo_sig(.5, self.mc_1, 5, 'high'), (5.0/10, 1.0))
     self.assertEqual(mcarlo_sig(.5, self.mc_1, 5, 'low'), (4.0/10, 1.0))
     self.assertEqual(mcarlo_sig(0, self.mc_1, 1, 'low'), (0.0, "<=%.1e" % (1.0/10)))
     self.assertEqual(mcarlo_sig(100, self.mc_1, 10, 'high'), (0.0, "<=%.1e" % (1.0/10)))