diff --git a/solventmapcreator/test/clusteringanalysistest/clustercalculationtest.py b/solventmapcreator/test/clusteringanalysistest/clustercalculationtest.py index 182541cd855925b011fbae9143fdb805f63bf81b..e0e13efafb8179111ac63ee779bd62fd9b00a81e 100644 --- a/solventmapcreator/test/clusteringanalysistest/clustercalculationtest.py +++ b/solventmapcreator/test/clusteringanalysistest/clustercalculationtest.py @@ -31,78 +31,78 @@ class ClusterCalculationTestCase(unittest.TestCase): """Test to see if expected clustering matrix is produced for Ward linkages. """ - expected_linkage_matrix = np.array([[0., 1., 17. , 2. ], - [ 4. , 5. , 23.459184, 3. ], - [ 2. , 3. , 28. , 2. ], - [ 6. , 7. , 43.875582, 5. ]]) + expected_linkage_matrix = np.array([[0., 1., 17., 2.], + [4., 5., 23.459184, 3.], + [2., 3., 28., 2.], + [6., 7., 43.875582, 5.]]) actual_matrix = clustercalculation.ward_clustering(self.example_distance_matrix) np.testing.assert_array_almost_equal(expected_linkage_matrix, actual_matrix) def test_wpgmc_clustering(self): """Test to see if expected clustering matrix is produced for WPGMC linkages. """ - expected_linkage_matrix = np.array([[ 0. , 1. , 17. , 2. ], - [4. , 5. , 20.31625 , 3. ], - [ 2. , 3. , 28. , 2. ], - [ 6. , 7. , 30.650245, 5. ]]) + expected_linkage_matrix = np.array([[0., 1., 17., 2.], + [4., 5., 20.31625, 3.], + [2., 3., 28., 2.], + [6., 7., 30.650245, 5.]]) actual_matrix = clustercalculation.wpgmc_clustering(self.example_distance_matrix) np.testing.assert_array_almost_equal(expected_linkage_matrix, actual_matrix) def test_upgmc_clustering(self): """Test to see if expected clustering matrix is produced for UPGMC linkages. """ - expected_linkage_matrix = np.array([[ 0. , 1. , 17. , 2. ], - [ 4. , 5. , 20.31625 , 3. ], - [ 2. , 3. , 28. , 2. ], - [ 6. , 7. , 28.321566, 5. ]]) + expected_linkage_matrix = np.array([[0., 1., 17., 2.], + [4., 5., 20.31625, 3.], + [2., 3., 28., 2.], + [6., 7., 28.321566, 5.]]) actual_matrix = clustercalculation.upgmc_clustering(self.example_distance_matrix) np.testing.assert_array_almost_equal(expected_linkage_matrix, actual_matrix) def test_wpgma_clustering(self): """Test to see if expected clustering matrix is produced for average/UPGMA linkages. """ - expected_linkage_matrix = np.array([[ 0., 1., 17., 2.], - [ 4., 5., 22., 3.], - [ 2., 3., 28., 2.], - [ 6., 7., 35., 5.]]) + expected_linkage_matrix = np.array([[0., 1., 17., 2.], + [4., 5., 22., 3.], + [2., 3., 28., 2.], + [6., 7., 35., 5.]]) actual_matrix = clustercalculation.wpgma_clustering(self.example_distance_matrix) np.testing.assert_array_almost_equal(expected_linkage_matrix, actual_matrix) def test_upgma_clustering(self): """Test to see if expected clustering matrix is produced for average/UPGMA linkages. """ - expected_linkage_matrix = np.array([[ 0., 1., 17., 2.], - [ 4., 5., 22., 3.], - [ 2., 3., 28., 2.], - [ 6., 7., 33., 5.]]) + expected_linkage_matrix = np.array([[0., 1., 17., 2.], + [4., 5., 22., 3.], + [2., 3., 28., 2.], + [6., 7., 33., 5.]]) actual_matrix = clustercalculation.upgma_clustering(self.example_distance_matrix) np.testing.assert_array_almost_equal(expected_linkage_matrix, actual_matrix) def test_max_clustering(self): """Test to see if expected clustering matrix is produced for maximum linkages. """ - expected_linkage_matrix = np.array([[ 0., 1., 17., 2.], - [ 4., 5., 23., 3.], - [ 2., 3., 28., 2.], - [ 6., 7., 43., 5.]]) + expected_linkage_matrix = np.array([[0., 1., 17., 2.], + [4., 5., 23., 3.], + [2., 3., 28., 2.], + [6., 7., 43., 5.]]) actual_matrix = clustercalculation.max_clustering(self.example_distance_matrix) np.testing.assert_array_almost_equal(expected_linkage_matrix, actual_matrix) def test_min_clustering(self): """Test to see if expected clustering matrix is produced for minimum linkages. """ - expected_linkage_matrix = np.array([[ 0., 1., 17., 2.], - [ 2., 5., 21., 3.], - [ 4., 6., 21., 4.], - [ 3., 7., 28., 5.]]) + expected_linkage_matrix = np.array([[0., 1., 17., 2.], + [2., 5., 21., 3.], + [4., 6., 21., 4.], + [3., 7., 28., 5.]]) actual_matrix = clustercalculation.min_clustering(self.example_distance_matrix) np.testing.assert_array_almost_equal(expected_linkage_matrix, actual_matrix) def test_calculate_clustering(self): """Test to see if expected clustering matrix is produced. """ - expected_linkage_matrix = np.array([[ 0., 1., 17., 2.], - [ 4., 5., 22., 3.], - [ 2., 3., 28., 2.], - [ 6., 7., 33., 5.]]) + expected_linkage_matrix = np.array([[0., 1., 17., 2.], + [4., 5., 22., 3.], + [2., 3., 28., 2.], + [6., 7., 33., 5.]]) actual_matrix = clustercalculation.calculate_clustering(self.example_distance_matrix, "average") np.testing.assert_array_almost_equal(expected_linkage_matrix, actual_matrix) \ No newline at end of file