X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fschemes%2FResidueProperties.java;h=c46c07d3c4d59449528f57afda32240dbc6bb79b;hb=a45774ee31d9f35d4eff46d54d7deab719afb092;hp=77938dddc67929e28bd1cd78a69b115289a08d14;hpb=506d60f0e188723ddc91c26824b41ac7034df3fe;p=jalview.git diff --git a/src/jalview/schemes/ResidueProperties.java b/src/jalview/schemes/ResidueProperties.java index 77938dd..c46c07d 100755 --- a/src/jalview/schemes/ResidueProperties.java +++ b/src/jalview/schemes/ResidueProperties.java @@ -1,20 +1,19 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) - * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7) + * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle * - * This program 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 2 - * of the License, or (at your option) any later version. + * This file is part of Jalview. * - * This program 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 PURPOSE. See the - * GNU General Public License for more details. + * 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. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + * 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 + * 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 . */ package jalview.schemes; @@ -93,7 +92,7 @@ public class ResidueProperties aaIndex['z'] = 21; aaIndex['x'] = 22; aaIndex['u'] = 22; // TODO: selenocystine triplet and codons needed. also - // extend subt. matrices + // extend subt. matrices } static @@ -101,7 +100,7 @@ public class ResidueProperties nucleotideIndex = new int[255]; for (int i = 0; i < 255; i++) { - nucleotideIndex[i] = -1; + nucleotideIndex[i] = 10; // non-nucleotide symbols are all non-gap gaps. } nucleotideIndex['A'] = 0; @@ -280,7 +279,13 @@ public class ResidueProperties new Color(255, 179, 64), // C new Color(235, 65, 60), // G new Color(60, 136, 238), // T - new Color(60, 136, 238) // U + new Color(60, 136, 238), // U + Color.white, // I + Color.white, // X + Color.white, // R + Color.white, // Y + Color.white, // N + Color.white, // Gap }; // Zappo @@ -490,7 +495,7 @@ public class ResidueProperties -8, -8, -8, -8, -8, -8, 1 }, }; public static final Hashtable ssHash = new Hashtable(); // stores the number - // value of the aa + // value of the aa static { @@ -505,13 +510,23 @@ public class ResidueProperties ssHash.put("B", Color.yellow); } + /* + * new Color(60, 136, 238), // U Color.white, // I Color.white, // X + * Color.white, // R Color.white, // Y Color.white, // N Color.white, // Gap + */ static final int[][] DNA = { - { 5, -4, -4, -4, 1 }, // C - { -4, 5, -4, -4, 1 }, // T - { -4, -4, 5, -4, 1 }, // A - { -4, -4, -4, 5, 1 }, // G - { 1, 1, 1, 1, 1 }, // - + { 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 }, // - + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, // - }; /** * register matrices in list @@ -525,7 +540,7 @@ public class ResidueProperties 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 = @@ -945,7 +960,9 @@ public class ResidueProperties charged.put("E", new Integer(1)); charged.put("Q", new Integer(0)); charged.put("D", new Integer(1)); - charged.put("N", new Integer(1)); + charged.put("N", new Integer(0)); // Asparagine is polar but not charged. + // Alternative would be charged and + // negative (in basic form)? charged.put("S", new Integer(0)); charged.put("T", new Integer(0)); charged.put("P", new Integer(0)); @@ -1138,8 +1155,14 @@ public class ResidueProperties return null; } - public static String codonTranslate(String codon) + public static String codonTranslate(String lccodon) { + String codon = lccodon.toUpperCase(); + // all base ambiguity codes yield an 'X' amino acid residue + if (codon.indexOf('X') > -1 || codon.indexOf('N') > -1) + { + return "X"; + } Enumeration e = codonHash.keys(); while (e.hasMoreElements()) @@ -1147,7 +1170,7 @@ public class ResidueProperties String key = (String) e.nextElement(); Vector tmp = (Vector) codonHash.get(key); - if (tmp.contains(codon.toUpperCase())) + if (tmp.contains(codon)) { return key; }