JAL-2403 JAL-2416 pairwise score unexpected symbols as minimum matrix
[jalview.git] / src / jalview / analysis / scoremodels / ScoreMatrix.java
index 84e91ae..7e07b9f 100644 (file)
@@ -289,8 +289,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 +316,8 @@ 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
      */
-    return 0;
+    return c == d ? 1 : getMinimumScore();
   }
 
   /**