From: gmungoc Date: Mon, 27 Mar 2017 10:02:47 +0000 (+0100) Subject: JAL-2403 SWDistanceModel now SmithWatermanModel - a similarity model X-Git-Tag: Release_2_10_2~3^2~105^2~2^2~50 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=43dc9a8834f510a1cfe20d1a1346635e4c0b47b2;p=jalview.git JAL-2403 SWDistanceModel now SmithWatermanModel - a similarity model --- diff --git a/src/jalview/analysis/scoremodels/SWDistanceModel.java b/src/jalview/analysis/scoremodels/SmithWatermanModel.java similarity index 85% rename from src/jalview/analysis/scoremodels/SWDistanceModel.java rename to src/jalview/analysis/scoremodels/SmithWatermanModel.java index b27cf26..eec08ed 100644 --- a/src/jalview/analysis/scoremodels/SWDistanceModel.java +++ b/src/jalview/analysis/scoremodels/SmithWatermanModel.java @@ -21,19 +21,24 @@ 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