示例#1
0
 def test_mpd(self):
     """Test if mean phylogenetic distance (mpd) is calculated correctly.
     Notes:
      The formula used is found Webb et al. 2002. Paper available at:
      http://www.annualreviews.org/doi/pdf/10.1146/annurev.ecolsys.33.010802.150448
     """
     distmat = array([[0.0, 0.4, 2.0, 1.3], [0.4, 0.0, 1.6, 0.2], [2.0, 1.6, 0.0, 1.1], [1.3, 0.2, 1.1, 0.0]])
     self.assertFloatEqual(6.6 / 6.0, mpd(distmat))
示例#2
0
 def test_mpd(self):
     """Test if mean phylogenetic distance (mpd) is calculated correctly.
     Notes:
      The formula used is found Webb et al. 2002. Paper available at:
      http://www.annualreviews.org/doi/pdf/10.1146/annurev.ecolsys.33.010802.150448
     """
     distmat = array([[0.0, 0.4, 2.0, 1.3], [0.4, 0.0, 1.6, 0.2],
                      [2.0, 1.6, 0.0, 1.1], [1.3, 0.2, 1.1, 0.0]])
     assert_almost_equal(6.6 / 6., mpd(distmat))
示例#3
0
    def test_mpd(self):
        """tests mpd walks through input matrices correctly"""
        #define data
        dist_mat = array([[0, 1, 2, 3, 4], [5, 6, 7, 8, 9],
                          [10, 11, 12, 13, 14], [15, 16, 17, 18, 19],
                          [20, 21, 22, 23, 24]])

        expected_out_m = 8
        actual_out_m = mpd(dist_mat)

        self.assertEqual(expected_out_m, actual_out_m)
示例#4
0
    def test_mpd(self):
        """tests mpd walks through input matrices correctly"""
        #define data
        dist_mat = array([[ 0,  1,  2,  3,  4],
                          [ 5,  6,  7,  8,  9],
                          [10, 11, 12, 13, 14],
                          [15, 16, 17, 18, 19],
                          [20, 21, 22, 23, 24]])

        expected_out_m = 8
        actual_out_m = mpd(dist_mat)

        self.assertEqual(expected_out_m, actual_out_m)