JAL-1473 refactor score matrices and tree score calculations to interface/api and...
[jalview.git] / src / jalview / schemes / ResidueProperties.java
index 9acfc24..98be0c8 100755 (executable)
  */
 package jalview.schemes;
 
+import jalview.analysis.scoremodels.PIDScoreModel;
+import jalview.api.analysis.ScoreModelI;
+
 import java.util.*;
 import java.util.List;
-
 import java.awt.*;
 
 public class ResidueProperties
 {
-  public static Hashtable scoreMatrices = new Hashtable();
+  public static Hashtable<String,ScoreModelI> scoreMatrices = new Hashtable();
 
   // Stores residue codes/names and colours and other things
   public static final int[] aaIndex; // aaHash version 2.1.1 and below
@@ -1416,6 +1418,10 @@ public class ResidueProperties
     propHash.put("proline", proline);
     propHash.put("polar", polar);
   }
+  static
+  {
+    scoreMatrices.put("PID", new PIDScoreModel());
+  }
 
   private ResidueProperties()
   {
@@ -1540,12 +1546,22 @@ public class ResidueProperties
   public static ScoreMatrix getScoreMatrix(String pwtype)
   {
     Object val = scoreMatrices.get(pwtype);
-    if (val != null)
+    if (val != null && val instanceof ScoreMatrix)
     {
       return (ScoreMatrix) val;
     }
     return null;
   }
+  /**
+   * get a ScoreModel based on its string name
+   * 
+   * @param pwtype
+   * @return scoremodel of type pwtype or null
+   */
+  public static ScoreModelI getScoreModel(String pwtype)
+  {
+    return scoreMatrices.get(pwtype);
+  }
 
   public static int getPAM250(char c, char d)
   {