X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fschemes%2FResidueProperties.java;h=2050147453381a354c07b4c2a292a1f222cff6ad;hb=b2f9a8d7bce642ff4011bc6d49e02bb0569fbb11;hp=bfff972a438a27da3ea5e461f2f7ea61c3ea5286;hpb=c4b3f11eeec8b3d01027d251054b8390ed4deae2;p=jalview.git diff --git a/src/jalview/schemes/ResidueProperties.java b/src/jalview/schemes/ResidueProperties.java index bfff972..2050147 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.1) + * 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) {