X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fanalysis%2Fscoremodels%2FPIDModelTest.java;fp=test%2Fjalview%2Fanalysis%2Fscoremodels%2FPIDModelTest.java;h=e8ffd2f691eca7ce389c34dbe5884e4da054a965;hb=74393b51f368cb9f58589472d432a433d9c4386d;hp=212f825b9e24c6e4e235c6d76b525af890d9bd26;hpb=7a0d503181fe41452120a8a02ca63476392aa08c;p=jalview.git diff --git a/test/jalview/analysis/scoremodels/PIDModelTest.java b/test/jalview/analysis/scoremodels/PIDModelTest.java index 212f825..e8ffd2f 100644 --- a/test/jalview/analysis/scoremodels/PIDModelTest.java +++ b/test/jalview/analysis/scoremodels/PIDModelTest.java @@ -44,6 +44,8 @@ public class PIDModelTest double newScore = PIDModel.computePID(s1, s2, params); double oldScore = Comparison.PID(s1, s2); assertEquals(newScore, oldScore, DELTA); + // and verify PIDModel calculation is symmetric + assertEquals(newScore, PIDModel.computePID(s2, s1, params)); /* * same length, with gaps @@ -54,6 +56,7 @@ public class PIDModelTest newScore = PIDModel.computePID(s1, s2, params); oldScore = Comparison.PID(s1, s2); assertEquals(newScore, oldScore, DELTA); + assertEquals(newScore, PIDModel.computePID(s2, s1, params)); /* * s2 longer than s1, with gaps @@ -64,6 +67,7 @@ public class PIDModelTest newScore = PIDModel.computePID(s1, s2, params); oldScore = Comparison.PID(s1, s2); assertEquals(newScore, oldScore, DELTA); + assertEquals(newScore, PIDModel.computePID(s2, s1, params)); /* * s1 longer than s2, with gaps @@ -74,6 +78,7 @@ public class PIDModelTest newScore = PIDModel.computePID(s1, s2, params); oldScore = Comparison.PID(s1, s2); assertEquals(newScore, oldScore, DELTA); + assertEquals(newScore, PIDModel.computePID(s2, s1, params)); /* * same but now also with gapped columns @@ -84,6 +89,7 @@ public class PIDModelTest newScore = PIDModel.computePID(s1, s2, params); oldScore = Comparison.PID(s1, s2); assertEquals(newScore, oldScore, DELTA); + assertEquals(newScore, PIDModel.computePID(s2, s1, params)); } /** @@ -102,6 +108,7 @@ public class PIDModelTest */ SimilarityParamsI params = new SimilarityParams(true, true, true, true); assertEquals(PIDModel.computePID(s1, s2, params), 80d); + assertEquals(PIDModel.computePID(s2, s1, params), 80d); /* * match gap-char but not gap-gap @@ -109,6 +116,7 @@ public class PIDModelTest */ params = new SimilarityParams(false, true, true, true); assertEquals(PIDModel.computePID(s1, s2, params), 75d); + assertEquals(PIDModel.computePID(s2, s1, params), 75d); /* * include gaps but don't match them @@ -117,6 +125,7 @@ public class PIDModelTest */ params = new SimilarityParams(true, false, true, true); assertEquals(PIDModel.computePID(s1, s2, params), 40d); + assertEquals(PIDModel.computePID(s2, s1, params), 40d); /* * include gaps but don't match them @@ -125,6 +134,7 @@ public class PIDModelTest */ params = new SimilarityParams(false, false, true, true); assertEquals(PIDModel.computePID(s1, s2, params), 25d); + assertEquals(PIDModel.computePID(s2, s1, params), 25d); } /** @@ -144,6 +154,7 @@ public class PIDModelTest */ SimilarityParamsI params = new SimilarityParams(true, true, true, false); assertEquals(PIDModel.computePID(s1, s2, params), 500d / 6); + assertEquals(PIDModel.computePID(s2, s1, params), 500d / 6); /* * match gap-char but not gap-gap @@ -151,6 +162,7 @@ public class PIDModelTest */ params = new SimilarityParams(false, true, true, false); assertEquals(PIDModel.computePID(s1, s2, params), 80d); + assertEquals(PIDModel.computePID(s2, s1, params), 80d); /* * include gaps but don't match them @@ -159,6 +171,7 @@ public class PIDModelTest */ params = new SimilarityParams(true, false, true, false); assertEquals(PIDModel.computePID(s1, s2, params), 100d / 3); + assertEquals(PIDModel.computePID(s2, s1, params), 100d / 3); /* * include gaps but don't match them @@ -167,6 +180,7 @@ public class PIDModelTest */ params = new SimilarityParams(false, false, true, false); assertEquals(PIDModel.computePID(s1, s2, params), 20d); + assertEquals(PIDModel.computePID(s2, s1, params), 20d); /* * no tests for matchGaps=true, includeGaps=false