JAL-2416 removed DNA and PAM250 matrices from ResidueProperties
[jalview.git] / src / jalview / analysis / AlignSeq.java
index f623a96..61ff012 100755 (executable)
@@ -20,6 +20,7 @@
  */
 package jalview.analysis;
 
+import jalview.analysis.scoremodels.PairwiseSeqScoreModel;
 import jalview.analysis.scoremodels.ScoreMatrix;
 import jalview.analysis.scoremodels.ScoreModels;
 import jalview.datamodel.AlignmentAnnotation;
@@ -117,7 +118,10 @@ public class AlignSeq
 
   int gapExtend = 20;
 
-  float[][] lookup = ResidueProperties.getBLOSUM62();
+  float[][] lookup = ((ScoreMatrix) ScoreModels.getInstance().forName(
+          ScoreModels.BLOSUM62)).getMatrix();
+
+  // ResidueProperties.getBLOSUM62();
 
   String[] intToStr = pep;
 
@@ -600,6 +604,9 @@ public class AlignSeq
             .append(String.valueOf(s2str.length())).append(")")
             .append(NEWLINE).append(NEWLINE);
 
+    PairwiseSeqScoreModel pam250 = (PairwiseSeqScoreModel) ScoreModels
+            .getInstance().forName(ScoreModels.PAM250);
+
     for (int j = 0; j < nochunks; j++)
     {
       // Print the first aligned sequence
@@ -616,25 +623,27 @@ public class AlignSeq
       output.append(NEWLINE);
       output.append(new Format("%" + (maxid) + "s").form(" ")).append(" ");
 
-      // Print out the matching chars
+      /*
+       * Print out the match symbols:
+       * | for exact match (ignoring case)
+       * . if PAM250 score is positive
+       * else a space
+       */
       for (int i = 0; i < len; i++)
       {
         if ((i + (j * len)) < astr1.length())
         {
-          boolean sameChar = Comparison.isSameResidue(
-                  astr1.charAt(i + (j * len)), astr2.charAt(i + (j * len)),
-                  false);
-          if (sameChar
-                  && !jalview.util.Comparison.isGap(astr1.charAt(i
-                          + (j * len))))
+          char c1 = astr1.charAt(i + (j * len));
+          char c2 = astr2.charAt(i + (j * len));
+          boolean sameChar = Comparison.isSameResidue(c1, c2, false);
+          if (sameChar && !Comparison.isGap(c1))
           {
             pid++;
             output.append("|");
           }
           else if (type.equals("pep"))
           {
-            if (ResidueProperties.getPAM250(astr1.charAt(i + (j * len)),
-                    astr2.charAt(i + (j * len))) > 0)
+            if (pam250.getPairwiseScore(c1, c2) > 0)
             {
               output.append(".");
             }