JAL-1473 provide Amino acid physicochemical conservation based score matrices
authorJim Procter <jprocter@dundee.ac.uk>
Tue, 15 Apr 2014 15:16:26 +0000 (16:16 +0100)
committerJim Procter <jprocter@dundee.ac.uk>
Mon, 21 Apr 2014 13:09:16 +0000 (14:09 +0100)
src/jalview/schemes/ResidueProperties.java

index 98be0c8..a277868 100755 (executable)
@@ -1420,6 +1420,41 @@ public class ResidueProperties
   }
   static
   {
+    int[][][] propMatrix = new int[3][maxProteinIndex][maxProteinIndex];
+    for (int i=0;i<maxProteinIndex;i++)
+    {
+      String ic="";
+      if (aa.length<i) {
+        ic+=aa[i];
+      }
+      else {ic = "-";}
+      propMatrix[0][i][i]=propHash.size();
+      propMatrix[1][i][i]=propHash.size();
+      propMatrix[2][i][i]=propHash.size();
+      for (int j=i+1;j<maxProteinIndex; j++)
+      {
+        String jc="";
+        if (aa.length<j) {
+          jc+=aa[j];
+        }
+        else {jc = "-";}
+        propMatrix[0][i][j]=0;
+        propMatrix[1][i][j]=0;
+        propMatrix[2][i][j]=0;
+        for (Enumeration<String> en= (Enumeration<String>)propHash.keys(); en.hasMoreElements(); )
+        {
+          String ph = en.nextElement();
+          Map<String,Integer> pph=(Map<String,Integer>)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());
   }