+
+
+ /**
+ * Verify computed distances of sequences with gap
+ */
+ @Test(groups = "Functional")
+ public void testFindDistances_withSSUndefinedInEitherOneSeq()
+ {
+ AlignFrame af = setupAlignmentViewWithoutSS("either");
+ AlignViewport viewport = af.getViewport();
+ AlignmentView view = viewport.getAlignmentView(false);
+
+ ScoreModelI sm = new SecondaryStructureDistanceModel();
+ sm = ScoreModels.getInstance().getScoreModel(sm.getName(),
+ af.alignPanel);
+
+ /*
+ * feature distance model always normalises by region width
+ * gap-gap is always included (but scores zero)
+ * the only variable parameter is 'includeGaps'
+ */
+
+ /*
+ * include gaps
+ * score = 0 + 0 + 2 + 2 = 2/4
+ */
+ SimilarityParamsI params = new SimilarityParams(false, true, true, true);
+ MatrixI distances = sm.findDistances(view, params);
+ assertEquals(distances.getValue(0, 0), 0d);
+ assertEquals(distances.getValue(1, 1), 0d);
+ assertEquals(distances.getValue(0, 1), 2d);
+ assertEquals(distances.getValue(1, 0), 2d);
+
+ /*
+ * exclude gaps
+ * score = 0 + 0 + 2 + 2 = 2/4
+ */
+
+ SimilarityParamsI params2 = new SimilarityParams(false, true, false, true);
+ MatrixI distances2 = sm.findDistances(view, params2);
+ assertEquals(distances2.getValue(0, 1), 2d);
+ assertEquals(distances2.getValue(1, 0), 2d);
+ }
+
+
+ /**
+ * Verify computed distances of sequences with gap
+ */
+ @Test(groups = "Functional")
+ public void testFindDistances_withSSUndefinedInBothSeqs()
+ {
+ AlignFrame af = setupAlignmentViewWithoutSS("both");
+ AlignViewport viewport = af.getViewport();
+ AlignmentView view = viewport.getAlignmentView(false);
+
+ ScoreModelI sm = new SecondaryStructureDistanceModel();
+ sm = ScoreModels.getInstance().getScoreModel(sm.getName(),
+ af.alignPanel);
+
+ /*
+ * feature distance model always normalises by region width
+ * gap-gap is always included (but scores zero)
+ * the only variable parameter is 'includeGaps'
+ */
+
+ /*
+ * include gaps
+ * score = 0 + 0 + 2 + 2 = 2/4
+ */
+ SimilarityParamsI params = new SimilarityParams(false, true, true, true);
+ MatrixI distances = sm.findDistances(view, params);
+ assertEquals(distances.getValue(0, 0), 0d);
+ assertEquals(distances.getValue(1, 1), 0d);
+ assertEquals(distances.getValue(0, 1), 0d);
+ assertEquals(distances.getValue(1, 0), 0d);
+
+ /*
+ * exclude gaps
+ * score = 0 + 0 + 2 + 2 = 2/4
+ */
+
+ SimilarityParamsI params2 = new SimilarityParams(false, true, false, true);
+ MatrixI distances2 = sm.findDistances(view, params2);
+ assertEquals(distances2.getValue(0, 1), 0d);
+ assertEquals(distances2.getValue(1, 0), 0d);
+ }