X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fanalysis%2Fscoremodels%2FScoreMatrix.java;h=e2c14e91e590cff8a69b98a08ff588702a228b31;hb=ae783be4cfa1df7fd59a4d0895df8bd1534d334c;hp=84e91aebc3c555aba5efc0dad30cb6533b4c9b27;hpb=2a9d6da50bb346c1f8cd38f104c958b7e8e6eff0;p=jalview.git diff --git a/src/jalview/analysis/scoremodels/ScoreMatrix.java b/src/jalview/analysis/scoremodels/ScoreMatrix.java index 84e91ae..e2c14e9 100644 --- a/src/jalview/analysis/scoremodels/ScoreMatrix.java +++ b/src/jalview/analysis/scoremodels/ScoreMatrix.java @@ -38,6 +38,13 @@ public class ScoreMatrix implements SimilarityScoreModelI, PairwiseScoreModelI { /* + * an arbitrary score to assign for identity of an unknown symbol + * (this is the value on the diagonal in the * column of the NCBI matrix) + * (though a case could be made for using the minimum diagonal value) + */ + private static final int UNKNOWN_IDENTITY_SCORE = 1; + + /* * this fields records which gap character (if any) is used in the alphabet; * space, dash or dot are recognised as gap symbols */ @@ -289,8 +296,9 @@ public class ScoreMatrix implements SimilarityScoreModelI, } /** - * Returns the pairwise score for substituting c with d, or zero if c or d is - * an unscored or unexpected character + * Returns the pairwise score for substituting c with d. If either c or d is + * an unexpected character, returns 1 for identity (c == d), else the minimum + * score value in the matrix. */ @Override public float getPairwiseScore(char c, char d) @@ -315,10 +323,11 @@ public class ScoreMatrix implements SimilarityScoreModelI, /* * one or both symbols not found in the matrix - * note: a possible strategy here would be to return the minimum - * matrix value if c != d + * currently scoring as 1 (for identity) or the minimum + * matrix score value (otherwise) + * (a case could be made for using minimum row/column value instead) */ - return 0; + return c == d ? UNKNOWN_IDENTITY_SCORE : getMinimumScore(); } /**