/*
- * 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.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
public static final int[] nucleotideIndex;
+ public static final int[] purinepyrimidineIndex;
+
public static final Hashtable aa3Hash = new Hashtable();
public static final Hashtable aa2Triplet = new Hashtable();
// 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];
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, // 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
* 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 }, // -
- { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, // -
+ { 10, -8, -8, -8, -8, 1, 1, -8, 1, 1, 1 }, // C
+ { -8, 10, -8, -8, 10, 1, 1, -8, 1, 1, 1 }, // T
+ { -8, -8, 10, -8, -8, 1, 1, 1, -8, 1, 1 }, // A
+ { -8, -8, -8, 10, -8, 1, 1, 1, -8, 1, 1 }, // G
+ { -8, 10, -8, -8, 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
+ { -8, -8, 1, 1, -8, 0, 0, 10, 0, 1, 1 }, // R
+ { 1, 1, -8, -8, 1, 0, 0, 0, 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 }, // -
};
- /**
+/**
* register matrices in list
*/
static
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 =
return ss.toString();
}
+ /**
+ * Used by getRNASecStrucState
+ *
+ */
+ public static Hashtable toRNAssState;
+ static
+ {
+ toRNAssState = new Hashtable();
+ toRNAssState.put(")", "S");
+ toRNAssState.put("(", "S");
+ toRNAssState.put("]", "C");
+ toRNAssState.put("[", "C");
+ toRNAssState.put("{", "C");
+ toRNAssState.put("}", "C");
+ toRNAssState.put("A", "C");
+ toRNAssState.put("a", "C");
+ toRNAssState.put("B", "C");
+ toRNAssState.put("b", "C");
+ toRNAssState.put("C", "C");
+ toRNAssState.put("c", "C");
+ toRNAssState.put("D", "C");
+ toRNAssState.put("d", "C");
+ }
+
+ /**
+ * 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)