From 43dc9a8834f510a1cfe20d1a1346635e4c0b47b2 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Mon, 27 Mar 2017 11:02:47 +0100 Subject: [PATCH] JAL-2403 SWDistanceModel now SmithWatermanModel - a similarity model --- ...WDistanceModel.java => SmithWatermanModel.java} | 22 ++++++++------------ 1 file changed, 9 insertions(+), 13 deletions(-) rename src/jalview/analysis/scoremodels/{SWDistanceModel.java => SmithWatermanModel.java} (85%) 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 -- 1.7.10.2