X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fschemes%2FResidueProperties.java;h=0ca155ac505df91fc5ec9b077f7a2e0edefe56f5;hb=28b416f0fdb491114107ef88f7b60baaca1d00d7;hp=67211cd5434f6a32dc8bb93f4610c7a74a855256;hpb=153dd62dc91da13ae732600e6ea55ddbe15eab39;p=jalview.git diff --git a/src/jalview/schemes/ResidueProperties.java b/src/jalview/schemes/ResidueProperties.java index 67211cd..0ca155a 100755 --- a/src/jalview/schemes/ResidueProperties.java +++ b/src/jalview/schemes/ResidueProperties.java @@ -1,13 +1,13 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6) - * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle + * 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 * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR @@ -30,6 +30,8 @@ public class ResidueProperties public static final int[] nucleotideIndex; + public static final int[] purinepyrimidineIndex; + public static final Hashtable aa3Hash = new Hashtable(); public static final Hashtable aa2Triplet = new Hashtable(); @@ -95,6 +97,16 @@ public class ResidueProperties // extend subt. matrices } + /** + * maximum (gap) index for matrices involving protein alphabet + */ + public final static int maxProteinIndex = 23; + + /** + * maximum (gap) index for matrices involving nucleotide alphabet + */ + public final static int maxNucleotideIndex = 10; + static { nucleotideIndex = new int[255]; @@ -144,6 +156,54 @@ public class ResidueProperties nucleotideName.put("y", "Unknown Pyrimidine"); nucleotideName.put("N", "Unknown"); nucleotideName.put("n", "Unknown"); + nucleotideName.put("W", "Weak nucleotide (A or T)"); + nucleotideName.put("w", "Weak nucleotide (A or T)"); + nucleotideName.put("S", "Strong nucleotide (G or C)"); + nucleotideName.put("s", "Strong nucleotide (G or C)"); + nucleotideName.put("M", "Amino (A or C)"); + nucleotideName.put("m", "Amino (A or C)"); + nucleotideName.put("K", "Keto (G or T)"); + nucleotideName.put("k", "Keto (G or T)"); + nucleotideName.put("B", "Not A (G or C or T)"); + nucleotideName.put("b", "Not A (G or C or T)"); + nucleotideName.put("H", "Not G (A or C or T)"); + nucleotideName.put("h", "Not G (A or C or T)"); + nucleotideName.put("D", "Not C (A or G or T)"); + nucleotideName.put("d", "Not C (A or G or T)"); + nucleotideName.put("V", "Not T (A or G or C"); + nucleotideName.put("v", "Not T (A or G or C"); + + } + + static + { + purinepyrimidineIndex = new int[255]; + for (int i = 0; i < 255; i++) + { + purinepyrimidineIndex[i] = 3; // non-nucleotide symbols are all non-gap + // gaps. + } + + purinepyrimidineIndex['A'] = 0; + purinepyrimidineIndex['a'] = 0; + purinepyrimidineIndex['C'] = 1; + purinepyrimidineIndex['c'] = 1; + purinepyrimidineIndex['G'] = 0; + purinepyrimidineIndex['g'] = 0; + purinepyrimidineIndex['T'] = 1; + purinepyrimidineIndex['t'] = 1; + purinepyrimidineIndex['U'] = 1; + purinepyrimidineIndex['u'] = 1; + purinepyrimidineIndex['I'] = 2; + purinepyrimidineIndex['i'] = 2; + purinepyrimidineIndex['X'] = 2; + purinepyrimidineIndex['x'] = 2; + purinepyrimidineIndex['R'] = 0; + purinepyrimidineIndex['r'] = 0; + purinepyrimidineIndex['Y'] = 1; + purinepyrimidineIndex['y'] = 1; + purinepyrimidineIndex['N'] = 2; + purinepyrimidineIndex['n'] = 2; } static @@ -280,14 +340,22 @@ public class ResidueProperties new Color(235, 65, 60), // G new Color(60, 136, 238), // T new Color(60, 136, 238), // U - Color.white, // I - Color.white, // X + Color.white, // I (inosine) + Color.white, // X (xanthine) Color.white, // R Color.white, // Y Color.white, // N Color.white, // Gap }; + // Added for PurinePyrimidineColourScheme + public static final Color[] purinepyrimidine = + { new Color(255, 131, 250), // A, G, R purines purplish/orchid + new Color(64, 224, 208), // C,U, T, Y pyrimidines turquoise + Color.white, // all other nucleotides + Color.white // Gap + }; + // Zappo public static final Color[] zappo = { Color.pink, // A @@ -514,18 +582,24 @@ public class ResidueProperties * new Color(60, 136, 238), // U Color.white, // I Color.white, // X * Color.white, // R Color.white, // Y Color.white, // N Color.white, // Gap */ + + // JBPNote: patch matrix for T/U equivalence when working with DNA or RNA. + // Will equate sequences if working with mixed nucleotide sets. + // treats T and U identically. R and Y weak equivalence with AG and CTU. + // N matches any other base weakly + // static final int[][] DNA = { - { 10, -8, -8, -8, 1, 0, 0, 0, 0, 0, 1 }, // C - { -8, 10, -8, -8, 1, 0, 0, 0, 0, 0, 1 }, // T - { -8, -8, 10, -8, 1, 0, 0, 0, 0, 0, 1 }, // A - { -8, -8, -8, 10, 1, 0, 0, 0, 0, 0, 1 }, // G - { 1, 1, 1, 1, 10, 0, 0, 0, 0, 0, 1 }, // - - { 1, 1, 1, 1, 1, 10, 0, 0, 0, 0, 1 }, // - - { 1, 1, 1, 1, 1, 0, 10, 0, 0, 0, 1 }, // - - { 1, 1, 1, 1, 1, 0, 0, 10, 0, 0, 1 }, // - - { 1, 1, 1, 1, 1, 0, 0, 0, 10, 0, 1 }, // - - { 1, 1, 1, 1, 1, 0, 0, 0, 0, 10, 1 }, // - + { 10, -8, -8, -8, -8, 1, 1, 1, -8, 1, 1 }, // A + { -8, 10, -8, -8, -8, 1, 1, -8, 1, 1, 1 }, // C + { -8, -8, 10, -8, -8, 1, 1, 1, -8, 1, 1 }, // G + { -8, -8, -8, 10, 10, 1, 1, -8, 1, 1, 1 }, // T + { -8, -8, -8, 10, 10, 1, 1, -8, 1, 1, 1 }, // U + { 1, 1, 1, 1, 1, 10, 0, 0, 0, 1, 1 }, // I + { 1, 1, 1, 1, 1, 0, 10, 0, 0, 1, 1 }, // X + { 1, -8, 1, -8, -8, 0, 0, 10, -8, 1, 1 }, // R + { -8, 1, -8, 1, 1, 0, 0, -8, 10, 1, 1 }, // Y + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 10, 1 }, // N { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, // - }; /** @@ -536,11 +610,12 @@ public class ResidueProperties scoreMatrices.put("BLOSUM62", new ScoreMatrix("BLOSUM62", BLOSUM62, 0)); scoreMatrices.put("PAM250", new ScoreMatrix("PAM250", PAM250, 0)); scoreMatrices.put("DNA", new ScoreMatrix("DNA", DNA, 1)); + } public static final Color[] pidColours = { midBlue, new Color(153, 153, 255), - // Color.lightGray, + // Color.lightGray, new Color(204, 204, 255), }; public static final float[] pidThresholds = @@ -1258,6 +1333,105 @@ public class ResidueProperties return ss.toString(); } + /** + * Used by getRNASecStrucState + * + */ + public static Hashtable toRNAssState; + static + { + toRNAssState = new Hashtable(); + toRNAssState.put(")", "("); + toRNAssState.put("(", "("); + toRNAssState.put("]", "["); + toRNAssState.put("[", "["); + toRNAssState.put("{", "{"); + toRNAssState.put("}", "{"); + toRNAssState.put(">", ">"); + toRNAssState.put("<", ">"); + toRNAssState.put("A", "A"); + toRNAssState.put("a", "A"); + toRNAssState.put("B", "B"); + toRNAssState.put("b", "B"); + toRNAssState.put("C", "C"); + toRNAssState.put("c", "C"); + toRNAssState.put("D", "D"); + toRNAssState.put("d", "D"); + toRNAssState.put("1", "1"); + toRNAssState.put("e", "1"); + 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("I", "I"); + toRNAssState.put("i", "I"); + toRNAssState.put("J", "J"); + toRNAssState.put("j", "J"); + toRNAssState.put("K", "K"); + toRNAssState.put("k", "K"); + toRNAssState.put("L", "L"); + toRNAssState.put("l", "L"); + toRNAssState.put("M", "M"); + toRNAssState.put("m", "M"); + toRNAssState.put("N", "N"); + toRNAssState.put("n", "N"); + toRNAssState.put("O", "O"); + toRNAssState.put("o", "O"); + toRNAssState.put("P", "P"); + toRNAssState.put("p", "P"); + toRNAssState.put("Q", "Q"); + toRNAssState.put("q", "Q"); + toRNAssState.put("R", "R"); + toRNAssState.put("r", "R"); + toRNAssState.put("S", "S"); + toRNAssState.put("s", "S"); + toRNAssState.put("T", "T"); + toRNAssState.put("t", "T"); + toRNAssState.put("U", "U"); + toRNAssState.put("u", "U"); + toRNAssState.put("V", "V"); + toRNAssState.put("v", "V"); + toRNAssState.put("W", "W"); + toRNAssState.put("w", "W"); + toRNAssState.put("X", "X"); + toRNAssState.put("x", "X"); + toRNAssState.put("Y", "Y"); + toRNAssState.put("y", "Y"); + toRNAssState.put("Z", "Z"); + toRNAssState.put("z", "Z"); + + } + + /** + * translate to RNA secondary structure representation + * + * @param ssstring + * @return ssstring as a RNA-state secondary structure assignment. + */ + public static String getRNASecStrucState(String ssstring) + { + if (ssstring == null) + { + return null; + } + StringBuffer ss = new StringBuffer(); + for (int i = 0; i < ssstring.length(); i++) + { + String ssc = ssstring.substring(i, i + 1); + if (toRNAssState.containsKey(ssc)) + { + ss.append((String) toRNAssState.get(ssc)); + } + else + { + ss.append(" "); + } + } + return ss.toString(); + } + // main method generates perl representation of residue property hash // / cut here public static void main(String[] args)