X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fschemes%2FResidueProperties.java;h=2050147453381a354c07b4c2a292a1f222cff6ad;hb=b2f9a8d7bce642ff4011bc6d49e02bb0569fbb11;hp=9acfc24d7734a4b36d02d689188259508b05e7b4;hpb=865a855a4ca87eadb3e5ff284ed32ed307d9c34b;p=jalview.git diff --git a/src/jalview/schemes/ResidueProperties.java b/src/jalview/schemes/ResidueProperties.java index 9acfc24..2050147 100755 --- a/src/jalview/schemes/ResidueProperties.java +++ b/src/jalview/schemes/ResidueProperties.java @@ -1,5 +1,5 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.0b1) + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.1) * Copyright (C) 2014 The Jalview Authors * * This file is part of Jalview. @@ -18,14 +18,16 @@ */ 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 @@ -1416,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() { @@ -1540,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) {