X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fschemes%2FResidueProperties.java;h=aecce4bd22c830e4b3006bdcc7c5f15a13426b45;hb=5ba9b9ce2c9b6e887430d4ac80efde577ca434d4;hp=d360995e57a15d37ad99bc4a41fb44e77893301f;hpb=7a8bd034d39520a7bc471f09f95ec28e6208275e;p=jalview.git
diff --git a/src/jalview/schemes/ResidueProperties.java b/src/jalview/schemes/ResidueProperties.java
index d360995..aecce4b 100755
--- a/src/jalview/schemes/ResidueProperties.java
+++ b/src/jalview/schemes/ResidueProperties.java
@@ -1,6 +1,6 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
- * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.0b1)
+ * Copyright (C) 2014 The Jalview Authors
*
* This file is part of Jalview.
*
@@ -14,17 +14,20 @@
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Jalview. If not, see .
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
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 scoreMatrices = new Hashtable();
// Stores residue codes/names and colours and other things
public static final int[] aaIndex; // aaHash version 2.1.1 and below
@@ -1415,6 +1418,45 @@ public class ResidueProperties
propHash.put("proline", proline);
propHash.put("polar", polar);
}
+ static
+ {
+ int[][][] propMatrix = new int[3][maxProteinIndex][maxProteinIndex];
+ for (int i=0;i en= (Enumeration)propHash.keys(); en.hasMoreElements(); )
+ {
+ String ph = en.nextElement();
+ Map pph=(Map)propHash.get(ph);
+ propMatrix[0][i][j]+= pph.get(ic).equals(pph.get(jc)) ? pph.get(ic) : -1;
+ propMatrix[1][i][j]+= pph.get(ic).equals(pph.get(jc)) ? 1 : -1;
+ propMatrix[2][i][j]+= pph.get(ic).equals(pph.get(jc)) ? pph.get(ic)*2 : 0;
+ }
+ }
+ }
+
+ scoreMatrices.put("Conservation Pos", new ScoreMatrix("Conservation Pos",propMatrix[0],0));
+ scoreMatrices.put("Conservation Both", new ScoreMatrix("Conservation Both",propMatrix[1],0));
+ scoreMatrices.put("Conservation EnhPos", new ScoreMatrix("Conservation EnhPos",propMatrix[2],0));
+ scoreMatrices.put("PID", new PIDScoreModel());
+ }
private ResidueProperties()
{
@@ -1539,12 +1581,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)
{
@@ -1606,7 +1658,7 @@ public class ResidueProperties
public static Hashtable toRNAssState;
static
{
- toRNAssState = new Hashtable();
+ toRNAssState = new Hashtable();
toRNAssState.put(")", "(");
toRNAssState.put("(", "(");
toRNAssState.put("]", "[");
@@ -1623,14 +1675,14 @@ public class ResidueProperties
toRNAssState.put("c", "C");
toRNAssState.put("D", "D");
toRNAssState.put("d", "D");
- toRNAssState.put("1", "1");
- toRNAssState.put("e", "1");
+ toRNAssState.put("E", "E");
+ toRNAssState.put("e", "E");
toRNAssState.put("F", "F");
toRNAssState.put("f", "F");
toRNAssState.put("G", "G");
toRNAssState.put("g", "G");
- toRNAssState.put("2", "2");
- toRNAssState.put("h", "2");
+ toRNAssState.put("H", "H");
+ toRNAssState.put("h", "H");
toRNAssState.put("I", "I");
toRNAssState.put("i", "I");
toRNAssState.put("J", "J");