Merge branch 'develop' into bug/JAL-1608createGroups
[jalview.git] / src / jalview / viewmodel / PCAModel.java
index 55e7300..0623dab 100644 (file)
@@ -30,6 +30,13 @@ import java.util.Vector;
 
 public class PCAModel
 {
+  /*
+   * Jalview 2.10.1 treated gaps as X (peptide) or N (nucleotide)
+   * for pairwise scoring; 2.10.2 uses gap score (last column) in
+   * score matrix (JAL-2397)
+   * Set this flag to true (via Groovy) for 2.10.1 behaviour
+   */
+  private static boolean scoreGapAsAny = false;
 
   public PCAModel(AlignmentView seqstrings2, SequenceI[] seqs2,
           boolean nucleotide2)
@@ -69,7 +76,8 @@ public class PCAModel
 
   public void run()
   {
-    String[] sequenceStrings = seqstrings.getSequenceStrings(' ');
+    char gapChar = scoreGapAsAny ? (nucleotide ? 'N' : 'X') : ' ';
+    String[] sequenceStrings = seqstrings.getSequenceStrings(gapChar);
     pca = new PCA(sequenceStrings, nucleotide,
             score_matrix);
     pca.setJvCalcMode(jvCalcMode);