JAL-2403 SWDistanceModel now SmithWatermanModel - a similarity model
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 27 Mar 2017 10:02:47 +0000 (11:02 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 27 Mar 2017 10:02:47 +0000 (11:02 +0100)
src/jalview/analysis/scoremodels/SmithWatermanModel.java [moved from src/jalview/analysis/scoremodels/SWDistanceModel.java with 85% similarity]

 package jalview.analysis.scoremodels;
 
 import jalview.analysis.AlignSeq;
-import jalview.api.analysis.DistanceScoreModelI;
 import jalview.api.analysis.SimilarityParamsI;
+import jalview.api.analysis.SimilarityScoreModelI;
 import jalview.datamodel.AlignmentView;
 import jalview.datamodel.SequenceI;
 import jalview.math.Matrix;
 import jalview.math.MatrixI;
 import jalview.util.Comparison;
 
-public class SWDistanceModel implements DistanceScoreModelI
+/**
+ * A class that computes pairwise similarity scores using the Smith-Waterman
+ * alignment algorithm
+ */
+public class SmithWatermanModel implements SimilarityScoreModelI
 {
+  private static final String NAME = "Smith Waterman Score";
 
   @Override
-  public MatrixI findDistances(AlignmentView seqData,
+  public MatrixI findSimilarities(AlignmentView seqData,
           SimilarityParamsI options)
   {
     SequenceI[] sequenceString = seqData.getVisibleAlignment(
@@ -61,22 +66,13 @@ public class SWDistanceModel implements DistanceScoreModelI
       }
     }
 
-    for (int i = 0; i < (noseqs - 1); i++)
-    {
-      for (int j = i; j < noseqs; j++)
-      {
-        distances[i][j] = max - distances[i][j];
-        distances[j][i] = distances[i][j];
-      }
-    }
-
     return new Matrix(distances);
   }
 
   @Override
   public String getName()
   {
-    return "Smith Waterman Score";
+    return NAME;
   }
 
   @Override