Exemplo n.º 1
0
 def test_different_trees(self):
     np.random.seed(1234)  # remove randomness for sake of testing p-value
     coeff, p_value, n = compare_tip_to_tip_distances(self.tree1,
                                                      self.tree2)
     self.assertAlmostEqual(coeff, 0.59603956067926978)
     self.assertAlmostEqual(p_value, 0.69599999999999995)
     self.assertEqual(n, 3)
Exemplo n.º 2
0
 def test_different_trees(self):
     np.random.seed(1234)  # remove randomness for sake of testing p-value
     coeff, p_value, n = compare_tip_to_tip_distances(self.tree1,
                                                      self.tree2)
     self.assertAlmostEqual(coeff, 0.59603956067926978)
     self.assertAlmostEqual(p_value, 0.69599999999999995)
     self.assertEqual(n, 3)
Exemplo n.º 3
0
def tip_to_tip_distances(output_dir: str, tree_1: NewickFormat,
                         tree_2: NewickFormat,
                         method: str=_ghost_tree_defaults['method']):

    tree1_fh = tree_1.open()
    tree2_fh = tree_2.open()

    stats_results = compare_tip_to_tip_distances(
        tree1_fh, tree2_fh, method)

    data_dict = {
        'Correlation Coefficient': str(round(stats_results[0], 5)),
        'p-value': str(stats_results[1]),
        'Number of Overlapping Tips': str(stats_results[2]),
    }

    df = pd.Series(data=data_dict).to_frame()
    df.columns = ['Tree Comparison Statistics']

    index = os.path.join(output_dir, 'index.html')
    with open(index, 'w') as fh:
        fh.write(df.to_html())
Exemplo n.º 4
0
 def test_same_trees(self):
     np.random.seed(1234)  # remove randomness for sake of testing p-value
     result = compare_tip_to_tip_distances(self.tree1, self.tree1_copy)
     self.assertEqual(result, (1.0, 0.042, 4))
Exemplo n.º 5
0
 def test_same_trees(self):
     np.random.seed(1234)  # remove randomness for sake of testing p-value
     result = compare_tip_to_tip_distances(self.tree1, self.tree1_copy)
     self.assertEqual(result, (1.0, 0.042, 4))