/*
- * Jalview - A Sequence Alignment Editor and Viewer (Development Version 2.4.1)
- * Copyright (C) 2009 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, J Engelhardt, LM Lui, 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 <http://www.gnu.org/licenses/>.
*/
package jalview.schemes;
public static final int[] nucleotideIndex;
+ public static final int[] purinepyrimidineIndex;
+
public static final Hashtable aa3Hash = new Hashtable();
public static final Hashtable aa2Triplet = new Hashtable();
aaIndex['z'] = 21;
aaIndex['x'] = 22;
aaIndex['u'] = 22; // TODO: selenocystine triplet and codons needed. also
- // extend subt. matrices
+ // extend subt. matrices
}
static
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
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, // R
- Color.white, // Y
- Color.white, // N
- Color.white, // Gap
+ 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
-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
{
ssHash.put("I", Color.pink);
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
-*/
+
+ /*
+ * 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 =
{
- { 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 }, // -
+ { 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
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 =
charged.put("E", new Integer(1));
charged.put("Q", new Integer(0));
charged.put("D", 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("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));
public static String codonTranslate(String lccodon)
{
- String codon=lccodon.toUpperCase();
+ String codon = lccodon.toUpperCase();
// all base ambiguity codes yield an 'X' amino acid residue
- if (codon.indexOf('X')>-1 || codon.indexOf('N')>-1)
+ if (codon.indexOf('X') > -1 || codon.indexOf('N') > -1)
{
return "X";
}
return ss.toString();
}
+ /**
+ * Used by getRNASecStrucState
+ *
+ */
+ public static Hashtable toRNAssState;
+ static
+ {
+ toRNAssState = new Hashtable();
+ toRNAssState.put(")", "S");
+ toRNAssState.put("(", "S");
+ }
+
+ /**
+ * 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)