JAL-1632 JAL-2416 load score matrices from file, as float[][]
[jalview.git] / src / jalview / analysis / PCA.java
index ace4ca4..87ec922 100755 (executable)
@@ -1,6 +1,6 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
- * Copyright (C) 2015 The Jalview Authors
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
  * 
  * This file is part of Jalview.
  * 
  */
 package jalview.analysis;
 
+import jalview.analysis.scoremodels.ScoreMatrix;
+import jalview.analysis.scoremodels.ScoreModels;
 import jalview.datamodel.BinarySequence;
 import jalview.datamodel.BinarySequence.InvalidSequenceTypeException;
 import jalview.math.Matrix;
-import jalview.schemes.ResidueProperties;
-import jalview.schemes.ScoreMatrix;
 
 import java.io.PrintStream;
 
@@ -94,14 +94,14 @@ public class PCA implements Runnable
     String sm = s_m;
     if (sm != null)
     {
-      smtrx = ResidueProperties.getScoreMatrix(sm);
+      smtrx = (ScoreMatrix) ScoreModels.getInstance().forName(sm);
     }
     if (smtrx == null)
     {
       // either we were given a non-existent score matrix or a scoremodel that
       // isn't based on a pairwise symbol score matrix
-      smtrx = ResidueProperties.getScoreMatrix(sm = (nucleotides ? "DNA"
-              : "BLOSUM62"));
+      smtrx = (ScoreMatrix) ScoreModels.getInstance().forName(
+              sm = (nucleotides ? "DNA" : "BLOSUM62"));
     }
     details.append("PCA calculation using " + sm
             + " sequence similarity matrix\n========\n\n");
@@ -144,8 +144,8 @@ public class PCA implements Runnable
     // System.out.println("Created array");
     // printMemory(rt);
     // System.out.println(" --- Original matrix ---- ");
-    m = new Matrix(seqmat, count, bs[0].getDBinary().length);
-    m2 = new Matrix(seqmat2, count, bs2[0].getDBinary().length);
+    m = new Matrix(seqmat);
+    m2 = new Matrix(seqmat2);
 
   }
 
@@ -252,15 +252,18 @@ public class PCA implements Runnable
   /**
    * DOCUMENT ME!
    */
+  @Override
   public void run()
   {
     PrintStream ps = new PrintStream(System.out)
     {
+      @Override
       public void print(String x)
       {
         details.append(x);
       }
 
+      @Override
       public void println()
       {
         details.append("\n");