コード例 #1
0
    def test_compute_q(self):
        expected_data = [[0, -50, -38, -34, -34], [-50, 0, -38, -34, -34],
                         [-38, -38, 0, -40, -40], [-34, -34, -40, 0, -48],
                         [-34, -34, -40, -48, 0]]
        expected_ids = list('abcde')
        expected = DistanceMatrix(expected_data, expected_ids)
        self.assertEqual(_compute_q(self.dm1), expected)

        data = [[0, 3, 2], [3, 0, 3], [2, 3, 0]]
        dm = DistanceMatrix(data, list('abc'))
        # computed this manually
        expected_data = [[0, -8, -8], [-8, 0, -8], [-8, -8, 0]]
        expected = DistanceMatrix(expected_data, list('abc'))
        self.assertEqual(_compute_q(dm), expected)
コード例 #2
0
ファイル: test_nj.py プロジェクト: anderspitman/scikit-bio
    def test_compute_q(self):
        expected_data = [[0, -50, -38, -34, -34],
                         [-50,   0, -38, -34, -34],
                         [-38, -38,   0, -40, -40],
                         [-34, -34, -40,   0, -48],
                         [-34, -34, -40, -48,   0]]
        expected_ids = list('abcde')
        expected = DistanceMatrix(expected_data, expected_ids)
        self.assertEqual(_compute_q(self.dm1), expected)

        data = [[0, 3, 2],
                [3, 0, 3],
                [2, 3, 0]]
        dm = DistanceMatrix(data, list('abc'))
        # computed this manually
        expected_data = [[0, -8, -8],
                         [-8,  0, -8],
                         [-8, -8,  0]]
        expected = DistanceMatrix(expected_data, list('abc'))
        self.assertEqual(_compute_q(dm), expected)
コード例 #3
0
ファイル: test_nj.py プロジェクト: anderspitman/scikit-bio
 def test_lowest_index(self):
     self.assertEqual(_lowest_index(self.dm1), (4, 3))
     self.assertEqual(_lowest_index(_compute_q(self.dm1)), (1, 0))
コード例 #4
0
 def test_lowest_index(self):
     self.assertEqual(_lowest_index(self.dm1), (4, 3))
     self.assertEqual(_lowest_index(_compute_q(self.dm1)), (1, 0))