import java.util.*;\r
\r
\r
-public class AAFrequency {\r
- // Takes in a vector of sequences and column start and column end\r
- // and returns a vector of size (end-start+1). Each element of the\r
- // vector contains a hashtable with the keys being residues and\r
- // the values being the count of each residue in that column.\r
- // This class is used extensively in calculating alignment colourschemes\r
- // that depend on the amount of conservation in each alignment column.\r
- public static Vector calculate(Vector sequences, int start, int end) {\r
+/**\r
+ * Takes in a vector of sequences and column start and column end\r
+ * and returns a vector of size (end-start+1). Each element of the\r
+ * vector contains a hashtable with the keys being residues and\r
+ * the values being the count of each residue in that column.\r
+ * This class is used extensively in calculating alignment colourschemes\r
+ * that depend on the amount of conservation in each alignment column.\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class AAFrequency\r
+{\r
+ /** Takes in a vector of sequences and column start and column end\r
+ * and returns a vector of size (end-start+1). Each element of the\r
+ * vector contains a hashtable with the keys being residues and\r
+ * the values being the count of each residue in that column.\r
+ * This class is used extensively in calculating alignment colourschemes\r
+ * that depend on the amount of conservation in each alignment column. */\r
+ public static Vector calculate(Vector sequences, int start, int end)\r
+ {\r
Vector result = new Vector();\r
\r
- for (int i = start; i <= end; i++) {\r
+ for (int i = start; i <= end; i++)\r
+ {\r
Hashtable residueHash = new Hashtable();\r
int maxCount = 0;\r
String maxResidue = "-";\r
int nongap = 0;\r
\r
- for (int j = 0; j < sequences.size(); j++) {\r
- if (sequences.elementAt(j) instanceof Sequence) {\r
+ for (int j = 0; j < sequences.size(); j++)\r
+ {\r
+ if (sequences.elementAt(j) instanceof Sequence)\r
+ {\r
Sequence s = (Sequence) sequences.elementAt(j);\r
\r
- if (s.getSequence().length() > i) {\r
+ if (s.getSequence().length() > i)\r
+ {\r
String res = s.getSequence().charAt(i) + "";\r
\r
- if (!jalview.util.Comparison.isGap(res.charAt(0))) {\r
+ if (!jalview.util.Comparison.isGap(res.charAt(0)))\r
+ {\r
nongap++;\r
- } else {\r
+ }\r
+ else\r
+ {\r
res = "-"; // we always use this for gaps in the property vectors\r
}\r
\r
- if (residueHash.containsKey(res)) {\r
+ if (residueHash.containsKey(res))\r
+ {\r
int count = ((Integer) residueHash.get(res)).intValue();\r
count++;\r
\r
if (!jalview.util.Comparison.isGap(res.charAt(0)) &&\r
- (count >= maxCount)) {\r
- if (count > maxCount) {\r
+ (count >= maxCount))\r
+ {\r
+ if (count > maxCount)\r
+ {\r
maxResidue = res;\r
- } else if (maxResidue.indexOf(res) == -1) {\r
+ }\r
+ else if (maxResidue.indexOf(res) == -1)\r
+ {\r
maxResidue += res;\r
}\r
\r
}\r
\r
residueHash.put(res, new Integer(count));\r
- } else {\r
+ }\r
+ else\r
+ {\r
residueHash.put(res, new Integer(1));\r
}\r
- } else {\r
- if (residueHash.containsKey("-")) {\r
+ }\r
+ else\r
+ {\r
+ if (residueHash.containsKey("-"))\r
+ {\r
int count = ((Integer) residueHash.get("-")).intValue();\r
count++;\r
residueHash.put("-", new Integer(count));\r
- } else {\r
+ }\r
+ else\r
+ {\r
residueHash.put("-", new Integer(1));\r
}\r
}\r
\r
residueHash.put("maxCount", new Integer(maxCount));\r
\r
- if (maxCount < 0) {\r
+ if (maxCount < 0)\r
+ {\r
System.out.println("asasa " + maxCount);\r
}\r
\r
\r
return result;\r
}\r
-\r
- public static Vector calculatePID(SequenceI refseq, Vector sequences,\r
- int window, int start, int end) {\r
- Vector result = new Vector();\r
-\r
- boolean init = true;\r
-\r
- Vector prev = null;\r
-\r
- for (int i = start; i <= end; i++) {\r
- Vector values = new Vector();\r
-\r
- result.addElement(values);\r
-\r
- // If start < window/2 then set value to zero.\r
- if ((i < (window / 2)) ||\r
- (i >= (refseq.getSequence().length() - (window / 2)))) {\r
- for (int j = 0; j < sequences.size(); j++) {\r
- values.addElement(new Integer(0));\r
- }\r
- } else if (init == true) {\r
- init = false;\r
-\r
- int winstart = i - (window / 2);\r
- int winend = i + (window / 2);\r
-\r
- if ((window % 2) != 0) {\r
- winend++;\r
- }\r
-\r
- for (int j = 0; j < sequences.size(); j++) {\r
- values.addElement(new Integer(0));\r
- }\r
-\r
- for (int k = winstart; k <= winend; k++) {\r
- String refchar = refseq.getSequence().substring(k, k + 1);\r
-\r
- if (jalview.util.Comparison.isGap(refchar.charAt(0))) {\r
- refchar = "-";\r
- } else {\r
- for (int j = 0; j < sequences.size(); j++) {\r
- Sequence s = (Sequence) sequences.elementAt(j);\r
-\r
- if (s.getSequence().length() > k) {\r
- String res = s.getSequence().substring(k, k +\r
- 1); // no gapchar test needed\r
-\r
- if (res.equals(refchar)) {\r
- int val = ((Integer) values.elementAt(j)).intValue();\r
- val++;\r
- values.setElementAt(new Integer(val), j);\r
- }\r
- }\r
- }\r
- }\r
- }\r
-\r
- prev = values;\r
- } else {\r
- int winstart = i - (window / 2);\r
- int winend = i + (window / 2);\r
-\r
- if ((window % 2) != 0) {\r
- winend++;\r
- }\r
-\r
- // We need to take the previous set of values\r
- // subtract the pid at winstart-1\r
- // and add the pid at winend;\r
- String pre_refchar = refseq.getSequence().substring(winstart -\r
- 1, winstart);\r
- String pos_refchar = "-";\r
-\r
- if (refseq.getSequence().length() > winend) {\r
- pos_refchar = refseq.getSequence().substring(winend,\r
- winend + 1);\r
- }\r
-\r
- for (int j = 0; j < sequences.size(); j++) {\r
- // First copy the pid value from i-1\r
- int val = ((Integer) prev.elementAt(j)).intValue();\r
-\r
- Sequence s = (Sequence) sequences.elementAt(j);\r
-\r
- String pre_char = s.getSequence().substring(winstart - 1,\r
- winstart);\r
-\r
- String pos_char = "-";\r
-\r
- if (s.getSequence().length() > winend) {\r
- pos_char = s.getSequence().substring(winend, winend +\r
- 1);\r
- }\r
-\r
- // Now substract 1 if the chars at winstart-1 match\r
- if ((jalview.util.Comparison.isGap(pre_refchar.charAt(0)) == false) &&\r
- pre_char.equals(pre_refchar)) {\r
- val--;\r
- }\r
-\r
- if ((jalview.util.Comparison.isGap(pos_refchar.charAt(0)) == false) &&\r
- pos_char.equals(pos_refchar)) {\r
- val++;\r
- }\r
-\r
- values.addElement(new Integer(val));\r
- }\r
-\r
- prev = values;\r
- }\r
- }\r
-\r
- return result;\r
- }\r
-\r
- public static Hashtable findBlocks(Vector seqs, int start, int end,\r
- Vector exc) {\r
- // start and end are in real (not relative coords);\r
- // The coords in the hashtable that is returned are in relative coords\r
- // i.e. start from 0\r
- Hashtable blocks = new Hashtable();\r
-\r
- boolean prev = false;\r
- int bstart = -1;\r
-\r
- for (int i = start; i <= end; i++) {\r
- SequenceI seq = (SequenceI) seqs.elementAt(0);\r
-\r
- char c = seq.getCharAt(i);\r
-\r
- boolean found = true;\r
-\r
- int j = 1;\r
-\r
- while ((j < seqs.size()) && (found == true)) {\r
- SequenceI jseq = (SequenceI) seqs.elementAt(j);\r
-\r
- if (!exc.contains(jseq)) {\r
- char cc = jseq.getCharAt(i);\r
-\r
- if (cc != c) {\r
- found = false;\r
- }\r
- }\r
-\r
- j++;\r
- }\r
-\r
- if ((prev == false) && (found == true)) {\r
- bstart = i;\r
- } else if ((prev == true) && (found == false) && (bstart != -1)) {\r
- int blockstart = bstart - start;\r
- int blocklen = i - bstart;\r
-\r
- //System.out.println("Start len " + blockstart + " " + blocklen);\r
- for (int jj = blockstart; jj < (blockstart + blocklen); jj++) {\r
- blocks.put(new Integer(jj), new Integer(blocklen));\r
- }\r
-\r
- bstart = -1;\r
- }\r
-\r
- prev = found;\r
- }\r
-\r
- if (bstart != -1) {\r
- int blockstart = bstart - start;\r
- int blocklen = end - bstart;\r
-\r
- // System.out.println("Start len " + blockstart + " " + blocklen);\r
- for (int jj = blockstart; jj < (blockstart + blocklen); jj++) {\r
- blocks.put(new Integer(blockstart), new Integer(blocklen));\r
- }\r
- }\r
-\r
- return blocks;\r
- }\r
-\r
- public static Hashtable findKmerCount(SequenceI seq, int start, int end,\r
- int window, int step, Vector kmers) {\r
- int tmpstart = start;\r
- Hashtable vals = new Hashtable();\r
-\r
- while (tmpstart <= end) {\r
- String tmpstr = seq.getSequence().substring(tmpstart -\r
- (window / 2), tmpstart + (window / 2));\r
-\r
- int count = 0;\r
-\r
- //System.out.println("Str " + tmpstr);\r
- for (int ii = 0; ii < kmers.size(); ii++) {\r
- String kmer = ((SequenceI) kmers.elementAt(ii)).getSequence();\r
-\r
- int i = -1;\r
-\r
- while (tmpstr.indexOf(kmer, i) != -1) {\r
- i = tmpstr.indexOf(kmer, i);\r
-\r
- i++;\r
- count++;\r
- }\r
-\r
- ii++;\r
- }\r
-\r
- vals.put(new Integer(tmpstart), new Integer(count));\r
- tmpstart += step;\r
- }\r
-\r
- return vals;\r
- }\r
-\r
- public static Hashtable findBlockStarts(Vector seqs, int start, int end,\r
- Vector exc) {\r
- // start and end are in real (not relative coords);\r
- // The coords in the hashtable that is returned are in relative coords\r
- // i.e. start from 0\r
- Hashtable blocks = new Hashtable();\r
-\r
- boolean prev = false;\r
- int bstart = -1;\r
-\r
- for (int i = start; i <= end; i++) {\r
- SequenceI seq = (SequenceI) seqs.elementAt(0);\r
-\r
- char c = seq.getCharAt(i);\r
-\r
- boolean found = true;\r
-\r
- int j = 1;\r
-\r
- while ((j < seqs.size()) && (found == true)) {\r
- SequenceI jseq = (SequenceI) seqs.elementAt(j);\r
-\r
- if (!exc.contains(jseq)) {\r
- char cc = jseq.getCharAt(i);\r
-\r
- if (cc != c) {\r
- found = false;\r
- }\r
- }\r
-\r
- j++;\r
- }\r
-\r
- if ((prev == false) && (found == true)) {\r
- bstart = i;\r
- } else if ((prev == true) && (found == false) && (bstart != -1)) {\r
- int blockstart = bstart - start;\r
- int blocklen = i - bstart;\r
-\r
- // System.out.println("Start len " + blockstart + " " + blocklen);\r
- //for (int jj = blockstart; jj < blockstart + blocklen;jj++) {\r
- blocks.put(new Integer(blockstart), new Integer(blocklen));\r
-\r
- // }\r
- bstart = -1;\r
- }\r
-\r
- prev = found;\r
- }\r
-\r
- if (bstart != -1) {\r
- int blockstart = bstart - start;\r
- int blocklen = end - bstart;\r
-\r
- // System.out.println("Start len " + blockstart + " " + blocklen);\r
- //for (int jj = blockstart; jj < blockstart + blocklen;jj++) {\r
- blocks.put(new Integer(blockstart), new Integer(blocklen));\r
-\r
- // }\r
- }\r
-\r
- return blocks;\r
- }\r
}\r
\r
import jalview.datamodel.SequenceI;\r
\r
-import jalview.io.*;\r
-\r
import jalview.schemes.*;\r
\r
import jalview.util.*;\r
\r
import java.awt.*;\r
\r
-import java.io.*;\r
-\r
import java.util.*;\r
\r
\r
-public class AlignSeq {\r
+/**\r
+ *\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class AlignSeq\r
+{\r
+ /** DOCUMENT ME!! */\r
public static java.util.Hashtable dnaHash = new java.util.Hashtable();\r
\r
- static {\r
+ static\r
+ {\r
dnaHash.put("C", new Integer(0));\r
dnaHash.put("T", new Integer(1));\r
dnaHash.put("A", new Integer(2));\r
}\r
\r
static String[] dna = { "C", "T", "A", "G", "-" };\r
- static String[] pep = {\r
+ static String[] pep =\r
+ {\r
"A", "R", "N", "D", "C", "Q", "E", "G", "H", "I", "L", "K", "M", "F",\r
"P", "S", "T", "W", "Y", "V", "B", "Z", "X", "-"\r
};\r
int[] aseq2;\r
String astr1 = "";\r
String astr2 = "";\r
+\r
+ /** DOCUMENT ME!! */\r
public int seq1start;\r
+\r
+ /** DOCUMENT ME!! */\r
public int seq1end;\r
+\r
+ /** DOCUMENT ME!! */\r
public int seq2start;\r
+\r
+ /** DOCUMENT ME!! */\r
public int seq2end;\r
int count;\r
+\r
+ /** DOCUMENT ME!! */\r
public int maxscore;\r
float pid;\r
int prev = 0;\r
String type;\r
Runtime rt;\r
\r
- public AlignSeq() {\r
- }\r
\r
- public AlignSeq(SequenceI s1, SequenceI s2, String type) {\r
+ /**\r
+ * Creates a new AlignSeq object.\r
+ *\r
+ * @param s1 DOCUMENT ME!\r
+ * @param s2 DOCUMENT ME!\r
+ * @param type DOCUMENT ME!\r
+ */\r
+ public AlignSeq(SequenceI s1, SequenceI s2, String type)\r
+ {\r
rt = Runtime.getRuntime();\r
SeqInit(s1, s2, type);\r
}\r
\r
- public int getMaxScore() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public int getMaxScore()\r
+ {\r
return maxscore;\r
}\r
\r
- public int getSeq2Start() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public int getSeq2Start()\r
+ {\r
return seq2start;\r
}\r
\r
- public int getSeq2End() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public int getSeq2End()\r
+ {\r
return seq2end;\r
}\r
\r
- public int getSeq1Start() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public int getSeq1Start()\r
+ {\r
return seq1start;\r
}\r
\r
- public int getSeq1End() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public int getSeq1End()\r
+ {\r
return seq1end;\r
}\r
\r
- public String getOutput() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public String getOutput()\r
+ {\r
return output;\r
}\r
\r
- public String getAStr1() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public String getAStr1()\r
+ {\r
return astr1;\r
}\r
\r
- public String getAStr2() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public String getAStr2()\r
+ {\r
return astr2;\r
}\r
\r
- public int[] getASeq1() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public int[] getASeq1()\r
+ {\r
return aseq1;\r
}\r
\r
- public int[] getASeq2() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public int[] getASeq2()\r
+ {\r
return aseq2;\r
}\r
\r
- public SequenceI getS1() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public SequenceI getS1()\r
+ {\r
return s1;\r
}\r
\r
- public SequenceI getS2() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public SequenceI getS2()\r
+ {\r
return s2;\r
}\r
\r
- public void SeqInit(SequenceI s1, SequenceI s2, String type) {\r
- s1str = extractGaps(".", s1.getSequence());\r
- s2str = extractGaps(".", s2.getSequence());\r
- s1str = extractGaps("-", s1str);\r
- s2str = extractGaps("-", s2str);\r
- s1str = extractGaps(" ", s1str);\r
- s2str = extractGaps(" ", s2str);\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param s1 DOCUMENT ME!\r
+ * @param s2 DOCUMENT ME!\r
+ * @param type DOCUMENT ME!\r
+ */\r
+ public void SeqInit(SequenceI s1, SequenceI s2, String type)\r
+ {\r
+ s1str = extractGaps(jalview.util.Comparison.GapChars, s1.getSequence());\r
+ s2str = extractGaps(jalview.util.Comparison.GapChars, s2.getSequence());\r
\r
this.s1 = s1;\r
this.s2 = s2;\r
\r
this.type = type;\r
\r
- if (type.equals("pep")) {\r
+ if (type.equals("pep"))\r
+ {\r
lookup = ResidueProperties.getBLOSUM62();\r
intToStr = pep;\r
defInt = 23;\r
- } else if (type.equals("dna")) {\r
+ }\r
+ else if (type.equals("dna"))\r
+ {\r
lookup = ResidueProperties.getDNA();\r
intToStr = dna;\r
defInt = 4;\r
- } else {\r
+ }\r
+ else\r
+ {\r
output = output + ("Wrong type = dna or pep only");\r
System.exit(0);\r
}\r
//System.out.println("Time take to traceback alignment = " + (tend-tstart) + " ms");\r
}\r
\r
- public void traceAlignment() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ public void traceAlignment()\r
+ {\r
// Find the maximum score along the rhs or bottom row\r
int max = -9999;\r
\r
- for (int i = 0; i < seq1.length; i++) {\r
- if (score[i][seq2.length - 1] > max) {\r
+ for (int i = 0; i < seq1.length; i++)\r
+ {\r
+ if (score[i][seq2.length - 1] > max)\r
+ {\r
max = score[i][seq2.length - 1];\r
maxi = i;\r
maxj = seq2.length - 1;\r
}\r
}\r
\r
- for (int j = 0; j < seq2.length; j++) {\r
- if (score[seq1.length - 1][j] > max) {\r
+ for (int j = 0; j < seq2.length; j++)\r
+ {\r
+ if (score[seq1.length - 1][j] > max)\r
+ {\r
max = score[seq1.length - 1][j];\r
maxi = seq1.length - 1;\r
maxj = j;\r
\r
count = (seq1.length + seq2.length) - 1;\r
\r
- while ((i > 0) && (j > 0)) {\r
- if ((aseq1[count] != defInt) && (i >= 0)) {\r
+ while ((i > 0) && (j > 0))\r
+ {\r
+ if ((aseq1[count] != defInt) && (i >= 0))\r
+ {\r
aseq1[count] = seq1[i];\r
astr1 = intToStr[seq1[i]] + astr1;\r
}\r
\r
- if ((aseq2[count] != defInt) && (j > 0)) {\r
+ if ((aseq2[count] != defInt) && (j > 0))\r
+ {\r
aseq2[count] = seq2[j];\r
astr2 = intToStr[seq2[j]] + astr2;\r
}\r
\r
trace = findTrace(i, j);\r
\r
- if (trace == 0) {\r
+ if (trace == 0)\r
+ {\r
i--;\r
j--;\r
- } else if (trace == 1) {\r
+ }\r
+ else if (trace == 1)\r
+ {\r
j--;\r
aseq1[count] = defInt;\r
astr1 = "-" + astr1.substring(1);\r
- } else if (trace == -1) {\r
+ }\r
+ else if (trace == -1)\r
+ {\r
i--;\r
aseq2[count] = defInt;\r
astr2 = "-" + astr2.substring(1);\r
seq1start = i + 1;\r
seq2start = j + 1;\r
\r
- if (aseq1[count] != defInt) {\r
+ if (aseq1[count] != defInt)\r
+ {\r
aseq1[count] = seq1[i];\r
astr1 = intToStr[seq1[i]] + astr1;\r
}\r
\r
- if (aseq2[count] != defInt) {\r
+ if (aseq2[count] != defInt)\r
+ {\r
aseq2[count] = seq2[j];\r
astr2 = intToStr[seq2[j]] + astr2;\r
}\r
}\r
\r
- public void printAlignment() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ public void printAlignment()\r
+ {\r
// Find the biggest id length for formatting purposes\r
int maxid = s1.getName().length();\r
\r
- if (s2.getName().length() > maxid) {\r
+ if (s2.getName().length() > maxid)\r
+ {\r
maxid = s2.getName().length();\r
}\r
\r
int nochunks = ((aseq1.length - count) / len) + 1;\r
pid = 0;\r
\r
- int overlap = 0;\r
-\r
output = output + ("Score = " + score[maxi][maxj] + "\n");\r
output = output +\r
("Length of alignment = " + (aseq1.length - count) + "\n");\r
(" : " + seq2start + " - " + seq2end + " (Sequence length = " +\r
s2str.length() + ")\n\n");\r
\r
- for (int j = 0; j < nochunks; j++) {\r
+ for (int j = 0; j < nochunks; j++)\r
+ {\r
// Print the first aligned sequence\r
output = output +\r
(new Format("%" + (maxid) + "s").form(s1.getName()) + " ");\r
\r
- for (int i = 0; i < len; i++) {\r
- if ((count + i + (j * len)) < aseq1.length) {\r
+ for (int i = 0; i < len; i++)\r
+ {\r
+ if ((count + i + (j * len)) < aseq1.length)\r
+ {\r
output = output +\r
(new Format("%s").form(intToStr[aseq1[count + i +\r
(j * len)]]));\r
(new Format("%" + (maxid) + "s").form(" ") + " ");\r
\r
// Print out the matching chars\r
- for (int i = 0; i < len; i++) {\r
- if ((count + i + (j * len)) < aseq1.length) {\r
+ for (int i = 0; i < len; i++)\r
+ {\r
+ if ((count + i + (j * len)) < aseq1.length)\r
+ {\r
if (intToStr[aseq1[count + i + (j * len)]].equals(\r
intToStr[aseq2[count + i + (j * len)]]) &&\r
- !intToStr[aseq1[count + i + (j * len)]].equals("-")) {\r
+ !intToStr[aseq1[count + i + (j * len)]].equals("-"))\r
+ {\r
pid++;\r
output = output + ("|");\r
- } else if (type.equals("pep")) {\r
+ }\r
+ else if (type.equals("pep"))\r
+ {\r
if (ResidueProperties.getPAM250(\r
intToStr[aseq1[count + i + (j * len)]],\r
- intToStr[aseq2[count + i + (j * len)]]) > 0) {\r
+ intToStr[aseq2[count + i + (j * len)]]) > 0)\r
+ {\r
output = output + (".");\r
- } else {\r
+ }\r
+ else\r
+ {\r
output = output + (" ");\r
}\r
- } else {\r
+ }\r
+ else\r
+ {\r
output = output + (" ");\r
}\r
}\r
output = output +\r
(new Format("%" + (maxid) + "s").form(s2.getName()) + " ");\r
\r
- for (int i = 0; i < len; i++) {\r
- if ((count + i + (j * len)) < aseq1.length) {\r
+ for (int i = 0; i < len; i++)\r
+ {\r
+ if ((count + i + (j * len)) < aseq1.length)\r
+ {\r
output = output +\r
(new Format("%s").form(intToStr[aseq2[count + i +\r
(j * len)]]));\r
output = output + (new Format("Percentage ID = %2.2f\n\n").form(pid));\r
}\r
\r
- public void printScoreMatrix(int[][] mat) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param mat DOCUMENT ME!\r
+ */\r
+ public void printScoreMatrix(int[][] mat)\r
+ {\r
int n = seq1.length;\r
int m = seq2.length;\r
\r
- for (int i = 0; i < n; i++) {\r
+ for (int i = 0; i < n; i++)\r
+ {\r
// Print the top sequence\r
- if (i == 0) {\r
+ if (i == 0)\r
+ {\r
Format.print(System.out, "%8s", s2str.substring(0, 1));\r
\r
- for (int jj = 1; jj < m; jj++) {\r
+ for (int jj = 1; jj < m; jj++)\r
+ {\r
Format.print(System.out, "%5s", s2str.substring(jj, jj + 1));\r
}\r
\r
System.out.println();\r
}\r
\r
- for (int j = 0; j < m; j++) {\r
- if (j == 0) {\r
+ for (int j = 0; j < m; j++)\r
+ {\r
+ if (j == 0)\r
+ {\r
Format.print(System.out, "%3s", s1str.substring(i, i + 1));\r
}\r
\r
}\r
}\r
\r
- public int findTrace(int i, int j) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param i DOCUMENT ME!\r
+ * @param j DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public int findTrace(int i, int j)\r
+ {\r
int t = 0;\r
int max = score[i - 1][j - 1] + (lookup[seq1[i]][seq2[j]] * 10);\r
\r
- if (F[i][j] > max) {\r
+ if (F[i][j] > max)\r
+ {\r
max = F[i][j];\r
t = -1;\r
- } else if (F[i][j] == max) {\r
- if (prev == -1) {\r
+ }\r
+ else if (F[i][j] == max)\r
+ {\r
+ if (prev == -1)\r
+ {\r
max = F[i][j];\r
t = -1;\r
}\r
}\r
\r
- if (E[i][j] >= max) {\r
+ if (E[i][j] >= max)\r
+ {\r
max = E[i][j];\r
t = 1;\r
- } else if (E[i][j] == max) {\r
- if (prev == 1) {\r
+ }\r
+ else if (E[i][j] == max)\r
+ {\r
+ if (prev == 1)\r
+ {\r
max = E[i][j];\r
t = 1;\r
}\r
return t;\r
}\r
\r
- public void calcScoreMatrix() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ public void calcScoreMatrix()\r
+ {\r
int n = seq1.length;\r
int m = seq2.length;\r
\r
F[0][0] = 0;\r
\r
// Calculate the top row first\r
- for (int j = 1; j < m; j++) {\r
+ for (int j = 1; j < m; j++)\r
+ {\r
// What should these values be? 0 maybe\r
E[0][j] = max(score[0][j - 1] - gapOpen, E[0][j - 1] - gapExtend);\r
F[0][j] = -gapExtend;\r
}\r
\r
// Now do the left hand column\r
- for (int i = 1; i < n; i++) {\r
+ for (int i = 1; i < n; i++)\r
+ {\r
E[i][0] = -gapOpen;\r
F[i][0] = max(score[i - 1][0] - gapOpen, F[i - 1][0] - gapExtend);\r
\r
}\r
\r
// Now do all the other rows\r
- for (int i = 1; i < n; i++) {\r
- for (int j = 1; j < m; j++) {\r
+ for (int i = 1; i < n; i++)\r
+ {\r
+ for (int j = 1; j < m; j++)\r
+ {\r
E[i][j] = max(score[i][j - 1] - gapOpen, E[i][j - 1] -\r
gapExtend);\r
F[i][j] = max(score[i - 1][j] - gapOpen, F[i - 1][j] -\r
}\r
}\r
\r
- public static String extractChars(String chars, String seq) {\r
- String out = seq;\r
\r
- for (int i = 0; i < chars.length(); i++) {\r
- String gap = chars.substring(i, i + 1);\r
- out = extractGaps(gap, out);\r
- }\r
-\r
- return out;\r
- }\r
\r
- public static String extractGaps(String gapChar, String seq) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param gapChar DOCUMENT ME!\r
+ * @param seq DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public static String extractGaps(String gapChar, String seq)\r
+ {\r
StringTokenizer str = new StringTokenizer(seq, gapChar);\r
String newString = "";\r
\r
- while (str.hasMoreTokens()) {\r
+ while (str.hasMoreTokens())\r
+ {\r
newString = newString + str.nextToken();\r
}\r
\r
return newString;\r
}\r
\r
- public int max(int i1, int i2, int i3) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param i1 DOCUMENT ME!\r
+ * @param i2 DOCUMENT ME!\r
+ * @param i3 DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public int max(int i1, int i2, int i3)\r
+ {\r
int max = i1;\r
\r
- if (i2 > i1) {\r
+ if (i2 > i1)\r
+ {\r
max = i2;\r
}\r
\r
- if (i3 > max) {\r
+ if (i3 > max)\r
+ {\r
max = i3;\r
}\r
\r
return max;\r
}\r
\r
- public int max(int i1, int i2) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param i1 DOCUMENT ME!\r
+ * @param i2 DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public int max(int i1, int i2)\r
+ {\r
int max = i1;\r
\r
- if (i2 > i1) {\r
+ if (i2 > i1)\r
+ {\r
max = i2;\r
}\r
\r
return max;\r
}\r
\r
- public int[] stringToInt(String s, String type) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param s DOCUMENT ME!\r
+ * @param type DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public int[] stringToInt(String s, String type)\r
+ {\r
int[] seq1 = new int[s.length()];\r
\r
- for (int i = 0; i < s.length(); i++) {\r
+ for (int i = 0; i < s.length(); i++)\r
+ {\r
String ss = s.substring(i, i + 1).toUpperCase();\r
\r
- try {\r
- if (type.equals("pep")) {\r
+ try\r
+ {\r
+ if (type.equals("pep"))\r
+ {\r
seq1[i] = ((Integer) ResidueProperties.aaHash.get(ss)).intValue();\r
- } else if (type.equals("dna")) {\r
+ }\r
+ else if (type.equals("dna"))\r
+ {\r
seq1[i] = ((Integer) dnaHash.get(ss)).intValue();\r
}\r
\r
- if (seq1[i] > 23) {\r
+ if (seq1[i] > 23)\r
+ {\r
seq1[i] = 23;\r
}\r
- } catch (Exception e) {\r
- if (type.equals("dna")) {\r
+ }\r
+ catch (Exception e)\r
+ {\r
+ if (type.equals("dna"))\r
+ {\r
seq1[i] = 4;\r
- } else {\r
+ }\r
+ else\r
+ {\r
seq1[i] = 23;\r
}\r
}\r
return seq1;\r
}\r
\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param g DOCUMENT ME!\r
+ * @param mat DOCUMENT ME!\r
+ * @param n DOCUMENT ME!\r
+ * @param m DOCUMENT ME!\r
+ * @param psize DOCUMENT ME!\r
+ */\r
public static void displayMatrix(Graphics g, int[][] mat, int n, int m,\r
- int psize) {\r
+ int psize)\r
+ {\r
int max = -1000;\r
int min = 1000;\r
\r
- for (int i = 0; i < n; i++) {\r
- for (int j = 0; j < m; j++) {\r
- if (mat[i][j] >= max) {\r
+ for (int i = 0; i < n; i++)\r
+ {\r
+ for (int j = 0; j < m; j++)\r
+ {\r
+ if (mat[i][j] >= max)\r
+ {\r
max = mat[i][j];\r
}\r
\r
- if (mat[i][j] <= min) {\r
+ if (mat[i][j] <= min)\r
+ {\r
min = mat[i][j];\r
}\r
}\r
\r
System.out.println(max + " " + min);\r
\r
- for (int i = 0; i < n; i++) {\r
- for (int j = 0; j < m; j++) {\r
+ for (int i = 0; i < n; i++)\r
+ {\r
+ for (int j = 0; j < m; j++)\r
+ {\r
int x = psize * i;\r
int y = psize * j;\r
\r
\r
import jalview.datamodel.*;\r
\r
-import jalview.io.*;\r
-\r
import jalview.util.*;\r
\r
import java.util.*;\r
\r
/** Data structure to hold and manipulate a multiple sequence alignment\r
*/\r
-public class AlignmentSorter {\r
- /** */\r
+public class AlignmentSorter\r
+{\r
static boolean sortIdAscending = true;\r
static int lastGroupHash = 0;\r
static boolean sortGroupAscending = true;\r
* @param align AlignmentI\r
* @param s SequenceI\r
*/\r
- public static void sortByPID(AlignmentI align, SequenceI s) {\r
+ public static void sortByPID(AlignmentI align, SequenceI s)\r
+ {\r
int nSeq = align.getHeight();\r
\r
float[] scores = new float[nSeq];\r
SequenceI[] seqs = new SequenceI[nSeq];\r
\r
- for (int i = 0; i < nSeq; i++) {\r
+ for (int i = 0; i < nSeq; i++)\r
+ {\r
scores[i] = Comparison.PID(align.getSequenceAt(i), s);\r
seqs[i] = align.getSequenceAt(i);\r
}\r
setReverseOrder(align, seqs);\r
}\r
\r
- private static void setReverseOrder(AlignmentI align, SequenceI[] seqs) {\r
+ /**\r
+ * Reverse the order of the sort\r
+ *\r
+ * @param align DOCUMENT ME!\r
+ * @param seqs DOCUMENT ME!\r
+ */\r
+ private static void setReverseOrder(AlignmentI align, SequenceI[] seqs)\r
+ {\r
int nSeq = seqs.length;\r
\r
int len = 0;\r
\r
- if ((nSeq % 2) == 0) {\r
+ if ((nSeq % 2) == 0)\r
+ {\r
len = nSeq / 2;\r
- } else {\r
+ }\r
+ else\r
+ {\r
len = (nSeq + 1) / 2;\r
}\r
\r
// NOTE: DO NOT USE align.setSequenceAt() here - it will NOT work\r
- for (int i = 0; i < len; i++) {\r
+ for (int i = 0; i < len; i++)\r
+ {\r
//SequenceI tmp = seqs[i];\r
align.getSequences().setElementAt(seqs[nSeq - i - 1], i);\r
align.getSequences().setElementAt(seqs[i], nSeq - i - 1);\r
}\r
}\r
\r
- private static void setOrder(AlignmentI align, Vector tmp) {\r
+ /**\r
+ * Sets the Alignment object with the given sequences\r
+ *\r
+ * @param align Alignment object to be updated\r
+ * @param tmp sequences as a vector\r
+ */\r
+ private static void setOrder(AlignmentI align, Vector tmp)\r
+ {\r
setOrder(align, vectorSubsetToArray(tmp, align.getSequences()));\r
}\r
\r
- private static void setOrder(AlignmentI align, SequenceI[] seqs) {\r
-\r
+ /**\r
+ * Sets the Alignment object with the given sequences\r
+ *\r
+ * @param align DOCUMENT ME!\r
+ * @param seqs sequences as an array\r
+ */\r
+ private static void setOrder(AlignmentI align, SequenceI[] seqs)\r
+ {\r
// NOTE: DO NOT USE align.setSequenceAt() here - it will NOT work\r
Vector algn = align.getSequences();\r
+\r
for (int i = 0; i < seqs.length; i++)\r
{\r
- algn.setElementAt(seqs[i], i);\r
+ algn.setElementAt(seqs[i], i);\r
}\r
}\r
\r
- public static void sortByID(AlignmentI align) {\r
+ /**\r
+ * Sorts by ID. Numbers are sorted before letters.\r
+ *\r
+ * @param align The alignment object to sort\r
+ */\r
+ public static void sortByID(AlignmentI align)\r
+ {\r
int nSeq = align.getHeight();\r
\r
String[] ids = new String[nSeq];\r
SequenceI[] seqs = new SequenceI[nSeq];\r
\r
- for (int i = 0; i < nSeq; i++) {\r
+ for (int i = 0; i < nSeq; i++)\r
+ {\r
ids[i] = align.getSequenceAt(i).getName();\r
seqs[i] = align.getSequenceAt(i);\r
}\r
\r
QuickSort.sort(ids, seqs);\r
\r
- if (sortIdAscending) {\r
+ if (sortIdAscending)\r
+ {\r
setReverseOrder(align, seqs);\r
- } else {\r
+ }\r
+ else\r
+ {\r
setOrder(align, seqs);\r
}\r
\r
sortIdAscending = !sortIdAscending;\r
}\r
\r
- public static void sortByGroup(AlignmentI align) {\r
- //MAINTAINS ORIGNAL SEQUENCE ORDER,\r
- //ORDERS BY GROUP SIZE\r
-\r
+ /**\r
+ * Sorts the alignment by size of group.\r
+ * <br>Maintains the order of sequences in each group\r
+ * by order in given alignment object.\r
+ *\r
+ * @param align sorts the given alignment object by group\r
+ */\r
+ public static void sortByGroup(AlignmentI align)\r
+ {\r
+ //MAINTAINS ORIGNAL SEQUENCE ORDER,\r
+ //ORDERS BY GROUP SIZE\r
Vector groups = new Vector();\r
\r
- if (groups.hashCode() != lastGroupHash) {\r
+ if (groups.hashCode() != lastGroupHash)\r
+ {\r
sortGroupAscending = true;\r
lastGroupHash = groups.hashCode();\r
- } else {\r
+ }\r
+ else\r
+ {\r
sortGroupAscending = !sortGroupAscending;\r
}\r
\r
//SORTS GROUPS BY SIZE\r
//////////////////////\r
- for(int i=0; i<align.getGroups().size(); i++)\r
+ for (int i = 0; i < align.getGroups().size(); i++)\r
{\r
- SequenceGroup sg = (SequenceGroup) align.getGroups().elementAt(i);\r
-\r
- for(int j=0; j<groups.size(); j++)\r
- {\r
- SequenceGroup sg2 = (SequenceGroup) groups.elementAt(j);\r
- if(sg.getSize() > sg2.getSize())\r
- {\r
- groups.insertElementAt(sg, j);\r
- break;\r
- }\r
- }\r
-\r
- if (!groups.contains(sg))\r
- {\r
- groups.addElement(sg);\r
- }\r
+ SequenceGroup sg = (SequenceGroup) align.getGroups().elementAt(i);\r
+\r
+ for (int j = 0; j < groups.size(); j++)\r
+ {\r
+ SequenceGroup sg2 = (SequenceGroup) groups.elementAt(j);\r
+\r
+ if (sg.getSize() > sg2.getSize())\r
+ {\r
+ groups.insertElementAt(sg, j);\r
+\r
+ break;\r
+ }\r
+ }\r
+\r
+ if (!groups.contains(sg))\r
+ {\r
+ groups.addElement(sg);\r
+ }\r
}\r
\r
//NOW ADD SEQUENCES MAINTAINING ALIGNMENT ORDER\r
///////////////////////////////////////////////\r
Vector seqs = new Vector();\r
+\r
for (int i = 0; i < groups.size(); i++)\r
{\r
SequenceGroup sg = (SequenceGroup) groups.elementAt(i);\r
- SequenceI [] orderedseqs = sg.getSequencesInOrder(align);\r
+ SequenceI[] orderedseqs = sg.getSequencesInOrder(align);\r
+\r
for (int j = 0; j < orderedseqs.length; j++)\r
{\r
seqs.addElement(orderedseqs[j]);\r
}\r
}\r
\r
- if (sortGroupAscending) {\r
+ if (sortGroupAscending)\r
+ {\r
setOrder(align, seqs);\r
- } else {\r
+ }\r
+ else\r
+ {\r
setReverseOrder(align,\r
vectorSubsetToArray(seqs, align.getSequences()));\r
}\r
}\r
\r
- private static SequenceI[] vectorToArray(Vector tmp) {\r
-\r
+ /**\r
+ * Converts Vector to array.\r
+ * java 1.18 does not have Vector.toArray()\r
+ *\r
+ * @param tmp Vector of SequenceI objects\r
+ *\r
+ * @return array of Sequence[]\r
+ */\r
+ private static SequenceI[] vectorToArray(Vector tmp)\r
+ {\r
SequenceI[] seqs = new SequenceI[tmp.size()];\r
\r
- for (int i = 0; i < tmp.size(); i++) {\r
+ for (int i = 0; i < tmp.size(); i++)\r
+ {\r
seqs[i] = (SequenceI) tmp.elementAt(i);\r
}\r
\r
return seqs;\r
}\r
\r
- private static SequenceI[] vectorSubsetToArray(Vector tmp, Vector mask) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param tmp DOCUMENT ME!\r
+ * @param mask DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ private static SequenceI[] vectorSubsetToArray(Vector tmp, Vector mask)\r
+ {\r
Vector seqs = new Vector();\r
int i;\r
boolean[] tmask = new boolean[mask.size()];\r
for (i = 0; i < mask.size(); i++)\r
tmask[i] = true;\r
\r
- for (i = 0; i < tmp.size(); i++) {\r
-\r
+ for (i = 0; i < tmp.size(); i++)\r
+ {\r
Object sq = tmp.elementAt(i);\r
\r
if (mask.contains(sq) && tmask[mask.indexOf(sq)])\r
}\r
\r
for (i = 0; i < tmask.length; i++)\r
- if (tmask[i]) {\r
+ if (tmask[i])\r
+ {\r
seqs.addElement(mask.elementAt(i));\r
}\r
\r
return vectorToArray(seqs);\r
}\r
\r
- public static void sortBy(AlignmentI align, AlignmentOrder order) {\r
+ /**\r
+ * Sorts by a given AlignmentOrder object\r
+ *\r
+ * @param align Alignment to order\r
+ * @param order specified order for alignment\r
+ */\r
+ public static void sortBy(AlignmentI align, AlignmentOrder order)\r
+ {\r
// Get an ordered vector of sequences which may also be present in align\r
Vector tmp = order.getOrder();\r
\r
- if (lastOrder == order) {\r
+ if (lastOrder == order)\r
+ {\r
sortOrderAscending = !sortOrderAscending;\r
- } else {\r
+ }\r
+ else\r
+ {\r
sortOrderAscending = true;\r
}\r
\r
- if (sortOrderAscending) {\r
+ if (sortOrderAscending)\r
+ {\r
setOrder(align, tmp);\r
- } else {\r
+ }\r
+ else\r
+ {\r
setReverseOrder(align,\r
vectorSubsetToArray(tmp, align.getSequences()));\r
}\r
}\r
\r
- public static Vector getOrderByTree(AlignmentI align, NJTree tree) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param align alignment to order\r
+ * @param tree tree which has\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ private static Vector getOrderByTree(AlignmentI align, NJTree tree)\r
+ {\r
int nSeq = align.getHeight();\r
\r
Vector tmp = new Vector();\r
\r
tmp = _sortByTree(tree.getTopNode(), tmp, align.getSequences());\r
\r
- if (tmp.size() != nSeq) {\r
+ if (tmp.size() != nSeq)\r
+ {\r
// TODO: JBPNote - decide if this is always an error\r
// (eg. not when a tree is associated to another alignment which has more\r
// sequences)\r
- if (tmp.size() < nSeq) {\r
+ if (tmp.size() < nSeq)\r
+ {\r
addStrays(align, tmp);\r
}\r
\r
- if (tmp.size() != nSeq) {\r
+ if (tmp.size() != nSeq)\r
+ {\r
System.err.println("ERROR: tmp.size()=" + tmp.size() +\r
" != nseq=" + nSeq + " in getOrderByTree");\r
}\r
return tmp;\r
}\r
\r
- public static void sortByTree(AlignmentI align, NJTree tree) {\r
+ /**\r
+ * Sorts the alignment by a given tree\r
+ *\r
+ * @param align alignment to order\r
+ * @param tree tree which has\r
+ */\r
+ public static void sortByTree(AlignmentI align, NJTree tree)\r
+ {\r
Vector tmp = getOrderByTree(align, tree);\r
\r
// tmp should properly permute align with tree.\r
- if (lastTree != tree) {\r
+ if (lastTree != tree)\r
+ {\r
sortTreeAscending = true;\r
lastTree = tree;\r
- } else {\r
+ }\r
+ else\r
+ {\r
sortTreeAscending = !sortTreeAscending;\r
}\r
\r
- if (sortTreeAscending) {\r
+ if (sortTreeAscending)\r
+ {\r
setOrder(align, tmp);\r
- } else {\r
+ }\r
+ else\r
+ {\r
setReverseOrder(align,\r
vectorSubsetToArray(tmp, align.getSequences()));\r
}\r
}\r
\r
- private static void addStrays(AlignmentI align, Vector seqs) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param align DOCUMENT ME!\r
+ * @param seqs DOCUMENT ME!\r
+ */\r
+ private static void addStrays(AlignmentI align, Vector seqs)\r
+ {\r
int nSeq = align.getHeight();\r
\r
- for (int i = 0; i < nSeq; i++) {\r
- if (!seqs.contains(align.getSequenceAt(i))) {\r
+ for (int i = 0; i < nSeq; i++)\r
+ {\r
+ if (!seqs.contains(align.getSequenceAt(i)))\r
+ {\r
seqs.addElement(align.getSequenceAt(i));\r
}\r
}\r
\r
- if (nSeq != seqs.size()) {\r
+ if (nSeq != seqs.size())\r
+ {\r
System.err.println(\r
"ERROR: Size still not right even after addStrays");\r
}\r
}\r
\r
- public static Vector _sortByTree(SequenceNode node, Vector tmp,\r
- Vector seqset) {\r
- if (node == null) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param node DOCUMENT ME!\r
+ * @param tmp DOCUMENT ME!\r
+ * @param seqset DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ private static Vector _sortByTree(SequenceNode node, Vector tmp,\r
+ Vector seqset)\r
+ {\r
+ if (node == null)\r
+ {\r
return tmp;\r
}\r
\r
SequenceNode left = (SequenceNode) node.left();\r
SequenceNode right = (SequenceNode) node.right();\r
\r
- if ((left == null) && (right == null)) {\r
- if (!node.isPlaceholder() && (node.element() != null)) {\r
- if (node.element() instanceof SequenceI) {\r
- if (!tmp.contains(node.element())) {\r
+ if ((left == null) && (right == null))\r
+ {\r
+ if (!node.isPlaceholder() && (node.element() != null))\r
+ {\r
+ if (node.element() instanceof SequenceI)\r
+ {\r
+ if (!tmp.contains(node.element()))\r
+ {\r
tmp.addElement((SequenceI) node.element());\r
}\r
}\r
}\r
\r
return tmp;\r
- } else {\r
+ }\r
+ else\r
+ {\r
_sortByTree(left, tmp, seqset);\r
_sortByTree(right, tmp, seqset);\r
}\r
* recover the order of sequences given by the safe numbering scheme introducd\r
* SeqsetUtils.uniquify.\r
*/\r
- public static void recoverOrder(SequenceI[] alignment) {\r
+ public static void recoverOrder(SequenceI[] alignment)\r
+ {\r
float[] ids = new float[alignment.length];\r
\r
for (int i = 0; i < alignment.length; i++)\r
\r
import jalview.datamodel.*;\r
\r
-import jalview.gui.*;\r
-\r
import java.util.*;\r
\r
\r
-public class Conservation {\r
+/**\r
+ * Calculates conservation values for a given set of sequences\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class Conservation\r
+{\r
Vector sequences;\r
int start;\r
int end;\r
int maxLength = 0; // used by quality calcs\r
boolean seqNumsChanged = false; // updated after any change via calcSeqNum;\r
Vector total = new Vector();\r
+\r
+ /** Stores calculated quality values */\r
public Vector quality;\r
+\r
+ /** Stores maximum and minimum values of quality values */\r
public Double[] qualityRange = new Double[2];\r
String consString = "";\r
Sequence consSequence;\r
String name = "";\r
int[][] cons2;\r
\r
+ /**\r
+ * Creates a new Conservation object.\r
+ *\r
+ * @param name Name of conservation\r
+ * @param propHash DOCUMENT ME!\r
+ * @param threshold to count the residues in residueHash(). commonly used value is 3\r
+ * @param sequences sequences to be used in calculation\r
+ * @param start start residue position\r
+ * @param end end residue position\r
+ */\r
public Conservation(String name, Hashtable propHash, int threshold,\r
- Vector sequences, int start, int end) {\r
+ Vector sequences, int start, int end)\r
+ {\r
this.name = name;\r
this.propHash = propHash;\r
this.threshold = threshold;\r
calcSeqNums();\r
}\r
\r
- private void calcSeqNums() {\r
- for (int i = 0; i < sequences.size(); i++) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ private void calcSeqNums()\r
+ {\r
+ for (int i = 0; i < sequences.size(); i++)\r
+ {\r
calcSeqNum(i);\r
}\r
}\r
\r
- private void calcSeqNum(int i) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param i DOCUMENT ME!\r
+ */\r
+ private void calcSeqNum(int i)\r
+ {\r
String sq = null; // for dumb jbuilder not-inited exception warning\r
int[] sqnum = null;\r
\r
- if ((i > -1) && (i < sequences.size())) {\r
+ if ((i > -1) && (i < sequences.size()))\r
+ {\r
sq = ((SequenceI) sequences.elementAt(i)).getSequence();\r
\r
- if (seqNums.size() <= i) {\r
+ if (seqNums.size() <= i)\r
+ {\r
seqNums.addElement(new int[sq.length() + 1]);\r
}\r
\r
- if (sq.hashCode() != ((int[]) seqNums.elementAt(i))[0]) {\r
+ if (sq.hashCode() != ((int[]) seqNums.elementAt(i))[0])\r
+ {\r
int j;\r
int len;\r
seqNumsChanged = true;\r
sq = ((SequenceI) sequences.elementAt(i)).getSequence();\r
len = sq.length();\r
\r
- if (maxLength < len) {\r
+ if (maxLength < len)\r
+ {\r
maxLength = len;\r
}\r
\r
sqnum = new int[len + 1]; // better to always make a new array - sequence can change its length\r
sqnum[0] = sq.hashCode();\r
\r
- for (j = 1; j <= len; j++) {\r
+ for (j = 1; j <= len; j++)\r
+ {\r
sqnum[j] = ((Integer) jalview.schemes.ResidueProperties.aaHash.get(new String(\r
sq.substring(j - 1, j)))).intValue(); // yuk\r
}\r
\r
seqNums.setElementAt(sqnum, i);\r
}\r
- } else {\r
+ }\r
+ else\r
+ {\r
// JBPNote INFO level debug\r
System.err.println(\r
"ERROR: calcSeqNum called with out of range sequence index for Alignment\n");\r
}\r
}\r
\r
- public void calculate() {\r
- for (int i = start; i <= end; i++) {\r
+ /**\r
+ * Calculates the conservation values for given set of sequences\r
+ */\r
+ public void calculate()\r
+ {\r
+ for (int i = start; i <= end; i++)\r
+ {\r
Hashtable resultHash = null;\r
Hashtable residueHash = null;\r
\r
resultHash = new Hashtable();\r
residueHash = new Hashtable();\r
\r
- for (int j = 0; j < sequences.size(); j++) {\r
+ for (int j = 0; j < sequences.size(); j++)\r
+ {\r
// JBPNote - have to make sure elements of the sequences vector\r
// are tested like this everywhere...\r
- if (sequences.elementAt(j) instanceof Sequence) {\r
+ if (sequences.elementAt(j) instanceof Sequence)\r
+ {\r
Sequence s = (Sequence) sequences.elementAt(j);\r
\r
- if (s.getLength() > i) {\r
+ if (s.getLength() > i)\r
+ {\r
String res = s.getSequence().substring(i, i + 1);\r
\r
- if (residueHash.containsKey(res)) {\r
+ if (residueHash.containsKey(res))\r
+ {\r
int count = ((Integer) residueHash.get(res)).intValue();\r
count++;\r
residueHash.put(res, new Integer(count));\r
- } else {\r
+ }\r
+ else\r
+ {\r
residueHash.put(res, new Integer(1));\r
}\r
- } else {\r
- if (residueHash.containsKey("-")) {\r
+ }\r
+ else\r
+ {\r
+ if (residueHash.containsKey("-"))\r
+ {\r
int count = ((Integer) residueHash.get("-")).intValue();\r
count++;\r
residueHash.put("-", new Integer(count));\r
- } else {\r
+ }\r
+ else\r
+ {\r
residueHash.put("-", new Integer(1));\r
}\r
}\r
//loop over all the found residues\r
Enumeration e = residueHash.keys();\r
\r
- while (e.hasMoreElements()) {\r
+ while (e.hasMoreElements())\r
+ {\r
String res = (String) e.nextElement();\r
\r
- if (((Integer) residueHash.get(res)).intValue() > thresh) {\r
+ if (((Integer) residueHash.get(res)).intValue() > thresh)\r
+ {\r
//Now loop over the properties\r
Enumeration e2 = propHash.keys();\r
\r
- while (e2.hasMoreElements()) {\r
+ while (e2.hasMoreElements())\r
+ {\r
String type = (String) e2.nextElement();\r
Hashtable ht = (Hashtable) propHash.get(type);\r
\r
//Have we ticked this before?\r
- if (!resultHash.containsKey(type)) {\r
- if (ht.containsKey(res)) {\r
+ if (!resultHash.containsKey(type))\r
+ {\r
+ if (ht.containsKey(res))\r
+ {\r
resultHash.put(type, ht.get(res));\r
- } else {\r
+ }\r
+ else\r
+ {\r
resultHash.put(type, ht.get("-"));\r
}\r
- } else if (((Integer) resultHash.get(type)).equals(\r
- (Integer) ht.get(res)) == false) {\r
+ }\r
+ else if (((Integer) resultHash.get(type)).equals(\r
+ (Integer) ht.get(res)) == false)\r
+ {\r
resultHash.put(type, new Integer(-1));\r
}\r
}\r
}\r
}\r
\r
- public int countGaps(int j) {\r
- int count = 0;\r
-\r
- for (int i = 0; i < sequences.size(); i++) {\r
- if ((j + 1) > ((Sequence) sequences.elementAt(i)).getSequence()\r
- .length()) {\r
- count++;\r
-\r
- continue;\r
- }\r
-\r
- char c = ((Sequence) sequences.elementAt(i)).getSequence().charAt(j);\r
-\r
- if (jalview.util.Comparison.isGap((c))) {\r
- count++;\r
- }\r
- }\r
-\r
- return count;\r
- }\r
\r
/***\r
* countConsNGaps\r
* returns gap count in int[0], and conserved residue count in int[1]\r
*/\r
- public int[] countConsNGaps(int j) {\r
+ public int[] countConsNGaps(int j)\r
+ {\r
int count = 0;\r
int cons = 0;\r
int nres = 0;\r
int[] r = new int[2];\r
char f = '$';\r
\r
- for (int i = 0; i < sequences.size(); i++) {\r
- if (j >= ((Sequence) sequences.elementAt(i)).getSequence().length()) {\r
+ for (int i = 0; i < sequences.size(); i++)\r
+ {\r
+ if (j >= ((Sequence) sequences.elementAt(i)).getSequence().length())\r
+ {\r
count++;\r
\r
continue;\r
\r
char c = ((Sequence) sequences.elementAt(i)).getSequence().charAt(j);\r
\r
- if (jalview.util.Comparison.isGap((c))) {\r
+ if (jalview.util.Comparison.isGap((c)))\r
+ {\r
count++;\r
- } else {\r
+ }\r
+ else\r
+ {\r
nres++;\r
\r
- if (nres == 1) {\r
+ if (nres == 1)\r
+ {\r
f = c;\r
cons++;\r
- } else if (f == c) {\r
+ }\r
+ else if (f == c)\r
+ {\r
cons++;\r
}\r
}\r
return r;\r
}\r
\r
- public void verdict(boolean consflag, float percentageGaps) {\r
+ /**\r
+ * Calculates the conservation sequence\r
+ *\r
+ * @param consflag if true, poitiveve conservation; false calculates negative conservation\r
+ * @param percentageGaps commonly used value is 25\r
+ */\r
+ public void verdict(boolean consflag, float percentageGaps)\r
+ {\r
String consString = "";\r
\r
- for (int i = start; i <= end; i++) {\r
+ for (int i = start; i <= end; i++)\r
+ {\r
int[] gapcons = countConsNGaps(i);\r
- boolean cons = (gapcons[0] == 1) ? true : false;\r
int totGaps = gapcons[1];\r
float pgaps = ((float) totGaps * 100) / (float) sequences.size();\r
\r
// System.out.println("percentage gaps = "+pgaps+"\n");\r
- if (percentageGaps > pgaps) {\r
+ if (percentageGaps > pgaps)\r
+ {\r
Hashtable resultHash = (Hashtable) total.elementAt(i - start);\r
\r
//Now find the verdict\r
int count = 0;\r
Enumeration e3 = resultHash.keys();\r
\r
- while (e3.hasMoreElements()) {\r
+ while (e3.hasMoreElements())\r
+ {\r
String type = (String) e3.nextElement();\r
Integer result = (Integer) resultHash.get(type);\r
\r
//Do we want to count +ve conservation or +ve and -ve cons.?\r
- if (consflag) {\r
- if (result.intValue() == 1) {\r
+ if (consflag)\r
+ {\r
+ if (result.intValue() == 1)\r
+ {\r
count++;\r
}\r
- } else {\r
- if (result.intValue() != -1) {\r
+ }\r
+ else\r
+ {\r
+ if (result.intValue() != -1)\r
+ {\r
count++;\r
}\r
}\r
}\r
\r
- if (count < 10) {\r
+ if (count < 10)\r
+ {\r
consString = consString + String.valueOf(count); // Conserved props!=Identity\r
- } else {\r
+ }\r
+ else\r
+ {\r
consString = consString + ((gapcons[0] == 1) ? "*" : "+");\r
}\r
- } else {\r
+ }\r
+ else\r
+ {\r
consString = consString + "-";\r
}\r
}\r
consSequence = new Sequence(name, consString, start, end);\r
}\r
\r
- public Sequence getConsSequence() {\r
+ /**\r
+ *\r
+ *\r
+ * @return Conservation sequence\r
+ */\r
+ public Sequence getConsSequence()\r
+ {\r
return consSequence;\r
}\r
\r
// From Alignment.java in jalview118\r
- public void findQuality() {\r
+ public void findQuality()\r
+ {\r
findQuality(0, maxLength - 1);\r
}\r
\r
- private void percentIdentity2() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ private void percentIdentity2()\r
+ {\r
calcSeqNums(); // updates maxLength, too.\r
\r
- if ((cons2 == null) || seqNumsChanged) {\r
+ if ((cons2 == null) || seqNumsChanged)\r
+ {\r
cons2 = new int[maxLength][24];\r
\r
// Initialize the array\r
- for (int j = 0; j < 24; j++) {\r
- for (int i = 0; i < maxLength; i++) {\r
+ for (int j = 0; j < 24; j++)\r
+ {\r
+ for (int i = 0; i < maxLength; i++)\r
+ {\r
cons2[i][j] = 0;\r
}\r
}\r
int[] sqnum;\r
int j = 0;\r
\r
- while (j < sequences.size()) {\r
+ while (j < sequences.size())\r
+ {\r
sqnum = (int[]) seqNums.elementAt(j);\r
\r
- for (int i = 1; i < sqnum.length; i++) {\r
+ for (int i = 1; i < sqnum.length; i++)\r
+ {\r
cons2[i - 1][sqnum[i]]++;\r
}\r
\r
- for (int i = sqnum.length - 1; i < maxLength; i++) {\r
+ for (int i = sqnum.length - 1; i < maxLength; i++)\r
+ {\r
cons2[i][23]++; // gap count\r
}\r
\r
}\r
}\r
\r
- public void findQuality(int start, int end) {\r
+ /**\r
+ * Calculates the quality of the set of sequences\r
+ *\r
+ * @param start Start residue\r
+ * @param end End residue\r
+ */\r
+ public void findQuality(int start, int end)\r
+ {\r
quality = new Vector();\r
\r
double max = -10000;\r
for (int l = 0; l < size; l++)\r
lengths[l] = ((int[]) seqNums.elementAt(l)).length - 1;\r
\r
- for (int j = start; j <= end; j++) {\r
+ for (int j = start; j <= end; j++)\r
+ {\r
double bigtot = 0;\r
\r
// First Xr = depends on column only\r
double[] x = new double[24];\r
\r
- for (int ii = 0; ii < 24; ii++) {\r
+ for (int ii = 0; ii < 24; ii++)\r
+ {\r
x[ii] = 0;\r
\r
- try {\r
- for (int i2 = 0; i2 < 24; i2++) {\r
+ try\r
+ {\r
+ for (int i2 = 0; i2 < 24; i2++)\r
+ {\r
x[ii] += (((double) cons2[j][i2] * BLOSUM62[ii][i2]) +\r
4);\r
}\r
- } catch (Exception e) {\r
+ }\r
+ catch (Exception e)\r
+ {\r
System.err.println("Exception during quality calculation.");\r
e.printStackTrace();\r
}\r
}\r
\r
// Now calculate D for each position and sum\r
- for (int k = 0; k < size; k++) {\r
+ for (int k = 0; k < size; k++)\r
+ {\r
double tot = 0;\r
double[] xx = new double[24];\r
int seqNum = (j < lengths[k])\r
? ((int[]) seqNums.elementAt(k))[j + 1] : 23; // Sequence, or gap at the end\r
\r
// This is a loop over r\r
- for (int i = 0; i < 23; i++) {\r
+ for (int i = 0; i < 23; i++)\r
+ {\r
double sr = 0;\r
\r
- try {\r
+ try\r
+ {\r
sr = (double) BLOSUM62[i][seqNum] + 4;\r
- } catch (Exception e) {\r
+ }\r
+ catch (Exception e)\r
+ {\r
System.out.println("Exception in sr: " + e);\r
e.printStackTrace();\r
}\r
}\r
\r
// This is the quality for one column\r
- if (max < bigtot) {\r
+ if (max < bigtot)\r
+ {\r
max = bigtot;\r
}\r
\r
\r
double newmax = -10000;\r
\r
- for (int j = start; j <= end; j++) {\r
+ for (int j = start; j <= end; j++)\r
+ {\r
double tmp = ((Double) quality.elementAt(j)).doubleValue();\r
tmp = ((max - tmp) * (size - cons2[j][23])) / size;\r
\r
// System.out.println(tmp+ " " + j);\r
quality.setElementAt(new Double(tmp), j);\r
\r
- if (tmp > newmax) {\r
+ if (tmp > newmax)\r
+ {\r
newmax = tmp;\r
}\r
}\r
import java.util.*;\r
\r
\r
-public class NJTree {\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class NJTree\r
+{\r
Vector cluster;\r
SequenceI[] sequence;\r
int[] done;\r
int start;\r
int end;\r
\r
- public NJTree(SequenceNode node) {\r
+ /**\r
+ * Creates a new NJTree object.\r
+ *\r
+ * @param node DOCUMENT ME!\r
+ */\r
+ public NJTree(SequenceNode node)\r
+ {\r
top = node;\r
maxheight = findHeight(top);\r
}\r
\r
- public NJTree(SequenceI[] seqs, NewickFile treefile) {\r
+ /**\r
+ * Creates a new NJTree object.\r
+ *\r
+ * @param seqs DOCUMENT ME!\r
+ * @param treefile DOCUMENT ME!\r
+ */\r
+ public NJTree(SequenceI[] seqs, NewickFile treefile)\r
+ {\r
top = treefile.getTree();\r
maxheight = findHeight(top);\r
\r
SequenceI nam;\r
String realnam;\r
\r
- while (i < leaves.size()) {\r
+ while (i < leaves.size())\r
+ {\r
j = (SequenceNode) leaves.elementAt(i++);\r
realnam = j.getName();\r
nam = null;\r
\r
- if (namesleft > -1) {\r
+ if (namesleft > -1)\r
+ {\r
nam = algnIds.findIdMatch(realnam);\r
}\r
\r
- if (nam != null) {\r
+ if (nam != null)\r
+ {\r
j.setElement(nam);\r
namesleft--;\r
- } else {\r
+ }\r
+ else\r
+ {\r
j.setElement(new Sequence(realnam, "THISISAPLACEHLDER"));\r
j.setPlaceholder(true);\r
}\r
}\r
}\r
\r
- public NJTree(SequenceI[] sequence, int start, int end) {\r
+ /**\r
+ * Creates a new NJTree object.\r
+ *\r
+ * @param sequence DOCUMENT ME!\r
+ * @param start DOCUMENT ME!\r
+ * @param end DOCUMENT ME!\r
+ */\r
+ public NJTree(SequenceI[] sequence, int start, int end)\r
+ {\r
this(sequence, "NJ", "BL", start, end);\r
}\r
\r
+ /**\r
+ * Creates a new NJTree object.\r
+ *\r
+ * @param sequence DOCUMENT ME!\r
+ * @param type DOCUMENT ME!\r
+ * @param pwtype DOCUMENT ME!\r
+ * @param start DOCUMENT ME!\r
+ * @param end DOCUMENT ME!\r
+ */\r
public NJTree(SequenceI[] sequence, String type, String pwtype, int start,\r
- int end) {\r
+ int end)\r
+ {\r
this.sequence = sequence;\r
this.node = new Vector();\r
this.type = type;\r
this.start = start;\r
this.end = end;\r
\r
- if (!(type.equals("NJ"))) {\r
+ if (!(type.equals("NJ")))\r
+ {\r
type = "AV";\r
}\r
\r
- if (!(pwtype.equals("PID"))) {\r
+ if (!(pwtype.equals("PID")))\r
+ {\r
type = "BL";\r
}\r
\r
\r
done = new int[sequence.length];\r
\r
- while ((i < sequence.length) && (sequence[i] != null)) {\r
+ while ((i < sequence.length) && (sequence[i] != null))\r
+ {\r
done[i] = 0;\r
i++;\r
}\r
cluster();\r
}\r
\r
- public String toString() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public String toString()\r
+ {\r
jalview.io.NewickFile fout = new jalview.io.NewickFile(getTopNode());\r
\r
return fout.print(false, true); // distances only\r
*\r
* @param alignment Vector\r
*/\r
- public void UpdatePlaceHolders(Vector alignment) {\r
+ public void UpdatePlaceHolders(Vector alignment)\r
+ {\r
Vector leaves = new Vector();\r
findLeaves(top, leaves);\r
\r
SequenceIdMatcher seqmatcher = null;\r
int i = 0;\r
\r
- while (i < sz) {\r
+ while (i < sz)\r
+ {\r
SequenceNode leaf = (SequenceNode) leaves.elementAt(i++);\r
\r
- if (alignment.contains(leaf.element())) {\r
+ if (alignment.contains(leaf.element()))\r
+ {\r
leaf.setPlaceholder(false);\r
- } else {\r
- if (seqmatcher == null) {\r
+ }\r
+ else\r
+ {\r
+ if (seqmatcher == null)\r
+ {\r
// Only create this the first time we need it\r
SequenceI[] seqs = new SequenceI[alignment.size()];\r
\r
\r
SequenceI nam = seqmatcher.findIdMatch(leaf.getName());\r
\r
- if (nam != null) {\r
+ if (nam != null)\r
+ {\r
leaf.setPlaceholder(false);\r
leaf.setElement(nam);\r
- } else {\r
+ }\r
+ else\r
+ {\r
leaf.setPlaceholder(true);\r
}\r
}\r
}\r
}\r
\r
- public void cluster() {\r
- while (noClus > 2) {\r
- if (type.equals("NJ")) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ public void cluster()\r
+ {\r
+ while (noClus > 2)\r
+ {\r
+ if (type.equals("NJ"))\r
+ {\r
float mind = findMinNJDistance();\r
- } else {\r
+ }\r
+ else\r
+ {\r
float mind = findMinDistance();\r
}\r
\r
int one = -1;\r
int two = -1;\r
\r
- for (int i = 0; i < noseqs; i++) {\r
- if (done[i] != 1) {\r
- if (onefound == false) {\r
+ for (int i = 0; i < noseqs; i++)\r
+ {\r
+ if (done[i] != 1)\r
+ {\r
+ if (onefound == false)\r
+ {\r
two = i;\r
onefound = true;\r
- } else {\r
+ }\r
+ else\r
+ {\r
one = i;\r
}\r
}\r
findMaxDist(top);\r
}\r
\r
- public Cluster joinClusters(int i, int j) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param i DOCUMENT ME!\r
+ * @param j DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public Cluster joinClusters(int i, int j)\r
+ {\r
float dist = distance[i][j];\r
\r
int noi = ((Cluster) cluster.elementAt(i)).value.length;\r
\r
int[] value = new int[noi + noj];\r
\r
- for (int ii = 0; ii < noi; ii++) {\r
+ for (int ii = 0; ii < noi; ii++)\r
+ {\r
value[ii] = ((Cluster) cluster.elementAt(i)).value[ii];\r
}\r
\r
- for (int ii = noi; ii < (noi + noj); ii++) {\r
+ for (int ii = noi; ii < (noi + noj); ii++)\r
+ {\r
value[ii] = ((Cluster) cluster.elementAt(j)).value[ii - noi];\r
}\r
\r
ri = findr(i, j);\r
rj = findr(j, i);\r
\r
- if (type.equals("NJ")) {\r
+ if (type.equals("NJ"))\r
+ {\r
findClusterNJDistance(i, j);\r
- } else {\r
+ }\r
+ else\r
+ {\r
findClusterDistance(i, j);\r
}\r
\r
SequenceNode tmpi = (SequenceNode) (node.elementAt(i));\r
SequenceNode tmpj = (SequenceNode) (node.elementAt(j));\r
\r
- if (type.equals("NJ")) {\r
+ if (type.equals("NJ"))\r
+ {\r
findNewNJDistances(tmpi, tmpj, dist);\r
- } else {\r
+ }\r
+ else\r
+ {\r
findNewDistances(tmpi, tmpj, dist);\r
}\r
\r
return c;\r
}\r
\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param tmpi DOCUMENT ME!\r
+ * @param tmpj DOCUMENT ME!\r
+ * @param dist DOCUMENT ME!\r
+ */\r
public void findNewNJDistances(SequenceNode tmpi, SequenceNode tmpj,\r
- float dist) {\r
+ float dist)\r
+ {\r
float ih = 0;\r
float jh = 0;\r
\r
tmpi.dist = ((dist + ri) - rj) / 2;\r
tmpj.dist = (dist - tmpi.dist);\r
\r
- if (tmpi.dist < 0) {\r
+ if (tmpi.dist < 0)\r
+ {\r
tmpi.dist = 0;\r
}\r
\r
- if (tmpj.dist < 0) {\r
+ if (tmpj.dist < 0)\r
+ {\r
tmpj.dist = 0;\r
}\r
}\r
\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param tmpi DOCUMENT ME!\r
+ * @param tmpj DOCUMENT ME!\r
+ * @param dist DOCUMENT ME!\r
+ */\r
public void findNewDistances(SequenceNode tmpi, SequenceNode tmpj,\r
- float dist) {\r
+ float dist)\r
+ {\r
float ih = 0;\r
float jh = 0;\r
\r
SequenceNode sni = tmpi;\r
SequenceNode snj = tmpj;\r
\r
- while (sni != null) {\r
+ while (sni != null)\r
+ {\r
ih = ih + sni.dist;\r
sni = (SequenceNode) sni.left();\r
}\r
\r
- while (snj != null) {\r
+ while (snj != null)\r
+ {\r
jh = jh + snj.dist;\r
snj = (SequenceNode) snj.left();\r
}\r
tmpj.dist = ((dist / 2) - jh);\r
}\r
\r
- public void findClusterDistance(int i, int j) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param i DOCUMENT ME!\r
+ * @param j DOCUMENT ME!\r
+ */\r
+ public void findClusterDistance(int i, int j)\r
+ {\r
int noi = ((Cluster) cluster.elementAt(i)).value.length;\r
int noj = ((Cluster) cluster.elementAt(j)).value.length;\r
\r
// New distances from cluster to others\r
float[] newdist = new float[noseqs];\r
\r
- for (int l = 0; l < noseqs; l++) {\r
- if ((l != i) && (l != j)) {\r
+ for (int l = 0; l < noseqs; l++)\r
+ {\r
+ if ((l != i) && (l != j))\r
+ {\r
newdist[l] = ((distance[i][l] * noi) + (distance[j][l] * noj)) / (noi +\r
noj);\r
- } else {\r
+ }\r
+ else\r
+ {\r
newdist[l] = 0;\r
}\r
}\r
\r
- for (int ii = 0; ii < noseqs; ii++) {\r
+ for (int ii = 0; ii < noseqs; ii++)\r
+ {\r
distance[i][ii] = newdist[ii];\r
distance[ii][i] = newdist[ii];\r
}\r
}\r
\r
- public void findClusterNJDistance(int i, int j) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param i DOCUMENT ME!\r
+ * @param j DOCUMENT ME!\r
+ */\r
+ public void findClusterNJDistance(int i, int j)\r
+ {\r
int noi = ((Cluster) cluster.elementAt(i)).value.length;\r
int noj = ((Cluster) cluster.elementAt(j)).value.length;\r
\r
// New distances from cluster to others\r
float[] newdist = new float[noseqs];\r
\r
- for (int l = 0; l < noseqs; l++) {\r
- if ((l != i) && (l != j)) {\r
+ for (int l = 0; l < noseqs; l++)\r
+ {\r
+ if ((l != i) && (l != j))\r
+ {\r
newdist[l] = ((distance[i][l] + distance[j][l]) -\r
distance[i][j]) / 2;\r
- } else {\r
+ }\r
+ else\r
+ {\r
newdist[l] = 0;\r
}\r
}\r
\r
- for (int ii = 0; ii < noseqs; ii++) {\r
+ for (int ii = 0; ii < noseqs; ii++)\r
+ {\r
distance[i][ii] = newdist[ii];\r
distance[ii][i] = newdist[ii];\r
}\r
}\r
\r
- public float findr(int i, int j) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param i DOCUMENT ME!\r
+ * @param j DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public float findr(int i, int j)\r
+ {\r
float tmp = 1;\r
\r
- for (int k = 0; k < noseqs; k++) {\r
- if ((k != i) && (k != j) && (done[k] != 1)) {\r
+ for (int k = 0; k < noseqs; k++)\r
+ {\r
+ if ((k != i) && (k != j) && (done[k] != 1))\r
+ {\r
tmp = tmp + distance[i][k];\r
}\r
}\r
\r
- if (noClus > 2) {\r
+ if (noClus > 2)\r
+ {\r
tmp = tmp / (noClus - 2);\r
}\r
\r
return tmp;\r
}\r
\r
- public float findMinNJDistance() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public float findMinNJDistance()\r
+ {\r
float min = 100000;\r
\r
- for (int i = 0; i < (noseqs - 1); i++) {\r
- for (int j = i + 1; j < noseqs; j++) {\r
- if ((done[i] != 1) && (done[j] != 1)) {\r
+ for (int i = 0; i < (noseqs - 1); i++)\r
+ {\r
+ for (int j = i + 1; j < noseqs; j++)\r
+ {\r
+ if ((done[i] != 1) && (done[j] != 1))\r
+ {\r
float tmp = distance[i][j] - (findr(i, j) + findr(j, i));\r
\r
- if (tmp < min) {\r
+ if (tmp < min)\r
+ {\r
mini = i;\r
minj = j;\r
\r
return min;\r
}\r
\r
- public float findMinDistance() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public float findMinDistance()\r
+ {\r
float min = 100000;\r
\r
- for (int i = 0; i < (noseqs - 1); i++) {\r
- for (int j = i + 1; j < noseqs; j++) {\r
- if ((done[i] != 1) && (done[j] != 1)) {\r
- if (distance[i][j] < min) {\r
+ for (int i = 0; i < (noseqs - 1); i++)\r
+ {\r
+ for (int j = i + 1; j < noseqs; j++)\r
+ {\r
+ if ((done[i] != 1) && (done[j] != 1))\r
+ {\r
+ if (distance[i][j] < min)\r
+ {\r
mini = i;\r
minj = j;\r
\r
return min;\r
}\r
\r
- public float[][] findDistances() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public float[][] findDistances()\r
+ {\r
float[][] distance = new float[noseqs][noseqs];\r
\r
- if (pwtype.equals("PID")) {\r
- for (int i = 0; i < (noseqs - 1); i++) {\r
- for (int j = i; j < noseqs; j++) {\r
- if (j == i) {\r
+ if (pwtype.equals("PID"))\r
+ {\r
+ for (int i = 0; i < (noseqs - 1); i++)\r
+ {\r
+ for (int j = i; j < noseqs; j++)\r
+ {\r
+ if (j == i)\r
+ {\r
distance[i][i] = 0;\r
- } else {\r
+ }\r
+ else\r
+ {\r
distance[i][j] = 100 -\r
Comparison.PID(sequence[i], sequence[j], start, end);\r
distance[j][i] = distance[i][j];\r
}\r
}\r
}\r
- } else if (pwtype.equals("BL")) {\r
+ }\r
+ else if (pwtype.equals("BL"))\r
+ {\r
int maxscore = 0;\r
\r
- for (int i = 0; i < (noseqs - 1); i++) {\r
- for (int j = i; j < noseqs; j++) {\r
+ for (int i = 0; i < (noseqs - 1); i++)\r
+ {\r
+ for (int j = i; j < noseqs; j++)\r
+ {\r
int score = 0;\r
\r
- for (int k = start; k < end; k++) {\r
- try {\r
+ for (int k = start; k < end; k++)\r
+ {\r
+ try\r
+ {\r
score += ResidueProperties.getBLOSUM62(sequence[i].getSequence(\r
k, k + 1), sequence[j].getSequence(k, k +\r
1));\r
- } catch (Exception ex) {\r
+ }\r
+ catch (Exception ex)\r
+ {\r
System.err.println("err creating BLOSUM62 tree");\r
ex.printStackTrace();\r
}\r
\r
distance[i][j] = (float) score;\r
\r
- if (score > maxscore) {\r
+ if (score > maxscore)\r
+ {\r
maxscore = score;\r
}\r
}\r
}\r
\r
- for (int i = 0; i < (noseqs - 1); i++) {\r
- for (int j = i; j < noseqs; j++) {\r
+ for (int i = 0; i < (noseqs - 1); i++)\r
+ {\r
+ for (int j = i; j < noseqs; j++)\r
+ {\r
distance[i][j] = (float) maxscore - distance[i][j];\r
distance[j][i] = distance[i][j];\r
}\r
}\r
- } else if (pwtype.equals("SW")) {\r
+ }\r
+ else if (pwtype.equals("SW"))\r
+ {\r
float max = -1;\r
\r
- for (int i = 0; i < (noseqs - 1); i++) {\r
- for (int j = i; j < noseqs; j++) {\r
+ for (int i = 0; i < (noseqs - 1); i++)\r
+ {\r
+ for (int j = i; j < noseqs; j++)\r
+ {\r
AlignSeq as = new AlignSeq(sequence[i], sequence[j], "pep");\r
as.calcScoreMatrix();\r
as.traceAlignment();\r
as.printAlignment();\r
distance[i][j] = (float) as.maxscore;\r
\r
- if (max < distance[i][j]) {\r
+ if (max < distance[i][j])\r
+ {\r
max = distance[i][j];\r
}\r
}\r
}\r
\r
- for (int i = 0; i < (noseqs - 1); i++) {\r
- for (int j = i; j < noseqs; j++) {\r
+ for (int i = 0; i < (noseqs - 1); i++)\r
+ {\r
+ for (int j = i; j < noseqs; j++)\r
+ {\r
distance[i][j] = max - distance[i][j];\r
distance[j][i] = distance[i][j];\r
}\r
return distance;\r
}\r
\r
- public void makeLeaves() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ public void makeLeaves()\r
+ {\r
cluster = new Vector();\r
\r
- for (int i = 0; i < noseqs; i++) {\r
+ for (int i = 0; i < noseqs; i++)\r
+ {\r
SequenceNode sn = new SequenceNode();\r
\r
sn.setElement(sequence[i]);\r
}\r
}\r
\r
- public Vector findLeaves(SequenceNode node, Vector leaves) {\r
- if (node == null) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param node DOCUMENT ME!\r
+ * @param leaves DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public Vector findLeaves(SequenceNode node, Vector leaves)\r
+ {\r
+ if (node == null)\r
+ {\r
return leaves;\r
}\r
\r
- if ((node.left() == null) && (node.right() == null)) {\r
+ if ((node.left() == null) && (node.right() == null))\r
+ {\r
leaves.addElement(node);\r
\r
return leaves;\r
- } else {\r
+ }\r
+ else\r
+ {\r
findLeaves((SequenceNode) node.left(), leaves);\r
findLeaves((SequenceNode) node.right(), leaves);\r
}\r
return leaves;\r
}\r
\r
- public Object findLeaf(SequenceNode node, int count) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param node DOCUMENT ME!\r
+ * @param count DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public Object findLeaf(SequenceNode node, int count)\r
+ {\r
found = _findLeaf(node, count);\r
\r
return found;\r
}\r
\r
- public Object _findLeaf(SequenceNode node, int count) {\r
- if (node == null) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param node DOCUMENT ME!\r
+ * @param count DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public Object _findLeaf(SequenceNode node, int count)\r
+ {\r
+ if (node == null)\r
+ {\r
return null;\r
}\r
\r
- if (node.ycount == count) {\r
+ if (node.ycount == count)\r
+ {\r
found = node.element();\r
\r
return found;\r
- } else {\r
+ }\r
+ else\r
+ {\r
_findLeaf((SequenceNode) node.left(), count);\r
_findLeaf((SequenceNode) node.right(), count);\r
}\r
*\r
* @param node SequenceNode\r
*/\r
- public void printNode(SequenceNode node) {\r
- if (node == null) {\r
+ public void printNode(SequenceNode node)\r
+ {\r
+ if (node == null)\r
+ {\r
return;\r
}\r
\r
- if ((node.left() == null) && (node.right() == null)) {\r
+ if ((node.left() == null) && (node.right() == null))\r
+ {\r
System.out.println("Leaf = " +\r
((SequenceI) node.element()).getName());\r
System.out.println("Dist " + ((SequenceNode) node).dist);\r
System.out.println("Boot " + node.getBootstrap());\r
- } else {\r
+ }\r
+ else\r
+ {\r
System.out.println("Dist " + ((SequenceNode) node).dist);\r
printNode((SequenceNode) node.left());\r
printNode((SequenceNode) node.right());\r
}\r
}\r
\r
- public void findMaxDist(SequenceNode node) {\r
- if (node == null) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param node DOCUMENT ME!\r
+ */\r
+ public void findMaxDist(SequenceNode node)\r
+ {\r
+ if (node == null)\r
+ {\r
return;\r
}\r
\r
- if ((node.left() == null) && (node.right() == null)) {\r
+ if ((node.left() == null) && (node.right() == null))\r
+ {\r
float dist = ((SequenceNode) node).dist;\r
\r
- if (dist > maxDistValue) {\r
+ if (dist > maxDistValue)\r
+ {\r
maxdist = (SequenceNode) node;\r
maxDistValue = dist;\r
}\r
- } else {\r
+ }\r
+ else\r
+ {\r
findMaxDist((SequenceNode) node.left());\r
findMaxDist((SequenceNode) node.right());\r
}\r
}\r
\r
- public Vector getGroups() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public Vector getGroups()\r
+ {\r
return groups;\r
}\r
\r
- public float getMaxHeight() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public float getMaxHeight()\r
+ {\r
return maxheight;\r
}\r
\r
- public void groupNodes(SequenceNode node, float threshold) {\r
- if (node == null) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param node DOCUMENT ME!\r
+ * @param threshold DOCUMENT ME!\r
+ */\r
+ public void groupNodes(SequenceNode node, float threshold)\r
+ {\r
+ if (node == null)\r
+ {\r
return;\r
}\r
\r
- if ((node.height / maxheight) > threshold) {\r
+ if ((node.height / maxheight) > threshold)\r
+ {\r
groups.addElement(node);\r
- } else {\r
+ }\r
+ else\r
+ {\r
groupNodes((SequenceNode) node.left(), threshold);\r
groupNodes((SequenceNode) node.right(), threshold);\r
}\r
}\r
\r
- public float findHeight(SequenceNode node) {\r
- if (node == null) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param node DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public float findHeight(SequenceNode node)\r
+ {\r
+ if (node == null)\r
+ {\r
return maxheight;\r
}\r
\r
- if ((node.left() == null) && (node.right() == null)) {\r
+ if ((node.left() == null) && (node.right() == null))\r
+ {\r
node.height = ((SequenceNode) node.parent()).height + node.dist;\r
\r
- if (node.height > maxheight) {\r
+ if (node.height > maxheight)\r
+ {\r
return node.height;\r
- } else {\r
+ }\r
+ else\r
+ {\r
return maxheight;\r
}\r
- } else {\r
- if (node.parent() != null) {\r
+ }\r
+ else\r
+ {\r
+ if (node.parent() != null)\r
+ {\r
node.height = ((SequenceNode) node.parent()).height +\r
node.dist;\r
- } else {\r
+ }\r
+ else\r
+ {\r
maxheight = 0;\r
node.height = (float) 0.0;\r
}\r
return maxheight;\r
}\r
\r
- public SequenceNode reRoot() {\r
- if (maxdist != null) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public SequenceNode reRoot()\r
+ {\r
+ if (maxdist != null)\r
+ {\r
ycount = 0;\r
\r
float tmpdist = maxdist.dist;\r
return top;\r
}\r
\r
- public static void printN(SequenceNode node) {\r
- if (node == null) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param node DOCUMENT ME!\r
+ */\r
+ public static void printN(SequenceNode node)\r
+ {\r
+ if (node == null)\r
+ {\r
return;\r
}\r
\r
- if ((node.left() != null) && (node.right() != null)) {\r
+ if ((node.left() != null) && (node.right() != null))\r
+ {\r
printN((SequenceNode) node.left());\r
printN((SequenceNode) node.right());\r
- } else {\r
+ }\r
+ else\r
+ {\r
System.out.println(" name = " +\r
((SequenceI) node.element()).getName());\r
}\r
((SequenceNode) node).count + " " + ((SequenceNode) node).height);\r
}\r
\r
- public void reCount(SequenceNode node) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param node DOCUMENT ME!\r
+ */\r
+ public void reCount(SequenceNode node)\r
+ {\r
ycount = 0;\r
_reCount(node);\r
}\r
\r
- public void _reCount(SequenceNode node) {\r
- if (node == null) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param node DOCUMENT ME!\r
+ */\r
+ public void _reCount(SequenceNode node)\r
+ {\r
+ if (node == null)\r
+ {\r
return;\r
}\r
\r
- if ((node.left() != null) && (node.right() != null)) {\r
+ if ((node.left() != null) && (node.right() != null))\r
+ {\r
_reCount((SequenceNode) node.left());\r
_reCount((SequenceNode) node.right());\r
\r
\r
((SequenceNode) node).count = l.count + r.count;\r
((SequenceNode) node).ycount = (l.ycount + r.ycount) / 2;\r
- } else {\r
+ }\r
+ else\r
+ {\r
((SequenceNode) node).count = 1;\r
((SequenceNode) node).ycount = ycount++;\r
}\r
}\r
\r
- public void swapNodes(SequenceNode node) {\r
- if (node == null) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param node DOCUMENT ME!\r
+ */\r
+ public void swapNodes(SequenceNode node)\r
+ {\r
+ if (node == null)\r
+ {\r
return;\r
}\r
\r
node.setRight(tmp);\r
}\r
\r
- public void changeDirection(SequenceNode node, SequenceNode dir) {\r
- if (node == null) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param node DOCUMENT ME!\r
+ * @param dir DOCUMENT ME!\r
+ */\r
+ public void changeDirection(SequenceNode node, SequenceNode dir)\r
+ {\r
+ if (node == null)\r
+ {\r
return;\r
}\r
\r
- if (node.parent() != top) {\r
+ if (node.parent() != top)\r
+ {\r
changeDirection((SequenceNode) node.parent(), node);\r
\r
SequenceNode tmp = (SequenceNode) node.parent();\r
\r
- if (dir == node.left()) {\r
+ if (dir == node.left())\r
+ {\r
node.setParent(dir);\r
node.setLeft(tmp);\r
- } else if (dir == node.right()) {\r
+ }\r
+ else if (dir == node.right())\r
+ {\r
node.setParent(dir);\r
node.setRight(tmp);\r
}\r
- } else {\r
- if (dir == node.left()) {\r
+ }\r
+ else\r
+ {\r
+ if (dir == node.left())\r
+ {\r
node.setParent(node.left());\r
\r
- if (top.left() == node) {\r
+ if (top.left() == node)\r
+ {\r
node.setRight(top.right());\r
- } else {\r
+ }\r
+ else\r
+ {\r
node.setRight(top.left());\r
}\r
- } else {\r
+ }\r
+ else\r
+ {\r
node.setParent(node.right());\r
\r
- if (top.left() == node) {\r
+ if (top.left() == node)\r
+ {\r
node.setLeft(top.right());\r
- } else {\r
+ }\r
+ else\r
+ {\r
node.setLeft(top.left());\r
}\r
}\r
}\r
}\r
\r
- public void setMaxDist(SequenceNode node) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param node DOCUMENT ME!\r
+ */\r
+ public void setMaxDist(SequenceNode node)\r
+ {\r
this.maxdist = maxdist;\r
}\r
\r
- public SequenceNode getMaxDist() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public SequenceNode getMaxDist()\r
+ {\r
return maxdist;\r
}\r
\r
- public SequenceNode getTopNode() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public SequenceNode getTopNode()\r
+ {\r
return top;\r
}\r
}\r
\r
\r
-class Cluster {\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+class Cluster\r
+{\r
int[] value;\r
\r
- public Cluster(int[] value) {\r
+ /**\r
+ * Creates a new Cluster object.\r
+ *\r
+ * @param value DOCUMENT ME!\r
+ */\r
+ public Cluster(int[] value)\r
+ {\r
this.value = value;\r
}\r
}\r
\r
import jalview.util.*;\r
\r
-import java.awt.*;\r
-\r
import java.io.*;\r
\r
\r
-public class PCA implements Runnable {\r
+/**\r
+ * Performs Principal Component Analysis on given sequences\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class PCA implements Runnable\r
+{\r
Matrix m;\r
Matrix symm;\r
Matrix m2;\r
double[] eigenvalue;\r
Matrix eigenvector;\r
\r
- public PCA(Matrix m) {\r
- this.m = m;\r
- }\r
\r
- public PCA(SequenceI[] s) {\r
- Runtime rt = Runtime.getRuntime();\r
+ /**\r
+ * Creates a new PCA object.\r
+ *\r
+ * @param s Set of sequences to perform PCA on\r
+ */\r
+ public PCA(SequenceI[] s)\r
+ {\r
\r
BinarySequence[] bs = new BinarySequence[s.length];\r
int ii = 0;\r
\r
- while ((ii < s.length) && (s[ii] != null)) {\r
+ while ((ii < s.length) && (s[ii] != null))\r
+ {\r
bs[ii] = new BinarySequence(s[ii]);\r
bs[ii].encode();\r
ii++;\r
BinarySequence[] bs2 = new BinarySequence[s.length];\r
ii = 0;\r
\r
- while ((ii < s.length) && (s[ii] != null)) {\r
+ while ((ii < s.length) && (s[ii] != null))\r
+ {\r
bs2[ii] = new BinarySequence(s[ii]);\r
bs2[ii].blosumEncode();\r
ii++;\r
//printMemory(rt);\r
int count = 0;\r
\r
- while ((count < bs.length) && (bs[count] != null)) {\r
+ while ((count < bs.length) && (bs[count] != null))\r
+ {\r
count++;\r
}\r
\r
double[][] seqmat2 = new double[count][bs2[0].getDBinary().length];\r
int i = 0;\r
\r
- while (i < count) {\r
+ while (i < count)\r
+ {\r
seqmat[i] = bs[i].getDBinary();\r
seqmat2[i] = bs2[i].getDBinary();\r
i++;\r
m = new Matrix(seqmat, count, bs[0].getDBinary().length);\r
m2 = new Matrix(seqmat2, count, bs2[0].getDBinary().length);\r
\r
- //System.out.println("Created matrix");\r
- printMemory(rt);\r
- }\r
+ }\r
\r
- public static void printMemory(Runtime rt) {\r
- System.out.println("PCA:Free memory = " + rt.freeMemory());\r
- }\r
+ /**\r
+ * Returns the matrix used in PCA calculation\r
+ *\r
+ * @return java.math.Matrix object\r
+ */\r
\r
- public Matrix getM() {\r
+ public Matrix getM()\r
+ {\r
return m;\r
- }\r
-\r
- public double[] getEigenvector(int i) {\r
- return eigenvector.getColumn(i);\r
- }\r
-\r
- public double getEigenvalue(int i) {\r
+ }\r
+\r
+ /**\r
+ * Returns Eigenvalue\r
+ *\r
+ * @param i Index of diagonal within matrix\r
+ *\r
+ * @return Returns value of diagonal from matrix\r
+ */\r
+ public double getEigenvalue(int i)\r
+ {\r
return eigenvector.d[i];\r
}\r
\r
- public float[][] getComponents(int l, int n, int mm) {\r
- return getComponents(l, n, mm, 1);\r
- }\r
-\r
- public float[][] getComponents(int l, int n, int mm, float factor) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param l DOCUMENT ME!\r
+ * @param n DOCUMENT ME!\r
+ * @param mm DOCUMENT ME!\r
+ * @param factor DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public float[][] getComponents(int l, int n, int mm, float factor)\r
+ {\r
float[][] out = new float[m.rows][3];\r
\r
- for (int i = 0; i < m.rows; i++) {\r
+ for (int i = 0; i < m.rows; i++)\r
+ {\r
out[i][0] = (float) component(i, l) * factor;\r
out[i][1] = (float) component(i, n) * factor;\r
out[i][2] = (float) component(i, mm) * factor;\r
return out;\r
}\r
\r
- public double[] component(int n) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param n DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public double[] component(int n)\r
+ {\r
// n = index of eigenvector\r
double[] out = new double[m.rows];\r
\r
- for (int i = 0; i < m.rows; i++) {\r
+ for (int i = 0; i < m.rows; i++)\r
+ {\r
out[i] = component(i, n);\r
}\r
\r
return out;\r
}\r
\r
- public double component(int row, int n) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param row DOCUMENT ME!\r
+ * @param n DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ double component(int row, int n)\r
+ {\r
double out = 0.0;\r
\r
- for (int i = 0; i < symm.cols; i++) {\r
+ for (int i = 0; i < symm.cols; i++)\r
+ {\r
out += (symm.value[row][i] * eigenvector.value[i][n]);\r
}\r
\r
return out / eigenvector.d[n];\r
}\r
\r
- public void checkEigenvector(int n, PrintStream ps) {\r
- ps.println(" --- Eigenvector " + n + " --- ");\r
-\r
- double[] eigenv = eigenvector.getColumn(n);\r
-\r
- for (int i = 0; i < eigenv.length; i++) {\r
- Format.print(ps, "%15.4f", eigenv[i]);\r
- }\r
-\r
- System.out.println();\r
-\r
- double[] neigenv = symm.vectorPostMultiply(eigenv);\r
- System.out.println(" --- symmat * eigenv / lambda --- ");\r
-\r
- if (eigenvector.d[n] > 1e-4) {\r
- for (int i = 0; i < neigenv.length; i++) {\r
- Format.print(System.out, "%15.4f", neigenv[i] / eigenvector.d[n]);\r
- }\r
- }\r
-\r
- System.out.println();\r
- }\r
\r
- public void run() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ public void run()\r
+ {\r
Matrix mt = m.transpose();\r
\r
// System.out.println(" --- OrigT * Orig ---- ");\r
-/*
-* Jalview - A Sequence Alignment Editor and Viewer
-* Copyright (C) 2005 AM Waterhouse, J Procter, 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 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.
-*
-* 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
-*/\r
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
+ */\r
package jalview.analysis;\r
\r
-import jalview.datamodel.SequenceI;\r
-\r
-import java.util.Hashtable;\r
-\r
-\r
-/**
- * <p>Title: </p>
- *
- * <p>Description: </p>
- *
- * <p>Copyright: Copyright (c) 2004</p>
- *
- * <p>Company: Dundee University</p>
- *
- * @author not attributable
- * @version 1.0
- */\r
-public class SeqsetUtils {\r
- /**
- * Store essential properties of a sequence in a hashtable for later recovery
- * Keys are Name, Start, End, SeqFeatures, PdbId
- * @param seq SequenceI
- * @return Hashtable
+import java.util.*;\r
+\r
+import jalview.datamodel.*;\r
+\r
+/**\r
+ * <p>Title: </p>\r
+ *\r
+ * <p>Description: </p>\r
+ *\r
+ * <p>Copyright: Copyright (c) 2004</p>\r
+ *\r
+ * <p>Company: Dundee University</p>\r
+ *\r
+ * @author not attributable\r
+ * @version 1.0\r
*/\r
- public static Hashtable SeqCharacterHash(SequenceI seq) {\r
- Hashtable sqinfo = new Hashtable();\r
- sqinfo.put("Name", seq.getName());\r
- sqinfo.put("Start", new Integer(seq.getStart()));\r
- sqinfo.put("End", new Integer(seq.getEnd()));\r
- sqinfo.put("SeqFeatures", seq.getSequenceFeatures());\r
- sqinfo.put("PdbId",\r
- (seq.getPDBId() != null) ? seq.getPDBId() : new String(""));\r
-\r
- return sqinfo;\r
+public class SeqsetUtils\r
+{\r
+ /**\r
+ * Store essential properties of a sequence in a hashtable for later recovery\r
+ * Keys are Name, Start, End, SeqFeatures, PdbId\r
+ * @param seq SequenceI\r
+ * @return Hashtable\r
+ */\r
+ public static Hashtable SeqCharacterHash(SequenceI seq)\r
+ {\r
+ Hashtable sqinfo = new Hashtable();\r
+ sqinfo.put("Name", seq.getName());\r
+ sqinfo.put("Start", new Integer(seq.getStart()));\r
+ sqinfo.put("End", new Integer(seq.getEnd()));\r
+ sqinfo.put("SeqFeatures", seq.getSequenceFeatures());\r
+ sqinfo.put("PdbId",\r
+ (seq.getPDBId() != null) ? seq.getPDBId() : new String(""));\r
+\r
+ return sqinfo;\r
+ }\r
+\r
+ /**\r
+ * Recover essential properties of a sequence from a hashtable\r
+ * TODO: replace these methods with something more elegant.\r
+ * @param sq SequenceI\r
+ * @param sqinfo Hashtable\r
+ * @return boolean\r
+ */\r
+ public static boolean SeqCharacterUnhash(SequenceI sq, Hashtable sqinfo)\r
+ {\r
+ boolean namePresent = true;\r
+ String oldname = (String) sqinfo.get("Name");\r
+ Integer start = (Integer) sqinfo.get("Start");\r
+ Integer end = (Integer) sqinfo.get("End");\r
+ java.util.Vector sfeatures = (java.util.Vector) sqinfo.get(\r
+ "SeqFeatures");\r
+ String pdbid = (String) sqinfo.get("PdbId");\r
+\r
+ if (oldname == null)\r
+ {\r
+ namePresent = false;\r
}\r
-\r
- /**
- * Recover essential properties of a sequence from a hashtable
- * TODO: replace these methods with something more elegant.
- * @param sq SequenceI
- * @param sqinfo Hashtable
- * @return boolean
- */\r
- public static boolean SeqCharacterUnhash(SequenceI sq, Hashtable sqinfo) {\r
- boolean namePresent = true;\r
- String oldname = (String) sqinfo.get("Name");\r
- Integer start = (Integer) sqinfo.get("Start");\r
- Integer end = (Integer) sqinfo.get("End");\r
- java.util.Vector sfeatures = (java.util.Vector) sqinfo.get(\r
- "SeqFeatures");\r
- String pdbid = (String) sqinfo.get("PdbId");\r
-\r
- if (oldname == null) {\r
- namePresent = false;\r
- } else {\r
- sq.setName(oldname);\r
- }\r
-\r
- if (!pdbid.equals("")) {\r
- sq.setPDBId(pdbid);\r
- }\r
-\r
- if ((start != null) && (end != null)) {\r
- sq.setStart(start.intValue());\r
- sq.setEnd(end.intValue());\r
- }\r
-\r
- if (sfeatures != null) {\r
- sq.setSequenceFeatures(sfeatures);\r
- }\r
-\r
- return namePresent;\r
+ else\r
+ {\r
+ sq.setName(oldname);\r
}\r
\r
- /**
- * Form of the unique name used in uniquify for the i'th sequence in an ordered vector of sequences.
- * @param i int
- * @return String
- */\r
- public static String unique_name(int i) {\r
- return new String("Sequence" + i);\r
+ if (!pdbid.equals(""))\r
+ {\r
+ sq.setPDBId(pdbid);\r
}\r
\r
- public static Hashtable uniquify(SequenceI[] sequences, boolean write_names) {\r
- // Generate a safely named sequence set and a hash to recover the sequence names\r
- Hashtable map = new Hashtable();\r
- String[] un_names = new String[sequences.length];\r
-\r
- if (!write_names) {\r
- for (int i = 0; i < sequences.length; i++) {\r
- String safename = new String("Sequence" + i);\r
- map.put(safename, SeqCharacterHash(sequences[i]));\r
-\r
- if (write_names) {\r
- sequences[i].setName(safename);\r
- }\r
- }\r
- }\r
+ if ( (start != null) && (end != null))\r
+ {\r
+ sq.setStart(start.intValue());\r
+ sq.setEnd(end.intValue());\r
+ }\r
\r
- return map;\r
+ if (sfeatures != null)\r
+ {\r
+ sq.setSequenceFeatures(sfeatures);\r
}\r
\r
- public static boolean deuniquify(Hashtable map, SequenceI[] sequences) {\r
- // recover unsafe sequence names for a sequence set\r
- boolean allfound = true;\r
-\r
- for (int i = 0; i < sequences.length; i++) {\r
- if (map.containsKey(sequences[i].getName())) {\r
- Hashtable sqinfo = (Hashtable) map.get(sequences[i].getName());\r
- SeqCharacterUnhash(sequences[i], sqinfo);\r
- } else {\r
- allfound = false;\r
- }\r
+ return namePresent;\r
+ }\r
+\r
+ /**\r
+ * Form of the unique name used in uniquify for the i'th sequence in an ordered vector of sequences.\r
+ * @param i int\r
+ * @return String\r
+ */\r
+ public static String unique_name(int i)\r
+ {\r
+ return new String("Sequence" + i);\r
+ }\r
+\r
+ public static Hashtable uniquify(SequenceI[] sequences, boolean write_names)\r
+ {\r
+ // Generate a safely named sequence set and a hash to recover the sequence names\r
+ Hashtable map = new Hashtable();\r
+ String[] un_names = new String[sequences.length];\r
+\r
+ if (!write_names)\r
+ {\r
+ for (int i = 0; i < sequences.length; i++)\r
+ {\r
+ String safename = new String("Sequence" + i);\r
+ map.put(safename, SeqCharacterHash(sequences[i]));\r
+\r
+ if (write_names)\r
+ {\r
+ sequences[i].setName(safename);\r
}\r
+ }\r
+ }\r
\r
- return allfound;\r
+ return map;\r
+ }\r
+\r
+ public static boolean deuniquify(Hashtable map, SequenceI[] sequences)\r
+ {\r
+ // recover unsafe sequence names for a sequence set\r
+ boolean allfound = true;\r
+\r
+ for (int i = 0; i < sequences.length; i++)\r
+ {\r
+ if (map.containsKey(sequences[i].getName()))\r
+ {\r
+ Hashtable sqinfo = (Hashtable) map.get(sequences[i].getName());\r
+ SeqCharacterUnhash(sequences[i], sqinfo);\r
+ }\r
+ else\r
+ {\r
+ allfound = false;\r
+ }\r
}\r
+\r
+ return allfound;\r
+ }\r
}\r
-/*
-* Jalview - A Sequence Alignment Editor and Viewer
-* Copyright (C) 2005 AM Waterhouse, J Procter, 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 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.
-*
-* 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
-*/\r
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
+ */\r
package jalview.analysis;\r
\r
-import jalview.datamodel.SequenceI;\r
-\r
-import java.util.Hashtable;\r
-import java.util.Vector;\r
-\r
-\r
-/**
- * <p>Title: </p>
- * SequenceIdMatcher
- * <p>Description: </p>
- * Routine which does approximate Sequence Id resolution by name using string containment rather than equivalence
- * <p>Copyright: Copyright (c) 2004</p>
- *
- * <p>Company: Dundee University</p>
- *
- * @author not attributable
- * @version 1.0
+import java.util.*;\r
+\r
+import jalview.datamodel.*;\r
+\r
+/**\r
+ * <p>Title: </p>\r
+ * SequenceIdMatcher\r
+ * <p>Description: </p>\r
+ * Routine which does approximate Sequence Id resolution by name using string containment rather than equivalence\r
+ * <p>Copyright: Copyright (c) 2004</p>\r
+ *\r
+ * <p>Company: Dundee University</p>\r
+ *\r
+ * @author not attributable\r
+ * @version 1.0\r
*/\r
-public class SequenceIdMatcher {\r
- private Hashtable names;\r
+public class SequenceIdMatcher\r
+{\r
+ private Hashtable names;\r
\r
- public SequenceIdMatcher(SequenceI[] seqs) {\r
- names = new Hashtable();\r
+ public SequenceIdMatcher(SequenceI[] seqs)\r
+ {\r
+ names = new Hashtable();\r
\r
- for (int i = 0; i < seqs.length; i++) {\r
- names.put(new SeqIdName(seqs[i].getName()), seqs[i]);\r
- }\r
+ for (int i = 0; i < seqs.length; i++)\r
+ {\r
+ names.put(new SeqIdName(seqs[i].getName()), seqs[i]);\r
}\r
+ }\r
\r
- SequenceI findIdMatch(SequenceI seq) {\r
- SeqIdName nam = new SeqIdName(seq.getName());\r
+ SequenceI findIdMatch(SequenceI seq)\r
+ {\r
+ SeqIdName nam = new SeqIdName(seq.getName());\r
\r
- if (names.containsKey(nam)) {\r
- return (SequenceI) names.get(nam);\r
- }\r
-\r
- return null;\r
+ if (names.containsKey(nam))\r
+ {\r
+ return (SequenceI) names.get(nam);\r
}\r
\r
- SequenceI findIdMatch(String seqnam) {\r
- SeqIdName nam = new SeqIdName(seqnam);\r
+ return null;\r
+ }\r
\r
- if (names.containsKey(nam)) {\r
- return (SequenceI) names.get(nam);\r
- }\r
+ SequenceI findIdMatch(String seqnam)\r
+ {\r
+ SeqIdName nam = new SeqIdName(seqnam);\r
\r
- return null;\r
+ if (names.containsKey(nam))\r
+ {\r
+ return (SequenceI) names.get(nam);\r
}\r
\r
- /**
- * findIdMatch
- *
- * Return pointers to sequences (or sequence object containers)
- * which have same Id as a given set of different sequence objects
- *
- * @param seqs SequenceI[]
- * @return SequenceI[]
- */\r
- SequenceI[] findIdMatch(SequenceI[] seqs) {\r
- SequenceI[] namedseqs = new SequenceI[seqs.length];\r
-\r
- int i = 0;\r
- SeqIdName nam;\r
-\r
- if (seqs.length > 0) {\r
- do {\r
- nam = new SeqIdName(seqs[i].getName());\r
-\r
- if (names.containsKey(nam)) {\r
- namedseqs[i] = (SequenceI) names.get(nam);\r
- } else {\r
- namedseqs[i] = null;\r
- }\r
- } while (i++ < seqs.length);\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * findIdMatch\r
+ *\r
+ * Return pointers to sequences (or sequence object containers)\r
+ * which have same Id as a given set of different sequence objects\r
+ *\r
+ * @param seqs SequenceI[]\r
+ * @return SequenceI[]\r
+ */\r
+ SequenceI[] findIdMatch(SequenceI[] seqs)\r
+ {\r
+ SequenceI[] namedseqs = new SequenceI[seqs.length];\r
+\r
+ int i = 0;\r
+ SeqIdName nam;\r
+\r
+ if (seqs.length > 0)\r
+ {\r
+ do\r
+ {\r
+ nam = new SeqIdName(seqs[i].getName());\r
+\r
+ if (names.containsKey(nam))\r
+ {\r
+ namedseqs[i] = (SequenceI) names.get(nam);\r
}\r
-\r
- return namedseqs;\r
+ else\r
+ {\r
+ namedseqs[i] = null;\r
+ }\r
+ }\r
+ while (i++ < seqs.length);\r
}\r
\r
- private class SeqIdName {\r
- String id;\r
+ return namedseqs;\r
+ }\r
\r
- SeqIdName(String s) {\r
- id = new String(s);\r
- }\r
+ private class SeqIdName\r
+ {\r
+ String id;\r
\r
- public int hashCode() {\r
- return (id.substring(0, 4).hashCode());\r
- }\r
+ SeqIdName(String s)\r
+ {\r
+ id = new String(s);\r
+ }\r
\r
- public boolean equals(Object s) {\r
- if (s instanceof SeqIdName) {\r
- return this.equals((SeqIdName) s);\r
- } else {\r
- if (s instanceof String) {\r
- return this.equals((String) s);\r
- }\r
- }\r
+ public int hashCode()\r
+ {\r
+ return (id.substring(0, 4).hashCode());\r
+ }\r
\r
- return false;\r
+ public boolean equals(Object s)\r
+ {\r
+ if (s instanceof SeqIdName)\r
+ {\r
+ return this.equals( (SeqIdName) s);\r
+ }\r
+ else\r
+ {\r
+ if (s instanceof String)\r
+ {\r
+ return this.equals( (String) s);\r
}\r
+ }\r
\r
- public boolean equals(SeqIdName s) {\r
- if (id.startsWith(s.id) || s.id.startsWith(id)) {\r
- return true;\r
- }\r
+ return false;\r
+ }\r
\r
- return false;\r
- }\r
+ public boolean equals(SeqIdName s)\r
+ {\r
+ if (id.startsWith(s.id) || s.id.startsWith(id))\r
+ {\r
+ return true;\r
+ }\r
\r
- public boolean equals(String s) {\r
- if (id.startsWith(s) || s.startsWith(id)) {\r
- return true;\r
- }\r
+ return false;\r
+ }\r
\r
- return false;\r
- }\r
+ public boolean equals(String s)\r
+ {\r
+ if (id.startsWith(s) || s.startsWith(id))\r
+ {\r
+ return true;\r
+ }\r
+\r
+ return false;\r
}\r
+ }\r
}\r
row.annotations[j - 1].secondaryStructure))\r
{\r
\r
- g.drawString(row.annotations[j].displayCharacter, x,\r
+ g.drawString(row.annotations[j].displayCharacter, x + charOffset,\r
y + iconOffset + 2);\r
}\r
\r
if (searchResults != null && searchResults.contains(s))\r
{\r
gg.setColor(Color.black);\r
- gg.fillRect(0, AlignmentUtil.getPixelHeight(starty, i, charHeight) + ypos,\r
+ gg.fillRect(0, ((i - starty) * charHeight) + ypos,\r
getSize().width, charHeight);\r
gg.setColor(Color.white);\r
}\r
av.getSelectionGroup().sequences.contains(s))\r
{\r
gg.setColor(Color.lightGray);\r
- gg.fillRect(0, AlignmentUtil.getPixelHeight(starty, i, charHeight) + ypos,\r
+ gg.fillRect(0, ((i - starty) * charHeight) + ypos,\r
getSize().width, charHeight);\r
gg.setColor(Color.white);\r
}\r
else\r
{\r
gg.setColor(s.getColor());\r
- gg.fillRect(0, AlignmentUtil.getPixelHeight(starty, i, charHeight) + ypos,\r
+ gg.fillRect(0, ((i - starty) * charHeight) + ypos,\r
getSize().width, charHeight);\r
gg.setColor(Color.black);\r
}\r
}\r
\r
gg.drawString(string, 0,\r
- AlignmentUtil.getPixelHeight(starty, i, charHeight) + ypos +\r
+ ((i - starty) * charHeight) + ypos +\r
charHeight - (charHeight / 5));\r
\r
}\r
gg.setColor(currentColor);\r
\r
gg.fillRect(0,\r
- AlignmentUtil.getPixelHeight(starty, i, av.charHeight),\r
+ ((i - starty) * av.charHeight),\r
getSize().width,\r
av.charHeight);\r
\r
string = av.alignment.getSequenceAt(i).getDisplayId();\r
}\r
gg.drawString(string, 0,\r
- AlignmentUtil.getPixelHeight(starty, i, av.charHeight) +\r
+ ((i - starty) * av.charHeight) +\r
av.charHeight - (av.charHeight / 5));\r
}\r
\r
sr.drawSequence(g, nextSeq, av.alignment.findAllGroups(nextSeq), x1, x2,\r
(x1 - startx) * av.charWidth,\r
offset +\r
- AlignmentUtil.getPixelHeight(starty, i, av.charHeight),\r
+ (i-starty)*av.charHeight,\r
av.charWidth, av.charHeight);\r
\r
if (av.showSequenceFeatures)\r
fr.drawSequence(g, nextSeq, av.alignment.findAllGroups(nextSeq), x1, x2,\r
(x1 - startx) * av.charWidth,\r
offset +\r
- AlignmentUtil.getPixelHeight(starty, i, av.charHeight),\r
+ (i-starty)*av.charHeight,\r
av.charWidth, av.charHeight);\r
}\r
}\r
for (i = y1; i < y2; i++)\r
{\r
sx = (group.getStartRes() - startx) * av.charWidth;\r
- sy = offset + AlignmentUtil.getPixelHeight(starty, i, av.charHeight);\r
+ sy = offset + (i-starty)*av.charHeight;\r
ex = (group.getEndRes() + 1 - group.getStartRes()) * av.charWidth - 1;\r
\r
if (sx < getSize().width\r
bottom = -1;\r
\r
}\r
- sy = offset + AlignmentUtil.getPixelHeight(starty, i, av.charHeight);\r
+ sy = offset + (i-starty)*av.charHeight;\r
g.drawLine(sx, oldY, sx, sy);\r
g.drawLine(sx + ex, oldY, sx + ex, sy);\r
inGroup = false;\r
searchEnd,\r
(searchStart - startx) * av.charWidth,\r
offset +\r
- AlignmentUtil.getPixelHeight(starty,\r
- searchSeq,\r
- av.charHeight),\r
+ (searchSeq-starty)*av.charHeight,\r
av.charWidth,\r
av.charHeight);\r
}\r
/*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
-*\r
-* This program is free software; you can redistribute it and/or\r
-* modify it under the terms of the GNU General Public License\r
-* as published by the Free Software Foundation; either version 2\r
-* of the License, or (at your option) any later version.\r
-*\r
-* This program is distributed in the hope that it will be useful,\r
-* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-* GNU General Public License for more details.\r
-*\r
-* You should have received a copy of the GNU General Public License\r
-* along with this program; if not, write to the Free Software\r
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
-*/\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
+ */\r
package jalview.bin;\r
\r
import java.io.*;\r
\r
import java.util.*;\r
-import java.util.jar.*;\r
\r
\r
-public class Cache {\r
- public static String VERSION = "Release 2.0";\r
+/**\r
+ * Stores and retrieves Jalview Application Properties\r
+ * <br><br>Current properties include:\r
+ * <br>logs.Axis.Level - one of the stringified Levels for log4j controlling the logging level for axis (used for web services)\r
+ * <br>logs.Castor.Level - one of the stringified Levels for log4j controlling the logging level for castor (used for serialization)\r
+ * <br>jalview.browser - used in the jalview.utils.browserLauncher class if it doesn't know what else to do.\r
+ * <br>SCREEN_WIDTH,SCREEN_HEIGHT,SCREEN_Y=285,SCREEN_X=371,SHOW_FULLSCREEN\r
+ * FONT_NAME,FONT_SIZE,FONT_STYLE,GAP_SYMBOL,LAST_DIRECTORY,USER_DEFINED_COLOUR\r
+ * SHOW_FULL_ID,SHOW_IDENTITY,SHOW_QUALITY,SHOW_ANNOTATIONS,SHOW_CONSERVATION,\r
+ * DEFAULT_COLOUR,DEFAULT_FILE_FORMAT,STARTUP_FILE,SHOW_STARTUP_FILE\r
+\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class Cache\r
+{\r
+ /** Current release tag */\r
+ public static String VERSION = "AW Test";\r
+\r
+ /** Date Jalview was last packaged, else compilation date of Cache.class */\r
public static String BUILD_DATE = "";\r
+\r
+ /** Jalview Properties */\r
public static Properties applicationProperties;\r
\r
- // Current properties include:\r
- //\r
- // LAST_DIRECTORY , use this to cache record of where the user looked to find a file\r
- // UNIPROT_CACHE\r
- // USER_DEFINED_COLOUR - file describing last user set colours\r
- // FONT_NAME\r
- // FONT_STYLE\r
- // FONT_SIZE\r
- // logs.Axis.Level - one of the stringified Levels for log4j controlling the logging level for axis (used for web services)\r
- // logs.Castor.Level - one of the stringified Levels for log4j controlling the logging level for castor (used for serialization)\r
- // jalview.browser - used in the jalview.utils.browserLauncher class if it doesn't know what else to do.\r
- public static void loadProperties() {\r
+ /** Default file is ~/.jalview_properties */\r
+ static String propertiesFile;\r
+\r
+ /** Called when Jalview is started */\r
+ public static void loadProperties(String propsFile)\r
+ {\r
+ propertiesFile = propsFile;\r
+ if (propsFile == null)\r
+ {\r
+ propertiesFile = System.getProperty("user.home") + "/.jalview_properties";\r
+ }\r
+\r
+\r
// get last build time.\r
long date = 0;\r
\r
- try {\r
+ try\r
+ {\r
String localFile = Cache.class.getProtectionDomain().getCodeSource()\r
.getLocation().toString();\r
localFile = localFile.concat("!/");\r
java.net.URL localJarFileURL = new java.net.URL(localJarFileString);\r
java.net.JarURLConnection localJarFile = (java.net.JarURLConnection) localJarFileURL.openConnection();\r
date = localJarFile.getLastModified();\r
- } catch (Exception ex) {\r
+ }\r
+ catch (Exception ex)\r
+ {\r
ex.printStackTrace();\r
}\r
\r
- if (date == 0) {\r
+ if (date == 0)\r
+ {\r
// this is called for unpackaged class files, ie not in a Jar file\r
// InstallAnywhere version will find build date this way\r
// not entirely accurate as it only tells you when Cache.class was last compiled\r
date = f.lastModified();\r
}\r
\r
- if (date != 0) {\r
+ if (date != 0)\r
+ {\r
BUILD_DATE = new Date(date).toString();\r
}\r
\r
applicationProperties = new Properties();\r
\r
- try {\r
- FileInputStream in = new FileInputStream(System.getProperty(\r
- "user.home") + "/.jalview_properties");\r
+ try\r
+ {\r
+ FileInputStream in = new FileInputStream(propertiesFile);\r
applicationProperties = new Properties();\r
applicationProperties.load(in);\r
in.close();\r
- } catch (Exception ex) {\r
+ }\r
+ catch (Exception ex)\r
+ {\r
}\r
}\r
\r
- public static String getProperty(String key) {\r
+ /**\r
+ * Gets Jalview application property of given key. Returns null\r
+ * if key not found\r
+ *\r
+ * @param key Name of property\r
+ *\r
+ * @return Property value\r
+ */\r
+ public static String getProperty(String key)\r
+ {\r
return applicationProperties.getProperty(key);\r
}\r
\r
- public static String setProperty(String key, String obj) {\r
- try {\r
- FileOutputStream out = new FileOutputStream(System.getProperty(\r
- "user.home") + "/.jalview_properties");\r
+ /**\r
+ * Stores property in the file "HOME_DIR/.jalview_properties"\r
+ *\r
+ * @param key Name of object\r
+ * @param obj String value of property\r
+ *\r
+ * @return String value of property\r
+ */\r
+ public static String setProperty(String key, String obj)\r
+ {\r
+ try\r
+ {\r
+ FileOutputStream out = new FileOutputStream(propertiesFile);\r
\r
applicationProperties.setProperty(key, obj);\r
\r
applicationProperties.store(out, "---JalviewX Properties File---");\r
out.close();\r
- } catch (Exception ex) {\r
+ }\r
+ catch (Exception ex)\r
+ {\r
}\r
\r
return obj;\r
/*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
-*\r
-* This program is free software; you can redistribute it and/or\r
-* modify it under the terms of the GNU General Public License\r
-* as published by the Free Software Foundation; either version 2\r
-* of the License, or (at your option) any later version.\r
-*\r
-* This program is distributed in the hope that it will be useful,\r
-* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-* GNU General Public License for more details.\r
-*\r
-* You should have received a copy of the GNU General Public License\r
-* along with this program; if not, write to the Free Software\r
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
-*/\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
+ */\r
package jalview.bin;\r
\r
import jalview.gui.*;\r
\r
-import jalview.io.*;\r
-\r
import org.apache.log4j.*;\r
\r
-import java.awt.event.*;\r
-\r
import javax.swing.*;\r
\r
-\r
-public class Jalview extends JApplet {\r
- public static JApplet applet;\r
- Desktop frame;\r
-\r
- public void init() {\r
- applet = this;\r
- Cache.loadProperties();\r
- jalview.gui.Preferences.initPreferences();\r
-\r
- frame = new Desktop();\r
- frame.setResizable(true);\r
- frame.setVisible(true);\r
- frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);\r
- frame.addWindowListener(new WindowAdapter() {\r
- public void windowClosing(WindowEvent e) {\r
- applet.stop();\r
- applet.destroy();\r
- }\r
- });\r
-\r
- String file = getParameter("alignment");\r
-\r
- if (file != null) {\r
- jalview.bin.Cache.setProperty("LAST_DIRECTORY", file);\r
-\r
- String protocol = "File";\r
-\r
- if (file.indexOf("http:") > -1) {\r
- protocol = "URL";\r
- }\r
-\r
- String format = jalview.io.IdentifyFile.Identify(file, protocol);\r
-\r
- frame.LoadFile(file, protocol, format);\r
- }\r
- }\r
-\r
- public void destroy() {\r
- if (applet != null) {\r
- applet.stop();\r
- } else {\r
- System.exit(0);\r
- }\r
-\r
- frame.setVisible(false);\r
- }\r
-\r
- private static void initLogger() {\r
+import java.util.Vector;\r
+\r
+\r
+/**\r
+ * Main class for Jalview Application\r
+ * <br>\r
+ * <br>start with java -Djava.ext.dirs=$PATH_TO_LIB$ jalview.bin.Jalview\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class Jalview\r
+{\r
+ /**\r
+ * Initialises the Apache Axis logger\r
+ */\r
+ private static void initLogger()\r
+ {\r
Logger laxis = Logger.getLogger("org.apache.axis");\r
Logger lcastor = Logger.getLogger("org.exolab.castor");\r
- if (Cache.getProperty("logs.Axis.Level") == null) {\r
+\r
+ if (Cache.getProperty("logs.Axis.Level") == null)\r
+ {\r
Cache.setProperty("logs.Axis.Level", Level.INFO.toString());\r
}\r
- if (Cache.getProperty("logs.Castor.Level") == null) {\r
+\r
+ if (Cache.getProperty("logs.Castor.Level") == null)\r
+ {\r
Cache.setProperty("logs.Castor.Level", Level.INFO.toString());\r
}\r
\r
lcastor.addAppender(ap);\r
}\r
\r
- public static void main(String[] args) {\r
- Cache.loadProperties();\r
- jalview.gui.Preferences.initPreferences();\r
-\r
- try {\r
- initLogger();\r
- } catch (Exception e) {\r
- System.err.println("Problems initializing the log4j system\n");\r
- e.printStackTrace();\r
- }\r
-\r
- try {\r
+ /**\r
+ * main class for Jalview application\r
+ *\r
+ * @param args open <em>filename</em>\r
+ */\r
+ public static void main(String[] args)\r
+ {\r
+ ArgsParser aparser = new ArgsParser(args);\r
+\r
+ try\r
+ {\r
UIManager.setLookAndFeel(\r
- // "javax.swing.plaf.metal.MetalLookAndFeel"\r
+ // "javax.swing.plaf.metal.MetalLookAndFeel"\r
// "javax.swing.plaf.multi.MultiLookAndFeel"\r
UIManager.getSystemLookAndFeelClassName());\r
- } catch (Exception ex) {\r
+ }\r
+ catch (Exception ex)\r
+ {\r
}\r
\r
- Desktop frame = new Desktop();\r
- frame.setResizable(true);\r
- frame.setVisible(true);\r
+ Cache.loadProperties(aparser.getValue("props"));\r
+ jalview.gui.Preferences.initPreferences();\r
+ try\r
+ {\r
+ initLogger();\r
+ }\r
+ catch (Exception e)\r
+ {\r
+ System.err.println("Problems initializing the log4j system\n");\r
+ }\r
+\r
+\r
+ String file = null, protocol = null, format = null, groups=null;\r
+ Desktop desktop = new Desktop();\r
+\r
+\r
+ if(args==null || args.length==0)\r
+ {\r
+ desktop.setVisible(true);\r
+ }\r
+ else\r
+ {\r
+ if( aparser.contains("help") || aparser.contains("h") )\r
+ {\r
+ System.out.println("Usage: jalview -open [FILE] [OUTPUT_FORMAT] [OUTPUT_FILE]\n\n"\r
+ +"-nodisplay\tRun Jalview without User Interface.\n"\r
+ +"-props FILE\tUse the given Jalview properties file instead of users default.\n"\r
+ +"-groups FILE\tUse the given file to mark groups on the alignment. \nGroups file is in the following tab delimited format\n"\r
+ +"TEXT<tab>SEQUENCE_ID<tab>SEQUENCE_INDEX<tab>START_RESIDUE<tab>END_RESIDUE<tab>COLOUR\n"\r
+ +"SequenceID is used in preference to SequenceIndex if both are provided.\n"\r
+ +"Enter ID_NOT_SPECIFIED for SEQUENCE_ID or -1 for SEQUENCE_INDEX if unknown.\n"\r
+ +"COLOUR can be hexadecimal RGB or 'red', 'blue' etc.\n\n"\r
+ +"-fasta FILE\tCreate alignment file FILE in Fasta format.\n"\r
+ +"-clustal FILE\tCreate alignment file FILE in Clustal format.\n"\r
+ +"-pfam FILE\tCreate alignment file FILE in PFAM format.\n"\r
+ +"-msf FILE\tCreate alignment file FILE in MSF format.\n"\r
+ +"-pileup FILE\tCreate alignment file FILE in Pileup format\n"\r
+ +"-pir FILE\tCreate alignment file FILE in PIR format.\n"\r
+ +"-blc FILE\tCreate alignment file FILE in BLC format.\n"\r
+ +"-jalview FILE\tCreate alignment file FILE in Jalview format.\n"\r
+ +"-png FILE\tCreate PNG image FILE from alignment.\n"\r
+ +"-imgMap FILE\tCreate HTML file FILE with image map of PNG image.\n"\r
+ +"-eps FILE\tCreate EPS file FILE from alignment.");\r
+ System.exit(0);\r
+\r
+ }\r
+\r
\r
- if ((args != null) && (args.length > 0)) {\r
- String file = null;\r
+ file = aparser.getValue("open");\r
\r
- if (args[0].equals("-open")) {\r
- file = args[1];\r
- } else {\r
- file = args[0];\r
+ if (file == null)\r
+ {\r
+ System.out.println("No files to open!");\r
+ System.exit(1);\r
+ }\r
+ else if(!file.startsWith("http://"))\r
+ {\r
+ if (!(new java.io.File(file)).exists())\r
+ {\r
+ System.out.println("Can't find " + file);\r
+ System.exit(1);\r
}\r
+ }\r
+\r
+ if (!aparser.contains("nodisplay"))\r
+ desktop.setVisible(true);\r
+\r
+ protocol = "File";\r
+\r
+ if (file.indexOf("http:") > -1)\r
+ {\r
+ protocol = "URL";\r
+ }\r
\r
- String protocol = "File";\r
+ if(file.endsWith(".jar"))\r
+ format = "Jalview";\r
+ else\r
+ format = jalview.io.IdentifyFile.Identify(file, protocol);\r
\r
- if (file.indexOf("http:") > -1) {\r
- protocol = "URL";\r
+ System.out.println("Opening: " + format + " file " + file);\r
+\r
+ AlignFrame af = desktop.LoadFileWaitTillLoaded(file, protocol, format);\r
+\r
+ groups = aparser.getValue("groups");\r
+ if(groups!=null)\r
+ {\r
+ af.parseGroupsFile(groups);\r
+ }\r
+\r
+ String imageName = "unnamed.png";\r
+ while (aparser.getSize() > 1)\r
+ {\r
+ format = aparser.nextValue();\r
+ file = aparser.nextValue();\r
+\r
+ if (format.equalsIgnoreCase("png"))\r
+ {\r
+ af.createPNG(new java.io.File(file));\r
+ imageName = (new java.io.File(file)).getName();\r
+ System.out.println("Creating PNG image: " + file);\r
+ continue;\r
}\r
+ else if (format.equalsIgnoreCase("imgMap"))\r
+ {\r
+ af.createImageMap(new java.io.File(file), imageName);\r
+ System.out.println("Creating image map: " + file);\r
+ continue;\r
+ }\r
+ else if (format.equalsIgnoreCase("eps"))\r
+ {\r
+ System.out.println("Creating EPS file: " + file);\r
+ af.createEPS(new java.io.File(file));\r
+ continue;\r
+ }\r
+\r
+ if (af.saveAlignment(file, format))\r
+ System.out.println("Written alignment in " + format +\r
+ " format to " + file);\r
+ else\r
+ System.out.println("Error writing file " + file + " in " + format +\r
+ " format!!");\r
\r
- String format = jalview.io.IdentifyFile.Identify(file, protocol);\r
+ }\r
\r
- frame.LoadFile(file, protocol, format);\r
+ while (aparser.getSize() > 0)\r
+ {\r
+ System.out.println("Unknown arg: " + aparser.nextValue());\r
+ }\r
}\r
\r
- if (jalview.gui.Preferences.showStartupFile &&\r
- (jalview.gui.Preferences.startupFile != null)) {\r
- String file = jalview.gui.Preferences.startupFile;\r
- String protocol = "File";\r
+ if (jalview.gui.Preferences.showStartupFile &&\r
+ (jalview.gui.Preferences.startupFile != null))\r
+ {\r
\r
- if (file.indexOf("http:") > -1) {\r
- protocol = "URL";\r
+ file = jalview.gui.Preferences.startupFile;\r
+ protocol = "File";\r
+\r
+ if (file.indexOf("http:") > -1)\r
+ {\r
+ protocol = "URL";\r
}\r
\r
- if (file.endsWith(".jar")) {\r
- Jalview2XML.LoadJalviewAlign(file);\r
- } else {\r
- String format = jalview.io.IdentifyFile.Identify(file, protocol);\r
- frame.LoadFile(file, protocol, format);\r
+ if (file.endsWith(".jar"))\r
+ {\r
+ Jalview2XML.LoadJalviewAlign(file);\r
}\r
- }\r
+ else\r
+ {\r
+ format = jalview.io.IdentifyFile.Identify(file, protocol);\r
+ desktop.LoadFile(file, protocol, format);\r
+ }\r
+ }\r
+\r
+ if (!desktop.isVisible())\r
+ System.exit(0);\r
}\r
}\r
+\r
+ class ArgsParser\r
+ {\r
+ Vector vargs = null;\r
+ public ArgsParser(String [] args)\r
+ {\r
+ vargs = new Vector();\r
+ for (int i = 0; i < args.length; i++)\r
+ {\r
+ String arg = args[i].trim();\r
+ if (arg.charAt(0) == '-')\r
+ arg = arg.substring(1);\r
+ vargs.addElement(arg);\r
+ }\r
+ }\r
+\r
+ public String getValue(String arg)\r
+ {\r
+ int index = vargs.indexOf(arg);\r
+ String ret = null;\r
+ if (index != -1)\r
+ {\r
+ ret = vargs.elementAt(index + 1).toString();\r
+ vargs.removeElementAt(index);\r
+ vargs.removeElementAt(index);\r
+ }\r
+ return ret;\r
+ }\r
+\r
+ public boolean contains(String arg)\r
+ {\r
+ if(vargs.contains(arg))\r
+ {\r
+ vargs.removeElement(arg);\r
+ return true;\r
+ }\r
+ else\r
+ return false;\r
+ }\r
+\r
+ public String nextValue()\r
+ {\r
+ return vargs.remove(0).toString();\r
+ }\r
+\r
+ public int getSize()\r
+ {\r
+ return vargs.size();\r
+ }\r
+\r
+ }\r
import java.awt.event.*;\r
\r
\r
-public class JalviewLite extends Applet {\r
+/**\r
+ * Jalview Applet. Runs in Java 1.18 runtime\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class JalviewLite extends Applet\r
+{\r
static int lastFrameX = 200;\r
static int lastFrameY = 200;\r
static Applet applet;\r
String file = "No file";\r
Button launcher = new Button("Start Jalview");\r
\r
- public void init() {\r
+ /**\r
+ * init method for Jalview Applet\r
+ */\r
+ public void init()\r
+ {\r
applet = this;\r
\r
- int r=255,g=255,b=255;\r
+ int r = 255;\r
+ int g = 255;\r
+ int b = 255;\r
String param = getParameter("RGB");\r
- if(param!=null)\r
+\r
+ if (param != null)\r
{\r
- try\r
- {\r
- r = Integer.parseInt(param.substring(0,2),16);\r
- g = Integer.parseInt(param.substring(2,4),16);\r
- b = Integer.parseInt(param.substring(4,6),16);\r
- }\r
- catch (Exception ex)\r
- { r=255;g=255;b=255; }\r
+ try\r
+ {\r
+ r = Integer.parseInt(param.substring(0, 2), 16);\r
+ g = Integer.parseInt(param.substring(2, 4), 16);\r
+ b = Integer.parseInt(param.substring(4, 6), 16);\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ r = 255;\r
+ g = 255;\r
+ b = 255;\r
+ }\r
}\r
\r
- this.setBackground(new Color(r,g,b));\r
+ this.setBackground(new Color(r, g, b));\r
\r
file = getParameter("file");\r
\r
- if (file != null) {\r
+ if (file != null)\r
+ {\r
add(launcher);\r
file = applet.getCodeBase() + file;\r
- launcher.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
+ launcher.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
String format = jalview.io.IdentifyFile.Identify(file,\r
"URL");\r
LoadFile(file, "URL", format);\r
}\r
});\r
- } else {\r
+ }\r
+ else\r
+ {\r
file = "NO FILE";\r
fileFound = false;\r
}\r
}\r
\r
- public static void showURL(String url) {\r
- try {\r
+ /**\r
+ * Displays the given URL in a new browser window\r
+ *\r
+ * @param url URL to display in browser window.\r
+ * <br>New window will be named "HELP_WINDOW"\r
+ */\r
+ public static void showURL(String url)\r
+ {\r
+ try\r
+ {\r
applet.getAppletContext().showDocument(new java.net.URL(url),\r
"HELP_WINDOW");\r
- } catch (Exception ex) {\r
+ }\r
+ catch (Exception ex)\r
+ {\r
}\r
}\r
\r
- public void LoadFile(String file, String protocol, String format) {\r
+ /**\r
+ * Starts a new LoadingThread for loading an alignment file\r
+ *\r
+ * @param file file name including full path to file\r
+ * @param protocol file or URL or paste\r
+ * @param format Fasta, Clustal, PFAM, MSF, PIR, BLC, Jalview\r
+ */\r
+ public void LoadFile(String file, String protocol, String format)\r
+ {\r
LoadingThread loader = new LoadingThread(file, protocol, format, this);\r
loader.start();\r
}\r
\r
+ /**\r
+ * Initialises and displays a new java.awt.Frame\r
+ *\r
+ * @param frame java.awt.Frame to be displayed\r
+ * @param title title of new frame\r
+ * @param width width if new frame\r
+ * @param height height of new frame\r
+ */\r
public static void addFrame(final Frame frame, String title, int width,\r
- int height) {\r
+ int height)\r
+ {\r
frame.setLocation(lastFrameX, lastFrameY);\r
lastFrameX += 40;\r
lastFrameY += 40;\r
frame.setSize(width, height);\r
frame.setTitle(title);\r
- frame.addWindowListener(new WindowAdapter() {\r
- public void windowClosing(WindowEvent e) {\r
+ frame.addWindowListener(new WindowAdapter()\r
+ {\r
+ public void windowClosing(WindowEvent e)\r
+ {\r
frame.dispose();\r
}\r
});\r
frame.setVisible(true);\r
}\r
\r
- public void paint(Graphics g) {\r
- if (!fileFound) {\r
+ /**\r
+ * This paints the background surrounding the "Launch Jalview button"\r
+ * <br>\r
+ * <br>If file given in parameter not found, displays error message\r
+ *\r
+ * @param g graphics context\r
+ */\r
+ public void paint(Graphics g)\r
+ {\r
+ if (!fileFound)\r
+ {\r
g.setColor(new Color(200, 200, 200));\r
g.setColor(Color.cyan);\r
g.fillRect(0, 0, getSize().width, getSize().height);\r
}\r
}\r
\r
- class LoadingThread extends Thread {\r
+ class LoadingThread extends Thread\r
+ {\r
String file;\r
String protocol;\r
String format;\r
JalviewLite jlapplet;\r
\r
public LoadingThread(String file, String protocol, String format,\r
- JalviewLite applet) {\r
+ JalviewLite applet)\r
+ {\r
this.file = file;\r
this.protocol = protocol;\r
this.format = format;\r
this.jlapplet = applet;\r
}\r
\r
- public void run() {\r
+ public void run()\r
+ {\r
SequenceI[] sequences = null;\r
sequences = FormatAdapter.readFile(file, protocol, format);\r
\r
- if ((sequences != null) && (sequences.length > 0)) {\r
+ if ((sequences != null) && (sequences.length > 0))\r
+ {\r
AlignFrame af = new AlignFrame(new Alignment(sequences),\r
jlapplet);\r
addFrame(af, file, AlignFrame.NEW_WINDOW_WIDTH,\r
AlignFrame.NEW_WINDOW_HEIGHT);\r
af.statusBar.setText("Successfully loaded file " + file);\r
- } else {\r
+ }\r
+ else\r
+ {\r
fileFound = false;\r
remove(launcher);\r
repaint();\r
/*\r
- * This class was automatically generated with \r
+ * This class was automatically generated with\r
* <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
* Schema.\r
* $Id$\r
*/\r
-\r
package jalview.binding;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
-//---------------------------------/\r
-\r
-import java.io.IOException;\r
-import java.io.Reader;\r
-import java.io.Serializable;\r
-import java.io.Writer;\r
import org.exolab.castor.xml.MarshalException;\r
import org.exolab.castor.xml.Marshaller;\r
import org.exolab.castor.xml.Unmarshaller;\r
import org.exolab.castor.xml.ValidationException;\r
+\r
import org.xml.sax.ContentHandler;\r
\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
+//---------------------------------/\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+\r
+\r
/**\r
* Class Alignment.\r
- * \r
+ *\r
* @version $Revision$ $Date$\r
*/\r
-public class Alignment implements java.io.Serializable {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
+public class Alignment implements java.io.Serializable\r
+{\r
+ //--------------------------/\r
+ //- Class/Member Variables -/\r
//--------------------------/\r
\r
/**\r
*/\r
private jalview.binding.SequenceSet _sequenceSet;\r
\r
-\r
- //----------------/\r
- //- Constructors -/\r
//----------------/\r
-\r
- public Alignment() {\r
+ //- Constructors -/\r
+ //----------------/\r
+ public Alignment()\r
+ {\r
super();\r
- } //-- jalview.binding.Alignment()\r
+ }\r
\r
-\r
- //-----------/\r
- //- Methods -/\r
+ //-- jalview.binding.Alignment()\r
//-----------/\r
\r
/**\r
- * Returns the value of field 'annotation'.\r
- * \r
- * @return Annotation\r
- * @return the value of field 'annotation'.\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
*/\r
public jalview.binding.Annotation getAnnotation()\r
{\r
return this._annotation;\r
- } //-- jalview.binding.Annotation getAnnotation() \r
+ }\r
+\r
+ //-- jalview.binding.Annotation getAnnotation() \r
\r
/**\r
* Returns the value of field 'sequenceSet'.\r
- * \r
+ *\r
* @return SequenceSet\r
* @return the value of field 'sequenceSet'.\r
*/\r
public jalview.binding.SequenceSet getSequenceSet()\r
{\r
return this._sequenceSet;\r
- } //-- jalview.binding.SequenceSet getSequenceSet() \r
+ }\r
+\r
+ //-- jalview.binding.SequenceSet getSequenceSet() \r
\r
/**\r
* Method isValid\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @return boolean\r
*/\r
public boolean isValid()\r
{\r
- try {\r
+ try\r
+ {\r
validate();\r
}\r
- catch (org.exolab.castor.xml.ValidationException vex) {\r
+ catch (org.exolab.castor.xml.ValidationException vex)\r
+ {\r
return false;\r
}\r
+\r
return true;\r
- } //-- boolean isValid() \r
+ }\r
+\r
+ //-- boolean isValid() \r
\r
/**\r
* Method marshal\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param out\r
*/\r
public void marshal(java.io.Writer out)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+ throws org.exolab.castor.xml.MarshalException, \r
+ org.exolab.castor.xml.ValidationException\r
{\r
- \r
Marshaller.marshal(this, out);\r
- } //-- void marshal(java.io.Writer) \r
+ }\r
+\r
+ //-- void marshal(java.io.Writer) \r
\r
/**\r
* Method marshal\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param handler\r
*/\r
public void marshal(org.xml.sax.ContentHandler handler)\r
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException, \r
+ org.exolab.castor.xml.ValidationException\r
{\r
- \r
Marshaller.marshal(this, handler);\r
- } //-- void marshal(org.xml.sax.ContentHandler) \r
+ }\r
+\r
+ //-- void marshal(org.xml.sax.ContentHandler) \r
\r
/**\r
* Sets the value of field 'annotation'.\r
- * \r
+ *\r
* @param annotation the value of field 'annotation'.\r
*/\r
public void setAnnotation(jalview.binding.Annotation annotation)\r
{\r
this._annotation = annotation;\r
- } //-- void setAnnotation(jalview.binding.Annotation) \r
+ }\r
+\r
+ //-- void setAnnotation(jalview.binding.Annotation) \r
\r
/**\r
* Sets the value of field 'sequenceSet'.\r
- * \r
+ *\r
* @param sequenceSet the value of field 'sequenceSet'.\r
*/\r
public void setSequenceSet(jalview.binding.SequenceSet sequenceSet)\r
{\r
this._sequenceSet = sequenceSet;\r
- } //-- void setSequenceSet(jalview.binding.SequenceSet) \r
+ }\r
+\r
+ //-- void setSequenceSet(jalview.binding.SequenceSet) \r
\r
/**\r
* Method unmarshal\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param reader\r
* @return Object\r
*/\r
public static java.lang.Object unmarshal(java.io.Reader reader)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+ throws org.exolab.castor.xml.MarshalException, \r
+ org.exolab.castor.xml.ValidationException\r
{\r
- return (jalview.binding.Alignment) Unmarshaller.unmarshal(jalview.binding.Alignment.class, reader);\r
- } //-- java.lang.Object unmarshal(java.io.Reader) \r
+ return (jalview.binding.Alignment) Unmarshaller.unmarshal(jalview.binding.Alignment.class,\r
+ reader);\r
+ }\r
+\r
+ //-- java.lang.Object unmarshal(java.io.Reader) \r
\r
/**\r
* Method validate\r
- * \r
+ *\r
*/\r
- public void validate()\r
- throws org.exolab.castor.xml.ValidationException\r
+ public void validate() throws org.exolab.castor.xml.ValidationException\r
{\r
org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
validator.validate(this);\r
- } //-- void validate() \r
+ }\r
\r
+ //-- void validate() \r
}\r
/*\r
- * This class was automatically generated with \r
+ * This class was automatically generated with\r
* <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
* Schema.\r
* $Id$\r
\r
package jalview.binding;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
//---------------------------------/\r
+//- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.util.*;\r
\r
-import java.io.IOException;\r
-import java.io.Reader;\r
-import java.io.Serializable;\r
-import java.io.Writer;\r
-import java.util.Enumeration;\r
-import java.util.Vector;\r
-import org.exolab.castor.xml.MarshalException;\r
-import org.exolab.castor.xml.Marshaller;\r
-import org.exolab.castor.xml.Unmarshaller;\r
-import org.exolab.castor.xml.ValidationException;\r
-import org.xml.sax.ContentHandler;\r
+import org.exolab.castor.xml.*;\r
\r
/**\r
* Class Annotation.\r
- * \r
+ *\r
* @version $Revision$ $Date$\r
*/\r
-public class Annotation implements java.io.Serializable {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _graph\r
- */\r
- private boolean _graph;\r
-\r
- /**\r
- * keeps track of state for field: _graph\r
- */\r
- private boolean _has_graph;\r
-\r
- /**\r
- * Field _annotationElementList\r
- */\r
- private java.util.Vector _annotationElementList;\r
-\r
- /**\r
- * Field _label\r
- */\r
- private java.lang.String _label;\r
-\r
- /**\r
- * Field _description\r
- */\r
- private java.lang.String _description;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public Annotation() {\r
- super();\r
- _annotationElementList = new Vector();\r
- } //-- jalview.binding.Annotation()\r
-\r
-\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
-\r
- /**\r
- * Method addAnnotationElement\r
- * \r
- * \r
- * \r
- * @param vAnnotationElement\r
- */\r
- public void addAnnotationElement(jalview.binding.AnnotationElement vAnnotationElement)\r
- throws java.lang.IndexOutOfBoundsException\r
- {\r
- _annotationElementList.addElement(vAnnotationElement);\r
- } //-- void addAnnotationElement(jalview.binding.AnnotationElement) \r
-\r
- /**\r
- * Method addAnnotationElement\r
- * \r
- * \r
- * \r
- * @param index\r
- * @param vAnnotationElement\r
- */\r
- public void addAnnotationElement(int index, jalview.binding.AnnotationElement vAnnotationElement)\r
- throws java.lang.IndexOutOfBoundsException\r
- {\r
- _annotationElementList.insertElementAt(vAnnotationElement, index);\r
- } //-- void addAnnotationElement(int, jalview.binding.AnnotationElement) \r
-\r
- /**\r
- * Method deleteGraph\r
- * \r
- */\r
- public void deleteGraph()\r
- {\r
- this._has_graph= false;\r
- } //-- void deleteGraph() \r
-\r
- /**\r
- * Method enumerateAnnotationElement\r
- * \r
- * \r
- * \r
- * @return Enumeration\r
- */\r
- public java.util.Enumeration enumerateAnnotationElement()\r
- {\r
- return _annotationElementList.elements();\r
- } //-- java.util.Enumeration enumerateAnnotationElement() \r
-\r
- /**\r
- * Method getAnnotationElement\r
- * \r
- * \r
- * \r
- * @param index\r
- * @return AnnotationElement\r
- */\r
- public jalview.binding.AnnotationElement getAnnotationElement(int index)\r
- throws java.lang.IndexOutOfBoundsException\r
- {\r
- //-- check bounds for index\r
- if ((index < 0) || (index > _annotationElementList.size())) {\r
- throw new IndexOutOfBoundsException();\r
- }\r
- \r
- return (jalview.binding.AnnotationElement) _annotationElementList.elementAt(index);\r
- } //-- jalview.binding.AnnotationElement getAnnotationElement(int) \r
-\r
- /**\r
- * Method getAnnotationElement\r
- * \r
- * \r
- * \r
- * @return AnnotationElement\r
- */\r
- public jalview.binding.AnnotationElement[] getAnnotationElement()\r
- {\r
- int size = _annotationElementList.size();\r
- jalview.binding.AnnotationElement[] mArray = new jalview.binding.AnnotationElement[size];\r
- for (int index = 0; index < size; index++) {\r
- mArray[index] = (jalview.binding.AnnotationElement) _annotationElementList.elementAt(index);\r
- }\r
- return mArray;\r
- } //-- jalview.binding.AnnotationElement[] getAnnotationElement() \r
-\r
- /**\r
- * Method getAnnotationElementCount\r
- * \r
- * \r
- * \r
- * @return int\r
- */\r
- public int getAnnotationElementCount()\r
- {\r
- return _annotationElementList.size();\r
- } //-- int getAnnotationElementCount() \r
-\r
- /**\r
- * Returns the value of field 'description'.\r
- * \r
- * @return String\r
- * @return the value of field 'description'.\r
- */\r
- public java.lang.String getDescription()\r
- {\r
- return this._description;\r
- } //-- java.lang.String getDescription() \r
-\r
- /**\r
- * Returns the value of field 'graph'.\r
- * \r
- * @return boolean\r
- * @return the value of field 'graph'.\r
- */\r
- public boolean getGraph()\r
- {\r
- return this._graph;\r
- } //-- boolean getGraph() \r
-\r
- /**\r
- * Returns the value of field 'label'.\r
- * \r
- * @return String\r
- * @return the value of field 'label'.\r
- */\r
- public java.lang.String getLabel()\r
- {\r
- return this._label;\r
- } //-- java.lang.String getLabel() \r
-\r
- /**\r
- * Method hasGraph\r
- * \r
- * \r
- * \r
- * @return boolean\r
- */\r
- public boolean hasGraph()\r
- {\r
- return this._has_graph;\r
- } //-- boolean hasGraph() \r
-\r
- /**\r
- * Method isValid\r
- * \r
- * \r
- * \r
- * @return boolean\r
- */\r
- public boolean isValid()\r
- {\r
- try {\r
- validate();\r
- }\r
- catch (org.exolab.castor.xml.ValidationException vex) {\r
- return false;\r
- }\r
- return true;\r
- } //-- boolean isValid() \r
-\r
- /**\r
- * Method marshal\r
- * \r
- * \r
- * \r
- * @param out\r
- */\r
- public void marshal(java.io.Writer out)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
- {\r
- \r
- Marshaller.marshal(this, out);\r
- } //-- void marshal(java.io.Writer) \r
-\r
- /**\r
- * Method marshal\r
- * \r
- * \r
- * \r
- * @param handler\r
- */\r
- public void marshal(org.xml.sax.ContentHandler handler)\r
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
- {\r
- \r
- Marshaller.marshal(this, handler);\r
- } //-- void marshal(org.xml.sax.ContentHandler) \r
-\r
- /**\r
- * Method removeAllAnnotationElement\r
- * \r
- */\r
- public void removeAllAnnotationElement()\r
- {\r
- _annotationElementList.removeAllElements();\r
- } //-- void removeAllAnnotationElement() \r
-\r
- /**\r
- * Method removeAnnotationElement\r
- * \r
- * \r
- * \r
- * @param index\r
- * @return AnnotationElement\r
- */\r
- public jalview.binding.AnnotationElement removeAnnotationElement(int index)\r
- {\r
- java.lang.Object obj = _annotationElementList.elementAt(index);\r
- _annotationElementList.removeElementAt(index);\r
- return (jalview.binding.AnnotationElement) obj;\r
- } //-- jalview.binding.AnnotationElement removeAnnotationElement(int) \r
-\r
- /**\r
- * Method setAnnotationElement\r
- * \r
- * \r
- * \r
- * @param index\r
- * @param vAnnotationElement\r
- */\r
- public void setAnnotationElement(int index, jalview.binding.AnnotationElement vAnnotationElement)\r
- throws java.lang.IndexOutOfBoundsException\r
- {\r
- //-- check bounds for index\r
- if ((index < 0) || (index > _annotationElementList.size())) {\r
- throw new IndexOutOfBoundsException();\r
- }\r
- _annotationElementList.setElementAt(vAnnotationElement, index);\r
- } //-- void setAnnotationElement(int, jalview.binding.AnnotationElement) \r
-\r
- /**\r
- * Method setAnnotationElement\r
- * \r
- * \r
- * \r
- * @param annotationElementArray\r
- */\r
- public void setAnnotationElement(jalview.binding.AnnotationElement[] annotationElementArray)\r
+public class Annotation\r
+ implements java.io.Serializable\r
+{\r
+\r
+ //--------------------------/\r
+ //- Class/Member Variables -/\r
+ //--------------------------/\r
+\r
+ /**\r
+ * Field _graph\r
+ */\r
+ private boolean _graph;\r
+\r
+ /**\r
+ * keeps track of state for field: _graph\r
+ */\r
+ private boolean _has_graph;\r
+\r
+ /**\r
+ * Field _annotationElementList\r
+ */\r
+ private java.util.Vector _annotationElementList;\r
+\r
+ /**\r
+ * Field _label\r
+ */\r
+ private java.lang.String _label;\r
+\r
+ /**\r
+ * Field _description\r
+ */\r
+ private java.lang.String _description;\r
+\r
+ //----------------/\r
+ //- Constructors -/\r
+ //----------------/\r
+\r
+ public Annotation()\r
+ {\r
+ super();\r
+ _annotationElementList = new Vector();\r
+ } //-- jalview.binding.Annotation()\r
+\r
+ //-----------/\r
+ //- Methods -/\r
+ //-----------/\r
+\r
+ /**\r
+ * Method addAnnotationElement\r
+ *\r
+ *\r
+ *\r
+ * @param vAnnotationElement\r
+ */\r
+ public void addAnnotationElement(jalview.binding.AnnotationElement\r
+ vAnnotationElement)\r
+ throws java.lang.IndexOutOfBoundsException\r
+ {\r
+ _annotationElementList.addElement(vAnnotationElement);\r
+ } //-- void addAnnotationElement(jalview.binding.AnnotationElement)\r
+\r
+ /**\r
+ * Method addAnnotationElement\r
+ *\r
+ *\r
+ *\r
+ * @param index\r
+ * @param vAnnotationElement\r
+ */\r
+ public void addAnnotationElement(int index,\r
+ jalview.binding.AnnotationElement\r
+ vAnnotationElement)\r
+ throws java.lang.IndexOutOfBoundsException\r
+ {\r
+ _annotationElementList.insertElementAt(vAnnotationElement, index);\r
+ } //-- void addAnnotationElement(int, jalview.binding.AnnotationElement)\r
+\r
+ /**\r
+ * Method deleteGraph\r
+ *\r
+ */\r
+ public void deleteGraph()\r
+ {\r
+ this._has_graph = false;\r
+ } //-- void deleteGraph()\r
+\r
+ /**\r
+ * Method enumerateAnnotationElement\r
+ *\r
+ *\r
+ *\r
+ * @return Enumeration\r
+ */\r
+ public java.util.Enumeration enumerateAnnotationElement()\r
+ {\r
+ return _annotationElementList.elements();\r
+ } //-- java.util.Enumeration enumerateAnnotationElement()\r
+\r
+ /**\r
+ * Method getAnnotationElement\r
+ *\r
+ *\r
+ *\r
+ * @param index\r
+ * @return AnnotationElement\r
+ */\r
+ public jalview.binding.AnnotationElement getAnnotationElement(int index)\r
+ throws java.lang.IndexOutOfBoundsException\r
+ {\r
+ //-- check bounds for index\r
+ if ( (index < 0) || (index > _annotationElementList.size()))\r
{\r
- //-- copy array\r
- _annotationElementList.removeAllElements();\r
- for (int i = 0; i < annotationElementArray.length; i++) {\r
- _annotationElementList.addElement(annotationElementArray[i]);\r
- }\r
- } //-- void setAnnotationElement(jalview.binding.AnnotationElement) \r
-\r
- /**\r
- * Sets the value of field 'description'.\r
- * \r
- * @param description the value of field 'description'.\r
- */\r
- public void setDescription(java.lang.String description)\r
+ throw new IndexOutOfBoundsException();\r
+ }\r
+\r
+ return (jalview.binding.AnnotationElement) _annotationElementList.elementAt(\r
+ index);\r
+ } //-- jalview.binding.AnnotationElement getAnnotationElement(int)\r
+\r
+ /**\r
+ * Method getAnnotationElement\r
+ *\r
+ *\r
+ *\r
+ * @return AnnotationElement\r
+ */\r
+ public jalview.binding.AnnotationElement[] getAnnotationElement()\r
+ {\r
+ int size = _annotationElementList.size();\r
+ jalview.binding.AnnotationElement[] mArray = new jalview.binding.\r
+ AnnotationElement[size];\r
+ for (int index = 0; index < size; index++)\r
{\r
- this._description = description;\r
- } //-- void setDescription(java.lang.String) \r
-\r
- /**\r
- * Sets the value of field 'graph'.\r
- * \r
- * @param graph the value of field 'graph'.\r
- */\r
- public void setGraph(boolean graph)\r
+ mArray[index] = (jalview.binding.AnnotationElement)\r
+ _annotationElementList.elementAt(index);\r
+ }\r
+ return mArray;\r
+ } //-- jalview.binding.AnnotationElement[] getAnnotationElement()\r
+\r
+ /**\r
+ * Method getAnnotationElementCount\r
+ *\r
+ *\r
+ *\r
+ * @return int\r
+ */\r
+ public int getAnnotationElementCount()\r
+ {\r
+ return _annotationElementList.size();\r
+ } //-- int getAnnotationElementCount()\r
+\r
+ /**\r
+ * Returns the value of field 'description'.\r
+ *\r
+ * @return String\r
+ * @return the value of field 'description'.\r
+ */\r
+ public java.lang.String getDescription()\r
+ {\r
+ return this._description;\r
+ } //-- java.lang.String getDescription()\r
+\r
+ /**\r
+ * Returns the value of field 'graph'.\r
+ *\r
+ * @return boolean\r
+ * @return the value of field 'graph'.\r
+ */\r
+ public boolean getGraph()\r
+ {\r
+ return this._graph;\r
+ } //-- boolean getGraph()\r
+\r
+ /**\r
+ * Returns the value of field 'label'.\r
+ *\r
+ * @return String\r
+ * @return the value of field 'label'.\r
+ */\r
+ public java.lang.String getLabel()\r
+ {\r
+ return this._label;\r
+ } //-- java.lang.String getLabel()\r
+\r
+ /**\r
+ * Method hasGraph\r
+ *\r
+ *\r
+ *\r
+ * @return boolean\r
+ */\r
+ public boolean hasGraph()\r
+ {\r
+ return this._has_graph;\r
+ } //-- boolean hasGraph()\r
+\r
+ /**\r
+ * Method isValid\r
+ *\r
+ *\r
+ *\r
+ * @return boolean\r
+ */\r
+ public boolean isValid()\r
+ {\r
+ try\r
{\r
- this._graph = graph;\r
- this._has_graph = true;\r
- } //-- void setGraph(boolean) \r
-\r
- /**\r
- * Sets the value of field 'label'.\r
- * \r
- * @param label the value of field 'label'.\r
- */\r
- public void setLabel(java.lang.String label)\r
+ validate();\r
+ }\r
+ catch (org.exolab.castor.xml.ValidationException vex)\r
{\r
- this._label = label;\r
- } //-- void setLabel(java.lang.String) \r
-\r
- /**\r
- * Method unmarshal\r
- * \r
- * \r
- * \r
- * @param reader\r
- * @return Object\r
- */\r
- public static java.lang.Object unmarshal(java.io.Reader reader)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+ return false;\r
+ }\r
+ return true;\r
+ } //-- boolean isValid()\r
+\r
+ /**\r
+ * Method marshal\r
+ *\r
+ *\r
+ *\r
+ * @param out\r
+ */\r
+ public void marshal(java.io.Writer out)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException\r
+ {\r
+\r
+ Marshaller.marshal(this, out);\r
+ } //-- void marshal(java.io.Writer)\r
+\r
+ /**\r
+ * Method marshal\r
+ *\r
+ *\r
+ *\r
+ * @param handler\r
+ */\r
+ public void marshal(org.xml.sax.ContentHandler handler)\r
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException\r
+ {\r
+\r
+ Marshaller.marshal(this, handler);\r
+ } //-- void marshal(org.xml.sax.ContentHandler)\r
+\r
+ /**\r
+ * Method removeAllAnnotationElement\r
+ *\r
+ */\r
+ public void removeAllAnnotationElement()\r
+ {\r
+ _annotationElementList.removeAllElements();\r
+ } //-- void removeAllAnnotationElement()\r
+\r
+ /**\r
+ * Method removeAnnotationElement\r
+ *\r
+ *\r
+ *\r
+ * @param index\r
+ * @return AnnotationElement\r
+ */\r
+ public jalview.binding.AnnotationElement removeAnnotationElement(int index)\r
+ {\r
+ java.lang.Object obj = _annotationElementList.elementAt(index);\r
+ _annotationElementList.removeElementAt(index);\r
+ return (jalview.binding.AnnotationElement) obj;\r
+ } //-- jalview.binding.AnnotationElement removeAnnotationElement(int)\r
+\r
+ /**\r
+ * Method setAnnotationElement\r
+ *\r
+ *\r
+ *\r
+ * @param index\r
+ * @param vAnnotationElement\r
+ */\r
+ public void setAnnotationElement(int index,\r
+ jalview.binding.AnnotationElement\r
+ vAnnotationElement)\r
+ throws java.lang.IndexOutOfBoundsException\r
+ {\r
+ //-- check bounds for index\r
+ if ( (index < 0) || (index > _annotationElementList.size()))\r
{\r
- return (jalview.binding.Annotation) Unmarshaller.unmarshal(jalview.binding.Annotation.class, reader);\r
- } //-- java.lang.Object unmarshal(java.io.Reader) \r
-\r
- /**\r
- * Method validate\r
- * \r
- */\r
- public void validate()\r
- throws org.exolab.castor.xml.ValidationException\r
+ throw new IndexOutOfBoundsException();\r
+ }\r
+ _annotationElementList.setElementAt(vAnnotationElement, index);\r
+ } //-- void setAnnotationElement(int, jalview.binding.AnnotationElement)\r
+\r
+ /**\r
+ * Method setAnnotationElement\r
+ *\r
+ *\r
+ *\r
+ * @param annotationElementArray\r
+ */\r
+ public void setAnnotationElement(jalview.binding.AnnotationElement[]\r
+ annotationElementArray)\r
+ {\r
+ //-- copy array\r
+ _annotationElementList.removeAllElements();\r
+ for (int i = 0; i < annotationElementArray.length; i++)\r
{\r
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
- validator.validate(this);\r
- } //-- void validate() \r
+ _annotationElementList.addElement(annotationElementArray[i]);\r
+ }\r
+ } //-- void setAnnotationElement(jalview.binding.AnnotationElement)\r
+\r
+ /**\r
+ * Sets the value of field 'description'.\r
+ *\r
+ * @param description the value of field 'description'.\r
+ */\r
+ public void setDescription(java.lang.String description)\r
+ {\r
+ this._description = description;\r
+ } //-- void setDescription(java.lang.String)\r
+\r
+ /**\r
+ * Sets the value of field 'graph'.\r
+ *\r
+ * @param graph the value of field 'graph'.\r
+ */\r
+ public void setGraph(boolean graph)\r
+ {\r
+ this._graph = graph;\r
+ this._has_graph = true;\r
+ } //-- void setGraph(boolean)\r
+\r
+ /**\r
+ * Sets the value of field 'label'.\r
+ *\r
+ * @param label the value of field 'label'.\r
+ */\r
+ public void setLabel(java.lang.String label)\r
+ {\r
+ this._label = label;\r
+ } //-- void setLabel(java.lang.String)\r
+\r
+ /**\r
+ * Method unmarshal\r
+ *\r
+ *\r
+ *\r
+ * @param reader\r
+ * @return Object\r
+ */\r
+ public static java.lang.Object unmarshal(java.io.Reader reader)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException\r
+ {\r
+ return (jalview.binding.Annotation) Unmarshaller.unmarshal(jalview.binding.\r
+ Annotation.class, reader);\r
+ } //-- java.lang.Object unmarshal(java.io.Reader)\r
+\r
+ /**\r
+ * Method validate\r
+ *\r
+ */\r
+ public void validate()\r
+ throws org.exolab.castor.xml.ValidationException\r
+ {\r
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.\r
+ Validator();\r
+ validator.validate(this);\r
+ } //-- void validate()\r
\r
}\r
/*\r
- * This class was automatically generated with \r
+ * This class was automatically generated with\r
* <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
* Schema.\r
* $Id$\r
*/\r
-\r
package jalview.binding;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
-//---------------------------------/\r
-\r
-import java.io.IOException;\r
-import java.io.Reader;\r
-import java.io.Serializable;\r
-import java.io.Writer;\r
import org.exolab.castor.xml.MarshalException;\r
import org.exolab.castor.xml.Marshaller;\r
import org.exolab.castor.xml.Unmarshaller;\r
import org.exolab.castor.xml.ValidationException;\r
+\r
import org.xml.sax.ContentHandler;\r
\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
+//---------------------------------/\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+\r
+\r
/**\r
* Class AnnotationElement.\r
- * \r
+ *\r
* @version $Revision$ $Date$\r
*/\r
-public class AnnotationElement implements java.io.Serializable {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
+public class AnnotationElement implements java.io.Serializable\r
+{\r
+ //--------------------------/\r
+ //- Class/Member Variables -/\r
//--------------------------/\r
\r
/**\r
*/\r
private boolean _has_value;\r
\r
-\r
- //----------------/\r
- //- Constructors -/\r
//----------------/\r
-\r
- public AnnotationElement() {\r
+ //- Constructors -/\r
+ //----------------/\r
+ public AnnotationElement()\r
+ {\r
super();\r
- } //-- jalview.binding.AnnotationElement()\r
-\r
+ }\r
\r
- //-----------/\r
- //- Methods -/\r
+ //-- jalview.binding.AnnotationElement()\r
//-----------/\r
\r
/**\r
- * Method deletePosition\r
- * \r
+ * DOCUMENT ME!\r
*/\r
public void deletePosition()\r
{\r
- this._has_position= false;\r
- } //-- void deletePosition() \r
+ this._has_position = false;\r
+ }\r
+\r
+ //-- void deletePosition() \r
\r
/**\r
* Method deleteValue\r
- * \r
+ *\r
*/\r
public void deleteValue()\r
{\r
- this._has_value= false;\r
- } //-- void deleteValue() \r
+ this._has_value = false;\r
+ }\r
+\r
+ //-- void deleteValue() \r
\r
/**\r
* Returns the value of field 'description'.\r
- * \r
+ *\r
* @return String\r
* @return the value of field 'description'.\r
*/\r
public java.lang.String getDescription()\r
{\r
return this._description;\r
- } //-- java.lang.String getDescription() \r
+ }\r
+\r
+ //-- java.lang.String getDescription() \r
\r
/**\r
* Returns the value of field 'displayCharacter'.\r
- * \r
+ *\r
* @return String\r
* @return the value of field 'displayCharacter'.\r
*/\r
public java.lang.String getDisplayCharacter()\r
{\r
return this._displayCharacter;\r
- } //-- java.lang.String getDisplayCharacter() \r
+ }\r
+\r
+ //-- java.lang.String getDisplayCharacter() \r
\r
/**\r
* Returns the value of field 'position'.\r
- * \r
+ *\r
* @return int\r
* @return the value of field 'position'.\r
*/\r
public int getPosition()\r
{\r
return this._position;\r
- } //-- int getPosition() \r
+ }\r
+\r
+ //-- int getPosition() \r
\r
/**\r
* Returns the value of field 'secondaryStructure'.\r
- * \r
+ *\r
* @return String\r
* @return the value of field 'secondaryStructure'.\r
*/\r
public java.lang.String getSecondaryStructure()\r
{\r
return this._secondaryStructure;\r
- } //-- java.lang.String getSecondaryStructure() \r
+ }\r
+\r
+ //-- java.lang.String getSecondaryStructure() \r
\r
/**\r
* Returns the value of field 'value'.\r
- * \r
+ *\r
* @return float\r
* @return the value of field 'value'.\r
*/\r
public float getValue()\r
{\r
return this._value;\r
- } //-- float getValue() \r
+ }\r
+\r
+ //-- float getValue() \r
\r
/**\r
* Method hasPosition\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @return boolean\r
*/\r
public boolean hasPosition()\r
{\r
return this._has_position;\r
- } //-- boolean hasPosition() \r
+ }\r
+\r
+ //-- boolean hasPosition() \r
\r
/**\r
* Method hasValue\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @return boolean\r
*/\r
public boolean hasValue()\r
{\r
return this._has_value;\r
- } //-- boolean hasValue() \r
+ }\r
+\r
+ //-- boolean hasValue() \r
\r
/**\r
* Method isValid\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @return boolean\r
*/\r
public boolean isValid()\r
{\r
- try {\r
+ try\r
+ {\r
validate();\r
}\r
- catch (org.exolab.castor.xml.ValidationException vex) {\r
+ catch (org.exolab.castor.xml.ValidationException vex)\r
+ {\r
return false;\r
}\r
+\r
return true;\r
- } //-- boolean isValid() \r
+ }\r
+\r
+ //-- boolean isValid() \r
\r
/**\r
* Method marshal\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param out\r
*/\r
public void marshal(java.io.Writer out)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+ throws org.exolab.castor.xml.MarshalException, \r
+ org.exolab.castor.xml.ValidationException\r
{\r
- \r
Marshaller.marshal(this, out);\r
- } //-- void marshal(java.io.Writer) \r
+ }\r
+\r
+ //-- void marshal(java.io.Writer) \r
\r
/**\r
* Method marshal\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param handler\r
*/\r
public void marshal(org.xml.sax.ContentHandler handler)\r
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException, \r
+ org.exolab.castor.xml.ValidationException\r
{\r
- \r
Marshaller.marshal(this, handler);\r
- } //-- void marshal(org.xml.sax.ContentHandler) \r
+ }\r
+\r
+ //-- void marshal(org.xml.sax.ContentHandler) \r
\r
/**\r
* Sets the value of field 'description'.\r
- * \r
+ *\r
* @param description the value of field 'description'.\r
*/\r
public void setDescription(java.lang.String description)\r
{\r
this._description = description;\r
- } //-- void setDescription(java.lang.String) \r
+ }\r
+\r
+ //-- void setDescription(java.lang.String) \r
\r
/**\r
* Sets the value of field 'displayCharacter'.\r
- * \r
+ *\r
* @param displayCharacter the value of field 'displayCharacter'\r
*/\r
public void setDisplayCharacter(java.lang.String displayCharacter)\r
{\r
this._displayCharacter = displayCharacter;\r
- } //-- void setDisplayCharacter(java.lang.String) \r
+ }\r
+\r
+ //-- void setDisplayCharacter(java.lang.String) \r
\r
/**\r
* Sets the value of field 'position'.\r
- * \r
+ *\r
* @param position the value of field 'position'.\r
*/\r
public void setPosition(int position)\r
{\r
this._position = position;\r
this._has_position = true;\r
- } //-- void setPosition(int) \r
+ }\r
+\r
+ //-- void setPosition(int) \r
\r
/**\r
* Sets the value of field 'secondaryStructure'.\r
- * \r
+ *\r
* @param secondaryStructure the value of field\r
* 'secondaryStructure'.\r
*/\r
public void setSecondaryStructure(java.lang.String secondaryStructure)\r
{\r
this._secondaryStructure = secondaryStructure;\r
- } //-- void setSecondaryStructure(java.lang.String) \r
+ }\r
+\r
+ //-- void setSecondaryStructure(java.lang.String) \r
\r
/**\r
* Sets the value of field 'value'.\r
- * \r
+ *\r
* @param value the value of field 'value'.\r
*/\r
public void setValue(float value)\r
{\r
this._value = value;\r
this._has_value = true;\r
- } //-- void setValue(float) \r
+ }\r
+\r
+ //-- void setValue(float) \r
\r
/**\r
* Method unmarshal\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param reader\r
* @return Object\r
*/\r
public static java.lang.Object unmarshal(java.io.Reader reader)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+ throws org.exolab.castor.xml.MarshalException, \r
+ org.exolab.castor.xml.ValidationException\r
{\r
- return (jalview.binding.AnnotationElement) Unmarshaller.unmarshal(jalview.binding.AnnotationElement.class, reader);\r
- } //-- java.lang.Object unmarshal(java.io.Reader) \r
+ return (jalview.binding.AnnotationElement) Unmarshaller.unmarshal(jalview.binding.AnnotationElement.class,\r
+ reader);\r
+ }\r
+\r
+ //-- java.lang.Object unmarshal(java.io.Reader) \r
\r
/**\r
* Method validate\r
- * \r
+ *\r
*/\r
- public void validate()\r
- throws org.exolab.castor.xml.ValidationException\r
+ public void validate() throws org.exolab.castor.xml.ValidationException\r
{\r
org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
validator.validate(this);\r
- } //-- void validate() \r
+ }\r
\r
+ //-- void validate() \r
}\r
/*\r
- * This class was automatically generated with \r
+ * This class was automatically generated with\r
* <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
* Schema.\r
* $Id$\r
*/\r
-\r
package jalview.binding;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
-//---------------------------------/\r
-\r
-import java.io.IOException;\r
-import java.io.Reader;\r
-import java.io.Serializable;\r
-import java.io.Writer;\r
import org.exolab.castor.xml.MarshalException;\r
import org.exolab.castor.xml.Marshaller;\r
import org.exolab.castor.xml.Unmarshaller;\r
import org.exolab.castor.xml.ValidationException;\r
+\r
import org.xml.sax.ContentHandler;\r
\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
+//---------------------------------/\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+\r
+\r
/**\r
* Class Colour.\r
- * \r
+ *\r
* @version $Revision$ $Date$\r
*/\r
-public class Colour implements java.io.Serializable {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
+public class Colour implements java.io.Serializable\r
+{\r
+ //--------------------------/\r
+ //- Class/Member Variables -/\r
//--------------------------/\r
\r
/**\r
*/\r
private java.lang.String _RGB;\r
\r
-\r
- //----------------/\r
- //- Constructors -/\r
//----------------/\r
-\r
- public Colour() {\r
+ //- Constructors -/\r
+ //----------------/\r
+ public Colour()\r
+ {\r
super();\r
- } //-- jalview.binding.Colour()\r
-\r
+ }\r
\r
- //-----------/\r
- //- Methods -/\r
+ //-- jalview.binding.Colour()\r
//-----------/\r
\r
/**\r
- * Returns the value of field 'name'.\r
- * \r
- * @return String\r
- * @return the value of field 'name'.\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
*/\r
public java.lang.String getName()\r
{\r
return this._name;\r
- } //-- java.lang.String getName() \r
+ }\r
+\r
+ //-- java.lang.String getName() \r
\r
/**\r
* Returns the value of field 'RGB'.\r
- * \r
+ *\r
* @return String\r
* @return the value of field 'RGB'.\r
*/\r
public java.lang.String getRGB()\r
{\r
return this._RGB;\r
- } //-- java.lang.String getRGB() \r
+ }\r
+\r
+ //-- java.lang.String getRGB() \r
\r
/**\r
* Method isValid\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @return boolean\r
*/\r
public boolean isValid()\r
{\r
- try {\r
+ try\r
+ {\r
validate();\r
}\r
- catch (org.exolab.castor.xml.ValidationException vex) {\r
+ catch (org.exolab.castor.xml.ValidationException vex)\r
+ {\r
return false;\r
}\r
+\r
return true;\r
- } //-- boolean isValid() \r
+ }\r
+\r
+ //-- boolean isValid() \r
\r
/**\r
* Method marshal\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param out\r
*/\r
public void marshal(java.io.Writer out)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+ throws org.exolab.castor.xml.MarshalException, \r
+ org.exolab.castor.xml.ValidationException\r
{\r
- \r
Marshaller.marshal(this, out);\r
- } //-- void marshal(java.io.Writer) \r
+ }\r
+\r
+ //-- void marshal(java.io.Writer) \r
\r
/**\r
* Method marshal\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param handler\r
*/\r
public void marshal(org.xml.sax.ContentHandler handler)\r
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException, \r
+ org.exolab.castor.xml.ValidationException\r
{\r
- \r
Marshaller.marshal(this, handler);\r
- } //-- void marshal(org.xml.sax.ContentHandler) \r
+ }\r
+\r
+ //-- void marshal(org.xml.sax.ContentHandler) \r
\r
/**\r
* Sets the value of field 'name'.\r
- * \r
+ *\r
* @param name the value of field 'name'.\r
*/\r
public void setName(java.lang.String name)\r
{\r
this._name = name;\r
- } //-- void setName(java.lang.String) \r
+ }\r
+\r
+ //-- void setName(java.lang.String) \r
\r
/**\r
* Sets the value of field 'RGB'.\r
- * \r
+ *\r
* @param RGB the value of field 'RGB'.\r
*/\r
public void setRGB(java.lang.String RGB)\r
{\r
this._RGB = RGB;\r
- } //-- void setRGB(java.lang.String) \r
+ }\r
+\r
+ //-- void setRGB(java.lang.String) \r
\r
/**\r
* Method unmarshal\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param reader\r
* @return Object\r
*/\r
public static java.lang.Object unmarshal(java.io.Reader reader)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+ throws org.exolab.castor.xml.MarshalException, \r
+ org.exolab.castor.xml.ValidationException\r
{\r
- return (jalview.binding.Colour) Unmarshaller.unmarshal(jalview.binding.Colour.class, reader);\r
- } //-- java.lang.Object unmarshal(java.io.Reader) \r
+ return (jalview.binding.Colour) Unmarshaller.unmarshal(jalview.binding.Colour.class,\r
+ reader);\r
+ }\r
+\r
+ //-- java.lang.Object unmarshal(java.io.Reader) \r
\r
/**\r
* Method validate\r
- * \r
+ *\r
*/\r
- public void validate()\r
- throws org.exolab.castor.xml.ValidationException\r
+ public void validate() throws org.exolab.castor.xml.ValidationException\r
{\r
org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
validator.validate(this);\r
- } //-- void validate() \r
+ }\r
\r
+ //-- void validate() \r
}\r
/*\r
- * This class was automatically generated with \r
+ * This class was automatically generated with\r
* <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
* Schema.\r
* $Id$\r
*/\r
-\r
package jalview.binding;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
-//---------------------------------/\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
\r
+import org.xml.sax.ContentHandler;\r
+\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
+//---------------------------------/\r
import java.io.IOException;\r
import java.io.Reader;\r
import java.io.Serializable;\r
import java.io.Writer;\r
+\r
import java.util.Enumeration;\r
import java.util.Vector;\r
-import org.exolab.castor.xml.MarshalException;\r
-import org.exolab.castor.xml.Marshaller;\r
-import org.exolab.castor.xml.Unmarshaller;\r
-import org.exolab.castor.xml.ValidationException;\r
-import org.xml.sax.ContentHandler;\r
+\r
\r
/**\r
* Class JGroup.\r
- * \r
+ *\r
* @version $Revision$ $Date$\r
*/\r
-public class JGroup implements java.io.Serializable {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
+public class JGroup implements java.io.Serializable\r
+{\r
+ //--------------------------/\r
+ //- Class/Member Variables -/\r
//--------------------------/\r
\r
/**\r
*/\r
private java.util.Vector _seqList;\r
\r
-\r
- //----------------/\r
- //- Constructors -/\r
//----------------/\r
-\r
- public JGroup() {\r
+ //- Constructors -/\r
+ //----------------/\r
+ public JGroup()\r
+ {\r
super();\r
_seqList = new Vector();\r
- } //-- jalview.binding.JGroup()\r
-\r
+ }\r
\r
- //-----------/\r
- //- Methods -/\r
+ //-- jalview.binding.JGroup()\r
//-----------/\r
\r
/**\r
- * Method addSeq\r
- * \r
- * \r
- * \r
- * @param vSeq\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param vSeq DOCUMENT ME!\r
+ *\r
+ * @throws java.lang.IndexOutOfBoundsException DOCUMENT ME!\r
*/\r
- public void addSeq(int vSeq)\r
- throws java.lang.IndexOutOfBoundsException\r
+ public void addSeq(int vSeq) throws java.lang.IndexOutOfBoundsException\r
{\r
_seqList.addElement(new java.lang.Integer(vSeq));\r
- } //-- void addSeq(int) \r
+ }\r
+\r
+ //-- void addSeq(int) \r
\r
/**\r
* Method addSeq\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param index\r
* @param vSeq\r
*/\r
throws java.lang.IndexOutOfBoundsException\r
{\r
_seqList.insertElementAt(new java.lang.Integer(vSeq), index);\r
- } //-- void addSeq(int, int) \r
+ }\r
+\r
+ //-- void addSeq(int, int) \r
\r
/**\r
* Method deleteColourText\r
- * \r
+ *\r
*/\r
public void deleteColourText()\r
{\r
- this._has_colourText= false;\r
- } //-- void deleteColourText() \r
+ this._has_colourText = false;\r
+ }\r
+\r
+ //-- void deleteColourText() \r
\r
/**\r
* Method deleteConsThreshold\r
- * \r
+ *\r
*/\r
public void deleteConsThreshold()\r
{\r
- this._has_consThreshold= false;\r
- } //-- void deleteConsThreshold() \r
+ this._has_consThreshold = false;\r
+ }\r
+\r
+ //-- void deleteConsThreshold() \r
\r
/**\r
* Method deleteDisplayBoxes\r
- * \r
+ *\r
*/\r
public void deleteDisplayBoxes()\r
{\r
- this._has_displayBoxes= false;\r
- } //-- void deleteDisplayBoxes() \r
+ this._has_displayBoxes = false;\r
+ }\r
+\r
+ //-- void deleteDisplayBoxes() \r
\r
/**\r
* Method deleteDisplayText\r
- * \r
+ *\r
*/\r
public void deleteDisplayText()\r
{\r
- this._has_displayText= false;\r
- } //-- void deleteDisplayText() \r
+ this._has_displayText = false;\r
+ }\r
+\r
+ //-- void deleteDisplayText() \r
\r
/**\r
* Method deleteEnd\r
- * \r
+ *\r
*/\r
public void deleteEnd()\r
{\r
- this._has_end= false;\r
- } //-- void deleteEnd() \r
+ this._has_end = false;\r
+ }\r
+\r
+ //-- void deleteEnd() \r
\r
/**\r
* Method deleteOutlineColour\r
- * \r
+ *\r
*/\r
public void deleteOutlineColour()\r
{\r
- this._has_outlineColour= false;\r
- } //-- void deleteOutlineColour() \r
+ this._has_outlineColour = false;\r
+ }\r
+\r
+ //-- void deleteOutlineColour() \r
\r
/**\r
* Method deletePidThreshold\r
- * \r
+ *\r
*/\r
public void deletePidThreshold()\r
{\r
- this._has_pidThreshold= false;\r
- } //-- void deletePidThreshold() \r
+ this._has_pidThreshold = false;\r
+ }\r
+\r
+ //-- void deletePidThreshold() \r
\r
/**\r
* Method deleteStart\r
- * \r
+ *\r
*/\r
public void deleteStart()\r
{\r
- this._has_start= false;\r
- } //-- void deleteStart() \r
+ this._has_start = false;\r
+ }\r
+\r
+ //-- void deleteStart() \r
\r
/**\r
* Method enumerateSeq\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @return Enumeration\r
*/\r
public java.util.Enumeration enumerateSeq()\r
{\r
return _seqList.elements();\r
- } //-- java.util.Enumeration enumerateSeq() \r
+ }\r
+\r
+ //-- java.util.Enumeration enumerateSeq() \r
\r
/**\r
* Returns the value of field 'colour'.\r
- * \r
+ *\r
* @return String\r
* @return the value of field 'colour'.\r
*/\r
public java.lang.String getColour()\r
{\r
return this._colour;\r
- } //-- java.lang.String getColour() \r
+ }\r
+\r
+ //-- java.lang.String getColour() \r
\r
/**\r
* Returns the value of field 'colourText'.\r
- * \r
+ *\r
* @return boolean\r
* @return the value of field 'colourText'.\r
*/\r
public boolean getColourText()\r
{\r
return this._colourText;\r
- } //-- boolean getColourText() \r
+ }\r
+\r
+ //-- boolean getColourText() \r
\r
/**\r
* Returns the value of field 'consThreshold'.\r
- * \r
+ *\r
* @return int\r
* @return the value of field 'consThreshold'.\r
*/\r
public int getConsThreshold()\r
{\r
return this._consThreshold;\r
- } //-- int getConsThreshold() \r
+ }\r
+\r
+ //-- int getConsThreshold() \r
\r
/**\r
* Returns the value of field 'displayBoxes'.\r
- * \r
+ *\r
* @return boolean\r
* @return the value of field 'displayBoxes'.\r
*/\r
public boolean getDisplayBoxes()\r
{\r
return this._displayBoxes;\r
- } //-- boolean getDisplayBoxes() \r
+ }\r
+\r
+ //-- boolean getDisplayBoxes() \r
\r
/**\r
* Returns the value of field 'displayText'.\r
- * \r
+ *\r
* @return boolean\r
* @return the value of field 'displayText'.\r
*/\r
public boolean getDisplayText()\r
{\r
return this._displayText;\r
- } //-- boolean getDisplayText() \r
+ }\r
+\r
+ //-- boolean getDisplayText() \r
\r
/**\r
* Returns the value of field 'end'.\r
- * \r
+ *\r
* @return int\r
* @return the value of field 'end'.\r
*/\r
public int getEnd()\r
{\r
return this._end;\r
- } //-- int getEnd() \r
+ }\r
+\r
+ //-- int getEnd() \r
\r
/**\r
* Returns the value of field 'name'.\r
- * \r
+ *\r
* @return String\r
* @return the value of field 'name'.\r
*/\r
public java.lang.String getName()\r
{\r
return this._name;\r
- } //-- java.lang.String getName() \r
+ }\r
+\r
+ //-- java.lang.String getName() \r
\r
/**\r
* Returns the value of field 'outlineColour'.\r
- * \r
+ *\r
* @return int\r
* @return the value of field 'outlineColour'.\r
*/\r
public int getOutlineColour()\r
{\r
return this._outlineColour;\r
- } //-- int getOutlineColour() \r
+ }\r
+\r
+ //-- int getOutlineColour() \r
\r
/**\r
* Returns the value of field 'pidThreshold'.\r
- * \r
+ *\r
* @return int\r
* @return the value of field 'pidThreshold'.\r
*/\r
public int getPidThreshold()\r
{\r
return this._pidThreshold;\r
- } //-- int getPidThreshold() \r
+ }\r
+\r
+ //-- int getPidThreshold() \r
\r
/**\r
* Method getSeq\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param index\r
* @return int\r
*/\r
- public int getSeq(int index)\r
- throws java.lang.IndexOutOfBoundsException\r
+ public int getSeq(int index) throws java.lang.IndexOutOfBoundsException\r
{\r
//-- check bounds for index\r
- if ((index < 0) || (index > _seqList.size())) {\r
+ if ((index < 0) || (index > _seqList.size()))\r
+ {\r
throw new IndexOutOfBoundsException();\r
}\r
- \r
- return ((java.lang.Integer)_seqList.elementAt(index)).intValue();\r
- } //-- int getSeq(int) \r
+\r
+ return ((java.lang.Integer) _seqList.elementAt(index)).intValue();\r
+ }\r
+\r
+ //-- int getSeq(int) \r
\r
/**\r
* Method getSeq\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @return int\r
*/\r
public int[] getSeq()\r
{\r
int size = _seqList.size();\r
int[] mArray = new int[size];\r
- for (int index = 0; index < size; index++) {\r
- mArray[index] = ((java.lang.Integer)_seqList.elementAt(index)).intValue();\r
+\r
+ for (int index = 0; index < size; index++)\r
+ {\r
+ mArray[index] = ((java.lang.Integer) _seqList.elementAt(index)).intValue();\r
}\r
+\r
return mArray;\r
- } //-- int[] getSeq() \r
+ }\r
+\r
+ //-- int[] getSeq() \r
\r
/**\r
* Method getSeqCount\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @return int\r
*/\r
public int getSeqCount()\r
{\r
return _seqList.size();\r
- } //-- int getSeqCount() \r
+ }\r
+\r
+ //-- int getSeqCount() \r
\r
/**\r
* Returns the value of field 'start'.\r
- * \r
+ *\r
* @return int\r
* @return the value of field 'start'.\r
*/\r
public int getStart()\r
{\r
return this._start;\r
- } //-- int getStart() \r
+ }\r
+\r
+ //-- int getStart() \r
\r
/**\r
* Method hasColourText\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @return boolean\r
*/\r
public boolean hasColourText()\r
{\r
return this._has_colourText;\r
- } //-- boolean hasColourText() \r
+ }\r
+\r
+ //-- boolean hasColourText() \r
\r
/**\r
* Method hasConsThreshold\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @return boolean\r
*/\r
public boolean hasConsThreshold()\r
{\r
return this._has_consThreshold;\r
- } //-- boolean hasConsThreshold() \r
+ }\r
+\r
+ //-- boolean hasConsThreshold() \r
\r
/**\r
* Method hasDisplayBoxes\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @return boolean\r
*/\r
public boolean hasDisplayBoxes()\r
{\r
return this._has_displayBoxes;\r
- } //-- boolean hasDisplayBoxes() \r
+ }\r
+\r
+ //-- boolean hasDisplayBoxes() \r
\r
/**\r
* Method hasDisplayText\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @return boolean\r
*/\r
public boolean hasDisplayText()\r
{\r
return this._has_displayText;\r
- } //-- boolean hasDisplayText() \r
+ }\r
+\r
+ //-- boolean hasDisplayText() \r
\r
/**\r
* Method hasEnd\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @return boolean\r
*/\r
public boolean hasEnd()\r
{\r
return this._has_end;\r
- } //-- boolean hasEnd() \r
+ }\r
+\r
+ //-- boolean hasEnd() \r
\r
/**\r
* Method hasOutlineColour\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @return boolean\r
*/\r
public boolean hasOutlineColour()\r
{\r
return this._has_outlineColour;\r
- } //-- boolean hasOutlineColour() \r
+ }\r
+\r
+ //-- boolean hasOutlineColour() \r
\r
/**\r
* Method hasPidThreshold\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @return boolean\r
*/\r
public boolean hasPidThreshold()\r
{\r
return this._has_pidThreshold;\r
- } //-- boolean hasPidThreshold() \r
+ }\r
+\r
+ //-- boolean hasPidThreshold() \r
\r
/**\r
* Method hasStart\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @return boolean\r
*/\r
public boolean hasStart()\r
{\r
return this._has_start;\r
- } //-- boolean hasStart() \r
+ }\r
+\r
+ //-- boolean hasStart() \r
\r
/**\r
* Method isValid\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @return boolean\r
*/\r
public boolean isValid()\r
{\r
- try {\r
+ try\r
+ {\r
validate();\r
}\r
- catch (org.exolab.castor.xml.ValidationException vex) {\r
+ catch (org.exolab.castor.xml.ValidationException vex)\r
+ {\r
return false;\r
}\r
+\r
return true;\r
- } //-- boolean isValid() \r
+ }\r
+\r
+ //-- boolean isValid() \r
\r
/**\r
* Method marshal\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param out\r
*/\r
public void marshal(java.io.Writer out)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+ throws org.exolab.castor.xml.MarshalException, \r
+ org.exolab.castor.xml.ValidationException\r
{\r
- \r
Marshaller.marshal(this, out);\r
- } //-- void marshal(java.io.Writer) \r
+ }\r
+\r
+ //-- void marshal(java.io.Writer) \r
\r
/**\r
* Method marshal\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param handler\r
*/\r
public void marshal(org.xml.sax.ContentHandler handler)\r
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException, \r
+ org.exolab.castor.xml.ValidationException\r
{\r
- \r
Marshaller.marshal(this, handler);\r
- } //-- void marshal(org.xml.sax.ContentHandler) \r
+ }\r
+\r
+ //-- void marshal(org.xml.sax.ContentHandler) \r
\r
/**\r
* Method removeAllSeq\r
- * \r
+ *\r
*/\r
public void removeAllSeq()\r
{\r
_seqList.removeAllElements();\r
- } //-- void removeAllSeq() \r
+ }\r
+\r
+ //-- void removeAllSeq() \r
\r
/**\r
* Method removeSeq\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param index\r
* @return int\r
*/\r
{\r
java.lang.Object obj = _seqList.elementAt(index);\r
_seqList.removeElementAt(index);\r
- return ((java.lang.Integer)obj).intValue();\r
- } //-- int removeSeq(int) \r
+\r
+ return ((java.lang.Integer) obj).intValue();\r
+ }\r
+\r
+ //-- int removeSeq(int) \r
\r
/**\r
* Sets the value of field 'colour'.\r
- * \r
+ *\r
* @param colour the value of field 'colour'.\r
*/\r
public void setColour(java.lang.String colour)\r
{\r
this._colour = colour;\r
- } //-- void setColour(java.lang.String) \r
+ }\r
+\r
+ //-- void setColour(java.lang.String) \r
\r
/**\r
* Sets the value of field 'colourText'.\r
- * \r
+ *\r
* @param colourText the value of field 'colourText'.\r
*/\r
public void setColourText(boolean colourText)\r
{\r
this._colourText = colourText;\r
this._has_colourText = true;\r
- } //-- void setColourText(boolean) \r
+ }\r
+\r
+ //-- void setColourText(boolean) \r
\r
/**\r
* Sets the value of field 'consThreshold'.\r
- * \r
+ *\r
* @param consThreshold the value of field 'consThreshold'.\r
*/\r
public void setConsThreshold(int consThreshold)\r
{\r
this._consThreshold = consThreshold;\r
this._has_consThreshold = true;\r
- } //-- void setConsThreshold(int) \r
+ }\r
+\r
+ //-- void setConsThreshold(int) \r
\r
/**\r
* Sets the value of field 'displayBoxes'.\r
- * \r
+ *\r
* @param displayBoxes the value of field 'displayBoxes'.\r
*/\r
public void setDisplayBoxes(boolean displayBoxes)\r
{\r
this._displayBoxes = displayBoxes;\r
this._has_displayBoxes = true;\r
- } //-- void setDisplayBoxes(boolean) \r
+ }\r
+\r
+ //-- void setDisplayBoxes(boolean) \r
\r
/**\r
* Sets the value of field 'displayText'.\r
- * \r
+ *\r
* @param displayText the value of field 'displayText'.\r
*/\r
public void setDisplayText(boolean displayText)\r
{\r
this._displayText = displayText;\r
this._has_displayText = true;\r
- } //-- void setDisplayText(boolean) \r
+ }\r
+\r
+ //-- void setDisplayText(boolean) \r
\r
/**\r
* Sets the value of field 'end'.\r
- * \r
+ *\r
* @param end the value of field 'end'.\r
*/\r
public void setEnd(int end)\r
{\r
this._end = end;\r
this._has_end = true;\r
- } //-- void setEnd(int) \r
+ }\r
+\r
+ //-- void setEnd(int) \r
\r
/**\r
* Sets the value of field 'name'.\r
- * \r
+ *\r
* @param name the value of field 'name'.\r
*/\r
public void setName(java.lang.String name)\r
{\r
this._name = name;\r
- } //-- void setName(java.lang.String) \r
+ }\r
+\r
+ //-- void setName(java.lang.String) \r
\r
/**\r
* Sets the value of field 'outlineColour'.\r
- * \r
+ *\r
* @param outlineColour the value of field 'outlineColour'.\r
*/\r
public void setOutlineColour(int outlineColour)\r
{\r
this._outlineColour = outlineColour;\r
this._has_outlineColour = true;\r
- } //-- void setOutlineColour(int) \r
+ }\r
+\r
+ //-- void setOutlineColour(int) \r
\r
/**\r
* Sets the value of field 'pidThreshold'.\r
- * \r
+ *\r
* @param pidThreshold the value of field 'pidThreshold'.\r
*/\r
public void setPidThreshold(int pidThreshold)\r
{\r
this._pidThreshold = pidThreshold;\r
this._has_pidThreshold = true;\r
- } //-- void setPidThreshold(int) \r
+ }\r
+\r
+ //-- void setPidThreshold(int) \r
\r
/**\r
* Method setSeq\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param index\r
* @param vSeq\r
*/\r
throws java.lang.IndexOutOfBoundsException\r
{\r
//-- check bounds for index\r
- if ((index < 0) || (index > _seqList.size())) {\r
+ if ((index < 0) || (index > _seqList.size()))\r
+ {\r
throw new IndexOutOfBoundsException();\r
}\r
+\r
_seqList.setElementAt(new java.lang.Integer(vSeq), index);\r
- } //-- void setSeq(int, int) \r
+ }\r
+\r
+ //-- void setSeq(int, int) \r
\r
/**\r
* Method setSeq\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param seqArray\r
*/\r
public void setSeq(int[] seqArray)\r
{\r
//-- copy array\r
_seqList.removeAllElements();\r
- for (int i = 0; i < seqArray.length; i++) {\r
+\r
+ for (int i = 0; i < seqArray.length; i++)\r
+ {\r
_seqList.addElement(new java.lang.Integer(seqArray[i]));\r
}\r
- } //-- void setSeq(int) \r
+ }\r
+\r
+ //-- void setSeq(int) \r
\r
/**\r
* Sets the value of field 'start'.\r
- * \r
+ *\r
* @param start the value of field 'start'.\r
*/\r
public void setStart(int start)\r
{\r
this._start = start;\r
this._has_start = true;\r
- } //-- void setStart(int) \r
+ }\r
+\r
+ //-- void setStart(int) \r
\r
/**\r
* Method unmarshal\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param reader\r
* @return Object\r
*/\r
public static java.lang.Object unmarshal(java.io.Reader reader)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+ throws org.exolab.castor.xml.MarshalException, \r
+ org.exolab.castor.xml.ValidationException\r
{\r
- return (jalview.binding.JGroup) Unmarshaller.unmarshal(jalview.binding.JGroup.class, reader);\r
- } //-- java.lang.Object unmarshal(java.io.Reader) \r
+ return (jalview.binding.JGroup) Unmarshaller.unmarshal(jalview.binding.JGroup.class,\r
+ reader);\r
+ }\r
+\r
+ //-- java.lang.Object unmarshal(java.io.Reader) \r
\r
/**\r
* Method validate\r
- * \r
+ *\r
*/\r
- public void validate()\r
- throws org.exolab.castor.xml.ValidationException\r
+ public void validate() throws org.exolab.castor.xml.ValidationException\r
{\r
org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
validator.validate(this);\r
- } //-- void validate() \r
+ }\r
\r
+ //-- void validate() \r
}\r
/*\r
- * This class was automatically generated with \r
+ * This class was automatically generated with\r
* <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
* Schema.\r
* $Id$\r
*/\r
-\r
package jalview.binding;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
-//---------------------------------/\r
-\r
-import java.io.IOException;\r
-import java.io.Reader;\r
-import java.io.Serializable;\r
-import java.io.Writer;\r
import org.exolab.castor.xml.MarshalException;\r
import org.exolab.castor.xml.Marshaller;\r
import org.exolab.castor.xml.Unmarshaller;\r
import org.exolab.castor.xml.ValidationException;\r
+\r
import org.xml.sax.ContentHandler;\r
\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
+//---------------------------------/\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+\r
+\r
/**\r
* Class JSeq.\r
- * \r
+ *\r
* @version $Revision$ $Date$\r
*/\r
-public class JSeq implements java.io.Serializable {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
+public class JSeq implements java.io.Serializable\r
+{\r
+ //--------------------------/\r
+ //- Class/Member Variables -/\r
//--------------------------/\r
\r
/**\r
*/\r
private boolean _has_id;\r
\r
-\r
- //----------------/\r
- //- Constructors -/\r
//----------------/\r
-\r
- public JSeq() {\r
+ //- Constructors -/\r
+ //----------------/\r
+ public JSeq()\r
+ {\r
super();\r
- } //-- jalview.binding.JSeq()\r
+ }\r
\r
-\r
- //-----------/\r
- //- Methods -/\r
+ //-- jalview.binding.JSeq()\r
//-----------/\r
\r
/**\r
- * Method deleteColour\r
- * \r
+ * DOCUMENT ME!\r
*/\r
public void deleteColour()\r
{\r
- this._has_colour= false;\r
- } //-- void deleteColour() \r
+ this._has_colour = false;\r
+ }\r
+\r
+ //-- void deleteColour() \r
\r
/**\r
* Method deleteEnd\r
- * \r
+ *\r
*/\r
public void deleteEnd()\r
{\r
- this._has_end= false;\r
- } //-- void deleteEnd() \r
+ this._has_end = false;\r
+ }\r
+\r
+ //-- void deleteEnd() \r
\r
/**\r
* Method deleteId\r
- * \r
+ *\r
*/\r
public void deleteId()\r
{\r
- this._has_id= false;\r
- } //-- void deleteId() \r
+ this._has_id = false;\r
+ }\r
+\r
+ //-- void deleteId() \r
\r
/**\r
* Method deleteStart\r
- * \r
+ *\r
*/\r
public void deleteStart()\r
{\r
- this._has_start= false;\r
- } //-- void deleteStart() \r
+ this._has_start = false;\r
+ }\r
+\r
+ //-- void deleteStart() \r
\r
/**\r
* Returns the value of field 'colour'.\r
- * \r
+ *\r
* @return int\r
* @return the value of field 'colour'.\r
*/\r
public int getColour()\r
{\r
return this._colour;\r
- } //-- int getColour() \r
+ }\r
+\r
+ //-- int getColour() \r
\r
/**\r
* Returns the value of field 'end'.\r
- * \r
+ *\r
* @return int\r
* @return the value of field 'end'.\r
*/\r
public int getEnd()\r
{\r
return this._end;\r
- } //-- int getEnd() \r
+ }\r
+\r
+ //-- int getEnd() \r
\r
/**\r
* Returns the value of field 'id'.\r
- * \r
+ *\r
* @return int\r
* @return the value of field 'id'.\r
*/\r
public int getId()\r
{\r
return this._id;\r
- } //-- int getId() \r
+ }\r
+\r
+ //-- int getId() \r
\r
/**\r
* Returns the value of field 'start'.\r
- * \r
+ *\r
* @return int\r
* @return the value of field 'start'.\r
*/\r
public int getStart()\r
{\r
return this._start;\r
- } //-- int getStart() \r
+ }\r
+\r
+ //-- int getStart() \r
\r
/**\r
* Method hasColour\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @return boolean\r
*/\r
public boolean hasColour()\r
{\r
return this._has_colour;\r
- } //-- boolean hasColour() \r
+ }\r
+\r
+ //-- boolean hasColour() \r
\r
/**\r
* Method hasEnd\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @return boolean\r
*/\r
public boolean hasEnd()\r
{\r
return this._has_end;\r
- } //-- boolean hasEnd() \r
+ }\r
+\r
+ //-- boolean hasEnd() \r
\r
/**\r
* Method hasId\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @return boolean\r
*/\r
public boolean hasId()\r
{\r
return this._has_id;\r
- } //-- boolean hasId() \r
+ }\r
+\r
+ //-- boolean hasId() \r
\r
/**\r
* Method hasStart\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @return boolean\r
*/\r
public boolean hasStart()\r
{\r
return this._has_start;\r
- } //-- boolean hasStart() \r
+ }\r
+\r
+ //-- boolean hasStart() \r
\r
/**\r
* Method isValid\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @return boolean\r
*/\r
public boolean isValid()\r
{\r
- try {\r
+ try\r
+ {\r
validate();\r
}\r
- catch (org.exolab.castor.xml.ValidationException vex) {\r
+ catch (org.exolab.castor.xml.ValidationException vex)\r
+ {\r
return false;\r
}\r
+\r
return true;\r
- } //-- boolean isValid() \r
+ }\r
+\r
+ //-- boolean isValid() \r
\r
/**\r
* Method marshal\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param out\r
*/\r
public void marshal(java.io.Writer out)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+ throws org.exolab.castor.xml.MarshalException, \r
+ org.exolab.castor.xml.ValidationException\r
{\r
- \r
Marshaller.marshal(this, out);\r
- } //-- void marshal(java.io.Writer) \r
+ }\r
+\r
+ //-- void marshal(java.io.Writer) \r
\r
/**\r
* Method marshal\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param handler\r
*/\r
public void marshal(org.xml.sax.ContentHandler handler)\r
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException, \r
+ org.exolab.castor.xml.ValidationException\r
{\r
- \r
Marshaller.marshal(this, handler);\r
- } //-- void marshal(org.xml.sax.ContentHandler) \r
+ }\r
+\r
+ //-- void marshal(org.xml.sax.ContentHandler) \r
\r
/**\r
* Sets the value of field 'colour'.\r
- * \r
+ *\r
* @param colour the value of field 'colour'.\r
*/\r
public void setColour(int colour)\r
{\r
this._colour = colour;\r
this._has_colour = true;\r
- } //-- void setColour(int) \r
+ }\r
+\r
+ //-- void setColour(int) \r
\r
/**\r
* Sets the value of field 'end'.\r
- * \r
+ *\r
* @param end the value of field 'end'.\r
*/\r
public void setEnd(int end)\r
{\r
this._end = end;\r
this._has_end = true;\r
- } //-- void setEnd(int) \r
+ }\r
+\r
+ //-- void setEnd(int) \r
\r
/**\r
* Sets the value of field 'id'.\r
- * \r
+ *\r
* @param id the value of field 'id'.\r
*/\r
public void setId(int id)\r
{\r
this._id = id;\r
this._has_id = true;\r
- } //-- void setId(int) \r
+ }\r
+\r
+ //-- void setId(int) \r
\r
/**\r
* Sets the value of field 'start'.\r
- * \r
+ *\r
* @param start the value of field 'start'.\r
*/\r
public void setStart(int start)\r
{\r
this._start = start;\r
this._has_start = true;\r
- } //-- void setStart(int) \r
+ }\r
+\r
+ //-- void setStart(int) \r
\r
/**\r
* Method unmarshal\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param reader\r
* @return Object\r
*/\r
public static java.lang.Object unmarshal(java.io.Reader reader)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+ throws org.exolab.castor.xml.MarshalException, \r
+ org.exolab.castor.xml.ValidationException\r
{\r
- return (jalview.binding.JSeq) Unmarshaller.unmarshal(jalview.binding.JSeq.class, reader);\r
- } //-- java.lang.Object unmarshal(java.io.Reader) \r
+ return (jalview.binding.JSeq) Unmarshaller.unmarshal(jalview.binding.JSeq.class,\r
+ reader);\r
+ }\r
+\r
+ //-- java.lang.Object unmarshal(java.io.Reader) \r
\r
/**\r
* Method validate\r
- * \r
+ *\r
*/\r
- public void validate()\r
- throws org.exolab.castor.xml.ValidationException\r
+ public void validate() throws org.exolab.castor.xml.ValidationException\r
{\r
org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
validator.validate(this);\r
- } //-- void validate() \r
+ }\r
\r
+ //-- void validate() \r
}\r
/*\r
- * This class was automatically generated with \r
+ * This class was automatically generated with\r
* <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
* Schema.\r
* $Id$\r
*/\r
-\r
package jalview.binding;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
-//---------------------------------/\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+\r
+import org.xml.sax.ContentHandler;\r
\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
+//---------------------------------/\r
import java.io.IOException;\r
import java.io.Reader;\r
import java.io.Serializable;\r
import java.io.Writer;\r
+\r
import java.util.Date;\r
-import org.exolab.castor.xml.MarshalException;\r
-import org.exolab.castor.xml.Marshaller;\r
-import org.exolab.castor.xml.Unmarshaller;\r
-import org.exolab.castor.xml.ValidationException;\r
-import org.xml.sax.ContentHandler;\r
+\r
\r
/**\r
* Class JalviewModel.\r
- * \r
+ *\r
* @version $Revision$ $Date$\r
*/\r
-public class JalviewModel implements java.io.Serializable {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
+public class JalviewModel implements java.io.Serializable\r
+{\r
+ //--------------------------/\r
+ //- Class/Member Variables -/\r
//--------------------------/\r
\r
/**\r
*/\r
private jalview.binding.JalviewModelSequence _jalviewModelSequence;\r
\r
-\r
- //----------------/\r
- //- Constructors -/\r
//----------------/\r
-\r
- public JalviewModel() {\r
+ //- Constructors -/\r
+ //----------------/\r
+ public JalviewModel()\r
+ {\r
super();\r
- } //-- jalview.binding.JalviewModel()\r
+ }\r
\r
-\r
- //-----------/\r
- //- Methods -/\r
+ //-- jalview.binding.JalviewModel()\r
//-----------/\r
\r
/**\r
- * Returns the value of field 'creationDate'.\r
- * \r
- * @return Date\r
- * @return the value of field 'creationDate'.\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
*/\r
public java.util.Date getCreationDate()\r
{\r
return this._creationDate;\r
- } //-- java.util.Date getCreationDate() \r
+ }\r
+\r
+ //-- java.util.Date getCreationDate() \r
\r
/**\r
* Returns the value of field 'jalviewModelSequence'.\r
- * \r
+ *\r
* @return JalviewModelSequence\r
* @return the value of field 'jalviewModelSequence'.\r
*/\r
public jalview.binding.JalviewModelSequence getJalviewModelSequence()\r
{\r
return this._jalviewModelSequence;\r
- } //-- jalview.binding.JalviewModelSequence getJalviewModelSequence() \r
+ }\r
+\r
+ //-- jalview.binding.JalviewModelSequence getJalviewModelSequence() \r
\r
/**\r
* Returns the value of field 'vamsasModel'.\r
- * \r
+ *\r
* @return VamsasModel\r
* @return the value of field 'vamsasModel'.\r
*/\r
public jalview.binding.VamsasModel getVamsasModel()\r
{\r
return this._vamsasModel;\r
- } //-- jalview.binding.VamsasModel getVamsasModel() \r
+ }\r
+\r
+ //-- jalview.binding.VamsasModel getVamsasModel() \r
\r
/**\r
* Returns the value of field 'version'.\r
- * \r
+ *\r
* @return String\r
* @return the value of field 'version'.\r
*/\r
public java.lang.String getVersion()\r
{\r
return this._version;\r
- } //-- java.lang.String getVersion() \r
+ }\r
+\r
+ //-- java.lang.String getVersion() \r
\r
/**\r
* Method isValid\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @return boolean\r
*/\r
public boolean isValid()\r
{\r
- try {\r
+ try\r
+ {\r
validate();\r
}\r
- catch (org.exolab.castor.xml.ValidationException vex) {\r
+ catch (org.exolab.castor.xml.ValidationException vex)\r
+ {\r
return false;\r
}\r
+\r
return true;\r
- } //-- boolean isValid() \r
+ }\r
+\r
+ //-- boolean isValid() \r
\r
/**\r
* Method marshal\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param out\r
*/\r
public void marshal(java.io.Writer out)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+ throws org.exolab.castor.xml.MarshalException, \r
+ org.exolab.castor.xml.ValidationException\r
{\r
- \r
Marshaller.marshal(this, out);\r
- } //-- void marshal(java.io.Writer) \r
+ }\r
+\r
+ //-- void marshal(java.io.Writer) \r
\r
/**\r
* Method marshal\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param handler\r
*/\r
public void marshal(org.xml.sax.ContentHandler handler)\r
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException, \r
+ org.exolab.castor.xml.ValidationException\r
{\r
- \r
Marshaller.marshal(this, handler);\r
- } //-- void marshal(org.xml.sax.ContentHandler) \r
+ }\r
+\r
+ //-- void marshal(org.xml.sax.ContentHandler) \r
\r
/**\r
* Sets the value of field 'creationDate'.\r
- * \r
+ *\r
* @param creationDate the value of field 'creationDate'.\r
*/\r
public void setCreationDate(java.util.Date creationDate)\r
{\r
this._creationDate = creationDate;\r
- } //-- void setCreationDate(java.util.Date) \r
+ }\r
+\r
+ //-- void setCreationDate(java.util.Date) \r
\r
/**\r
* Sets the value of field 'jalviewModelSequence'.\r
- * \r
+ *\r
* @param jalviewModelSequence the value of field\r
* 'jalviewModelSequence'.\r
*/\r
- public void setJalviewModelSequence(jalview.binding.JalviewModelSequence jalviewModelSequence)\r
+ public void setJalviewModelSequence(\r
+ jalview.binding.JalviewModelSequence jalviewModelSequence)\r
{\r
this._jalviewModelSequence = jalviewModelSequence;\r
- } //-- void setJalviewModelSequence(jalview.binding.JalviewModelSequence) \r
+ }\r
+\r
+ //-- void setJalviewModelSequence(jalview.binding.JalviewModelSequence) \r
\r
/**\r
* Sets the value of field 'vamsasModel'.\r
- * \r
+ *\r
* @param vamsasModel the value of field 'vamsasModel'.\r
*/\r
public void setVamsasModel(jalview.binding.VamsasModel vamsasModel)\r
{\r
this._vamsasModel = vamsasModel;\r
- } //-- void setVamsasModel(jalview.binding.VamsasModel) \r
+ }\r
+\r
+ //-- void setVamsasModel(jalview.binding.VamsasModel) \r
\r
/**\r
* Sets the value of field 'version'.\r
- * \r
+ *\r
* @param version the value of field 'version'.\r
*/\r
public void setVersion(java.lang.String version)\r
{\r
this._version = version;\r
- } //-- void setVersion(java.lang.String) \r
+ }\r
+\r
+ //-- void setVersion(java.lang.String) \r
\r
/**\r
* Method unmarshal\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param reader\r
* @return Object\r
*/\r
public static java.lang.Object unmarshal(java.io.Reader reader)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+ throws org.exolab.castor.xml.MarshalException, \r
+ org.exolab.castor.xml.ValidationException\r
{\r
- return (jalview.binding.JalviewModel) Unmarshaller.unmarshal(jalview.binding.JalviewModel.class, reader);\r
- } //-- java.lang.Object unmarshal(java.io.Reader) \r
+ return (jalview.binding.JalviewModel) Unmarshaller.unmarshal(jalview.binding.JalviewModel.class,\r
+ reader);\r
+ }\r
+\r
+ //-- java.lang.Object unmarshal(java.io.Reader) \r
\r
/**\r
* Method validate\r
- * \r
+ *\r
*/\r
- public void validate()\r
- throws org.exolab.castor.xml.ValidationException\r
+ public void validate() throws org.exolab.castor.xml.ValidationException\r
{\r
org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
validator.validate(this);\r
- } //-- void validate() \r
+ }\r
\r
+ //-- void validate() \r
}\r
/*\r
- * This class was automatically generated with \r
+ * This class was automatically generated with\r
* <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
* Schema.\r
* $Id$\r
\r
package jalview.binding;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
//---------------------------------/\r
+//- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.util.*;\r
\r
-import java.io.IOException;\r
-import java.io.Reader;\r
-import java.io.Serializable;\r
-import java.io.Writer;\r
-import java.util.Enumeration;\r
-import java.util.Vector;\r
-import org.exolab.castor.xml.MarshalException;\r
-import org.exolab.castor.xml.Marshaller;\r
-import org.exolab.castor.xml.Unmarshaller;\r
-import org.exolab.castor.xml.ValidationException;\r
-import org.xml.sax.ContentHandler;\r
+import org.exolab.castor.xml.*;\r
\r
/**\r
* Class JalviewModelSequence.\r
- * \r
+ *\r
* @version $Revision$ $Date$\r
*/\r
-public class JalviewModelSequence implements java.io.Serializable {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _JSeqList\r
- */\r
- private java.util.Vector _JSeqList;\r
-\r
- /**\r
- * Field _JGroupList\r
- */\r
- private java.util.Vector _JGroupList;\r
-\r
- /**\r
- * Field _viewportList\r
- */\r
- private java.util.Vector _viewportList;\r
-\r
- /**\r
- * Field _userColoursList\r
- */\r
- private java.util.Vector _userColoursList;\r
-\r
- /**\r
- * Field _treeList\r
- */\r
- private java.util.Vector _treeList;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public JalviewModelSequence() {\r
- super();\r
- _JSeqList = new Vector();\r
- _JGroupList = new Vector();\r
- _viewportList = new Vector();\r
- _userColoursList = new Vector();\r
- _treeList = new Vector();\r
- } //-- jalview.binding.JalviewModelSequence()\r
-\r
-\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
-\r
- /**\r
- * Method addJGroup\r
- * \r
- * \r
- * \r
- * @param vJGroup\r
- */\r
- public void addJGroup(jalview.binding.JGroup vJGroup)\r
- throws java.lang.IndexOutOfBoundsException\r
- {\r
- _JGroupList.addElement(vJGroup);\r
- } //-- void addJGroup(jalview.binding.JGroup) \r
-\r
- /**\r
- * Method addJGroup\r
- * \r
- * \r
- * \r
- * @param index\r
- * @param vJGroup\r
- */\r
- public void addJGroup(int index, jalview.binding.JGroup vJGroup)\r
- throws java.lang.IndexOutOfBoundsException\r
- {\r
- _JGroupList.insertElementAt(vJGroup, index);\r
- } //-- void addJGroup(int, jalview.binding.JGroup) \r
-\r
- /**\r
- * Method addJSeq\r
- * \r
- * \r
- * \r
- * @param vJSeq\r
- */\r
- public void addJSeq(jalview.binding.JSeq vJSeq)\r
- throws java.lang.IndexOutOfBoundsException\r
- {\r
- _JSeqList.addElement(vJSeq);\r
- } //-- void addJSeq(jalview.binding.JSeq) \r
-\r
- /**\r
- * Method addJSeq\r
- * \r
- * \r
- * \r
- * @param index\r
- * @param vJSeq\r
- */\r
- public void addJSeq(int index, jalview.binding.JSeq vJSeq)\r
- throws java.lang.IndexOutOfBoundsException\r
- {\r
- _JSeqList.insertElementAt(vJSeq, index);\r
- } //-- void addJSeq(int, jalview.binding.JSeq) \r
-\r
- /**\r
- * Method addTree\r
- * \r
- * \r
- * \r
- * @param vTree\r
- */\r
- public void addTree(jalview.binding.Tree vTree)\r
- throws java.lang.IndexOutOfBoundsException\r
- {\r
- _treeList.addElement(vTree);\r
- } //-- void addTree(jalview.binding.Tree) \r
-\r
- /**\r
- * Method addTree\r
- * \r
- * \r
- * \r
- * @param index\r
- * @param vTree\r
- */\r
- public void addTree(int index, jalview.binding.Tree vTree)\r
- throws java.lang.IndexOutOfBoundsException\r
- {\r
- _treeList.insertElementAt(vTree, index);\r
- } //-- void addTree(int, jalview.binding.Tree) \r
-\r
- /**\r
- * Method addUserColours\r
- * \r
- * \r
- * \r
- * @param vUserColours\r
- */\r
- public void addUserColours(jalview.binding.UserColours vUserColours)\r
- throws java.lang.IndexOutOfBoundsException\r
- {\r
- _userColoursList.addElement(vUserColours);\r
- } //-- void addUserColours(jalview.binding.UserColours) \r
-\r
- /**\r
- * Method addUserColours\r
- * \r
- * \r
- * \r
- * @param index\r
- * @param vUserColours\r
- */\r
- public void addUserColours(int index, jalview.binding.UserColours vUserColours)\r
- throws java.lang.IndexOutOfBoundsException\r
- {\r
- _userColoursList.insertElementAt(vUserColours, index);\r
- } //-- void addUserColours(int, jalview.binding.UserColours) \r
-\r
- /**\r
- * Method addViewport\r
- * \r
- * \r
- * \r
- * @param vViewport\r
- */\r
- public void addViewport(jalview.binding.Viewport vViewport)\r
- throws java.lang.IndexOutOfBoundsException\r
- {\r
- _viewportList.addElement(vViewport);\r
- } //-- void addViewport(jalview.binding.Viewport) \r
-\r
- /**\r
- * Method addViewport\r
- * \r
- * \r
- * \r
- * @param index\r
- * @param vViewport\r
- */\r
- public void addViewport(int index, jalview.binding.Viewport vViewport)\r
- throws java.lang.IndexOutOfBoundsException\r
- {\r
- _viewportList.insertElementAt(vViewport, index);\r
- } //-- void addViewport(int, jalview.binding.Viewport) \r
-\r
- /**\r
- * Method enumerateJGroup\r
- * \r
- * \r
- * \r
- * @return Enumeration\r
- */\r
- public java.util.Enumeration enumerateJGroup()\r
- {\r
- return _JGroupList.elements();\r
- } //-- java.util.Enumeration enumerateJGroup() \r
-\r
- /**\r
- * Method enumerateJSeq\r
- * \r
- * \r
- * \r
- * @return Enumeration\r
- */\r
- public java.util.Enumeration enumerateJSeq()\r
- {\r
- return _JSeqList.elements();\r
- } //-- java.util.Enumeration enumerateJSeq() \r
-\r
- /**\r
- * Method enumerateTree\r
- * \r
- * \r
- * \r
- * @return Enumeration\r
- */\r
- public java.util.Enumeration enumerateTree()\r
- {\r
- return _treeList.elements();\r
- } //-- java.util.Enumeration enumerateTree() \r
-\r
- /**\r
- * Method enumerateUserColours\r
- * \r
- * \r
- * \r
- * @return Enumeration\r
- */\r
- public java.util.Enumeration enumerateUserColours()\r
- {\r
- return _userColoursList.elements();\r
- } //-- java.util.Enumeration enumerateUserColours() \r
-\r
- /**\r
- * Method enumerateViewport\r
- * \r
- * \r
- * \r
- * @return Enumeration\r
- */\r
- public java.util.Enumeration enumerateViewport()\r
- {\r
- return _viewportList.elements();\r
- } //-- java.util.Enumeration enumerateViewport() \r
-\r
- /**\r
- * Method getJGroup\r
- * \r
- * \r
- * \r
- * @param index\r
- * @return JGroup\r
- */\r
- public jalview.binding.JGroup getJGroup(int index)\r
- throws java.lang.IndexOutOfBoundsException\r
- {\r
- //-- check bounds for index\r
- if ((index < 0) || (index > _JGroupList.size())) {\r
- throw new IndexOutOfBoundsException();\r
- }\r
- \r
- return (jalview.binding.JGroup) _JGroupList.elementAt(index);\r
- } //-- jalview.binding.JGroup getJGroup(int) \r
-\r
- /**\r
- * Method getJGroup\r
- * \r
- * \r
- * \r
- * @return JGroup\r
- */\r
- public jalview.binding.JGroup[] getJGroup()\r
- {\r
- int size = _JGroupList.size();\r
- jalview.binding.JGroup[] mArray = new jalview.binding.JGroup[size];\r
- for (int index = 0; index < size; index++) {\r
- mArray[index] = (jalview.binding.JGroup) _JGroupList.elementAt(index);\r
- }\r
- return mArray;\r
- } //-- jalview.binding.JGroup[] getJGroup() \r
-\r
- /**\r
- * Method getJGroupCount\r
- * \r
- * \r
- * \r
- * @return int\r
- */\r
- public int getJGroupCount()\r
- {\r
- return _JGroupList.size();\r
- } //-- int getJGroupCount() \r
-\r
- /**\r
- * Method getJSeq\r
- * \r
- * \r
- * \r
- * @param index\r
- * @return JSeq\r
- */\r
- public jalview.binding.JSeq getJSeq(int index)\r
- throws java.lang.IndexOutOfBoundsException\r
- {\r
- //-- check bounds for index\r
- if ((index < 0) || (index > _JSeqList.size())) {\r
- throw new IndexOutOfBoundsException();\r
- }\r
- \r
- return (jalview.binding.JSeq) _JSeqList.elementAt(index);\r
- } //-- jalview.binding.JSeq getJSeq(int) \r
-\r
- /**\r
- * Method getJSeq\r
- * \r
- * \r
- * \r
- * @return JSeq\r
- */\r
- public jalview.binding.JSeq[] getJSeq()\r
- {\r
- int size = _JSeqList.size();\r
- jalview.binding.JSeq[] mArray = new jalview.binding.JSeq[size];\r
- for (int index = 0; index < size; index++) {\r
- mArray[index] = (jalview.binding.JSeq) _JSeqList.elementAt(index);\r
- }\r
- return mArray;\r
- } //-- jalview.binding.JSeq[] getJSeq() \r
-\r
- /**\r
- * Method getJSeqCount\r
- * \r
- * \r
- * \r
- * @return int\r
- */\r
- public int getJSeqCount()\r
- {\r
- return _JSeqList.size();\r
- } //-- int getJSeqCount() \r
-\r
- /**\r
- * Method getTree\r
- * \r
- * \r
- * \r
- * @param index\r
- * @return Tree\r
- */\r
- public jalview.binding.Tree getTree(int index)\r
- throws java.lang.IndexOutOfBoundsException\r
- {\r
- //-- check bounds for index\r
- if ((index < 0) || (index > _treeList.size())) {\r
- throw new IndexOutOfBoundsException();\r
- }\r
- \r
- return (jalview.binding.Tree) _treeList.elementAt(index);\r
- } //-- jalview.binding.Tree getTree(int) \r
-\r
- /**\r
- * Method getTree\r
- * \r
- * \r
- * \r
- * @return Tree\r
- */\r
- public jalview.binding.Tree[] getTree()\r
- {\r
- int size = _treeList.size();\r
- jalview.binding.Tree[] mArray = new jalview.binding.Tree[size];\r
- for (int index = 0; index < size; index++) {\r
- mArray[index] = (jalview.binding.Tree) _treeList.elementAt(index);\r
- }\r
- return mArray;\r
- } //-- jalview.binding.Tree[] getTree() \r
-\r
- /**\r
- * Method getTreeCount\r
- * \r
- * \r
- * \r
- * @return int\r
- */\r
- public int getTreeCount()\r
- {\r
- return _treeList.size();\r
- } //-- int getTreeCount() \r
-\r
- /**\r
- * Method getUserColours\r
- * \r
- * \r
- * \r
- * @param index\r
- * @return UserColours\r
- */\r
- public jalview.binding.UserColours getUserColours(int index)\r
- throws java.lang.IndexOutOfBoundsException\r
- {\r
- //-- check bounds for index\r
- if ((index < 0) || (index > _userColoursList.size())) {\r
- throw new IndexOutOfBoundsException();\r
- }\r
- \r
- return (jalview.binding.UserColours) _userColoursList.elementAt(index);\r
- } //-- jalview.binding.UserColours getUserColours(int) \r
-\r
- /**\r
- * Method getUserColours\r
- * \r
- * \r
- * \r
- * @return UserColours\r
- */\r
- public jalview.binding.UserColours[] getUserColours()\r
- {\r
- int size = _userColoursList.size();\r
- jalview.binding.UserColours[] mArray = new jalview.binding.UserColours[size];\r
- for (int index = 0; index < size; index++) {\r
- mArray[index] = (jalview.binding.UserColours) _userColoursList.elementAt(index);\r
- }\r
- return mArray;\r
- } //-- jalview.binding.UserColours[] getUserColours() \r
-\r
- /**\r
- * Method getUserColoursCount\r
- * \r
- * \r
- * \r
- * @return int\r
- */\r
- public int getUserColoursCount()\r
- {\r
- return _userColoursList.size();\r
- } //-- int getUserColoursCount() \r
-\r
- /**\r
- * Method getViewport\r
- * \r
- * \r
- * \r
- * @param index\r
- * @return Viewport\r
- */\r
- public jalview.binding.Viewport getViewport(int index)\r
- throws java.lang.IndexOutOfBoundsException\r
- {\r
- //-- check bounds for index\r
- if ((index < 0) || (index > _viewportList.size())) {\r
- throw new IndexOutOfBoundsException();\r
- }\r
- \r
- return (jalview.binding.Viewport) _viewportList.elementAt(index);\r
- } //-- jalview.binding.Viewport getViewport(int) \r
-\r
- /**\r
- * Method getViewport\r
- * \r
- * \r
- * \r
- * @return Viewport\r
- */\r
- public jalview.binding.Viewport[] getViewport()\r
- {\r
- int size = _viewportList.size();\r
- jalview.binding.Viewport[] mArray = new jalview.binding.Viewport[size];\r
- for (int index = 0; index < size; index++) {\r
- mArray[index] = (jalview.binding.Viewport) _viewportList.elementAt(index);\r
- }\r
- return mArray;\r
- } //-- jalview.binding.Viewport[] getViewport() \r
-\r
- /**\r
- * Method getViewportCount\r
- * \r
- * \r
- * \r
- * @return int\r
- */\r
- public int getViewportCount()\r
- {\r
- return _viewportList.size();\r
- } //-- int getViewportCount() \r
-\r
- /**\r
- * Method isValid\r
- * \r
- * \r
- * \r
- * @return boolean\r
- */\r
- public boolean isValid()\r
- {\r
- try {\r
- validate();\r
- }\r
- catch (org.exolab.castor.xml.ValidationException vex) {\r
- return false;\r
- }\r
- return true;\r
- } //-- boolean isValid() \r
-\r
- /**\r
- * Method marshal\r
- * \r
- * \r
- * \r
- * @param out\r
- */\r
- public void marshal(java.io.Writer out)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
- {\r
- \r
- Marshaller.marshal(this, out);\r
- } //-- void marshal(java.io.Writer) \r
-\r
- /**\r
- * Method marshal\r
- * \r
- * \r
- * \r
- * @param handler\r
- */\r
- public void marshal(org.xml.sax.ContentHandler handler)\r
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
- {\r
- \r
- Marshaller.marshal(this, handler);\r
- } //-- void marshal(org.xml.sax.ContentHandler) \r
-\r
- /**\r
- * Method removeAllJGroup\r
- * \r
- */\r
- public void removeAllJGroup()\r
- {\r
- _JGroupList.removeAllElements();\r
- } //-- void removeAllJGroup() \r
-\r
- /**\r
- * Method removeAllJSeq\r
- * \r
- */\r
- public void removeAllJSeq()\r
- {\r
- _JSeqList.removeAllElements();\r
- } //-- void removeAllJSeq() \r
-\r
- /**\r
- * Method removeAllTree\r
- * \r
- */\r
- public void removeAllTree()\r
- {\r
- _treeList.removeAllElements();\r
- } //-- void removeAllTree() \r
-\r
- /**\r
- * Method removeAllUserColours\r
- * \r
- */\r
- public void removeAllUserColours()\r
- {\r
- _userColoursList.removeAllElements();\r
- } //-- void removeAllUserColours() \r
-\r
- /**\r
- * Method removeAllViewport\r
- * \r
- */\r
- public void removeAllViewport()\r
- {\r
- _viewportList.removeAllElements();\r
- } //-- void removeAllViewport() \r
-\r
- /**\r
- * Method removeJGroup\r
- * \r
- * \r
- * \r
- * @param index\r
- * @return JGroup\r
- */\r
- public jalview.binding.JGroup removeJGroup(int index)\r
- {\r
- java.lang.Object obj = _JGroupList.elementAt(index);\r
- _JGroupList.removeElementAt(index);\r
- return (jalview.binding.JGroup) obj;\r
- } //-- jalview.binding.JGroup removeJGroup(int) \r
-\r
- /**\r
- * Method removeJSeq\r
- * \r
- * \r
- * \r
- * @param index\r
- * @return JSeq\r
- */\r
- public jalview.binding.JSeq removeJSeq(int index)\r
- {\r
- java.lang.Object obj = _JSeqList.elementAt(index);\r
- _JSeqList.removeElementAt(index);\r
- return (jalview.binding.JSeq) obj;\r
- } //-- jalview.binding.JSeq removeJSeq(int) \r
-\r
- /**\r
- * Method removeTree\r
- * \r
- * \r
- * \r
- * @param index\r
- * @return Tree\r
- */\r
- public jalview.binding.Tree removeTree(int index)\r
- {\r
- java.lang.Object obj = _treeList.elementAt(index);\r
- _treeList.removeElementAt(index);\r
- return (jalview.binding.Tree) obj;\r
- } //-- jalview.binding.Tree removeTree(int) \r
-\r
- /**\r
- * Method removeUserColours\r
- * \r
- * \r
- * \r
- * @param index\r
- * @return UserColours\r
- */\r
- public jalview.binding.UserColours removeUserColours(int index)\r
- {\r
- java.lang.Object obj = _userColoursList.elementAt(index);\r
- _userColoursList.removeElementAt(index);\r
- return (jalview.binding.UserColours) obj;\r
- } //-- jalview.binding.UserColours removeUserColours(int) \r
-\r
- /**\r
- * Method removeViewport\r
- * \r
- * \r
- * \r
- * @param index\r
- * @return Viewport\r
- */\r
- public jalview.binding.Viewport removeViewport(int index)\r
- {\r
- java.lang.Object obj = _viewportList.elementAt(index);\r
- _viewportList.removeElementAt(index);\r
- return (jalview.binding.Viewport) obj;\r
- } //-- jalview.binding.Viewport removeViewport(int) \r
-\r
- /**\r
- * Method setJGroup\r
- * \r
- * \r
- * \r
- * @param index\r
- * @param vJGroup\r
- */\r
- public void setJGroup(int index, jalview.binding.JGroup vJGroup)\r
- throws java.lang.IndexOutOfBoundsException\r
- {\r
- //-- check bounds for index\r
- if ((index < 0) || (index > _JGroupList.size())) {\r
- throw new IndexOutOfBoundsException();\r
- }\r
- _JGroupList.setElementAt(vJGroup, index);\r
- } //-- void setJGroup(int, jalview.binding.JGroup) \r
-\r
- /**\r
- * Method setJGroup\r
- * \r
- * \r
- * \r
- * @param JGroupArray\r
- */\r
- public void setJGroup(jalview.binding.JGroup[] JGroupArray)\r
- {\r
- //-- copy array\r
- _JGroupList.removeAllElements();\r
- for (int i = 0; i < JGroupArray.length; i++) {\r
- _JGroupList.addElement(JGroupArray[i]);\r
- }\r
- } //-- void setJGroup(jalview.binding.JGroup) \r
-\r
- /**\r
- * Method setJSeq\r
- * \r
- * \r
- * \r
- * @param index\r
- * @param vJSeq\r
- */\r
- public void setJSeq(int index, jalview.binding.JSeq vJSeq)\r
- throws java.lang.IndexOutOfBoundsException\r
- {\r
- //-- check bounds for index\r
- if ((index < 0) || (index > _JSeqList.size())) {\r
- throw new IndexOutOfBoundsException();\r
- }\r
- _JSeqList.setElementAt(vJSeq, index);\r
- } //-- void setJSeq(int, jalview.binding.JSeq) \r
-\r
- /**\r
- * Method setJSeq\r
- * \r
- * \r
- * \r
- * @param JSeqArray\r
- */\r
- public void setJSeq(jalview.binding.JSeq[] JSeqArray)\r
- {\r
- //-- copy array\r
- _JSeqList.removeAllElements();\r
- for (int i = 0; i < JSeqArray.length; i++) {\r
- _JSeqList.addElement(JSeqArray[i]);\r
- }\r
- } //-- void setJSeq(jalview.binding.JSeq) \r
-\r
- /**\r
- * Method setTree\r
- * \r
- * \r
- * \r
- * @param index\r
- * @param vTree\r
- */\r
- public void setTree(int index, jalview.binding.Tree vTree)\r
- throws java.lang.IndexOutOfBoundsException\r
- {\r
- //-- check bounds for index\r
- if ((index < 0) || (index > _treeList.size())) {\r
- throw new IndexOutOfBoundsException();\r
- }\r
- _treeList.setElementAt(vTree, index);\r
- } //-- void setTree(int, jalview.binding.Tree) \r
-\r
- /**\r
- * Method setTree\r
- * \r
- * \r
- * \r
- * @param treeArray\r
- */\r
- public void setTree(jalview.binding.Tree[] treeArray)\r
- {\r
- //-- copy array\r
- _treeList.removeAllElements();\r
- for (int i = 0; i < treeArray.length; i++) {\r
- _treeList.addElement(treeArray[i]);\r
- }\r
- } //-- void setTree(jalview.binding.Tree) \r
-\r
- /**\r
- * Method setUserColours\r
- * \r
- * \r
- * \r
- * @param index\r
- * @param vUserColours\r
- */\r
- public void setUserColours(int index, jalview.binding.UserColours vUserColours)\r
- throws java.lang.IndexOutOfBoundsException\r
- {\r
- //-- check bounds for index\r
- if ((index < 0) || (index > _userColoursList.size())) {\r
- throw new IndexOutOfBoundsException();\r
- }\r
- _userColoursList.setElementAt(vUserColours, index);\r
- } //-- void setUserColours(int, jalview.binding.UserColours) \r
-\r
- /**\r
- * Method setUserColours\r
- * \r
- * \r
- * \r
- * @param userColoursArray\r
- */\r
- public void setUserColours(jalview.binding.UserColours[] userColoursArray)\r
- {\r
- //-- copy array\r
- _userColoursList.removeAllElements();\r
- for (int i = 0; i < userColoursArray.length; i++) {\r
- _userColoursList.addElement(userColoursArray[i]);\r
- }\r
- } //-- void setUserColours(jalview.binding.UserColours) \r
-\r
- /**\r
- * Method setViewport\r
- * \r
- * \r
- * \r
- * @param index\r
- * @param vViewport\r
- */\r
- public void setViewport(int index, jalview.binding.Viewport vViewport)\r
- throws java.lang.IndexOutOfBoundsException\r
- {\r
- //-- check bounds for index\r
- if ((index < 0) || (index > _viewportList.size())) {\r
- throw new IndexOutOfBoundsException();\r
- }\r
- _viewportList.setElementAt(vViewport, index);\r
- } //-- void setViewport(int, jalview.binding.Viewport) \r
-\r
- /**\r
- * Method setViewport\r
- * \r
- * \r
- * \r
- * @param viewportArray\r
- */\r
- public void setViewport(jalview.binding.Viewport[] viewportArray)\r
- {\r
- //-- copy array\r
- _viewportList.removeAllElements();\r
- for (int i = 0; i < viewportArray.length; i++) {\r
- _viewportList.addElement(viewportArray[i]);\r
- }\r
- } //-- void setViewport(jalview.binding.Viewport) \r
-\r
- /**\r
- * Method unmarshal\r
- * \r
- * \r
- * \r
- * @param reader\r
- * @return Object\r
- */\r
- public static java.lang.Object unmarshal(java.io.Reader reader)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
- {\r
- return (jalview.binding.JalviewModelSequence) Unmarshaller.unmarshal(jalview.binding.JalviewModelSequence.class, reader);\r
- } //-- java.lang.Object unmarshal(java.io.Reader) \r
-\r
- /**\r
- * Method validate\r
- * \r
- */\r
- public void validate()\r
- throws org.exolab.castor.xml.ValidationException\r
- {\r
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
- validator.validate(this);\r
- } //-- void validate() \r
+public class JalviewModelSequence\r
+ implements java.io.Serializable\r
+{\r
+\r
+ //--------------------------/\r
+ //- Class/Member Variables -/\r
+ //--------------------------/\r
+\r
+ /**\r
+ * Field _JSeqList\r
+ */\r
+ private java.util.Vector _JSeqList;\r
+\r
+ /**\r
+ * Field _JGroupList\r
+ */\r
+ private java.util.Vector _JGroupList;\r
+\r
+ /**\r
+ * Field _viewportList\r
+ */\r
+ private java.util.Vector _viewportList;\r
+\r
+ /**\r
+ * Field _userColoursList\r
+ */\r
+ private java.util.Vector _userColoursList;\r
+\r
+ /**\r
+ * Field _treeList\r
+ */\r
+ private java.util.Vector _treeList;\r
+\r
+ //----------------/\r
+ //- Constructors -/\r
+ //----------------/\r
+\r
+ public JalviewModelSequence()\r
+ {\r
+ super();\r
+ _JSeqList = new Vector();\r
+ _JGroupList = new Vector();\r
+ _viewportList = new Vector();\r
+ _userColoursList = new Vector();\r
+ _treeList = new Vector();\r
+ } //-- jalview.binding.JalviewModelSequence()\r
+\r
+ //-----------/\r
+ //- Methods -/\r
+ //-----------/\r
+\r
+ /**\r
+ * Method addJGroup\r
+ *\r
+ *\r
+ *\r
+ * @param vJGroup\r
+ */\r
+ public void addJGroup(jalview.binding.JGroup vJGroup)\r
+ throws java.lang.IndexOutOfBoundsException\r
+ {\r
+ _JGroupList.addElement(vJGroup);\r
+ } //-- void addJGroup(jalview.binding.JGroup)\r
+\r
+ /**\r
+ * Method addJGroup\r
+ *\r
+ *\r
+ *\r
+ * @param index\r
+ * @param vJGroup\r
+ */\r
+ public void addJGroup(int index, jalview.binding.JGroup vJGroup)\r
+ throws java.lang.IndexOutOfBoundsException\r
+ {\r
+ _JGroupList.insertElementAt(vJGroup, index);\r
+ } //-- void addJGroup(int, jalview.binding.JGroup)\r
+\r
+ /**\r
+ * Method addJSeq\r
+ *\r
+ *\r
+ *\r
+ * @param vJSeq\r
+ */\r
+ public void addJSeq(jalview.binding.JSeq vJSeq)\r
+ throws java.lang.IndexOutOfBoundsException\r
+ {\r
+ _JSeqList.addElement(vJSeq);\r
+ } //-- void addJSeq(jalview.binding.JSeq)\r
+\r
+ /**\r
+ * Method addJSeq\r
+ *\r
+ *\r
+ *\r
+ * @param index\r
+ * @param vJSeq\r
+ */\r
+ public void addJSeq(int index, jalview.binding.JSeq vJSeq)\r
+ throws java.lang.IndexOutOfBoundsException\r
+ {\r
+ _JSeqList.insertElementAt(vJSeq, index);\r
+ } //-- void addJSeq(int, jalview.binding.JSeq)\r
+\r
+ /**\r
+ * Method addTree\r
+ *\r
+ *\r
+ *\r
+ * @param vTree\r
+ */\r
+ public void addTree(jalview.binding.Tree vTree)\r
+ throws java.lang.IndexOutOfBoundsException\r
+ {\r
+ _treeList.addElement(vTree);\r
+ } //-- void addTree(jalview.binding.Tree)\r
+\r
+ /**\r
+ * Method addTree\r
+ *\r
+ *\r
+ *\r
+ * @param index\r
+ * @param vTree\r
+ */\r
+ public void addTree(int index, jalview.binding.Tree vTree)\r
+ throws java.lang.IndexOutOfBoundsException\r
+ {\r
+ _treeList.insertElementAt(vTree, index);\r
+ } //-- void addTree(int, jalview.binding.Tree)\r
+\r
+ /**\r
+ * Method addUserColours\r
+ *\r
+ *\r
+ *\r
+ * @param vUserColours\r
+ */\r
+ public void addUserColours(jalview.binding.UserColours vUserColours)\r
+ throws java.lang.IndexOutOfBoundsException\r
+ {\r
+ _userColoursList.addElement(vUserColours);\r
+ } //-- void addUserColours(jalview.binding.UserColours)\r
+\r
+ /**\r
+ * Method addUserColours\r
+ *\r
+ *\r
+ *\r
+ * @param index\r
+ * @param vUserColours\r
+ */\r
+ public void addUserColours(int index,\r
+ jalview.binding.UserColours vUserColours)\r
+ throws java.lang.IndexOutOfBoundsException\r
+ {\r
+ _userColoursList.insertElementAt(vUserColours, index);\r
+ } //-- void addUserColours(int, jalview.binding.UserColours)\r
+\r
+ /**\r
+ * Method addViewport\r
+ *\r
+ *\r
+ *\r
+ * @param vViewport\r
+ */\r
+ public void addViewport(jalview.binding.Viewport vViewport)\r
+ throws java.lang.IndexOutOfBoundsException\r
+ {\r
+ _viewportList.addElement(vViewport);\r
+ } //-- void addViewport(jalview.binding.Viewport)\r
+\r
+ /**\r
+ * Method addViewport\r
+ *\r
+ *\r
+ *\r
+ * @param index\r
+ * @param vViewport\r
+ */\r
+ public void addViewport(int index, jalview.binding.Viewport vViewport)\r
+ throws java.lang.IndexOutOfBoundsException\r
+ {\r
+ _viewportList.insertElementAt(vViewport, index);\r
+ } //-- void addViewport(int, jalview.binding.Viewport)\r
+\r
+ /**\r
+ * Method enumerateJGroup\r
+ *\r
+ *\r
+ *\r
+ * @return Enumeration\r
+ */\r
+ public java.util.Enumeration enumerateJGroup()\r
+ {\r
+ return _JGroupList.elements();\r
+ } //-- java.util.Enumeration enumerateJGroup()\r
+\r
+ /**\r
+ * Method enumerateJSeq\r
+ *\r
+ *\r
+ *\r
+ * @return Enumeration\r
+ */\r
+ public java.util.Enumeration enumerateJSeq()\r
+ {\r
+ return _JSeqList.elements();\r
+ } //-- java.util.Enumeration enumerateJSeq()\r
+\r
+ /**\r
+ * Method enumerateTree\r
+ *\r
+ *\r
+ *\r
+ * @return Enumeration\r
+ */\r
+ public java.util.Enumeration enumerateTree()\r
+ {\r
+ return _treeList.elements();\r
+ } //-- java.util.Enumeration enumerateTree()\r
+\r
+ /**\r
+ * Method enumerateUserColours\r
+ *\r
+ *\r
+ *\r
+ * @return Enumeration\r
+ */\r
+ public java.util.Enumeration enumerateUserColours()\r
+ {\r
+ return _userColoursList.elements();\r
+ } //-- java.util.Enumeration enumerateUserColours()\r
+\r
+ /**\r
+ * Method enumerateViewport\r
+ *\r
+ *\r
+ *\r
+ * @return Enumeration\r
+ */\r
+ public java.util.Enumeration enumerateViewport()\r
+ {\r
+ return _viewportList.elements();\r
+ } //-- java.util.Enumeration enumerateViewport()\r
+\r
+ /**\r
+ * Method getJGroup\r
+ *\r
+ *\r
+ *\r
+ * @param index\r
+ * @return JGroup\r
+ */\r
+ public jalview.binding.JGroup getJGroup(int index)\r
+ throws java.lang.IndexOutOfBoundsException\r
+ {\r
+ //-- check bounds for index\r
+ if ( (index < 0) || (index > _JGroupList.size()))\r
+ {\r
+ throw new IndexOutOfBoundsException();\r
+ }\r
+\r
+ return (jalview.binding.JGroup) _JGroupList.elementAt(index);\r
+ } //-- jalview.binding.JGroup getJGroup(int)\r
+\r
+ /**\r
+ * Method getJGroup\r
+ *\r
+ *\r
+ *\r
+ * @return JGroup\r
+ */\r
+ public jalview.binding.JGroup[] getJGroup()\r
+ {\r
+ int size = _JGroupList.size();\r
+ jalview.binding.JGroup[] mArray = new jalview.binding.JGroup[size];\r
+ for (int index = 0; index < size; index++)\r
+ {\r
+ mArray[index] = (jalview.binding.JGroup) _JGroupList.elementAt(index);\r
+ }\r
+ return mArray;\r
+ } //-- jalview.binding.JGroup[] getJGroup()\r
+\r
+ /**\r
+ * Method getJGroupCount\r
+ *\r
+ *\r
+ *\r
+ * @return int\r
+ */\r
+ public int getJGroupCount()\r
+ {\r
+ return _JGroupList.size();\r
+ } //-- int getJGroupCount()\r
+\r
+ /**\r
+ * Method getJSeq\r
+ *\r
+ *\r
+ *\r
+ * @param index\r
+ * @return JSeq\r
+ */\r
+ public jalview.binding.JSeq getJSeq(int index)\r
+ throws java.lang.IndexOutOfBoundsException\r
+ {\r
+ //-- check bounds for index\r
+ if ( (index < 0) || (index > _JSeqList.size()))\r
+ {\r
+ throw new IndexOutOfBoundsException();\r
+ }\r
+\r
+ return (jalview.binding.JSeq) _JSeqList.elementAt(index);\r
+ } //-- jalview.binding.JSeq getJSeq(int)\r
+\r
+ /**\r
+ * Method getJSeq\r
+ *\r
+ *\r
+ *\r
+ * @return JSeq\r
+ */\r
+ public jalview.binding.JSeq[] getJSeq()\r
+ {\r
+ int size = _JSeqList.size();\r
+ jalview.binding.JSeq[] mArray = new jalview.binding.JSeq[size];\r
+ for (int index = 0; index < size; index++)\r
+ {\r
+ mArray[index] = (jalview.binding.JSeq) _JSeqList.elementAt(index);\r
+ }\r
+ return mArray;\r
+ } //-- jalview.binding.JSeq[] getJSeq()\r
+\r
+ /**\r
+ * Method getJSeqCount\r
+ *\r
+ *\r
+ *\r
+ * @return int\r
+ */\r
+ public int getJSeqCount()\r
+ {\r
+ return _JSeqList.size();\r
+ } //-- int getJSeqCount()\r
+\r
+ /**\r
+ * Method getTree\r
+ *\r
+ *\r
+ *\r
+ * @param index\r
+ * @return Tree\r
+ */\r
+ public jalview.binding.Tree getTree(int index)\r
+ throws java.lang.IndexOutOfBoundsException\r
+ {\r
+ //-- check bounds for index\r
+ if ( (index < 0) || (index > _treeList.size()))\r
+ {\r
+ throw new IndexOutOfBoundsException();\r
+ }\r
+\r
+ return (jalview.binding.Tree) _treeList.elementAt(index);\r
+ } //-- jalview.binding.Tree getTree(int)\r
+\r
+ /**\r
+ * Method getTree\r
+ *\r
+ *\r
+ *\r
+ * @return Tree\r
+ */\r
+ public jalview.binding.Tree[] getTree()\r
+ {\r
+ int size = _treeList.size();\r
+ jalview.binding.Tree[] mArray = new jalview.binding.Tree[size];\r
+ for (int index = 0; index < size; index++)\r
+ {\r
+ mArray[index] = (jalview.binding.Tree) _treeList.elementAt(index);\r
+ }\r
+ return mArray;\r
+ } //-- jalview.binding.Tree[] getTree()\r
+\r
+ /**\r
+ * Method getTreeCount\r
+ *\r
+ *\r
+ *\r
+ * @return int\r
+ */\r
+ public int getTreeCount()\r
+ {\r
+ return _treeList.size();\r
+ } //-- int getTreeCount()\r
+\r
+ /**\r
+ * Method getUserColours\r
+ *\r
+ *\r
+ *\r
+ * @param index\r
+ * @return UserColours\r
+ */\r
+ public jalview.binding.UserColours getUserColours(int index)\r
+ throws java.lang.IndexOutOfBoundsException\r
+ {\r
+ //-- check bounds for index\r
+ if ( (index < 0) || (index > _userColoursList.size()))\r
+ {\r
+ throw new IndexOutOfBoundsException();\r
+ }\r
+\r
+ return (jalview.binding.UserColours) _userColoursList.elementAt(index);\r
+ } //-- jalview.binding.UserColours getUserColours(int)\r
+\r
+ /**\r
+ * Method getUserColours\r
+ *\r
+ *\r
+ *\r
+ * @return UserColours\r
+ */\r
+ public jalview.binding.UserColours[] getUserColours()\r
+ {\r
+ int size = _userColoursList.size();\r
+ jalview.binding.UserColours[] mArray = new jalview.binding.UserColours[size];\r
+ for (int index = 0; index < size; index++)\r
+ {\r
+ mArray[index] = (jalview.binding.UserColours) _userColoursList.elementAt(\r
+ index);\r
+ }\r
+ return mArray;\r
+ } //-- jalview.binding.UserColours[] getUserColours()\r
+\r
+ /**\r
+ * Method getUserColoursCount\r
+ *\r
+ *\r
+ *\r
+ * @return int\r
+ */\r
+ public int getUserColoursCount()\r
+ {\r
+ return _userColoursList.size();\r
+ } //-- int getUserColoursCount()\r
+\r
+ /**\r
+ * Method getViewport\r
+ *\r
+ *\r
+ *\r
+ * @param index\r
+ * @return Viewport\r
+ */\r
+ public jalview.binding.Viewport getViewport(int index)\r
+ throws java.lang.IndexOutOfBoundsException\r
+ {\r
+ //-- check bounds for index\r
+ if ( (index < 0) || (index > _viewportList.size()))\r
+ {\r
+ throw new IndexOutOfBoundsException();\r
+ }\r
+\r
+ return (jalview.binding.Viewport) _viewportList.elementAt(index);\r
+ } //-- jalview.binding.Viewport getViewport(int)\r
+\r
+ /**\r
+ * Method getViewport\r
+ *\r
+ *\r
+ *\r
+ * @return Viewport\r
+ */\r
+ public jalview.binding.Viewport[] getViewport()\r
+ {\r
+ int size = _viewportList.size();\r
+ jalview.binding.Viewport[] mArray = new jalview.binding.Viewport[size];\r
+ for (int index = 0; index < size; index++)\r
+ {\r
+ mArray[index] = (jalview.binding.Viewport) _viewportList.elementAt(index);\r
+ }\r
+ return mArray;\r
+ } //-- jalview.binding.Viewport[] getViewport()\r
+\r
+ /**\r
+ * Method getViewportCount\r
+ *\r
+ *\r
+ *\r
+ * @return int\r
+ */\r
+ public int getViewportCount()\r
+ {\r
+ return _viewportList.size();\r
+ } //-- int getViewportCount()\r
+\r
+ /**\r
+ * Method isValid\r
+ *\r
+ *\r
+ *\r
+ * @return boolean\r
+ */\r
+ public boolean isValid()\r
+ {\r
+ try\r
+ {\r
+ validate();\r
+ }\r
+ catch (org.exolab.castor.xml.ValidationException vex)\r
+ {\r
+ return false;\r
+ }\r
+ return true;\r
+ } //-- boolean isValid()\r
+\r
+ /**\r
+ * Method marshal\r
+ *\r
+ *\r
+ *\r
+ * @param out\r
+ */\r
+ public void marshal(java.io.Writer out)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException\r
+ {\r
+\r
+ Marshaller.marshal(this, out);\r
+ } //-- void marshal(java.io.Writer)\r
+\r
+ /**\r
+ * Method marshal\r
+ *\r
+ *\r
+ *\r
+ * @param handler\r
+ */\r
+ public void marshal(org.xml.sax.ContentHandler handler)\r
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException\r
+ {\r
+\r
+ Marshaller.marshal(this, handler);\r
+ } //-- void marshal(org.xml.sax.ContentHandler)\r
+\r
+ /**\r
+ * Method removeAllJGroup\r
+ *\r
+ */\r
+ public void removeAllJGroup()\r
+ {\r
+ _JGroupList.removeAllElements();\r
+ } //-- void removeAllJGroup()\r
+\r
+ /**\r
+ * Method removeAllJSeq\r
+ *\r
+ */\r
+ public void removeAllJSeq()\r
+ {\r
+ _JSeqList.removeAllElements();\r
+ } //-- void removeAllJSeq()\r
+\r
+ /**\r
+ * Method removeAllTree\r
+ *\r
+ */\r
+ public void removeAllTree()\r
+ {\r
+ _treeList.removeAllElements();\r
+ } //-- void removeAllTree()\r
+\r
+ /**\r
+ * Method removeAllUserColours\r
+ *\r
+ */\r
+ public void removeAllUserColours()\r
+ {\r
+ _userColoursList.removeAllElements();\r
+ } //-- void removeAllUserColours()\r
+\r
+ /**\r
+ * Method removeAllViewport\r
+ *\r
+ */\r
+ public void removeAllViewport()\r
+ {\r
+ _viewportList.removeAllElements();\r
+ } //-- void removeAllViewport()\r
+\r
+ /**\r
+ * Method removeJGroup\r
+ *\r
+ *\r
+ *\r
+ * @param index\r
+ * @return JGroup\r
+ */\r
+ public jalview.binding.JGroup removeJGroup(int index)\r
+ {\r
+ java.lang.Object obj = _JGroupList.elementAt(index);\r
+ _JGroupList.removeElementAt(index);\r
+ return (jalview.binding.JGroup) obj;\r
+ } //-- jalview.binding.JGroup removeJGroup(int)\r
+\r
+ /**\r
+ * Method removeJSeq\r
+ *\r
+ *\r
+ *\r
+ * @param index\r
+ * @return JSeq\r
+ */\r
+ public jalview.binding.JSeq removeJSeq(int index)\r
+ {\r
+ java.lang.Object obj = _JSeqList.elementAt(index);\r
+ _JSeqList.removeElementAt(index);\r
+ return (jalview.binding.JSeq) obj;\r
+ } //-- jalview.binding.JSeq removeJSeq(int)\r
+\r
+ /**\r
+ * Method removeTree\r
+ *\r
+ *\r
+ *\r
+ * @param index\r
+ * @return Tree\r
+ */\r
+ public jalview.binding.Tree removeTree(int index)\r
+ {\r
+ java.lang.Object obj = _treeList.elementAt(index);\r
+ _treeList.removeElementAt(index);\r
+ return (jalview.binding.Tree) obj;\r
+ } //-- jalview.binding.Tree removeTree(int)\r
+\r
+ /**\r
+ * Method removeUserColours\r
+ *\r
+ *\r
+ *\r
+ * @param index\r
+ * @return UserColours\r
+ */\r
+ public jalview.binding.UserColours removeUserColours(int index)\r
+ {\r
+ java.lang.Object obj = _userColoursList.elementAt(index);\r
+ _userColoursList.removeElementAt(index);\r
+ return (jalview.binding.UserColours) obj;\r
+ } //-- jalview.binding.UserColours removeUserColours(int)\r
+\r
+ /**\r
+ * Method removeViewport\r
+ *\r
+ *\r
+ *\r
+ * @param index\r
+ * @return Viewport\r
+ */\r
+ public jalview.binding.Viewport removeViewport(int index)\r
+ {\r
+ java.lang.Object obj = _viewportList.elementAt(index);\r
+ _viewportList.removeElementAt(index);\r
+ return (jalview.binding.Viewport) obj;\r
+ } //-- jalview.binding.Viewport removeViewport(int)\r
+\r
+ /**\r
+ * Method setJGroup\r
+ *\r
+ *\r
+ *\r
+ * @param index\r
+ * @param vJGroup\r
+ */\r
+ public void setJGroup(int index, jalview.binding.JGroup vJGroup)\r
+ throws java.lang.IndexOutOfBoundsException\r
+ {\r
+ //-- check bounds for index\r
+ if ( (index < 0) || (index > _JGroupList.size()))\r
+ {\r
+ throw new IndexOutOfBoundsException();\r
+ }\r
+ _JGroupList.setElementAt(vJGroup, index);\r
+ } //-- void setJGroup(int, jalview.binding.JGroup)\r
+\r
+ /**\r
+ * Method setJGroup\r
+ *\r
+ *\r
+ *\r
+ * @param JGroupArray\r
+ */\r
+ public void setJGroup(jalview.binding.JGroup[] JGroupArray)\r
+ {\r
+ //-- copy array\r
+ _JGroupList.removeAllElements();\r
+ for (int i = 0; i < JGroupArray.length; i++)\r
+ {\r
+ _JGroupList.addElement(JGroupArray[i]);\r
+ }\r
+ } //-- void setJGroup(jalview.binding.JGroup)\r
+\r
+ /**\r
+ * Method setJSeq\r
+ *\r
+ *\r
+ *\r
+ * @param index\r
+ * @param vJSeq\r
+ */\r
+ public void setJSeq(int index, jalview.binding.JSeq vJSeq)\r
+ throws java.lang.IndexOutOfBoundsException\r
+ {\r
+ //-- check bounds for index\r
+ if ( (index < 0) || (index > _JSeqList.size()))\r
+ {\r
+ throw new IndexOutOfBoundsException();\r
+ }\r
+ _JSeqList.setElementAt(vJSeq, index);\r
+ } //-- void setJSeq(int, jalview.binding.JSeq)\r
+\r
+ /**\r
+ * Method setJSeq\r
+ *\r
+ *\r
+ *\r
+ * @param JSeqArray\r
+ */\r
+ public void setJSeq(jalview.binding.JSeq[] JSeqArray)\r
+ {\r
+ //-- copy array\r
+ _JSeqList.removeAllElements();\r
+ for (int i = 0; i < JSeqArray.length; i++)\r
+ {\r
+ _JSeqList.addElement(JSeqArray[i]);\r
+ }\r
+ } //-- void setJSeq(jalview.binding.JSeq)\r
+\r
+ /**\r
+ * Method setTree\r
+ *\r
+ *\r
+ *\r
+ * @param index\r
+ * @param vTree\r
+ */\r
+ public void setTree(int index, jalview.binding.Tree vTree)\r
+ throws java.lang.IndexOutOfBoundsException\r
+ {\r
+ //-- check bounds for index\r
+ if ( (index < 0) || (index > _treeList.size()))\r
+ {\r
+ throw new IndexOutOfBoundsException();\r
+ }\r
+ _treeList.setElementAt(vTree, index);\r
+ } //-- void setTree(int, jalview.binding.Tree)\r
+\r
+ /**\r
+ * Method setTree\r
+ *\r
+ *\r
+ *\r
+ * @param treeArray\r
+ */\r
+ public void setTree(jalview.binding.Tree[] treeArray)\r
+ {\r
+ //-- copy array\r
+ _treeList.removeAllElements();\r
+ for (int i = 0; i < treeArray.length; i++)\r
+ {\r
+ _treeList.addElement(treeArray[i]);\r
+ }\r
+ } //-- void setTree(jalview.binding.Tree)\r
+\r
+ /**\r
+ * Method setUserColours\r
+ *\r
+ *\r
+ *\r
+ * @param index\r
+ * @param vUserColours\r
+ */\r
+ public void setUserColours(int index,\r
+ jalview.binding.UserColours vUserColours)\r
+ throws java.lang.IndexOutOfBoundsException\r
+ {\r
+ //-- check bounds for index\r
+ if ( (index < 0) || (index > _userColoursList.size()))\r
+ {\r
+ throw new IndexOutOfBoundsException();\r
+ }\r
+ _userColoursList.setElementAt(vUserColours, index);\r
+ } //-- void setUserColours(int, jalview.binding.UserColours)\r
+\r
+ /**\r
+ * Method setUserColours\r
+ *\r
+ *\r
+ *\r
+ * @param userColoursArray\r
+ */\r
+ public void setUserColours(jalview.binding.UserColours[] userColoursArray)\r
+ {\r
+ //-- copy array\r
+ _userColoursList.removeAllElements();\r
+ for (int i = 0; i < userColoursArray.length; i++)\r
+ {\r
+ _userColoursList.addElement(userColoursArray[i]);\r
+ }\r
+ } //-- void setUserColours(jalview.binding.UserColours)\r
+\r
+ /**\r
+ * Method setViewport\r
+ *\r
+ *\r
+ *\r
+ * @param index\r
+ * @param vViewport\r
+ */\r
+ public void setViewport(int index, jalview.binding.Viewport vViewport)\r
+ throws java.lang.IndexOutOfBoundsException\r
+ {\r
+ //-- check bounds for index\r
+ if ( (index < 0) || (index > _viewportList.size()))\r
+ {\r
+ throw new IndexOutOfBoundsException();\r
+ }\r
+ _viewportList.setElementAt(vViewport, index);\r
+ } //-- void setViewport(int, jalview.binding.Viewport)\r
+\r
+ /**\r
+ * Method setViewport\r
+ *\r
+ *\r
+ *\r
+ * @param viewportArray\r
+ */\r
+ public void setViewport(jalview.binding.Viewport[] viewportArray)\r
+ {\r
+ //-- copy array\r
+ _viewportList.removeAllElements();\r
+ for (int i = 0; i < viewportArray.length; i++)\r
+ {\r
+ _viewportList.addElement(viewportArray[i]);\r
+ }\r
+ } //-- void setViewport(jalview.binding.Viewport)\r
+\r
+ /**\r
+ * Method unmarshal\r
+ *\r
+ *\r
+ *\r
+ * @param reader\r
+ * @return Object\r
+ */\r
+ public static java.lang.Object unmarshal(java.io.Reader reader)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException\r
+ {\r
+ return (jalview.binding.JalviewModelSequence) Unmarshaller.unmarshal(\r
+ jalview.binding.JalviewModelSequence.class, reader);\r
+ } //-- java.lang.Object unmarshal(java.io.Reader)\r
+\r
+ /**\r
+ * Method validate\r
+ *\r
+ */\r
+ public void validate()\r
+ throws org.exolab.castor.xml.ValidationException\r
+ {\r
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.\r
+ Validator();\r
+ validator.validate(this);\r
+ } //-- void validate()\r
\r
}\r
/*\r
- * This class was automatically generated with \r
+ * This class was automatically generated with\r
* <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
* Schema.\r
* $Id$\r
*/\r
-\r
package jalview.binding;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
-//---------------------------------/\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
\r
+import org.xml.sax.ContentHandler;\r
+\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
+//---------------------------------/\r
import java.io.IOException;\r
import java.io.Reader;\r
import java.io.Serializable;\r
import java.io.Writer;\r
+\r
import java.util.Enumeration;\r
import java.util.Vector;\r
-import org.exolab.castor.xml.MarshalException;\r
-import org.exolab.castor.xml.Marshaller;\r
-import org.exolab.castor.xml.Unmarshaller;\r
-import org.exolab.castor.xml.ValidationException;\r
-import org.xml.sax.ContentHandler;\r
+\r
\r
/**\r
* Class JalviewModelSequence2.\r
- * \r
+ *\r
* @version $Revision$ $Date$\r
*/\r
-public class JalviewModelSequence2 implements java.io.Serializable {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
+public class JalviewModelSequence2 implements java.io.Serializable\r
+{\r
+ //--------------------------/\r
+ //- Class/Member Variables -/\r
//--------------------------/\r
\r
/**\r
*/\r
private java.util.Vector _items;\r
\r
-\r
- //----------------/\r
- //- Constructors -/\r
//----------------/\r
-\r
- public JalviewModelSequence2() {\r
+ //- Constructors -/\r
+ //----------------/\r
+ public JalviewModelSequence2()\r
+ {\r
super();\r
_items = new Vector();\r
- } //-- jalview.binding.JalviewModelSequence2()\r
-\r
+ }\r
\r
- //-----------/\r
- //- Methods -/\r
+ //-- jalview.binding.JalviewModelSequence2()\r
//-----------/\r
\r
/**\r
- * Method addJalviewModelSequence2Item\r
- * \r
- * \r
- * \r
- * @param vJalviewModelSequence2Item\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param vJalviewModelSequence2Item DOCUMENT ME!\r
+ *\r
+ * @throws java.lang.IndexOutOfBoundsException DOCUMENT ME!\r
*/\r
- public void addJalviewModelSequence2Item(jalview.binding.JalviewModelSequence2Item vJalviewModelSequence2Item)\r
+ public void addJalviewModelSequence2Item(\r
+ jalview.binding.JalviewModelSequence2Item vJalviewModelSequence2Item)\r
throws java.lang.IndexOutOfBoundsException\r
{\r
_items.addElement(vJalviewModelSequence2Item);\r
- } //-- void addJalviewModelSequence2Item(jalview.binding.JalviewModelSequence2Item) \r
+ }\r
+\r
+ //-- void addJalviewModelSequence2Item(jalview.binding.JalviewModelSequence2Item) \r
\r
/**\r
* Method addJalviewModelSequence2Item\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param index\r
* @param vJalviewModelSequence2Item\r
*/\r
- public void addJalviewModelSequence2Item(int index, jalview.binding.JalviewModelSequence2Item vJalviewModelSequence2Item)\r
+ public void addJalviewModelSequence2Item(int index,\r
+ jalview.binding.JalviewModelSequence2Item vJalviewModelSequence2Item)\r
throws java.lang.IndexOutOfBoundsException\r
{\r
_items.insertElementAt(vJalviewModelSequence2Item, index);\r
- } //-- void addJalviewModelSequence2Item(int, jalview.binding.JalviewModelSequence2Item) \r
+ }\r
+\r
+ //-- void addJalviewModelSequence2Item(int, jalview.binding.JalviewModelSequence2Item) \r
\r
/**\r
* Method enumerateJalviewModelSequence2Item\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @return Enumeration\r
*/\r
public java.util.Enumeration enumerateJalviewModelSequence2Item()\r
{\r
return _items.elements();\r
- } //-- java.util.Enumeration enumerateJalviewModelSequence2Item() \r
+ }\r
+\r
+ //-- java.util.Enumeration enumerateJalviewModelSequence2Item() \r
\r
/**\r
* Method getJalviewModelSequence2Item\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param index\r
* @return JalviewModelSequence2Item\r
*/\r
- public jalview.binding.JalviewModelSequence2Item getJalviewModelSequence2Item(int index)\r
- throws java.lang.IndexOutOfBoundsException\r
+ public jalview.binding.JalviewModelSequence2Item getJalviewModelSequence2Item(\r
+ int index) throws java.lang.IndexOutOfBoundsException\r
{\r
//-- check bounds for index\r
- if ((index < 0) || (index > _items.size())) {\r
+ if ((index < 0) || (index > _items.size()))\r
+ {\r
throw new IndexOutOfBoundsException();\r
}\r
- \r
+\r
return (jalview.binding.JalviewModelSequence2Item) _items.elementAt(index);\r
- } //-- jalview.binding.JalviewModelSequence2Item getJalviewModelSequence2Item(int) \r
+ }\r
+\r
+ //-- jalview.binding.JalviewModelSequence2Item getJalviewModelSequence2Item(int) \r
\r
/**\r
* Method getJalviewModelSequence2Item\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @return JalviewModelSequence2Item\r
*/\r
public jalview.binding.JalviewModelSequence2Item[] getJalviewModelSequence2Item()\r
{\r
int size = _items.size();\r
jalview.binding.JalviewModelSequence2Item[] mArray = new jalview.binding.JalviewModelSequence2Item[size];\r
- for (int index = 0; index < size; index++) {\r
+\r
+ for (int index = 0; index < size; index++)\r
+ {\r
mArray[index] = (jalview.binding.JalviewModelSequence2Item) _items.elementAt(index);\r
}\r
+\r
return mArray;\r
- } //-- jalview.binding.JalviewModelSequence2Item[] getJalviewModelSequence2Item() \r
+ }\r
+\r
+ //-- jalview.binding.JalviewModelSequence2Item[] getJalviewModelSequence2Item() \r
\r
/**\r
* Method getJalviewModelSequence2ItemCount\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @return int\r
*/\r
public int getJalviewModelSequence2ItemCount()\r
{\r
return _items.size();\r
- } //-- int getJalviewModelSequence2ItemCount() \r
+ }\r
+\r
+ //-- int getJalviewModelSequence2ItemCount() \r
\r
/**\r
* Method isValid\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @return boolean\r
*/\r
public boolean isValid()\r
{\r
- try {\r
+ try\r
+ {\r
validate();\r
}\r
- catch (org.exolab.castor.xml.ValidationException vex) {\r
+ catch (org.exolab.castor.xml.ValidationException vex)\r
+ {\r
return false;\r
}\r
+\r
return true;\r
- } //-- boolean isValid() \r
+ }\r
+\r
+ //-- boolean isValid() \r
\r
/**\r
* Method marshal\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param out\r
*/\r
public void marshal(java.io.Writer out)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+ throws org.exolab.castor.xml.MarshalException, \r
+ org.exolab.castor.xml.ValidationException\r
{\r
- \r
Marshaller.marshal(this, out);\r
- } //-- void marshal(java.io.Writer) \r
+ }\r
+\r
+ //-- void marshal(java.io.Writer) \r
\r
/**\r
* Method marshal\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param handler\r
*/\r
public void marshal(org.xml.sax.ContentHandler handler)\r
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException, \r
+ org.exolab.castor.xml.ValidationException\r
{\r
- \r
Marshaller.marshal(this, handler);\r
- } //-- void marshal(org.xml.sax.ContentHandler) \r
+ }\r
+\r
+ //-- void marshal(org.xml.sax.ContentHandler) \r
\r
/**\r
* Method removeAllJalviewModelSequence2Item\r
- * \r
+ *\r
*/\r
public void removeAllJalviewModelSequence2Item()\r
{\r
_items.removeAllElements();\r
- } //-- void removeAllJalviewModelSequence2Item() \r
+ }\r
+\r
+ //-- void removeAllJalviewModelSequence2Item() \r
\r
/**\r
* Method removeJalviewModelSequence2Item\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param index\r
* @return JalviewModelSequence2Item\r
*/\r
- public jalview.binding.JalviewModelSequence2Item removeJalviewModelSequence2Item(int index)\r
+ public jalview.binding.JalviewModelSequence2Item removeJalviewModelSequence2Item(\r
+ int index)\r
{\r
java.lang.Object obj = _items.elementAt(index);\r
_items.removeElementAt(index);\r
+\r
return (jalview.binding.JalviewModelSequence2Item) obj;\r
- } //-- jalview.binding.JalviewModelSequence2Item removeJalviewModelSequence2Item(int) \r
+ }\r
+\r
+ //-- jalview.binding.JalviewModelSequence2Item removeJalviewModelSequence2Item(int) \r
\r
/**\r
* Method setJalviewModelSequence2Item\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param index\r
* @param vJalviewModelSequence2Item\r
*/\r
- public void setJalviewModelSequence2Item(int index, jalview.binding.JalviewModelSequence2Item vJalviewModelSequence2Item)\r
+ public void setJalviewModelSequence2Item(int index,\r
+ jalview.binding.JalviewModelSequence2Item vJalviewModelSequence2Item)\r
throws java.lang.IndexOutOfBoundsException\r
{\r
//-- check bounds for index\r
- if ((index < 0) || (index > _items.size())) {\r
+ if ((index < 0) || (index > _items.size()))\r
+ {\r
throw new IndexOutOfBoundsException();\r
}\r
+\r
_items.setElementAt(vJalviewModelSequence2Item, index);\r
- } //-- void setJalviewModelSequence2Item(int, jalview.binding.JalviewModelSequence2Item) \r
+ }\r
+\r
+ //-- void setJalviewModelSequence2Item(int, jalview.binding.JalviewModelSequence2Item) \r
\r
/**\r
* Method setJalviewModelSequence2Item\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param jalviewModelSequence2ItemArray\r
*/\r
- public void setJalviewModelSequence2Item(jalview.binding.JalviewModelSequence2Item[] jalviewModelSequence2ItemArray)\r
+ public void setJalviewModelSequence2Item(\r
+ jalview.binding.JalviewModelSequence2Item[] jalviewModelSequence2ItemArray)\r
{\r
//-- copy array\r
_items.removeAllElements();\r
- for (int i = 0; i < jalviewModelSequence2ItemArray.length; i++) {\r
+\r
+ for (int i = 0; i < jalviewModelSequence2ItemArray.length; i++)\r
+ {\r
_items.addElement(jalviewModelSequence2ItemArray[i]);\r
}\r
- } //-- void setJalviewModelSequence2Item(jalview.binding.JalviewModelSequence2Item) \r
+ }\r
+\r
+ //-- void setJalviewModelSequence2Item(jalview.binding.JalviewModelSequence2Item) \r
\r
/**\r
* Method unmarshal\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param reader\r
* @return Object\r
*/\r
public static java.lang.Object unmarshal(java.io.Reader reader)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+ throws org.exolab.castor.xml.MarshalException, \r
+ org.exolab.castor.xml.ValidationException\r
{\r
- return (jalview.binding.JalviewModelSequence2) Unmarshaller.unmarshal(jalview.binding.JalviewModelSequence2.class, reader);\r
- } //-- java.lang.Object unmarshal(java.io.Reader) \r
+ return (jalview.binding.JalviewModelSequence2) Unmarshaller.unmarshal(jalview.binding.JalviewModelSequence2.class,\r
+ reader);\r
+ }\r
+\r
+ //-- java.lang.Object unmarshal(java.io.Reader) \r
\r
/**\r
* Method validate\r
- * \r
+ *\r
*/\r
- public void validate()\r
- throws org.exolab.castor.xml.ValidationException\r
+ public void validate() throws org.exolab.castor.xml.ValidationException\r
{\r
org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
validator.validate(this);\r
- } //-- void validate() \r
+ }\r
\r
+ //-- void validate() \r
}\r
/*\r
- * This class was automatically generated with \r
+ * This class was automatically generated with\r
* <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
* Schema.\r
* $Id$\r
\r
package jalview.binding;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
-import java.io.Serializable;\r
-import java.util.Enumeration;\r
-import java.util.Vector;\r
-import org.exolab.castor.xml.Marshaller;\r
-import org.exolab.castor.xml.Unmarshaller;\r
+import java.util.*;\r
\r
/**\r
* Class JalviewModelSequence2Item.\r
- * \r
+ *\r
* @version $Revision$ $Date$\r
*/\r
-public class JalviewModelSequence2Item implements java.io.Serializable {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _userColourSchemeList\r
- */\r
- private java.util.Vector _userColourSchemeList;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public JalviewModelSequence2Item() {\r
- super();\r
- _userColourSchemeList = new Vector();\r
- } //-- jalview.binding.JalviewModelSequence2Item()\r
-\r
-\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
-\r
- /**\r
- * Method addUserColourScheme\r
- * \r
- * \r
- * \r
- * @param vUserColourScheme\r
- */\r
- public void addUserColourScheme(jalview.binding.UserColourScheme vUserColourScheme)\r
- throws java.lang.IndexOutOfBoundsException\r
- {\r
- _userColourSchemeList.addElement(vUserColourScheme);\r
- } //-- void addUserColourScheme(jalview.binding.UserColourScheme) \r
-\r
- /**\r
- * Method addUserColourScheme\r
- * \r
- * \r
- * \r
- * @param index\r
- * @param vUserColourScheme\r
- */\r
- public void addUserColourScheme(int index, jalview.binding.UserColourScheme vUserColourScheme)\r
- throws java.lang.IndexOutOfBoundsException\r
- {\r
- _userColourSchemeList.insertElementAt(vUserColourScheme, index);\r
- } //-- void addUserColourScheme(int, jalview.binding.UserColourScheme) \r
-\r
- /**\r
- * Method enumerateUserColourScheme\r
- * \r
- * \r
- * \r
- * @return Enumeration\r
- */\r
- public java.util.Enumeration enumerateUserColourScheme()\r
- {\r
- return _userColourSchemeList.elements();\r
- } //-- java.util.Enumeration enumerateUserColourScheme() \r
-\r
- /**\r
- * Method getUserColourScheme\r
- * \r
- * \r
- * \r
- * @param index\r
- * @return UserColourScheme\r
- */\r
- public jalview.binding.UserColourScheme getUserColourScheme(int index)\r
- throws java.lang.IndexOutOfBoundsException\r
- {\r
- //-- check bounds for index\r
- if ((index < 0) || (index > _userColourSchemeList.size())) {\r
- throw new IndexOutOfBoundsException();\r
- }\r
- \r
- return (jalview.binding.UserColourScheme) _userColourSchemeList.elementAt(index);\r
- } //-- jalview.binding.UserColourScheme getUserColourScheme(int) \r
-\r
- /**\r
- * Method getUserColourScheme\r
- * \r
- * \r
- * \r
- * @return UserColourScheme\r
- */\r
- public jalview.binding.UserColourScheme[] getUserColourScheme()\r
- {\r
- int size = _userColourSchemeList.size();\r
- jalview.binding.UserColourScheme[] mArray = new jalview.binding.UserColourScheme[size];\r
- for (int index = 0; index < size; index++) {\r
- mArray[index] = (jalview.binding.UserColourScheme) _userColourSchemeList.elementAt(index);\r
- }\r
- return mArray;\r
- } //-- jalview.binding.UserColourScheme[] getUserColourScheme() \r
-\r
- /**\r
- * Method getUserColourSchemeCount\r
- * \r
- * \r
- * \r
- * @return int\r
- */\r
- public int getUserColourSchemeCount()\r
- {\r
- return _userColourSchemeList.size();\r
- } //-- int getUserColourSchemeCount() \r
-\r
- /**\r
- * Method removeAllUserColourScheme\r
- * \r
- */\r
- public void removeAllUserColourScheme()\r
+public class JalviewModelSequence2Item\r
+ implements java.io.Serializable\r
+{\r
+\r
+ //--------------------------/\r
+ //- Class/Member Variables -/\r
+ //--------------------------/\r
+\r
+ /**\r
+ * Field _userColourSchemeList\r
+ */\r
+ private java.util.Vector _userColourSchemeList;\r
+\r
+ //----------------/\r
+ //- Constructors -/\r
+ //----------------/\r
+\r
+ public JalviewModelSequence2Item()\r
+ {\r
+ super();\r
+ _userColourSchemeList = new Vector();\r
+ } //-- jalview.binding.JalviewModelSequence2Item()\r
+\r
+ //-----------/\r
+ //- Methods -/\r
+ //-----------/\r
+\r
+ /**\r
+ * Method addUserColourScheme\r
+ *\r
+ *\r
+ *\r
+ * @param vUserColourScheme\r
+ */\r
+ public void addUserColourScheme(jalview.binding.UserColourScheme\r
+ vUserColourScheme)\r
+ throws java.lang.IndexOutOfBoundsException\r
+ {\r
+ _userColourSchemeList.addElement(vUserColourScheme);\r
+ } //-- void addUserColourScheme(jalview.binding.UserColourScheme)\r
+\r
+ /**\r
+ * Method addUserColourScheme\r
+ *\r
+ *\r
+ *\r
+ * @param index\r
+ * @param vUserColourScheme\r
+ */\r
+ public void addUserColourScheme(int index,\r
+ jalview.binding.UserColourScheme\r
+ vUserColourScheme)\r
+ throws java.lang.IndexOutOfBoundsException\r
+ {\r
+ _userColourSchemeList.insertElementAt(vUserColourScheme, index);\r
+ } //-- void addUserColourScheme(int, jalview.binding.UserColourScheme)\r
+\r
+ /**\r
+ * Method enumerateUserColourScheme\r
+ *\r
+ *\r
+ *\r
+ * @return Enumeration\r
+ */\r
+ public java.util.Enumeration enumerateUserColourScheme()\r
+ {\r
+ return _userColourSchemeList.elements();\r
+ } //-- java.util.Enumeration enumerateUserColourScheme()\r
+\r
+ /**\r
+ * Method getUserColourScheme\r
+ *\r
+ *\r
+ *\r
+ * @param index\r
+ * @return UserColourScheme\r
+ */\r
+ public jalview.binding.UserColourScheme getUserColourScheme(int index)\r
+ throws java.lang.IndexOutOfBoundsException\r
+ {\r
+ //-- check bounds for index\r
+ if ( (index < 0) || (index > _userColourSchemeList.size()))\r
{\r
- _userColourSchemeList.removeAllElements();\r
- } //-- void removeAllUserColourScheme() \r
-\r
- /**\r
- * Method removeUserColourScheme\r
- * \r
- * \r
- * \r
- * @param index\r
- * @return UserColourScheme\r
- */\r
- public jalview.binding.UserColourScheme removeUserColourScheme(int index)\r
+ throw new IndexOutOfBoundsException();\r
+ }\r
+\r
+ return (jalview.binding.UserColourScheme) _userColourSchemeList.elementAt(\r
+ index);\r
+ } //-- jalview.binding.UserColourScheme getUserColourScheme(int)\r
+\r
+ /**\r
+ * Method getUserColourScheme\r
+ *\r
+ *\r
+ *\r
+ * @return UserColourScheme\r
+ */\r
+ public jalview.binding.UserColourScheme[] getUserColourScheme()\r
+ {\r
+ int size = _userColourSchemeList.size();\r
+ jalview.binding.UserColourScheme[] mArray = new jalview.binding.\r
+ UserColourScheme[size];\r
+ for (int index = 0; index < size; index++)\r
{\r
- java.lang.Object obj = _userColourSchemeList.elementAt(index);\r
- _userColourSchemeList.removeElementAt(index);\r
- return (jalview.binding.UserColourScheme) obj;\r
- } //-- jalview.binding.UserColourScheme removeUserColourScheme(int) \r
-\r
- /**\r
- * Method setUserColourScheme\r
- * \r
- * \r
- * \r
- * @param index\r
- * @param vUserColourScheme\r
- */\r
- public void setUserColourScheme(int index, jalview.binding.UserColourScheme vUserColourScheme)\r
- throws java.lang.IndexOutOfBoundsException\r
+ mArray[index] = (jalview.binding.UserColourScheme) _userColourSchemeList.\r
+ elementAt(index);\r
+ }\r
+ return mArray;\r
+ } //-- jalview.binding.UserColourScheme[] getUserColourScheme()\r
+\r
+ /**\r
+ * Method getUserColourSchemeCount\r
+ *\r
+ *\r
+ *\r
+ * @return int\r
+ */\r
+ public int getUserColourSchemeCount()\r
+ {\r
+ return _userColourSchemeList.size();\r
+ } //-- int getUserColourSchemeCount()\r
+\r
+ /**\r
+ * Method removeAllUserColourScheme\r
+ *\r
+ */\r
+ public void removeAllUserColourScheme()\r
+ {\r
+ _userColourSchemeList.removeAllElements();\r
+ } //-- void removeAllUserColourScheme()\r
+\r
+ /**\r
+ * Method removeUserColourScheme\r
+ *\r
+ *\r
+ *\r
+ * @param index\r
+ * @return UserColourScheme\r
+ */\r
+ public jalview.binding.UserColourScheme removeUserColourScheme(int index)\r
+ {\r
+ java.lang.Object obj = _userColourSchemeList.elementAt(index);\r
+ _userColourSchemeList.removeElementAt(index);\r
+ return (jalview.binding.UserColourScheme) obj;\r
+ } //-- jalview.binding.UserColourScheme removeUserColourScheme(int)\r
+\r
+ /**\r
+ * Method setUserColourScheme\r
+ *\r
+ *\r
+ *\r
+ * @param index\r
+ * @param vUserColourScheme\r
+ */\r
+ public void setUserColourScheme(int index,\r
+ jalview.binding.UserColourScheme\r
+ vUserColourScheme)\r
+ throws java.lang.IndexOutOfBoundsException\r
+ {\r
+ //-- check bounds for index\r
+ if ( (index < 0) || (index > _userColourSchemeList.size()))\r
{\r
- //-- check bounds for index\r
- if ((index < 0) || (index > _userColourSchemeList.size())) {\r
- throw new IndexOutOfBoundsException();\r
- }\r
- _userColourSchemeList.setElementAt(vUserColourScheme, index);\r
- } //-- void setUserColourScheme(int, jalview.binding.UserColourScheme) \r
-\r
- /**\r
- * Method setUserColourScheme\r
- * \r
- * \r
- * \r
- * @param userColourSchemeArray\r
- */\r
- public void setUserColourScheme(jalview.binding.UserColourScheme[] userColourSchemeArray)\r
+ throw new IndexOutOfBoundsException();\r
+ }\r
+ _userColourSchemeList.setElementAt(vUserColourScheme, index);\r
+ } //-- void setUserColourScheme(int, jalview.binding.UserColourScheme)\r
+\r
+ /**\r
+ * Method setUserColourScheme\r
+ *\r
+ *\r
+ *\r
+ * @param userColourSchemeArray\r
+ */\r
+ public void setUserColourScheme(jalview.binding.UserColourScheme[]\r
+ userColourSchemeArray)\r
+ {\r
+ //-- copy array\r
+ _userColourSchemeList.removeAllElements();\r
+ for (int i = 0; i < userColourSchemeArray.length; i++)\r
{\r
- //-- copy array\r
- _userColourSchemeList.removeAllElements();\r
- for (int i = 0; i < userColourSchemeArray.length; i++) {\r
- _userColourSchemeList.addElement(userColourSchemeArray[i]);\r
- }\r
- } //-- void setUserColourScheme(jalview.binding.UserColourScheme) \r
+ _userColourSchemeList.addElement(userColourSchemeArray[i]);\r
+ }\r
+ } //-- void setUserColourScheme(jalview.binding.UserColourScheme)\r
\r
}\r
/*\r
- * This class was automatically generated with \r
+ * This class was automatically generated with\r
* <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
* Schema.\r
* $Id$\r
*/\r
-\r
package jalview.binding;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
-//---------------------------------/\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
\r
+import org.xml.sax.ContentHandler;\r
+\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
+//---------------------------------/\r
import java.io.IOException;\r
import java.io.Reader;\r
import java.io.Serializable;\r
import java.io.Writer;\r
+\r
import java.util.Enumeration;\r
import java.util.Vector;\r
-import org.exolab.castor.xml.MarshalException;\r
-import org.exolab.castor.xml.Marshaller;\r
-import org.exolab.castor.xml.Unmarshaller;\r
-import org.exolab.castor.xml.ValidationException;\r
-import org.xml.sax.ContentHandler;\r
+\r
\r
/**\r
* Class JalviewUserColours.\r
- * \r
+ *\r
* @version $Revision$ $Date$\r
*/\r
-public class JalviewUserColours implements java.io.Serializable {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
+public class JalviewUserColours implements java.io.Serializable\r
+{\r
+ //--------------------------/\r
+ //- Class/Member Variables -/\r
//--------------------------/\r
\r
/**\r
*/\r
private java.util.Vector _colourList;\r
\r
-\r
- //----------------/\r
- //- Constructors -/\r
//----------------/\r
-\r
- public JalviewUserColours() {\r
+ //- Constructors -/\r
+ //----------------/\r
+ public JalviewUserColours()\r
+ {\r
super();\r
_colourList = new Vector();\r
- } //-- jalview.binding.JalviewUserColours()\r
+ }\r
\r
-\r
- //-----------/\r
- //- Methods -/\r
+ //-- jalview.binding.JalviewUserColours()\r
//-----------/\r
\r
/**\r
- * Method addColour\r
- * \r
- * \r
- * \r
- * @param vColour\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param vColour DOCUMENT ME!\r
+ *\r
+ * @throws java.lang.IndexOutOfBoundsException DOCUMENT ME!\r
*/\r
public void addColour(jalview.binding.Colour vColour)\r
throws java.lang.IndexOutOfBoundsException\r
{\r
_colourList.addElement(vColour);\r
- } //-- void addColour(jalview.binding.Colour) \r
+ }\r
+\r
+ //-- void addColour(jalview.binding.Colour) \r
\r
/**\r
* Method addColour\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param index\r
* @param vColour\r
*/\r
throws java.lang.IndexOutOfBoundsException\r
{\r
_colourList.insertElementAt(vColour, index);\r
- } //-- void addColour(int, jalview.binding.Colour) \r
+ }\r
+\r
+ //-- void addColour(int, jalview.binding.Colour) \r
\r
/**\r
* Method enumerateColour\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @return Enumeration\r
*/\r
public java.util.Enumeration enumerateColour()\r
{\r
return _colourList.elements();\r
- } //-- java.util.Enumeration enumerateColour() \r
+ }\r
+\r
+ //-- java.util.Enumeration enumerateColour() \r
\r
/**\r
* Method getColour\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param index\r
* @return Colour\r
*/\r
throws java.lang.IndexOutOfBoundsException\r
{\r
//-- check bounds for index\r
- if ((index < 0) || (index > _colourList.size())) {\r
+ if ((index < 0) || (index > _colourList.size()))\r
+ {\r
throw new IndexOutOfBoundsException();\r
}\r
- \r
+\r
return (jalview.binding.Colour) _colourList.elementAt(index);\r
- } //-- jalview.binding.Colour getColour(int) \r
+ }\r
+\r
+ //-- jalview.binding.Colour getColour(int) \r
\r
/**\r
* Method getColour\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @return Colour\r
*/\r
public jalview.binding.Colour[] getColour()\r
{\r
int size = _colourList.size();\r
jalview.binding.Colour[] mArray = new jalview.binding.Colour[size];\r
- for (int index = 0; index < size; index++) {\r
+\r
+ for (int index = 0; index < size; index++)\r
+ {\r
mArray[index] = (jalview.binding.Colour) _colourList.elementAt(index);\r
}\r
+\r
return mArray;\r
- } //-- jalview.binding.Colour[] getColour() \r
+ }\r
+\r
+ //-- jalview.binding.Colour[] getColour() \r
\r
/**\r
* Method getColourCount\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @return int\r
*/\r
public int getColourCount()\r
{\r
return _colourList.size();\r
- } //-- int getColourCount() \r
+ }\r
+\r
+ //-- int getColourCount() \r
\r
/**\r
* Method isValid\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @return boolean\r
*/\r
public boolean isValid()\r
{\r
- try {\r
+ try\r
+ {\r
validate();\r
}\r
- catch (org.exolab.castor.xml.ValidationException vex) {\r
+ catch (org.exolab.castor.xml.ValidationException vex)\r
+ {\r
return false;\r
}\r
+\r
return true;\r
- } //-- boolean isValid() \r
+ }\r
+\r
+ //-- boolean isValid() \r
\r
/**\r
* Method marshal\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param out\r
*/\r
public void marshal(java.io.Writer out)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+ throws org.exolab.castor.xml.MarshalException, \r
+ org.exolab.castor.xml.ValidationException\r
{\r
- \r
Marshaller.marshal(this, out);\r
- } //-- void marshal(java.io.Writer) \r
+ }\r
+\r
+ //-- void marshal(java.io.Writer) \r
\r
/**\r
* Method marshal\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param handler\r
*/\r
public void marshal(org.xml.sax.ContentHandler handler)\r
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException, \r
+ org.exolab.castor.xml.ValidationException\r
{\r
- \r
Marshaller.marshal(this, handler);\r
- } //-- void marshal(org.xml.sax.ContentHandler) \r
+ }\r
+\r
+ //-- void marshal(org.xml.sax.ContentHandler) \r
\r
/**\r
* Method removeAllColour\r
- * \r
+ *\r
*/\r
public void removeAllColour()\r
{\r
_colourList.removeAllElements();\r
- } //-- void removeAllColour() \r
+ }\r
+\r
+ //-- void removeAllColour() \r
\r
/**\r
* Method removeColour\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param index\r
* @return Colour\r
*/\r
{\r
java.lang.Object obj = _colourList.elementAt(index);\r
_colourList.removeElementAt(index);\r
+\r
return (jalview.binding.Colour) obj;\r
- } //-- jalview.binding.Colour removeColour(int) \r
+ }\r
+\r
+ //-- jalview.binding.Colour removeColour(int) \r
\r
/**\r
* Method setColour\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param index\r
* @param vColour\r
*/\r
throws java.lang.IndexOutOfBoundsException\r
{\r
//-- check bounds for index\r
- if ((index < 0) || (index > _colourList.size())) {\r
+ if ((index < 0) || (index > _colourList.size()))\r
+ {\r
throw new IndexOutOfBoundsException();\r
}\r
+\r
_colourList.setElementAt(vColour, index);\r
- } //-- void setColour(int, jalview.binding.Colour) \r
+ }\r
+\r
+ //-- void setColour(int, jalview.binding.Colour) \r
\r
/**\r
* Method setColour\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param colourArray\r
*/\r
public void setColour(jalview.binding.Colour[] colourArray)\r
{\r
//-- copy array\r
_colourList.removeAllElements();\r
- for (int i = 0; i < colourArray.length; i++) {\r
+\r
+ for (int i = 0; i < colourArray.length; i++)\r
+ {\r
_colourList.addElement(colourArray[i]);\r
}\r
- } //-- void setColour(jalview.binding.Colour) \r
+ }\r
+\r
+ //-- void setColour(jalview.binding.Colour) \r
\r
/**\r
* Method unmarshal\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param reader\r
* @return Object\r
*/\r
public static java.lang.Object unmarshal(java.io.Reader reader)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+ throws org.exolab.castor.xml.MarshalException, \r
+ org.exolab.castor.xml.ValidationException\r
{\r
- return (jalview.binding.JalviewUserColours) Unmarshaller.unmarshal(jalview.binding.JalviewUserColours.class, reader);\r
- } //-- java.lang.Object unmarshal(java.io.Reader) \r
+ return (jalview.binding.JalviewUserColours) Unmarshaller.unmarshal(jalview.binding.JalviewUserColours.class,\r
+ reader);\r
+ }\r
+\r
+ //-- java.lang.Object unmarshal(java.io.Reader) \r
\r
/**\r
* Method validate\r
- * \r
+ *\r
*/\r
- public void validate()\r
- throws org.exolab.castor.xml.ValidationException\r
+ public void validate() throws org.exolab.castor.xml.ValidationException\r
{\r
org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
validator.validate(this);\r
- } //-- void validate() \r
+ }\r
\r
+ //-- void validate() \r
}\r
/*\r
- * This class was automatically generated with \r
+ * This class was automatically generated with\r
* <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
* Schema.\r
* $Id$\r
*/\r
-\r
package jalview.binding;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
-//---------------------------------/\r
-\r
-import java.io.Serializable;\r
import org.exolab.castor.xml.Marshaller;\r
import org.exolab.castor.xml.Unmarshaller;\r
\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
+//---------------------------------/\r
+import java.io.Serializable;\r
+\r
+\r
/**\r
* Class JalviewUserColoursItem.\r
- * \r
+ *\r
* @version $Revision$ $Date$\r
*/\r
-public class JalviewUserColoursItem implements java.io.Serializable {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
+public class JalviewUserColoursItem implements java.io.Serializable\r
+{\r
+ //--------------------------/\r
+ //- Class/Member Variables -/\r
//--------------------------/\r
\r
/**\r
*/\r
private jalview.binding.Colour _colour;\r
\r
-\r
- //----------------/\r
- //- Constructors -/\r
//----------------/\r
-\r
- public JalviewUserColoursItem() {\r
+ //- Constructors -/\r
+ //----------------/\r
+ public JalviewUserColoursItem()\r
+ {\r
super();\r
- } //-- jalview.binding.JalviewUserColoursItem()\r
+ }\r
\r
-\r
- //-----------/\r
- //- Methods -/\r
+ //-- jalview.binding.JalviewUserColoursItem()\r
//-----------/\r
\r
/**\r
- * Returns the value of field 'colour'.\r
- * \r
- * @return Colour\r
- * @return the value of field 'colour'.\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
*/\r
public jalview.binding.Colour getColour()\r
{\r
return this._colour;\r
- } //-- jalview.binding.Colour getColour() \r
+ }\r
+\r
+ //-- jalview.binding.Colour getColour() \r
\r
/**\r
* Sets the value of field 'colour'.\r
- * \r
+ *\r
* @param colour the value of field 'colour'.\r
*/\r
public void setColour(jalview.binding.Colour colour)\r
{\r
this._colour = colour;\r
- } //-- void setColour(jalview.binding.Colour) \r
+ }\r
\r
+ //-- void setColour(jalview.binding.Colour) \r
}\r
/*\r
- * This class was automatically generated with \r
+ * This class was automatically generated with\r
* <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
* Schema.\r
* $Id$\r
\r
package jalview.binding;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
-import java.io.IOException;\r
-import java.io.Reader;\r
-import java.io.Serializable;\r
-import java.io.Writer;\r
-import org.exolab.castor.xml.MarshalException;\r
-import org.exolab.castor.xml.Marshaller;\r
-import org.exolab.castor.xml.Unmarshaller;\r
-import org.exolab.castor.xml.ValidationException;\r
-import org.xml.sax.ContentHandler;\r
+import org.exolab.castor.xml.*;\r
\r
/**\r
* Class Residue.\r
- * \r
+ *\r
* @version $Revision$ $Date$\r
*/\r
-public class Residue implements java.io.Serializable {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _name\r
- */\r
- private java.lang.String _name;\r
-\r
- /**\r
- * Field _RGB\r
- */\r
- private int _RGB;\r
-\r
- /**\r
- * keeps track of state for field: _RGB\r
- */\r
- private boolean _has_RGB;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public Residue() {\r
- super();\r
- } //-- jalview.binding.Residue()\r
-\r
-\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
-\r
- /**\r
- * Method deleteRGB\r
- * \r
- */\r
- public void deleteRGB()\r
- {\r
- this._has_RGB= false;\r
- } //-- void deleteRGB() \r
-\r
- /**\r
- * Returns the value of field 'name'.\r
- * \r
- * @return String\r
- * @return the value of field 'name'.\r
- */\r
- public java.lang.String getName()\r
- {\r
- return this._name;\r
- } //-- java.lang.String getName() \r
-\r
- /**\r
- * Returns the value of field 'RGB'.\r
- * \r
- * @return int\r
- * @return the value of field 'RGB'.\r
- */\r
- public int getRGB()\r
- {\r
- return this._RGB;\r
- } //-- int getRGB() \r
-\r
- /**\r
- * Method hasRGB\r
- * \r
- * \r
- * \r
- * @return boolean\r
- */\r
- public boolean hasRGB()\r
- {\r
- return this._has_RGB;\r
- } //-- boolean hasRGB() \r
-\r
- /**\r
- * Method isValid\r
- * \r
- * \r
- * \r
- * @return boolean\r
- */\r
- public boolean isValid()\r
- {\r
- try {\r
- validate();\r
- }\r
- catch (org.exolab.castor.xml.ValidationException vex) {\r
- return false;\r
- }\r
- return true;\r
- } //-- boolean isValid() \r
-\r
- /**\r
- * Method marshal\r
- * \r
- * \r
- * \r
- * @param out\r
- */\r
- public void marshal(java.io.Writer out)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
- {\r
- \r
- Marshaller.marshal(this, out);\r
- } //-- void marshal(java.io.Writer) \r
-\r
- /**\r
- * Method marshal\r
- * \r
- * \r
- * \r
- * @param handler\r
- */\r
- public void marshal(org.xml.sax.ContentHandler handler)\r
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
- {\r
- \r
- Marshaller.marshal(this, handler);\r
- } //-- void marshal(org.xml.sax.ContentHandler) \r
-\r
- /**\r
- * Sets the value of field 'name'.\r
- * \r
- * @param name the value of field 'name'.\r
- */\r
- public void setName(java.lang.String name)\r
- {\r
- this._name = name;\r
- } //-- void setName(java.lang.String) \r
-\r
- /**\r
- * Sets the value of field 'RGB'.\r
- * \r
- * @param RGB the value of field 'RGB'.\r
- */\r
- public void setRGB(int RGB)\r
- {\r
- this._RGB = RGB;\r
- this._has_RGB = true;\r
- } //-- void setRGB(int) \r
-\r
- /**\r
- * Method unmarshal\r
- * \r
- * \r
- * \r
- * @param reader\r
- * @return Object\r
- */\r
- public static java.lang.Object unmarshal(java.io.Reader reader)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+public class Residue\r
+ implements java.io.Serializable\r
+{\r
+\r
+ //--------------------------/\r
+ //- Class/Member Variables -/\r
+ //--------------------------/\r
+\r
+ /**\r
+ * Field _name\r
+ */\r
+ private java.lang.String _name;\r
+\r
+ /**\r
+ * Field _RGB\r
+ */\r
+ private int _RGB;\r
+\r
+ /**\r
+ * keeps track of state for field: _RGB\r
+ */\r
+ private boolean _has_RGB;\r
+\r
+ //----------------/\r
+ //- Constructors -/\r
+ //----------------/\r
+\r
+ public Residue()\r
+ {\r
+ super();\r
+ } //-- jalview.binding.Residue()\r
+\r
+ //-----------/\r
+ //- Methods -/\r
+ //-----------/\r
+\r
+ /**\r
+ * Method deleteRGB\r
+ *\r
+ */\r
+ public void deleteRGB()\r
+ {\r
+ this._has_RGB = false;\r
+ } //-- void deleteRGB()\r
+\r
+ /**\r
+ * Returns the value of field 'name'.\r
+ *\r
+ * @return String\r
+ * @return the value of field 'name'.\r
+ */\r
+ public java.lang.String getName()\r
+ {\r
+ return this._name;\r
+ } //-- java.lang.String getName()\r
+\r
+ /**\r
+ * Returns the value of field 'RGB'.\r
+ *\r
+ * @return int\r
+ * @return the value of field 'RGB'.\r
+ */\r
+ public int getRGB()\r
+ {\r
+ return this._RGB;\r
+ } //-- int getRGB()\r
+\r
+ /**\r
+ * Method hasRGB\r
+ *\r
+ *\r
+ *\r
+ * @return boolean\r
+ */\r
+ public boolean hasRGB()\r
+ {\r
+ return this._has_RGB;\r
+ } //-- boolean hasRGB()\r
+\r
+ /**\r
+ * Method isValid\r
+ *\r
+ *\r
+ *\r
+ * @return boolean\r
+ */\r
+ public boolean isValid()\r
+ {\r
+ try\r
{\r
- return (jalview.binding.Residue) Unmarshaller.unmarshal(jalview.binding.Residue.class, reader);\r
- } //-- java.lang.Object unmarshal(java.io.Reader) \r
-\r
- /**\r
- * Method validate\r
- * \r
- */\r
- public void validate()\r
- throws org.exolab.castor.xml.ValidationException\r
+ validate();\r
+ }\r
+ catch (org.exolab.castor.xml.ValidationException vex)\r
{\r
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
- validator.validate(this);\r
- } //-- void validate() \r
+ return false;\r
+ }\r
+ return true;\r
+ } //-- boolean isValid()\r
+\r
+ /**\r
+ * Method marshal\r
+ *\r
+ *\r
+ *\r
+ * @param out\r
+ */\r
+ public void marshal(java.io.Writer out)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException\r
+ {\r
+\r
+ Marshaller.marshal(this, out);\r
+ } //-- void marshal(java.io.Writer)\r
+\r
+ /**\r
+ * Method marshal\r
+ *\r
+ *\r
+ *\r
+ * @param handler\r
+ */\r
+ public void marshal(org.xml.sax.ContentHandler handler)\r
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException\r
+ {\r
+\r
+ Marshaller.marshal(this, handler);\r
+ } //-- void marshal(org.xml.sax.ContentHandler)\r
+\r
+ /**\r
+ * Sets the value of field 'name'.\r
+ *\r
+ * @param name the value of field 'name'.\r
+ */\r
+ public void setName(java.lang.String name)\r
+ {\r
+ this._name = name;\r
+ } //-- void setName(java.lang.String)\r
+\r
+ /**\r
+ * Sets the value of field 'RGB'.\r
+ *\r
+ * @param RGB the value of field 'RGB'.\r
+ */\r
+ public void setRGB(int RGB)\r
+ {\r
+ this._RGB = RGB;\r
+ this._has_RGB = true;\r
+ } //-- void setRGB(int)\r
+\r
+ /**\r
+ * Method unmarshal\r
+ *\r
+ *\r
+ *\r
+ * @param reader\r
+ * @return Object\r
+ */\r
+ public static java.lang.Object unmarshal(java.io.Reader reader)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException\r
+ {\r
+ return (jalview.binding.Residue) Unmarshaller.unmarshal(jalview.binding.\r
+ Residue.class, reader);\r
+ } //-- java.lang.Object unmarshal(java.io.Reader)\r
+\r
+ /**\r
+ * Method validate\r
+ *\r
+ */\r
+ public void validate()\r
+ throws org.exolab.castor.xml.ValidationException\r
+ {\r
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.\r
+ Validator();\r
+ validator.validate(this);\r
+ } //-- void validate()\r
\r
}\r
/*\r
- * This class was automatically generated with \r
+ * This class was automatically generated with\r
* <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
* Schema.\r
* $Id$\r
\r
package jalview.binding;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
-import java.io.IOException;\r
-import java.io.Reader;\r
-import java.io.Serializable;\r
-import java.io.Writer;\r
-import org.exolab.castor.xml.MarshalException;\r
-import org.exolab.castor.xml.Marshaller;\r
-import org.exolab.castor.xml.Unmarshaller;\r
-import org.exolab.castor.xml.ValidationException;\r
-import org.xml.sax.ContentHandler;\r
+import org.exolab.castor.xml.*;\r
\r
/**\r
* Class Sequence.\r
- * \r
+ *\r
* @version $Revision$ $Date$\r
*/\r
-public class Sequence extends SequenceType \r
-implements java.io.Serializable\r
+public class Sequence\r
+ extends SequenceType implements java.io.Serializable\r
{\r
\r
+ //----------------/\r
+ //- Constructors -/\r
+ //----------------/\r
\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
+ public Sequence()\r
+ {\r
+ super();\r
+ } //-- jalview.binding.Sequence()\r
\r
- public Sequence() {\r
- super();\r
- } //-- jalview.binding.Sequence()\r
+ //-----------/\r
+ //- Methods -/\r
+ //-----------/\r
\r
+ /**\r
+ * Method isValid\r
+ *\r
+ *\r
+ *\r
+ * @return boolean\r
+ */\r
+ public boolean isValid()\r
+ {\r
+ try\r
+ {\r
+ validate();\r
+ }\r
+ catch (org.exolab.castor.xml.ValidationException vex)\r
+ {\r
+ return false;\r
+ }\r
+ return true;\r
+ } //-- boolean isValid()\r
\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
+ /**\r
+ * Method marshal\r
+ *\r
+ *\r
+ *\r
+ * @param out\r
+ */\r
+ public void marshal(java.io.Writer out)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException\r
+ {\r
\r
- /**\r
- * Method isValid\r
- * \r
- * \r
- * \r
- * @return boolean\r
- */\r
- public boolean isValid()\r
- {\r
- try {\r
- validate();\r
- }\r
- catch (org.exolab.castor.xml.ValidationException vex) {\r
- return false;\r
- }\r
- return true;\r
- } //-- boolean isValid() \r
+ Marshaller.marshal(this, out);\r
+ } //-- void marshal(java.io.Writer)\r
\r
- /**\r
- * Method marshal\r
- * \r
- * \r
- * \r
- * @param out\r
- */\r
- public void marshal(java.io.Writer out)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
- {\r
- \r
- Marshaller.marshal(this, out);\r
- } //-- void marshal(java.io.Writer) \r
+ /**\r
+ * Method marshal\r
+ *\r
+ *\r
+ *\r
+ * @param handler\r
+ */\r
+ public void marshal(org.xml.sax.ContentHandler handler)\r
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException\r
+ {\r
\r
- /**\r
- * Method marshal\r
- * \r
- * \r
- * \r
- * @param handler\r
- */\r
- public void marshal(org.xml.sax.ContentHandler handler)\r
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
- {\r
- \r
- Marshaller.marshal(this, handler);\r
- } //-- void marshal(org.xml.sax.ContentHandler) \r
+ Marshaller.marshal(this, handler);\r
+ } //-- void marshal(org.xml.sax.ContentHandler)\r
\r
- /**\r
- * Method unmarshal\r
- * \r
- * \r
- * \r
- * @param reader\r
- * @return Object\r
- */\r
- public static java.lang.Object unmarshal(java.io.Reader reader)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
- {\r
- return (jalview.binding.Sequence) Unmarshaller.unmarshal(jalview.binding.Sequence.class, reader);\r
- } //-- java.lang.Object unmarshal(java.io.Reader) \r
+ /**\r
+ * Method unmarshal\r
+ *\r
+ *\r
+ *\r
+ * @param reader\r
+ * @return Object\r
+ */\r
+ public static java.lang.Object unmarshal(java.io.Reader reader)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException\r
+ {\r
+ return (jalview.binding.Sequence) Unmarshaller.unmarshal(jalview.binding.\r
+ Sequence.class, reader);\r
+ } //-- java.lang.Object unmarshal(java.io.Reader)\r
\r
- /**\r
- * Method validate\r
- * \r
- */\r
- public void validate()\r
- throws org.exolab.castor.xml.ValidationException\r
- {\r
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
- validator.validate(this);\r
- } //-- void validate() \r
+ /**\r
+ * Method validate\r
+ *\r
+ */\r
+ public void validate()\r
+ throws org.exolab.castor.xml.ValidationException\r
+ {\r
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.\r
+ Validator();\r
+ validator.validate(this);\r
+ } //-- void validate()\r
\r
}\r
/*\r
- * This class was automatically generated with \r
+ * This class was automatically generated with\r
* <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
* Schema.\r
* $Id$\r
*/\r
-\r
package jalview.binding;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
-//---------------------------------/\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+\r
+import org.xml.sax.ContentHandler;\r
\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
+//---------------------------------/\r
import java.io.IOException;\r
import java.io.Reader;\r
import java.io.Serializable;\r
import java.io.Writer;\r
+\r
import java.util.Enumeration;\r
import java.util.Vector;\r
-import org.exolab.castor.xml.MarshalException;\r
-import org.exolab.castor.xml.Marshaller;\r
-import org.exolab.castor.xml.Unmarshaller;\r
-import org.exolab.castor.xml.ValidationException;\r
-import org.xml.sax.ContentHandler;\r
+\r
\r
/**\r
* Class SequenceSet.\r
- * \r
+ *\r
* @version $Revision$ $Date$\r
*/\r
-public class SequenceSet implements java.io.Serializable {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
+public class SequenceSet implements java.io.Serializable\r
+{\r
+ //--------------------------/\r
+ //- Class/Member Variables -/\r
//--------------------------/\r
\r
/**\r
*/\r
private java.util.Vector _annotationList;\r
\r
-\r
- //----------------/\r
- //- Constructors -/\r
//----------------/\r
-\r
- public SequenceSet() {\r
+ //- Constructors -/\r
+ //----------------/\r
+ public SequenceSet()\r
+ {\r
super();\r
_sequenceList = new Vector();\r
_annotationList = new Vector();\r
- } //-- jalview.binding.SequenceSet()\r
-\r
+ }\r
\r
- //-----------/\r
- //- Methods -/\r
+ //-- jalview.binding.SequenceSet()\r
//-----------/\r
\r
/**\r
- * Method addAnnotation\r
- * \r
- * \r
- * \r
- * @param vAnnotation\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param vAnnotation DOCUMENT ME!\r
+ *\r
+ * @throws java.lang.IndexOutOfBoundsException DOCUMENT ME!\r
*/\r
public void addAnnotation(jalview.binding.Annotation vAnnotation)\r
throws java.lang.IndexOutOfBoundsException\r
{\r
_annotationList.addElement(vAnnotation);\r
- } //-- void addAnnotation(jalview.binding.Annotation) \r
+ }\r
+\r
+ //-- void addAnnotation(jalview.binding.Annotation) \r
\r
/**\r
* Method addAnnotation\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param index\r
* @param vAnnotation\r
*/\r
throws java.lang.IndexOutOfBoundsException\r
{\r
_annotationList.insertElementAt(vAnnotation, index);\r
- } //-- void addAnnotation(int, jalview.binding.Annotation) \r
+ }\r
+\r
+ //-- void addAnnotation(int, jalview.binding.Annotation) \r
\r
/**\r
* Method addSequence\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param vSequence\r
*/\r
public void addSequence(jalview.binding.Sequence vSequence)\r
throws java.lang.IndexOutOfBoundsException\r
{\r
_sequenceList.addElement(vSequence);\r
- } //-- void addSequence(jalview.binding.Sequence) \r
+ }\r
+\r
+ //-- void addSequence(jalview.binding.Sequence) \r
\r
/**\r
* Method addSequence\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param index\r
* @param vSequence\r
*/\r
throws java.lang.IndexOutOfBoundsException\r
{\r
_sequenceList.insertElementAt(vSequence, index);\r
- } //-- void addSequence(int, jalview.binding.Sequence) \r
+ }\r
+\r
+ //-- void addSequence(int, jalview.binding.Sequence) \r
\r
/**\r
* Method deleteAligned\r
- * \r
+ *\r
*/\r
public void deleteAligned()\r
{\r
- this._has_aligned= false;\r
- } //-- void deleteAligned() \r
+ this._has_aligned = false;\r
+ }\r
+\r
+ //-- void deleteAligned() \r
\r
/**\r
* Method enumerateAnnotation\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @return Enumeration\r
*/\r
public java.util.Enumeration enumerateAnnotation()\r
{\r
return _annotationList.elements();\r
- } //-- java.util.Enumeration enumerateAnnotation() \r
+ }\r
+\r
+ //-- java.util.Enumeration enumerateAnnotation() \r
\r
/**\r
* Method enumerateSequence\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @return Enumeration\r
*/\r
public java.util.Enumeration enumerateSequence()\r
{\r
return _sequenceList.elements();\r
- } //-- java.util.Enumeration enumerateSequence() \r
+ }\r
+\r
+ //-- java.util.Enumeration enumerateSequence() \r
\r
/**\r
* Returns the value of field 'aligned'.\r
- * \r
+ *\r
* @return boolean\r
* @return the value of field 'aligned'.\r
*/\r
public boolean getAligned()\r
{\r
return this._aligned;\r
- } //-- boolean getAligned() \r
+ }\r
+\r
+ //-- boolean getAligned() \r
\r
/**\r
* Method getAnnotation\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param index\r
* @return Annotation\r
*/\r
throws java.lang.IndexOutOfBoundsException\r
{\r
//-- check bounds for index\r
- if ((index < 0) || (index > _annotationList.size())) {\r
+ if ((index < 0) || (index > _annotationList.size()))\r
+ {\r
throw new IndexOutOfBoundsException();\r
}\r
- \r
+\r
return (jalview.binding.Annotation) _annotationList.elementAt(index);\r
- } //-- jalview.binding.Annotation getAnnotation(int) \r
+ }\r
+\r
+ //-- jalview.binding.Annotation getAnnotation(int) \r
\r
/**\r
* Method getAnnotation\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @return Annotation\r
*/\r
public jalview.binding.Annotation[] getAnnotation()\r
{\r
int size = _annotationList.size();\r
jalview.binding.Annotation[] mArray = new jalview.binding.Annotation[size];\r
- for (int index = 0; index < size; index++) {\r
+\r
+ for (int index = 0; index < size; index++)\r
+ {\r
mArray[index] = (jalview.binding.Annotation) _annotationList.elementAt(index);\r
}\r
+\r
return mArray;\r
- } //-- jalview.binding.Annotation[] getAnnotation() \r
+ }\r
+\r
+ //-- jalview.binding.Annotation[] getAnnotation() \r
\r
/**\r
* Method getAnnotationCount\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @return int\r
*/\r
public int getAnnotationCount()\r
{\r
return _annotationList.size();\r
- } //-- int getAnnotationCount() \r
+ }\r
+\r
+ //-- int getAnnotationCount() \r
\r
/**\r
* Returns the value of field 'gapChar'.\r
- * \r
+ *\r
* @return String\r
* @return the value of field 'gapChar'.\r
*/\r
public java.lang.String getGapChar()\r
{\r
return this._gapChar;\r
- } //-- java.lang.String getGapChar() \r
+ }\r
+\r
+ //-- java.lang.String getGapChar() \r
\r
/**\r
* Method getSequence\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param index\r
* @return Sequence\r
*/\r
throws java.lang.IndexOutOfBoundsException\r
{\r
//-- check bounds for index\r
- if ((index < 0) || (index > _sequenceList.size())) {\r
+ if ((index < 0) || (index > _sequenceList.size()))\r
+ {\r
throw new IndexOutOfBoundsException();\r
}\r
- \r
+\r
return (jalview.binding.Sequence) _sequenceList.elementAt(index);\r
- } //-- jalview.binding.Sequence getSequence(int) \r
+ }\r
+\r
+ //-- jalview.binding.Sequence getSequence(int) \r
\r
/**\r
* Method getSequence\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @return Sequence\r
*/\r
public jalview.binding.Sequence[] getSequence()\r
{\r
int size = _sequenceList.size();\r
jalview.binding.Sequence[] mArray = new jalview.binding.Sequence[size];\r
- for (int index = 0; index < size; index++) {\r
+\r
+ for (int index = 0; index < size; index++)\r
+ {\r
mArray[index] = (jalview.binding.Sequence) _sequenceList.elementAt(index);\r
}\r
+\r
return mArray;\r
- } //-- jalview.binding.Sequence[] getSequence() \r
+ }\r
+\r
+ //-- jalview.binding.Sequence[] getSequence() \r
\r
/**\r
* Method getSequenceCount\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @return int\r
*/\r
public int getSequenceCount()\r
{\r
return _sequenceList.size();\r
- } //-- int getSequenceCount() \r
+ }\r
+\r
+ //-- int getSequenceCount() \r
\r
/**\r
* Method hasAligned\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @return boolean\r
*/\r
public boolean hasAligned()\r
{\r
return this._has_aligned;\r
- } //-- boolean hasAligned() \r
+ }\r
+\r
+ //-- boolean hasAligned() \r
\r
/**\r
* Method isValid\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @return boolean\r
*/\r
public boolean isValid()\r
{\r
- try {\r
+ try\r
+ {\r
validate();\r
}\r
- catch (org.exolab.castor.xml.ValidationException vex) {\r
+ catch (org.exolab.castor.xml.ValidationException vex)\r
+ {\r
return false;\r
}\r
+\r
return true;\r
- } //-- boolean isValid() \r
+ }\r
+\r
+ //-- boolean isValid() \r
\r
/**\r
* Method marshal\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param out\r
*/\r
public void marshal(java.io.Writer out)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+ throws org.exolab.castor.xml.MarshalException, \r
+ org.exolab.castor.xml.ValidationException\r
{\r
- \r
Marshaller.marshal(this, out);\r
- } //-- void marshal(java.io.Writer) \r
+ }\r
+\r
+ //-- void marshal(java.io.Writer) \r
\r
/**\r
* Method marshal\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param handler\r
*/\r
public void marshal(org.xml.sax.ContentHandler handler)\r
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException, \r
+ org.exolab.castor.xml.ValidationException\r
{\r
- \r
Marshaller.marshal(this, handler);\r
- } //-- void marshal(org.xml.sax.ContentHandler) \r
+ }\r
+\r
+ //-- void marshal(org.xml.sax.ContentHandler) \r
\r
/**\r
* Method removeAllAnnotation\r
- * \r
+ *\r
*/\r
public void removeAllAnnotation()\r
{\r
_annotationList.removeAllElements();\r
- } //-- void removeAllAnnotation() \r
+ }\r
+\r
+ //-- void removeAllAnnotation() \r
\r
/**\r
* Method removeAllSequence\r
- * \r
+ *\r
*/\r
public void removeAllSequence()\r
{\r
_sequenceList.removeAllElements();\r
- } //-- void removeAllSequence() \r
+ }\r
+\r
+ //-- void removeAllSequence() \r
\r
/**\r
* Method removeAnnotation\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param index\r
* @return Annotation\r
*/\r
{\r
java.lang.Object obj = _annotationList.elementAt(index);\r
_annotationList.removeElementAt(index);\r
+\r
return (jalview.binding.Annotation) obj;\r
- } //-- jalview.binding.Annotation removeAnnotation(int) \r
+ }\r
+\r
+ //-- jalview.binding.Annotation removeAnnotation(int) \r
\r
/**\r
* Method removeSequence\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param index\r
* @return Sequence\r
*/\r
{\r
java.lang.Object obj = _sequenceList.elementAt(index);\r
_sequenceList.removeElementAt(index);\r
+\r
return (jalview.binding.Sequence) obj;\r
- } //-- jalview.binding.Sequence removeSequence(int) \r
+ }\r
+\r
+ //-- jalview.binding.Sequence removeSequence(int) \r
\r
/**\r
* Sets the value of field 'aligned'.\r
- * \r
+ *\r
* @param aligned the value of field 'aligned'.\r
*/\r
public void setAligned(boolean aligned)\r
{\r
this._aligned = aligned;\r
this._has_aligned = true;\r
- } //-- void setAligned(boolean) \r
+ }\r
+\r
+ //-- void setAligned(boolean) \r
\r
/**\r
* Method setAnnotation\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param index\r
* @param vAnnotation\r
*/\r
throws java.lang.IndexOutOfBoundsException\r
{\r
//-- check bounds for index\r
- if ((index < 0) || (index > _annotationList.size())) {\r
+ if ((index < 0) || (index > _annotationList.size()))\r
+ {\r
throw new IndexOutOfBoundsException();\r
}\r
+\r
_annotationList.setElementAt(vAnnotation, index);\r
- } //-- void setAnnotation(int, jalview.binding.Annotation) \r
+ }\r
+\r
+ //-- void setAnnotation(int, jalview.binding.Annotation) \r
\r
/**\r
* Method setAnnotation\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param annotationArray\r
*/\r
public void setAnnotation(jalview.binding.Annotation[] annotationArray)\r
{\r
//-- copy array\r
_annotationList.removeAllElements();\r
- for (int i = 0; i < annotationArray.length; i++) {\r
+\r
+ for (int i = 0; i < annotationArray.length; i++)\r
+ {\r
_annotationList.addElement(annotationArray[i]);\r
}\r
- } //-- void setAnnotation(jalview.binding.Annotation) \r
+ }\r
+\r
+ //-- void setAnnotation(jalview.binding.Annotation) \r
\r
/**\r
* Sets the value of field 'gapChar'.\r
- * \r
+ *\r
* @param gapChar the value of field 'gapChar'.\r
*/\r
public void setGapChar(java.lang.String gapChar)\r
{\r
this._gapChar = gapChar;\r
- } //-- void setGapChar(java.lang.String) \r
+ }\r
+\r
+ //-- void setGapChar(java.lang.String) \r
\r
/**\r
* Method setSequence\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param index\r
* @param vSequence\r
*/\r
throws java.lang.IndexOutOfBoundsException\r
{\r
//-- check bounds for index\r
- if ((index < 0) || (index > _sequenceList.size())) {\r
+ if ((index < 0) || (index > _sequenceList.size()))\r
+ {\r
throw new IndexOutOfBoundsException();\r
}\r
+\r
_sequenceList.setElementAt(vSequence, index);\r
- } //-- void setSequence(int, jalview.binding.Sequence) \r
+ }\r
+\r
+ //-- void setSequence(int, jalview.binding.Sequence) \r
\r
/**\r
* Method setSequence\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param sequenceArray\r
*/\r
public void setSequence(jalview.binding.Sequence[] sequenceArray)\r
{\r
//-- copy array\r
_sequenceList.removeAllElements();\r
- for (int i = 0; i < sequenceArray.length; i++) {\r
+\r
+ for (int i = 0; i < sequenceArray.length; i++)\r
+ {\r
_sequenceList.addElement(sequenceArray[i]);\r
}\r
- } //-- void setSequence(jalview.binding.Sequence) \r
+ }\r
+\r
+ //-- void setSequence(jalview.binding.Sequence) \r
\r
/**\r
* Method unmarshal\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param reader\r
* @return Object\r
*/\r
public static java.lang.Object unmarshal(java.io.Reader reader)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+ throws org.exolab.castor.xml.MarshalException, \r
+ org.exolab.castor.xml.ValidationException\r
{\r
- return (jalview.binding.SequenceSet) Unmarshaller.unmarshal(jalview.binding.SequenceSet.class, reader);\r
- } //-- java.lang.Object unmarshal(java.io.Reader) \r
+ return (jalview.binding.SequenceSet) Unmarshaller.unmarshal(jalview.binding.SequenceSet.class,\r
+ reader);\r
+ }\r
+\r
+ //-- java.lang.Object unmarshal(java.io.Reader) \r
\r
/**\r
* Method validate\r
- * \r
+ *\r
*/\r
- public void validate()\r
- throws org.exolab.castor.xml.ValidationException\r
+ public void validate() throws org.exolab.castor.xml.ValidationException\r
{\r
org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
validator.validate(this);\r
- } //-- void validate() \r
+ }\r
\r
+ //-- void validate() \r
}\r
/*\r
- * This class was automatically generated with \r
+ * This class was automatically generated with\r
* <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
* Schema.\r
* $Id$\r
\r
package jalview.binding;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
-import java.io.IOException;\r
-import java.io.Reader;\r
-import java.io.Serializable;\r
-import java.io.Writer;\r
-import org.exolab.castor.xml.MarshalException;\r
-import org.exolab.castor.xml.Marshaller;\r
-import org.exolab.castor.xml.Unmarshaller;\r
-import org.exolab.castor.xml.ValidationException;\r
-import org.xml.sax.ContentHandler;\r
+import org.exolab.castor.xml.*;\r
\r
/**\r
* Class SequenceType.\r
- * \r
+ *\r
* @version $Revision$ $Date$\r
*/\r
-public class SequenceType implements java.io.Serializable {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _id\r
- */\r
- private java.lang.String _id;\r
-\r
- /**\r
- * Field _sequence\r
- */\r
- private java.lang.String _sequence;\r
-\r
- /**\r
- * Field _name\r
- */\r
- private java.lang.String _name;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public SequenceType() {\r
- super();\r
- } //-- jalview.binding.SequenceType()\r
-\r
-\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
-\r
- /**\r
- * Returns the value of field 'id'.\r
- * \r
- * @return String\r
- * @return the value of field 'id'.\r
- */\r
- public java.lang.String getId()\r
- {\r
- return this._id;\r
- } //-- java.lang.String getId() \r
-\r
- /**\r
- * Returns the value of field 'name'.\r
- * \r
- * @return String\r
- * @return the value of field 'name'.\r
- */\r
- public java.lang.String getName()\r
- {\r
- return this._name;\r
- } //-- java.lang.String getName() \r
-\r
- /**\r
- * Returns the value of field 'sequence'.\r
- * \r
- * @return String\r
- * @return the value of field 'sequence'.\r
- */\r
- public java.lang.String getSequence()\r
- {\r
- return this._sequence;\r
- } //-- java.lang.String getSequence() \r
-\r
- /**\r
- * Method isValid\r
- * \r
- * \r
- * \r
- * @return boolean\r
- */\r
- public boolean isValid()\r
- {\r
- try {\r
- validate();\r
- }\r
- catch (org.exolab.castor.xml.ValidationException vex) {\r
- return false;\r
- }\r
- return true;\r
- } //-- boolean isValid() \r
-\r
- /**\r
- * Method marshal\r
- * \r
- * \r
- * \r
- * @param out\r
- */\r
- public void marshal(java.io.Writer out)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
- {\r
- \r
- Marshaller.marshal(this, out);\r
- } //-- void marshal(java.io.Writer) \r
-\r
- /**\r
- * Method marshal\r
- * \r
- * \r
- * \r
- * @param handler\r
- */\r
- public void marshal(org.xml.sax.ContentHandler handler)\r
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
- {\r
- \r
- Marshaller.marshal(this, handler);\r
- } //-- void marshal(org.xml.sax.ContentHandler) \r
-\r
- /**\r
- * Sets the value of field 'id'.\r
- * \r
- * @param id the value of field 'id'.\r
- */\r
- public void setId(java.lang.String id)\r
- {\r
- this._id = id;\r
- } //-- void setId(java.lang.String) \r
-\r
- /**\r
- * Sets the value of field 'name'.\r
- * \r
- * @param name the value of field 'name'.\r
- */\r
- public void setName(java.lang.String name)\r
- {\r
- this._name = name;\r
- } //-- void setName(java.lang.String) \r
-\r
- /**\r
- * Sets the value of field 'sequence'.\r
- * \r
- * @param sequence the value of field 'sequence'.\r
- */\r
- public void setSequence(java.lang.String sequence)\r
- {\r
- this._sequence = sequence;\r
- } //-- void setSequence(java.lang.String) \r
-\r
- /**\r
- * Method unmarshal\r
- * \r
- * \r
- * \r
- * @param reader\r
- * @return Object\r
- */\r
- public static java.lang.Object unmarshal(java.io.Reader reader)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+public class SequenceType\r
+ implements java.io.Serializable\r
+{\r
+\r
+ //--------------------------/\r
+ //- Class/Member Variables -/\r
+ //--------------------------/\r
+\r
+ /**\r
+ * Field _id\r
+ */\r
+ private java.lang.String _id;\r
+\r
+ /**\r
+ * Field _sequence\r
+ */\r
+ private java.lang.String _sequence;\r
+\r
+ /**\r
+ * Field _name\r
+ */\r
+ private java.lang.String _name;\r
+\r
+ //----------------/\r
+ //- Constructors -/\r
+ //----------------/\r
+\r
+ public SequenceType()\r
+ {\r
+ super();\r
+ } //-- jalview.binding.SequenceType()\r
+\r
+ //-----------/\r
+ //- Methods -/\r
+ //-----------/\r
+\r
+ /**\r
+ * Returns the value of field 'id'.\r
+ *\r
+ * @return String\r
+ * @return the value of field 'id'.\r
+ */\r
+ public java.lang.String getId()\r
+ {\r
+ return this._id;\r
+ } //-- java.lang.String getId()\r
+\r
+ /**\r
+ * Returns the value of field 'name'.\r
+ *\r
+ * @return String\r
+ * @return the value of field 'name'.\r
+ */\r
+ public java.lang.String getName()\r
+ {\r
+ return this._name;\r
+ } //-- java.lang.String getName()\r
+\r
+ /**\r
+ * Returns the value of field 'sequence'.\r
+ *\r
+ * @return String\r
+ * @return the value of field 'sequence'.\r
+ */\r
+ public java.lang.String getSequence()\r
+ {\r
+ return this._sequence;\r
+ } //-- java.lang.String getSequence()\r
+\r
+ /**\r
+ * Method isValid\r
+ *\r
+ *\r
+ *\r
+ * @return boolean\r
+ */\r
+ public boolean isValid()\r
+ {\r
+ try\r
{\r
- return (jalview.binding.SequenceType) Unmarshaller.unmarshal(jalview.binding.SequenceType.class, reader);\r
- } //-- java.lang.Object unmarshal(java.io.Reader) \r
-\r
- /**\r
- * Method validate\r
- * \r
- */\r
- public void validate()\r
- throws org.exolab.castor.xml.ValidationException\r
+ validate();\r
+ }\r
+ catch (org.exolab.castor.xml.ValidationException vex)\r
{\r
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
- validator.validate(this);\r
- } //-- void validate() \r
+ return false;\r
+ }\r
+ return true;\r
+ } //-- boolean isValid()\r
+\r
+ /**\r
+ * Method marshal\r
+ *\r
+ *\r
+ *\r
+ * @param out\r
+ */\r
+ public void marshal(java.io.Writer out)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException\r
+ {\r
+\r
+ Marshaller.marshal(this, out);\r
+ } //-- void marshal(java.io.Writer)\r
+\r
+ /**\r
+ * Method marshal\r
+ *\r
+ *\r
+ *\r
+ * @param handler\r
+ */\r
+ public void marshal(org.xml.sax.ContentHandler handler)\r
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException\r
+ {\r
+\r
+ Marshaller.marshal(this, handler);\r
+ } //-- void marshal(org.xml.sax.ContentHandler)\r
+\r
+ /**\r
+ * Sets the value of field 'id'.\r
+ *\r
+ * @param id the value of field 'id'.\r
+ */\r
+ public void setId(java.lang.String id)\r
+ {\r
+ this._id = id;\r
+ } //-- void setId(java.lang.String)\r
+\r
+ /**\r
+ * Sets the value of field 'name'.\r
+ *\r
+ * @param name the value of field 'name'.\r
+ */\r
+ public void setName(java.lang.String name)\r
+ {\r
+ this._name = name;\r
+ } //-- void setName(java.lang.String)\r
+\r
+ /**\r
+ * Sets the value of field 'sequence'.\r
+ *\r
+ * @param sequence the value of field 'sequence'.\r
+ */\r
+ public void setSequence(java.lang.String sequence)\r
+ {\r
+ this._sequence = sequence;\r
+ } //-- void setSequence(java.lang.String)\r
+\r
+ /**\r
+ * Method unmarshal\r
+ *\r
+ *\r
+ *\r
+ * @param reader\r
+ * @return Object\r
+ */\r
+ public static java.lang.Object unmarshal(java.io.Reader reader)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException\r
+ {\r
+ return (jalview.binding.SequenceType) Unmarshaller.unmarshal(jalview.\r
+ binding.SequenceType.class, reader);\r
+ } //-- java.lang.Object unmarshal(java.io.Reader)\r
+\r
+ /**\r
+ * Method validate\r
+ *\r
+ */\r
+ public void validate()\r
+ throws org.exolab.castor.xml.ValidationException\r
+ {\r
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.\r
+ Validator();\r
+ validator.validate(this);\r
+ } //-- void validate()\r
\r
}\r
/*\r
- * This class was automatically generated with \r
+ * This class was automatically generated with\r
* <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
* Schema.\r
* $Id$\r
*/\r
-\r
package jalview.binding;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
-//---------------------------------/\r
-\r
-import java.io.IOException;\r
-import java.io.Reader;\r
-import java.io.Serializable;\r
-import java.io.Writer;\r
import org.exolab.castor.xml.MarshalException;\r
import org.exolab.castor.xml.Marshaller;\r
import org.exolab.castor.xml.Unmarshaller;\r
import org.exolab.castor.xml.ValidationException;\r
+\r
import org.xml.sax.ContentHandler;\r
\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
+//---------------------------------/\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+\r
+\r
/**\r
* Class Tree.\r
- * \r
+ *\r
* @version $Revision$ $Date$\r
*/\r
-public class Tree implements java.io.Serializable {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
+public class Tree implements java.io.Serializable\r
+{\r
+ //--------------------------/\r
+ //- Class/Member Variables -/\r
//--------------------------/\r
\r
/**\r
*/\r
private java.lang.String _newick;\r
\r
-\r
- //----------------/\r
- //- Constructors -/\r
//----------------/\r
-\r
- public Tree() {\r
+ //- Constructors -/\r
+ //----------------/\r
+ public Tree()\r
+ {\r
super();\r
- } //-- jalview.binding.Tree()\r
+ }\r
\r
-\r
- //-----------/\r
- //- Methods -/\r
+ //-- jalview.binding.Tree()\r
//-----------/\r
\r
/**\r
- * Method deleteCurrentTree\r
- * \r
+ * DOCUMENT ME!\r
*/\r
public void deleteCurrentTree()\r
{\r
- this._has_currentTree= false;\r
- } //-- void deleteCurrentTree() \r
+ this._has_currentTree = false;\r
+ }\r
+\r
+ //-- void deleteCurrentTree() \r
\r
/**\r
* Method deleteFitToWindow\r
- * \r
+ *\r
*/\r
public void deleteFitToWindow()\r
{\r
- this._has_fitToWindow= false;\r
- } //-- void deleteFitToWindow() \r
+ this._has_fitToWindow = false;\r
+ }\r
+\r
+ //-- void deleteFitToWindow() \r
\r
/**\r
* Method deleteFontSize\r
- * \r
+ *\r
*/\r
public void deleteFontSize()\r
{\r
- this._has_fontSize= false;\r
- } //-- void deleteFontSize() \r
+ this._has_fontSize = false;\r
+ }\r
+\r
+ //-- void deleteFontSize() \r
\r
/**\r
* Method deleteHeight\r
- * \r
+ *\r
*/\r
public void deleteHeight()\r
{\r
- this._has_height= false;\r
- } //-- void deleteHeight() \r
+ this._has_height = false;\r
+ }\r
+\r
+ //-- void deleteHeight() \r
\r
/**\r
* Method deleteMarkUnlinked\r
- * \r
+ *\r
*/\r
public void deleteMarkUnlinked()\r
{\r
- this._has_markUnlinked= false;\r
- } //-- void deleteMarkUnlinked() \r
+ this._has_markUnlinked = false;\r
+ }\r
+\r
+ //-- void deleteMarkUnlinked() \r
\r
/**\r
* Method deleteShowBootstrap\r
- * \r
+ *\r
*/\r
public void deleteShowBootstrap()\r
{\r
- this._has_showBootstrap= false;\r
- } //-- void deleteShowBootstrap() \r
+ this._has_showBootstrap = false;\r
+ }\r
+\r
+ //-- void deleteShowBootstrap() \r
\r
/**\r
* Method deleteShowDistances\r
- * \r
+ *\r
*/\r
public void deleteShowDistances()\r
{\r
- this._has_showDistances= false;\r
- } //-- void deleteShowDistances() \r
+ this._has_showDistances = false;\r
+ }\r
+\r
+ //-- void deleteShowDistances() \r
\r
/**\r
* Method deleteThreshold\r
- * \r
+ *\r
*/\r
public void deleteThreshold()\r
{\r
- this._has_threshold= false;\r
- } //-- void deleteThreshold() \r
+ this._has_threshold = false;\r
+ }\r
+\r
+ //-- void deleteThreshold() \r
\r
/**\r
* Method deleteWidth\r
- * \r
+ *\r
*/\r
public void deleteWidth()\r
{\r
- this._has_width= false;\r
- } //-- void deleteWidth() \r
+ this._has_width = false;\r
+ }\r
+\r
+ //-- void deleteWidth() \r
\r
/**\r
* Method deleteXpos\r
- * \r
+ *\r
*/\r
public void deleteXpos()\r
{\r
- this._has_xpos= false;\r
- } //-- void deleteXpos() \r
+ this._has_xpos = false;\r
+ }\r
+\r
+ //-- void deleteXpos() \r
\r
/**\r
* Method deleteYpos\r
- * \r
+ *\r
*/\r
public void deleteYpos()\r
{\r
- this._has_ypos= false;\r
- } //-- void deleteYpos() \r
+ this._has_ypos = false;\r
+ }\r
+\r
+ //-- void deleteYpos() \r
\r
/**\r
* Returns the value of field 'currentTree'.\r
- * \r
+ *\r
* @return boolean\r
* @return the value of field 'currentTree'.\r
*/\r
public boolean getCurrentTree()\r
{\r
return this._currentTree;\r
- } //-- boolean getCurrentTree() \r
+ }\r
+\r
+ //-- boolean getCurrentTree() \r
\r
/**\r
* Returns the value of field 'fitToWindow'.\r
- * \r
+ *\r
* @return boolean\r
* @return the value of field 'fitToWindow'.\r
*/\r
public boolean getFitToWindow()\r
{\r
return this._fitToWindow;\r
- } //-- boolean getFitToWindow() \r
+ }\r
+\r
+ //-- boolean getFitToWindow() \r
\r
/**\r
* Returns the value of field 'fontSize'.\r
- * \r
+ *\r
* @return int\r
* @return the value of field 'fontSize'.\r
*/\r
public int getFontSize()\r
{\r
return this._fontSize;\r
- } //-- int getFontSize() \r
+ }\r
+\r
+ //-- int getFontSize() \r
\r
/**\r
* Returns the value of field 'height'.\r
- * \r
+ *\r
* @return int\r
* @return the value of field 'height'.\r
*/\r
public int getHeight()\r
{\r
return this._height;\r
- } //-- int getHeight() \r
+ }\r
+\r
+ //-- int getHeight() \r
\r
/**\r
* Returns the value of field 'markUnlinked'.\r
- * \r
+ *\r
* @return boolean\r
* @return the value of field 'markUnlinked'.\r
*/\r
public boolean getMarkUnlinked()\r
{\r
return this._markUnlinked;\r
- } //-- boolean getMarkUnlinked() \r
+ }\r
+\r
+ //-- boolean getMarkUnlinked() \r
\r
/**\r
* Returns the value of field 'newick'.\r
- * \r
+ *\r
* @return String\r
* @return the value of field 'newick'.\r
*/\r
public java.lang.String getNewick()\r
{\r
return this._newick;\r
- } //-- java.lang.String getNewick() \r
+ }\r
+\r
+ //-- java.lang.String getNewick() \r
\r
/**\r
* Returns the value of field 'showBootstrap'.\r
- * \r
+ *\r
* @return boolean\r
* @return the value of field 'showBootstrap'.\r
*/\r
public boolean getShowBootstrap()\r
{\r
return this._showBootstrap;\r
- } //-- boolean getShowBootstrap() \r
+ }\r
+\r
+ //-- boolean getShowBootstrap() \r
\r
/**\r
* Returns the value of field 'showDistances'.\r
- * \r
+ *\r
* @return boolean\r
* @return the value of field 'showDistances'.\r
*/\r
public boolean getShowDistances()\r
{\r
return this._showDistances;\r
- } //-- boolean getShowDistances() \r
+ }\r
+\r
+ //-- boolean getShowDistances() \r
\r
/**\r
* Returns the value of field 'threshold'.\r
- * \r
+ *\r
* @return float\r
* @return the value of field 'threshold'.\r
*/\r
public float getThreshold()\r
{\r
return this._threshold;\r
- } //-- float getThreshold() \r
+ }\r
+\r
+ //-- float getThreshold() \r
\r
/**\r
* Returns the value of field 'title'.\r
- * \r
+ *\r
* @return String\r
* @return the value of field 'title'.\r
*/\r
public java.lang.String getTitle()\r
{\r
return this._title;\r
- } //-- java.lang.String getTitle() \r
+ }\r
+\r
+ //-- java.lang.String getTitle() \r
\r
/**\r
* Returns the value of field 'width'.\r
- * \r
+ *\r
* @return int\r
* @return the value of field 'width'.\r
*/\r
public int getWidth()\r
{\r
return this._width;\r
- } //-- int getWidth() \r
+ }\r
+\r
+ //-- int getWidth() \r
\r
/**\r
* Returns the value of field 'xpos'.\r
- * \r
+ *\r
* @return int\r
* @return the value of field 'xpos'.\r
*/\r
public int getXpos()\r
{\r
return this._xpos;\r
- } //-- int getXpos() \r
+ }\r
+\r
+ //-- int getXpos() \r
\r
/**\r
* Returns the value of field 'ypos'.\r
- * \r
+ *\r
* @return int\r
* @return the value of field 'ypos'.\r
*/\r
public int getYpos()\r
{\r
return this._ypos;\r
- } //-- int getYpos() \r
+ }\r
+\r
+ //-- int getYpos() \r
\r
/**\r
* Method hasCurrentTree\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @return boolean\r
*/\r
public boolean hasCurrentTree()\r
{\r
return this._has_currentTree;\r
- } //-- boolean hasCurrentTree() \r
+ }\r
+\r
+ //-- boolean hasCurrentTree() \r
\r
/**\r
* Method hasFitToWindow\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @return boolean\r
*/\r
public boolean hasFitToWindow()\r
{\r
return this._has_fitToWindow;\r
- } //-- boolean hasFitToWindow() \r
+ }\r
+\r
+ //-- boolean hasFitToWindow() \r
\r
/**\r
* Method hasFontSize\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @return boolean\r
*/\r
public boolean hasFontSize()\r
{\r
return this._has_fontSize;\r
- } //-- boolean hasFontSize() \r
+ }\r
+\r
+ //-- boolean hasFontSize() \r
\r
/**\r
* Method hasHeight\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @return boolean\r
*/\r
public boolean hasHeight()\r
{\r
return this._has_height;\r
- } //-- boolean hasHeight() \r
+ }\r
+\r
+ //-- boolean hasHeight() \r
\r
/**\r
* Method hasMarkUnlinked\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @return boolean\r
*/\r
public boolean hasMarkUnlinked()\r
{\r
return this._has_markUnlinked;\r
- } //-- boolean hasMarkUnlinked() \r
+ }\r
+\r
+ //-- boolean hasMarkUnlinked() \r
\r
/**\r
* Method hasShowBootstrap\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @return boolean\r
*/\r
public boolean hasShowBootstrap()\r
{\r
return this._has_showBootstrap;\r
- } //-- boolean hasShowBootstrap() \r
+ }\r
+\r
+ //-- boolean hasShowBootstrap() \r
\r
/**\r
* Method hasShowDistances\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @return boolean\r
*/\r
public boolean hasShowDistances()\r
{\r
return this._has_showDistances;\r
- } //-- boolean hasShowDistances() \r
+ }\r
+\r
+ //-- boolean hasShowDistances() \r
\r
/**\r
* Method hasThreshold\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @return boolean\r
*/\r
public boolean hasThreshold()\r
{\r
return this._has_threshold;\r
- } //-- boolean hasThreshold() \r
+ }\r
+\r
+ //-- boolean hasThreshold() \r
\r
/**\r
* Method hasWidth\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @return boolean\r
*/\r
public boolean hasWidth()\r
{\r
return this._has_width;\r
- } //-- boolean hasWidth() \r
+ }\r
+\r
+ //-- boolean hasWidth() \r
\r
/**\r
* Method hasXpos\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @return boolean\r
*/\r
public boolean hasXpos()\r
{\r
return this._has_xpos;\r
- } //-- boolean hasXpos() \r
+ }\r
+\r
+ //-- boolean hasXpos() \r
\r
/**\r
* Method hasYpos\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @return boolean\r
*/\r
public boolean hasYpos()\r
{\r
return this._has_ypos;\r
- } //-- boolean hasYpos() \r
+ }\r
+\r
+ //-- boolean hasYpos() \r
\r
/**\r
* Method isValid\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @return boolean\r
*/\r
public boolean isValid()\r
{\r
- try {\r
+ try\r
+ {\r
validate();\r
}\r
- catch (org.exolab.castor.xml.ValidationException vex) {\r
+ catch (org.exolab.castor.xml.ValidationException vex)\r
+ {\r
return false;\r
}\r
+\r
return true;\r
- } //-- boolean isValid() \r
+ }\r
+\r
+ //-- boolean isValid() \r
\r
/**\r
* Method marshal\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param out\r
*/\r
public void marshal(java.io.Writer out)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+ throws org.exolab.castor.xml.MarshalException, \r
+ org.exolab.castor.xml.ValidationException\r
{\r
- \r
Marshaller.marshal(this, out);\r
- } //-- void marshal(java.io.Writer) \r
+ }\r
+\r
+ //-- void marshal(java.io.Writer) \r
\r
/**\r
* Method marshal\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param handler\r
*/\r
public void marshal(org.xml.sax.ContentHandler handler)\r
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException, \r
+ org.exolab.castor.xml.ValidationException\r
{\r
- \r
Marshaller.marshal(this, handler);\r
- } //-- void marshal(org.xml.sax.ContentHandler) \r
+ }\r
+\r
+ //-- void marshal(org.xml.sax.ContentHandler) \r
\r
/**\r
* Sets the value of field 'currentTree'.\r
- * \r
+ *\r
* @param currentTree the value of field 'currentTree'.\r
*/\r
public void setCurrentTree(boolean currentTree)\r
{\r
this._currentTree = currentTree;\r
this._has_currentTree = true;\r
- } //-- void setCurrentTree(boolean) \r
+ }\r
+\r
+ //-- void setCurrentTree(boolean) \r
\r
/**\r
* Sets the value of field 'fitToWindow'.\r
- * \r
+ *\r
* @param fitToWindow the value of field 'fitToWindow'.\r
*/\r
public void setFitToWindow(boolean fitToWindow)\r
{\r
this._fitToWindow = fitToWindow;\r
this._has_fitToWindow = true;\r
- } //-- void setFitToWindow(boolean) \r
+ }\r
+\r
+ //-- void setFitToWindow(boolean) \r
\r
/**\r
* Sets the value of field 'fontSize'.\r
- * \r
+ *\r
* @param fontSize the value of field 'fontSize'.\r
*/\r
public void setFontSize(int fontSize)\r
{\r
this._fontSize = fontSize;\r
this._has_fontSize = true;\r
- } //-- void setFontSize(int) \r
+ }\r
+\r
+ //-- void setFontSize(int) \r
\r
/**\r
* Sets the value of field 'height'.\r
- * \r
+ *\r
* @param height the value of field 'height'.\r
*/\r
public void setHeight(int height)\r
{\r
this._height = height;\r
this._has_height = true;\r
- } //-- void setHeight(int) \r
+ }\r
+\r
+ //-- void setHeight(int) \r
\r
/**\r
* Sets the value of field 'markUnlinked'.\r
- * \r
+ *\r
* @param markUnlinked the value of field 'markUnlinked'.\r
*/\r
public void setMarkUnlinked(boolean markUnlinked)\r
{\r
this._markUnlinked = markUnlinked;\r
this._has_markUnlinked = true;\r
- } //-- void setMarkUnlinked(boolean) \r
+ }\r
+\r
+ //-- void setMarkUnlinked(boolean) \r
\r
/**\r
* Sets the value of field 'newick'.\r
- * \r
+ *\r
* @param newick the value of field 'newick'.\r
*/\r
public void setNewick(java.lang.String newick)\r
{\r
this._newick = newick;\r
- } //-- void setNewick(java.lang.String) \r
+ }\r
+\r
+ //-- void setNewick(java.lang.String) \r
\r
/**\r
* Sets the value of field 'showBootstrap'.\r
- * \r
+ *\r
* @param showBootstrap the value of field 'showBootstrap'.\r
*/\r
public void setShowBootstrap(boolean showBootstrap)\r
{\r
this._showBootstrap = showBootstrap;\r
this._has_showBootstrap = true;\r
- } //-- void setShowBootstrap(boolean) \r
+ }\r
+\r
+ //-- void setShowBootstrap(boolean) \r
\r
/**\r
* Sets the value of field 'showDistances'.\r
- * \r
+ *\r
* @param showDistances the value of field 'showDistances'.\r
*/\r
public void setShowDistances(boolean showDistances)\r
{\r
this._showDistances = showDistances;\r
this._has_showDistances = true;\r
- } //-- void setShowDistances(boolean) \r
+ }\r
+\r
+ //-- void setShowDistances(boolean) \r
\r
/**\r
* Sets the value of field 'threshold'.\r
- * \r
+ *\r
* @param threshold the value of field 'threshold'.\r
*/\r
public void setThreshold(float threshold)\r
{\r
this._threshold = threshold;\r
this._has_threshold = true;\r
- } //-- void setThreshold(float) \r
+ }\r
+\r
+ //-- void setThreshold(float) \r
\r
/**\r
* Sets the value of field 'title'.\r
- * \r
+ *\r
* @param title the value of field 'title'.\r
*/\r
public void setTitle(java.lang.String title)\r
{\r
this._title = title;\r
- } //-- void setTitle(java.lang.String) \r
+ }\r
+\r
+ //-- void setTitle(java.lang.String) \r
\r
/**\r
* Sets the value of field 'width'.\r
- * \r
+ *\r
* @param width the value of field 'width'.\r
*/\r
public void setWidth(int width)\r
{\r
this._width = width;\r
this._has_width = true;\r
- } //-- void setWidth(int) \r
+ }\r
+\r
+ //-- void setWidth(int) \r
\r
/**\r
* Sets the value of field 'xpos'.\r
- * \r
+ *\r
* @param xpos the value of field 'xpos'.\r
*/\r
public void setXpos(int xpos)\r
{\r
this._xpos = xpos;\r
this._has_xpos = true;\r
- } //-- void setXpos(int) \r
+ }\r
+\r
+ //-- void setXpos(int) \r
\r
/**\r
* Sets the value of field 'ypos'.\r
- * \r
+ *\r
* @param ypos the value of field 'ypos'.\r
*/\r
public void setYpos(int ypos)\r
{\r
this._ypos = ypos;\r
this._has_ypos = true;\r
- } //-- void setYpos(int) \r
+ }\r
+\r
+ //-- void setYpos(int) \r
\r
/**\r
* Method unmarshal\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param reader\r
* @return Object\r
*/\r
public static java.lang.Object unmarshal(java.io.Reader reader)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+ throws org.exolab.castor.xml.MarshalException, \r
+ org.exolab.castor.xml.ValidationException\r
{\r
- return (jalview.binding.Tree) Unmarshaller.unmarshal(jalview.binding.Tree.class, reader);\r
- } //-- java.lang.Object unmarshal(java.io.Reader) \r
+ return (jalview.binding.Tree) Unmarshaller.unmarshal(jalview.binding.Tree.class,\r
+ reader);\r
+ }\r
+\r
+ //-- java.lang.Object unmarshal(java.io.Reader) \r
\r
/**\r
* Method validate\r
- * \r
+ *\r
*/\r
- public void validate()\r
- throws org.exolab.castor.xml.ValidationException\r
+ public void validate() throws org.exolab.castor.xml.ValidationException\r
{\r
org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
validator.validate(this);\r
- } //-- void validate() \r
+ }\r
\r
+ //-- void validate() \r
}\r
/*\r
- * This class was automatically generated with \r
+ * This class was automatically generated with\r
* <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
* Schema.\r
* $Id$\r
\r
package jalview.binding;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
-import java.io.IOException;\r
-import java.io.Reader;\r
-import java.io.Serializable;\r
-import java.io.Writer;\r
-import org.exolab.castor.xml.MarshalException;\r
-import org.exolab.castor.xml.Marshaller;\r
-import org.exolab.castor.xml.Unmarshaller;\r
-import org.exolab.castor.xml.ValidationException;\r
-import org.xml.sax.ContentHandler;\r
+import org.exolab.castor.xml.*;\r
\r
/**\r
* Class UserColour.\r
- * \r
+ *\r
* @version $Revision$ $Date$\r
*/\r
-public class UserColour implements java.io.Serializable {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _id\r
- */\r
- private int _id;\r
-\r
- /**\r
- * keeps track of state for field: _id\r
- */\r
- private boolean _has_id;\r
-\r
- /**\r
- * Field _userColourScheme\r
- */\r
- private jalview.binding.UserColourScheme _userColourScheme;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public UserColour() {\r
- super();\r
- } //-- jalview.binding.UserColour()\r
-\r
-\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
-\r
- /**\r
- * Method deleteId\r
- * \r
- */\r
- public void deleteId()\r
- {\r
- this._has_id= false;\r
- } //-- void deleteId() \r
-\r
- /**\r
- * Returns the value of field 'id'.\r
- * \r
- * @return int\r
- * @return the value of field 'id'.\r
- */\r
- public int getId()\r
- {\r
- return this._id;\r
- } //-- int getId() \r
-\r
- /**\r
- * Returns the value of field 'userColourScheme'.\r
- * \r
- * @return UserColourScheme\r
- * @return the value of field 'userColourScheme'.\r
- */\r
- public jalview.binding.UserColourScheme getUserColourScheme()\r
- {\r
- return this._userColourScheme;\r
- } //-- jalview.binding.UserColourScheme getUserColourScheme() \r
-\r
- /**\r
- * Method hasId\r
- * \r
- * \r
- * \r
- * @return boolean\r
- */\r
- public boolean hasId()\r
- {\r
- return this._has_id;\r
- } //-- boolean hasId() \r
-\r
- /**\r
- * Method isValid\r
- * \r
- * \r
- * \r
- * @return boolean\r
- */\r
- public boolean isValid()\r
- {\r
- try {\r
- validate();\r
- }\r
- catch (org.exolab.castor.xml.ValidationException vex) {\r
- return false;\r
- }\r
- return true;\r
- } //-- boolean isValid() \r
-\r
- /**\r
- * Method marshal\r
- * \r
- * \r
- * \r
- * @param out\r
- */\r
- public void marshal(java.io.Writer out)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
- {\r
- \r
- Marshaller.marshal(this, out);\r
- } //-- void marshal(java.io.Writer) \r
-\r
- /**\r
- * Method marshal\r
- * \r
- * \r
- * \r
- * @param handler\r
- */\r
- public void marshal(org.xml.sax.ContentHandler handler)\r
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
- {\r
- \r
- Marshaller.marshal(this, handler);\r
- } //-- void marshal(org.xml.sax.ContentHandler) \r
-\r
- /**\r
- * Sets the value of field 'id'.\r
- * \r
- * @param id the value of field 'id'.\r
- */\r
- public void setId(int id)\r
- {\r
- this._id = id;\r
- this._has_id = true;\r
- } //-- void setId(int) \r
-\r
- /**\r
- * Sets the value of field 'userColourScheme'.\r
- * \r
- * @param userColourScheme the value of field 'userColourScheme'\r
- */\r
- public void setUserColourScheme(jalview.binding.UserColourScheme userColourScheme)\r
- {\r
- this._userColourScheme = userColourScheme;\r
- } //-- void setUserColourScheme(jalview.binding.UserColourScheme) \r
-\r
- /**\r
- * Method unmarshal\r
- * \r
- * \r
- * \r
- * @param reader\r
- * @return Object\r
- */\r
- public static java.lang.Object unmarshal(java.io.Reader reader)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+public class UserColour\r
+ implements java.io.Serializable\r
+{\r
+\r
+ //--------------------------/\r
+ //- Class/Member Variables -/\r
+ //--------------------------/\r
+\r
+ /**\r
+ * Field _id\r
+ */\r
+ private int _id;\r
+\r
+ /**\r
+ * keeps track of state for field: _id\r
+ */\r
+ private boolean _has_id;\r
+\r
+ /**\r
+ * Field _userColourScheme\r
+ */\r
+ private jalview.binding.UserColourScheme _userColourScheme;\r
+\r
+ //----------------/\r
+ //- Constructors -/\r
+ //----------------/\r
+\r
+ public UserColour()\r
+ {\r
+ super();\r
+ } //-- jalview.binding.UserColour()\r
+\r
+ //-----------/\r
+ //- Methods -/\r
+ //-----------/\r
+\r
+ /**\r
+ * Method deleteId\r
+ *\r
+ */\r
+ public void deleteId()\r
+ {\r
+ this._has_id = false;\r
+ } //-- void deleteId()\r
+\r
+ /**\r
+ * Returns the value of field 'id'.\r
+ *\r
+ * @return int\r
+ * @return the value of field 'id'.\r
+ */\r
+ public int getId()\r
+ {\r
+ return this._id;\r
+ } //-- int getId()\r
+\r
+ /**\r
+ * Returns the value of field 'userColourScheme'.\r
+ *\r
+ * @return UserColourScheme\r
+ * @return the value of field 'userColourScheme'.\r
+ */\r
+ public jalview.binding.UserColourScheme getUserColourScheme()\r
+ {\r
+ return this._userColourScheme;\r
+ } //-- jalview.binding.UserColourScheme getUserColourScheme()\r
+\r
+ /**\r
+ * Method hasId\r
+ *\r
+ *\r
+ *\r
+ * @return boolean\r
+ */\r
+ public boolean hasId()\r
+ {\r
+ return this._has_id;\r
+ } //-- boolean hasId()\r
+\r
+ /**\r
+ * Method isValid\r
+ *\r
+ *\r
+ *\r
+ * @return boolean\r
+ */\r
+ public boolean isValid()\r
+ {\r
+ try\r
{\r
- return (jalview.binding.UserColour) Unmarshaller.unmarshal(jalview.binding.UserColour.class, reader);\r
- } //-- java.lang.Object unmarshal(java.io.Reader) \r
-\r
- /**\r
- * Method validate\r
- * \r
- */\r
- public void validate()\r
- throws org.exolab.castor.xml.ValidationException\r
+ validate();\r
+ }\r
+ catch (org.exolab.castor.xml.ValidationException vex)\r
{\r
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
- validator.validate(this);\r
- } //-- void validate() \r
+ return false;\r
+ }\r
+ return true;\r
+ } //-- boolean isValid()\r
+\r
+ /**\r
+ * Method marshal\r
+ *\r
+ *\r
+ *\r
+ * @param out\r
+ */\r
+ public void marshal(java.io.Writer out)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException\r
+ {\r
+\r
+ Marshaller.marshal(this, out);\r
+ } //-- void marshal(java.io.Writer)\r
+\r
+ /**\r
+ * Method marshal\r
+ *\r
+ *\r
+ *\r
+ * @param handler\r
+ */\r
+ public void marshal(org.xml.sax.ContentHandler handler)\r
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException\r
+ {\r
+\r
+ Marshaller.marshal(this, handler);\r
+ } //-- void marshal(org.xml.sax.ContentHandler)\r
+\r
+ /**\r
+ * Sets the value of field 'id'.\r
+ *\r
+ * @param id the value of field 'id'.\r
+ */\r
+ public void setId(int id)\r
+ {\r
+ this._id = id;\r
+ this._has_id = true;\r
+ } //-- void setId(int)\r
+\r
+ /**\r
+ * Sets the value of field 'userColourScheme'.\r
+ *\r
+ * @param userColourScheme the value of field 'userColourScheme'\r
+ */\r
+ public void setUserColourScheme(jalview.binding.UserColourScheme\r
+ userColourScheme)\r
+ {\r
+ this._userColourScheme = userColourScheme;\r
+ } //-- void setUserColourScheme(jalview.binding.UserColourScheme)\r
+\r
+ /**\r
+ * Method unmarshal\r
+ *\r
+ *\r
+ *\r
+ * @param reader\r
+ * @return Object\r
+ */\r
+ public static java.lang.Object unmarshal(java.io.Reader reader)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException\r
+ {\r
+ return (jalview.binding.UserColour) Unmarshaller.unmarshal(jalview.binding.\r
+ UserColour.class, reader);\r
+ } //-- java.lang.Object unmarshal(java.io.Reader)\r
+\r
+ /**\r
+ * Method validate\r
+ *\r
+ */\r
+ public void validate()\r
+ throws org.exolab.castor.xml.ValidationException\r
+ {\r
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.\r
+ Validator();\r
+ validator.validate(this);\r
+ } //-- void validate()\r
\r
}\r
/*\r
- * This class was automatically generated with \r
+ * This class was automatically generated with\r
* <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
* Schema.\r
* $Id$\r
\r
package jalview.binding;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
-import java.io.IOException;\r
-import java.io.Reader;\r
-import java.io.Serializable;\r
-import java.io.Writer;\r
-import org.exolab.castor.xml.MarshalException;\r
-import org.exolab.castor.xml.Marshaller;\r
-import org.exolab.castor.xml.Unmarshaller;\r
-import org.exolab.castor.xml.ValidationException;\r
-import org.xml.sax.ContentHandler;\r
+import org.exolab.castor.xml.*;\r
\r
/**\r
* Class UserColourScheme.\r
- * \r
+ *\r
* @version $Revision$ $Date$\r
*/\r
-public class UserColourScheme extends JalviewUserColours \r
-implements java.io.Serializable\r
+public class UserColourScheme\r
+ extends JalviewUserColours implements java.io.Serializable\r
{\r
\r
+ //----------------/\r
+ //- Constructors -/\r
+ //----------------/\r
\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
+ public UserColourScheme()\r
+ {\r
+ super();\r
+ } //-- jalview.binding.UserColourScheme()\r
\r
- public UserColourScheme() {\r
- super();\r
- } //-- jalview.binding.UserColourScheme()\r
+ //-----------/\r
+ //- Methods -/\r
+ //-----------/\r
\r
+ /**\r
+ * Method isValid\r
+ *\r
+ *\r
+ *\r
+ * @return boolean\r
+ */\r
+ public boolean isValid()\r
+ {\r
+ try\r
+ {\r
+ validate();\r
+ }\r
+ catch (org.exolab.castor.xml.ValidationException vex)\r
+ {\r
+ return false;\r
+ }\r
+ return true;\r
+ } //-- boolean isValid()\r
\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
+ /**\r
+ * Method marshal\r
+ *\r
+ *\r
+ *\r
+ * @param out\r
+ */\r
+ public void marshal(java.io.Writer out)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException\r
+ {\r
\r
- /**\r
- * Method isValid\r
- * \r
- * \r
- * \r
- * @return boolean\r
- */\r
- public boolean isValid()\r
- {\r
- try {\r
- validate();\r
- }\r
- catch (org.exolab.castor.xml.ValidationException vex) {\r
- return false;\r
- }\r
- return true;\r
- } //-- boolean isValid() \r
+ Marshaller.marshal(this, out);\r
+ } //-- void marshal(java.io.Writer)\r
\r
- /**\r
- * Method marshal\r
- * \r
- * \r
- * \r
- * @param out\r
- */\r
- public void marshal(java.io.Writer out)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
- {\r
- \r
- Marshaller.marshal(this, out);\r
- } //-- void marshal(java.io.Writer) \r
+ /**\r
+ * Method marshal\r
+ *\r
+ *\r
+ *\r
+ * @param handler\r
+ */\r
+ public void marshal(org.xml.sax.ContentHandler handler)\r
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException\r
+ {\r
\r
- /**\r
- * Method marshal\r
- * \r
- * \r
- * \r
- * @param handler\r
- */\r
- public void marshal(org.xml.sax.ContentHandler handler)\r
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
- {\r
- \r
- Marshaller.marshal(this, handler);\r
- } //-- void marshal(org.xml.sax.ContentHandler) \r
+ Marshaller.marshal(this, handler);\r
+ } //-- void marshal(org.xml.sax.ContentHandler)\r
\r
- /**\r
- * Method unmarshal\r
- * \r
- * \r
- * \r
- * @param reader\r
- * @return Object\r
- */\r
- public static java.lang.Object unmarshal(java.io.Reader reader)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
- {\r
- return (jalview.binding.UserColourScheme) Unmarshaller.unmarshal(jalview.binding.UserColourScheme.class, reader);\r
- } //-- java.lang.Object unmarshal(java.io.Reader) \r
+ /**\r
+ * Method unmarshal\r
+ *\r
+ *\r
+ *\r
+ * @param reader\r
+ * @return Object\r
+ */\r
+ public static java.lang.Object unmarshal(java.io.Reader reader)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException\r
+ {\r
+ return (jalview.binding.UserColourScheme) Unmarshaller.unmarshal(jalview.\r
+ binding.UserColourScheme.class, reader);\r
+ } //-- java.lang.Object unmarshal(java.io.Reader)\r
\r
- /**\r
- * Method validate\r
- * \r
- */\r
- public void validate()\r
- throws org.exolab.castor.xml.ValidationException\r
- {\r
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
- validator.validate(this);\r
- } //-- void validate() \r
+ /**\r
+ * Method validate\r
+ *\r
+ */\r
+ public void validate()\r
+ throws org.exolab.castor.xml.ValidationException\r
+ {\r
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.\r
+ Validator();\r
+ validator.validate(this);\r
+ } //-- void validate()\r
\r
}\r
/*\r
- * This class was automatically generated with \r
+ * This class was automatically generated with\r
* <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
* Schema.\r
* $Id$\r
\r
package jalview.binding;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
-import java.io.IOException;\r
-import java.io.Reader;\r
-import java.io.Serializable;\r
-import java.io.Writer;\r
-import org.exolab.castor.xml.MarshalException;\r
-import org.exolab.castor.xml.Marshaller;\r
-import org.exolab.castor.xml.Unmarshaller;\r
-import org.exolab.castor.xml.ValidationException;\r
-import org.xml.sax.ContentHandler;\r
+import org.exolab.castor.xml.*;\r
\r
/**\r
* Class UserColours.\r
- * \r
+ *\r
* @version $Revision$ $Date$\r
*/\r
-public class UserColours implements java.io.Serializable {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _id\r
- */\r
- private java.lang.String _id;\r
-\r
- /**\r
- * Field _userColourScheme\r
- */\r
- private jalview.binding.UserColourScheme _userColourScheme;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public UserColours() {\r
- super();\r
- } //-- jalview.binding.UserColours()\r
-\r
-\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
-\r
- /**\r
- * Returns the value of field 'id'.\r
- * \r
- * @return String\r
- * @return the value of field 'id'.\r
- */\r
- public java.lang.String getId()\r
- {\r
- return this._id;\r
- } //-- java.lang.String getId() \r
-\r
- /**\r
- * Returns the value of field 'userColourScheme'.\r
- * \r
- * @return UserColourScheme\r
- * @return the value of field 'userColourScheme'.\r
- */\r
- public jalview.binding.UserColourScheme getUserColourScheme()\r
- {\r
- return this._userColourScheme;\r
- } //-- jalview.binding.UserColourScheme getUserColourScheme() \r
-\r
- /**\r
- * Method isValid\r
- * \r
- * \r
- * \r
- * @return boolean\r
- */\r
- public boolean isValid()\r
- {\r
- try {\r
- validate();\r
- }\r
- catch (org.exolab.castor.xml.ValidationException vex) {\r
- return false;\r
- }\r
- return true;\r
- } //-- boolean isValid() \r
-\r
- /**\r
- * Method marshal\r
- * \r
- * \r
- * \r
- * @param out\r
- */\r
- public void marshal(java.io.Writer out)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
- {\r
- \r
- Marshaller.marshal(this, out);\r
- } //-- void marshal(java.io.Writer) \r
-\r
- /**\r
- * Method marshal\r
- * \r
- * \r
- * \r
- * @param handler\r
- */\r
- public void marshal(org.xml.sax.ContentHandler handler)\r
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
- {\r
- \r
- Marshaller.marshal(this, handler);\r
- } //-- void marshal(org.xml.sax.ContentHandler) \r
-\r
- /**\r
- * Sets the value of field 'id'.\r
- * \r
- * @param id the value of field 'id'.\r
- */\r
- public void setId(java.lang.String id)\r
- {\r
- this._id = id;\r
- } //-- void setId(java.lang.String) \r
-\r
- /**\r
- * Sets the value of field 'userColourScheme'.\r
- * \r
- * @param userColourScheme the value of field 'userColourScheme'\r
- */\r
- public void setUserColourScheme(jalview.binding.UserColourScheme userColourScheme)\r
- {\r
- this._userColourScheme = userColourScheme;\r
- } //-- void setUserColourScheme(jalview.binding.UserColourScheme) \r
-\r
- /**\r
- * Method unmarshal\r
- * \r
- * \r
- * \r
- * @param reader\r
- * @return Object\r
- */\r
- public static java.lang.Object unmarshal(java.io.Reader reader)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+public class UserColours\r
+ implements java.io.Serializable\r
+{\r
+\r
+ //--------------------------/\r
+ //- Class/Member Variables -/\r
+ //--------------------------/\r
+\r
+ /**\r
+ * Field _id\r
+ */\r
+ private java.lang.String _id;\r
+\r
+ /**\r
+ * Field _userColourScheme\r
+ */\r
+ private jalview.binding.UserColourScheme _userColourScheme;\r
+\r
+ //----------------/\r
+ //- Constructors -/\r
+ //----------------/\r
+\r
+ public UserColours()\r
+ {\r
+ super();\r
+ } //-- jalview.binding.UserColours()\r
+\r
+ //-----------/\r
+ //- Methods -/\r
+ //-----------/\r
+\r
+ /**\r
+ * Returns the value of field 'id'.\r
+ *\r
+ * @return String\r
+ * @return the value of field 'id'.\r
+ */\r
+ public java.lang.String getId()\r
+ {\r
+ return this._id;\r
+ } //-- java.lang.String getId()\r
+\r
+ /**\r
+ * Returns the value of field 'userColourScheme'.\r
+ *\r
+ * @return UserColourScheme\r
+ * @return the value of field 'userColourScheme'.\r
+ */\r
+ public jalview.binding.UserColourScheme getUserColourScheme()\r
+ {\r
+ return this._userColourScheme;\r
+ } //-- jalview.binding.UserColourScheme getUserColourScheme()\r
+\r
+ /**\r
+ * Method isValid\r
+ *\r
+ *\r
+ *\r
+ * @return boolean\r
+ */\r
+ public boolean isValid()\r
+ {\r
+ try\r
{\r
- return (jalview.binding.UserColours) Unmarshaller.unmarshal(jalview.binding.UserColours.class, reader);\r
- } //-- java.lang.Object unmarshal(java.io.Reader) \r
-\r
- /**\r
- * Method validate\r
- * \r
- */\r
- public void validate()\r
- throws org.exolab.castor.xml.ValidationException\r
+ validate();\r
+ }\r
+ catch (org.exolab.castor.xml.ValidationException vex)\r
{\r
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
- validator.validate(this);\r
- } //-- void validate() \r
+ return false;\r
+ }\r
+ return true;\r
+ } //-- boolean isValid()\r
+\r
+ /**\r
+ * Method marshal\r
+ *\r
+ *\r
+ *\r
+ * @param out\r
+ */\r
+ public void marshal(java.io.Writer out)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException\r
+ {\r
+\r
+ Marshaller.marshal(this, out);\r
+ } //-- void marshal(java.io.Writer)\r
+\r
+ /**\r
+ * Method marshal\r
+ *\r
+ *\r
+ *\r
+ * @param handler\r
+ */\r
+ public void marshal(org.xml.sax.ContentHandler handler)\r
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException\r
+ {\r
+\r
+ Marshaller.marshal(this, handler);\r
+ } //-- void marshal(org.xml.sax.ContentHandler)\r
+\r
+ /**\r
+ * Sets the value of field 'id'.\r
+ *\r
+ * @param id the value of field 'id'.\r
+ */\r
+ public void setId(java.lang.String id)\r
+ {\r
+ this._id = id;\r
+ } //-- void setId(java.lang.String)\r
+\r
+ /**\r
+ * Sets the value of field 'userColourScheme'.\r
+ *\r
+ * @param userColourScheme the value of field 'userColourScheme'\r
+ */\r
+ public void setUserColourScheme(jalview.binding.UserColourScheme\r
+ userColourScheme)\r
+ {\r
+ this._userColourScheme = userColourScheme;\r
+ } //-- void setUserColourScheme(jalview.binding.UserColourScheme)\r
+\r
+ /**\r
+ * Method unmarshal\r
+ *\r
+ *\r
+ *\r
+ * @param reader\r
+ * @return Object\r
+ */\r
+ public static java.lang.Object unmarshal(java.io.Reader reader)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException\r
+ {\r
+ return (jalview.binding.UserColours) Unmarshaller.unmarshal(jalview.binding.\r
+ UserColours.class, reader);\r
+ } //-- java.lang.Object unmarshal(java.io.Reader)\r
+\r
+ /**\r
+ * Method validate\r
+ *\r
+ */\r
+ public void validate()\r
+ throws org.exolab.castor.xml.ValidationException\r
+ {\r
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.\r
+ Validator();\r
+ validator.validate(this);\r
+ } //-- void validate()\r
\r
}\r
/*\r
- * This class was automatically generated with \r
+ * This class was automatically generated with\r
* <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
* Schema.\r
* $Id$\r
\r
package jalview.binding;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
//---------------------------------/\r
+//- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.util.*;\r
\r
-import java.io.IOException;\r
-import java.io.Reader;\r
-import java.io.Serializable;\r
-import java.io.Writer;\r
-import java.util.Enumeration;\r
-import java.util.Vector;\r
-import org.exolab.castor.xml.MarshalException;\r
-import org.exolab.castor.xml.Marshaller;\r
-import org.exolab.castor.xml.Unmarshaller;\r
-import org.exolab.castor.xml.ValidationException;\r
-import org.xml.sax.ContentHandler;\r
+import org.exolab.castor.xml.*;\r
\r
/**\r
* Class VAMSAS.\r
- * \r
+ *\r
* @version $Revision$ $Date$\r
*/\r
-public class VAMSAS implements java.io.Serializable {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _alignmentList\r
- */\r
- private java.util.Vector _alignmentList;\r
-\r
- /**\r
- * Field _treeList\r
- */\r
- private java.util.Vector _treeList;\r
-\r
- /**\r
- * Field _sequenceSetList\r
- */\r
- private java.util.Vector _sequenceSetList;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public VAMSAS() {\r
- super();\r
- _alignmentList = new Vector();\r
- _treeList = new Vector();\r
- _sequenceSetList = new Vector();\r
- } //-- jalview.binding.VAMSAS()\r
-\r
-\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
-\r
- /**\r
- * Method addAlignment\r
- * \r
- * \r
- * \r
- * @param vAlignment\r
- */\r
- public void addAlignment(jalview.binding.Alignment vAlignment)\r
- throws java.lang.IndexOutOfBoundsException\r
- {\r
- _alignmentList.addElement(vAlignment);\r
- } //-- void addAlignment(jalview.binding.Alignment) \r
-\r
- /**\r
- * Method addAlignment\r
- * \r
- * \r
- * \r
- * @param index\r
- * @param vAlignment\r
- */\r
- public void addAlignment(int index, jalview.binding.Alignment vAlignment)\r
- throws java.lang.IndexOutOfBoundsException\r
- {\r
- _alignmentList.insertElementAt(vAlignment, index);\r
- } //-- void addAlignment(int, jalview.binding.Alignment) \r
-\r
- /**\r
- * Method addSequenceSet\r
- * \r
- * \r
- * \r
- * @param vSequenceSet\r
- */\r
- public void addSequenceSet(jalview.binding.SequenceSet vSequenceSet)\r
- throws java.lang.IndexOutOfBoundsException\r
- {\r
- _sequenceSetList.addElement(vSequenceSet);\r
- } //-- void addSequenceSet(jalview.binding.SequenceSet) \r
-\r
- /**\r
- * Method addSequenceSet\r
- * \r
- * \r
- * \r
- * @param index\r
- * @param vSequenceSet\r
- */\r
- public void addSequenceSet(int index, jalview.binding.SequenceSet vSequenceSet)\r
- throws java.lang.IndexOutOfBoundsException\r
- {\r
- _sequenceSetList.insertElementAt(vSequenceSet, index);\r
- } //-- void addSequenceSet(int, jalview.binding.SequenceSet) \r
-\r
- /**\r
- * Method addTree\r
- * \r
- * \r
- * \r
- * @param vTree\r
- */\r
- public void addTree(java.lang.String vTree)\r
- throws java.lang.IndexOutOfBoundsException\r
- {\r
- _treeList.addElement(vTree);\r
- } //-- void addTree(java.lang.String) \r
-\r
- /**\r
- * Method addTree\r
- * \r
- * \r
- * \r
- * @param index\r
- * @param vTree\r
- */\r
- public void addTree(int index, java.lang.String vTree)\r
- throws java.lang.IndexOutOfBoundsException\r
- {\r
- _treeList.insertElementAt(vTree, index);\r
- } //-- void addTree(int, java.lang.String) \r
-\r
- /**\r
- * Method enumerateAlignment\r
- * \r
- * \r
- * \r
- * @return Enumeration\r
- */\r
- public java.util.Enumeration enumerateAlignment()\r
- {\r
- return _alignmentList.elements();\r
- } //-- java.util.Enumeration enumerateAlignment() \r
-\r
- /**\r
- * Method enumerateSequenceSet\r
- * \r
- * \r
- * \r
- * @return Enumeration\r
- */\r
- public java.util.Enumeration enumerateSequenceSet()\r
- {\r
- return _sequenceSetList.elements();\r
- } //-- java.util.Enumeration enumerateSequenceSet() \r
-\r
- /**\r
- * Method enumerateTree\r
- * \r
- * \r
- * \r
- * @return Enumeration\r
- */\r
- public java.util.Enumeration enumerateTree()\r
- {\r
- return _treeList.elements();\r
- } //-- java.util.Enumeration enumerateTree() \r
-\r
- /**\r
- * Method getAlignment\r
- * \r
- * \r
- * \r
- * @param index\r
- * @return Alignment\r
- */\r
- public jalview.binding.Alignment getAlignment(int index)\r
- throws java.lang.IndexOutOfBoundsException\r
- {\r
- //-- check bounds for index\r
- if ((index < 0) || (index > _alignmentList.size())) {\r
- throw new IndexOutOfBoundsException();\r
- }\r
- \r
- return (jalview.binding.Alignment) _alignmentList.elementAt(index);\r
- } //-- jalview.binding.Alignment getAlignment(int) \r
-\r
- /**\r
- * Method getAlignment\r
- * \r
- * \r
- * \r
- * @return Alignment\r
- */\r
- public jalview.binding.Alignment[] getAlignment()\r
- {\r
- int size = _alignmentList.size();\r
- jalview.binding.Alignment[] mArray = new jalview.binding.Alignment[size];\r
- for (int index = 0; index < size; index++) {\r
- mArray[index] = (jalview.binding.Alignment) _alignmentList.elementAt(index);\r
- }\r
- return mArray;\r
- } //-- jalview.binding.Alignment[] getAlignment() \r
-\r
- /**\r
- * Method getAlignmentCount\r
- * \r
- * \r
- * \r
- * @return int\r
- */\r
- public int getAlignmentCount()\r
- {\r
- return _alignmentList.size();\r
- } //-- int getAlignmentCount() \r
-\r
- /**\r
- * Method getSequenceSet\r
- * \r
- * \r
- * \r
- * @param index\r
- * @return SequenceSet\r
- */\r
- public jalview.binding.SequenceSet getSequenceSet(int index)\r
- throws java.lang.IndexOutOfBoundsException\r
- {\r
- //-- check bounds for index\r
- if ((index < 0) || (index > _sequenceSetList.size())) {\r
- throw new IndexOutOfBoundsException();\r
- }\r
- \r
- return (jalview.binding.SequenceSet) _sequenceSetList.elementAt(index);\r
- } //-- jalview.binding.SequenceSet getSequenceSet(int) \r
-\r
- /**\r
- * Method getSequenceSet\r
- * \r
- * \r
- * \r
- * @return SequenceSet\r
- */\r
- public jalview.binding.SequenceSet[] getSequenceSet()\r
- {\r
- int size = _sequenceSetList.size();\r
- jalview.binding.SequenceSet[] mArray = new jalview.binding.SequenceSet[size];\r
- for (int index = 0; index < size; index++) {\r
- mArray[index] = (jalview.binding.SequenceSet) _sequenceSetList.elementAt(index);\r
- }\r
- return mArray;\r
- } //-- jalview.binding.SequenceSet[] getSequenceSet() \r
-\r
- /**\r
- * Method getSequenceSetCount\r
- * \r
- * \r
- * \r
- * @return int\r
- */\r
- public int getSequenceSetCount()\r
- {\r
- return _sequenceSetList.size();\r
- } //-- int getSequenceSetCount() \r
-\r
- /**\r
- * Method getTree\r
- * \r
- * \r
- * \r
- * @param index\r
- * @return String\r
- */\r
- public java.lang.String getTree(int index)\r
- throws java.lang.IndexOutOfBoundsException\r
- {\r
- //-- check bounds for index\r
- if ((index < 0) || (index > _treeList.size())) {\r
- throw new IndexOutOfBoundsException();\r
- }\r
- \r
- return (String)_treeList.elementAt(index);\r
- } //-- java.lang.String getTree(int) \r
-\r
- /**\r
- * Method getTree\r
- * \r
- * \r
- * \r
- * @return String\r
- */\r
- public java.lang.String[] getTree()\r
- {\r
- int size = _treeList.size();\r
- java.lang.String[] mArray = new java.lang.String[size];\r
- for (int index = 0; index < size; index++) {\r
- mArray[index] = (String)_treeList.elementAt(index);\r
- }\r
- return mArray;\r
- } //-- java.lang.String[] getTree() \r
-\r
- /**\r
- * Method getTreeCount\r
- * \r
- * \r
- * \r
- * @return int\r
- */\r
- public int getTreeCount()\r
- {\r
- return _treeList.size();\r
- } //-- int getTreeCount() \r
-\r
- /**\r
- * Method isValid\r
- * \r
- * \r
- * \r
- * @return boolean\r
- */\r
- public boolean isValid()\r
- {\r
- try {\r
- validate();\r
- }\r
- catch (org.exolab.castor.xml.ValidationException vex) {\r
- return false;\r
- }\r
- return true;\r
- } //-- boolean isValid() \r
-\r
- /**\r
- * Method marshal\r
- * \r
- * \r
- * \r
- * @param out\r
- */\r
- public void marshal(java.io.Writer out)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
- {\r
- \r
- Marshaller.marshal(this, out);\r
- } //-- void marshal(java.io.Writer) \r
-\r
- /**\r
- * Method marshal\r
- * \r
- * \r
- * \r
- * @param handler\r
- */\r
- public void marshal(org.xml.sax.ContentHandler handler)\r
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
- {\r
- \r
- Marshaller.marshal(this, handler);\r
- } //-- void marshal(org.xml.sax.ContentHandler) \r
-\r
- /**\r
- * Method removeAlignment\r
- * \r
- * \r
- * \r
- * @param index\r
- * @return Alignment\r
- */\r
- public jalview.binding.Alignment removeAlignment(int index)\r
- {\r
- java.lang.Object obj = _alignmentList.elementAt(index);\r
- _alignmentList.removeElementAt(index);\r
- return (jalview.binding.Alignment) obj;\r
- } //-- jalview.binding.Alignment removeAlignment(int) \r
-\r
- /**\r
- * Method removeAllAlignment\r
- * \r
- */\r
- public void removeAllAlignment()\r
- {\r
- _alignmentList.removeAllElements();\r
- } //-- void removeAllAlignment() \r
-\r
- /**\r
- * Method removeAllSequenceSet\r
- * \r
- */\r
- public void removeAllSequenceSet()\r
- {\r
- _sequenceSetList.removeAllElements();\r
- } //-- void removeAllSequenceSet() \r
-\r
- /**\r
- * Method removeAllTree\r
- * \r
- */\r
- public void removeAllTree()\r
- {\r
- _treeList.removeAllElements();\r
- } //-- void removeAllTree() \r
-\r
- /**\r
- * Method removeSequenceSet\r
- * \r
- * \r
- * \r
- * @param index\r
- * @return SequenceSet\r
- */\r
- public jalview.binding.SequenceSet removeSequenceSet(int index)\r
- {\r
- java.lang.Object obj = _sequenceSetList.elementAt(index);\r
- _sequenceSetList.removeElementAt(index);\r
- return (jalview.binding.SequenceSet) obj;\r
- } //-- jalview.binding.SequenceSet removeSequenceSet(int) \r
-\r
- /**\r
- * Method removeTree\r
- * \r
- * \r
- * \r
- * @param index\r
- * @return String\r
- */\r
- public java.lang.String removeTree(int index)\r
- {\r
- java.lang.Object obj = _treeList.elementAt(index);\r
- _treeList.removeElementAt(index);\r
- return (String)obj;\r
- } //-- java.lang.String removeTree(int) \r
-\r
- /**\r
- * Method setAlignment\r
- * \r
- * \r
- * \r
- * @param index\r
- * @param vAlignment\r
- */\r
- public void setAlignment(int index, jalview.binding.Alignment vAlignment)\r
- throws java.lang.IndexOutOfBoundsException\r
- {\r
- //-- check bounds for index\r
- if ((index < 0) || (index > _alignmentList.size())) {\r
- throw new IndexOutOfBoundsException();\r
- }\r
- _alignmentList.setElementAt(vAlignment, index);\r
- } //-- void setAlignment(int, jalview.binding.Alignment) \r
-\r
- /**\r
- * Method setAlignment\r
- * \r
- * \r
- * \r
- * @param alignmentArray\r
- */\r
- public void setAlignment(jalview.binding.Alignment[] alignmentArray)\r
- {\r
- //-- copy array\r
- _alignmentList.removeAllElements();\r
- for (int i = 0; i < alignmentArray.length; i++) {\r
- _alignmentList.addElement(alignmentArray[i]);\r
- }\r
- } //-- void setAlignment(jalview.binding.Alignment) \r
-\r
- /**\r
- * Method setSequenceSet\r
- * \r
- * \r
- * \r
- * @param index\r
- * @param vSequenceSet\r
- */\r
- public void setSequenceSet(int index, jalview.binding.SequenceSet vSequenceSet)\r
- throws java.lang.IndexOutOfBoundsException\r
- {\r
- //-- check bounds for index\r
- if ((index < 0) || (index > _sequenceSetList.size())) {\r
- throw new IndexOutOfBoundsException();\r
- }\r
- _sequenceSetList.setElementAt(vSequenceSet, index);\r
- } //-- void setSequenceSet(int, jalview.binding.SequenceSet) \r
-\r
- /**\r
- * Method setSequenceSet\r
- * \r
- * \r
- * \r
- * @param sequenceSetArray\r
- */\r
- public void setSequenceSet(jalview.binding.SequenceSet[] sequenceSetArray)\r
- {\r
- //-- copy array\r
- _sequenceSetList.removeAllElements();\r
- for (int i = 0; i < sequenceSetArray.length; i++) {\r
- _sequenceSetList.addElement(sequenceSetArray[i]);\r
- }\r
- } //-- void setSequenceSet(jalview.binding.SequenceSet) \r
-\r
- /**\r
- * Method setTree\r
- * \r
- * \r
- * \r
- * @param index\r
- * @param vTree\r
- */\r
- public void setTree(int index, java.lang.String vTree)\r
- throws java.lang.IndexOutOfBoundsException\r
- {\r
- //-- check bounds for index\r
- if ((index < 0) || (index > _treeList.size())) {\r
- throw new IndexOutOfBoundsException();\r
- }\r
- _treeList.setElementAt(vTree, index);\r
- } //-- void setTree(int, java.lang.String) \r
-\r
- /**\r
- * Method setTree\r
- * \r
- * \r
- * \r
- * @param treeArray\r
- */\r
- public void setTree(java.lang.String[] treeArray)\r
- {\r
- //-- copy array\r
- _treeList.removeAllElements();\r
- for (int i = 0; i < treeArray.length; i++) {\r
- _treeList.addElement(treeArray[i]);\r
- }\r
- } //-- void setTree(java.lang.String) \r
-\r
- /**\r
- * Method unmarshal\r
- * \r
- * \r
- * \r
- * @param reader\r
- * @return Object\r
- */\r
- public static java.lang.Object unmarshal(java.io.Reader reader)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
- {\r
- return (jalview.binding.VAMSAS) Unmarshaller.unmarshal(jalview.binding.VAMSAS.class, reader);\r
- } //-- java.lang.Object unmarshal(java.io.Reader) \r
-\r
- /**\r
- * Method validate\r
- * \r
- */\r
- public void validate()\r
- throws org.exolab.castor.xml.ValidationException\r
- {\r
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
- validator.validate(this);\r
- } //-- void validate() \r
+public class VAMSAS\r
+ implements java.io.Serializable\r
+{\r
+\r
+ //--------------------------/\r
+ //- Class/Member Variables -/\r
+ //--------------------------/\r
+\r
+ /**\r
+ * Field _alignmentList\r
+ */\r
+ private java.util.Vector _alignmentList;\r
+\r
+ /**\r
+ * Field _treeList\r
+ */\r
+ private java.util.Vector _treeList;\r
+\r
+ /**\r
+ * Field _sequenceSetList\r
+ */\r
+ private java.util.Vector _sequenceSetList;\r
+\r
+ //----------------/\r
+ //- Constructors -/\r
+ //----------------/\r
+\r
+ public VAMSAS()\r
+ {\r
+ super();\r
+ _alignmentList = new Vector();\r
+ _treeList = new Vector();\r
+ _sequenceSetList = new Vector();\r
+ } //-- jalview.binding.VAMSAS()\r
+\r
+ //-----------/\r
+ //- Methods -/\r
+ //-----------/\r
+\r
+ /**\r
+ * Method addAlignment\r
+ *\r
+ *\r
+ *\r
+ * @param vAlignment\r
+ */\r
+ public void addAlignment(jalview.binding.Alignment vAlignment)\r
+ throws java.lang.IndexOutOfBoundsException\r
+ {\r
+ _alignmentList.addElement(vAlignment);\r
+ } //-- void addAlignment(jalview.binding.Alignment)\r
+\r
+ /**\r
+ * Method addAlignment\r
+ *\r
+ *\r
+ *\r
+ * @param index\r
+ * @param vAlignment\r
+ */\r
+ public void addAlignment(int index, jalview.binding.Alignment vAlignment)\r
+ throws java.lang.IndexOutOfBoundsException\r
+ {\r
+ _alignmentList.insertElementAt(vAlignment, index);\r
+ } //-- void addAlignment(int, jalview.binding.Alignment)\r
+\r
+ /**\r
+ * Method addSequenceSet\r
+ *\r
+ *\r
+ *\r
+ * @param vSequenceSet\r
+ */\r
+ public void addSequenceSet(jalview.binding.SequenceSet vSequenceSet)\r
+ throws java.lang.IndexOutOfBoundsException\r
+ {\r
+ _sequenceSetList.addElement(vSequenceSet);\r
+ } //-- void addSequenceSet(jalview.binding.SequenceSet)\r
+\r
+ /**\r
+ * Method addSequenceSet\r
+ *\r
+ *\r
+ *\r
+ * @param index\r
+ * @param vSequenceSet\r
+ */\r
+ public void addSequenceSet(int index,\r
+ jalview.binding.SequenceSet vSequenceSet)\r
+ throws java.lang.IndexOutOfBoundsException\r
+ {\r
+ _sequenceSetList.insertElementAt(vSequenceSet, index);\r
+ } //-- void addSequenceSet(int, jalview.binding.SequenceSet)\r
+\r
+ /**\r
+ * Method addTree\r
+ *\r
+ *\r
+ *\r
+ * @param vTree\r
+ */\r
+ public void addTree(java.lang.String vTree)\r
+ throws java.lang.IndexOutOfBoundsException\r
+ {\r
+ _treeList.addElement(vTree);\r
+ } //-- void addTree(java.lang.String)\r
+\r
+ /**\r
+ * Method addTree\r
+ *\r
+ *\r
+ *\r
+ * @param index\r
+ * @param vTree\r
+ */\r
+ public void addTree(int index, java.lang.String vTree)\r
+ throws java.lang.IndexOutOfBoundsException\r
+ {\r
+ _treeList.insertElementAt(vTree, index);\r
+ } //-- void addTree(int, java.lang.String)\r
+\r
+ /**\r
+ * Method enumerateAlignment\r
+ *\r
+ *\r
+ *\r
+ * @return Enumeration\r
+ */\r
+ public java.util.Enumeration enumerateAlignment()\r
+ {\r
+ return _alignmentList.elements();\r
+ } //-- java.util.Enumeration enumerateAlignment()\r
+\r
+ /**\r
+ * Method enumerateSequenceSet\r
+ *\r
+ *\r
+ *\r
+ * @return Enumeration\r
+ */\r
+ public java.util.Enumeration enumerateSequenceSet()\r
+ {\r
+ return _sequenceSetList.elements();\r
+ } //-- java.util.Enumeration enumerateSequenceSet()\r
+\r
+ /**\r
+ * Method enumerateTree\r
+ *\r
+ *\r
+ *\r
+ * @return Enumeration\r
+ */\r
+ public java.util.Enumeration enumerateTree()\r
+ {\r
+ return _treeList.elements();\r
+ } //-- java.util.Enumeration enumerateTree()\r
+\r
+ /**\r
+ * Method getAlignment\r
+ *\r
+ *\r
+ *\r
+ * @param index\r
+ * @return Alignment\r
+ */\r
+ public jalview.binding.Alignment getAlignment(int index)\r
+ throws java.lang.IndexOutOfBoundsException\r
+ {\r
+ //-- check bounds for index\r
+ if ( (index < 0) || (index > _alignmentList.size()))\r
+ {\r
+ throw new IndexOutOfBoundsException();\r
+ }\r
+\r
+ return (jalview.binding.Alignment) _alignmentList.elementAt(index);\r
+ } //-- jalview.binding.Alignment getAlignment(int)\r
+\r
+ /**\r
+ * Method getAlignment\r
+ *\r
+ *\r
+ *\r
+ * @return Alignment\r
+ */\r
+ public jalview.binding.Alignment[] getAlignment()\r
+ {\r
+ int size = _alignmentList.size();\r
+ jalview.binding.Alignment[] mArray = new jalview.binding.Alignment[size];\r
+ for (int index = 0; index < size; index++)\r
+ {\r
+ mArray[index] = (jalview.binding.Alignment) _alignmentList.elementAt(\r
+ index);\r
+ }\r
+ return mArray;\r
+ } //-- jalview.binding.Alignment[] getAlignment()\r
+\r
+ /**\r
+ * Method getAlignmentCount\r
+ *\r
+ *\r
+ *\r
+ * @return int\r
+ */\r
+ public int getAlignmentCount()\r
+ {\r
+ return _alignmentList.size();\r
+ } //-- int getAlignmentCount()\r
+\r
+ /**\r
+ * Method getSequenceSet\r
+ *\r
+ *\r
+ *\r
+ * @param index\r
+ * @return SequenceSet\r
+ */\r
+ public jalview.binding.SequenceSet getSequenceSet(int index)\r
+ throws java.lang.IndexOutOfBoundsException\r
+ {\r
+ //-- check bounds for index\r
+ if ( (index < 0) || (index > _sequenceSetList.size()))\r
+ {\r
+ throw new IndexOutOfBoundsException();\r
+ }\r
+\r
+ return (jalview.binding.SequenceSet) _sequenceSetList.elementAt(index);\r
+ } //-- jalview.binding.SequenceSet getSequenceSet(int)\r
+\r
+ /**\r
+ * Method getSequenceSet\r
+ *\r
+ *\r
+ *\r
+ * @return SequenceSet\r
+ */\r
+ public jalview.binding.SequenceSet[] getSequenceSet()\r
+ {\r
+ int size = _sequenceSetList.size();\r
+ jalview.binding.SequenceSet[] mArray = new jalview.binding.SequenceSet[size];\r
+ for (int index = 0; index < size; index++)\r
+ {\r
+ mArray[index] = (jalview.binding.SequenceSet) _sequenceSetList.elementAt(\r
+ index);\r
+ }\r
+ return mArray;\r
+ } //-- jalview.binding.SequenceSet[] getSequenceSet()\r
+\r
+ /**\r
+ * Method getSequenceSetCount\r
+ *\r
+ *\r
+ *\r
+ * @return int\r
+ */\r
+ public int getSequenceSetCount()\r
+ {\r
+ return _sequenceSetList.size();\r
+ } //-- int getSequenceSetCount()\r
+\r
+ /**\r
+ * Method getTree\r
+ *\r
+ *\r
+ *\r
+ * @param index\r
+ * @return String\r
+ */\r
+ public java.lang.String getTree(int index)\r
+ throws java.lang.IndexOutOfBoundsException\r
+ {\r
+ //-- check bounds for index\r
+ if ( (index < 0) || (index > _treeList.size()))\r
+ {\r
+ throw new IndexOutOfBoundsException();\r
+ }\r
+\r
+ return (String) _treeList.elementAt(index);\r
+ } //-- java.lang.String getTree(int)\r
+\r
+ /**\r
+ * Method getTree\r
+ *\r
+ *\r
+ *\r
+ * @return String\r
+ */\r
+ public java.lang.String[] getTree()\r
+ {\r
+ int size = _treeList.size();\r
+ java.lang.String[] mArray = new java.lang.String[size];\r
+ for (int index = 0; index < size; index++)\r
+ {\r
+ mArray[index] = (String) _treeList.elementAt(index);\r
+ }\r
+ return mArray;\r
+ } //-- java.lang.String[] getTree()\r
+\r
+ /**\r
+ * Method getTreeCount\r
+ *\r
+ *\r
+ *\r
+ * @return int\r
+ */\r
+ public int getTreeCount()\r
+ {\r
+ return _treeList.size();\r
+ } //-- int getTreeCount()\r
+\r
+ /**\r
+ * Method isValid\r
+ *\r
+ *\r
+ *\r
+ * @return boolean\r
+ */\r
+ public boolean isValid()\r
+ {\r
+ try\r
+ {\r
+ validate();\r
+ }\r
+ catch (org.exolab.castor.xml.ValidationException vex)\r
+ {\r
+ return false;\r
+ }\r
+ return true;\r
+ } //-- boolean isValid()\r
+\r
+ /**\r
+ * Method marshal\r
+ *\r
+ *\r
+ *\r
+ * @param out\r
+ */\r
+ public void marshal(java.io.Writer out)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException\r
+ {\r
+\r
+ Marshaller.marshal(this, out);\r
+ } //-- void marshal(java.io.Writer)\r
+\r
+ /**\r
+ * Method marshal\r
+ *\r
+ *\r
+ *\r
+ * @param handler\r
+ */\r
+ public void marshal(org.xml.sax.ContentHandler handler)\r
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException\r
+ {\r
+\r
+ Marshaller.marshal(this, handler);\r
+ } //-- void marshal(org.xml.sax.ContentHandler)\r
+\r
+ /**\r
+ * Method removeAlignment\r
+ *\r
+ *\r
+ *\r
+ * @param index\r
+ * @return Alignment\r
+ */\r
+ public jalview.binding.Alignment removeAlignment(int index)\r
+ {\r
+ java.lang.Object obj = _alignmentList.elementAt(index);\r
+ _alignmentList.removeElementAt(index);\r
+ return (jalview.binding.Alignment) obj;\r
+ } //-- jalview.binding.Alignment removeAlignment(int)\r
+\r
+ /**\r
+ * Method removeAllAlignment\r
+ *\r
+ */\r
+ public void removeAllAlignment()\r
+ {\r
+ _alignmentList.removeAllElements();\r
+ } //-- void removeAllAlignment()\r
+\r
+ /**\r
+ * Method removeAllSequenceSet\r
+ *\r
+ */\r
+ public void removeAllSequenceSet()\r
+ {\r
+ _sequenceSetList.removeAllElements();\r
+ } //-- void removeAllSequenceSet()\r
+\r
+ /**\r
+ * Method removeAllTree\r
+ *\r
+ */\r
+ public void removeAllTree()\r
+ {\r
+ _treeList.removeAllElements();\r
+ } //-- void removeAllTree()\r
+\r
+ /**\r
+ * Method removeSequenceSet\r
+ *\r
+ *\r
+ *\r
+ * @param index\r
+ * @return SequenceSet\r
+ */\r
+ public jalview.binding.SequenceSet removeSequenceSet(int index)\r
+ {\r
+ java.lang.Object obj = _sequenceSetList.elementAt(index);\r
+ _sequenceSetList.removeElementAt(index);\r
+ return (jalview.binding.SequenceSet) obj;\r
+ } //-- jalview.binding.SequenceSet removeSequenceSet(int)\r
+\r
+ /**\r
+ * Method removeTree\r
+ *\r
+ *\r
+ *\r
+ * @param index\r
+ * @return String\r
+ */\r
+ public java.lang.String removeTree(int index)\r
+ {\r
+ java.lang.Object obj = _treeList.elementAt(index);\r
+ _treeList.removeElementAt(index);\r
+ return (String) obj;\r
+ } //-- java.lang.String removeTree(int)\r
+\r
+ /**\r
+ * Method setAlignment\r
+ *\r
+ *\r
+ *\r
+ * @param index\r
+ * @param vAlignment\r
+ */\r
+ public void setAlignment(int index, jalview.binding.Alignment vAlignment)\r
+ throws java.lang.IndexOutOfBoundsException\r
+ {\r
+ //-- check bounds for index\r
+ if ( (index < 0) || (index > _alignmentList.size()))\r
+ {\r
+ throw new IndexOutOfBoundsException();\r
+ }\r
+ _alignmentList.setElementAt(vAlignment, index);\r
+ } //-- void setAlignment(int, jalview.binding.Alignment)\r
+\r
+ /**\r
+ * Method setAlignment\r
+ *\r
+ *\r
+ *\r
+ * @param alignmentArray\r
+ */\r
+ public void setAlignment(jalview.binding.Alignment[] alignmentArray)\r
+ {\r
+ //-- copy array\r
+ _alignmentList.removeAllElements();\r
+ for (int i = 0; i < alignmentArray.length; i++)\r
+ {\r
+ _alignmentList.addElement(alignmentArray[i]);\r
+ }\r
+ } //-- void setAlignment(jalview.binding.Alignment)\r
+\r
+ /**\r
+ * Method setSequenceSet\r
+ *\r
+ *\r
+ *\r
+ * @param index\r
+ * @param vSequenceSet\r
+ */\r
+ public void setSequenceSet(int index,\r
+ jalview.binding.SequenceSet vSequenceSet)\r
+ throws java.lang.IndexOutOfBoundsException\r
+ {\r
+ //-- check bounds for index\r
+ if ( (index < 0) || (index > _sequenceSetList.size()))\r
+ {\r
+ throw new IndexOutOfBoundsException();\r
+ }\r
+ _sequenceSetList.setElementAt(vSequenceSet, index);\r
+ } //-- void setSequenceSet(int, jalview.binding.SequenceSet)\r
+\r
+ /**\r
+ * Method setSequenceSet\r
+ *\r
+ *\r
+ *\r
+ * @param sequenceSetArray\r
+ */\r
+ public void setSequenceSet(jalview.binding.SequenceSet[] sequenceSetArray)\r
+ {\r
+ //-- copy array\r
+ _sequenceSetList.removeAllElements();\r
+ for (int i = 0; i < sequenceSetArray.length; i++)\r
+ {\r
+ _sequenceSetList.addElement(sequenceSetArray[i]);\r
+ }\r
+ } //-- void setSequenceSet(jalview.binding.SequenceSet)\r
+\r
+ /**\r
+ * Method setTree\r
+ *\r
+ *\r
+ *\r
+ * @param index\r
+ * @param vTree\r
+ */\r
+ public void setTree(int index, java.lang.String vTree)\r
+ throws java.lang.IndexOutOfBoundsException\r
+ {\r
+ //-- check bounds for index\r
+ if ( (index < 0) || (index > _treeList.size()))\r
+ {\r
+ throw new IndexOutOfBoundsException();\r
+ }\r
+ _treeList.setElementAt(vTree, index);\r
+ } //-- void setTree(int, java.lang.String)\r
+\r
+ /**\r
+ * Method setTree\r
+ *\r
+ *\r
+ *\r
+ * @param treeArray\r
+ */\r
+ public void setTree(java.lang.String[] treeArray)\r
+ {\r
+ //-- copy array\r
+ _treeList.removeAllElements();\r
+ for (int i = 0; i < treeArray.length; i++)\r
+ {\r
+ _treeList.addElement(treeArray[i]);\r
+ }\r
+ } //-- void setTree(java.lang.String)\r
+\r
+ /**\r
+ * Method unmarshal\r
+ *\r
+ *\r
+ *\r
+ * @param reader\r
+ * @return Object\r
+ */\r
+ public static java.lang.Object unmarshal(java.io.Reader reader)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException\r
+ {\r
+ return (jalview.binding.VAMSAS) Unmarshaller.unmarshal(jalview.binding.\r
+ VAMSAS.class, reader);\r
+ } //-- java.lang.Object unmarshal(java.io.Reader)\r
+\r
+ /**\r
+ * Method validate\r
+ *\r
+ */\r
+ public void validate()\r
+ throws org.exolab.castor.xml.ValidationException\r
+ {\r
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.\r
+ Validator();\r
+ validator.validate(this);\r
+ } //-- void validate()\r
\r
}\r
/*\r
- * This class was automatically generated with \r
+ * This class was automatically generated with\r
* <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
* Schema.\r
* $Id$\r
*/\r
-\r
package jalview.binding;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
-//---------------------------------/\r
-\r
-import java.io.IOException;\r
-import java.io.Reader;\r
-import java.io.Serializable;\r
-import java.io.Writer;\r
import org.exolab.castor.xml.MarshalException;\r
import org.exolab.castor.xml.Marshaller;\r
import org.exolab.castor.xml.Unmarshaller;\r
import org.exolab.castor.xml.ValidationException;\r
+\r
import org.xml.sax.ContentHandler;\r
\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
+//---------------------------------/\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+\r
+\r
/**\r
* Class VamsasModel.\r
- * \r
+ *\r
* @version $Revision$ $Date$\r
*/\r
-public class VamsasModel extends VAMSAS \r
-implements java.io.Serializable\r
+public class VamsasModel extends VAMSAS implements java.io.Serializable\r
{\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
//----------------/\r
-\r
- public VamsasModel() {\r
+ //- Constructors -/\r
+ //----------------/\r
+ public VamsasModel()\r
+ {\r
super();\r
- } //-- jalview.binding.VamsasModel()\r
+ }\r
\r
-\r
- //-----------/\r
- //- Methods -/\r
+ //-- jalview.binding.VamsasModel()\r
//-----------/\r
\r
/**\r
- * Method isValid\r
- * \r
- * \r
- * \r
- * @return boolean\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
*/\r
public boolean isValid()\r
{\r
- try {\r
+ try\r
+ {\r
validate();\r
}\r
- catch (org.exolab.castor.xml.ValidationException vex) {\r
+ catch (org.exolab.castor.xml.ValidationException vex)\r
+ {\r
return false;\r
}\r
+\r
return true;\r
- } //-- boolean isValid() \r
+ }\r
+\r
+ //-- boolean isValid() \r
\r
/**\r
* Method marshal\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param out\r
*/\r
public void marshal(java.io.Writer out)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+ throws org.exolab.castor.xml.MarshalException, \r
+ org.exolab.castor.xml.ValidationException\r
{\r
- \r
Marshaller.marshal(this, out);\r
- } //-- void marshal(java.io.Writer) \r
+ }\r
+\r
+ //-- void marshal(java.io.Writer) \r
\r
/**\r
* Method marshal\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param handler\r
*/\r
public void marshal(org.xml.sax.ContentHandler handler)\r
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException, \r
+ org.exolab.castor.xml.ValidationException\r
{\r
- \r
Marshaller.marshal(this, handler);\r
- } //-- void marshal(org.xml.sax.ContentHandler) \r
+ }\r
+\r
+ //-- void marshal(org.xml.sax.ContentHandler) \r
\r
/**\r
* Method unmarshal\r
- * \r
- * \r
- * \r
+ *\r
+ *\r
+ *\r
* @param reader\r
* @return Object\r
*/\r
public static java.lang.Object unmarshal(java.io.Reader reader)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+ throws org.exolab.castor.xml.MarshalException, \r
+ org.exolab.castor.xml.ValidationException\r
{\r
- return (jalview.binding.VamsasModel) Unmarshaller.unmarshal(jalview.binding.VamsasModel.class, reader);\r
- } //-- java.lang.Object unmarshal(java.io.Reader) \r
+ return (jalview.binding.VamsasModel) Unmarshaller.unmarshal(jalview.binding.VamsasModel.class,\r
+ reader);\r
+ }\r
+\r
+ //-- java.lang.Object unmarshal(java.io.Reader) \r
\r
/**\r
* Method validate\r
- * \r
+ *\r
*/\r
- public void validate()\r
- throws org.exolab.castor.xml.ValidationException\r
+ public void validate() throws org.exolab.castor.xml.ValidationException\r
{\r
org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
validator.validate(this);\r
- } //-- void validate() \r
+ }\r
\r
+ //-- void validate() \r
}\r
/*\r
- * This class was automatically generated with \r
+ * This class was automatically generated with\r
* <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
* Schema.\r
* $Id$\r
\r
package jalview.binding;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
-import java.io.IOException;\r
-import java.io.Reader;\r
-import java.io.Serializable;\r
-import java.io.Writer;\r
-import org.exolab.castor.xml.MarshalException;\r
-import org.exolab.castor.xml.Marshaller;\r
-import org.exolab.castor.xml.Unmarshaller;\r
-import org.exolab.castor.xml.ValidationException;\r
-import org.xml.sax.ContentHandler;\r
+import org.exolab.castor.xml.*;\r
\r
/**\r
* Class Viewport.\r
- * \r
+ *\r
* @version $Revision$ $Date$\r
*/\r
-public class Viewport implements java.io.Serializable {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _conservationSelected\r
- */\r
- private boolean _conservationSelected;\r
-\r
- /**\r
- * keeps track of state for field: _conservationSelected\r
- */\r
- private boolean _has_conservationSelected;\r
-\r
- /**\r
- * Field _pidSelected\r
- */\r
- private boolean _pidSelected;\r
-\r
- /**\r
- * keeps track of state for field: _pidSelected\r
- */\r
- private boolean _has_pidSelected;\r
-\r
- /**\r
- * Field _bgColour\r
- */\r
- private java.lang.String _bgColour;\r
-\r
- /**\r
- * Field _consThreshold\r
- */\r
- private int _consThreshold;\r
-\r
- /**\r
- * keeps track of state for field: _consThreshold\r
- */\r
- private boolean _has_consThreshold;\r
-\r
- /**\r
- * Field _pidThreshold\r
- */\r
- private int _pidThreshold;\r
-\r
- /**\r
- * keeps track of state for field: _pidThreshold\r
- */\r
- private boolean _has_pidThreshold;\r
-\r
- /**\r
- * Field _title\r
- */\r
- private java.lang.String _title;\r
-\r
- /**\r
- * Field _showFullId\r
- */\r
- private boolean _showFullId;\r
-\r
- /**\r
- * keeps track of state for field: _showFullId\r
- */\r
- private boolean _has_showFullId;\r
-\r
- /**\r
- * Field _showText\r
- */\r
- private boolean _showText;\r
-\r
- /**\r
- * keeps track of state for field: _showText\r
- */\r
- private boolean _has_showText;\r
-\r
- /**\r
- * Field _showColourText\r
- */\r
- private boolean _showColourText;\r
-\r
- /**\r
- * keeps track of state for field: _showColourText\r
- */\r
- private boolean _has_showColourText;\r
-\r
- /**\r
- * Field _showBoxes\r
- */\r
- private boolean _showBoxes;\r
-\r
- /**\r
- * keeps track of state for field: _showBoxes\r
- */\r
- private boolean _has_showBoxes;\r
-\r
- /**\r
- * Field _wrapAlignment\r
- */\r
- private boolean _wrapAlignment;\r
-\r
- /**\r
- * keeps track of state for field: _wrapAlignment\r
- */\r
- private boolean _has_wrapAlignment;\r
-\r
- /**\r
- * Field _renderGaps\r
- */\r
- private boolean _renderGaps;\r
-\r
- /**\r
- * keeps track of state for field: _renderGaps\r
- */\r
- private boolean _has_renderGaps;\r
-\r
- /**\r
- * Field _showSequenceFeatures\r
- */\r
- private boolean _showSequenceFeatures;\r
-\r
- /**\r
- * keeps track of state for field: _showSequenceFeatures\r
- */\r
- private boolean _has_showSequenceFeatures;\r
-\r
- /**\r
- * Field _showAnnotation\r
- */\r
- private boolean _showAnnotation;\r
-\r
- /**\r
- * keeps track of state for field: _showAnnotation\r
- */\r
- private boolean _has_showAnnotation;\r
-\r
- /**\r
- * Field _showConservation\r
- */\r
- private boolean _showConservation;\r
-\r
- /**\r
- * keeps track of state for field: _showConservation\r
- */\r
- private boolean _has_showConservation;\r
-\r
- /**\r
- * Field _showQuality\r
- */\r
- private boolean _showQuality;\r
-\r
- /**\r
- * keeps track of state for field: _showQuality\r
- */\r
- private boolean _has_showQuality;\r
-\r
- /**\r
- * Field _showIdentity\r
- */\r
- private boolean _showIdentity;\r
-\r
- /**\r
- * keeps track of state for field: _showIdentity\r
- */\r
- private boolean _has_showIdentity;\r
-\r
- /**\r
- * Field _xpos\r
- */\r
- private int _xpos;\r
-\r
- /**\r
- * keeps track of state for field: _xpos\r
- */\r
- private boolean _has_xpos;\r
-\r
- /**\r
- * Field _ypos\r
- */\r
- private int _ypos;\r
-\r
- /**\r
- * keeps track of state for field: _ypos\r
- */\r
- private boolean _has_ypos;\r
-\r
- /**\r
- * Field _width\r
- */\r
- private int _width;\r
-\r
- /**\r
- * keeps track of state for field: _width\r
- */\r
- private boolean _has_width;\r
-\r
- /**\r
- * Field _height\r
- */\r
- private int _height;\r
-\r
- /**\r
- * keeps track of state for field: _height\r
- */\r
- private boolean _has_height;\r
-\r
- /**\r
- * Field _startRes\r
- */\r
- private int _startRes;\r
-\r
- /**\r
- * keeps track of state for field: _startRes\r
- */\r
- private boolean _has_startRes;\r
-\r
- /**\r
- * Field _startSeq\r
- */\r
- private int _startSeq;\r
-\r
- /**\r
- * keeps track of state for field: _startSeq\r
- */\r
- private boolean _has_startSeq;\r
-\r
- /**\r
- * Field _fontName\r
- */\r
- private java.lang.String _fontName;\r
-\r
- /**\r
- * Field _fontSize\r
- */\r
- private int _fontSize;\r
-\r
- /**\r
- * keeps track of state for field: _fontSize\r
- */\r
- private boolean _has_fontSize;\r
-\r
- /**\r
- * Field _fontStyle\r
- */\r
- private int _fontStyle;\r
-\r
- /**\r
- * keeps track of state for field: _fontStyle\r
- */\r
- private boolean _has_fontStyle;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public Viewport() {\r
- super();\r
- } //-- jalview.binding.Viewport()\r
-\r
-\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
-\r
- /**\r
- * Method deleteConsThreshold\r
- * \r
- */\r
- public void deleteConsThreshold()\r
- {\r
- this._has_consThreshold= false;\r
- } //-- void deleteConsThreshold() \r
-\r
- /**\r
- * Method deleteConservationSelected\r
- * \r
- */\r
- public void deleteConservationSelected()\r
- {\r
- this._has_conservationSelected= false;\r
- } //-- void deleteConservationSelected() \r
-\r
- /**\r
- * Method deleteFontSize\r
- * \r
- */\r
- public void deleteFontSize()\r
- {\r
- this._has_fontSize= false;\r
- } //-- void deleteFontSize() \r
-\r
- /**\r
- * Method deleteFontStyle\r
- * \r
- */\r
- public void deleteFontStyle()\r
- {\r
- this._has_fontStyle= false;\r
- } //-- void deleteFontStyle() \r
-\r
- /**\r
- * Method deleteHeight\r
- * \r
- */\r
- public void deleteHeight()\r
- {\r
- this._has_height= false;\r
- } //-- void deleteHeight() \r
-\r
- /**\r
- * Method deletePidSelected\r
- * \r
- */\r
- public void deletePidSelected()\r
- {\r
- this._has_pidSelected= false;\r
- } //-- void deletePidSelected() \r
-\r
- /**\r
- * Method deletePidThreshold\r
- * \r
- */\r
- public void deletePidThreshold()\r
- {\r
- this._has_pidThreshold= false;\r
- } //-- void deletePidThreshold() \r
-\r
- /**\r
- * Method deleteRenderGaps\r
- * \r
- */\r
- public void deleteRenderGaps()\r
- {\r
- this._has_renderGaps= false;\r
- } //-- void deleteRenderGaps() \r
-\r
- /**\r
- * Method deleteShowAnnotation\r
- * \r
- */\r
- public void deleteShowAnnotation()\r
- {\r
- this._has_showAnnotation= false;\r
- } //-- void deleteShowAnnotation() \r
-\r
- /**\r
- * Method deleteShowBoxes\r
- * \r
- */\r
- public void deleteShowBoxes()\r
- {\r
- this._has_showBoxes= false;\r
- } //-- void deleteShowBoxes() \r
-\r
- /**\r
- * Method deleteShowColourText\r
- * \r
- */\r
- public void deleteShowColourText()\r
- {\r
- this._has_showColourText= false;\r
- } //-- void deleteShowColourText() \r
-\r
- /**\r
- * Method deleteShowConservation\r
- * \r
- */\r
- public void deleteShowConservation()\r
- {\r
- this._has_showConservation= false;\r
- } //-- void deleteShowConservation() \r
-\r
- /**\r
- * Method deleteShowFullId\r
- * \r
- */\r
- public void deleteShowFullId()\r
- {\r
- this._has_showFullId= false;\r
- } //-- void deleteShowFullId() \r
-\r
- /**\r
- * Method deleteShowIdentity\r
- * \r
- */\r
- public void deleteShowIdentity()\r
- {\r
- this._has_showIdentity= false;\r
- } //-- void deleteShowIdentity() \r
-\r
- /**\r
- * Method deleteShowQuality\r
- * \r
- */\r
- public void deleteShowQuality()\r
- {\r
- this._has_showQuality= false;\r
- } //-- void deleteShowQuality() \r
-\r
- /**\r
- * Method deleteShowSequenceFeatures\r
- * \r
- */\r
- public void deleteShowSequenceFeatures()\r
- {\r
- this._has_showSequenceFeatures= false;\r
- } //-- void deleteShowSequenceFeatures() \r
-\r
- /**\r
- * Method deleteShowText\r
- * \r
- */\r
- public void deleteShowText()\r
- {\r
- this._has_showText= false;\r
- } //-- void deleteShowText() \r
-\r
- /**\r
- * Method deleteStartRes\r
- * \r
- */\r
- public void deleteStartRes()\r
- {\r
- this._has_startRes= false;\r
- } //-- void deleteStartRes() \r
-\r
- /**\r
- * Method deleteStartSeq\r
- * \r
- */\r
- public void deleteStartSeq()\r
- {\r
- this._has_startSeq= false;\r
- } //-- void deleteStartSeq() \r
-\r
- /**\r
- * Method deleteWidth\r
- * \r
- */\r
- public void deleteWidth()\r
- {\r
- this._has_width= false;\r
- } //-- void deleteWidth() \r
-\r
- /**\r
- * Method deleteWrapAlignment\r
- * \r
- */\r
- public void deleteWrapAlignment()\r
- {\r
- this._has_wrapAlignment= false;\r
- } //-- void deleteWrapAlignment() \r
-\r
- /**\r
- * Method deleteXpos\r
- * \r
- */\r
- public void deleteXpos()\r
- {\r
- this._has_xpos= false;\r
- } //-- void deleteXpos() \r
-\r
- /**\r
- * Method deleteYpos\r
- * \r
- */\r
- public void deleteYpos()\r
- {\r
- this._has_ypos= false;\r
- } //-- void deleteYpos() \r
-\r
- /**\r
- * Returns the value of field 'bgColour'.\r
- * \r
- * @return String\r
- * @return the value of field 'bgColour'.\r
- */\r
- public java.lang.String getBgColour()\r
- {\r
- return this._bgColour;\r
- } //-- java.lang.String getBgColour() \r
-\r
- /**\r
- * Returns the value of field 'consThreshold'.\r
- * \r
- * @return int\r
- * @return the value of field 'consThreshold'.\r
- */\r
- public int getConsThreshold()\r
- {\r
- return this._consThreshold;\r
- } //-- int getConsThreshold() \r
-\r
- /**\r
- * Returns the value of field 'conservationSelected'.\r
- * \r
- * @return boolean\r
- * @return the value of field 'conservationSelected'.\r
- */\r
- public boolean getConservationSelected()\r
- {\r
- return this._conservationSelected;\r
- } //-- boolean getConservationSelected() \r
-\r
- /**\r
- * Returns the value of field 'fontName'.\r
- * \r
- * @return String\r
- * @return the value of field 'fontName'.\r
- */\r
- public java.lang.String getFontName()\r
- {\r
- return this._fontName;\r
- } //-- java.lang.String getFontName() \r
-\r
- /**\r
- * Returns the value of field 'fontSize'.\r
- * \r
- * @return int\r
- * @return the value of field 'fontSize'.\r
- */\r
- public int getFontSize()\r
- {\r
- return this._fontSize;\r
- } //-- int getFontSize() \r
-\r
- /**\r
- * Returns the value of field 'fontStyle'.\r
- * \r
- * @return int\r
- * @return the value of field 'fontStyle'.\r
- */\r
- public int getFontStyle()\r
- {\r
- return this._fontStyle;\r
- } //-- int getFontStyle() \r
-\r
- /**\r
- * Returns the value of field 'height'.\r
- * \r
- * @return int\r
- * @return the value of field 'height'.\r
- */\r
- public int getHeight()\r
- {\r
- return this._height;\r
- } //-- int getHeight() \r
-\r
- /**\r
- * Returns the value of field 'pidSelected'.\r
- * \r
- * @return boolean\r
- * @return the value of field 'pidSelected'.\r
- */\r
- public boolean getPidSelected()\r
- {\r
- return this._pidSelected;\r
- } //-- boolean getPidSelected() \r
-\r
- /**\r
- * Returns the value of field 'pidThreshold'.\r
- * \r
- * @return int\r
- * @return the value of field 'pidThreshold'.\r
- */\r
- public int getPidThreshold()\r
- {\r
- return this._pidThreshold;\r
- } //-- int getPidThreshold() \r
-\r
- /**\r
- * Returns the value of field 'renderGaps'.\r
- * \r
- * @return boolean\r
- * @return the value of field 'renderGaps'.\r
- */\r
- public boolean getRenderGaps()\r
- {\r
- return this._renderGaps;\r
- } //-- boolean getRenderGaps() \r
-\r
- /**\r
- * Returns the value of field 'showAnnotation'.\r
- * \r
- * @return boolean\r
- * @return the value of field 'showAnnotation'.\r
- */\r
- public boolean getShowAnnotation()\r
- {\r
- return this._showAnnotation;\r
- } //-- boolean getShowAnnotation() \r
-\r
- /**\r
- * Returns the value of field 'showBoxes'.\r
- * \r
- * @return boolean\r
- * @return the value of field 'showBoxes'.\r
- */\r
- public boolean getShowBoxes()\r
- {\r
- return this._showBoxes;\r
- } //-- boolean getShowBoxes() \r
-\r
- /**\r
- * Returns the value of field 'showColourText'.\r
- * \r
- * @return boolean\r
- * @return the value of field 'showColourText'.\r
- */\r
- public boolean getShowColourText()\r
- {\r
- return this._showColourText;\r
- } //-- boolean getShowColourText() \r
-\r
- /**\r
- * Returns the value of field 'showConservation'.\r
- * \r
- * @return boolean\r
- * @return the value of field 'showConservation'.\r
- */\r
- public boolean getShowConservation()\r
- {\r
- return this._showConservation;\r
- } //-- boolean getShowConservation() \r
-\r
- /**\r
- * Returns the value of field 'showFullId'.\r
- * \r
- * @return boolean\r
- * @return the value of field 'showFullId'.\r
- */\r
- public boolean getShowFullId()\r
- {\r
- return this._showFullId;\r
- } //-- boolean getShowFullId() \r
-\r
- /**\r
- * Returns the value of field 'showIdentity'.\r
- * \r
- * @return boolean\r
- * @return the value of field 'showIdentity'.\r
- */\r
- public boolean getShowIdentity()\r
- {\r
- return this._showIdentity;\r
- } //-- boolean getShowIdentity() \r
-\r
- /**\r
- * Returns the value of field 'showQuality'.\r
- * \r
- * @return boolean\r
- * @return the value of field 'showQuality'.\r
- */\r
- public boolean getShowQuality()\r
- {\r
- return this._showQuality;\r
- } //-- boolean getShowQuality() \r
-\r
- /**\r
- * Returns the value of field 'showSequenceFeatures'.\r
- * \r
- * @return boolean\r
- * @return the value of field 'showSequenceFeatures'.\r
- */\r
- public boolean getShowSequenceFeatures()\r
- {\r
- return this._showSequenceFeatures;\r
- } //-- boolean getShowSequenceFeatures() \r
-\r
- /**\r
- * Returns the value of field 'showText'.\r
- * \r
- * @return boolean\r
- * @return the value of field 'showText'.\r
- */\r
- public boolean getShowText()\r
- {\r
- return this._showText;\r
- } //-- boolean getShowText() \r
-\r
- /**\r
- * Returns the value of field 'startRes'.\r
- * \r
- * @return int\r
- * @return the value of field 'startRes'.\r
- */\r
- public int getStartRes()\r
- {\r
- return this._startRes;\r
- } //-- int getStartRes() \r
-\r
- /**\r
- * Returns the value of field 'startSeq'.\r
- * \r
- * @return int\r
- * @return the value of field 'startSeq'.\r
- */\r
- public int getStartSeq()\r
- {\r
- return this._startSeq;\r
- } //-- int getStartSeq() \r
-\r
- /**\r
- * Returns the value of field 'title'.\r
- * \r
- * @return String\r
- * @return the value of field 'title'.\r
- */\r
- public java.lang.String getTitle()\r
- {\r
- return this._title;\r
- } //-- java.lang.String getTitle() \r
-\r
- /**\r
- * Returns the value of field 'width'.\r
- * \r
- * @return int\r
- * @return the value of field 'width'.\r
- */\r
- public int getWidth()\r
- {\r
- return this._width;\r
- } //-- int getWidth() \r
-\r
- /**\r
- * Returns the value of field 'wrapAlignment'.\r
- * \r
- * @return boolean\r
- * @return the value of field 'wrapAlignment'.\r
- */\r
- public boolean getWrapAlignment()\r
- {\r
- return this._wrapAlignment;\r
- } //-- boolean getWrapAlignment() \r
-\r
- /**\r
- * Returns the value of field 'xpos'.\r
- * \r
- * @return int\r
- * @return the value of field 'xpos'.\r
- */\r
- public int getXpos()\r
- {\r
- return this._xpos;\r
- } //-- int getXpos() \r
-\r
- /**\r
- * Returns the value of field 'ypos'.\r
- * \r
- * @return int\r
- * @return the value of field 'ypos'.\r
- */\r
- public int getYpos()\r
- {\r
- return this._ypos;\r
- } //-- int getYpos() \r
-\r
- /**\r
- * Method hasConsThreshold\r
- * \r
- * \r
- * \r
- * @return boolean\r
- */\r
- public boolean hasConsThreshold()\r
- {\r
- return this._has_consThreshold;\r
- } //-- boolean hasConsThreshold() \r
-\r
- /**\r
- * Method hasConservationSelected\r
- * \r
- * \r
- * \r
- * @return boolean\r
- */\r
- public boolean hasConservationSelected()\r
- {\r
- return this._has_conservationSelected;\r
- } //-- boolean hasConservationSelected() \r
-\r
- /**\r
- * Method hasFontSize\r
- * \r
- * \r
- * \r
- * @return boolean\r
- */\r
- public boolean hasFontSize()\r
- {\r
- return this._has_fontSize;\r
- } //-- boolean hasFontSize() \r
-\r
- /**\r
- * Method hasFontStyle\r
- * \r
- * \r
- * \r
- * @return boolean\r
- */\r
- public boolean hasFontStyle()\r
- {\r
- return this._has_fontStyle;\r
- } //-- boolean hasFontStyle() \r
-\r
- /**\r
- * Method hasHeight\r
- * \r
- * \r
- * \r
- * @return boolean\r
- */\r
- public boolean hasHeight()\r
- {\r
- return this._has_height;\r
- } //-- boolean hasHeight() \r
-\r
- /**\r
- * Method hasPidSelected\r
- * \r
- * \r
- * \r
- * @return boolean\r
- */\r
- public boolean hasPidSelected()\r
- {\r
- return this._has_pidSelected;\r
- } //-- boolean hasPidSelected() \r
-\r
- /**\r
- * Method hasPidThreshold\r
- * \r
- * \r
- * \r
- * @return boolean\r
- */\r
- public boolean hasPidThreshold()\r
- {\r
- return this._has_pidThreshold;\r
- } //-- boolean hasPidThreshold() \r
-\r
- /**\r
- * Method hasRenderGaps\r
- * \r
- * \r
- * \r
- * @return boolean\r
- */\r
- public boolean hasRenderGaps()\r
- {\r
- return this._has_renderGaps;\r
- } //-- boolean hasRenderGaps() \r
-\r
- /**\r
- * Method hasShowAnnotation\r
- * \r
- * \r
- * \r
- * @return boolean\r
- */\r
- public boolean hasShowAnnotation()\r
- {\r
- return this._has_showAnnotation;\r
- } //-- boolean hasShowAnnotation() \r
-\r
- /**\r
- * Method hasShowBoxes\r
- * \r
- * \r
- * \r
- * @return boolean\r
- */\r
- public boolean hasShowBoxes()\r
- {\r
- return this._has_showBoxes;\r
- } //-- boolean hasShowBoxes() \r
-\r
- /**\r
- * Method hasShowColourText\r
- * \r
- * \r
- * \r
- * @return boolean\r
- */\r
- public boolean hasShowColourText()\r
- {\r
- return this._has_showColourText;\r
- } //-- boolean hasShowColourText() \r
-\r
- /**\r
- * Method hasShowConservation\r
- * \r
- * \r
- * \r
- * @return boolean\r
- */\r
- public boolean hasShowConservation()\r
- {\r
- return this._has_showConservation;\r
- } //-- boolean hasShowConservation() \r
-\r
- /**\r
- * Method hasShowFullId\r
- * \r
- * \r
- * \r
- * @return boolean\r
- */\r
- public boolean hasShowFullId()\r
- {\r
- return this._has_showFullId;\r
- } //-- boolean hasShowFullId() \r
-\r
- /**\r
- * Method hasShowIdentity\r
- * \r
- * \r
- * \r
- * @return boolean\r
- */\r
- public boolean hasShowIdentity()\r
- {\r
- return this._has_showIdentity;\r
- } //-- boolean hasShowIdentity() \r
-\r
- /**\r
- * Method hasShowQuality\r
- * \r
- * \r
- * \r
- * @return boolean\r
- */\r
- public boolean hasShowQuality()\r
- {\r
- return this._has_showQuality;\r
- } //-- boolean hasShowQuality() \r
-\r
- /**\r
- * Method hasShowSequenceFeatures\r
- * \r
- * \r
- * \r
- * @return boolean\r
- */\r
- public boolean hasShowSequenceFeatures()\r
- {\r
- return this._has_showSequenceFeatures;\r
- } //-- boolean hasShowSequenceFeatures() \r
-\r
- /**\r
- * Method hasShowText\r
- * \r
- * \r
- * \r
- * @return boolean\r
- */\r
- public boolean hasShowText()\r
- {\r
- return this._has_showText;\r
- } //-- boolean hasShowText() \r
-\r
- /**\r
- * Method hasStartRes\r
- * \r
- * \r
- * \r
- * @return boolean\r
- */\r
- public boolean hasStartRes()\r
- {\r
- return this._has_startRes;\r
- } //-- boolean hasStartRes() \r
-\r
- /**\r
- * Method hasStartSeq\r
- * \r
- * \r
- * \r
- * @return boolean\r
- */\r
- public boolean hasStartSeq()\r
- {\r
- return this._has_startSeq;\r
- } //-- boolean hasStartSeq() \r
-\r
- /**\r
- * Method hasWidth\r
- * \r
- * \r
- * \r
- * @return boolean\r
- */\r
- public boolean hasWidth()\r
- {\r
- return this._has_width;\r
- } //-- boolean hasWidth() \r
-\r
- /**\r
- * Method hasWrapAlignment\r
- * \r
- * \r
- * \r
- * @return boolean\r
- */\r
- public boolean hasWrapAlignment()\r
- {\r
- return this._has_wrapAlignment;\r
- } //-- boolean hasWrapAlignment() \r
-\r
- /**\r
- * Method hasXpos\r
- * \r
- * \r
- * \r
- * @return boolean\r
- */\r
- public boolean hasXpos()\r
- {\r
- return this._has_xpos;\r
- } //-- boolean hasXpos() \r
-\r
- /**\r
- * Method hasYpos\r
- * \r
- * \r
- * \r
- * @return boolean\r
- */\r
- public boolean hasYpos()\r
- {\r
- return this._has_ypos;\r
- } //-- boolean hasYpos() \r
-\r
- /**\r
- * Method isValid\r
- * \r
- * \r
- * \r
- * @return boolean\r
- */\r
- public boolean isValid()\r
- {\r
- try {\r
- validate();\r
- }\r
- catch (org.exolab.castor.xml.ValidationException vex) {\r
- return false;\r
- }\r
- return true;\r
- } //-- boolean isValid() \r
-\r
- /**\r
- * Method marshal\r
- * \r
- * \r
- * \r
- * @param out\r
- */\r
- public void marshal(java.io.Writer out)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
- {\r
- \r
- Marshaller.marshal(this, out);\r
- } //-- void marshal(java.io.Writer) \r
-\r
- /**\r
- * Method marshal\r
- * \r
- * \r
- * \r
- * @param handler\r
- */\r
- public void marshal(org.xml.sax.ContentHandler handler)\r
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
- {\r
- \r
- Marshaller.marshal(this, handler);\r
- } //-- void marshal(org.xml.sax.ContentHandler) \r
-\r
- /**\r
- * Sets the value of field 'bgColour'.\r
- * \r
- * @param bgColour the value of field 'bgColour'.\r
- */\r
- public void setBgColour(java.lang.String bgColour)\r
- {\r
- this._bgColour = bgColour;\r
- } //-- void setBgColour(java.lang.String) \r
-\r
- /**\r
- * Sets the value of field 'consThreshold'.\r
- * \r
- * @param consThreshold the value of field 'consThreshold'.\r
- */\r
- public void setConsThreshold(int consThreshold)\r
- {\r
- this._consThreshold = consThreshold;\r
- this._has_consThreshold = true;\r
- } //-- void setConsThreshold(int) \r
-\r
- /**\r
- * Sets the value of field 'conservationSelected'.\r
- * \r
- * @param conservationSelected the value of field\r
- * 'conservationSelected'.\r
- */\r
- public void setConservationSelected(boolean conservationSelected)\r
- {\r
- this._conservationSelected = conservationSelected;\r
- this._has_conservationSelected = true;\r
- } //-- void setConservationSelected(boolean) \r
-\r
- /**\r
- * Sets the value of field 'fontName'.\r
- * \r
- * @param fontName the value of field 'fontName'.\r
- */\r
- public void setFontName(java.lang.String fontName)\r
- {\r
- this._fontName = fontName;\r
- } //-- void setFontName(java.lang.String) \r
-\r
- /**\r
- * Sets the value of field 'fontSize'.\r
- * \r
- * @param fontSize the value of field 'fontSize'.\r
- */\r
- public void setFontSize(int fontSize)\r
- {\r
- this._fontSize = fontSize;\r
- this._has_fontSize = true;\r
- } //-- void setFontSize(int) \r
-\r
- /**\r
- * Sets the value of field 'fontStyle'.\r
- * \r
- * @param fontStyle the value of field 'fontStyle'.\r
- */\r
- public void setFontStyle(int fontStyle)\r
- {\r
- this._fontStyle = fontStyle;\r
- this._has_fontStyle = true;\r
- } //-- void setFontStyle(int) \r
-\r
- /**\r
- * Sets the value of field 'height'.\r
- * \r
- * @param height the value of field 'height'.\r
- */\r
- public void setHeight(int height)\r
- {\r
- this._height = height;\r
- this._has_height = true;\r
- } //-- void setHeight(int) \r
-\r
- /**\r
- * Sets the value of field 'pidSelected'.\r
- * \r
- * @param pidSelected the value of field 'pidSelected'.\r
- */\r
- public void setPidSelected(boolean pidSelected)\r
- {\r
- this._pidSelected = pidSelected;\r
- this._has_pidSelected = true;\r
- } //-- void setPidSelected(boolean) \r
-\r
- /**\r
- * Sets the value of field 'pidThreshold'.\r
- * \r
- * @param pidThreshold the value of field 'pidThreshold'.\r
- */\r
- public void setPidThreshold(int pidThreshold)\r
- {\r
- this._pidThreshold = pidThreshold;\r
- this._has_pidThreshold = true;\r
- } //-- void setPidThreshold(int) \r
-\r
- /**\r
- * Sets the value of field 'renderGaps'.\r
- * \r
- * @param renderGaps the value of field 'renderGaps'.\r
- */\r
- public void setRenderGaps(boolean renderGaps)\r
- {\r
- this._renderGaps = renderGaps;\r
- this._has_renderGaps = true;\r
- } //-- void setRenderGaps(boolean) \r
-\r
- /**\r
- * Sets the value of field 'showAnnotation'.\r
- * \r
- * @param showAnnotation the value of field 'showAnnotation'.\r
- */\r
- public void setShowAnnotation(boolean showAnnotation)\r
- {\r
- this._showAnnotation = showAnnotation;\r
- this._has_showAnnotation = true;\r
- } //-- void setShowAnnotation(boolean) \r
-\r
- /**\r
- * Sets the value of field 'showBoxes'.\r
- * \r
- * @param showBoxes the value of field 'showBoxes'.\r
- */\r
- public void setShowBoxes(boolean showBoxes)\r
- {\r
- this._showBoxes = showBoxes;\r
- this._has_showBoxes = true;\r
- } //-- void setShowBoxes(boolean) \r
-\r
- /**\r
- * Sets the value of field 'showColourText'.\r
- * \r
- * @param showColourText the value of field 'showColourText'.\r
- */\r
- public void setShowColourText(boolean showColourText)\r
- {\r
- this._showColourText = showColourText;\r
- this._has_showColourText = true;\r
- } //-- void setShowColourText(boolean) \r
-\r
- /**\r
- * Sets the value of field 'showConservation'.\r
- * \r
- * @param showConservation the value of field 'showConservation'\r
- */\r
- public void setShowConservation(boolean showConservation)\r
- {\r
- this._showConservation = showConservation;\r
- this._has_showConservation = true;\r
- } //-- void setShowConservation(boolean) \r
-\r
- /**\r
- * Sets the value of field 'showFullId'.\r
- * \r
- * @param showFullId the value of field 'showFullId'.\r
- */\r
- public void setShowFullId(boolean showFullId)\r
- {\r
- this._showFullId = showFullId;\r
- this._has_showFullId = true;\r
- } //-- void setShowFullId(boolean) \r
-\r
- /**\r
- * Sets the value of field 'showIdentity'.\r
- * \r
- * @param showIdentity the value of field 'showIdentity'.\r
- */\r
- public void setShowIdentity(boolean showIdentity)\r
- {\r
- this._showIdentity = showIdentity;\r
- this._has_showIdentity = true;\r
- } //-- void setShowIdentity(boolean) \r
-\r
- /**\r
- * Sets the value of field 'showQuality'.\r
- * \r
- * @param showQuality the value of field 'showQuality'.\r
- */\r
- public void setShowQuality(boolean showQuality)\r
- {\r
- this._showQuality = showQuality;\r
- this._has_showQuality = true;\r
- } //-- void setShowQuality(boolean) \r
-\r
- /**\r
- * Sets the value of field 'showSequenceFeatures'.\r
- * \r
- * @param showSequenceFeatures the value of field\r
- * 'showSequenceFeatures'.\r
- */\r
- public void setShowSequenceFeatures(boolean showSequenceFeatures)\r
- {\r
- this._showSequenceFeatures = showSequenceFeatures;\r
- this._has_showSequenceFeatures = true;\r
- } //-- void setShowSequenceFeatures(boolean) \r
-\r
- /**\r
- * Sets the value of field 'showText'.\r
- * \r
- * @param showText the value of field 'showText'.\r
- */\r
- public void setShowText(boolean showText)\r
- {\r
- this._showText = showText;\r
- this._has_showText = true;\r
- } //-- void setShowText(boolean) \r
-\r
- /**\r
- * Sets the value of field 'startRes'.\r
- * \r
- * @param startRes the value of field 'startRes'.\r
- */\r
- public void setStartRes(int startRes)\r
- {\r
- this._startRes = startRes;\r
- this._has_startRes = true;\r
- } //-- void setStartRes(int) \r
-\r
- /**\r
- * Sets the value of field 'startSeq'.\r
- * \r
- * @param startSeq the value of field 'startSeq'.\r
- */\r
- public void setStartSeq(int startSeq)\r
- {\r
- this._startSeq = startSeq;\r
- this._has_startSeq = true;\r
- } //-- void setStartSeq(int) \r
-\r
- /**\r
- * Sets the value of field 'title'.\r
- * \r
- * @param title the value of field 'title'.\r
- */\r
- public void setTitle(java.lang.String title)\r
- {\r
- this._title = title;\r
- } //-- void setTitle(java.lang.String) \r
-\r
- /**\r
- * Sets the value of field 'width'.\r
- * \r
- * @param width the value of field 'width'.\r
- */\r
- public void setWidth(int width)\r
- {\r
- this._width = width;\r
- this._has_width = true;\r
- } //-- void setWidth(int) \r
-\r
- /**\r
- * Sets the value of field 'wrapAlignment'.\r
- * \r
- * @param wrapAlignment the value of field 'wrapAlignment'.\r
- */\r
- public void setWrapAlignment(boolean wrapAlignment)\r
- {\r
- this._wrapAlignment = wrapAlignment;\r
- this._has_wrapAlignment = true;\r
- } //-- void setWrapAlignment(boolean) \r
-\r
- /**\r
- * Sets the value of field 'xpos'.\r
- * \r
- * @param xpos the value of field 'xpos'.\r
- */\r
- public void setXpos(int xpos)\r
- {\r
- this._xpos = xpos;\r
- this._has_xpos = true;\r
- } //-- void setXpos(int) \r
-\r
- /**\r
- * Sets the value of field 'ypos'.\r
- * \r
- * @param ypos the value of field 'ypos'.\r
- */\r
- public void setYpos(int ypos)\r
- {\r
- this._ypos = ypos;\r
- this._has_ypos = true;\r
- } //-- void setYpos(int) \r
-\r
- /**\r
- * Method unmarshal\r
- * \r
- * \r
- * \r
- * @param reader\r
- * @return Object\r
- */\r
- public static java.lang.Object unmarshal(java.io.Reader reader)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
- {\r
- return (jalview.binding.Viewport) Unmarshaller.unmarshal(jalview.binding.Viewport.class, reader);\r
- } //-- java.lang.Object unmarshal(java.io.Reader) \r
-\r
- /**\r
- * Method validate\r
- * \r
- */\r
- public void validate()\r
- throws org.exolab.castor.xml.ValidationException\r
- {\r
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
- validator.validate(this);\r
- } //-- void validate() \r
+public class Viewport\r
+ implements java.io.Serializable\r
+{\r
+\r
+ //--------------------------/\r
+ //- Class/Member Variables -/\r
+ //--------------------------/\r
+\r
+ /**\r
+ * Field _conservationSelected\r
+ */\r
+ private boolean _conservationSelected;\r
+\r
+ /**\r
+ * keeps track of state for field: _conservationSelected\r
+ */\r
+ private boolean _has_conservationSelected;\r
+\r
+ /**\r
+ * Field _pidSelected\r
+ */\r
+ private boolean _pidSelected;\r
+\r
+ /**\r
+ * keeps track of state for field: _pidSelected\r
+ */\r
+ private boolean _has_pidSelected;\r
+\r
+ /**\r
+ * Field _bgColour\r
+ */\r
+ private java.lang.String _bgColour;\r
+\r
+ /**\r
+ * Field _consThreshold\r
+ */\r
+ private int _consThreshold;\r
+\r
+ /**\r
+ * keeps track of state for field: _consThreshold\r
+ */\r
+ private boolean _has_consThreshold;\r
+\r
+ /**\r
+ * Field _pidThreshold\r
+ */\r
+ private int _pidThreshold;\r
+\r
+ /**\r
+ * keeps track of state for field: _pidThreshold\r
+ */\r
+ private boolean _has_pidThreshold;\r
+\r
+ /**\r
+ * Field _title\r
+ */\r
+ private java.lang.String _title;\r
+\r
+ /**\r
+ * Field _showFullId\r
+ */\r
+ private boolean _showFullId;\r
+\r
+ /**\r
+ * keeps track of state for field: _showFullId\r
+ */\r
+ private boolean _has_showFullId;\r
+\r
+ /**\r
+ * Field _showText\r
+ */\r
+ private boolean _showText;\r
+\r
+ /**\r
+ * keeps track of state for field: _showText\r
+ */\r
+ private boolean _has_showText;\r
+\r
+ /**\r
+ * Field _showColourText\r
+ */\r
+ private boolean _showColourText;\r
+\r
+ /**\r
+ * keeps track of state for field: _showColourText\r
+ */\r
+ private boolean _has_showColourText;\r
+\r
+ /**\r
+ * Field _showBoxes\r
+ */\r
+ private boolean _showBoxes;\r
+\r
+ /**\r
+ * keeps track of state for field: _showBoxes\r
+ */\r
+ private boolean _has_showBoxes;\r
+\r
+ /**\r
+ * Field _wrapAlignment\r
+ */\r
+ private boolean _wrapAlignment;\r
+\r
+ /**\r
+ * keeps track of state for field: _wrapAlignment\r
+ */\r
+ private boolean _has_wrapAlignment;\r
+\r
+ /**\r
+ * Field _renderGaps\r
+ */\r
+ private boolean _renderGaps;\r
+\r
+ /**\r
+ * keeps track of state for field: _renderGaps\r
+ */\r
+ private boolean _has_renderGaps;\r
+\r
+ /**\r
+ * Field _showSequenceFeatures\r
+ */\r
+ private boolean _showSequenceFeatures;\r
+\r
+ /**\r
+ * keeps track of state for field: _showSequenceFeatures\r
+ */\r
+ private boolean _has_showSequenceFeatures;\r
+\r
+ /**\r
+ * Field _showAnnotation\r
+ */\r
+ private boolean _showAnnotation;\r
+\r
+ /**\r
+ * keeps track of state for field: _showAnnotation\r
+ */\r
+ private boolean _has_showAnnotation;\r
+\r
+ /**\r
+ * Field _showConservation\r
+ */\r
+ private boolean _showConservation;\r
+\r
+ /**\r
+ * keeps track of state for field: _showConservation\r
+ */\r
+ private boolean _has_showConservation;\r
+\r
+ /**\r
+ * Field _showQuality\r
+ */\r
+ private boolean _showQuality;\r
+\r
+ /**\r
+ * keeps track of state for field: _showQuality\r
+ */\r
+ private boolean _has_showQuality;\r
+\r
+ /**\r
+ * Field _showIdentity\r
+ */\r
+ private boolean _showIdentity;\r
+\r
+ /**\r
+ * keeps track of state for field: _showIdentity\r
+ */\r
+ private boolean _has_showIdentity;\r
+\r
+ /**\r
+ * Field _xpos\r
+ */\r
+ private int _xpos;\r
+\r
+ /**\r
+ * keeps track of state for field: _xpos\r
+ */\r
+ private boolean _has_xpos;\r
+\r
+ /**\r
+ * Field _ypos\r
+ */\r
+ private int _ypos;\r
+\r
+ /**\r
+ * keeps track of state for field: _ypos\r
+ */\r
+ private boolean _has_ypos;\r
+\r
+ /**\r
+ * Field _width\r
+ */\r
+ private int _width;\r
+\r
+ /**\r
+ * keeps track of state for field: _width\r
+ */\r
+ private boolean _has_width;\r
+\r
+ /**\r
+ * Field _height\r
+ */\r
+ private int _height;\r
+\r
+ /**\r
+ * keeps track of state for field: _height\r
+ */\r
+ private boolean _has_height;\r
+\r
+ /**\r
+ * Field _startRes\r
+ */\r
+ private int _startRes;\r
+\r
+ /**\r
+ * keeps track of state for field: _startRes\r
+ */\r
+ private boolean _has_startRes;\r
+\r
+ /**\r
+ * Field _startSeq\r
+ */\r
+ private int _startSeq;\r
+\r
+ /**\r
+ * keeps track of state for field: _startSeq\r
+ */\r
+ private boolean _has_startSeq;\r
+\r
+ /**\r
+ * Field _fontName\r
+ */\r
+ private java.lang.String _fontName;\r
+\r
+ /**\r
+ * Field _fontSize\r
+ */\r
+ private int _fontSize;\r
+\r
+ /**\r
+ * keeps track of state for field: _fontSize\r
+ */\r
+ private boolean _has_fontSize;\r
+\r
+ /**\r
+ * Field _fontStyle\r
+ */\r
+ private int _fontStyle;\r
+\r
+ /**\r
+ * keeps track of state for field: _fontStyle\r
+ */\r
+ private boolean _has_fontStyle;\r
+\r
+ //----------------/\r
+ //- Constructors -/\r
+ //----------------/\r
+\r
+ public Viewport()\r
+ {\r
+ super();\r
+ } //-- jalview.binding.Viewport()\r
+\r
+ //-----------/\r
+ //- Methods -/\r
+ //-----------/\r
+\r
+ /**\r
+ * Method deleteConsThreshold\r
+ *\r
+ */\r
+ public void deleteConsThreshold()\r
+ {\r
+ this._has_consThreshold = false;\r
+ } //-- void deleteConsThreshold()\r
+\r
+ /**\r
+ * Method deleteConservationSelected\r
+ *\r
+ */\r
+ public void deleteConservationSelected()\r
+ {\r
+ this._has_conservationSelected = false;\r
+ } //-- void deleteConservationSelected()\r
+\r
+ /**\r
+ * Method deleteFontSize\r
+ *\r
+ */\r
+ public void deleteFontSize()\r
+ {\r
+ this._has_fontSize = false;\r
+ } //-- void deleteFontSize()\r
+\r
+ /**\r
+ * Method deleteFontStyle\r
+ *\r
+ */\r
+ public void deleteFontStyle()\r
+ {\r
+ this._has_fontStyle = false;\r
+ } //-- void deleteFontStyle()\r
+\r
+ /**\r
+ * Method deleteHeight\r
+ *\r
+ */\r
+ public void deleteHeight()\r
+ {\r
+ this._has_height = false;\r
+ } //-- void deleteHeight()\r
+\r
+ /**\r
+ * Method deletePidSelected\r
+ *\r
+ */\r
+ public void deletePidSelected()\r
+ {\r
+ this._has_pidSelected = false;\r
+ } //-- void deletePidSelected()\r
+\r
+ /**\r
+ * Method deletePidThreshold\r
+ *\r
+ */\r
+ public void deletePidThreshold()\r
+ {\r
+ this._has_pidThreshold = false;\r
+ } //-- void deletePidThreshold()\r
+\r
+ /**\r
+ * Method deleteRenderGaps\r
+ *\r
+ */\r
+ public void deleteRenderGaps()\r
+ {\r
+ this._has_renderGaps = false;\r
+ } //-- void deleteRenderGaps()\r
+\r
+ /**\r
+ * Method deleteShowAnnotation\r
+ *\r
+ */\r
+ public void deleteShowAnnotation()\r
+ {\r
+ this._has_showAnnotation = false;\r
+ } //-- void deleteShowAnnotation()\r
+\r
+ /**\r
+ * Method deleteShowBoxes\r
+ *\r
+ */\r
+ public void deleteShowBoxes()\r
+ {\r
+ this._has_showBoxes = false;\r
+ } //-- void deleteShowBoxes()\r
+\r
+ /**\r
+ * Method deleteShowColourText\r
+ *\r
+ */\r
+ public void deleteShowColourText()\r
+ {\r
+ this._has_showColourText = false;\r
+ } //-- void deleteShowColourText()\r
+\r
+ /**\r
+ * Method deleteShowConservation\r
+ *\r
+ */\r
+ public void deleteShowConservation()\r
+ {\r
+ this._has_showConservation = false;\r
+ } //-- void deleteShowConservation()\r
+\r
+ /**\r
+ * Method deleteShowFullId\r
+ *\r
+ */\r
+ public void deleteShowFullId()\r
+ {\r
+ this._has_showFullId = false;\r
+ } //-- void deleteShowFullId()\r
+\r
+ /**\r
+ * Method deleteShowIdentity\r
+ *\r
+ */\r
+ public void deleteShowIdentity()\r
+ {\r
+ this._has_showIdentity = false;\r
+ } //-- void deleteShowIdentity()\r
+\r
+ /**\r
+ * Method deleteShowQuality\r
+ *\r
+ */\r
+ public void deleteShowQuality()\r
+ {\r
+ this._has_showQuality = false;\r
+ } //-- void deleteShowQuality()\r
+\r
+ /**\r
+ * Method deleteShowSequenceFeatures\r
+ *\r
+ */\r
+ public void deleteShowSequenceFeatures()\r
+ {\r
+ this._has_showSequenceFeatures = false;\r
+ } //-- void deleteShowSequenceFeatures()\r
+\r
+ /**\r
+ * Method deleteShowText\r
+ *\r
+ */\r
+ public void deleteShowText()\r
+ {\r
+ this._has_showText = false;\r
+ } //-- void deleteShowText()\r
+\r
+ /**\r
+ * Method deleteStartRes\r
+ *\r
+ */\r
+ public void deleteStartRes()\r
+ {\r
+ this._has_startRes = false;\r
+ } //-- void deleteStartRes()\r
+\r
+ /**\r
+ * Method deleteStartSeq\r
+ *\r
+ */\r
+ public void deleteStartSeq()\r
+ {\r
+ this._has_startSeq = false;\r
+ } //-- void deleteStartSeq()\r
+\r
+ /**\r
+ * Method deleteWidth\r
+ *\r
+ */\r
+ public void deleteWidth()\r
+ {\r
+ this._has_width = false;\r
+ } //-- void deleteWidth()\r
+\r
+ /**\r
+ * Method deleteWrapAlignment\r
+ *\r
+ */\r
+ public void deleteWrapAlignment()\r
+ {\r
+ this._has_wrapAlignment = false;\r
+ } //-- void deleteWrapAlignment()\r
+\r
+ /**\r
+ * Method deleteXpos\r
+ *\r
+ */\r
+ public void deleteXpos()\r
+ {\r
+ this._has_xpos = false;\r
+ } //-- void deleteXpos()\r
+\r
+ /**\r
+ * Method deleteYpos\r
+ *\r
+ */\r
+ public void deleteYpos()\r
+ {\r
+ this._has_ypos = false;\r
+ } //-- void deleteYpos()\r
+\r
+ /**\r
+ * Returns the value of field 'bgColour'.\r
+ *\r
+ * @return String\r
+ * @return the value of field 'bgColour'.\r
+ */\r
+ public java.lang.String getBgColour()\r
+ {\r
+ return this._bgColour;\r
+ } //-- java.lang.String getBgColour()\r
+\r
+ /**\r
+ * Returns the value of field 'consThreshold'.\r
+ *\r
+ * @return int\r
+ * @return the value of field 'consThreshold'.\r
+ */\r
+ public int getConsThreshold()\r
+ {\r
+ return this._consThreshold;\r
+ } //-- int getConsThreshold()\r
+\r
+ /**\r
+ * Returns the value of field 'conservationSelected'.\r
+ *\r
+ * @return boolean\r
+ * @return the value of field 'conservationSelected'.\r
+ */\r
+ public boolean getConservationSelected()\r
+ {\r
+ return this._conservationSelected;\r
+ } //-- boolean getConservationSelected()\r
+\r
+ /**\r
+ * Returns the value of field 'fontName'.\r
+ *\r
+ * @return String\r
+ * @return the value of field 'fontName'.\r
+ */\r
+ public java.lang.String getFontName()\r
+ {\r
+ return this._fontName;\r
+ } //-- java.lang.String getFontName()\r
+\r
+ /**\r
+ * Returns the value of field 'fontSize'.\r
+ *\r
+ * @return int\r
+ * @return the value of field 'fontSize'.\r
+ */\r
+ public int getFontSize()\r
+ {\r
+ return this._fontSize;\r
+ } //-- int getFontSize()\r
+\r
+ /**\r
+ * Returns the value of field 'fontStyle'.\r
+ *\r
+ * @return int\r
+ * @return the value of field 'fontStyle'.\r
+ */\r
+ public int getFontStyle()\r
+ {\r
+ return this._fontStyle;\r
+ } //-- int getFontStyle()\r
+\r
+ /**\r
+ * Returns the value of field 'height'.\r
+ *\r
+ * @return int\r
+ * @return the value of field 'height'.\r
+ */\r
+ public int getHeight()\r
+ {\r
+ return this._height;\r
+ } //-- int getHeight()\r
+\r
+ /**\r
+ * Returns the value of field 'pidSelected'.\r
+ *\r
+ * @return boolean\r
+ * @return the value of field 'pidSelected'.\r
+ */\r
+ public boolean getPidSelected()\r
+ {\r
+ return this._pidSelected;\r
+ } //-- boolean getPidSelected()\r
+\r
+ /**\r
+ * Returns the value of field 'pidThreshold'.\r
+ *\r
+ * @return int\r
+ * @return the value of field 'pidThreshold'.\r
+ */\r
+ public int getPidThreshold()\r
+ {\r
+ return this._pidThreshold;\r
+ } //-- int getPidThreshold()\r
+\r
+ /**\r
+ * Returns the value of field 'renderGaps'.\r
+ *\r
+ * @return boolean\r
+ * @return the value of field 'renderGaps'.\r
+ */\r
+ public boolean getRenderGaps()\r
+ {\r
+ return this._renderGaps;\r
+ } //-- boolean getRenderGaps()\r
+\r
+ /**\r
+ * Returns the value of field 'showAnnotation'.\r
+ *\r
+ * @return boolean\r
+ * @return the value of field 'showAnnotation'.\r
+ */\r
+ public boolean getShowAnnotation()\r
+ {\r
+ return this._showAnnotation;\r
+ } //-- boolean getShowAnnotation()\r
+\r
+ /**\r
+ * Returns the value of field 'showBoxes'.\r
+ *\r
+ * @return boolean\r
+ * @return the value of field 'showBoxes'.\r
+ */\r
+ public boolean getShowBoxes()\r
+ {\r
+ return this._showBoxes;\r
+ } //-- boolean getShowBoxes()\r
+\r
+ /**\r
+ * Returns the value of field 'showColourText'.\r
+ *\r
+ * @return boolean\r
+ * @return the value of field 'showColourText'.\r
+ */\r
+ public boolean getShowColourText()\r
+ {\r
+ return this._showColourText;\r
+ } //-- boolean getShowColourText()\r
+\r
+ /**\r
+ * Returns the value of field 'showConservation'.\r
+ *\r
+ * @return boolean\r
+ * @return the value of field 'showConservation'.\r
+ */\r
+ public boolean getShowConservation()\r
+ {\r
+ return this._showConservation;\r
+ } //-- boolean getShowConservation()\r
+\r
+ /**\r
+ * Returns the value of field 'showFullId'.\r
+ *\r
+ * @return boolean\r
+ * @return the value of field 'showFullId'.\r
+ */\r
+ public boolean getShowFullId()\r
+ {\r
+ return this._showFullId;\r
+ } //-- boolean getShowFullId()\r
+\r
+ /**\r
+ * Returns the value of field 'showIdentity'.\r
+ *\r
+ * @return boolean\r
+ * @return the value of field 'showIdentity'.\r
+ */\r
+ public boolean getShowIdentity()\r
+ {\r
+ return this._showIdentity;\r
+ } //-- boolean getShowIdentity()\r
+\r
+ /**\r
+ * Returns the value of field 'showQuality'.\r
+ *\r
+ * @return boolean\r
+ * @return the value of field 'showQuality'.\r
+ */\r
+ public boolean getShowQuality()\r
+ {\r
+ return this._showQuality;\r
+ } //-- boolean getShowQuality()\r
+\r
+ /**\r
+ * Returns the value of field 'showSequenceFeatures'.\r
+ *\r
+ * @return boolean\r
+ * @return the value of field 'showSequenceFeatures'.\r
+ */\r
+ public boolean getShowSequenceFeatures()\r
+ {\r
+ return this._showSequenceFeatures;\r
+ } //-- boolean getShowSequenceFeatures()\r
+\r
+ /**\r
+ * Returns the value of field 'showText'.\r
+ *\r
+ * @return boolean\r
+ * @return the value of field 'showText'.\r
+ */\r
+ public boolean getShowText()\r
+ {\r
+ return this._showText;\r
+ } //-- boolean getShowText()\r
+\r
+ /**\r
+ * Returns the value of field 'startRes'.\r
+ *\r
+ * @return int\r
+ * @return the value of field 'startRes'.\r
+ */\r
+ public int getStartRes()\r
+ {\r
+ return this._startRes;\r
+ } //-- int getStartRes()\r
+\r
+ /**\r
+ * Returns the value of field 'startSeq'.\r
+ *\r
+ * @return int\r
+ * @return the value of field 'startSeq'.\r
+ */\r
+ public int getStartSeq()\r
+ {\r
+ return this._startSeq;\r
+ } //-- int getStartSeq()\r
+\r
+ /**\r
+ * Returns the value of field 'title'.\r
+ *\r
+ * @return String\r
+ * @return the value of field 'title'.\r
+ */\r
+ public java.lang.String getTitle()\r
+ {\r
+ return this._title;\r
+ } //-- java.lang.String getTitle()\r
+\r
+ /**\r
+ * Returns the value of field 'width'.\r
+ *\r
+ * @return int\r
+ * @return the value of field 'width'.\r
+ */\r
+ public int getWidth()\r
+ {\r
+ return this._width;\r
+ } //-- int getWidth()\r
+\r
+ /**\r
+ * Returns the value of field 'wrapAlignment'.\r
+ *\r
+ * @return boolean\r
+ * @return the value of field 'wrapAlignment'.\r
+ */\r
+ public boolean getWrapAlignment()\r
+ {\r
+ return this._wrapAlignment;\r
+ } //-- boolean getWrapAlignment()\r
+\r
+ /**\r
+ * Returns the value of field 'xpos'.\r
+ *\r
+ * @return int\r
+ * @return the value of field 'xpos'.\r
+ */\r
+ public int getXpos()\r
+ {\r
+ return this._xpos;\r
+ } //-- int getXpos()\r
+\r
+ /**\r
+ * Returns the value of field 'ypos'.\r
+ *\r
+ * @return int\r
+ * @return the value of field 'ypos'.\r
+ */\r
+ public int getYpos()\r
+ {\r
+ return this._ypos;\r
+ } //-- int getYpos()\r
+\r
+ /**\r
+ * Method hasConsThreshold\r
+ *\r
+ *\r
+ *\r
+ * @return boolean\r
+ */\r
+ public boolean hasConsThreshold()\r
+ {\r
+ return this._has_consThreshold;\r
+ } //-- boolean hasConsThreshold()\r
+\r
+ /**\r
+ * Method hasConservationSelected\r
+ *\r
+ *\r
+ *\r
+ * @return boolean\r
+ */\r
+ public boolean hasConservationSelected()\r
+ {\r
+ return this._has_conservationSelected;\r
+ } //-- boolean hasConservationSelected()\r
+\r
+ /**\r
+ * Method hasFontSize\r
+ *\r
+ *\r
+ *\r
+ * @return boolean\r
+ */\r
+ public boolean hasFontSize()\r
+ {\r
+ return this._has_fontSize;\r
+ } //-- boolean hasFontSize()\r
+\r
+ /**\r
+ * Method hasFontStyle\r
+ *\r
+ *\r
+ *\r
+ * @return boolean\r
+ */\r
+ public boolean hasFontStyle()\r
+ {\r
+ return this._has_fontStyle;\r
+ } //-- boolean hasFontStyle()\r
+\r
+ /**\r
+ * Method hasHeight\r
+ *\r
+ *\r
+ *\r
+ * @return boolean\r
+ */\r
+ public boolean hasHeight()\r
+ {\r
+ return this._has_height;\r
+ } //-- boolean hasHeight()\r
+\r
+ /**\r
+ * Method hasPidSelected\r
+ *\r
+ *\r
+ *\r
+ * @return boolean\r
+ */\r
+ public boolean hasPidSelected()\r
+ {\r
+ return this._has_pidSelected;\r
+ } //-- boolean hasPidSelected()\r
+\r
+ /**\r
+ * Method hasPidThreshold\r
+ *\r
+ *\r
+ *\r
+ * @return boolean\r
+ */\r
+ public boolean hasPidThreshold()\r
+ {\r
+ return this._has_pidThreshold;\r
+ } //-- boolean hasPidThreshold()\r
+\r
+ /**\r
+ * Method hasRenderGaps\r
+ *\r
+ *\r
+ *\r
+ * @return boolean\r
+ */\r
+ public boolean hasRenderGaps()\r
+ {\r
+ return this._has_renderGaps;\r
+ } //-- boolean hasRenderGaps()\r
+\r
+ /**\r
+ * Method hasShowAnnotation\r
+ *\r
+ *\r
+ *\r
+ * @return boolean\r
+ */\r
+ public boolean hasShowAnnotation()\r
+ {\r
+ return this._has_showAnnotation;\r
+ } //-- boolean hasShowAnnotation()\r
+\r
+ /**\r
+ * Method hasShowBoxes\r
+ *\r
+ *\r
+ *\r
+ * @return boolean\r
+ */\r
+ public boolean hasShowBoxes()\r
+ {\r
+ return this._has_showBoxes;\r
+ } //-- boolean hasShowBoxes()\r
+\r
+ /**\r
+ * Method hasShowColourText\r
+ *\r
+ *\r
+ *\r
+ * @return boolean\r
+ */\r
+ public boolean hasShowColourText()\r
+ {\r
+ return this._has_showColourText;\r
+ } //-- boolean hasShowColourText()\r
+\r
+ /**\r
+ * Method hasShowConservation\r
+ *\r
+ *\r
+ *\r
+ * @return boolean\r
+ */\r
+ public boolean hasShowConservation()\r
+ {\r
+ return this._has_showConservation;\r
+ } //-- boolean hasShowConservation()\r
+\r
+ /**\r
+ * Method hasShowFullId\r
+ *\r
+ *\r
+ *\r
+ * @return boolean\r
+ */\r
+ public boolean hasShowFullId()\r
+ {\r
+ return this._has_showFullId;\r
+ } //-- boolean hasShowFullId()\r
+\r
+ /**\r
+ * Method hasShowIdentity\r
+ *\r
+ *\r
+ *\r
+ * @return boolean\r
+ */\r
+ public boolean hasShowIdentity()\r
+ {\r
+ return this._has_showIdentity;\r
+ } //-- boolean hasShowIdentity()\r
+\r
+ /**\r
+ * Method hasShowQuality\r
+ *\r
+ *\r
+ *\r
+ * @return boolean\r
+ */\r
+ public boolean hasShowQuality()\r
+ {\r
+ return this._has_showQuality;\r
+ } //-- boolean hasShowQuality()\r
+\r
+ /**\r
+ * Method hasShowSequenceFeatures\r
+ *\r
+ *\r
+ *\r
+ * @return boolean\r
+ */\r
+ public boolean hasShowSequenceFeatures()\r
+ {\r
+ return this._has_showSequenceFeatures;\r
+ } //-- boolean hasShowSequenceFeatures()\r
+\r
+ /**\r
+ * Method hasShowText\r
+ *\r
+ *\r
+ *\r
+ * @return boolean\r
+ */\r
+ public boolean hasShowText()\r
+ {\r
+ return this._has_showText;\r
+ } //-- boolean hasShowText()\r
+\r
+ /**\r
+ * Method hasStartRes\r
+ *\r
+ *\r
+ *\r
+ * @return boolean\r
+ */\r
+ public boolean hasStartRes()\r
+ {\r
+ return this._has_startRes;\r
+ } //-- boolean hasStartRes()\r
+\r
+ /**\r
+ * Method hasStartSeq\r
+ *\r
+ *\r
+ *\r
+ * @return boolean\r
+ */\r
+ public boolean hasStartSeq()\r
+ {\r
+ return this._has_startSeq;\r
+ } //-- boolean hasStartSeq()\r
+\r
+ /**\r
+ * Method hasWidth\r
+ *\r
+ *\r
+ *\r
+ * @return boolean\r
+ */\r
+ public boolean hasWidth()\r
+ {\r
+ return this._has_width;\r
+ } //-- boolean hasWidth()\r
+\r
+ /**\r
+ * Method hasWrapAlignment\r
+ *\r
+ *\r
+ *\r
+ * @return boolean\r
+ */\r
+ public boolean hasWrapAlignment()\r
+ {\r
+ return this._has_wrapAlignment;\r
+ } //-- boolean hasWrapAlignment()\r
+\r
+ /**\r
+ * Method hasXpos\r
+ *\r
+ *\r
+ *\r
+ * @return boolean\r
+ */\r
+ public boolean hasXpos()\r
+ {\r
+ return this._has_xpos;\r
+ } //-- boolean hasXpos()\r
+\r
+ /**\r
+ * Method hasYpos\r
+ *\r
+ *\r
+ *\r
+ * @return boolean\r
+ */\r
+ public boolean hasYpos()\r
+ {\r
+ return this._has_ypos;\r
+ } //-- boolean hasYpos()\r
+\r
+ /**\r
+ * Method isValid\r
+ *\r
+ *\r
+ *\r
+ * @return boolean\r
+ */\r
+ public boolean isValid()\r
+ {\r
+ try\r
+ {\r
+ validate();\r
+ }\r
+ catch (org.exolab.castor.xml.ValidationException vex)\r
+ {\r
+ return false;\r
+ }\r
+ return true;\r
+ } //-- boolean isValid()\r
+\r
+ /**\r
+ * Method marshal\r
+ *\r
+ *\r
+ *\r
+ * @param out\r
+ */\r
+ public void marshal(java.io.Writer out)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException\r
+ {\r
+\r
+ Marshaller.marshal(this, out);\r
+ } //-- void marshal(java.io.Writer)\r
+\r
+ /**\r
+ * Method marshal\r
+ *\r
+ *\r
+ *\r
+ * @param handler\r
+ */\r
+ public void marshal(org.xml.sax.ContentHandler handler)\r
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException\r
+ {\r
+\r
+ Marshaller.marshal(this, handler);\r
+ } //-- void marshal(org.xml.sax.ContentHandler)\r
+\r
+ /**\r
+ * Sets the value of field 'bgColour'.\r
+ *\r
+ * @param bgColour the value of field 'bgColour'.\r
+ */\r
+ public void setBgColour(java.lang.String bgColour)\r
+ {\r
+ this._bgColour = bgColour;\r
+ } //-- void setBgColour(java.lang.String)\r
+\r
+ /**\r
+ * Sets the value of field 'consThreshold'.\r
+ *\r
+ * @param consThreshold the value of field 'consThreshold'.\r
+ */\r
+ public void setConsThreshold(int consThreshold)\r
+ {\r
+ this._consThreshold = consThreshold;\r
+ this._has_consThreshold = true;\r
+ } //-- void setConsThreshold(int)\r
+\r
+ /**\r
+ * Sets the value of field 'conservationSelected'.\r
+ *\r
+ * @param conservationSelected the value of field\r
+ * 'conservationSelected'.\r
+ */\r
+ public void setConservationSelected(boolean conservationSelected)\r
+ {\r
+ this._conservationSelected = conservationSelected;\r
+ this._has_conservationSelected = true;\r
+ } //-- void setConservationSelected(boolean)\r
+\r
+ /**\r
+ * Sets the value of field 'fontName'.\r
+ *\r
+ * @param fontName the value of field 'fontName'.\r
+ */\r
+ public void setFontName(java.lang.String fontName)\r
+ {\r
+ this._fontName = fontName;\r
+ } //-- void setFontName(java.lang.String)\r
+\r
+ /**\r
+ * Sets the value of field 'fontSize'.\r
+ *\r
+ * @param fontSize the value of field 'fontSize'.\r
+ */\r
+ public void setFontSize(int fontSize)\r
+ {\r
+ this._fontSize = fontSize;\r
+ this._has_fontSize = true;\r
+ } //-- void setFontSize(int)\r
+\r
+ /**\r
+ * Sets the value of field 'fontStyle'.\r
+ *\r
+ * @param fontStyle the value of field 'fontStyle'.\r
+ */\r
+ public void setFontStyle(int fontStyle)\r
+ {\r
+ this._fontStyle = fontStyle;\r
+ this._has_fontStyle = true;\r
+ } //-- void setFontStyle(int)\r
+\r
+ /**\r
+ * Sets the value of field 'height'.\r
+ *\r
+ * @param height the value of field 'height'.\r
+ */\r
+ public void setHeight(int height)\r
+ {\r
+ this._height = height;\r
+ this._has_height = true;\r
+ } //-- void setHeight(int)\r
+\r
+ /**\r
+ * Sets the value of field 'pidSelected'.\r
+ *\r
+ * @param pidSelected the value of field 'pidSelected'.\r
+ */\r
+ public void setPidSelected(boolean pidSelected)\r
+ {\r
+ this._pidSelected = pidSelected;\r
+ this._has_pidSelected = true;\r
+ } //-- void setPidSelected(boolean)\r
+\r
+ /**\r
+ * Sets the value of field 'pidThreshold'.\r
+ *\r
+ * @param pidThreshold the value of field 'pidThreshold'.\r
+ */\r
+ public void setPidThreshold(int pidThreshold)\r
+ {\r
+ this._pidThreshold = pidThreshold;\r
+ this._has_pidThreshold = true;\r
+ } //-- void setPidThreshold(int)\r
+\r
+ /**\r
+ * Sets the value of field 'renderGaps'.\r
+ *\r
+ * @param renderGaps the value of field 'renderGaps'.\r
+ */\r
+ public void setRenderGaps(boolean renderGaps)\r
+ {\r
+ this._renderGaps = renderGaps;\r
+ this._has_renderGaps = true;\r
+ } //-- void setRenderGaps(boolean)\r
+\r
+ /**\r
+ * Sets the value of field 'showAnnotation'.\r
+ *\r
+ * @param showAnnotation the value of field 'showAnnotation'.\r
+ */\r
+ public void setShowAnnotation(boolean showAnnotation)\r
+ {\r
+ this._showAnnotation = showAnnotation;\r
+ this._has_showAnnotation = true;\r
+ } //-- void setShowAnnotation(boolean)\r
+\r
+ /**\r
+ * Sets the value of field 'showBoxes'.\r
+ *\r
+ * @param showBoxes the value of field 'showBoxes'.\r
+ */\r
+ public void setShowBoxes(boolean showBoxes)\r
+ {\r
+ this._showBoxes = showBoxes;\r
+ this._has_showBoxes = true;\r
+ } //-- void setShowBoxes(boolean)\r
+\r
+ /**\r
+ * Sets the value of field 'showColourText'.\r
+ *\r
+ * @param showColourText the value of field 'showColourText'.\r
+ */\r
+ public void setShowColourText(boolean showColourText)\r
+ {\r
+ this._showColourText = showColourText;\r
+ this._has_showColourText = true;\r
+ } //-- void setShowColourText(boolean)\r
+\r
+ /**\r
+ * Sets the value of field 'showConservation'.\r
+ *\r
+ * @param showConservation the value of field 'showConservation'\r
+ */\r
+ public void setShowConservation(boolean showConservation)\r
+ {\r
+ this._showConservation = showConservation;\r
+ this._has_showConservation = true;\r
+ } //-- void setShowConservation(boolean)\r
+\r
+ /**\r
+ * Sets the value of field 'showFullId'.\r
+ *\r
+ * @param showFullId the value of field 'showFullId'.\r
+ */\r
+ public void setShowFullId(boolean showFullId)\r
+ {\r
+ this._showFullId = showFullId;\r
+ this._has_showFullId = true;\r
+ } //-- void setShowFullId(boolean)\r
+\r
+ /**\r
+ * Sets the value of field 'showIdentity'.\r
+ *\r
+ * @param showIdentity the value of field 'showIdentity'.\r
+ */\r
+ public void setShowIdentity(boolean showIdentity)\r
+ {\r
+ this._showIdentity = showIdentity;\r
+ this._has_showIdentity = true;\r
+ } //-- void setShowIdentity(boolean)\r
+\r
+ /**\r
+ * Sets the value of field 'showQuality'.\r
+ *\r
+ * @param showQuality the value of field 'showQuality'.\r
+ */\r
+ public void setShowQuality(boolean showQuality)\r
+ {\r
+ this._showQuality = showQuality;\r
+ this._has_showQuality = true;\r
+ } //-- void setShowQuality(boolean)\r
+\r
+ /**\r
+ * Sets the value of field 'showSequenceFeatures'.\r
+ *\r
+ * @param showSequenceFeatures the value of field\r
+ * 'showSequenceFeatures'.\r
+ */\r
+ public void setShowSequenceFeatures(boolean showSequenceFeatures)\r
+ {\r
+ this._showSequenceFeatures = showSequenceFeatures;\r
+ this._has_showSequenceFeatures = true;\r
+ } //-- void setShowSequenceFeatures(boolean)\r
+\r
+ /**\r
+ * Sets the value of field 'showText'.\r
+ *\r
+ * @param showText the value of field 'showText'.\r
+ */\r
+ public void setShowText(boolean showText)\r
+ {\r
+ this._showText = showText;\r
+ this._has_showText = true;\r
+ } //-- void setShowText(boolean)\r
+\r
+ /**\r
+ * Sets the value of field 'startRes'.\r
+ *\r
+ * @param startRes the value of field 'startRes'.\r
+ */\r
+ public void setStartRes(int startRes)\r
+ {\r
+ this._startRes = startRes;\r
+ this._has_startRes = true;\r
+ } //-- void setStartRes(int)\r
+\r
+ /**\r
+ * Sets the value of field 'startSeq'.\r
+ *\r
+ * @param startSeq the value of field 'startSeq'.\r
+ */\r
+ public void setStartSeq(int startSeq)\r
+ {\r
+ this._startSeq = startSeq;\r
+ this._has_startSeq = true;\r
+ } //-- void setStartSeq(int)\r
+\r
+ /**\r
+ * Sets the value of field 'title'.\r
+ *\r
+ * @param title the value of field 'title'.\r
+ */\r
+ public void setTitle(java.lang.String title)\r
+ {\r
+ this._title = title;\r
+ } //-- void setTitle(java.lang.String)\r
+\r
+ /**\r
+ * Sets the value of field 'width'.\r
+ *\r
+ * @param width the value of field 'width'.\r
+ */\r
+ public void setWidth(int width)\r
+ {\r
+ this._width = width;\r
+ this._has_width = true;\r
+ } //-- void setWidth(int)\r
+\r
+ /**\r
+ * Sets the value of field 'wrapAlignment'.\r
+ *\r
+ * @param wrapAlignment the value of field 'wrapAlignment'.\r
+ */\r
+ public void setWrapAlignment(boolean wrapAlignment)\r
+ {\r
+ this._wrapAlignment = wrapAlignment;\r
+ this._has_wrapAlignment = true;\r
+ } //-- void setWrapAlignment(boolean)\r
+\r
+ /**\r
+ * Sets the value of field 'xpos'.\r
+ *\r
+ * @param xpos the value of field 'xpos'.\r
+ */\r
+ public void setXpos(int xpos)\r
+ {\r
+ this._xpos = xpos;\r
+ this._has_xpos = true;\r
+ } //-- void setXpos(int)\r
+\r
+ /**\r
+ * Sets the value of field 'ypos'.\r
+ *\r
+ * @param ypos the value of field 'ypos'.\r
+ */\r
+ public void setYpos(int ypos)\r
+ {\r
+ this._ypos = ypos;\r
+ this._has_ypos = true;\r
+ } //-- void setYpos(int)\r
+\r
+ /**\r
+ * Method unmarshal\r
+ *\r
+ *\r
+ *\r
+ * @param reader\r
+ * @return Object\r
+ */\r
+ public static java.lang.Object unmarshal(java.io.Reader reader)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException\r
+ {\r
+ return (jalview.binding.Viewport) Unmarshaller.unmarshal(jalview.binding.\r
+ Viewport.class, reader);\r
+ } //-- java.lang.Object unmarshal(java.io.Reader)\r
+\r
+ /**\r
+ * Method validate\r
+ *\r
+ */\r
+ public void validate()\r
+ throws org.exolab.castor.xml.ValidationException\r
+ {\r
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.\r
+ Validator();\r
+ validator.validate(this);\r
+ } //-- void validate()\r
\r
}\r
/*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
-*\r
-* This program is free software; you can redistribute it and/or\r
-* modify it under the terms of the GNU General Public License\r
-* as published by the Free Software Foundation; either version 2\r
-* of the License, or (at your option) any later version.\r
-*\r
-* This program is distributed in the hope that it will be useful,\r
-* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-* GNU General Public License for more details.\r
-*\r
-* You should have received a copy of the GNU General Public License\r
-* along with this program; if not, write to the Free Software\r
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
-*/\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
+ */\r
package jalview.datamodel;\r
\r
import jalview.analysis.*;\r
\r
/** Data structure to hold and manipulate a multiple sequence alignment\r
*/\r
-public class Alignment implements AlignmentI {\r
+public class Alignment implements AlignmentI\r
+{\r
protected Vector sequences;\r
protected Vector groups = new Vector();\r
protected Vector superGroup = new Vector();\r
protected char gapCharacter = '-';\r
+\r
+ /** DOCUMENT ME!! */\r
public AlignmentAnnotation[] annotations;\r
+\r
+ /** DOCUMENT ME!! */\r
public boolean featuresAdded = false;\r
\r
/** Make an alignment from an array of Sequences.\r
- *\r
- * @param sequences\r
- */\r
- public Alignment(SequenceI[] seqs) {\r
+ *\r
+ * @param sequences\r
+ */\r
+ public Alignment(SequenceI[] seqs)\r
+ {\r
sequences = new Vector();\r
\r
for (int i = 0; i < seqs.length; i++)\r
+ {\r
sequences.addElement(seqs[i]);\r
+ }\r
\r
getWidth();\r
}\r
\r
- public Vector getSequences() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public Vector getSequences()\r
+ {\r
return sequences;\r
}\r
\r
- public SequenceI getSequenceAt(int i) {\r
- if (i < sequences.size()) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param i DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public SequenceI getSequenceAt(int i)\r
+ {\r
+ if (i < sequences.size())\r
+ {\r
return (SequenceI) sequences.elementAt(i);\r
}\r
\r
*\r
* @param snew\r
*/\r
- public void addSequence(SequenceI snew) {\r
+ public void addSequence(SequenceI snew)\r
+ {\r
sequences.addElement(snew);\r
}\r
\r
- public void addSequence(SequenceI[] seq) {\r
- for (int i = 0; i < seq.length; i++) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param seq DOCUMENT ME!\r
+ */\r
+ public void addSequence(SequenceI[] seq)\r
+ {\r
+ for (int i = 0; i < seq.length; i++)\r
+ {\r
addSequence(seq[i]);\r
}\r
}\r
\r
/** Adds a sequence to the alignment. Recalculates maxLength and size.\r
- *\r
+ *\r
* @param snew\r
*/\r
- public void setSequenceAt(int i, SequenceI snew) {\r
+ public void setSequenceAt(int i, SequenceI snew)\r
+ {\r
SequenceI oldseq = getSequenceAt(i);\r
deleteSequence(oldseq);\r
\r
sequences.setElementAt(snew, i);\r
}\r
\r
- public Vector getGroups() {\r
- return groups;\r
- }\r
-\r
- /** Sorts the sequences by sequence group size - largest to smallest.\r
- * Uses QuickSort.\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
*/\r
- public void sortGroups() {\r
- float[] arr = new float[groups.size()];\r
- Object[] s = new Object[groups.size()];\r
-\r
- for (int i = 0; i < groups.size(); i++) {\r
- arr[i] = ((SequenceGroup) groups.elementAt(i)).sequences.size();\r
- s[i] = groups.elementAt(i);\r
- }\r
-\r
- QuickSort.sort(arr, s);\r
-\r
- Vector newg = new Vector(groups.size());\r
-\r
- for (int i = groups.size() - 1; i >= 0; i--) {\r
- newg.addElement(s[i]);\r
- }\r
-\r
- groups = newg;\r
+ public Vector getGroups()\r
+ {\r
+ return groups;\r
}\r
\r
/** Takes out columns consisting entirely of gaps (-,.," ")\r
*/\r
- public void removeGaps() {\r
+ public void removeGaps()\r
+ {\r
SequenceI current;\r
int iSize = getWidth();\r
\r
- for (int i = 0; i < iSize; i++) {\r
+ for (int i = 0; i < iSize; i++)\r
+ {\r
boolean delete = true;\r
\r
- for (int j = 0; j < getHeight(); j++) {\r
+ for (int j = 0; j < getHeight(); j++)\r
+ {\r
current = getSequenceAt(j);\r
\r
- if (current.getLength() > i) {\r
+ if (current.getLength() > i)\r
+ {\r
/* MC Should move this to a method somewhere */\r
- if (!jalview.util.Comparison.isGap(current.getCharAt(i))) {\r
+ if (!jalview.util.Comparison.isGap(current.getCharAt(i)))\r
+ {\r
delete = false;\r
}\r
}\r
}\r
\r
- if (delete) {\r
+ if (delete)\r
+ {\r
deleteColumns(i, i);\r
iSize--;\r
i--;\r
}\r
}\r
\r
- /** Returns an array of Sequences containing columns\r
- * start to end (inclusive) only.\r
- *\r
- * @param start start column to fetch\r
- * @param end end column to fetch\r
- * @return Array of Sequences, ready to put into a new Alignment\r
- */\r
- public SequenceI[] getColumns(int start, int end) {\r
- return getColumns(0, getHeight() - 1, start, end);\r
- }\r
-\r
/** Removes a range of columns (start to end inclusive).\r
*\r
* @param start Start column in the alignment\r
* @param end End column in the alignment\r
*/\r
- public void deleteColumns(int start, int end) {\r
+ public void deleteColumns(int start, int end)\r
+ {\r
deleteColumns(0, getHeight() - 1, start, end);\r
}\r
\r
- public void deleteColumns(int seq1, int seq2, int start, int end) {\r
- for (int i = 0; i <= (end - start); i++) {\r
- for (int j = seq1; j <= seq2; j++) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param seq1 DOCUMENT ME!\r
+ * @param seq2 DOCUMENT ME!\r
+ * @param start DOCUMENT ME!\r
+ * @param end DOCUMENT ME!\r
+ */\r
+ public void deleteColumns(int seq1, int seq2, int start, int end)\r
+ {\r
+ for (int i = 0; i <= (end - start); i++)\r
+ {\r
+ for (int j = seq1; j <= seq2; j++)\r
+ {\r
getSequenceAt(j).deleteCharAt(start);\r
}\r
}\r
}\r
\r
- public void insertColumns(SequenceI[] seqs, int pos) {\r
- if (seqs.length == getHeight()) {\r
- for (int i = 0; i < getHeight(); i++) {\r
- String tmp = new String(getSequenceAt(i).getSequence());\r
- getSequenceAt(i).setSequence(tmp.substring(0, pos) +\r
- seqs[i].getSequence() + tmp.substring(pos));\r
- }\r
- }\r
- }\r
-\r
- public SequenceI[] getColumns(int seq1, int seq2, int start, int end) {\r
- SequenceI[] seqs = new Sequence[(seq2 - seq1) + 1];\r
-\r
- for (int i = seq1; i <= seq2; i++) {\r
- seqs[i] = new Sequence(getSequenceAt(i).getName(),\r
- getSequenceAt(i).getSequence().substring(start, end),\r
- getSequenceAt(i).findPosition(start),\r
- getSequenceAt(i).findPosition(end));\r
- }\r
-\r
- return seqs;\r
- }\r
-\r
- public void trimLeft(int i) {\r
- for (int j = 0; j < getHeight(); j++) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param i DOCUMENT ME!\r
+ */\r
+ public void trimLeft(int i)\r
+ {\r
+ for (int j = 0; j < getHeight(); j++)\r
+ {\r
SequenceI s = getSequenceAt(j);\r
int newstart = s.findPosition(i);\r
\r
}\r
}\r
\r
- public void trimRight(int i) {\r
- for (int j = 0; j < getHeight(); j++) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param i DOCUMENT ME!\r
+ */\r
+ public void trimRight(int i)\r
+ {\r
+ for (int j = 0; j < getHeight(); j++)\r
+ {\r
SequenceI s = getSequenceAt(j);\r
int newend = s.findPosition(i);\r
\r
}\r
}\r
\r
- public void deleteSequence(SequenceI s) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param s DOCUMENT ME!\r
+ */\r
+ public void deleteSequence(SequenceI s)\r
+ {\r
for (int i = 0; i < getHeight(); i++)\r
- if (getSequenceAt(i) == s) {\r
+ {\r
+ if (getSequenceAt(i) == s)\r
+ {\r
deleteSequence(i);\r
}\r
+ }\r
}\r
\r
- public void deleteSequence(int i) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param i DOCUMENT ME!\r
+ */\r
+ public void deleteSequence(int i)\r
+ {\r
sequences.removeElementAt(i);\r
}\r
\r
- public Vector removeRedundancy(float threshold, Vector sel) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param threshold DOCUMENT ME!\r
+ * @param sel DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public Vector removeRedundancy(float threshold, Vector sel)\r
+ {\r
Vector del = new Vector();\r
\r
- for (int i = 1; i < sel.size(); i++) {\r
- for (int j = 0; j < i; j++) {\r
+ for (int i = 1; i < sel.size(); i++)\r
+ {\r
+ for (int j = 0; j < i; j++)\r
+ {\r
// Only do the comparison if either have not been deleted\r
if (!del.contains((SequenceI) sel.elementAt(i)) ||\r
- !del.contains((SequenceI) sel.elementAt(j))) {\r
+ !del.contains((SequenceI) sel.elementAt(j)))\r
+ {\r
// use PID instead of Comparison (which is really not pleasant)\r
float pid = Comparison.PID((SequenceI) sel.elementAt(j),\r
(SequenceI) sel.elementAt(i));\r
\r
- if (pid >= threshold) {\r
+ if (pid >= threshold)\r
+ {\r
// Delete the shortest one\r
if (((SequenceI) sel.elementAt(j)).getSequence().length() > ((SequenceI) sel\r
.elementAt(\r
- i)).getSequence().length()) {\r
+ i)).getSequence().length())\r
+ {\r
del.addElement(sel.elementAt(i));\r
- } else {\r
+ }\r
+ else\r
+ {\r
del.addElement(sel.elementAt(i));\r
}\r
}\r
\r
// Now delete the sequences\r
for (int i = 0; i < del.size(); i++)\r
+ {\r
deleteSequence((SequenceI) del.elementAt(i));\r
-\r
- return del;\r
- }\r
-\r
- public void sortByPID(SequenceI s) {\r
- float[] scores = new float[getHeight()];\r
- SequenceI[] seqs = new SequenceI[getHeight()];\r
-\r
- for (int i = 0; i < getHeight(); i++) {\r
- scores[i] = Comparison.compare(getSequenceAt(i), s);\r
- seqs[i] = getSequenceAt(i);\r
}\r
\r
- QuickSort.sort(scores, 0, scores.length - 1, seqs);\r
-\r
- int len = 0;\r
-\r
- if ((getHeight() % 2) == 0) {\r
- len = getHeight() / 2;\r
- } else {\r
- len = (getHeight() + 1) / 2;\r
- }\r
-\r
- for (int i = 0; i < len; i++) {\r
- SequenceI tmp = seqs[i];\r
- sequences.setElementAt(seqs[getHeight() - i - 1], i);\r
- sequences.setElementAt(tmp, getHeight() - i - 1);\r
- }\r
- }\r
-\r
- public void sortByID() {\r
- String[] ids = new String[getHeight()];\r
- SequenceI[] seqs = new SequenceI[getHeight()];\r
-\r
- for (int i = 0; i < getHeight(); i++) {\r
- ids[i] = getSequenceAt(i).getName();\r
- seqs[i] = getSequenceAt(i);\r
- }\r
-\r
- QuickSort.sort(ids, seqs);\r
-\r
- int len = 0;\r
-\r
- if ((getHeight() % 2) == 0) {\r
- len = getHeight() / 2;\r
- } else {\r
- len = (getHeight() + 1) / 2;\r
- System.out.println("DEBUG:Sort len is odd = " + len); // log.\r
- }\r
-\r
- for (int i = 0; i < len; i++) {\r
- System.out.println("DEBUG:Swapping " + seqs[i].getName() + " and " +\r
- seqs[getHeight() - i - 1].getName()); // log.\r
-\r
- SequenceI tmp = seqs[i];\r
- sequences.setElementAt(seqs[getHeight() - i - 1], i);\r
- sequences.setElementAt(tmp, getHeight() - i - 1);\r
- }\r
+ return del;\r
}\r
\r
/** */\r
- public SequenceGroup findGroup(int i) {\r
+ public SequenceGroup findGroup(int i)\r
+ {\r
return findGroup(getSequenceAt(i));\r
}\r
\r
/** */\r
- public SequenceGroup findGroup(SequenceI s) {\r
- for (int i = 0; i < this.groups.size(); i++) {\r
+ public SequenceGroup findGroup(SequenceI s)\r
+ {\r
+ for (int i = 0; i < this.groups.size(); i++)\r
+ {\r
SequenceGroup sg = (SequenceGroup) groups.elementAt(i);\r
\r
- if (sg.sequences.contains(s)) {\r
+ if (sg.sequences.contains(s))\r
+ {\r
return sg;\r
}\r
}\r
return null;\r
}\r
\r
- public SequenceGroup[] findAllGroups(SequenceI s) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param s DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public SequenceGroup[] findAllGroups(SequenceI s)\r
+ {\r
Vector temp = new Vector();\r
\r
- for (int i = 0; i < this.groups.size(); i++) {\r
+ for (int i = 0; i < this.groups.size(); i++)\r
+ {\r
SequenceGroup sg = (SequenceGroup) groups.elementAt(i);\r
\r
- if (sg.sequences.contains(s)) {\r
+ if (sg.sequences.contains(s))\r
+ {\r
temp.addElement(sg);\r
}\r
}\r
SequenceGroup[] ret = new SequenceGroup[temp.size()];\r
\r
for (int i = 0; i < temp.size(); i++)\r
+ {\r
ret[i] = (SequenceGroup) temp.elementAt(i);\r
-\r
- return ret;\r
- }\r
-\r
- /** */\r
- public void addToGroup(SequenceGroup g, SequenceI s) {\r
- if (!(g.sequences.contains(s))) {\r
- g.sequences.addElement(s);\r
}\r
- }\r
\r
- /** */\r
- public void removeFromGroup(SequenceGroup g, SequenceI s) {\r
- if ((g != null) && (g.sequences != null)) {\r
- if (g.sequences.contains(s)) {\r
- g.sequences.removeElement(s);\r
-\r
- if (g.sequences.size() == 0) {\r
- groups.removeElement(g);\r
- }\r
- }\r
- }\r
+ return ret;\r
}\r
\r
- public void addSuperGroup(SuperGroup sg) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param sg DOCUMENT ME!\r
+ */\r
+ public void addSuperGroup(SuperGroup sg)\r
+ {\r
superGroup.addElement(sg);\r
}\r
\r
- public void removeSuperGroup(SuperGroup sg) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param sg DOCUMENT ME!\r
+ */\r
+ public void removeSuperGroup(SuperGroup sg)\r
+ {\r
superGroup.removeElement(sg);\r
}\r
\r
- public SuperGroup getSuperGroup(SequenceGroup sg) {\r
- for (int i = 0; i < this.superGroup.size(); i++) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param sg DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public SuperGroup getSuperGroup(SequenceGroup sg)\r
+ {\r
+ for (int i = 0; i < this.superGroup.size(); i++)\r
+ {\r
SuperGroup temp = (SuperGroup) superGroup.elementAt(i);\r
\r
- if (temp.sequenceGroups.contains(sg)) {\r
+ if (temp.sequenceGroups.contains(sg))\r
+ {\r
return temp;\r
}\r
}\r
}\r
\r
/** */\r
- public void addGroup(SequenceGroup sg) {\r
- if (!groups.contains(sg)) {\r
+ public void addGroup(SequenceGroup sg)\r
+ {\r
+ if (!groups.contains(sg))\r
+ {\r
groups.addElement(sg);\r
}\r
}\r
\r
- public void deleteAllGroups() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ public void deleteAllGroups()\r
+ {\r
groups.removeAllElements();\r
superGroup.removeAllElements();\r
\r
int i = 0;\r
\r
- while (i < sequences.size()) {\r
+ while (i < sequences.size())\r
+ {\r
SequenceI s = getSequenceAt(i);\r
s.setColor(java.awt.Color.white);\r
i++;\r
}\r
\r
/** */\r
- public void deleteGroup(SequenceGroup g) {\r
- if (groups.contains(g)) {\r
+ public void deleteGroup(SequenceGroup g)\r
+ {\r
+ if (groups.contains(g))\r
+ {\r
groups.removeElement(g);\r
}\r
}\r
\r
/** */\r
- public SequenceI findName(String name) {\r
+ public SequenceI findName(String name)\r
+ {\r
int i = 0;\r
\r
- while (i < sequences.size()) {\r
+ while (i < sequences.size())\r
+ {\r
SequenceI s = getSequenceAt(i);\r
\r
- if (s.getName().equals(name)) {\r
+ if (s.getName().equals(name))\r
+ {\r
return s;\r
}\r
\r
}\r
\r
/** */\r
- public SequenceI findbyDisplayId(String name) {\r
+ public SequenceI findbyDisplayId(String name)\r
+ {\r
int i = 0;\r
\r
- while (i < sequences.size()) {\r
+ while (i < sequences.size())\r
+ {\r
SequenceI s = getSequenceAt(i);\r
\r
- if (s.getDisplayId().equals(name)) {\r
+ if (s.getDisplayId().equals(name))\r
+ {\r
return s;\r
}\r
\r
}\r
\r
/** */\r
- public int findIndex(SequenceI s) {\r
+ public int findIndex(SequenceI s)\r
+ {\r
int i = 0;\r
\r
- while (i < sequences.size()) {\r
- if (s == getSequenceAt(i)) {\r
+ while (i < sequences.size())\r
+ {\r
+ if (s == getSequenceAt(i))\r
+ {\r
return i;\r
}\r
\r
return -1;\r
}\r
\r
- public int getHeight() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public int getHeight()\r
+ {\r
return sequences.size();\r
}\r
\r
- public int getWidth() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public int getWidth()\r
+ {\r
int maxLength = -1;\r
\r
- for (int i = 0; i < sequences.size(); i++) {\r
- if (getSequenceAt(i).getLength() > maxLength) {\r
+ for (int i = 0; i < sequences.size(); i++)\r
+ {\r
+ if (getSequenceAt(i).getLength() > maxLength)\r
+ {\r
maxLength = getSequenceAt(i).getLength();\r
}\r
}\r
return maxLength;\r
}\r
\r
- public int getMaxIdLength() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public int getMaxIdLength()\r
+ {\r
int max = 0;\r
int i = 0;\r
\r
- while (i < sequences.size()) {\r
+ while (i < sequences.size())\r
+ {\r
SequenceI seq = getSequenceAt(i);\r
String tmp = seq.getName() + "/" + seq.getStart() + "-" +\r
seq.getEnd();\r
\r
- if (tmp.length() > max) {\r
+ if (tmp.length() > max)\r
+ {\r
max = tmp.length();\r
}\r
\r
return max;\r
}\r
\r
- public void setGapCharacter(char gc) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param gc DOCUMENT ME!\r
+ */\r
+ public void setGapCharacter(char gc)\r
+ {\r
gapCharacter = gc;\r
\r
- for (int i = 0; i < sequences.size(); i++) {\r
+ for (int i = 0; i < sequences.size(); i++)\r
+ {\r
Sequence seq = (Sequence) sequences.elementAt(i);\r
seq.sequence = seq.sequence.replace('.', gc);\r
seq.sequence = seq.sequence.replace('-', gc);\r
}\r
}\r
\r
- public char getGapCharacter() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public char getGapCharacter()\r
+ {\r
return gapCharacter;\r
}\r
\r
- public Vector getAAFrequency() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public Vector getAAFrequency()\r
+ {\r
return AAFrequency.calculate(sequences, 0, getWidth());\r
}\r
\r
- public boolean isAligned() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public boolean isAligned()\r
+ {\r
int width = getWidth();\r
\r
for (int i = 0; i < sequences.size(); i++)\r
- if (getSequenceAt(i).getLength() != width) {\r
+ {\r
+ if (getSequenceAt(i).getLength() != width)\r
+ {\r
return false;\r
}\r
+ }\r
\r
return true;\r
}\r
\r
- public void deleteAnnotation(AlignmentAnnotation aa) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param aa DOCUMENT ME!\r
+ */\r
+ public void deleteAnnotation(AlignmentAnnotation aa)\r
+ {\r
int aSize = 1;\r
\r
- if (annotations != null) {\r
+ if (annotations != null)\r
+ {\r
aSize = annotations.length;\r
}\r
\r
\r
int tIndex = 0;\r
\r
- for (int i = 0; i < aSize; i++) {\r
- if (annotations[i] == aa) {\r
+ for (int i = 0; i < aSize; i++)\r
+ {\r
+ if (annotations[i] == aa)\r
+ {\r
continue;\r
}\r
\r
annotations = temp;\r
}\r
\r
- public void addAnnotation(AlignmentAnnotation aa) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param aa DOCUMENT ME!\r
+ */\r
+ public void addAnnotation(AlignmentAnnotation aa)\r
+ {\r
int aSize = 1;\r
\r
- if (annotations != null) {\r
+ if (annotations != null)\r
+ {\r
aSize = annotations.length + 1;\r
}\r
\r
AlignmentAnnotation[] temp = new AlignmentAnnotation[aSize];\r
int i = 0;\r
\r
- if (aSize > 1) {\r
+ if (aSize > 1)\r
+ {\r
for (i = 0; i < (aSize - 1); i++)\r
+ {\r
temp[i] = annotations[i];\r
+ }\r
}\r
\r
temp[i] = aa;\r
annotations = temp;\r
}\r
\r
- public AlignmentAnnotation[] getAlignmentAnnotation() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public AlignmentAnnotation[] getAlignmentAnnotation()\r
+ {\r
return annotations;\r
}\r
}\r
*/\r
package jalview.datamodel;\r
\r
-public class AlignmentAnnotation {\r
+\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class AlignmentAnnotation\r
+{\r
+ /** DOCUMENT ME!! */\r
public String label;\r
+\r
+ /** DOCUMENT ME!! */\r
public String description;\r
+\r
+ /** DOCUMENT ME!! */\r
public Annotation[] annotations;\r
+\r
+ /** DOCUMENT ME!! */\r
public boolean isGraph = false;\r
+\r
+ /** DOCUMENT ME!! */\r
public float graphMin;\r
+\r
+ /** DOCUMENT ME!! */\r
public float graphMax;\r
+\r
+ /** DOCUMENT ME!! */\r
public int windowLength;\r
\r
// Graphical hints and tips\r
+\r
+ /** DOCUMENT ME!! */\r
public boolean editable = false;\r
+\r
+ /** DOCUMENT ME!! */\r
public boolean hasIcons; //\r
+\r
+ /** DOCUMENT ME!! */\r
public boolean hasText;\r
+\r
+ /** DOCUMENT ME!! */\r
public boolean visible = true;\r
+\r
+ /** DOCUMENT ME!! */\r
public int height = 0;\r
\r
+ /**\r
+ * Creates a new AlignmentAnnotation object.\r
+ *\r
+ * @param label DOCUMENT ME!\r
+ * @param description DOCUMENT ME!\r
+ * @param annotations DOCUMENT ME!\r
+ */\r
public AlignmentAnnotation(String label, String description,\r
- Annotation[] annotations) {\r
+ Annotation[] annotations)\r
+ {\r
// always editable?\r
editable = true;\r
this.label = label;\r
this.description = description;\r
this.annotations = annotations;\r
\r
- for (int i = 0; i < annotations.length; i++) {\r
+ for (int i = 0; i < annotations.length; i++)\r
+ {\r
if ((annotations[i] != null) &&\r
((annotations[i].secondaryStructure == 'H') ||\r
- (annotations[i].secondaryStructure == 'E'))) {\r
+ (annotations[i].secondaryStructure == 'E')))\r
+ {\r
hasIcons = true;\r
}\r
\r
if ((annotations[i] != null) &&\r
- (annotations[i].displayCharacter.length() > 0)) {\r
+ (annotations[i].displayCharacter.length() > 0))\r
+ {\r
hasText = true;\r
}\r
}\r
}\r
\r
+ /**\r
+ * Creates a new AlignmentAnnotation object.\r
+ *\r
+ * @param label DOCUMENT ME!\r
+ * @param description DOCUMENT ME!\r
+ * @param annotations DOCUMENT ME!\r
+ * @param min DOCUMENT ME!\r
+ * @param max DOCUMENT ME!\r
+ * @param winLength DOCUMENT ME!\r
+ */\r
public AlignmentAnnotation(String label, String description,\r
- Annotation[] annotations, float min, float max, int winLength) {\r
+ Annotation[] annotations, float min, float max, int winLength)\r
+ {\r
// graphs are not editable\r
this.label = label;\r
this.description = description;\r
this.annotations = annotations;\r
isGraph = true;\r
\r
- if (min == max) {\r
- for (int i = 0; i < annotations.length; i++) {\r
- if (annotations[i] == null) {\r
+ if (min == max)\r
+ {\r
+ for (int i = 0; i < annotations.length; i++)\r
+ {\r
+ if (annotations[i] == null)\r
+ {\r
continue;\r
}\r
\r
- if (annotations[i].value > max) {\r
+ if (annotations[i].value > max)\r
+ {\r
max = annotations[i].value;\r
}\r
\r
- if (annotations[i].value < min) {\r
+ if (annotations[i].value < min)\r
+ {\r
min = annotations[i].value;\r
}\r
}\r
graphMax = max;\r
windowLength = winLength;\r
\r
- for (int i = 0; i < annotations.length; i++) {\r
+ for (int i = 0; i < annotations.length; i++)\r
+ {\r
if ((annotations[i] != null) &&\r
((annotations[i].secondaryStructure == 'H') ||\r
- (annotations[i].secondaryStructure == 'E'))) {\r
+ (annotations[i].secondaryStructure == 'E')))\r
+ {\r
hasIcons = true;\r
}\r
\r
if ((annotations[i] != null) &&\r
- (annotations[i].displayCharacter.length() > 0)) {\r
+ (annotations[i].displayCharacter.length() > 0))\r
+ {\r
hasText = true;\r
}\r
}\r
}\r
\r
- public String toString() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public String toString()\r
+ {\r
StringBuffer buffer = new StringBuffer();\r
\r
- for (int i = 0; i < annotations.length; i++) {\r
- if (annotations[i] != null) {\r
- if (isGraph) {\r
+ for (int i = 0; i < annotations.length; i++)\r
+ {\r
+ if (annotations[i] != null)\r
+ {\r
+ if (isGraph)\r
+ {\r
buffer.append(annotations[i].value);\r
- } else if (hasIcons) {\r
+ }\r
+ else if (hasIcons)\r
+ {\r
buffer.append(annotations[i].secondaryStructure);\r
- } else {\r
+ }\r
+ else\r
+ {\r
buffer.append(annotations[i].displayCharacter);\r
}\r
}\r
buffer.append(", ");\r
}\r
\r
- if (label.equals("Consensus")) {\r
+ if (label.equals("Consensus"))\r
+ {\r
buffer.append("\n");\r
\r
- for (int i = 0; i < annotations.length; i++) {\r
- if (annotations[i] != null) {\r
+ for (int i = 0; i < annotations.length; i++)\r
+ {\r
+ if (annotations[i] != null)\r
+ {\r
buffer.append(annotations[i].description);\r
}\r
\r
\r
/** Data structure to hold and manipulate a multiple sequence alignment\r
*/\r
-public interface AlignmentI {\r
+public interface AlignmentI\r
+{\r
+ /**\r
+ * Calculates the number of sequences in an alignment\r
+ *\r
+ * @return Number of sequences in alignment\r
+ */\r
public int getHeight();\r
\r
+ /**\r
+ * Calculates the maximum width of the alignment, including gaps.\r
+ *\r
+ * @return Greatest sequence length within alignment.\r
+ */\r
public int getWidth();\r
\r
+ /**\r
+ * Calculates the longest sequence Id of the alignment\r
+ *\r
+ * @return Number of characters in longest sequence Id.\r
+ */\r
public int getMaxIdLength();\r
\r
+ /**\r
+ * Calculates if this set of sequences is all the same length\r
+ *\r
+ * @return true if all sequences in alignment are the same length\r
+ */\r
public boolean isAligned();\r
\r
+ /**\r
+ * Gets sequences as a Vector\r
+ *\r
+ * @return All sequences in alignment.\r
+ */\r
public Vector getSequences();\r
\r
+ /**\r
+ * Find a specific sequence in this alignment.\r
+ *\r
+ * @param i Index of required sequence.\r
+ *\r
+ * @return SequenceI at given index.\r
+ */\r
public SequenceI getSequenceAt(int i);\r
\r
+ /**\r
+ * Add a new sequence to this alignment.\r
+ *\r
+ * @param seq New sequence will be added at end of alignment.\r
+ */\r
public void addSequence(SequenceI seq);\r
\r
+ /**\r
+ * Used to set a particular index of the alignment with the given sequence.\r
+ *\r
+ * @param i Index of sequence to be updated.\r
+ * @param seq New sequence to be inserted.\r
+ */\r
public void setSequenceAt(int i, SequenceI seq);\r
\r
+ /**\r
+ * Deletes a sequence from the alignment.\r
+ *\r
+ * @param s Sequence to be deleted.\r
+ */\r
public void deleteSequence(SequenceI s);\r
\r
+ /**\r
+ * Deletes a sequence from the alignment.\r
+ *\r
+ * @param i Index of sequence to be deleted.\r
+ */\r
public void deleteSequence(int i);\r
\r
- public SequenceI[] getColumns(int start, int end);\r
-\r
- public SequenceI[] getColumns(int seq1, int seq2, int start, int end);\r
-\r
+ /**\r
+ * Deletes all residues in every sequence of alignment within given columns.\r
+ *\r
+ * @param start Start index of columns to delete.\r
+ * @param end End index to columns to delete.\r
+ */\r
public void deleteColumns(int start, int end);\r
\r
+ /**\r
+ * Deletes all residues in every sequence of alignment within given columns.\r
+ *\r
+ * @param seq1 Index of first sequence to delete columns from.\r
+ * @param seq2 Index of last sequence to delete columns from.\r
+ * @param start Start index of columns to delete.\r
+ * @param end End index of columns to delete.\r
+ */\r
public void deleteColumns(int seq1, int seq2, int start, int end);\r
\r
- public void insertColumns(SequenceI[] seqs, int pos);\r
-\r
+ /**\r
+ * Finds sequence in alignment using sequence name as query.\r
+ *\r
+ * @param name Id of sequence to search for.\r
+ *\r
+ * @return Sequence matching query, if found. If not found returns null.\r
+ */\r
public SequenceI findName(String name);\r
\r
+ /**\r
+ * Finds sequence in alignment using full displayId as query.\r
+ *\r
+ * @param name displayId, ie <em>NAME/25-100</em>\r
+ *\r
+ * @return Sequence matching query, if found. If not found returns null.\r
+ */\r
public SequenceI findbyDisplayId(String name);\r
\r
+ /**\r
+ * Finds index of a given sequence in the alignment.\r
+ *\r
+ * @param s Sequence to look for.\r
+ *\r
+ * @return Index of sequence within the alignment.\r
+ */\r
public int findIndex(SequenceI s);\r
\r
- // Modifying\r
+ /**\r
+ * All sequences will be cut from beginning to given index.\r
+ *\r
+ * @param i Remove all residues in sequences up to this column.\r
+ */\r
public void trimLeft(int i);\r
\r
+ /**\r
+ * All sequences will be cut from given index.\r
+ *\r
+ * @param i Remove all residues in sequences beyond this column.\r
+ */\r
public void trimRight(int i);\r
\r
+ /**\r
+ * Removes all columns containing entirely gap characters.\r
+ */\r
public void removeGaps();\r
\r
+ /**\r
+ * Removes redundant sequences from alignment.\r
+ *\r
+ * @param threshold Remove all sequences above the given threshold.\r
+ * @param sel Set of sequences which will have redundant sequences removed from.\r
+ *\r
+ * @return All sequences below redundancy threshold.\r
+ */\r
public Vector removeRedundancy(float threshold, Vector sel);\r
\r
- // Grouping methods\r
+ /**\r
+ * Finds group that sequence at index i in alignment is part of.\r
+ *\r
+ * @param i Index in alignment.\r
+ *\r
+ * @return First group found for sequence at position i. WARNING :\r
+ * Sequences may be members of several groups. This method is incomplete.\r
+ */\r
public SequenceGroup findGroup(int i);\r
\r
+ /**\r
+ * Finds group that given sequence is part of.\r
+ *\r
+ * @param s Sequence in alignment.\r
+ *\r
+ * @return First group found for sequence. WARNING :\r
+ * Sequences may be members of several groups. This method is incomplete.\r
+ */\r
public SequenceGroup findGroup(SequenceI s);\r
\r
+ /**\r
+ * Finds all groups that a given sequence is part of.\r
+ *\r
+ * @param s Sequence in alignment.\r
+ *\r
+ * @return All groups containing given sequence.\r
+ */\r
public SequenceGroup[] findAllGroups(SequenceI s);\r
\r
- public void addToGroup(SequenceGroup g, SequenceI s);\r
-\r
- public void removeFromGroup(SequenceGroup g, SequenceI s);\r
-\r
+ /**\r
+ * Adds a new SequenceGroup to this alignment.\r
+ *\r
+ * @param sg New group to be added.\r
+ */\r
public void addGroup(SequenceGroup sg);\r
\r
+ /**\r
+ * Deletes a specific SequenceGroup\r
+ *\r
+ * @param g Group will be deleted from alignment.\r
+ */\r
public void deleteGroup(SequenceGroup g);\r
\r
+ /**\r
+ * Get all the groups associated with this alignment.\r
+ *\r
+ * @return All groups as a Vector.\r
+ */\r
public Vector getGroups();\r
\r
+ /**\r
+ * Deletes all groups from this alignment.\r
+ */\r
public void deleteAllGroups();\r
\r
+ /**\r
+ * Adds a super group. A SuperGroup is a group of groups.\r
+ *\r
+ * @param sg Adds a new SuperGroup to alignment\r
+ */\r
public void addSuperGroup(SuperGroup sg);\r
\r
+ /**\r
+ * Removes SuperGroup from alignment.\r
+ *\r
+ * @param sg This SuperGroup will be deleted from alignment.\r
+ */\r
public void removeSuperGroup(SuperGroup sg);\r
\r
+ /**\r
+ * Finds any SuperGroup that a given SequenceGroup may be part of.\r
+ *\r
+ * @param sg SequenceGroup to search for.\r
+ *\r
+ * @return SuperGroup that contains the given SequenceGroup.\r
+ */\r
public SuperGroup getSuperGroup(SequenceGroup sg);\r
\r
- // Sorting\r
- public void sortGroups();\r
-\r
- public void sortByPID(SequenceI s);\r
-\r
- public void sortByID();\r
-\r
- //Annotations\r
+ /**\r
+ * Adds a new AlignmentAnnotation to this alignment\r
+ */\r
public void addAnnotation(AlignmentAnnotation aa);\r
\r
+ /**\r
+ * Deletes a specific AlignmentAnnotation from the alignment.\r
+ *\r
+ * @param aa DOCUMENT ME!\r
+ */\r
public void deleteAnnotation(AlignmentAnnotation aa);\r
\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
public AlignmentAnnotation[] getAlignmentAnnotation();\r
\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param gc DOCUMENT ME!\r
+ */\r
public void setGapCharacter(char gc);\r
\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
public char getGapCharacter();\r
\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
public Vector getAAFrequency();\r
}\r
-/*
-* Jalview - A Sequence Alignment Editor and Viewer
-* Copyright (C) 2005 AM Waterhouse, J Procter, 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 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.
-*
-* 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
-*/\r
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
+ */\r
package jalview.datamodel;\r
\r
import java.util.*;\r
\r
\r
-/**
- * <p>Title: </p>
- *
- * <p>Description: </p>
- *
- * <p>Copyright: Copyright (c) 2004</p>
- *
- * <p>Company: Dundee University</p>
- *
- * @author not attributable
- * @version 1.0
+/**\r
+ * <p>Title: </p>\r
+ *\r
+ * <p>Description: </p>\r
+ *\r
+ * <p>Copyright: Copyright (c) 2004</p>\r
+ *\r
+ * <p>Company: Dundee University</p>\r
+ *\r
+ * @author not attributable\r
+ * @version 1.0\r
*/\r
-public class AlignmentOrder {\r
+public class AlignmentOrder\r
+{\r
// JBPNote : this method would return a vector containing all sequences in seqset\r
// with those also contained in order at the beginning of the vector in the order\r
// given by order. AlignmentSorter.vectorSubsetToArray already does this, but that method\r
// should be here for completeness.\r
\r
- /* public Vector getOrder(AlignmentI seqset)
- {
- Vector perm = new Vector(seqset.getHeight());
- for (i=0, o = 0, n=seqset.getHeight(), p = Order.size(); i<n; i++)
- perm.setElement(i,...).
- return Order;
- }
- */\r
+ /* public Vector getOrder(AlignmentI seqset)\r
+ {\r
+ Vector perm = new Vector(seqset.getHeight());\r
+ for (i=0, o = 0, n=seqset.getHeight(), p = Order.size(); i<n; i++)\r
+ perm.setElement(i,...).\r
+ return Order;\r
+ }\r
+ */\r
+\r
+ /** DOCUMENT ME!! */\r
public static final int FILE = 0;\r
+\r
+ /** DOCUMENT ME!! */\r
public static final int MSA = 1;\r
+\r
+ /** DOCUMENT ME!! */\r
public static final int USER = 2;\r
private int Type = 0;\r
private String Name;\r
private Vector Order = null;\r
\r
- public AlignmentOrder() {\r
+ /**\r
+ * Creates a new AlignmentOrder object.\r
+ */\r
+ public AlignmentOrder()\r
+ {\r
}\r
\r
- /**
- * AlignmentOrder
- *
- * @param anOrder Vector
- */\r
- public AlignmentOrder(Vector anOrder) {\r
+ /**\r
+ * AlignmentOrder\r
+ *\r
+ * @param anOrder Vector\r
+ */\r
+ public AlignmentOrder(Vector anOrder)\r
+ {\r
Order = anOrder;\r
}\r
\r
- /**
- * AlignmentOrder
- *
- * @param orderFrom AlignmentI
- */\r
- public AlignmentOrder(AlignmentI orderFrom) {\r
+ /**\r
+ * AlignmentOrder\r
+ *\r
+ * @param orderFrom AlignmentI\r
+ */\r
+ public AlignmentOrder(AlignmentI orderFrom)\r
+ {\r
Order = new Vector();\r
\r
for (int i = 0, ns = orderFrom.getHeight(); i < ns; i++)\r
+ {\r
Order.addElement(orderFrom.getSequenceAt(i));\r
+ }\r
}\r
\r
- public AlignmentOrder(SequenceI[] orderFrom) {\r
+ /**\r
+ * Creates a new AlignmentOrder object.\r
+ *\r
+ * @param orderFrom DOCUMENT ME!\r
+ */\r
+ public AlignmentOrder(SequenceI[] orderFrom)\r
+ {\r
Order = new Vector();\r
\r
for (int i = 0, ns = orderFrom.length; i < ns; i++)\r
+ {\r
Order.addElement(orderFrom[i]);\r
+ }\r
}\r
\r
- public void setType(int Type) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param Type DOCUMENT ME!\r
+ */\r
+ public void setType(int Type)\r
+ {\r
this.Type = Type;\r
}\r
\r
- public int getType() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public int getType()\r
+ {\r
return Type;\r
}\r
\r
- public void setName(String Name) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param Name DOCUMENT ME!\r
+ */\r
+ public void setName(String Name)\r
+ {\r
this.Name = Name;\r
}\r
\r
- public String getName() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public String getName()\r
+ {\r
return Name;\r
}\r
\r
- public void setOrder(Vector Order) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param Order DOCUMENT ME!\r
+ */\r
+ public void setOrder(Vector Order)\r
+ {\r
this.Order = Order;\r
}\r
\r
- public Vector getOrder() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public Vector getOrder()\r
+ {\r
return Order;\r
}\r
\r
- /**
- * AlignmentOrder
- *
- * @param orderThis AlignmentI
- * @param byThat AlignmentI
- */\r
+ /**\r
+ * AlignmentOrder\r
+ *\r
+ * @param orderThis AlignmentI\r
+ * @param byThat AlignmentI\r
+ */\r
+\r
+ /* public AlignmentOrder(AlignmentI orderThis, AlignmentI byThat)\r
+ {\r
+ // Vector is an ordering of this alignment using the order of sequence objects in byThat,\r
+ // where ids and unaligned sequences must match\r
\r
- /* public AlignmentOrder(AlignmentI orderThis, AlignmentI byThat)
-{
- // Vector is an ordering of this alignment using the order of sequence objects in byThat,
- // where ids and unaligned sequences must match
-
-} */\r
+ } */\r
}\r
import java.awt.*;\r
\r
\r
-public class Annotation {\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class Annotation\r
+{\r
+ /** DOCUMENT ME!! */\r
public String displayCharacter = "";\r
+\r
+ /** DOCUMENT ME!! */\r
public String description = ""; // currently used as mouse over\r
+\r
+ /** DOCUMENT ME!! */\r
public char secondaryStructure = ' '; // recognises H and E\r
+\r
+ /** DOCUMENT ME!! */\r
public float value;\r
\r
// add visual cues here\r
+\r
+ /** DOCUMENT ME!! */\r
public Color colour = Color.black;\r
\r
- public Annotation(String displayChar, String desc, char ss, float val) {\r
+ /**\r
+ * Creates a new Annotation object.\r
+ *\r
+ * @param displayChar DOCUMENT ME!\r
+ * @param desc DOCUMENT ME!\r
+ * @param ss DOCUMENT ME!\r
+ * @param val DOCUMENT ME!\r
+ */\r
+ public Annotation(String displayChar, String desc, char ss, float val)\r
+ {\r
displayCharacter = displayChar;\r
description = desc;\r
secondaryStructure = ss;\r
value = val;\r
}\r
\r
+ /**\r
+ * Creates a new Annotation object.\r
+ *\r
+ * @param displayChar DOCUMENT ME!\r
+ * @param desc DOCUMENT ME!\r
+ * @param ss DOCUMENT ME!\r
+ * @param val DOCUMENT ME!\r
+ * @param colour DOCUMENT ME!\r
+ */\r
public Annotation(String displayChar, String desc, char ss, float val,\r
- Color colour) {\r
+ Color colour)\r
+ {\r
this(displayChar, desc, ss, val);\r
this.colour = colour;\r
}\r
-/*
-* Jalview - A Sequence Alignment Editor and Viewer
-* Copyright (C) 2005 AM Waterhouse, J Procter, 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 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.
-*
-* 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
-*/\r
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
+ */\r
package jalview.datamodel;\r
\r
-public class BinaryNode {\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class BinaryNode\r
+{\r
Object element;\r
String name;\r
BinaryNode left;\r
BinaryNode right;\r
BinaryNode parent;\r
+\r
+ /** DOCUMENT ME!! */\r
public int bootstrap;\r
\r
- public BinaryNode() {\r
+ /**\r
+ * Creates a new BinaryNode object.\r
+ */\r
+ public BinaryNode()\r
+ {\r
left = right = parent = null;\r
bootstrap = 0;\r
}\r
\r
- public BinaryNode(Object element, BinaryNode parent, String name) {\r
+ /**\r
+ * Creates a new BinaryNode object.\r
+ *\r
+ * @param element DOCUMENT ME!\r
+ * @param parent DOCUMENT ME!\r
+ * @param name DOCUMENT ME!\r
+ */\r
+ public BinaryNode(Object element, BinaryNode parent, String name)\r
+ {\r
this.element = element;\r
this.parent = parent;\r
this.name = name;\r
left = right = null;\r
}\r
\r
- public Object element() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public Object element()\r
+ {\r
return element;\r
}\r
\r
- public Object setElement(Object v) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param v DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public Object setElement(Object v)\r
+ {\r
return element = v;\r
}\r
\r
- public BinaryNode left() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public BinaryNode left()\r
+ {\r
return left;\r
}\r
\r
- public BinaryNode setLeft(BinaryNode n) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param n DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public BinaryNode setLeft(BinaryNode n)\r
+ {\r
return left = n;\r
}\r
\r
- public BinaryNode right() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public BinaryNode right()\r
+ {\r
return right;\r
}\r
\r
- public BinaryNode setRight(BinaryNode n) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param n DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public BinaryNode setRight(BinaryNode n)\r
+ {\r
return right = n;\r
}\r
\r
- public BinaryNode parent() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public BinaryNode parent()\r
+ {\r
return parent;\r
}\r
\r
- public BinaryNode setParent(BinaryNode n) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param n DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public BinaryNode setParent(BinaryNode n)\r
+ {\r
return parent = n;\r
}\r
\r
- public boolean isLeaf() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public boolean isLeaf()\r
+ {\r
return (left == null) && (right == null);\r
}\r
\r
- /**
- * attaches FIRST and SECOND node arguments as the LEFT and RIGHT children of this node (removing any old references)
- * a null parameter DOES NOT mean that the pointer to the corresponding child node is set to NULL - you should use
- * setChild(null), or detach() for this.
- *
- */\r
- public void SetChildren(BinaryNode leftchild, BinaryNode rightchild) {\r
- if (leftchild != null) {\r
+ /**\r
+ * attaches FIRST and SECOND node arguments as the LEFT and RIGHT children of this node (removing any old references)\r
+ * a null parameter DOES NOT mean that the pointer to the corresponding child node is set to NULL - you should use\r
+ * setChild(null), or detach() for this.\r
+ *\r
+ */\r
+ public void SetChildren(BinaryNode leftchild, BinaryNode rightchild)\r
+ {\r
+ if (leftchild != null)\r
+ {\r
this.setLeft(leftchild);\r
leftchild.detach();\r
leftchild.setParent(this);\r
}\r
\r
- if (rightchild != null) {\r
+ if (rightchild != null)\r
+ {\r
this.setRight(rightchild);\r
rightchild.detach();\r
rightchild.setParent(this);\r
}\r
}\r
\r
- /**
- * Detaches the node from the binary tree, along with all its child nodes.
- * @return BinaryNode The detached node.
- */\r
- public BinaryNode detach() {\r
- if (this.parent != null) {\r
- if (this.parent.left == this) {\r
+ /**\r
+ * Detaches the node from the binary tree, along with all its child nodes.\r
+ * @return BinaryNode The detached node.\r
+ */\r
+ public BinaryNode detach()\r
+ {\r
+ if (this.parent != null)\r
+ {\r
+ if (this.parent.left == this)\r
+ {\r
this.parent.left = null;\r
- } else {\r
- if (this.parent.right == this) {\r
+ }\r
+ else\r
+ {\r
+ if (this.parent.right == this)\r
+ {\r
this.parent.right = null;\r
}\r
}\r
return this;\r
}\r
\r
- /**
- * Traverses up through the tree until a node with a free leftchild is discovered.
- * @return BinaryNode
- */\r
- public BinaryNode ascendLeft() {\r
+ /**\r
+ * Traverses up through the tree until a node with a free leftchild is discovered.\r
+ * @return BinaryNode\r
+ */\r
+ public BinaryNode ascendLeft()\r
+ {\r
BinaryNode c = this;\r
\r
- do {\r
+ do\r
+ {\r
c = c.parent();\r
- } while ((c != null) && (c.left() != null) && !c.left().isLeaf());\r
+ }\r
+ while ((c != null) && (c.left() != null) && !c.left().isLeaf());\r
\r
return c;\r
}\r
\r
- /**
- * Traverses up through the tree until a node with a free rightchild is discovered.
- * Jalview builds trees by descent on the left, so this may be unused.
- * @return BinaryNode
- */\r
- public BinaryNode ascendRight() {\r
+ /**\r
+ * Traverses up through the tree until a node with a free rightchild is discovered.\r
+ * Jalview builds trees by descent on the left, so this may be unused.\r
+ * @return BinaryNode\r
+ */\r
+ public BinaryNode ascendRight()\r
+ {\r
BinaryNode c = this;\r
\r
- do {\r
+ do\r
+ {\r
c = c.parent();\r
- } while ((c != null) && (c.right() != null) && !c.right().isLeaf());\r
+ }\r
+ while ((c != null) && (c.right() != null) && !c.right().isLeaf());\r
\r
return c;\r
}\r
\r
- public void setName(String name) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param name DOCUMENT ME!\r
+ */\r
+ public void setName(String name)\r
+ {\r
this.name = name;\r
}\r
\r
- public String getName() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public String getName()\r
+ {\r
return this.name;\r
}\r
\r
- public void setBootstrap(int boot) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param boot DOCUMENT ME!\r
+ */\r
+ public void setBootstrap(int boot)\r
+ {\r
this.bootstrap = boot;\r
}\r
\r
- public int getBootstrap() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public int getBootstrap()\r
+ {\r
return bootstrap;\r
}\r
}\r
import java.awt.*;\r
\r
\r
-public class BinarySequence extends Sequence {\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class BinarySequence extends Sequence\r
+{\r
int[] binary;\r
double[] dbinary;\r
\r
- public BinarySequence(SequenceI s) {\r
+ /**\r
+ * Creates a new BinarySequence object.\r
+ *\r
+ * @param s DOCUMENT ME!\r
+ */\r
+ public BinarySequence(SequenceI s)\r
+ {\r
super(s.getName(), s.getSequence(), s.getStart(), s.getEnd());\r
}\r
\r
- public BinarySequence(String name, String sequence, int start, int end) {\r
+ /**\r
+ * Creates a new BinarySequence object.\r
+ *\r
+ * @param name DOCUMENT ME!\r
+ * @param sequence DOCUMENT ME!\r
+ * @param start DOCUMENT ME!\r
+ * @param end DOCUMENT ME!\r
+ */\r
+ public BinarySequence(String name, String sequence, int start, int end)\r
+ {\r
super(name, sequence, start, end);\r
}\r
\r
- public void encode() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ public void encode()\r
+ {\r
// Set all matrix to 0\r
dbinary = new double[getSequence().length() * 21];\r
\r
int nores = 21;\r
\r
- for (int i = 0; i < dbinary.length; i++) {\r
+ for (int i = 0; i < dbinary.length; i++)\r
+ {\r
dbinary[i] = 0.0;\r
}\r
\r
- for (int i = 0; i < getSequence().length(); i++) {\r
+ for (int i = 0; i < getSequence().length(); i++)\r
+ {\r
int aanum = 20;\r
\r
- try {\r
+ try\r
+ {\r
aanum = ((Integer) ResidueProperties.getAAHash().get(getSequence()\r
.substring(i,\r
i + 1))).intValue();\r
- } catch (NullPointerException e) {\r
+ }\r
+ catch (NullPointerException e)\r
+ {\r
aanum = 20;\r
}\r
\r
- if (aanum > 20) {\r
+ if (aanum > 20)\r
+ {\r
aanum = 20;\r
}\r
\r
}\r
}\r
\r
- public void blosumEncode() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ public void blosumEncode()\r
+ {\r
// Set all matrix to 0\r
dbinary = new double[getSequence().length() * 21];\r
\r
//for (int i = 0; i < dbinary.length; i++) {\r
// dbinary[i] = 0.0;\r
//}\r
- for (int i = 0; i < getSequence().length(); i++) {\r
+ for (int i = 0; i < getSequence().length(); i++)\r
+ {\r
int aanum = 20;\r
\r
- try {\r
+ try\r
+ {\r
aanum = ((Integer) ResidueProperties.getAAHash().get(getSequence()\r
.substring(i,\r
i + 1))).intValue();\r
- } catch (NullPointerException e) {\r
+ }\r
+ catch (NullPointerException e)\r
+ {\r
aanum = 20;\r
}\r
\r
- if (aanum > 20) {\r
+ if (aanum > 20)\r
+ {\r
aanum = 20;\r
}\r
\r
// Do the blosum thing\r
- for (int j = 0; j < 20; j++) {\r
+ for (int j = 0; j < 20; j++)\r
+ {\r
dbinary[(i * nores) + j] = ResidueProperties.getBLOSUM62()[aanum][j];\r
}\r
}\r
}\r
\r
- public String toBinaryString() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public String toBinaryString()\r
+ {\r
String out = "";\r
\r
- for (int i = 0; i < binary.length; i++) {\r
+ for (int i = 0; i < binary.length; i++)\r
+ {\r
out += (new Integer(binary[i])).toString();\r
\r
- if (i < (binary.length - 1)) {\r
+ if (i < (binary.length - 1))\r
+ {\r
out += " ";\r
}\r
}\r
return out;\r
}\r
\r
- public double[] getDBinary() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public double[] getDBinary()\r
+ {\r
return dbinary;\r
}\r
\r
- public static void printMemory(Runtime rt) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param rt DOCUMENT ME!\r
+ */\r
+ public static void printMemory(Runtime rt)\r
+ {\r
System.out.println("DEBUG: Free memory = " + rt.freeMemory()); // log.\r
}\r
}\r
import java.util.*;\r
\r
\r
-public class HistoryItem {\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class HistoryItem\r
+{\r
+ /** DOCUMENT ME!! */\r
public static final int EDIT = 0;\r
+\r
+ /** DOCUMENT ME!! */\r
public static final int SORT = 1;\r
+\r
+ /** DOCUMENT ME!! */\r
public static final int HIDE = 2;\r
+\r
+ /** DOCUMENT ME!! */\r
public static final int PASTE = 3;\r
final int type;\r
Vector sequences;\r
String description;\r
Vector hiddenSeqs;\r
\r
- public HistoryItem(String description, AlignmentI al, int type) {\r
+ /**\r
+ * Creates a new HistoryItem object.\r
+ *\r
+ * @param description DOCUMENT ME!\r
+ * @param al DOCUMENT ME!\r
+ * @param type DOCUMENT ME!\r
+ */\r
+ public HistoryItem(String description, AlignmentI al, int type)\r
+ {\r
this.type = type;\r
this.description = description;\r
sequences = new Vector();\r
alignIndex = new Vector();\r
hiddenSeqs = new Vector();\r
\r
- for (int i = 0; i < al.getHeight(); i++) {\r
+ for (int i = 0; i < al.getHeight(); i++)\r
+ {\r
SequenceI seq = al.getSequenceAt(i);\r
sequences.addElement(seq);\r
alignIndex.addElement(i + "");\r
}\r
}\r
\r
- public int getType() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public int getType()\r
+ {\r
return type;\r
}\r
\r
- public Vector getSequences() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public Vector getSequences()\r
+ {\r
return sequences;\r
}\r
\r
- public String getDescription() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public String getDescription()\r
+ {\r
return description;\r
}\r
\r
- public Vector getHidden() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public Vector getHidden()\r
+ {\r
return hiddenSeqs;\r
}\r
\r
- public int getAlignIndex(int seq) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param seq DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public int getAlignIndex(int seq)\r
+ {\r
return Integer.parseInt(alignIndex.elementAt(seq).toString());\r
}\r
}\r
import java.util.*;\r
\r
\r
-public class Sequence implements SequenceI {\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class Sequence implements SequenceI\r
+{\r
protected String name;\r
protected String sequence;\r
protected String description;\r
protected String displayId;\r
protected Color color = Color.white;\r
String pdbId;\r
+\r
+ /** DOCUMENT ME!! */\r
public Vector sequenceFeatures = new Vector();\r
\r
- public Sequence(String name, String sequence, int start, int end) {\r
+ /**\r
+ * Creates a new Sequence object.\r
+ *\r
+ * @param name DOCUMENT ME!\r
+ * @param sequence DOCUMENT ME!\r
+ * @param start DOCUMENT ME!\r
+ * @param end DOCUMENT ME!\r
+ */\r
+ public Sequence(String name, String sequence, int start, int end)\r
+ {\r
this.name = name;\r
this.sequence = sequence;\r
this.start = start;\r
setDisplayId();\r
}\r
\r
- public Sequence(String name, String sequence) {\r
+ /**\r
+ * Creates a new Sequence object.\r
+ *\r
+ * @param name DOCUMENT ME!\r
+ * @param sequence DOCUMENT ME!\r
+ */\r
+ public Sequence(String name, String sequence)\r
+ {\r
this(name, sequence, 1, sequence.length());\r
}\r
\r
- public Sequence(SequenceI seq) {\r
+ /**\r
+ * Creates a new Sequence object.\r
+ *\r
+ * @param seq DOCUMENT ME!\r
+ */\r
+ public Sequence(SequenceI seq)\r
+ {\r
this(seq.getName(), seq.getSequence(), seq.getStart(), seq.getEnd());\r
}\r
\r
- public void setSequenceFeatures(Vector v) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param v DOCUMENT ME!\r
+ */\r
+ public void setSequenceFeatures(Vector v)\r
+ {\r
sequenceFeatures = v;\r
}\r
\r
- public Vector getSequenceFeatures() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public Vector getSequenceFeatures()\r
+ {\r
return sequenceFeatures;\r
}\r
\r
- public void setPDBId(String id) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param id DOCUMENT ME!\r
+ */\r
+ public void setPDBId(String id)\r
+ {\r
pdbId = id;\r
}\r
\r
- public String getPDBId() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public String getPDBId()\r
+ {\r
return pdbId;\r
}\r
\r
- public String getDisplayId() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public String getDisplayId()\r
+ {\r
return displayId;\r
}\r
\r
- public void setDisplayId() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ public void setDisplayId()\r
+ {\r
displayId = name + "/" + start + "-" + end;\r
}\r
\r
- public void setName(String name) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param name DOCUMENT ME!\r
+ */\r
+ public void setName(String name)\r
+ {\r
this.name = name;\r
setDisplayId();\r
}\r
\r
- public String getName() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public String getName()\r
+ {\r
return this.name;\r
}\r
\r
- public void setStart(int start) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param start DOCUMENT ME!\r
+ */\r
+ public void setStart(int start)\r
+ {\r
this.start = start;\r
setDisplayId();\r
}\r
\r
- public int getStart() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public int getStart()\r
+ {\r
return this.start;\r
}\r
\r
- public void setEnd(int end) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param end DOCUMENT ME!\r
+ */\r
+ public void setEnd(int end)\r
+ {\r
this.end = end;\r
setDisplayId();\r
}\r
\r
- public int getEnd() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public int getEnd()\r
+ {\r
return this.end;\r
}\r
\r
- public int getLength() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public int getLength()\r
+ {\r
return this.sequence.length();\r
}\r
\r
- public void setSequence(String seq) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param seq DOCUMENT ME!\r
+ */\r
+ public void setSequence(String seq)\r
+ {\r
this.sequence = seq;\r
}\r
\r
- public String getSequence() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public String getSequence()\r
+ {\r
return this.sequence;\r
}\r
\r
- public String getSequence(int start, int end) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param start DOCUMENT ME!\r
+ * @param end DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public String getSequence(int start, int end)\r
+ {\r
// JBPNote - left to user to pad the result here (TODO:Decide on this policy)\r
- if (start >= sequence.length()) {\r
+ if (start >= sequence.length())\r
+ {\r
return "";\r
}\r
\r
- if (end >= sequence.length()) {\r
+ if (end >= sequence.length())\r
+ {\r
end = sequence.length();\r
}\r
\r
return this.sequence.substring(start, end);\r
}\r
\r
- public char getCharAt(int i) {\r
- if (i < sequence.length()) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param i DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public char getCharAt(int i)\r
+ {\r
+ if (i < sequence.length())\r
+ {\r
return sequence.charAt(i);\r
- } else {\r
+ }\r
+ else\r
+ {\r
return ' ';\r
}\r
}\r
\r
- public void setDescription(String desc) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param desc DOCUMENT ME!\r
+ */\r
+ public void setDescription(String desc)\r
+ {\r
this.description = desc;\r
}\r
\r
- public String getDescription() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public String getDescription()\r
+ {\r
return this.description;\r
}\r
\r
- public int findIndex(int pos) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param pos DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public int findIndex(int pos)\r
+ {\r
// returns the alignment position for a residue\r
int j = start;\r
int i = 0;\r
\r
- while ((i < sequence.length()) && (j <= end) && (j <= pos)) {\r
+ while ((i < sequence.length()) && (j <= end) && (j <= pos))\r
+ {\r
char c = sequence.charAt(i);\r
\r
- if (!jalview.util.Comparison.isGap((c))) {\r
+ if (!jalview.util.Comparison.isGap((c)))\r
+ {\r
j++;\r
}\r
\r
i++;\r
}\r
\r
- if ((j == end) && (j < pos)) {\r
+ if ((j == end) && (j < pos))\r
+ {\r
return end + 1;\r
- } else {\r
+ }\r
+ else\r
+ {\r
return i;\r
}\r
}\r
\r
- public int findPosition(int i) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param i DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public int findPosition(int i)\r
+ {\r
// Returns the sequence position for an alignment position\r
int j = 0;\r
int pos = start;\r
\r
- while ((j < i) && (j < sequence.length())) {\r
+ while ((j < i) && (j < sequence.length()))\r
+ {\r
char c = sequence.charAt(j);\r
\r
- if (!jalview.util.Comparison.isGap((c))) {\r
+ if (!jalview.util.Comparison.isGap((c)))\r
+ {\r
pos++;\r
}\r
\r
return pos;\r
}\r
\r
- public int[] gapMap() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public int[] gapMap()\r
+ {\r
// Returns an int array giving the position of each residue in the sequence in the alignment\r
String seq = jalview.analysis.AlignSeq.extractGaps("-. ", sequence);\r
int[] map = new int[seq.length()];\r
int j = 0;\r
int p = 0;\r
\r
- while (j < sequence.length()) {\r
- if (!jalview.util.Comparison.isGap(sequence.charAt(j))) {\r
+ while (j < sequence.length())\r
+ {\r
+ if (!jalview.util.Comparison.isGap(sequence.charAt(j)))\r
+ {\r
map[p++] = j;\r
}\r
\r
return map;\r
}\r
\r
- public void deleteCharAt(int i) {\r
- if (i >= sequence.length()) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param i DOCUMENT ME!\r
+ */\r
+ public void deleteCharAt(int i)\r
+ {\r
+ if (i >= sequence.length())\r
+ {\r
return;\r
}\r
\r
sequence = sequence.substring(0, i) + sequence.substring(i + 1);\r
}\r
\r
- public void deleteChars(int i, int j) {\r
- if (i >= sequence.length()) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param i DOCUMENT ME!\r
+ * @param j DOCUMENT ME!\r
+ */\r
+ public void deleteChars(int i, int j)\r
+ {\r
+ if (i >= sequence.length())\r
+ {\r
return;\r
}\r
\r
- if (j >= sequence.length()) {\r
+ if (j >= sequence.length())\r
+ {\r
sequence = sequence.substring(0, i);\r
- } else {\r
+ }\r
+ else\r
+ {\r
sequence = sequence.substring(0, i) + sequence.substring(j);\r
}\r
}\r
\r
- public void insertCharAt(int i, char c) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param i DOCUMENT ME!\r
+ * @param c DOCUMENT ME!\r
+ */\r
+ public void insertCharAt(int i, char c)\r
+ {\r
insertCharAt(i, c, true);\r
}\r
\r
- public void insertCharAt(int i, char c, boolean chop) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param i DOCUMENT ME!\r
+ * @param c DOCUMENT ME!\r
+ * @param chop DOCUMENT ME!\r
+ */\r
+ public void insertCharAt(int i, char c, boolean chop)\r
+ {\r
String tmp = new String(sequence);\r
\r
- if (i < sequence.length()) {\r
+ if (i < sequence.length())\r
+ {\r
sequence = tmp.substring(0, i) + String.valueOf(c) +\r
tmp.substring(i);\r
- } else {\r
+ }\r
+ else\r
+ {\r
// JBPNote : padding char at end of sequence. We'll not get away with this when we insert residues, I bet!\r
char[] ch = new char[(1 + i) - sequence.length()];\r
\r
}\r
}\r
\r
- public void setColor(Color c) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param c DOCUMENT ME!\r
+ */\r
+ public void setColor(Color c)\r
+ {\r
this.color = c;\r
}\r
\r
- public Color getColor() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public Color getColor()\r
+ {\r
return color;\r
}\r
}\r
/*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
-*\r
-* This program is free software; you can redistribute it and/or\r
-* modify it under the terms of the GNU General Public License\r
-* as published by the Free Software Foundation; either version 2\r
-* of the License, or (at your option) any later version.\r
-*\r
-* This program is distributed in the hope that it will be useful,\r
-* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-* GNU General Public License for more details.\r
-*\r
-* You should have received a copy of the GNU General Public License\r
-* along with this program; if not, write to the Free Software\r
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
-*/\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
+ */\r
package jalview.datamodel;\r
\r
-public class SequenceFeature {\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class SequenceFeature\r
+{\r
int begin;\r
int end;\r
String type;\r
String description;\r
String status;\r
\r
- public SequenceFeature() {\r
+ /**\r
+ * Creates a new SequenceFeature object.\r
+ */\r
+ public SequenceFeature()\r
+ {\r
}\r
\r
+ /**\r
+ * Creates a new SequenceFeature object.\r
+ *\r
+ * @param type DOCUMENT ME!\r
+ * @param start DOCUMENT ME!\r
+ * @param end DOCUMENT ME!\r
+ * @param description DOCUMENT ME!\r
+ * @param status DOCUMENT ME!\r
+ */\r
public SequenceFeature(String type, int start, int end, String description,\r
- String status) {\r
+ String status)\r
+ {\r
this.type = type;\r
this.begin = start;\r
this.end = end;\r
this.status = status;\r
}\r
\r
- public int getStart() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public int getStart()\r
+ {\r
return begin;\r
}\r
\r
- public int getEnd() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public int getEnd()\r
+ {\r
return end;\r
}\r
\r
- public String getType() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public String getType()\r
+ {\r
return type;\r
}\r
\r
- public String getDescription() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public String getDescription()\r
+ {\r
return description;\r
}\r
\r
- public String getStatus() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public String getStatus()\r
+ {\r
return status;\r
}\r
\r
/*\r
<xs:enumeration value="active site" />\r
- <xs:enumeration value="binding site" />\r
- <xs:enumeration value="calcium-binding region" />\r
- <xs:enumeration value="chain" />\r
- <xs:enumeration value="cross-link" />\r
- <xs:enumeration value="disulfide bond" />\r
- <xs:enumeration value="DNA-binding region" />\r
- <xs:enumeration value="domain" />\r
- <xs:enumeration value="glycosylation site" />\r
- <xs:enumeration value="helix" />\r
- <xs:enumeration value="initiator methionine" />\r
- <xs:enumeration value="lipid moiety-binding region" />\r
- <xs:enumeration value="metal ion-binding site" />\r
- <xs:enumeration value="modified residue" />\r
- <xs:enumeration value="mutagenesis site" />\r
- <xs:enumeration value="non-consecutive residues" />\r
- <xs:enumeration value="non-terminal residue" />\r
- <xs:enumeration value="nucleotide phosphate-binding region" />\r
- <xs:enumeration value="peptide" />\r
- <xs:enumeration value="propeptide" />\r
- <xs:enumeration value="repeat" />\r
- <xs:enumeration value="selenocysteine" />\r
- <xs:enumeration value="sequence conflict" />\r
- <xs:enumeration value="sequence variant" />\r
- <xs:enumeration value="signal peptide" />\r
- <xs:enumeration value="similar" />\r
- <xs:enumeration value="site" />\r
- <xs:enumeration value="splice variant" />\r
- <xs:enumeration value="strand" />\r
- <xs:enumeration value="thioether bond" />\r
- <xs:enumeration value="thiolester bond" />\r
- <xs:enumeration value="transit peptide" />\r
- <xs:enumeration value="transmembrane region" />\r
- <xs:enumeration value="turn" />\r
- <xs:enumeration value="unsure residue" />\r
- <xs:enumeration value="zinc finger region" />\r
- */\r
+ <xs:enumeration value="binding site" />\r
+ <xs:enumeration value="calcium-binding region" />\r
+ <xs:enumeration value="chain" />\r
+ <xs:enumeration value="cross-link" />\r
+ <xs:enumeration value="disulfide bond" />\r
+ <xs:enumeration value="DNA-binding region" />\r
+ <xs:enumeration value="domain" />\r
+ <xs:enumeration value="glycosylation site" />\r
+ <xs:enumeration value="helix" />\r
+ <xs:enumeration value="initiator methionine" />\r
+ <xs:enumeration value="lipid moiety-binding region" />\r
+ <xs:enumeration value="metal ion-binding site" />\r
+ <xs:enumeration value="modified residue" />\r
+ <xs:enumeration value="mutagenesis site" />\r
+ <xs:enumeration value="non-consecutive residues" />\r
+ <xs:enumeration value="non-terminal residue" />\r
+ <xs:enumeration value="nucleotide phosphate-binding region" />\r
+ <xs:enumeration value="peptide" />\r
+ <xs:enumeration value="propeptide" />\r
+ <xs:enumeration value="repeat" />\r
+ <xs:enumeration value="selenocysteine" />\r
+ <xs:enumeration value="sequence conflict" />\r
+ <xs:enumeration value="sequence variant" />\r
+ <xs:enumeration value="signal peptide" />\r
+ <xs:enumeration value="similar" />\r
+ <xs:enumeration value="site" />\r
+ <xs:enumeration value="splice variant" />\r
+ <xs:enumeration value="strand" />\r
+ <xs:enumeration value="thioether bond" />\r
+ <xs:enumeration value="thiolester bond" />\r
+ <xs:enumeration value="transit peptide" />\r
+ <xs:enumeration value="transmembrane region" />\r
+ <xs:enumeration value="turn" />\r
+ <xs:enumeration value="unsure residue" />\r
+ <xs:enumeration value="zinc finger region" />\r
+ */\r
}\r
\r
import jalview.analysis.*;\r
\r
-import jalview.datamodel.*;\r
-\r
import jalview.schemes.*;\r
\r
import java.awt.*;\r
\r
-import java.util.Vector;\r
+import java.util.*;\r
+\r
\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
public class SequenceGroup\r
{\r
- String groupName;\r
- Conservation conserve;\r
- Vector aaFrequency;\r
- boolean displayBoxes;\r
- boolean displayText;\r
- boolean colourText;\r
- public Vector sequences = new Vector();\r
- int width = -1;\r
- public ColourSchemeI cs;\r
- int startRes = 0;\r
- int endRes = 0;\r
- Color outlineColour = Color.black;\r
-\r
- public SequenceGroup()\r
- {\r
- groupName = "Group";\r
- this.displayBoxes = true;\r
- this.displayText = true;\r
- this.colourText = false;\r
- cs = null;\r
- }\r
-\r
- public SequenceGroup(Vector sequences, String groupName, ColourSchemeI scheme,\r
- boolean displayBoxes, boolean displayText,\r
- boolean colourText,\r
- int start, int end)\r
- {\r
- this.sequences = sequences;\r
- this.groupName = groupName;\r
- this.displayBoxes = displayBoxes;\r
- this.displayText = displayText;\r
- this.colourText = colourText;\r
- this.cs = scheme;\r
- startRes = start;\r
- endRes = end;\r
- recalcConservation();\r
- }\r
-\r
- public SequenceGroup(String groupName, ColourSchemeI scheme,\r
- boolean displayBoxes, boolean displayText,\r
- boolean colourText,\r
- int start, int end)\r
- {\r
- this.groupName = groupName;\r
- this.displayBoxes = displayBoxes;\r
- this.displayText = displayText;\r
- this.colourText = colourText;\r
- this.cs = scheme;\r
- startRes = start;\r
- endRes = end;\r
- }\r
-\r
- public boolean adjustForRemoveLeft(int col)\r
- {\r
- // return value is true if the group still exists\r
- if (startRes >= col)\r
+ String groupName;\r
+ Conservation conserve;\r
+ Vector aaFrequency;\r
+ boolean displayBoxes;\r
+ boolean displayText;\r
+ boolean colourText;\r
+\r
+ /** DOCUMENT ME!! */\r
+ public Vector sequences = new Vector();\r
+ int width = -1;\r
+\r
+ /** DOCUMENT ME!! */\r
+ public ColourSchemeI cs;\r
+ int startRes = 0;\r
+ int endRes = 0;\r
+ Color outlineColour = Color.black;\r
+\r
+ /**\r
+ * Creates a new SequenceGroup object.\r
+ */\r
+ public SequenceGroup()\r
{\r
- startRes = startRes - col;\r
+ groupName = "Group";\r
+ this.displayBoxes = true;\r
+ this.displayText = true;\r
+ this.colourText = false;\r
+ cs = null;\r
}\r
\r
- if (endRes >= col)\r
+ /**\r
+ * Creates a new SequenceGroup object.\r
+ *\r
+ * @param sequences DOCUMENT ME!\r
+ * @param groupName DOCUMENT ME!\r
+ * @param scheme DOCUMENT ME!\r
+ * @param displayBoxes DOCUMENT ME!\r
+ * @param displayText DOCUMENT ME!\r
+ * @param colourText DOCUMENT ME!\r
+ * @param start DOCUMENT ME!\r
+ * @param end DOCUMENT ME!\r
+ */\r
+ public SequenceGroup(Vector sequences, String groupName,\r
+ ColourSchemeI scheme, boolean displayBoxes, boolean displayText,\r
+ boolean colourText, int start, int end)\r
{\r
- endRes = endRes - col;\r
+ this.sequences = sequences;\r
+ this.groupName = groupName;\r
+ this.displayBoxes = displayBoxes;\r
+ this.displayText = displayText;\r
+ this.colourText = colourText;\r
+ this.cs = scheme;\r
+ startRes = start;\r
+ endRes = end;\r
+ recalcConservation();\r
+ }\r
\r
- if (startRes > endRes)\r
- {\r
- startRes = 0;\r
- }\r
+ /**\r
+ * Creates a new SequenceGroup object.\r
+ *\r
+ * @param groupName DOCUMENT ME!\r
+ * @param scheme DOCUMENT ME!\r
+ * @param displayBoxes DOCUMENT ME!\r
+ * @param displayText DOCUMENT ME!\r
+ * @param colourText DOCUMENT ME!\r
+ * @param start DOCUMENT ME!\r
+ * @param end DOCUMENT ME!\r
+ */\r
+ public SequenceGroup(String groupName, ColourSchemeI scheme,\r
+ boolean displayBoxes, boolean displayText, boolean colourText,\r
+ int start, int end)\r
+ {\r
+ this.groupName = groupName;\r
+ this.displayBoxes = displayBoxes;\r
+ this.displayText = displayText;\r
+ this.colourText = colourText;\r
+ this.cs = scheme;\r
+ startRes = start;\r
+ endRes = end;\r
}\r
- else\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param col DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public boolean adjustForRemoveLeft(int col)\r
{\r
- // must delete this group!!\r
- return false;\r
+ // return value is true if the group still exists\r
+ if (startRes >= col)\r
+ {\r
+ startRes = startRes - col;\r
+ }\r
+\r
+ if (endRes >= col)\r
+ {\r
+ endRes = endRes - col;\r
+\r
+ if (startRes > endRes)\r
+ {\r
+ startRes = 0;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ // must delete this group!!\r
+ return false;\r
+ }\r
+\r
+ return true;\r
}\r
\r
- return true;\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param col DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public boolean adjustForRemoveRight(int col)\r
+ {\r
+ if (startRes > col)\r
+ {\r
+ // delete this group\r
+ return false;\r
+ }\r
+\r
+ if (endRes >= col)\r
+ {\r
+ endRes = col;\r
+ }\r
\r
- public boolean adjustForRemoveRight(int col)\r
- {\r
- if (startRes > col)\r
+ return true;\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public String getName()\r
{\r
- // delete this group\r
- return false;\r
+ return groupName;\r
}\r
\r
- if (endRes >= col)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param name DOCUMENT ME!\r
+ */\r
+ public void setName(String name)\r
{\r
- endRes = col;\r
+ groupName = name;\r
}\r
\r
- return true;\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public Conservation getConservation()\r
+ {\r
+ return conserve;\r
+ }\r
\r
- public String getName()\r
- {\r
- return groupName;\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param c DOCUMENT ME!\r
+ */\r
+ public void setConservation(Conservation c)\r
+ {\r
+ conserve = c;\r
+ }\r
\r
- public void setName(String name)\r
- {\r
- groupName = name;\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param s DOCUMENT ME!\r
+ * @param recalc DOCUMENT ME!\r
+ */\r
+ public void addSequence(SequenceI s, boolean recalc)\r
+ {\r
+ if (!sequences.contains(s))\r
+ {\r
+ sequences.addElement(s);\r
+ }\r
\r
- public Conservation getConservation()\r
- {\r
- return conserve;\r
- }\r
+ if (recalc)\r
+ {\r
+ recalcConservation();\r
+ }\r
+ }\r
\r
- public void setConservation(Conservation c)\r
- {\r
- conserve = c;\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ public void recalcConservation()\r
+ {\r
+ if (cs != null)\r
+ {\r
+ cs.setConsensus(AAFrequency.calculate(sequences, 0, getWidth()));\r
+ }\r
\r
- public void addSequence(SequenceI s, boolean recalc)\r
- {\r
- if (!sequences.contains(s))\r
- sequences.addElement(s);\r
+ if (cs instanceof ClustalxColourScheme)\r
+ {\r
+ ((ClustalxColourScheme) cs).resetClustalX(sequences, getWidth());\r
+ }\r
\r
- if(recalc)\r
- recalcConservation();\r
- }\r
+ if (cs instanceof ConservationColourScheme)\r
+ {\r
+ Conservation c = new Conservation(groupName,\r
+ ResidueProperties.propHash, 3, sequences, 0, getWidth());\r
+ c.calculate();\r
+ c.verdict(false, 25);\r
+\r
+ ConservationColourScheme ccs = (ConservationColourScheme) cs;\r
+ ccs.conserve = c;\r
+\r
+ if (ccs.cs instanceof ClustalxColourScheme)\r
+ {\r
+ ((ClustalxColourScheme) ccs.cs).resetClustalX(sequences,\r
+ getWidth());\r
+ }\r
+ }\r
+ }\r
\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param s DOCUMENT ME!\r
+ * @param recalc DOCUMENT ME!\r
+ */\r
+ public void addOrRemove(SequenceI s, boolean recalc)\r
+ {\r
+ if (sequences.contains(s))\r
+ {\r
+ deleteSequence(s, recalc);\r
+ }\r
+ else\r
+ {\r
+ addSequence(s, recalc);\r
+ }\r
+ }\r
\r
- public void recalcConservation()\r
- {\r
- if (cs != null)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param s DOCUMENT ME!\r
+ * @param recalc DOCUMENT ME!\r
+ */\r
+ public void deleteSequence(SequenceI s, boolean recalc)\r
{\r
- cs.setConsensus(AAFrequency.calculate(sequences, 0, getWidth()));\r
+ sequences.removeElement(s);\r
+\r
+ if (recalc)\r
+ {\r
+ recalcConservation();\r
+ }\r
}\r
\r
- if (cs instanceof ClustalxColourScheme)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public int getStartRes()\r
{\r
- ( (ClustalxColourScheme) cs).resetClustalX(sequences,getWidth());\r
+ return startRes;\r
}\r
\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public int getEndRes()\r
+ {\r
+ return endRes;\r
+ }\r
\r
- if ( cs instanceof ConservationColourScheme)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param i DOCUMENT ME!\r
+ */\r
+ public void setStartRes(int i)\r
{\r
- Conservation c = new Conservation(groupName,\r
- ResidueProperties.propHash, 3, sequences,\r
- 0, getWidth());\r
- c.calculate();\r
- c.verdict(false, 25);\r
-\r
- ConservationColourScheme ccs = (ConservationColourScheme) cs;\r
- ccs.conserve = c;\r
- if (ccs.cs instanceof ClustalxColourScheme)\r
- {\r
- ( (ClustalxColourScheme) ccs.cs).resetClustalX(sequences, getWidth());\r
- }\r
+ startRes = i;\r
+ }\r
\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param i DOCUMENT ME!\r
+ */\r
+ public void setEndRes(int i)\r
+ {\r
+ endRes = i;\r
}\r
- }\r
\r
- public void addOrRemove(SequenceI s, boolean recalc)\r
- {\r
- if (sequences.contains(s))\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public int getSize()\r
{\r
- deleteSequence(s, recalc);\r
+ return sequences.size();\r
}\r
- else\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param i DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public SequenceI getSequenceAt(int i)\r
+ {\r
+ return (SequenceI) sequences.elementAt(i);\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param state DOCUMENT ME!\r
+ */\r
+ public void setColourText(boolean state)\r
{\r
- addSequence(s, recalc);\r
+ colourText = state;\r
}\r
- }\r
-\r
- public void deleteSequence(SequenceI s, boolean recalc)\r
- {\r
- sequences.removeElement(s);\r
- if(recalc)\r
- recalcConservation();\r
- }\r
-\r
- public int getStartRes()\r
- {\r
- return startRes;\r
- }\r
-\r
- public int getEndRes()\r
- {\r
- return endRes;\r
- }\r
-\r
- public void setStartRes(int i)\r
- {\r
- startRes = i;\r
- }\r
-\r
- public void setEndRes(int i)\r
- {\r
- endRes = i;\r
- }\r
-\r
- public int getSize()\r
- {\r
- return sequences.size();\r
- }\r
-\r
- public SequenceI getSequenceAt(int i)\r
- {\r
- return (SequenceI) sequences.elementAt(i);\r
- }\r
-\r
- public void setColourText(boolean state)\r
- {\r
- colourText = state;\r
- }\r
-\r
- public boolean getColourText()\r
- {\r
- return colourText;\r
- }\r
-\r
- public void setDisplayText(boolean state)\r
- {\r
- displayText = state;\r
- }\r
-\r
- public boolean getDisplayText()\r
- {\r
- return displayText;\r
- }\r
-\r
- public void setDisplayBoxes(boolean state)\r
- {\r
- displayBoxes = state;\r
- }\r
-\r
- public boolean getDisplayBoxes()\r
- {\r
- return displayBoxes;\r
- }\r
-\r
- public int getWidth()\r
- {\r
- // MC This needs to get reset when characters are inserted and deleted\r
- if (sequences.size() > 0)\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public boolean getColourText()\r
{\r
- width = ( (SequenceI) sequences.elementAt(0)).getLength();\r
+ return colourText;\r
}\r
\r
- for (int i = 1; i < sequences.size(); i++)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param state DOCUMENT ME!\r
+ */\r
+ public void setDisplayText(boolean state)\r
{\r
- SequenceI seq = (SequenceI) sequences.elementAt(i);\r
+ displayText = state;\r
+ }\r
\r
- if (seq.getLength() > width)\r
- {\r
- width = seq.getLength();\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public boolean getDisplayText()\r
+ {\r
+ return displayText;\r
}\r
\r
- return width;\r
- }\r
-\r
- public void setOutlineColour(Color c)\r
- {\r
- outlineColour = c;\r
- }\r
-\r
- public Color getOutlineColour()\r
- {\r
- return outlineColour;\r
- }\r
-\r
- /**\r
- *\r
- * returns the sequences in the group ordered by the ordering given by al\r
- *\r
- * @param al Alignment\r
- * @return SequenceI[]\r
- */\r
- public SequenceI[] getSequencesInOrder(AlignmentI al)\r
- {\r
- int sz = sequences.size();\r
- java.util.Hashtable orderedSeqs = new java.util.Hashtable();\r
- SequenceI[] seqs = new SequenceI[sz];\r
-\r
- for (int i = 0; i < sz; i++)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param state DOCUMENT ME!\r
+ */\r
+ public void setDisplayBoxes(boolean state)\r
{\r
- SequenceI seq = (SequenceI) sequences.elementAt(i);\r
- int index = al.findIndex(seq);\r
- orderedSeqs.put(index + "", seq);\r
+ displayBoxes = state;\r
}\r
\r
- int index = 0;\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public boolean getDisplayBoxes()\r
+ {\r
+ return displayBoxes;\r
+ }\r
\r
- for (int i = 0; i < al.getHeight(); i++)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public int getWidth()\r
{\r
- if (orderedSeqs.containsKey(i + ""))\r
+ // MC This needs to get reset when characters are inserted and deleted\r
+ if (sequences.size() > 0)\r
{\r
- seqs[index++] = (SequenceI) orderedSeqs.get(i + "");\r
+ width = ((SequenceI) sequences.elementAt(0)).getLength();\r
}\r
+\r
+ for (int i = 1; i < sequences.size(); i++)\r
+ {\r
+ SequenceI seq = (SequenceI) sequences.elementAt(i);\r
+\r
+ if (seq.getLength() > width)\r
+ {\r
+ width = seq.getLength();\r
+ }\r
+ }\r
+\r
+ return width;\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param c DOCUMENT ME!\r
+ */\r
+ public void setOutlineColour(Color c)\r
+ {\r
+ outlineColour = c;\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public Color getOutlineColour()\r
+ {\r
+ return outlineColour;\r
}\r
\r
- return seqs;\r
- }\r
+ /**\r
+ *\r
+ * returns the sequences in the group ordered by the ordering given by al\r
+ *\r
+ * @param al Alignment\r
+ * @return SequenceI[]\r
+ */\r
+ public SequenceI[] getSequencesInOrder(AlignmentI al)\r
+ {\r
+ int sz = sequences.size();\r
+ java.util.Hashtable orderedSeqs = new java.util.Hashtable();\r
+ SequenceI[] seqs = new SequenceI[sz];\r
+\r
+ for (int i = 0; i < sz; i++)\r
+ {\r
+ SequenceI seq = (SequenceI) sequences.elementAt(i);\r
+ int index = al.findIndex(seq);\r
+ orderedSeqs.put(index + "", seq);\r
+ }\r
+\r
+ int index = 0;\r
+\r
+ for (int i = 0; i < al.getHeight(); i++)\r
+ {\r
+ if (orderedSeqs.containsKey(i + ""))\r
+ {\r
+ seqs[index++] = (SequenceI) orderedSeqs.get(i + "");\r
+ }\r
+ }\r
+\r
+ return seqs;\r
+ }\r
}\r
/*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
-*\r
-* This program is free software; you can redistribute it and/or\r
-* modify it under the terms of the GNU General Public License\r
-* as published by the Free Software Foundation; either version 2\r
-* of the License, or (at your option) any later version.\r
-*\r
-* This program is distributed in the hope that it will be useful,\r
-* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-* GNU General Public License for more details.\r
-*\r
-* You should have received a copy of the GNU General Public License\r
-* along with this program; if not, write to the Free Software\r
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
-*/\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
+ */\r
package jalview.datamodel;\r
\r
-import jalview.jbgui.*;\r
-\r
import java.awt.*;\r
\r
-import java.util.Vector;\r
-\r
-\r
-public interface SequenceI {\r
+import java.util.*;\r
+\r
+\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public interface SequenceI\r
+{\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param name DOCUMENT ME!\r
+ */\r
public void setName(String name);\r
\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
public String getName();\r
\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param start DOCUMENT ME!\r
+ */\r
public void setStart(int start);\r
\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
public int getStart();\r
\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
public String getDisplayId();\r
\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param end DOCUMENT ME!\r
+ */\r
public void setEnd(int end);\r
\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
public int getEnd();\r
\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
public int getLength();\r
\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param sequence DOCUMENT ME!\r
+ */\r
public void setSequence(String sequence);\r
\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
public String getSequence();\r
\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param start DOCUMENT ME!\r
+ * @param end DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
public String getSequence(int start, int end);\r
\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param i DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
public char getCharAt(int i);\r
\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param desc DOCUMENT ME!\r
+ */\r
public void setDescription(String desc);\r
\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
public String getDescription();\r
\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param pos DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
public int findIndex(int pos);\r
\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param i DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
public int findPosition(int i);\r
\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
public int[] gapMap();\r
\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param i DOCUMENT ME!\r
+ * @param j DOCUMENT ME!\r
+ */\r
public void deleteChars(int i, int j);\r
\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param i DOCUMENT ME!\r
+ */\r
public void deleteCharAt(int i);\r
\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param i DOCUMENT ME!\r
+ * @param c DOCUMENT ME!\r
+ */\r
public void insertCharAt(int i, char c);\r
\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param i DOCUMENT ME!\r
+ * @param c DOCUMENT ME!\r
+ * @param chop DOCUMENT ME!\r
+ */\r
public void insertCharAt(int i, char c, boolean chop);\r
\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param c DOCUMENT ME!\r
+ */\r
public void setColor(Color c);\r
\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
public Color getColor();\r
\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
public Vector getSequenceFeatures();\r
\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param v DOCUMENT ME!\r
+ */\r
public void setSequenceFeatures(Vector v);\r
\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param id DOCUMENT ME!\r
+ */\r
public void setPDBId(String id);\r
\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
public String getPDBId();\r
}\r
/*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
-*\r
-* This program is free software; you can redistribute it and/or\r
-* modify it under the terms of the GNU General Public License\r
-* as published by the Free Software Foundation; either version 2\r
-* of the License, or (at your option) any later version.\r
-*\r
-* This program is distributed in the hope that it will be useful,\r
-* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-* GNU General Public License for more details.\r
-*\r
-* You should have received a copy of the GNU General Public License\r
-* along with this program; if not, write to the Free Software\r
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
-*/\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
+ */\r
package jalview.datamodel;\r
\r
import java.awt.*;\r
\r
\r
-public class SequenceNode extends BinaryNode {\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class SequenceNode extends BinaryNode\r
+{\r
+ /** DOCUMENT ME!! */\r
public float dist;\r
+\r
+ /** DOCUMENT ME!! */\r
public int count;\r
+\r
+ /** DOCUMENT ME!! */\r
public float height;\r
+\r
+ /** DOCUMENT ME!! */\r
public float ycount;\r
+\r
+ /** DOCUMENT ME!! */\r
public Color color = Color.black;\r
+\r
+ /** DOCUMENT ME!! */\r
public boolean dummy = false;\r
private boolean placeholder = false;\r
\r
- public SequenceNode() {\r
+ /**\r
+ * Creates a new SequenceNode object.\r
+ */\r
+ public SequenceNode()\r
+ {\r
super();\r
}\r
\r
- public SequenceNode(Object val, SequenceNode parent, float dist, String name) {\r
+ /**\r
+ * Creates a new SequenceNode object.\r
+ *\r
+ * @param val DOCUMENT ME!\r
+ * @param parent DOCUMENT ME!\r
+ * @param dist DOCUMENT ME!\r
+ * @param name DOCUMENT ME!\r
+ */\r
+ public SequenceNode(Object val, SequenceNode parent, float dist, String name)\r
+ {\r
super(val, parent, name);\r
this.dist = dist;\r
}\r
\r
+ /**\r
+ * Creates a new SequenceNode object.\r
+ *\r
+ * @param val DOCUMENT ME!\r
+ * @param parent DOCUMENT ME!\r
+ * @param name DOCUMENT ME!\r
+ * @param dist DOCUMENT ME!\r
+ * @param bootstrap DOCUMENT ME!\r
+ * @param dummy DOCUMENT ME!\r
+ */\r
public SequenceNode(Object val, SequenceNode parent, String name,\r
- float dist, int bootstrap, boolean dummy) {\r
+ float dist, int bootstrap, boolean dummy)\r
+ {\r
super(val, parent, name);\r
this.dist = dist;\r
this.bootstrap = bootstrap;\r
/**\r
* @param dummy true if node is created for the representation of polytomous trees\r
*/\r
- public boolean isDummy() {\r
+ public boolean isDummy()\r
+ {\r
return dummy;\r
}\r
\r
/* @param placeholder is true if the sequence refered to in the\r
* element node is not actually present in the associated alignment\r
*/\r
- public boolean isPlaceholder() {\r
+ public boolean isPlaceholder()\r
+ {\r
return placeholder;\r
}\r
\r
- public boolean setDummy(boolean newstate) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param newstate DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public boolean setDummy(boolean newstate)\r
+ {\r
boolean oldstate = dummy;\r
dummy = newstate;\r
\r
return oldstate;\r
}\r
\r
- public void setPlaceholder(boolean Placeholder) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param Placeholder DOCUMENT ME!\r
+ */\r
+ public void setPlaceholder(boolean Placeholder)\r
+ {\r
this.placeholder = Placeholder;\r
}\r
\r
* ascends the tree but doesn't stop until a non-dummy node is discovered.\r
* This will probably break if the tree is a mixture of BinaryNodes and SequenceNodes.\r
*/\r
- public SequenceNode AscendTree() {\r
+ public SequenceNode AscendTree()\r
+ {\r
SequenceNode c = this;\r
\r
- do {\r
+ do\r
+ {\r
c = (SequenceNode) c.parent();\r
- } while ((c != null) && c.dummy);\r
+ }\r
+ while ((c != null) && c.dummy);\r
\r
return c;\r
}\r
/*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
-*\r
-* This program is free software; you can redistribute it and/or\r
-* modify it under the terms of the GNU General Public License\r
-* as published by the Free Software Foundation; either version 2\r
-* of the License, or (at your option) any later version.\r
-*\r
-* This program is distributed in the hope that it will be useful,\r
-* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-* GNU General Public License for more details.\r
-*\r
-* You should have received a copy of the GNU General Public License\r
-* along with this program; if not, write to the Free Software\r
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
-*/\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
+ */\r
package jalview.datamodel;\r
\r
-import java.awt.*;\r
-\r
-import java.util.*;\r
-\r
-\r
-public class SequencePoint {\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class SequencePoint\r
+{\r
// SMJS PUBLIC\r
+\r
+ /** DOCUMENT ME!! */\r
public SequenceI sequence;\r
+\r
+ /** DOCUMENT ME!! */\r
public float[] coord;\r
\r
// SMJS ENDPUBLIC\r
- public SequencePoint(SequenceI sequence, float[] coord) {\r
+ public SequencePoint(SequenceI sequence, float[] coord)\r
+ {\r
this.sequence = sequence;\r
this.coord = coord;\r
}\r
*/\r
package jalview.datamodel;\r
\r
-import jalview.analysis.*;\r
-\r
import jalview.datamodel.*;\r
\r
import jalview.schemes.*;\r
import java.util.*;\r
\r
\r
-public class SuperGroup {\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class SuperGroup\r
+{\r
String groupName;\r
boolean displayBoxes;\r
boolean displayText;\r
boolean colourText;\r
+\r
+ /** DOCUMENT ME!! */\r
public ColourSchemeI cs;\r
Vector sequenceGroups = new Vector();\r
\r
- public SuperGroup() {\r
+ /**\r
+ * Creates a new SuperGroup object.\r
+ */\r
+ public SuperGroup()\r
+ {\r
groupName = "Super group";\r
this.displayBoxes = true;\r
this.displayText = true;\r
cs = null;\r
}\r
\r
+ /**\r
+ * Creates a new SuperGroup object.\r
+ *\r
+ * @param groupName DOCUMENT ME!\r
+ * @param scheme DOCUMENT ME!\r
+ * @param displayBoxes DOCUMENT ME!\r
+ * @param displayText DOCUMENT ME!\r
+ * @param colourText DOCUMENT ME!\r
+ */\r
public SuperGroup(String groupName, ColourSchemeI scheme,\r
- boolean displayBoxes, boolean displayText, boolean colourText) {\r
+ boolean displayBoxes, boolean displayText, boolean colourText)\r
+ {\r
this.groupName = groupName;\r
this.displayBoxes = displayBoxes;\r
this.displayText = displayText;\r
this.cs = scheme;\r
}\r
\r
- public String getName() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public String getName()\r
+ {\r
return groupName;\r
}\r
\r
- public void setName(String name) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param name DOCUMENT ME!\r
+ */\r
+ public void setName(String name)\r
+ {\r
groupName = name;\r
}\r
\r
- public void addGroup(SequenceGroup sg) {\r
- if (!sequenceGroups.contains(sg)) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param sg DOCUMENT ME!\r
+ */\r
+ public void addGroup(SequenceGroup sg)\r
+ {\r
+ if (!sequenceGroups.contains(sg))\r
+ {\r
sequenceGroups.addElement(sg);\r
}\r
}\r
\r
- public void addOrRemove(SequenceGroup sg) {\r
- if (sequenceGroups.contains(sg)) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param sg DOCUMENT ME!\r
+ */\r
+ public void addOrRemove(SequenceGroup sg)\r
+ {\r
+ if (sequenceGroups.contains(sg))\r
+ {\r
deleteGroup(sg);\r
- } else {\r
+ }\r
+ else\r
+ {\r
addGroup(sg);\r
}\r
}\r
\r
- public void deleteGroup(SequenceGroup sg) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param sg DOCUMENT ME!\r
+ */\r
+ public void deleteGroup(SequenceGroup sg)\r
+ {\r
sequenceGroups.removeElement(sg);\r
}\r
\r
- public void setSuperGroupProperties(SequenceGroup sg) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param sg DOCUMENT ME!\r
+ */\r
+ public void setSuperGroupProperties(SequenceGroup sg)\r
+ {\r
cs = sg.cs;\r
colourText = sg.colourText;\r
displayText = sg.displayText;\r
displayBoxes = sg.displayBoxes;\r
\r
- for (int i = 0; i < sequenceGroups.size(); i++) {\r
+ for (int i = 0; i < sequenceGroups.size(); i++)\r
+ {\r
SequenceGroup temp = (SequenceGroup) sequenceGroups.elementAt(i);\r
temp.cs = sg.cs;\r
temp.colourText = sg.colourText;\r
}\r
}\r
\r
- public int getSize() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public int getSize()\r
+ {\r
return sequenceGroups.size();\r
}\r
\r
- public SequenceGroup getGroupeAt(int i) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param i DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public SequenceGroup getGroupeAt(int i)\r
+ {\r
return (SequenceGroup) sequenceGroups.elementAt(i);\r
}\r
}\r
*/\r
package jalview.gui;\r
\r
-import java.beans.*;\r
-import java.util.*;\r
+import jalview.analysis.*;\r
+\r
+import jalview.datamodel.*;\r
+\r
+import jalview.io.*;\r
+\r
+import jalview.jbgui.*;\r
+\r
+import jalview.schemes.*;\r
+\r
+import jalview.ws.*;\r
\r
import java.awt.*;\r
import java.awt.datatransfer.*;\r
import java.awt.event.*;\r
import java.awt.print.*;\r
+\r
+import java.io.*;\r
+\r
+import java.beans.*;\r
+\r
+import java.util.*;\r
+\r
import javax.swing.*;\r
import javax.swing.event.*;\r
\r
-import jalview.analysis.*;\r
-import jalview.datamodel.*;\r
-import jalview.io.*;\r
-import jalview.jbgui.*;\r
-import jalview.schemes.*;\r
-import jalview.ws.*;\r
\r
-public class AlignFrame\r
- extends GAlignFrame\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class AlignFrame extends GAlignFrame\r
{\r
- public static final int NEW_WINDOW_WIDTH = 700;\r
- public static final int NEW_WINDOW_HEIGHT = 500;\r
- final AlignmentPanel alignPanel;\r
- final AlignViewport viewport;\r
- public String currentFileFormat = "Jalview";\r
- Stack historyList = new Stack();\r
- Stack redoList = new Stack();\r
- private int treeCount = 0;\r
-\r
- public AlignFrame(AlignmentI al)\r
- {\r
- viewport = new AlignViewport(al);\r
-\r
- alignPanel = new AlignmentPanel(this, viewport);\r
- alignPanel.annotationPanel.adjustPanelHeight();\r
- alignPanel.annotationSpaceFillerHolder.setPreferredSize(alignPanel.\r
- annotationPanel.getPreferredSize());\r
- alignPanel.annotationScroller.setPreferredSize(alignPanel.annotationPanel.\r
- getPreferredSize());\r
- alignPanel.setAnnotationVisible(viewport.getShowAnnotation());\r
-\r
- getContentPane().add(alignPanel, java.awt.BorderLayout.CENTER);\r
-\r
- addInternalFrameListener(new InternalFrameAdapter()\r
- {\r
- public void internalFrameActivated(InternalFrameEvent evt)\r
- {\r
- javax.swing.SwingUtilities.invokeLater(new Runnable()\r
+ /** DOCUMENT ME!! */\r
+ public static final int NEW_WINDOW_WIDTH = 700;\r
+\r
+ /** DOCUMENT ME!! */\r
+ public static final int NEW_WINDOW_HEIGHT = 500;\r
+ final AlignmentPanel alignPanel;\r
+ final AlignViewport viewport;\r
+\r
+ /** DOCUMENT ME!! */\r
+ public String currentFileFormat = null;\r
+ Stack historyList = new Stack();\r
+ Stack redoList = new Stack();\r
+ private int treeCount = 0;\r
+\r
+ /**\r
+ * Creates a new AlignFrame object.\r
+ *\r
+ * @param al DOCUMENT ME!\r
+ */\r
+ public AlignFrame(AlignmentI al)\r
+ {\r
+ viewport = new AlignViewport(al);\r
+\r
+ alignPanel = new AlignmentPanel(this, viewport);\r
+ alignPanel.annotationPanel.adjustPanelHeight();\r
+ alignPanel.annotationSpaceFillerHolder.setPreferredSize(alignPanel.annotationPanel.getPreferredSize());\r
+ alignPanel.annotationScroller.setPreferredSize(alignPanel.annotationPanel.getPreferredSize());\r
+ alignPanel.setAnnotationVisible(viewport.getShowAnnotation());\r
+\r
+ getContentPane().add(alignPanel, java.awt.BorderLayout.CENTER);\r
+\r
+ addInternalFrameListener(new InternalFrameAdapter()\r
+ {\r
+ public void internalFrameActivated(InternalFrameEvent evt)\r
+ {\r
+ javax.swing.SwingUtilities.invokeLater(new Runnable()\r
+ {\r
+ public void run()\r
+ {\r
+ alignPanel.requestFocus();\r
+ }\r
+ });\r
+ }\r
+ });\r
+ }\r
+\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void parseGroupsFile(String file)\r
+ {\r
+ try{\r
+ BufferedReader in = new BufferedReader(new FileReader(file));\r
+ SequenceI seq=null;\r
+ String line, text, token;\r
+ UserColourScheme ucs;\r
+ int index, start, end;\r
+ StringTokenizer st;\r
+ SequenceGroup sg;\r
+ while( (line = in.readLine())!=null)\r
{\r
- public void run()\r
+ st = new StringTokenizer(line, "\t");\r
+ if(st.countTokens()!=6)\r
{\r
- alignPanel.requestFocus();\r
+ System.out.println("Groups file "+file+" is invalid. Read help file.");\r
+ System.exit(1);\r
}\r
- });\r
- }\r
- });\r
- }\r
\r
- public void saveAlignmentMenu_actionPerformed(ActionEvent e)\r
- {\r
- JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.\r
- getProperty(\r
- "LAST_DIRECTORY"),\r
- new String[]\r
- {\r
- "fa, fasta, fastq", "aln", "pfam", "msf", "pir", "blc",\r
- "jar"\r
- },\r
- new String[]\r
+ while(st.hasMoreElements())\r
+ {\r
+ text = st.nextToken();\r
+ token = st.nextToken();\r
+ if(!token.equals("ID_NOT_SPECIFIED"))\r
+ {\r
+ index = viewport.alignment.findIndex(viewport.alignment.findName(\r
+ token));\r
+ st.nextToken();\r
+ }\r
+ else\r
+ index = Integer.parseInt( st.nextToken() );\r
+\r
+ start=Integer.parseInt( st.nextToken() );\r
+ end = Integer.parseInt( st.nextToken() );\r
+ ucs = new UserColourScheme(st.nextToken());\r
+\r
+ seq = viewport.alignment.getSequenceAt(index);\r
+ start = seq.findIndex(start)-1;\r
+ end = seq.findIndex(end)-1;\r
+\r
+ sg = new SequenceGroup(text,ucs,true,true,false,start,end);\r
+ sg.addSequence( seq,true);\r
+\r
+ viewport.alignment.addGroup(sg);\r
+ }\r
+ }\r
+\r
+ }catch(Exception ex){System.out.println("Error parsing groups file: "+ex);}\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void saveAlignmentMenu_actionPerformed(ActionEvent e)\r
+ {\r
+ JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.getProperty(\r
+ "LAST_DIRECTORY"),\r
+ new String[]\r
+ {\r
+ "fa, fasta, fastq", "aln", "pfam", "msf", "pir", "blc",\r
+ "jar"\r
+ },\r
+ new String[]\r
+ {\r
+ "Fasta", "Clustal", "PFAM", "MSF", "PIR", "BLC", "Jalview"\r
+ }, currentFileFormat);\r
+\r
+ chooser.setAcceptAllFileFilterUsed(false);\r
+ chooser.setFileView(new JalviewFileView());\r
+ chooser.setDialogTitle("Save Alignment to file");\r
+ chooser.setToolTipText("Save");\r
+\r
+ int value = chooser.showSaveDialog(this);\r
+\r
+ if (value == JalviewFileChooser.APPROVE_OPTION)\r
{\r
- "Fasta", "Clustal", "PFAM", "MSF", "PIR", "BLC", "Jalview"\r
- }, currentFileFormat);\r
+ currentFileFormat = chooser.getSelectedFormat();\r
+ jalview.bin.Cache.setProperty("DEFAULT_FILE_FORMAT",\r
+ currentFileFormat);\r
\r
- chooser.setAcceptAllFileFilterUsed(false);\r
- chooser.setFileView(new JalviewFileView());\r
- chooser.setDialogTitle("Save Alignment to file");\r
- chooser.setToolTipText("Save");\r
+ String choice = chooser.getSelectedFile().getPath();\r
+ jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice);\r
\r
- int value = chooser.showSaveDialog(this);\r
+ saveAlignment(choice, currentFileFormat);\r
+ }\r
+ }\r
\r
- if (value == JalviewFileChooser.APPROVE_OPTION)\r
+ public boolean saveAlignment(String file, String format)\r
{\r
- currentFileFormat = chooser.getSelectedFormat();\r
- jalview.bin.Cache.setProperty("DEFAULT_FILE_FORMAT",\r
- currentFileFormat);\r
-\r
- if (currentFileFormat.equals("Jalview"))\r
+ if (format.equalsIgnoreCase("Jalview"))\r
{\r
String shortName = title;\r
\r
java.io.File.separatorChar) + 1);\r
}\r
\r
- String choice = chooser.getSelectedFile().getPath();\r
- Jalview2XML.SaveAlignment(this, choice, shortName);\r
+ Jalview2XML.SaveAlignment(this, file, shortName);\r
\r
// USE Jalview2XML to save this file\r
- return;\r
- }\r
-\r
- String choice = chooser.getSelectedFile().getPath();\r
- jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice);\r
-\r
- String output = FormatAdapter.formatSequences(currentFileFormat,\r
- viewport.getAlignment().getSequences());\r
-\r
- try\r
- {\r
- java.io.PrintWriter out = new java.io.PrintWriter(new java.io.\r
- FileWriter(\r
- choice));\r
- out.println(output);\r
- out.close();\r
+ return true;\r
}\r
- catch (Exception ex)\r
+ else\r
{\r
+ String output = FormatAdapter.formatSequences(format,\r
+ viewport.getAlignment().\r
+ getSequences());\r
+ if(output==null)\r
+ return false;\r
+\r
+ try\r
+ {\r
+ java.io.PrintWriter out = new java.io.PrintWriter(\r
+ new java.io.FileWriter(file));\r
+ out.println(output);\r
+ out.close();\r
+ return true;\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ ex.printStackTrace();\r
+ }\r
}\r
+ return false;\r
}\r
- }\r
-\r
- protected void outputText_actionPerformed(ActionEvent e)\r
- {\r
- CutAndPasteTransfer cap = new CutAndPasteTransfer();\r
- Desktop.addInternalFrame(cap,\r
- "Alignment output - " + e.getActionCommand(), 600,\r
- 500);\r
- cap.setText(FormatAdapter.formatSequences(e.getActionCommand(),\r
- viewport.getAlignment().\r
- getSequences()));\r
- }\r
\r
- protected void htmlMenuItem_actionPerformed(ActionEvent e)\r
- {\r
- new HTMLOutput(viewport);\r
- }\r
\r
- protected void createPNG_actionPerformed(ActionEvent e)\r
- {\r
- alignPanel.makePNG();\r
- }\r
-\r
- protected void epsFile_actionPerformed(ActionEvent e)\r
- {\r
- alignPanel.makeEPS();\r
- }\r
-\r
- public void printMenuItem_actionPerformed(ActionEvent e)\r
- {\r
- //Putting in a thread avoids Swing painting problems\r
- PrintThread thread = new PrintThread();\r
- thread.start();\r
- }\r
-\r
- public void closeMenuItem_actionPerformed(ActionEvent e)\r
- {\r
- try\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void outputText_actionPerformed(ActionEvent e)\r
{\r
- this.setClosed(true);\r
+ CutAndPasteTransfer cap = new CutAndPasteTransfer();\r
+ Desktop.addInternalFrame(cap,\r
+ "Alignment output - " + e.getActionCommand(), 600, 500);\r
+ cap.setText(FormatAdapter.formatSequences(e.getActionCommand(),\r
+ viewport.getAlignment().getSequences()));\r
}\r
- catch (Exception ex)\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void htmlMenuItem_actionPerformed(ActionEvent e)\r
{\r
+ new HTMLOutput(viewport);\r
}\r
- }\r
\r
- void updateEditMenuBar()\r
- {\r
- if (historyList.size() > 0)\r
+ public void createImageMap(File file, String image)\r
{\r
- undoMenuItem.setEnabled(true);\r
-\r
- HistoryItem hi = (HistoryItem) historyList.peek();\r
- undoMenuItem.setText("Undo " + hi.getDescription());\r
+ alignPanel.makePNGImageMap(file, image);\r
}\r
- else\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void createPNG(File f)\r
{\r
- undoMenuItem.setEnabled(false);\r
- undoMenuItem.setText("Undo");\r
+ alignPanel.makePNG(f);\r
}\r
\r
- if (redoList.size() > 0)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void createEPS(File f)\r
{\r
- redoMenuItem.setEnabled(true);\r
-\r
- HistoryItem hi = (HistoryItem) redoList.peek();\r
- redoMenuItem.setText("Redo " + hi.getDescription());\r
+ alignPanel.makeEPS(f);\r
}\r
- else\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void printMenuItem_actionPerformed(ActionEvent e)\r
{\r
- redoMenuItem.setEnabled(false);\r
- redoMenuItem.setText("Redo");\r
+ //Putting in a thread avoids Swing painting problems\r
+ PrintThread thread = new PrintThread();\r
+ thread.start();\r
}\r
- }\r
-\r
- public void addHistoryItem(HistoryItem hi)\r
- {\r
- historyList.push(hi);\r
- updateEditMenuBar();\r
- }\r
-\r
- protected void undoMenuItem_actionPerformed(ActionEvent e)\r
- {\r
- HistoryItem hi = (HistoryItem) historyList.pop();\r
- redoList.push(new HistoryItem(hi.getDescription(), viewport.alignment,\r
- HistoryItem.HIDE));\r
- restoreHistoryItem(hi);\r
- }\r
-\r
- protected void redoMenuItem_actionPerformed(ActionEvent e)\r
- {\r
- HistoryItem hi = (HistoryItem) redoList.pop();\r
- restoreHistoryItem(hi);\r
- updateEditMenuBar();\r
- viewport.updateConsensus();\r
- alignPanel.repaint();\r
- alignPanel.repaint();\r
- }\r
\r
- // used by undo and redo\r
- void restoreHistoryItem(HistoryItem hi)\r
- {\r
- if (hi.getType() == HistoryItem.SORT)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void closeMenuItem_actionPerformed(ActionEvent e)\r
{\r
- for (int i = 0; i < hi.getSequences().size(); i++)\r
- {\r
- viewport.alignment.getSequences().setElementAt(hi.getSequences()\r
- .elementAt(i),\r
- i);\r
- }\r
+ try\r
+ {\r
+ this.setClosed(true);\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ }\r
}\r
- else\r
- {\r
- for (int i = 0; i < hi.getSequences().size(); i++)\r
- {\r
- SequenceI restore = (SequenceI) hi.getSequences().elementAt(i);\r
\r
- if (restore.getLength() == 0)\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ void updateEditMenuBar()\r
+ {\r
+ if (historyList.size() > 0)\r
{\r
- restore.setSequence(hi.getHidden().elementAt(i).toString());\r
- viewport.alignment.getSequences().insertElementAt(restore,\r
- hi.getAlignIndex(i));\r
+ undoMenuItem.setEnabled(true);\r
+\r
+ HistoryItem hi = (HistoryItem) historyList.peek();\r
+ undoMenuItem.setText("Undo " + hi.getDescription());\r
}\r
else\r
{\r
- restore.setSequence(hi.getHidden().elementAt(i).toString());\r
+ undoMenuItem.setEnabled(false);\r
+ undoMenuItem.setText("Undo");\r
}\r
- }\r
\r
- if (hi.getType() == HistoryItem.PASTE)\r
- {\r
- for (int i = viewport.alignment.getHeight() - 1;\r
- i > (hi.getSequences().size() - 1); i--)\r
+ if (redoList.size() > 0)\r
{\r
- viewport.alignment.deleteSequence(i);\r
+ redoMenuItem.setEnabled(true);\r
+\r
+ HistoryItem hi = (HistoryItem) redoList.peek();\r
+ redoMenuItem.setText("Redo " + hi.getDescription());\r
+ }\r
+ else\r
+ {\r
+ redoMenuItem.setEnabled(false);\r
+ redoMenuItem.setText("Redo");\r
}\r
- }\r
}\r
\r
- updateEditMenuBar();\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param hi DOCUMENT ME!\r
+ */\r
+ public void addHistoryItem(HistoryItem hi)\r
+ {\r
+ historyList.push(hi);\r
+ updateEditMenuBar();\r
+ }\r
\r
- viewport.updateConsensus();\r
- viewport.updateConservation();\r
- alignPanel.repaint();\r
- viewport.firePropertyChange("alignment", null,\r
- viewport.getAlignment().getSequences());\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void undoMenuItem_actionPerformed(ActionEvent e)\r
+ {\r
+ HistoryItem hi = (HistoryItem) historyList.pop();\r
+ redoList.push(new HistoryItem(hi.getDescription(), viewport.alignment,\r
+ HistoryItem.HIDE));\r
+ restoreHistoryItem(hi);\r
+ }\r
\r
- public void moveSelectedSequences(boolean up)\r
- {\r
- SequenceGroup sg = viewport.getSelectionGroup();\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void redoMenuItem_actionPerformed(ActionEvent e)\r
+ {\r
+ HistoryItem hi = (HistoryItem) redoList.pop();\r
+ restoreHistoryItem(hi);\r
+ updateEditMenuBar();\r
+ viewport.updateConsensus();\r
+ alignPanel.repaint();\r
+ alignPanel.repaint();\r
+ }\r
\r
- if (sg == null)\r
+ // used by undo and redo\r
+ void restoreHistoryItem(HistoryItem hi)\r
{\r
- return;\r
+ if (hi.getType() == HistoryItem.SORT)\r
+ {\r
+ for (int i = 0; i < hi.getSequences().size(); i++)\r
+ {\r
+ viewport.alignment.getSequences().setElementAt(hi.getSequences()\r
+ .elementAt(i),\r
+ i);\r
+ }\r
+ }\r
+ else\r
+ {\r
+ for (int i = 0; i < hi.getSequences().size(); i++)\r
+ {\r
+ SequenceI restore = (SequenceI) hi.getSequences().elementAt(i);\r
+\r
+ if (restore.getLength() == 0)\r
+ {\r
+ restore.setSequence(hi.getHidden().elementAt(i).toString());\r
+ viewport.alignment.getSequences().insertElementAt(restore,\r
+ hi.getAlignIndex(i));\r
+ }\r
+ else\r
+ {\r
+ restore.setSequence(hi.getHidden().elementAt(i).toString());\r
+ }\r
+ }\r
+\r
+ if (hi.getType() == HistoryItem.PASTE)\r
+ {\r
+ for (int i = viewport.alignment.getHeight() - 1;\r
+ i > (hi.getSequences().size() - 1); i--)\r
+ {\r
+ viewport.alignment.deleteSequence(i);\r
+ }\r
+ }\r
+ }\r
+\r
+ updateEditMenuBar();\r
+\r
+ viewport.updateConsensus();\r
+ viewport.updateConservation();\r
+ alignPanel.repaint();\r
+ viewport.firePropertyChange("alignment", null,\r
+ viewport.getAlignment().getSequences());\r
}\r
\r
- if (up)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param up DOCUMENT ME!\r
+ */\r
+ public void moveSelectedSequences(boolean up)\r
{\r
- for (int i = 1; i < viewport.alignment.getHeight(); i++)\r
- {\r
- SequenceI seq = viewport.alignment.getSequenceAt(i);\r
+ SequenceGroup sg = viewport.getSelectionGroup();\r
\r
- if (!sg.sequences.contains(seq))\r
+ if (sg == null)\r
{\r
- continue;\r
+ return;\r
}\r
\r
- SequenceI temp = viewport.alignment.getSequenceAt(i - 1);\r
+ if (up)\r
+ {\r
+ for (int i = 1; i < viewport.alignment.getHeight(); i++)\r
+ {\r
+ SequenceI seq = viewport.alignment.getSequenceAt(i);\r
+\r
+ if (!sg.sequences.contains(seq))\r
+ {\r
+ continue;\r
+ }\r
+\r
+ SequenceI temp = viewport.alignment.getSequenceAt(i - 1);\r
\r
- if (sg.sequences.contains(temp))\r
+ if (sg.sequences.contains(temp))\r
+ {\r
+ continue;\r
+ }\r
+\r
+ viewport.alignment.getSequences().setElementAt(temp, i);\r
+ viewport.alignment.getSequences().setElementAt(seq, i - 1);\r
+ }\r
+ }\r
+ else\r
{\r
- continue;\r
+ for (int i = viewport.alignment.getHeight() - 2; i > -1; i--)\r
+ {\r
+ SequenceI seq = viewport.alignment.getSequenceAt(i);\r
+\r
+ if (!sg.sequences.contains(seq))\r
+ {\r
+ continue;\r
+ }\r
+\r
+ SequenceI temp = viewport.alignment.getSequenceAt(i + 1);\r
+\r
+ if (sg.sequences.contains(temp))\r
+ {\r
+ continue;\r
+ }\r
+\r
+ viewport.alignment.getSequences().setElementAt(temp, i);\r
+ viewport.alignment.getSequences().setElementAt(seq, i + 1);\r
+ }\r
}\r
\r
- viewport.alignment.getSequences().setElementAt(temp, i);\r
- viewport.alignment.getSequences().setElementAt(seq, i - 1);\r
- }\r
+ alignPanel.repaint();\r
}\r
- else\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void copy_actionPerformed(ActionEvent e)\r
{\r
- for (int i = viewport.alignment.getHeight() - 2; i > -1; i--)\r
- {\r
- SequenceI seq = viewport.alignment.getSequenceAt(i);\r
+ if (viewport.getSelectionGroup() == null)\r
+ {\r
+ return;\r
+ }\r
+\r
+ SequenceGroup sg = viewport.getSelectionGroup();\r
\r
- if (!sg.sequences.contains(seq))\r
+ Clipboard c = Toolkit.getDefaultToolkit().getSystemClipboard();\r
+ StringBuffer buffer = new StringBuffer();\r
+\r
+ Hashtable orderedSeqs = new Hashtable();\r
+\r
+ for (int i = 0; i < sg.getSize(); i++)\r
{\r
- continue;\r
+ SequenceI seq = sg.getSequenceAt(i);\r
+ int index = viewport.alignment.findIndex(seq);\r
+ orderedSeqs.put(index + "", seq);\r
}\r
\r
- SequenceI temp = viewport.alignment.getSequenceAt(i + 1);\r
+ int index = 0;\r
\r
- if (sg.sequences.contains(temp))\r
+ for (int i = 0; i < sg.getSize(); i++)\r
{\r
- continue;\r
+ SequenceI seq = null;\r
+\r
+ while (seq == null)\r
+ {\r
+ if (orderedSeqs.containsKey(index + ""))\r
+ {\r
+ seq = (SequenceI) orderedSeqs.get(index + "");\r
+ index++;\r
+\r
+ break;\r
+ }\r
+ else\r
+ {\r
+ index++;\r
+ }\r
+ }\r
+\r
+ buffer.append(seq.getName() + "\t" +\r
+ seq.findPosition(sg.getStartRes()) + "\t" +\r
+ seq.findPosition(sg.getEndRes()) + "\t" +\r
+ sg.getSequenceAt(i).getSequence(sg.getStartRes(),\r
+ sg.getEndRes() + 1) + "\n");\r
}\r
\r
- viewport.alignment.getSequences().setElementAt(temp, i);\r
- viewport.alignment.getSequences().setElementAt(seq, i + 1);\r
- }\r
+ c.setContents(new StringSelection(buffer.toString()), null);\r
}\r
\r
- alignPanel.repaint();\r
- }\r
-\r
- protected void copy_actionPerformed(ActionEvent e)\r
- {\r
- if (viewport.getSelectionGroup() == null)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void pasteNew_actionPerformed(ActionEvent e)\r
{\r
- return;\r
+ paste(true);\r
}\r
\r
- SequenceGroup sg = viewport.getSelectionGroup();\r
-\r
- Clipboard c = Toolkit.getDefaultToolkit().getSystemClipboard();\r
- StringBuffer buffer = new StringBuffer();\r
-\r
- Hashtable orderedSeqs = new Hashtable();\r
-\r
- for (int i = 0; i < sg.getSize(); i++)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void pasteThis_actionPerformed(ActionEvent e)\r
{\r
- SequenceI seq = sg.getSequenceAt(i);\r
- int index = viewport.alignment.findIndex(seq);\r
- orderedSeqs.put(index + "", seq);\r
+ addHistoryItem(new HistoryItem("Paste Sequences", viewport.alignment,\r
+ HistoryItem.PASTE));\r
+ paste(false);\r
}\r
\r
- int index = 0;\r
-\r
- for (int i = 0; i < sg.getSize(); i++)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param newAlignment DOCUMENT ME!\r
+ */\r
+ void paste(boolean newAlignment)\r
{\r
- SequenceI seq = null;\r
-\r
- while (seq == null)\r
- {\r
- if (orderedSeqs.containsKey(index + ""))\r
+ try\r
{\r
- seq = (SequenceI) orderedSeqs.get(index + "");\r
- index++;\r
-\r
- break;\r
+ Clipboard c = Toolkit.getDefaultToolkit().getSystemClipboard();\r
+ Transferable contents = c.getContents(this);\r
+\r
+ if (contents == null)\r
+ {\r
+ return;\r
+ }\r
+\r
+ String str = (String) contents.getTransferData(DataFlavor.stringFlavor);\r
+ StringTokenizer st = new StringTokenizer(str);\r
+ ArrayList seqs = new ArrayList();\r
+\r
+ while (st.hasMoreElements())\r
+ {\r
+ String name = st.nextToken();\r
+ int start = Integer.parseInt(st.nextToken());\r
+ int end = Integer.parseInt(st.nextToken());\r
+ Sequence sequence = new Sequence(name, st.nextToken(), start,\r
+ end);\r
+\r
+ if (!newAlignment)\r
+ {\r
+ viewport.alignment.addSequence(sequence);\r
+ }\r
+ else\r
+ {\r
+ seqs.add(sequence);\r
+ }\r
+ }\r
+\r
+ if (newAlignment)\r
+ {\r
+ SequenceI[] newSeqs = new SequenceI[seqs.size()];\r
+ seqs.toArray(newSeqs);\r
+\r
+ AlignFrame af = new AlignFrame(new Alignment(newSeqs));\r
+ String newtitle = new String("Copied sequences");\r
+\r
+ if (title.startsWith("Copied sequences"))\r
+ {\r
+ newtitle = title;\r
+ }\r
+ else\r
+ {\r
+ newtitle = newtitle.concat("- from " + title);\r
+ }\r
+\r
+ Desktop.addInternalFrame(af, newtitle, NEW_WINDOW_WIDTH,\r
+ NEW_WINDOW_HEIGHT);\r
+ }\r
+ else\r
+ {\r
+ viewport.firePropertyChange("alignment", null,\r
+ viewport.getAlignment().getSequences());\r
+ viewport.setEndSeq(viewport.alignment.getHeight());\r
+ viewport.alignment.getWidth();\r
+ viewport.updateConservation();\r
+ viewport.updateConsensus();\r
+ alignPanel.repaint();\r
+ }\r
}\r
- else\r
+ catch (Exception ex)\r
{\r
- index++;\r
}\r
- }\r
\r
- buffer.append(seq.getName() + "\t" +\r
- seq.findPosition(sg.getStartRes()) + "\t" +\r
- seq.findPosition(sg.getEndRes()) + "\t" +\r
- sg.getSequenceAt(i).getSequence(sg.getStartRes(),\r
- sg.getEndRes() + 1) + "\n");\r
+ // could be anything being pasted in here\r
}\r
\r
- c.setContents(new StringSelection(buffer.toString()), null);\r
- }\r
-\r
- protected void pasteNew_actionPerformed(ActionEvent e)\r
- {\r
- paste(true);\r
- }\r
-\r
- protected void pasteThis_actionPerformed(ActionEvent e)\r
- {\r
- addHistoryItem(new HistoryItem("Paste Sequences", viewport.alignment,\r
- HistoryItem.PASTE));\r
- paste(false);\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void cut_actionPerformed(ActionEvent e)\r
+ {\r
+ copy_actionPerformed(null);\r
+ delete_actionPerformed(null);\r
+ }\r
\r
- void paste(boolean newAlignment)\r
- {\r
- try\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void delete_actionPerformed(ActionEvent e)\r
{\r
- Clipboard c = Toolkit.getDefaultToolkit().getSystemClipboard();\r
- Transferable contents = c.getContents(this);\r
+ boolean seqsdeleted = false;\r
\r
- if (contents == null)\r
- {\r
- return;\r
- }\r
+ if (viewport.getSelectionGroup() == null)\r
+ {\r
+ return;\r
+ }\r
\r
- String str = (String) contents.getTransferData(DataFlavor.stringFlavor);\r
- StringTokenizer st = new StringTokenizer(str);\r
- ArrayList seqs = new ArrayList();\r
+ addHistoryItem(new HistoryItem("Delete Sequences", viewport.alignment,\r
+ HistoryItem.HIDE));\r
\r
- while (st.hasMoreElements())\r
- {\r
- String name = st.nextToken();\r
- int start = Integer.parseInt(st.nextToken());\r
- int end = Integer.parseInt(st.nextToken());\r
- Sequence sequence = new Sequence(name, st.nextToken(), start,\r
- end);\r
+ SequenceGroup sg = viewport.getSelectionGroup();\r
\r
- if (!newAlignment)\r
+ for (int i = 0; i < sg.sequences.size(); i++)\r
{\r
- viewport.alignment.addSequence(sequence);\r
+ SequenceI seq = sg.getSequenceAt(i);\r
+ int index = viewport.getAlignment().findIndex(seq);\r
+ seq.deleteChars(sg.getStartRes(), sg.getEndRes() + 1);\r
+\r
+ if (seq.getSequence().length() < 1)\r
+ {\r
+ seqsdeleted = true;\r
+ viewport.getAlignment().deleteSequence(seq);\r
+ }\r
+ else\r
+ {\r
+ viewport.getAlignment().getSequences().setElementAt(seq, index);\r
+ }\r
}\r
- else\r
- {\r
- seqs.add(sequence);\r
- }\r
- }\r
\r
- if (newAlignment)\r
- {\r
- SequenceI[] newSeqs = new SequenceI[seqs.size()];\r
- seqs.toArray(newSeqs);\r
-\r
- AlignFrame af = new AlignFrame(new Alignment(newSeqs));\r
- String newtitle = new String("Copied sequences");\r
+ viewport.setSelectionGroup(null);\r
+ viewport.alignment.deleteGroup(sg);\r
\r
- if (title.startsWith("Copied sequences"))\r
+ if (seqsdeleted)\r
{\r
- newtitle = title;\r
+ viewport.firePropertyChange("alignment", null,\r
+ viewport.getAlignment().getSequences());\r
}\r
- else\r
+\r
+ viewport.resetSeqLimits(alignPanel.seqPanel.seqCanvas.getHeight());\r
+\r
+ if (viewport.getAlignment().getHeight() < 1)\r
{\r
- newtitle = newtitle.concat("- from " + title);\r
+ try\r
+ {\r
+ this.setClosed(true);\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ }\r
}\r
\r
- Desktop.addInternalFrame(af, newtitle, NEW_WINDOW_WIDTH,\r
- NEW_WINDOW_HEIGHT);\r
- }\r
- else\r
- {\r
- viewport.firePropertyChange("alignment", null,\r
- viewport.getAlignment().getSequences());\r
- viewport.setEndSeq(viewport.alignment.getHeight());\r
- viewport.alignment.getWidth();\r
viewport.updateConservation();\r
viewport.updateConsensus();\r
alignPanel.repaint();\r
- }\r
}\r
- catch (Exception ex)\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void deleteGroups_actionPerformed(ActionEvent e)\r
{\r
+ viewport.alignment.deleteAllGroups();\r
+ viewport.setSelectionGroup(null);\r
+ alignPanel.repaint();\r
}\r
\r
- // could be anything being pasted in here\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void selectAllSequenceMenuItem_actionPerformed(ActionEvent e)\r
+ {\r
+ SequenceGroup sg = new SequenceGroup();\r
\r
- protected void cut_actionPerformed(ActionEvent e)\r
- {\r
- copy_actionPerformed(null);\r
- delete_actionPerformed(null);\r
- }\r
+ for (int i = 0; i < viewport.getAlignment().getSequences().size();\r
+ i++)\r
+ {\r
+ sg.addSequence(viewport.getAlignment().getSequenceAt(i), false);\r
+ }\r
\r
- protected void delete_actionPerformed(ActionEvent e)\r
- {\r
- boolean seqsdeleted = false;\r
+ sg.setEndRes(viewport.alignment.getWidth());\r
+ viewport.setSelectionGroup(sg);\r
+ PaintRefresher.Refresh(null, viewport.alignment);\r
+ }\r
\r
- if (viewport.getSelectionGroup() == null)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void deselectAllSequenceMenuItem_actionPerformed(ActionEvent e)\r
{\r
- return;\r
+ viewport.setSelectionGroup(null);\r
+ viewport.getColumnSelection().clear();\r
+ viewport.setSelectionGroup(null);\r
+ alignPanel.annotationPanel.activeRes = null;\r
+ PaintRefresher.Refresh(null, viewport.alignment);\r
}\r
\r
- addHistoryItem(new HistoryItem("Delete Sequences", viewport.alignment,\r
- HistoryItem.HIDE));\r
-\r
- SequenceGroup sg = viewport.getSelectionGroup();\r
-\r
- for (int i = 0; i < sg.sequences.size(); i++)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void invertSequenceMenuItem_actionPerformed(ActionEvent e)\r
{\r
- SequenceI seq = sg.getSequenceAt(i);\r
- int index = viewport.getAlignment().findIndex(seq);\r
- seq.deleteChars(sg.getStartRes(), sg.getEndRes() + 1);\r
+ SequenceGroup sg = viewport.getSelectionGroup();\r
\r
- if (seq.getSequence().length() < 1)\r
- {\r
- seqsdeleted = true;\r
- viewport.getAlignment().deleteSequence(seq);\r
- }\r
- else\r
- {\r
- viewport.getAlignment().getSequences().setElementAt(seq, index);\r
- }\r
- }\r
+ if (sg == null)\r
+ {\r
+ selectAllSequenceMenuItem_actionPerformed(null);\r
\r
- viewport.setSelectionGroup(null);\r
- viewport.alignment.deleteGroup(sg);\r
+ return;\r
+ }\r
\r
- if (seqsdeleted)\r
- {\r
- viewport.firePropertyChange("alignment", null,\r
- viewport.getAlignment().getSequences());\r
- }\r
+ for (int i = 0; i < viewport.getAlignment().getSequences().size();\r
+ i++)\r
+ {\r
+ sg.addOrRemove(viewport.getAlignment().getSequenceAt(i), false);\r
+ }\r
\r
- viewport.resetSeqLimits(alignPanel.seqPanel.seqCanvas.getHeight());\r
+ PaintRefresher.Refresh(null, viewport.alignment);\r
+ }\r
\r
- if (viewport.getAlignment().getHeight() < 1)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void remove2LeftMenuItem_actionPerformed(ActionEvent e)\r
{\r
- try\r
- {\r
- this.setClosed(true);\r
- }\r
- catch (Exception ex)\r
- {\r
- }\r
- }\r
+ ColumnSelection colSel = viewport.getColumnSelection();\r
\r
- viewport.updateConservation();\r
- viewport.updateConsensus();\r
- alignPanel.repaint();\r
- }\r
+ if (colSel.size() > 0)\r
+ {\r
+ addHistoryItem(new HistoryItem("Remove Left", viewport.alignment,\r
+ HistoryItem.HIDE));\r
\r
- protected void deleteGroups_actionPerformed(ActionEvent e)\r
- {\r
- viewport.alignment.deleteAllGroups();\r
- viewport.setSelectionGroup(null);\r
- alignPanel.repaint();\r
- }\r
+ int min = colSel.getMin();\r
+ viewport.getAlignment().trimLeft(min);\r
+ colSel.compensateForEdit(0, min);\r
\r
- public void selectAllSequenceMenuItem_actionPerformed(ActionEvent e)\r
- {\r
- SequenceGroup sg = new SequenceGroup();\r
+ if (viewport.getSelectionGroup() != null)\r
+ {\r
+ viewport.getSelectionGroup().adjustForRemoveLeft(min);\r
+ }\r
\r
- for (int i = 0; i < viewport.getAlignment().getSequences().size();\r
- i++)\r
- {\r
- sg.addSequence(viewport.getAlignment().getSequenceAt(i), false);\r
- }\r
+ Vector groups = viewport.alignment.getGroups();\r
\r
- sg.setEndRes(viewport.alignment.getWidth());\r
- viewport.setSelectionGroup(sg);\r
- PaintRefresher.Refresh(null, viewport.alignment);\r
- }\r
+ for (int i = 0; i < groups.size(); i++)\r
+ {\r
+ SequenceGroup sg = (SequenceGroup) groups.get(i);\r
\r
- public void deselectAllSequenceMenuItem_actionPerformed(ActionEvent e)\r
- {\r
- viewport.setSelectionGroup(null);\r
- viewport.getColumnSelection().clear();\r
- viewport.setSelectionGroup(null);\r
- alignPanel.annotationPanel.activeRes=null;\r
- PaintRefresher.Refresh(null, viewport.alignment);\r
- }\r
+ if (!sg.adjustForRemoveLeft(min))\r
+ {\r
+ viewport.alignment.deleteGroup(sg);\r
+ }\r
+ }\r
\r
- public void invertSequenceMenuItem_actionPerformed(ActionEvent e)\r
- {\r
- SequenceGroup sg = viewport.getSelectionGroup();\r
- if(sg==null)\r
- {\r
- selectAllSequenceMenuItem_actionPerformed(null);\r
- return;\r
+ alignPanel.repaint();\r
+ }\r
}\r
\r
- for (int i = 0; i < viewport.getAlignment().getSequences().size();\r
- i++)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void remove2RightMenuItem_actionPerformed(ActionEvent e)\r
{\r
- sg.addOrRemove(viewport.getAlignment().getSequenceAt(i), false);\r
- }\r
-\r
- PaintRefresher.Refresh(null, viewport.alignment);\r
- }\r
+ ColumnSelection colSel = viewport.getColumnSelection();\r
\r
- public void remove2LeftMenuItem_actionPerformed(ActionEvent e)\r
- {\r
- ColumnSelection colSel = viewport.getColumnSelection();\r
+ if (colSel.size() > 0)\r
+ {\r
+ addHistoryItem(new HistoryItem("Remove Right", viewport.alignment,\r
+ HistoryItem.HIDE));\r
\r
- if (colSel.size() > 0)\r
- {\r
- addHistoryItem(new HistoryItem("Remove Left", viewport.alignment,\r
- HistoryItem.HIDE));\r
+ int max = colSel.getMax();\r
+ viewport.getAlignment().trimRight(max);\r
\r
- int min = colSel.getMin();\r
- viewport.getAlignment().trimLeft(min);\r
- colSel.compensateForEdit(0, min);\r
+ if (viewport.getSelectionGroup() != null)\r
+ {\r
+ viewport.getSelectionGroup().adjustForRemoveRight(max);\r
+ }\r
\r
- if (viewport.getSelectionGroup() != null)\r
- {\r
- viewport.getSelectionGroup().adjustForRemoveLeft(min);\r
- }\r
+ Vector groups = viewport.alignment.getGroups();\r
\r
- Vector groups = viewport.alignment.getGroups();\r
+ for (int i = 0; i < groups.size(); i++)\r
+ {\r
+ SequenceGroup sg = (SequenceGroup) groups.get(i);\r
\r
- for (int i = 0; i < groups.size(); i++)\r
- {\r
- SequenceGroup sg = (SequenceGroup) groups.get(i);\r
+ if (!sg.adjustForRemoveRight(max))\r
+ {\r
+ viewport.alignment.deleteGroup(sg);\r
+ }\r
+ }\r
\r
- if (!sg.adjustForRemoveLeft(min))\r
- {\r
- viewport.alignment.deleteGroup(sg);\r
+ alignPanel.repaint();\r
}\r
- }\r
-\r
- alignPanel.repaint();\r
}\r
- }\r
\r
- public void remove2RightMenuItem_actionPerformed(ActionEvent e)\r
- {\r
- ColumnSelection colSel = viewport.getColumnSelection();\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void removeGappedColumnMenuItem_actionPerformed(ActionEvent e)\r
+ {\r
+ addHistoryItem(new HistoryItem("Remove Gapped Columns",\r
+ viewport.alignment, HistoryItem.HIDE));\r
\r
- if (colSel.size() > 0)\r
+ viewport.getAlignment().removeGaps();\r
+ viewport.updateConservation();\r
+ viewport.updateConsensus();\r
+ alignPanel.repaint();\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void removeAllGapsMenuItem_actionPerformed(ActionEvent e)\r
{\r
- addHistoryItem(new HistoryItem("Remove Right", viewport.alignment,\r
- HistoryItem.HIDE));\r
+ addHistoryItem(new HistoryItem("Remove Gaps", viewport.alignment,\r
+ HistoryItem.HIDE));\r
\r
- int max = colSel.getMax();\r
- viewport.getAlignment().trimRight(max);\r
+ SequenceI current;\r
+ int jSize;\r
\r
- if (viewport.getSelectionGroup() != null)\r
- {\r
- viewport.getSelectionGroup().adjustForRemoveRight(max);\r
- }\r
+ Vector seqs = null;\r
\r
- Vector groups = viewport.alignment.getGroups();\r
+ int start = 0;\r
+ int end = viewport.alignment.getWidth();\r
\r
- for (int i = 0; i < groups.size(); i++)\r
- {\r
- SequenceGroup sg = (SequenceGroup) groups.get(i);\r
+ if (viewport.getSelectionGroup() != null)\r
+ {\r
+ seqs = viewport.getSelectionGroup().sequences;\r
+ start = viewport.getSelectionGroup().getStartRes();\r
+ end = viewport.getSelectionGroup().getEndRes();\r
+ }\r
+ else\r
+ {\r
+ seqs = viewport.alignment.getSequences();\r
+ }\r
\r
- if (!sg.adjustForRemoveRight(max))\r
+ for (int i = 0; i < seqs.size(); i++)\r
{\r
- viewport.alignment.deleteGroup(sg);\r
+ current = (SequenceI) seqs.elementAt(i);\r
+ jSize = current.getLength();\r
+\r
+ int j = start;\r
+\r
+ do\r
+ {\r
+ if (jalview.util.Comparison.isGap(current.getCharAt(j)))\r
+ {\r
+ current.deleteCharAt(j);\r
+ j--;\r
+ jSize--;\r
+ }\r
+\r
+ j++;\r
+ }\r
+ while (j < end);\r
}\r
- }\r
\r
- alignPanel.repaint();\r
+ viewport.updateConservation();\r
+ viewport.updateConsensus();\r
+ alignPanel.repaint();\r
}\r
- }\r
\r
- public void removeGappedColumnMenuItem_actionPerformed(ActionEvent e)\r
- {\r
- addHistoryItem(new HistoryItem("Remove Gapped Columns",\r
- viewport.alignment, HistoryItem.HIDE));\r
-\r
- viewport.getAlignment().removeGaps();\r
- viewport.updateConservation();\r
- viewport.updateConsensus();\r
- alignPanel.repaint();\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void padGapsMenuitem_actionPerformed(ActionEvent e)\r
+ {\r
+ addHistoryItem(new HistoryItem("Pad Gaps", viewport.alignment,\r
+ HistoryItem.HIDE));\r
\r
- public void removeAllGapsMenuItem_actionPerformed(ActionEvent e)\r
- {\r
- addHistoryItem(new HistoryItem("Remove Gaps", viewport.alignment,\r
- HistoryItem.HIDE));\r
+ SequenceI current;\r
+ int Width = viewport.getAlignment().getWidth();\r
\r
- SequenceI current;\r
- int jSize;\r
+ for (int i = 0; i < viewport.getAlignment().getSequences().size();\r
+ i++)\r
+ {\r
+ current = viewport.getAlignment().getSequenceAt(i);\r
\r
- Vector seqs=null;\r
+ if (current.getLength() < Width)\r
+ {\r
+ current.insertCharAt(Width - 1, viewport.getGapCharacter());\r
+ }\r
+ }\r
\r
- int start=0, end = viewport.alignment.getWidth();\r
+ viewport.updateConservation();\r
+ viewport.updateConsensus();\r
+ alignPanel.repaint();\r
+ }\r
\r
- if(viewport.getSelectionGroup()!=null)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void findMenuItem_actionPerformed(ActionEvent e)\r
{\r
- seqs = viewport.getSelectionGroup().sequences;\r
- start = viewport.getSelectionGroup().getStartRes();\r
- end = viewport.getSelectionGroup().getEndRes();\r
+ JInternalFrame frame = new JInternalFrame();\r
+ Finder finder = new Finder(viewport, alignPanel, frame);\r
+ frame.setContentPane(finder);\r
+ Desktop.addInternalFrame(frame, "Find", 340, 110);\r
+ frame.setLayer(JLayeredPane.PALETTE_LAYER);\r
}\r
- else\r
- seqs = viewport.alignment.getSequences();\r
\r
- for (int i = 0; i <seqs.size(); i++)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void font_actionPerformed(ActionEvent e)\r
{\r
- current = (SequenceI)seqs.elementAt(i);\r
- jSize = current.getLength();\r
-\r
- int j = start;\r
- do\r
- {\r
- if (jalview.util.Comparison.isGap(current.getCharAt(j)))\r
- {\r
- current.deleteCharAt(j);\r
- j--;\r
- jSize--;\r
- }\r
- j++;\r
- }\r
- while(j < end);\r
+ FontChooser fc = new FontChooser(alignPanel);\r
}\r
\r
- viewport.updateConservation();\r
- viewport.updateConsensus();\r
- alignPanel.repaint();\r
- }\r
-\r
- public void padGapsMenuitem_actionPerformed(ActionEvent e)\r
- {\r
- addHistoryItem(new HistoryItem("Pad Gaps", viewport.alignment,\r
- HistoryItem.HIDE));\r
-\r
- SequenceI current;\r
- int Width = viewport.getAlignment().getWidth();\r
-\r
- for (int i = 0; i < viewport.getAlignment().getSequences().size();\r
- i++)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void fullSeqId_actionPerformed(ActionEvent e)\r
{\r
- current = viewport.getAlignment().getSequenceAt(i);\r
+ viewport.setShowFullId(fullSeqId.isSelected());\r
\r
- if (current.getLength() < Width)\r
- {\r
- current.insertCharAt(Width-1, viewport.getGapCharacter());\r
- }\r
+ alignPanel.idPanel.idCanvas.setPreferredSize(alignPanel.calculateIdWidth());\r
+ alignPanel.repaint();\r
}\r
\r
- viewport.updateConservation();\r
- viewport.updateConsensus();\r
- alignPanel.repaint();\r
- }\r
-\r
- public void findMenuItem_actionPerformed(ActionEvent e)\r
- {\r
- JInternalFrame frame = new JInternalFrame();\r
- Finder finder = new Finder(viewport, alignPanel, frame);\r
- frame.setContentPane(finder);\r
- Desktop.addInternalFrame(frame, "Find", 340, 110);\r
- frame.setLayer(JLayeredPane.PALETTE_LAYER);\r
- }\r
-\r
- public void font_actionPerformed(ActionEvent e)\r
- {\r
- FontChooser fc = new FontChooser(alignPanel);\r
- }\r
-\r
- protected void fullSeqId_actionPerformed(ActionEvent e)\r
- {\r
- viewport.setShowFullId(fullSeqId.isSelected());\r
-\r
- alignPanel.idPanel.idCanvas.setPreferredSize(alignPanel.calculateIdWidth());\r
- alignPanel.repaint();\r
- }\r
-\r
- protected void colourTextMenuItem_actionPerformed(ActionEvent e)\r
- {\r
- viewport.setColourText(colourTextMenuItem.isSelected());\r
- alignPanel.repaint();\r
- }\r
-\r
- protected void wrapMenuItem_actionPerformed(ActionEvent e)\r
- {\r
- viewport.setWrapAlignment(wrapMenuItem.isSelected());\r
- alignPanel.setWrapAlignment(wrapMenuItem.isSelected());\r
- scaleAbove.setVisible(wrapMenuItem.isSelected());\r
- scaleLeft.setVisible(wrapMenuItem.isSelected());\r
- scaleRight.setVisible(wrapMenuItem.isSelected());\r
- alignPanel.repaint();\r
- }\r
-\r
- protected void scaleAbove_actionPerformed(ActionEvent e)\r
- {\r
- viewport.setScaleAboveWrapped(scaleAbove.isSelected());\r
- alignPanel.repaint();\r
- }\r
-\r
- protected void scaleLeft_actionPerformed(ActionEvent e)\r
- {\r
- viewport.setScaleLeftWrapped(scaleLeft.isSelected());\r
- alignPanel.repaint();\r
- }\r
-\r
- protected void scaleRight_actionPerformed(ActionEvent e)\r
- {\r
- viewport.setScaleRightWrapped(scaleRight.isSelected());\r
- alignPanel.repaint();\r
- }\r
-\r
- public void viewBoxesMenuItem_actionPerformed(ActionEvent e)\r
- {\r
- viewport.setShowBoxes(viewBoxesMenuItem.isSelected());\r
- alignPanel.repaint();\r
- }\r
-\r
- public void viewTextMenuItem_actionPerformed(ActionEvent e)\r
- {\r
- viewport.setShowText(viewTextMenuItem.isSelected());\r
- alignPanel.repaint();\r
- }\r
-\r
- protected void renderGapsMenuItem_actionPerformed(ActionEvent e)\r
- {\r
- viewport.setRenderGaps(renderGapsMenuItem.isSelected());\r
- alignPanel.repaint();\r
- }\r
-\r
- public void sequenceFeatures_actionPerformed(ActionEvent evt)\r
- {\r
- viewport.showSequenceFeatures(sequenceFeatures.isSelected());\r
-\r
- if (viewport.showSequenceFeatures &&\r
- ! ( (Alignment) viewport.alignment).featuresAdded)\r
- {\r
- SequenceFeatureFetcher sft = new SequenceFeatureFetcher(viewport.\r
- alignment,\r
- alignPanel);\r
- ( (Alignment) viewport.alignment).featuresAdded = true;\r
- }\r
-\r
- alignPanel.repaint();\r
- }\r
-\r
- public void annotationPanelMenuItem_actionPerformed(ActionEvent e)\r
- {\r
- if (annotationPanelMenuItem.isSelected() &&\r
- viewport.getWrapAlignment())\r
- {\r
- annotationPanelMenuItem.setSelected(false);\r
-\r
- return;\r
- }\r
-\r
- viewport.setShowAnnotation(annotationPanelMenuItem.isSelected());\r
- alignPanel.setAnnotationVisible(annotationPanelMenuItem.isSelected());\r
- }\r
-\r
- public void overviewMenuItem_actionPerformed(ActionEvent e)\r
- {\r
- if (alignPanel.overviewPanel != null)\r
- {\r
- return;\r
- }\r
-\r
- JInternalFrame frame = new JInternalFrame();\r
- OverviewPanel overview = new OverviewPanel(alignPanel);\r
- frame.setContentPane(overview);\r
- Desktop.addInternalFrame(frame, "Overview " + this.getTitle(),\r
- frame.getWidth(), frame.getHeight());\r
- frame.pack();\r
- frame.setLayer(JLayeredPane.PALETTE_LAYER);\r
- frame.addInternalFrameListener(new javax.swing.event.InternalFrameAdapter()\r
- {\r
- public void internalFrameClosed(\r
- javax.swing.event.InternalFrameEvent evt)\r
- {\r
- alignPanel.setOverviewPanel(null);\r
- }\r
- ;\r
- });\r
-\r
- alignPanel.setOverviewPanel(overview);\r
- }\r
-\r
- protected void noColourmenuItem_actionPerformed(ActionEvent e)\r
- {\r
- changeColour(null);\r
- }\r
-\r
- public void clustalColour_actionPerformed(ActionEvent e)\r
- {\r
- changeColour(new ClustalxColourScheme(\r
- viewport.alignment.getSequences(), viewport.alignment.getWidth()));\r
- }\r
-\r
- public void zappoColour_actionPerformed(ActionEvent e)\r
- {\r
- changeColour(new ZappoColourScheme());\r
- }\r
-\r
- public void taylorColour_actionPerformed(ActionEvent e)\r
- {\r
- changeColour(new TaylorColourScheme());\r
- }\r
-\r
- public void hydrophobicityColour_actionPerformed(ActionEvent e)\r
- {\r
- changeColour(new HydrophobicColourScheme());\r
- }\r
-\r
- public void helixColour_actionPerformed(ActionEvent e)\r
- {\r
- changeColour(new HelixColourScheme());\r
- }\r
-\r
- public void strandColour_actionPerformed(ActionEvent e)\r
- {\r
- changeColour(new StrandColourScheme());\r
- }\r
-\r
- public void turnColour_actionPerformed(ActionEvent e)\r
- {\r
- changeColour(new TurnColourScheme());\r
- }\r
-\r
- public void buriedColour_actionPerformed(ActionEvent e)\r
- {\r
- changeColour(new BuriedColourScheme());\r
- }\r
-\r
- public void nucleotideColour_actionPerformed(ActionEvent e)\r
- {\r
- changeColour(new NucleotideColourScheme());\r
- }\r
-\r
- protected void applyToAllGroups_actionPerformed(ActionEvent e)\r
- {\r
- viewport.setColourAppliesToAllGroups(applyToAllGroups.isSelected());\r
- }\r
-\r
- void changeColour(ColourSchemeI cs)\r
- {\r
- int threshold = 0;\r
-\r
- if (viewport.getAbovePIDThreshold())\r
- {\r
- threshold = SliderPanel.setPIDSliderSource(alignPanel, cs,\r
- "Background");\r
-\r
- if (cs instanceof ResidueColourScheme)\r
- {\r
- ( (ResidueColourScheme) cs).setThreshold(threshold);\r
- }\r
- else if (cs instanceof ScoreColourScheme)\r
- {\r
- ( (ScoreColourScheme) cs).setThreshold(threshold);\r
- }\r
-\r
- viewport.setGlobalColourScheme(cs);\r
- }\r
- else if (cs instanceof ResidueColourScheme)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void colourTextMenuItem_actionPerformed(ActionEvent e)\r
{\r
- ( (ResidueColourScheme) cs).setThreshold(0);\r
+ viewport.setColourText(colourTextMenuItem.isSelected());\r
+ alignPanel.repaint();\r
}\r
- else if (cs instanceof ScoreColourScheme)\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void wrapMenuItem_actionPerformed(ActionEvent e)\r
{\r
- ( (ScoreColourScheme) cs).setThreshold(0);\r
+ viewport.setWrapAlignment(wrapMenuItem.isSelected());\r
+ alignPanel.setWrapAlignment(wrapMenuItem.isSelected());\r
+ scaleAbove.setVisible(wrapMenuItem.isSelected());\r
+ scaleLeft.setVisible(wrapMenuItem.isSelected());\r
+ scaleRight.setVisible(wrapMenuItem.isSelected());\r
+ alignPanel.repaint();\r
}\r
\r
- if (viewport.getConservationSelected())\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void scaleAbove_actionPerformed(ActionEvent e)\r
{\r
- ConservationColourScheme ccs = null;\r
-\r
- Alignment al = (Alignment) viewport.alignment;\r
- Conservation c = new Conservation("All",\r
- ResidueProperties.propHash, 3,\r
- al.getSequences(), 0,\r
- al.getWidth() - 1);\r
-\r
- c.calculate();\r
- c.verdict(false, viewport.ConsPercGaps);\r
-\r
- ccs = new ConservationColourScheme(c, cs);\r
+ viewport.setScaleAboveWrapped(scaleAbove.isSelected());\r
+ alignPanel.repaint();\r
+ }\r
\r
- // MUST NOTIFY THE COLOURSCHEME OF CONSENSUS!\r
- ccs.setConsensus(viewport.vconsensus);\r
- viewport.setGlobalColourScheme(ccs);\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void scaleLeft_actionPerformed(ActionEvent e)\r
+ {\r
+ viewport.setScaleLeftWrapped(scaleLeft.isSelected());\r
+ alignPanel.repaint();\r
+ }\r
\r
- ccs.inc = SliderPanel.setConservationSlider(alignPanel, ccs,\r
- "Background");\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void scaleRight_actionPerformed(ActionEvent e)\r
+ {\r
+ viewport.setScaleRightWrapped(scaleRight.isSelected());\r
+ alignPanel.repaint();\r
}\r
- else\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void viewBoxesMenuItem_actionPerformed(ActionEvent e)\r
{\r
- // MUST NOTIFY THE COLOURSCHEME OF CONSENSUS!\r
- if (cs != null)\r
- {\r
- cs.setConsensus(viewport.vconsensus);\r
- }\r
+ viewport.setShowBoxes(viewBoxesMenuItem.isSelected());\r
+ alignPanel.repaint();\r
+ }\r
\r
- viewport.setGlobalColourScheme(cs);\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void viewTextMenuItem_actionPerformed(ActionEvent e)\r
+ {\r
+ viewport.setShowText(viewTextMenuItem.isSelected());\r
+ alignPanel.repaint();\r
}\r
\r
- if (viewport.getColourAppliesToAllGroups())\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void renderGapsMenuItem_actionPerformed(ActionEvent e)\r
{\r
- Vector groups = viewport.alignment.getGroups();\r
+ viewport.setRenderGaps(renderGapsMenuItem.isSelected());\r
+ alignPanel.repaint();\r
+ }\r
\r
- for (int i = 0; i < groups.size(); i++)\r
- {\r
- SequenceGroup sg = (SequenceGroup) groups.elementAt(i);\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ */\r
+ public void sequenceFeatures_actionPerformed(ActionEvent evt)\r
+ {\r
+ viewport.showSequenceFeatures(sequenceFeatures.isSelected());\r
\r
- if (cs == null)\r
- {\r
- sg.cs = null;\r
- }\r
- else if (cs instanceof ClustalxColourScheme)\r
- {\r
- sg.cs = new ClustalxColourScheme(sg.sequences, sg.getWidth());\r
- }\r
- else if (cs instanceof UserColourScheme)\r
+ if (viewport.showSequenceFeatures &&\r
+ !((Alignment) viewport.alignment).featuresAdded)\r
{\r
- sg.cs = new UserColourScheme( ( (UserColourScheme) cs).getColours());\r
- }\r
- else\r
- {\r
- try\r
- {\r
- sg.cs = (ColourSchemeI) cs.getClass().newInstance();\r
- }\r
- catch (Exception ex)\r
- {\r
- }\r
+ SequenceFeatureFetcher sft = new SequenceFeatureFetcher(viewport.alignment,\r
+ alignPanel);\r
+ ((Alignment) viewport.alignment).featuresAdded = true;\r
}\r
\r
- if (viewport.getAbovePIDThreshold())\r
+ alignPanel.repaint();\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void annotationPanelMenuItem_actionPerformed(ActionEvent e)\r
+ {\r
+ if (annotationPanelMenuItem.isSelected() &&\r
+ viewport.getWrapAlignment())\r
{\r
- if (sg.cs instanceof ResidueColourScheme)\r
- {\r
- ( (ResidueColourScheme) sg.cs).setThreshold(threshold);\r
- }\r
- else if (sg.cs instanceof ScoreColourScheme)\r
- {\r
- ( (ScoreColourScheme) sg.cs).setThreshold(threshold);\r
- }\r
+ annotationPanelMenuItem.setSelected(false);\r
\r
- sg.cs.setConsensus(AAFrequency.calculate(sg.sequences, 0,\r
- sg.getWidth()));\r
+ return;\r
}\r
\r
- if (viewport.getConservationSelected())\r
- {\r
- Conservation c = new Conservation("Group",\r
- ResidueProperties.propHash, 3,\r
- sg.sequences, 0,\r
- viewport.alignment.getWidth() - 1);\r
- c.calculate();\r
- c.verdict(false, viewport.ConsPercGaps);\r
-\r
- ConservationColourScheme ccs = new ConservationColourScheme(c,\r
- sg.cs);\r
+ viewport.setShowAnnotation(annotationPanelMenuItem.isSelected());\r
+ alignPanel.setAnnotationVisible(annotationPanelMenuItem.isSelected());\r
+ }\r
\r
- // MUST NOTIFY THE COLOURSCHEME OF CONSENSUS!\r
- ccs.setConsensus(AAFrequency.calculate(sg.sequences, 0,\r
- sg.getWidth()));\r
- sg.cs = ccs;\r
- }\r
- else if (cs != null)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void overviewMenuItem_actionPerformed(ActionEvent e)\r
+ {\r
+ if (alignPanel.overviewPanel != null)\r
{\r
- // MUST NOTIFY THE COLOURSCHEME OF CONSENSUS!\r
- sg.cs.setConsensus(AAFrequency.calculate(sg.sequences, 0,\r
- sg.getWidth()));\r
+ return;\r
}\r
- }\r
+\r
+ JInternalFrame frame = new JInternalFrame();\r
+ OverviewPanel overview = new OverviewPanel(alignPanel);\r
+ frame.setContentPane(overview);\r
+ Desktop.addInternalFrame(frame, "Overview " + this.getTitle(),\r
+ frame.getWidth(), frame.getHeight());\r
+ frame.pack();\r
+ frame.setLayer(JLayeredPane.PALETTE_LAYER);\r
+ frame.addInternalFrameListener(new javax.swing.event.InternalFrameAdapter()\r
+ {\r
+ public void internalFrameClosed(\r
+ javax.swing.event.InternalFrameEvent evt)\r
+ {\r
+ alignPanel.setOverviewPanel(null);\r
+ }\r
+ ;\r
+ });\r
+\r
+ alignPanel.setOverviewPanel(overview);\r
}\r
\r
- if (alignPanel.getOverviewPanel() != null)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void noColourmenuItem_actionPerformed(ActionEvent e)\r
{\r
- alignPanel.getOverviewPanel().updateOverviewImage();\r
+ changeColour(null);\r
}\r
\r
- alignPanel.repaint();\r
- }\r
-\r
- protected void modifyPID_actionPerformed(ActionEvent e)\r
- {\r
- if (viewport.getAbovePIDThreshold())\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void clustalColour_actionPerformed(ActionEvent e)\r
{\r
- SliderPanel.setPIDSliderSource(alignPanel,\r
- viewport.getGlobalColourScheme(),\r
- "Background");\r
- SliderPanel.showPIDSlider();\r
+ changeColour(new ClustalxColourScheme(\r
+ viewport.alignment.getSequences(), viewport.alignment.getWidth()));\r
}\r
- }\r
\r
- protected void modifyConservation_actionPerformed(ActionEvent e)\r
- {\r
- if (viewport.getConservationSelected())\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void zappoColour_actionPerformed(ActionEvent e)\r
{\r
- SliderPanel.setConservationSlider(alignPanel,\r
- viewport.globalColourScheme,\r
- "Background");\r
- SliderPanel.showConservationSlider();\r
+ changeColour(new ZappoColourScheme());\r
}\r
- }\r
-\r
- protected void conservationMenuItem_actionPerformed(ActionEvent e)\r
- {\r
- viewport.setConservationSelected(conservationMenuItem.isSelected());\r
-\r
- viewport.setAbovePIDThreshold(false);\r
- abovePIDThreshold.setSelected(false);\r
\r
- ColourSchemeI cs = viewport.getGlobalColourScheme();\r
-\r
- if (cs instanceof ConservationColourScheme)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void taylorColour_actionPerformed(ActionEvent e)\r
{\r
- changeColour( ( (ConservationColourScheme) cs).cs);\r
+ changeColour(new TaylorColourScheme());\r
}\r
- else\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void hydrophobicityColour_actionPerformed(ActionEvent e)\r
{\r
- changeColour(cs);\r
+ changeColour(new HydrophobicColourScheme());\r
}\r
\r
- modifyConservation_actionPerformed(null);\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void helixColour_actionPerformed(ActionEvent e)\r
+ {\r
+ changeColour(new HelixColourScheme());\r
+ }\r
\r
- public void abovePIDThreshold_actionPerformed(ActionEvent e)\r
- {\r
- viewport.setAbovePIDThreshold(abovePIDThreshold.isSelected());\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void strandColour_actionPerformed(ActionEvent e)\r
+ {\r
+ changeColour(new StrandColourScheme());\r
+ }\r
\r
- conservationMenuItem.setSelected(false);\r
- viewport.setConservationSelected(false);\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void turnColour_actionPerformed(ActionEvent e)\r
+ {\r
+ changeColour(new TurnColourScheme());\r
+ }\r
\r
- ColourSchemeI cs = viewport.getGlobalColourScheme();\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void buriedColour_actionPerformed(ActionEvent e)\r
+ {\r
+ changeColour(new BuriedColourScheme());\r
+ }\r
\r
- if (cs instanceof ConservationColourScheme)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void nucleotideColour_actionPerformed(ActionEvent e)\r
{\r
- changeColour( ( (ConservationColourScheme) cs).cs);\r
+ changeColour(new NucleotideColourScheme());\r
}\r
- else\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void applyToAllGroups_actionPerformed(ActionEvent e)\r
{\r
- changeColour(cs);\r
+ viewport.setColourAppliesToAllGroups(applyToAllGroups.isSelected());\r
}\r
\r
- modifyPID_actionPerformed(null);\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param cs DOCUMENT ME!\r
+ */\r
+ void changeColour(ColourSchemeI cs)\r
+ {\r
+ int threshold = 0;\r
\r
- public void userDefinedColour_actionPerformed(ActionEvent e)\r
- {\r
- new UserDefinedColours(alignPanel, null);\r
- }\r
+ if (viewport.getAbovePIDThreshold())\r
+ {\r
+ threshold = SliderPanel.setPIDSliderSource(alignPanel, cs,\r
+ "Background");\r
+\r
+ if (cs instanceof ResidueColourScheme)\r
+ {\r
+ ((ResidueColourScheme) cs).setThreshold(threshold);\r
+ }\r
+ else if (cs instanceof ScoreColourScheme)\r
+ {\r
+ ((ScoreColourScheme) cs).setThreshold(threshold);\r
+ }\r
+\r
+ viewport.setGlobalColourScheme(cs);\r
+ }\r
+ else if (cs instanceof ResidueColourScheme)\r
+ {\r
+ ((ResidueColourScheme) cs).setThreshold(0);\r
+ }\r
+ else if (cs instanceof ScoreColourScheme)\r
+ {\r
+ ((ScoreColourScheme) cs).setThreshold(0);\r
+ }\r
\r
- public void PIDColour_actionPerformed(ActionEvent e)\r
- {\r
- changeColour(new PIDColourScheme());\r
- }\r
+ if (viewport.getConservationSelected())\r
+ {\r
+ ConservationColourScheme ccs = null;\r
\r
- public void BLOSUM62Colour_actionPerformed(ActionEvent e)\r
- {\r
- changeColour(new Blosum62ColourScheme());\r
- }\r
+ Alignment al = (Alignment) viewport.alignment;\r
+ Conservation c = new Conservation("All",\r
+ ResidueProperties.propHash, 3, al.getSequences(), 0,\r
+ al.getWidth() - 1);\r
\r
- public void sortPairwiseMenuItem_actionPerformed(ActionEvent e)\r
- {\r
- addHistoryItem(new HistoryItem("Pairwise Sort", viewport.alignment,\r
- HistoryItem.SORT));\r
- AlignmentSorter.sortByPID(viewport.getAlignment(),\r
- viewport.getAlignment().getSequenceAt(0));\r
- alignPanel.repaint();\r
- }\r
+ c.calculate();\r
+ c.verdict(false, viewport.ConsPercGaps);\r
\r
- public void sortIDMenuItem_actionPerformed(ActionEvent e)\r
- {\r
- addHistoryItem(new HistoryItem("ID Sort", viewport.alignment,\r
- HistoryItem.SORT));\r
- AlignmentSorter.sortByID(viewport.getAlignment());\r
- alignPanel.repaint();\r
- }\r
+ ccs = new ConservationColourScheme(c, cs);\r
\r
- public void sortGroupMenuItem_actionPerformed(ActionEvent e)\r
- {\r
- addHistoryItem(new HistoryItem("Group Sort", viewport.alignment,\r
- HistoryItem.SORT));\r
+ // MUST NOTIFY THE COLOURSCHEME OF CONSENSUS!\r
+ ccs.setConsensus(viewport.vconsensus);\r
+ viewport.setGlobalColourScheme(ccs);\r
\r
- AlignmentSorter.sortByGroup(viewport.getAlignment());\r
- alignPanel.repaint();\r
- }\r
+ ccs.inc = SliderPanel.setConservationSlider(alignPanel, ccs,\r
+ "Background");\r
+ }\r
+ else\r
+ {\r
+ // MUST NOTIFY THE COLOURSCHEME OF CONSENSUS!\r
+ if (cs != null)\r
+ {\r
+ cs.setConsensus(viewport.vconsensus);\r
+ }\r
\r
- public void removeRedundancyMenuItem_actionPerformed(ActionEvent e)\r
- {\r
- RedundancyPanel sp = new RedundancyPanel(alignPanel, this);\r
- JInternalFrame frame = new JInternalFrame();\r
- frame.setContentPane(sp);\r
- Desktop.addInternalFrame(frame, "Redundancy threshold selection", 400,\r
- 100, false);\r
- }\r
+ viewport.setGlobalColourScheme(cs);\r
+ }\r
\r
- public void pairwiseAlignmentMenuItem_actionPerformed(ActionEvent e)\r
- {\r
- if ( (viewport.getSelectionGroup() == null) ||\r
- (viewport.getSelectionGroup().getSize() < 2))\r
- {\r
- JOptionPane.showInternalMessageDialog(this,\r
- "You must select at least 2 sequences.",\r
- "Invalid Selection",\r
- JOptionPane.WARNING_MESSAGE);\r
+ if (viewport.getColourAppliesToAllGroups())\r
+ {\r
+ Vector groups = viewport.alignment.getGroups();\r
+\r
+ for (int i = 0; i < groups.size(); i++)\r
+ {\r
+ SequenceGroup sg = (SequenceGroup) groups.elementAt(i);\r
+\r
+ if (cs == null)\r
+ {\r
+ sg.cs = null;\r
+ }\r
+ else if (cs instanceof ClustalxColourScheme)\r
+ {\r
+ sg.cs = new ClustalxColourScheme(sg.sequences, sg.getWidth());\r
+ }\r
+ else if (cs instanceof UserColourScheme)\r
+ {\r
+ sg.cs = new UserColourScheme(((UserColourScheme) cs).getColours());\r
+ }\r
+ else\r
+ {\r
+ try\r
+ {\r
+ sg.cs = (ColourSchemeI) cs.getClass().newInstance();\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ }\r
+ }\r
+\r
+ if (viewport.getAbovePIDThreshold())\r
+ {\r
+ if (sg.cs instanceof ResidueColourScheme)\r
+ {\r
+ ((ResidueColourScheme) sg.cs).setThreshold(threshold);\r
+ }\r
+ else if (sg.cs instanceof ScoreColourScheme)\r
+ {\r
+ ((ScoreColourScheme) sg.cs).setThreshold(threshold);\r
+ }\r
+\r
+ sg.cs.setConsensus(AAFrequency.calculate(sg.sequences, 0,\r
+ sg.getWidth()));\r
+ }\r
+\r
+ if (viewport.getConservationSelected())\r
+ {\r
+ Conservation c = new Conservation("Group",\r
+ ResidueProperties.propHash, 3, sg.sequences, 0,\r
+ viewport.alignment.getWidth() - 1);\r
+ c.calculate();\r
+ c.verdict(false, viewport.ConsPercGaps);\r
+\r
+ ConservationColourScheme ccs = new ConservationColourScheme(c,\r
+ sg.cs);\r
+\r
+ // MUST NOTIFY THE COLOURSCHEME OF CONSENSUS!\r
+ ccs.setConsensus(AAFrequency.calculate(sg.sequences, 0,\r
+ sg.getWidth()));\r
+ sg.cs = ccs;\r
+ }\r
+ else if (cs != null)\r
+ {\r
+ // MUST NOTIFY THE COLOURSCHEME OF CONSENSUS!\r
+ sg.cs.setConsensus(AAFrequency.calculate(sg.sequences, 0,\r
+ sg.getWidth()));\r
+ }\r
+ }\r
+ }\r
+\r
+ if (alignPanel.getOverviewPanel() != null)\r
+ {\r
+ alignPanel.getOverviewPanel().updateOverviewImage();\r
+ }\r
+\r
+ alignPanel.repaint();\r
}\r
- else\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void modifyPID_actionPerformed(ActionEvent e)\r
{\r
- JInternalFrame frame = new JInternalFrame();\r
- frame.setContentPane(new PairwiseAlignPanel(viewport));\r
- Desktop.addInternalFrame(frame, "Pairwise Alignment", 600, 500);\r
+ if (viewport.getAbovePIDThreshold())\r
+ {\r
+ SliderPanel.setPIDSliderSource(alignPanel,\r
+ viewport.getGlobalColourScheme(), "Background");\r
+ SliderPanel.showPIDSlider();\r
+ }\r
}\r
- }\r
\r
- public void PCAMenuItem_actionPerformed(ActionEvent e)\r
- {\r
- if ( ( (viewport.getSelectionGroup() != null) &&\r
- (viewport.getSelectionGroup().getSize() < 4) &&\r
- (viewport.getSelectionGroup().getSize() > 0)) ||\r
- (viewport.getAlignment().getHeight() < 4))\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void modifyConservation_actionPerformed(ActionEvent e)\r
{\r
- JOptionPane.showInternalMessageDialog(this,\r
- "Principal component analysis must take\n" +\r
- "at least 4 input sequences.",\r
- "Sequence selection insufficient",\r
- JOptionPane.WARNING_MESSAGE);\r
-\r
- return;\r
+ if (viewport.getConservationSelected())\r
+ {\r
+ SliderPanel.setConservationSlider(alignPanel,\r
+ viewport.globalColourScheme, "Background");\r
+ SliderPanel.showConservationSlider();\r
+ }\r
}\r
\r
- try\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void conservationMenuItem_actionPerformed(ActionEvent e)\r
{\r
- PCAPanel pcaPanel = new PCAPanel(viewport, null);\r
- JInternalFrame frame = new JInternalFrame();\r
- frame.setContentPane(pcaPanel);\r
- Desktop.addInternalFrame(frame, "Principal component analysis",\r
- 400, 400);\r
- }\r
- catch (java.lang.OutOfMemoryError ex)\r
- {\r
- JOptionPane.showInternalMessageDialog(this,\r
- "Too many sequences selected\nfor Principal Component Analysis!!",\r
- "Out of memory",\r
- JOptionPane.WARNING_MESSAGE);\r
- }\r
- }\r
-\r
- public void averageDistanceTreeMenuItem_actionPerformed(ActionEvent e)\r
- {\r
- NewTreePanel("AV", "PID", "Average distance tree using PID");\r
- }\r
-\r
- public void neighbourTreeMenuItem_actionPerformed(ActionEvent e)\r
- {\r
- NewTreePanel("NJ", "PID", "Neighbour joining tree using PID");\r
- }\r
-\r
- protected void njTreeBlosumMenuItem_actionPerformed(ActionEvent e)\r
- {\r
- NewTreePanel("NJ", "BL", "Neighbour joining tree using BLOSUM62");\r
- }\r
-\r
- protected void avTreeBlosumMenuItem_actionPerformed(ActionEvent e)\r
- {\r
- NewTreePanel("AV", "BL", "Average distance tree using BLOSUM62");\r
- }\r
-\r
- void NewTreePanel(String type, String pwType, String title)\r
- {\r
- final TreePanel tp;\r
-\r
- if ( (viewport.getSelectionGroup() != null) &&\r
- (viewport.getSelectionGroup().getSize() > 3))\r
- {\r
- int s = 0;\r
- SequenceGroup sg = viewport.getSelectionGroup();\r
+ viewport.setConservationSelected(conservationMenuItem.isSelected());\r
\r
- /* Decide if the selection is a column region */\r
- while (s < sg.sequences.size())\r
- {\r
- if ( ( (SequenceI) sg.sequences.elementAt(s++)).getLength() <\r
- sg.getEndRes())\r
- {\r
- JOptionPane.showMessageDialog(Desktop.desktop,\r
- "The selected region to create a tree may\nonly contain residues or gaps.\n" +\r
- "Try using the Pad function in the edit menu,\n" +\r
- "or one of the multiple sequence alignment web services.",\r
- "Sequences in selection are not aligned",\r
- JOptionPane.WARNING_MESSAGE);\r
+ viewport.setAbovePIDThreshold(false);\r
+ abovePIDThreshold.setSelected(false);\r
+\r
+ ColourSchemeI cs = viewport.getGlobalColourScheme();\r
\r
- return;\r
+ if (cs instanceof ConservationColourScheme)\r
+ {\r
+ changeColour(((ConservationColourScheme) cs).cs);\r
+ }\r
+ else\r
+ {\r
+ changeColour(cs);\r
}\r
- }\r
\r
- title = title + " on region";\r
- tp = new TreePanel(viewport,\r
- viewport.getSelectionGroup().sequences, type, pwType,\r
- sg.getStartRes(), sg.getEndRes());\r
+ modifyConservation_actionPerformed(null);\r
}\r
- else\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void abovePIDThreshold_actionPerformed(ActionEvent e)\r
{\r
- //are the sequences aligned?\r
- if (!viewport.alignment.isAligned())\r
- {\r
- JOptionPane.showMessageDialog(Desktop.desktop,\r
- "The sequences must be aligned before creating a tree.\n" +\r
- "Try using the Pad function in the edit menu,\n" +\r
- "or one of the multiple sequence alignment web services.",\r
- "Sequences not aligned",\r
- JOptionPane.WARNING_MESSAGE);\r
-\r
- return;\r
- }\r
+ viewport.setAbovePIDThreshold(abovePIDThreshold.isSelected());\r
\r
- tp = new TreePanel(viewport,\r
- viewport.getAlignment().getSequences(), type, pwType,\r
- 0,\r
- viewport.alignment.getWidth());\r
- }\r
+ conservationMenuItem.setSelected(false);\r
+ viewport.setConservationSelected(false);\r
\r
- addTreeMenuItem(tp, title);\r
- viewport.setCurrentTree(tp.getTree());\r
+ ColourSchemeI cs = viewport.getGlobalColourScheme();\r
\r
- Desktop.addInternalFrame(tp, title + " from " + this.title, 600, 500);\r
- }\r
+ if (cs instanceof ConservationColourScheme)\r
+ {\r
+ changeColour(((ConservationColourScheme) cs).cs);\r
+ }\r
+ else\r
+ {\r
+ changeColour(cs);\r
+ }\r
\r
- public void addSortByOrderMenuItem(String title, final AlignmentOrder order)\r
- {\r
- final JMenuItem item = new JMenuItem("by " + title);\r
- sort.add(item);\r
- item.addActionListener(new java.awt.event.ActionListener()\r
+ modifyPID_actionPerformed(null);\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void userDefinedColour_actionPerformed(ActionEvent e)\r
{\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- addHistoryItem(new HistoryItem("Sort", viewport.alignment,\r
- HistoryItem.SORT));\r
+ new UserDefinedColours(alignPanel, null);\r
+ }\r
\r
- // TODO: JBPNote - have to map order entries to curent SequenceI pointers\r
- AlignmentSorter.sortBy(viewport.getAlignment(), order);\r
- alignPanel.repaint();\r
- }\r
- });\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void PIDColour_actionPerformed(ActionEvent e)\r
+ {\r
+ changeColour(new PIDColourScheme());\r
+ }\r
\r
- void addTreeMenuItem(final TreePanel treePanel, String title)\r
- {\r
- final JMenuItem item = new JMenuItem(title);\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void BLOSUM62Colour_actionPerformed(ActionEvent e)\r
+ {\r
+ changeColour(new Blosum62ColourScheme());\r
+ }\r
\r
- treeCount++;\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void sortPairwiseMenuItem_actionPerformed(ActionEvent e)\r
+ {\r
+ addHistoryItem(new HistoryItem("Pairwise Sort", viewport.alignment,\r
+ HistoryItem.SORT));\r
+ AlignmentSorter.sortByPID(viewport.getAlignment(),\r
+ viewport.getAlignment().getSequenceAt(0));\r
+ alignPanel.repaint();\r
+ }\r
\r
- if (treeCount == 1)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void sortIDMenuItem_actionPerformed(ActionEvent e)\r
{\r
- sort.add(sortByTreeMenu);\r
+ addHistoryItem(new HistoryItem("ID Sort", viewport.alignment,\r
+ HistoryItem.SORT));\r
+ AlignmentSorter.sortByID(viewport.getAlignment());\r
+ alignPanel.repaint();\r
}\r
\r
- sortByTreeMenu.add(item);\r
- item.addActionListener(new java.awt.event.ActionListener()\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void sortGroupMenuItem_actionPerformed(ActionEvent e)\r
{\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- addHistoryItem(new HistoryItem("Tree Sort",\r
- viewport.alignment, HistoryItem.SORT));\r
- AlignmentSorter.sortByTree(viewport.getAlignment(),\r
- treePanel.getTree());\r
+ addHistoryItem(new HistoryItem("Group Sort", viewport.alignment,\r
+ HistoryItem.SORT));\r
+\r
+ AlignmentSorter.sortByGroup(viewport.getAlignment());\r
alignPanel.repaint();\r
- }\r
- });\r
+ }\r
\r
- treePanel.addInternalFrameListener(new javax.swing.event.\r
- InternalFrameAdapter()\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void removeRedundancyMenuItem_actionPerformed(ActionEvent e)\r
{\r
- public void internalFrameClosed(\r
- javax.swing.event.InternalFrameEvent evt)\r
- {\r
- treeCount--;\r
- sortByTreeMenu.remove(item);\r
+ RedundancyPanel sp = new RedundancyPanel(alignPanel, this);\r
+ JInternalFrame frame = new JInternalFrame();\r
+ frame.setContentPane(sp);\r
+ Desktop.addInternalFrame(frame, "Redundancy threshold selection", 400,\r
+ 100, false);\r
+ }\r
\r
- if (treeCount == 0)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void pairwiseAlignmentMenuItem_actionPerformed(ActionEvent e)\r
+ {\r
+ if ((viewport.getSelectionGroup() == null) ||\r
+ (viewport.getSelectionGroup().getSize() < 2))\r
{\r
- sort.remove(sortByTreeMenu);\r
+ JOptionPane.showInternalMessageDialog(this,\r
+ "You must select at least 2 sequences.", "Invalid Selection",\r
+ JOptionPane.WARNING_MESSAGE);\r
}\r
- }\r
- ;\r
- });\r
- viewport.addPropertyChangeListener(new java.beans.PropertyChangeListener()\r
- {\r
- public void propertyChange(PropertyChangeEvent evt)\r
- {\r
- if (evt.getPropertyName().equals("alignment"))\r
+ else\r
{\r
- treePanel.getTree().UpdatePlaceHolders( (Vector) evt.getNewValue());\r
- treePanel.repaint();\r
+ JInternalFrame frame = new JInternalFrame();\r
+ frame.setContentPane(new PairwiseAlignPanel(viewport));\r
+ Desktop.addInternalFrame(frame, "Pairwise Alignment", 600, 500);\r
}\r
- }\r
- });\r
- }\r
-\r
- public void clustalAlignMenuItem_actionPerformed(ActionEvent e)\r
- {\r
- // TODO:resolve which menu item was actually selected\r
- // Now, check we have enough sequences\r
- SequenceI[] msa = null;\r
-\r
- if ( (viewport.getSelectionGroup() != null) &&\r
- (viewport.getSelectionGroup().getSize() > 1))\r
- {\r
- // JBPNote UGLY! To prettify, make SequenceGroup and Alignment conform to some common interface!\r
- SequenceGroup seqs = viewport.getSelectionGroup();\r
- int sz;\r
- msa = new SequenceI[sz = seqs.getSize()];\r
-\r
- for (int i = 0; i < sz; i++)\r
- {\r
- msa[i] = (SequenceI) seqs.getSequenceAt(i);\r
- }\r
}\r
- else\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void PCAMenuItem_actionPerformed(ActionEvent e)\r
{\r
- Vector seqs = viewport.getAlignment().getSequences();\r
+ if (((viewport.getSelectionGroup() != null) &&\r
+ (viewport.getSelectionGroup().getSize() < 4) &&\r
+ (viewport.getSelectionGroup().getSize() > 0)) ||\r
+ (viewport.getAlignment().getHeight() < 4))\r
+ {\r
+ JOptionPane.showInternalMessageDialog(this,\r
+ "Principal component analysis must take\n" +\r
+ "at least 4 input sequences.",\r
+ "Sequence selection insufficient", JOptionPane.WARNING_MESSAGE);\r
\r
- if (seqs.size() > 1)\r
- {\r
- msa = new SequenceI[seqs.size()];\r
+ return;\r
+ }\r
\r
- for (int i = 0; i < seqs.size(); i++)\r
+ try\r
{\r
- msa[i] = (SequenceI) seqs.elementAt(i);\r
+ PCAPanel pcaPanel = new PCAPanel(viewport, null);\r
+ JInternalFrame frame = new JInternalFrame();\r
+ frame.setContentPane(pcaPanel);\r
+ Desktop.addInternalFrame(frame, "Principal component analysis",\r
+ 400, 400);\r
+ }\r
+ catch (java.lang.OutOfMemoryError ex)\r
+ {\r
+ JOptionPane.showInternalMessageDialog(this,\r
+ "Too many sequences selected\nfor Principal Component Analysis!!",\r
+ "Out of memory", JOptionPane.WARNING_MESSAGE);\r
}\r
- }\r
}\r
\r
- if (msa != null)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void averageDistanceTreeMenuItem_actionPerformed(ActionEvent e)\r
{\r
- jalview.ws.MsaWSClient ct = new jalview.ws.MsaWSClient("ClustalWS",\r
- title, msa, false, true);\r
+ NewTreePanel("AV", "PID", "Average distance tree using PID");\r
}\r
- }\r
\r
- public void ClustalRealign_actionPerformed(ActionEvent e)\r
- {\r
- // TODO:resolve which menu item was actually selected\r
- // Now, check we have enough sequences\r
- SequenceI[] msa = null;\r
-\r
- if ( (viewport.getSelectionGroup() != null) &&\r
- (viewport.getSelectionGroup().getSize() > 1))\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void neighbourTreeMenuItem_actionPerformed(ActionEvent e)\r
{\r
- // JBPNote UGLY! To prettify, make SequenceGroup and Alignment conform to some common interface!\r
- SequenceGroup seqs = viewport.getSelectionGroup();\r
- int sz;\r
- msa = new SequenceI[sz = seqs.getSize()];\r
+ NewTreePanel("NJ", "PID", "Neighbour joining tree using PID");\r
+ }\r
\r
- for (int i = 0; i < sz; i++)\r
- {\r
- msa[i] = (SequenceI) seqs.getSequenceAt(i);\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void njTreeBlosumMenuItem_actionPerformed(ActionEvent e)\r
+ {\r
+ NewTreePanel("NJ", "BL", "Neighbour joining tree using BLOSUM62");\r
}\r
- else\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void avTreeBlosumMenuItem_actionPerformed(ActionEvent e)\r
{\r
- Vector seqs = viewport.getAlignment().getSequences();\r
+ NewTreePanel("AV", "BL", "Average distance tree using BLOSUM62");\r
+ }\r
\r
- if (seqs.size() > 1)\r
- {\r
- msa = new SequenceI[seqs.size()];\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param type DOCUMENT ME!\r
+ * @param pwType DOCUMENT ME!\r
+ * @param title DOCUMENT ME!\r
+ */\r
+ void NewTreePanel(String type, String pwType, String title)\r
+ {\r
+ final TreePanel tp;\r
\r
- for (int i = 0; i < seqs.size(); i++)\r
+ if ((viewport.getSelectionGroup() != null) &&\r
+ (viewport.getSelectionGroup().getSize() > 3))\r
{\r
- msa[i] = (SequenceI) seqs.elementAt(i);\r
+ int s = 0;\r
+ SequenceGroup sg = viewport.getSelectionGroup();\r
+\r
+ /* Decide if the selection is a column region */\r
+ while (s < sg.sequences.size())\r
+ {\r
+ if (((SequenceI) sg.sequences.elementAt(s++)).getLength() < sg.getEndRes())\r
+ {\r
+ JOptionPane.showMessageDialog(Desktop.desktop,\r
+ "The selected region to create a tree may\nonly contain residues or gaps.\n" +\r
+ "Try using the Pad function in the edit menu,\n" +\r
+ "or one of the multiple sequence alignment web services.",\r
+ "Sequences in selection are not aligned",\r
+ JOptionPane.WARNING_MESSAGE);\r
+\r
+ return;\r
+ }\r
+ }\r
+\r
+ title = title + " on region";\r
+ tp = new TreePanel(viewport,\r
+ viewport.getSelectionGroup().sequences, type, pwType,\r
+ sg.getStartRes(), sg.getEndRes());\r
}\r
- }\r
+ else\r
+ {\r
+ //are the sequences aligned?\r
+ if (!viewport.alignment.isAligned())\r
+ {\r
+ JOptionPane.showMessageDialog(Desktop.desktop,\r
+ "The sequences must be aligned before creating a tree.\n" +\r
+ "Try using the Pad function in the edit menu,\n" +\r
+ "or one of the multiple sequence alignment web services.",\r
+ "Sequences not aligned", JOptionPane.WARNING_MESSAGE);\r
+\r
+ return;\r
+ }\r
+\r
+ tp = new TreePanel(viewport,\r
+ viewport.getAlignment().getSequences(), type, pwType, 0,\r
+ viewport.alignment.getWidth());\r
+ }\r
+\r
+ addTreeMenuItem(tp, title);\r
+ viewport.setCurrentTree(tp.getTree());\r
+\r
+ Desktop.addInternalFrame(tp, title + " from " + this.title, 600, 500);\r
}\r
\r
- if (msa != null)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param title DOCUMENT ME!\r
+ * @param order DOCUMENT ME!\r
+ */\r
+ public void addSortByOrderMenuItem(String title, final AlignmentOrder order)\r
{\r
- jalview.ws.MsaWSClient ct = new jalview.ws.MsaWSClient("ClustalWS",\r
- title, msa, true, true);\r
- }\r
- }\r
+ final JMenuItem item = new JMenuItem("by " + title);\r
+ sort.add(item);\r
+ item.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ addHistoryItem(new HistoryItem("Sort", viewport.alignment,\r
+ HistoryItem.SORT));\r
\r
- protected void jpred_actionPerformed(ActionEvent e)\r
- {\r
- SequenceI seq = null;\r
- SequenceI[] msa = null;\r
+ // TODO: JBPNote - have to map order entries to curent SequenceI pointers\r
+ AlignmentSorter.sortBy(viewport.getAlignment(), order);\r
+ alignPanel.repaint();\r
+ }\r
+ });\r
+ }\r
\r
- if ( (viewport.getSelectionGroup() != null) &&\r
- (viewport.getSelectionGroup().getSize() > 0))\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param treePanel DOCUMENT ME!\r
+ * @param title DOCUMENT ME!\r
+ */\r
+ void addTreeMenuItem(final TreePanel treePanel, String title)\r
{\r
- // JBPNote UGLY! To prettify, make SequenceGroup and Alignment conform to some common interface!\r
- SequenceGroup seqs = viewport.getSelectionGroup();\r
+ final JMenuItem item = new JMenuItem(title);\r
\r
- if ( (seqs.getSize() == 1) || !viewport.alignment.isAligned())\r
- {\r
- seq = (SequenceI) seqs.getSequenceAt(0);\r
- }\r
- else\r
- {\r
- int sz;\r
- msa = new SequenceI[sz = seqs.getSize()];\r
+ treeCount++;\r
\r
- for (int i = 0; i < sz; i++)\r
+ if (treeCount == 1)\r
{\r
- msa[i] = (SequenceI) seqs.getSequenceAt(i);\r
+ sort.add(sortByTreeMenu);\r
}\r
- }\r
- }\r
- else\r
- {\r
- Vector seqs = viewport.getAlignment().getSequences();\r
\r
- if ( (seqs.size() == 1) || !viewport.alignment.isAligned())\r
- {\r
- seq = (SequenceI) seqs.elementAt(0);\r
- }\r
- else\r
- {\r
- msa = new SequenceI[seqs.size()];\r
+ sortByTreeMenu.add(item);\r
+ item.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ addHistoryItem(new HistoryItem("Tree Sort",\r
+ viewport.alignment, HistoryItem.SORT));\r
+ AlignmentSorter.sortByTree(viewport.getAlignment(),\r
+ treePanel.getTree());\r
+ alignPanel.repaint();\r
+ }\r
+ });\r
+\r
+ treePanel.addInternalFrameListener(new javax.swing.event.InternalFrameAdapter()\r
+ {\r
+ public void internalFrameClosed(\r
+ javax.swing.event.InternalFrameEvent evt)\r
+ {\r
+ treeCount--;\r
+ sortByTreeMenu.remove(item);\r
+\r
+ if (treeCount == 0)\r
+ {\r
+ sort.remove(sortByTreeMenu);\r
+ }\r
+ }\r
+ ;\r
+ });\r
+ viewport.addPropertyChangeListener(new java.beans.PropertyChangeListener()\r
+ {\r
+ public void propertyChange(PropertyChangeEvent evt)\r
+ {\r
+ if (evt.getPropertyName().equals("alignment"))\r
+ {\r
+ treePanel.getTree().UpdatePlaceHolders((Vector) evt.getNewValue());\r
+ treePanel.repaint();\r
+ }\r
+ }\r
+ });\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void clustalAlignMenuItem_actionPerformed(ActionEvent e)\r
+ {\r
+ // TODO:resolve which menu item was actually selected\r
+ // Now, check we have enough sequences\r
+ SequenceI[] msa = null;\r
+\r
+ if ((viewport.getSelectionGroup() != null) &&\r
+ (viewport.getSelectionGroup().getSize() > 1))\r
+ {\r
+ // JBPNote UGLY! To prettify, make SequenceGroup and Alignment conform to some common interface!\r
+ SequenceGroup seqs = viewport.getSelectionGroup();\r
+ int sz;\r
+ msa = new SequenceI[sz = seqs.getSize()];\r
+\r
+ for (int i = 0; i < sz; i++)\r
+ {\r
+ msa[i] = (SequenceI) seqs.getSequenceAt(i);\r
+ }\r
+ }\r
+ else\r
+ {\r
+ Vector seqs = viewport.getAlignment().getSequences();\r
\r
- for (int i = 0; i < seqs.size(); i++)\r
+ if (seqs.size() > 1)\r
+ {\r
+ msa = new SequenceI[seqs.size()];\r
+\r
+ for (int i = 0; i < seqs.size(); i++)\r
+ {\r
+ msa[i] = (SequenceI) seqs.elementAt(i);\r
+ }\r
+ }\r
+ }\r
+\r
+ if (msa != null)\r
{\r
- msa[i] = (SequenceI) seqs.elementAt(i);\r
+ jalview.ws.MsaWSClient ct = new jalview.ws.MsaWSClient("ClustalWS",\r
+ title, msa, false, true);\r
}\r
- }\r
}\r
\r
- if (msa != null)\r
- {\r
- JPredClient ct = new JPredClient(title, msa);\r
- }\r
- else if (seq != null)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void ClustalRealign_actionPerformed(ActionEvent e)\r
{\r
- JPredClient ct = new JPredClient(title, seq);\r
- }\r
- else\r
- {\r
- System.err.print(\r
- "JALVIEW ERROR! - Unexpected JPred selection state!\n");\r
- }\r
- }\r
+ // TODO:resolve which menu item was actually selected\r
+ // Now, check we have enough sequences\r
+ SequenceI[] msa = null;\r
+\r
+ if ((viewport.getSelectionGroup() != null) &&\r
+ (viewport.getSelectionGroup().getSize() > 1))\r
+ {\r
+ // JBPNote UGLY! To prettify, make SequenceGroup and Alignment conform to some common interface!\r
+ SequenceGroup seqs = viewport.getSelectionGroup();\r
+ int sz;\r
+ msa = new SequenceI[sz = seqs.getSize()];\r
+\r
+ for (int i = 0; i < sz; i++)\r
+ {\r
+ msa[i] = (SequenceI) seqs.getSequenceAt(i);\r
+ }\r
+ }\r
+ else\r
+ {\r
+ Vector seqs = viewport.getAlignment().getSequences();\r
\r
- protected void msaAlignMenuItem_actionPerformed(ActionEvent e)\r
- {\r
- // TODO:resolve which menu item was actually selected\r
- // Now, check we have enough sequences\r
- SequenceI[] msa = null;\r
+ if (seqs.size() > 1)\r
+ {\r
+ msa = new SequenceI[seqs.size()];\r
\r
- if ( (viewport.getSelectionGroup() != null) &&\r
- (viewport.getSelectionGroup().getSize() > 1))\r
- {\r
- // JBPNote UGLY! To prettify, make SequenceGroup and Alignment conform to some common interface!\r
- SequenceGroup seqs = viewport.getSelectionGroup();\r
- int sz;\r
- msa = new SequenceI[sz = seqs.getSize()];\r
+ for (int i = 0; i < seqs.size(); i++)\r
+ {\r
+ msa[i] = (SequenceI) seqs.elementAt(i);\r
+ }\r
+ }\r
+ }\r
\r
- for (int i = 0; i < sz; i++)\r
- {\r
- msa[i] = (SequenceI) seqs.getSequenceAt(i);\r
- }\r
+ if (msa != null)\r
+ {\r
+ jalview.ws.MsaWSClient ct = new jalview.ws.MsaWSClient("ClustalWS",\r
+ title, msa, true, true);\r
+ }\r
}\r
- else\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void jpred_actionPerformed(ActionEvent e)\r
{\r
- Vector seqs = viewport.getAlignment().getSequences();\r
+ SequenceI seq = null;\r
+ SequenceI[] msa = null;\r
\r
- if (seqs.size() > 1)\r
- {\r
- msa = new SequenceI[seqs.size()];\r
+ if ((viewport.getSelectionGroup() != null) &&\r
+ (viewport.getSelectionGroup().getSize() > 0))\r
+ {\r
+ // JBPNote UGLY! To prettify, make SequenceGroup and Alignment conform to some common interface!\r
+ SequenceGroup seqs = viewport.getSelectionGroup();\r
+\r
+ if ((seqs.getSize() == 1) || !viewport.alignment.isAligned())\r
+ {\r
+ seq = (SequenceI) seqs.getSequenceAt(0);\r
+ }\r
+ else\r
+ {\r
+ int sz;\r
+ msa = new SequenceI[sz = seqs.getSize()];\r
+\r
+ for (int i = 0; i < sz; i++)\r
+ {\r
+ msa[i] = (SequenceI) seqs.getSequenceAt(i);\r
+ }\r
+ }\r
+ }\r
+ else\r
+ {\r
+ Vector seqs = viewport.getAlignment().getSequences();\r
+\r
+ if ((seqs.size() == 1) || !viewport.alignment.isAligned())\r
+ {\r
+ seq = (SequenceI) seqs.elementAt(0);\r
+ }\r
+ else\r
+ {\r
+ msa = new SequenceI[seqs.size()];\r
+\r
+ for (int i = 0; i < seqs.size(); i++)\r
+ {\r
+ msa[i] = (SequenceI) seqs.elementAt(i);\r
+ }\r
+ }\r
+ }\r
\r
- for (int i = 0; i < seqs.size(); i++)\r
+ if (msa != null)\r
{\r
- msa[i] = (SequenceI) seqs.elementAt(i);\r
+ JPredClient ct = new JPredClient(title, msa);\r
+ }\r
+ else if (seq != null)\r
+ {\r
+ JPredClient ct = new JPredClient(title, seq);\r
+ }\r
+ else\r
+ {\r
+ System.err.print(\r
+ "JALVIEW ERROR! - Unexpected JPred selection state!\n");\r
}\r
- }\r
}\r
\r
- if (msa != null)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void msaAlignMenuItem_actionPerformed(ActionEvent e)\r
{\r
- MsaWSClient ct = new jalview.ws.MsaWSClient("MuscleWS", title, msa,\r
- false, true);\r
- }\r
- }\r
+ // TODO:resolve which menu item was actually selected\r
+ // Now, check we have enough sequences\r
+ SequenceI[] msa = null;\r
\r
- protected void LoadtreeMenuItem_actionPerformed(ActionEvent e)\r
- {\r
- // Pick the tree file\r
- JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.\r
- getProperty(\r
- "LAST_DIRECTORY"));\r
- chooser.setFileView(new JalviewFileView());\r
- chooser.setDialogTitle("Select a newick-like tree file");\r
- chooser.setToolTipText("Load a tree file");\r
+ if ((viewport.getSelectionGroup() != null) &&\r
+ (viewport.getSelectionGroup().getSize() > 1))\r
+ {\r
+ // JBPNote UGLY! To prettify, make SequenceGroup and Alignment conform to some common interface!\r
+ SequenceGroup seqs = viewport.getSelectionGroup();\r
+ int sz;\r
+ msa = new SequenceI[sz = seqs.getSize()];\r
+\r
+ for (int i = 0; i < sz; i++)\r
+ {\r
+ msa[i] = (SequenceI) seqs.getSequenceAt(i);\r
+ }\r
+ }\r
+ else\r
+ {\r
+ Vector seqs = viewport.getAlignment().getSequences();\r
\r
- int value = chooser.showOpenDialog(null);\r
+ if (seqs.size() > 1)\r
+ {\r
+ msa = new SequenceI[seqs.size()];\r
\r
- if (value == JalviewFileChooser.APPROVE_OPTION)\r
- {\r
- String choice = chooser.getSelectedFile().getPath();\r
- jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice);\r
+ for (int i = 0; i < seqs.size(); i++)\r
+ {\r
+ msa[i] = (SequenceI) seqs.elementAt(i);\r
+ }\r
+ }\r
+ }\r
\r
- try\r
- {\r
- jalview.io.NewickFile fin = new jalview.io.NewickFile(choice,\r
- "File");\r
- viewport.setCurrentTree( ShowNewickTree(fin, choice).getTree() );\r
- }\r
- catch (Exception ex)\r
- {\r
- JOptionPane.showMessageDialog(Desktop.desktop,\r
- "Problem reading tree file",\r
- ex.getMessage(),\r
- JOptionPane.WARNING_MESSAGE);\r
- ex.printStackTrace();\r
- }\r
+ if (msa != null)\r
+ {\r
+ MsaWSClient ct = new jalview.ws.MsaWSClient("MuscleWS", title, msa,\r
+ false, true);\r
+ }\r
}\r
- }\r
\r
- public TreePanel ShowNewickTree(NewickFile nf, String title)\r
- {\r
- TreePanel tp = null;\r
- try\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void LoadtreeMenuItem_actionPerformed(ActionEvent e)\r
{\r
- nf.parse();\r
- if (nf.getTree() != null)\r
- {\r
- tp = new TreePanel(viewport,\r
- viewport.getAlignment().getSequences(), nf,\r
- "FromFile",\r
- title);\r
- Desktop.addInternalFrame(tp, title, 600, 500);\r
- addTreeMenuItem(tp, title);\r
- }\r
- }\r
- catch (Exception ex)\r
- {\r
- ex.printStackTrace();\r
+ // Pick the tree file\r
+ JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.getProperty(\r
+ "LAST_DIRECTORY"));\r
+ chooser.setFileView(new JalviewFileView());\r
+ chooser.setDialogTitle("Select a newick-like tree file");\r
+ chooser.setToolTipText("Load a tree file");\r
+\r
+ int value = chooser.showOpenDialog(null);\r
+\r
+ if (value == JalviewFileChooser.APPROVE_OPTION)\r
+ {\r
+ String choice = chooser.getSelectedFile().getPath();\r
+ jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice);\r
+\r
+ try\r
+ {\r
+ jalview.io.NewickFile fin = new jalview.io.NewickFile(choice,\r
+ "File");\r
+ viewport.setCurrentTree(ShowNewickTree(fin, choice).getTree());\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ JOptionPane.showMessageDialog(Desktop.desktop,\r
+ "Problem reading tree file", ex.getMessage(),\r
+ JOptionPane.WARNING_MESSAGE);\r
+ ex.printStackTrace();\r
+ }\r
+ }\r
}\r
- return tp;\r
- }\r
\r
- class PrintThread\r
- extends Thread\r
- {\r
- public void run()\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param nf DOCUMENT ME!\r
+ * @param title DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public TreePanel ShowNewickTree(NewickFile nf, String title)\r
{\r
- PrinterJob printJob = PrinterJob.getPrinterJob();\r
- PageFormat pf = printJob.pageDialog(printJob.defaultPage());\r
- printJob.setPrintable(alignPanel, pf);\r
+ TreePanel tp = null;\r
\r
- if (printJob.printDialog())\r
- {\r
try\r
{\r
- printJob.print();\r
+ nf.parse();\r
+\r
+ if (nf.getTree() != null)\r
+ {\r
+ tp = new TreePanel(viewport,\r
+ viewport.getAlignment().getSequences(), nf, "FromFile",\r
+ title);\r
+ Desktop.addInternalFrame(tp, title, 600, 500);\r
+ addTreeMenuItem(tp, title);\r
+ }\r
}\r
- catch (Exception PrintException)\r
+ catch (Exception ex)\r
{\r
- PrintException.printStackTrace();\r
+ ex.printStackTrace();\r
+ }\r
+\r
+ return tp;\r
+ }\r
+\r
+ class PrintThread extends Thread\r
+ {\r
+ public void run()\r
+ {\r
+ PrinterJob printJob = PrinterJob.getPrinterJob();\r
+ PageFormat pf = printJob.pageDialog(printJob.defaultPage());\r
+ printJob.setPrintable(alignPanel, pf);\r
+\r
+ if (printJob.printDialog())\r
+ {\r
+ try\r
+ {\r
+ printJob.print();\r
+ }\r
+ catch (Exception PrintException)\r
+ {\r
+ PrintException.printStackTrace();\r
+ }\r
+ }\r
}\r
- }\r
}\r
- }\r
}\r
*/\r
package jalview.gui;\r
\r
-import java.util.*;\r
-\r
-import java.awt.*;\r
-\r
import jalview.analysis.*;\r
+\r
import jalview.bin.*;\r
+\r
import jalview.datamodel.*;\r
+\r
import jalview.schemes.*;\r
\r
+import java.awt.*;\r
+\r
+import java.util.*;\r
+\r
+\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
public class AlignViewport\r
{\r
- int startRes;\r
- int endRes;\r
- int startSeq;\r
- int endSeq;\r
- boolean showFullId = false;\r
- boolean showText = true;\r
- boolean showColourText = false;\r
- boolean showBoxes = true;\r
- boolean wrapAlignment = false;\r
- boolean renderGaps = true;\r
- boolean showSequenceFeatures = false;\r
- boolean showAnnotation = true;\r
- boolean showConservation = true;\r
- boolean showQuality = true;\r
- boolean showIdentity = true;\r
- boolean colourAppliesToAllGroups = true;\r
- ColourSchemeI globalColourScheme = null;\r
- boolean conservationColourSelected = false;\r
- boolean abovePIDThreshold = false;\r
- SequenceGroup selectionGroup = new SequenceGroup();\r
- int charHeight;\r
- int charWidth;\r
- int chunkWidth;\r
- int chunkHeight;\r
- Font font = new Font("SansSerif", Font.PLAIN, 10);\r
- AlignmentI alignment;\r
- ColumnSelection colSel = new ColumnSelection();\r
- int threshold;\r
- int increment;\r
- NJTree currentTree = null;\r
- boolean scaleAboveWrapped = false;\r
- boolean scaleLeftWrapped = true;\r
- boolean scaleRightWrapped = true;\r
- public Vector vconsensus;\r
- AlignmentAnnotation consensus;\r
- AlignmentAnnotation conservation;\r
- AlignmentAnnotation quality;\r
- public int ConsPercGaps = 25; // JBPNote : This should be a scalable property!\r
-\r
- // JBPNote Prolly only need this in the applet version.\r
- private java.beans.PropertyChangeSupport changeSupport = new java.beans.\r
- PropertyChangeSupport(this);\r
-\r
- public AlignViewport(AlignmentI al)\r
- {\r
- setAlignment(al);\r
- this.startRes = 0;\r
- this.endRes = al.getWidth() - 1;\r
- this.startSeq = 0;\r
- this.endSeq = al.getHeight() - 1;\r
-\r
- updateFromPreferences();\r
- }\r
-\r
- public void updateFromPreferences()\r
- {\r
- showFullId = Preferences.showFullId;\r
- showAnnotation = Preferences.showAnnotation;\r
- showConservation = Preferences.showConservation;\r
- showQuality = Preferences.showQuality;\r
- showIdentity = Preferences.showIdentity;\r
- showFullId = Preferences.showFullId;\r
-\r
- String fontName = Preferences.fontName;\r
- String fontStyle = Preferences.fontStyle;\r
- String fontSize = Cache.getProperty("FONT_SIZE");\r
-\r
- if ( (fontName != null) && (fontStyle != null) && (fontSize != null))\r
- {\r
- int style = 0;\r
-\r
- if (fontStyle.equals("bold"))\r
- {\r
- style = 1;\r
- }\r
- else if (fontStyle.equals("italic"))\r
- {\r
- style = 2;\r
- }\r
-\r
- setFont(new Font(fontName, style, Integer.parseInt(fontSize)));\r
- }\r
- else\r
- {\r
- setFont(font);\r
- }\r
-\r
- alignment.setGapCharacter(Preferences.gapSymbol);\r
-\r
- // We must set conservation and consensus before setting colour,\r
- // as Blosum and Clustal require this to be done\r
- updateConservation();\r
- updateConsensus();\r
-\r
- if (Preferences.defaultColour != null)\r
- {\r
- globalColourScheme = ColourSchemeProperty.getColour(alignment,\r
- Preferences.defaultColour);\r
-\r
- if (globalColourScheme instanceof UserColourScheme)\r
- {\r
- globalColourScheme = UserDefinedColours.loadDefaultColours();\r
- }\r
-\r
- if (globalColourScheme != null)\r
- {\r
- globalColourScheme.setConsensus(vconsensus);\r
- }\r
- }\r
- }\r
-\r
- public void showSequenceFeatures(boolean b)\r
- {\r
- showSequenceFeatures = b;\r
- }\r
-\r
- public void updateConservation()\r
- {\r
- Conservation cons = new jalview.analysis.Conservation("All",\r
- jalview.schemes.ResidueProperties.propHash, 3,\r
- alignment.getSequences(), 0, alignment.getWidth() - 1);\r
- cons.calculate();\r
- cons.verdict(false, ConsPercGaps);\r
- cons.findQuality();\r
-\r
- int alWidth = alignment.getWidth();\r
- Annotation[] annotations = new Annotation[alWidth];\r
- Annotation[] qannotations = new Annotation[alWidth];\r
- String sequence = cons.getConsSequence().getSequence();\r
- float minR;\r
- float minG;\r
- float minB;\r
- float maxR;\r
- float maxG;\r
- float maxB;\r
- minR = 0.3f;\r
- minG = 0.0f;\r
- minB = 0f;\r
- maxR = 1.0f - minR;\r
- maxG = 0.9f - minG;\r
- maxB = 0f - minB; // scalable range for colouring both Conservation and Quality\r
-\r
- float min = 0f;\r
- float max = 11f;\r
- float qmin = cons.qualityRange[0].floatValue();\r
- float qmax = cons.qualityRange[1].floatValue();\r
-\r
- for (int i = 0; i < alWidth; i++)\r
- {\r
- float value = 0;\r
-\r
- try\r
- {\r
- value = Integer.parseInt(sequence.charAt(i) + "");\r
- }\r
- catch (Exception ex)\r
- {\r
- if (sequence.charAt(i) == '*')\r
+ int startRes;\r
+ int endRes;\r
+ int startSeq;\r
+ int endSeq;\r
+ boolean showFullId = false;\r
+ boolean showText = true;\r
+ boolean showColourText = false;\r
+ boolean showBoxes = true;\r
+ boolean wrapAlignment = false;\r
+ boolean renderGaps = true;\r
+ boolean showSequenceFeatures = false;\r
+ boolean showAnnotation = true;\r
+ boolean showConservation = true;\r
+ boolean showQuality = true;\r
+ boolean showIdentity = true;\r
+ boolean colourAppliesToAllGroups = true;\r
+ ColourSchemeI globalColourScheme = null;\r
+ boolean conservationColourSelected = false;\r
+ boolean abovePIDThreshold = false;\r
+ SequenceGroup selectionGroup = new SequenceGroup();\r
+ int charHeight;\r
+ int charWidth;\r
+ int chunkWidth;\r
+ int chunkHeight;\r
+ Font font = new Font("SansSerif", Font.PLAIN, 10);\r
+ AlignmentI alignment;\r
+ ColumnSelection colSel = new ColumnSelection();\r
+ int threshold;\r
+ int increment;\r
+ NJTree currentTree = null;\r
+ boolean scaleAboveWrapped = false;\r
+ boolean scaleLeftWrapped = true;\r
+ boolean scaleRightWrapped = true;\r
+\r
+ /** DOCUMENT ME!! */\r
+ public Vector vconsensus;\r
+ AlignmentAnnotation consensus;\r
+ AlignmentAnnotation conservation;\r
+ AlignmentAnnotation quality;\r
+\r
+ /** DOCUMENT ME!! */\r
+ public int ConsPercGaps = 25; // JBPNote : This should be a scalable property!\r
+\r
+ // JBPNote Prolly only need this in the applet version.\r
+ private java.beans.PropertyChangeSupport changeSupport = new java.beans.PropertyChangeSupport(this);\r
+\r
+ /**\r
+ * Creates a new AlignViewport object.\r
+ *\r
+ * @param al DOCUMENT ME!\r
+ */\r
+ public AlignViewport(AlignmentI al)\r
+ {\r
+ setAlignment(al);\r
+ this.startRes = 0;\r
+ this.endRes = al.getWidth() - 1;\r
+ this.startSeq = 0;\r
+ this.endSeq = al.getHeight() - 1;\r
+\r
+ updateFromPreferences();\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ public void updateFromPreferences()\r
+ {\r
+ showFullId = Preferences.showFullId;\r
+ showAnnotation = Preferences.showAnnotation;\r
+ showConservation = Preferences.showConservation;\r
+ showQuality = Preferences.showQuality;\r
+ showIdentity = Preferences.showIdentity;\r
+ showFullId = Preferences.showFullId;\r
+\r
+ String fontName = Preferences.fontName;\r
+ String fontStyle = Preferences.fontStyle;\r
+ String fontSize = Cache.getProperty("FONT_SIZE");\r
+\r
+ if ((fontName != null) && (fontStyle != null) && (fontSize != null))\r
{\r
- value = 11;\r
+ int style = 0;\r
+\r
+ if (fontStyle.equals("bold"))\r
+ {\r
+ style = 1;\r
+ }\r
+ else if (fontStyle.equals("italic"))\r
+ {\r
+ style = 2;\r
+ }\r
+\r
+ setFont(new Font(fontName, style, Integer.parseInt(fontSize)));\r
}\r
+ else\r
+ {\r
+ setFont(font);\r
+ }\r
+\r
+ alignment.setGapCharacter(Preferences.gapSymbol);\r
\r
- if (sequence.charAt(i) == '+')\r
+ // We must set conservation and consensus before setting colour,\r
+ // as Blosum and Clustal require this to be done\r
+ updateConservation();\r
+ updateConsensus();\r
+\r
+ if (Preferences.defaultColour != null)\r
{\r
- value = 10;\r
+ globalColourScheme = ColourSchemeProperty.getColour(alignment,\r
+ Preferences.defaultColour);\r
+\r
+ if (globalColourScheme instanceof UserColourScheme)\r
+ {\r
+ globalColourScheme = UserDefinedColours.loadDefaultColours();\r
+ }\r
+\r
+ if (globalColourScheme != null)\r
+ {\r
+ globalColourScheme.setConsensus(vconsensus);\r
+ }\r
}\r
- }\r
+ }\r
\r
- float vprop = value - min;\r
- vprop /= max;\r
- annotations[i] = new Annotation(sequence.charAt(i) + "", String.valueOf(value), ' ',\r
- value,\r
- new Color(minR + (maxR * vprop),\r
- minG + (maxG * vprop),\r
- minB + (maxB * vprop)));\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param b DOCUMENT ME!\r
+ */\r
+ public void showSequenceFeatures(boolean b)\r
+ {\r
+ showSequenceFeatures = b;\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ public void updateConservation()\r
+ {\r
+ Conservation cons = new jalview.analysis.Conservation("All",\r
+ jalview.schemes.ResidueProperties.propHash, 3,\r
+ alignment.getSequences(), 0, alignment.getWidth() - 1);\r
+ cons.calculate();\r
+ cons.verdict(false, ConsPercGaps);\r
+ cons.findQuality();\r
+\r
+ int alWidth = alignment.getWidth();\r
+ Annotation[] annotations = new Annotation[alWidth];\r
+ Annotation[] qannotations = new Annotation[alWidth];\r
+ String sequence = cons.getConsSequence().getSequence();\r
+ float minR;\r
+ float minG;\r
+ float minB;\r
+ float maxR;\r
+ float maxG;\r
+ float maxB;\r
+ minR = 0.3f;\r
+ minG = 0.0f;\r
+ minB = 0f;\r
+ maxR = 1.0f - minR;\r
+ maxG = 0.9f - minG;\r
+ maxB = 0f - minB; // scalable range for colouring both Conservation and Quality\r
+\r
+ float min = 0f;\r
+ float max = 11f;\r
+ float qmin = cons.qualityRange[0].floatValue();\r
+ float qmax = cons.qualityRange[1].floatValue();\r
+\r
+ for (int i = 0; i < alWidth; i++)\r
+ {\r
+ float value = 0;\r
+\r
+ try\r
+ {\r
+ value = Integer.parseInt(sequence.charAt(i) + "");\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ if (sequence.charAt(i) == '*')\r
+ {\r
+ value = 11;\r
+ }\r
+\r
+ if (sequence.charAt(i) == '+')\r
+ {\r
+ value = 10;\r
+ }\r
+ }\r
+\r
+ float vprop = value - min;\r
+ vprop /= max;\r
+ annotations[i] = new Annotation(sequence.charAt(i) + "",\r
+ String.valueOf(value), ' ', value,\r
+ new Color(minR + (maxR * vprop), minG + (maxG * vprop),\r
+ minB + (maxB * vprop)));\r
+\r
+ // Quality calc\r
+ value = ((Double) cons.quality.get(i)).floatValue();\r
+ vprop = value - qmin;\r
+ vprop /= qmax;\r
+ qannotations[i] = new Annotation(" ", String.valueOf(value), ' ',\r
+ value,\r
+ new Color(minR + (maxR * vprop), minG + (maxG * vprop),\r
+ minB + (maxB * vprop)));\r
+ }\r
\r
- // Quality calc\r
- value = ( (Double) cons.quality.get(i)).floatValue();\r
- vprop = value - qmin;\r
- vprop /= qmax;\r
- qannotations[i] = new Annotation(" ", String.valueOf(value), ' ',\r
- value,\r
- new Color(minR + (maxR * vprop),\r
- minG + (maxG * vprop),\r
- minB + (maxB * vprop)));\r
+ if (conservation == null)\r
+ {\r
+ conservation = new AlignmentAnnotation("Conservation",\r
+ "Conservation of total alignment less than " +\r
+ ConsPercGaps + "% gaps", annotations, 0f, // cons.qualityRange[0].floatValue(),\r
+ 11f, // cons.qualityRange[1].floatValue()\r
+ 1);\r
+\r
+ if (showConservation)\r
+ {\r
+ alignment.addAnnotation(conservation);\r
+ }\r
+\r
+ quality = new AlignmentAnnotation("Quality",\r
+ "Alignment Quality based on Blosum62 scores", qannotations,\r
+ cons.qualityRange[0].floatValue(),\r
+ cons.qualityRange[1].floatValue(), 1);\r
+\r
+ if (showQuality)\r
+ {\r
+ alignment.addAnnotation(quality);\r
+ }\r
+ }\r
+ else\r
+ {\r
+ conservation.annotations = annotations;\r
+ quality.annotations = qannotations;\r
+ quality.graphMax = cons.qualityRange[1].floatValue();\r
+ }\r
}\r
\r
- if (conservation == null)\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ public void updateConsensus()\r
{\r
- conservation = new AlignmentAnnotation("Conservation",\r
- "Conservation of total alignment less than " +\r
- ConsPercGaps + "% gaps",\r
- annotations, 0f, // cons.qualityRange[0].floatValue(),\r
- 11f, // cons.qualityRange[1].floatValue()\r
- 1);\r
+ Annotation[] annotations = new Annotation[alignment.getWidth()];\r
+\r
+ // this routine prevents vconsensus becoming a new object each time\r
+ // consenus is calculated. Important for speed of Blosum62\r
+ // and PID colouring of alignment\r
+ if (vconsensus == null)\r
+ {\r
+ vconsensus = alignment.getAAFrequency();\r
+ }\r
+ else\r
+ {\r
+ Vector temp = alignment.getAAFrequency();\r
+ vconsensus.clear();\r
+\r
+ Enumeration e = temp.elements();\r
+\r
+ while (e.hasMoreElements())\r
+ {\r
+ vconsensus.add(e.nextElement());\r
+ }\r
+ }\r
+\r
+ Hashtable hash = null;\r
+\r
+ for (int i = 0; i < alignment.getWidth(); i++)\r
+ {\r
+ hash = (Hashtable) vconsensus.elementAt(i);\r
+\r
+ float value = Float.parseFloat(hash.get("maxCount").toString());\r
+ value /= Float.parseFloat(hash.get("size").toString());\r
+\r
+ value *= 100;\r
+\r
+ String maxRes = hash.get("maxResidue") + " ";\r
+ String mouseOver = hash.get("maxResidue") + " ";\r
+\r
+ if (maxRes.length() > 2)\r
+ {\r
+ mouseOver = "[" + maxRes + "] ";\r
+ maxRes = "+ ";\r
+ }\r
+\r
+ mouseOver += ((int) value + "%");\r
+ annotations[i] = new Annotation(maxRes, mouseOver, ' ', value);\r
+ }\r
\r
- if (showConservation)\r
- {\r
- alignment.addAnnotation(conservation);\r
- }\r
+ if (consensus == null)\r
+ {\r
+ consensus = new AlignmentAnnotation("Consensus", "PID",\r
+ annotations, 0f, 100f, 1);\r
\r
- quality = new AlignmentAnnotation("Quality",\r
- "Alignment Quality based on Blosum62 scores",\r
- qannotations,\r
- cons.qualityRange[0].floatValue(),\r
- cons.qualityRange[1].floatValue(), 1);\r
+ if (showIdentity)\r
+ {\r
+ alignment.addAnnotation(consensus);\r
+ }\r
+ }\r
+ else\r
+ {\r
+ consensus.annotations = annotations;\r
+ }\r
+ }\r
\r
- if (showQuality)\r
- {\r
- alignment.addAnnotation(quality);\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public SequenceGroup getSelectionGroup()\r
+ {\r
+ return selectionGroup;\r
}\r
- else\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param sg DOCUMENT ME!\r
+ */\r
+ public void setSelectionGroup(SequenceGroup sg)\r
{\r
- conservation.annotations = annotations;\r
- quality.annotations = qannotations;\r
- quality.graphMax = cons.qualityRange[1].floatValue();\r
+ selectionGroup = sg;\r
}\r
- }\r
\r
- public void updateConsensus()\r
- {\r
- Annotation[] annotations = new Annotation[alignment.getWidth()];\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public boolean getConservationSelected()\r
+ {\r
+ return conservationColourSelected;\r
+ }\r
\r
- // this routine prevents vconsensus becoming a new object each time\r
- // consenus is calculated. Important for speed of Blosum62\r
- // and PID colouring of alignment\r
- if (vconsensus == null)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param b DOCUMENT ME!\r
+ */\r
+ public void setConservationSelected(boolean b)\r
{\r
- vconsensus = alignment.getAAFrequency();\r
+ conservationColourSelected = b;\r
}\r
- else\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public boolean getAbovePIDThreshold()\r
{\r
- Vector temp = alignment.getAAFrequency();\r
- vconsensus.clear();\r
+ return abovePIDThreshold;\r
+ }\r
\r
- Enumeration e = temp.elements();\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param b DOCUMENT ME!\r
+ */\r
+ public void setAbovePIDThreshold(boolean b)\r
+ {\r
+ abovePIDThreshold = b;\r
+ }\r
\r
- while (e.hasMoreElements())\r
- {\r
- vconsensus.add(e.nextElement());\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public int getStartRes()\r
+ {\r
+ return startRes;\r
}\r
\r
- Hashtable hash = null;\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public int getEndRes()\r
+ {\r
+ return endRes;\r
+ }\r
\r
- for (int i = 0; i < alignment.getWidth(); i++)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public int getStartSeq()\r
{\r
- hash = (Hashtable) vconsensus.elementAt(i);\r
+ return startSeq;\r
+ }\r
\r
- float value = Float.parseFloat(hash.get("maxCount").toString());\r
- value /= Float.parseFloat(hash.get("size").toString());\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param cs DOCUMENT ME!\r
+ */\r
+ public void setGlobalColourScheme(ColourSchemeI cs)\r
+ {\r
+ globalColourScheme = cs;\r
+ }\r
\r
- value *= 100;\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public ColourSchemeI getGlobalColourScheme()\r
+ {\r
+ return globalColourScheme;\r
+ }\r
\r
- String maxRes = hash.get("maxResidue") + " ";\r
- String mouseOver = hash.get("maxResidue") + " ";\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param res DOCUMENT ME!\r
+ */\r
+ public void setStartRes(int res)\r
+ {\r
+ this.startRes = res;\r
+ }\r
\r
- if (maxRes.length() > 2)\r
- {\r
- mouseOver = "[" + maxRes + "] ";\r
- maxRes = "+ ";\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param seq DOCUMENT ME!\r
+ */\r
+ public void setStartSeq(int seq)\r
+ {\r
+ this.startSeq = seq;\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param res DOCUMENT ME!\r
+ */\r
+ public void setEndRes(int res)\r
+ {\r
+ if (res > (alignment.getWidth() - 1))\r
+ {\r
+ // log.System.out.println(" Corrected res from " + res + " to maximum " + (alignment.getWidth()-1));\r
+ res = alignment.getWidth() - 1;\r
+ }\r
+\r
+ if (res < 0)\r
+ {\r
+ res = 0;\r
+ }\r
\r
- mouseOver += ( (int) value + "%");\r
- annotations[i] = new Annotation(maxRes, mouseOver, ' ', value);\r
+ this.endRes = res;\r
}\r
\r
- if (consensus == null)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param seq DOCUMENT ME!\r
+ */\r
+ public void setEndSeq(int seq)\r
{\r
- consensus = new AlignmentAnnotation("Consensus", "PID",\r
- annotations, 0f, 100f, 1);\r
+ if (seq > alignment.getHeight())\r
+ {\r
+ seq = alignment.getHeight();\r
+ }\r
+\r
+ if (seq < 0)\r
+ {\r
+ seq = 0;\r
+ }\r
\r
- if (showIdentity)\r
- {\r
- alignment.addAnnotation(consensus);\r
- }\r
+ this.endSeq = seq;\r
}\r
- else\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public int getEndSeq()\r
{\r
- consensus.annotations = annotations;\r
+ return endSeq;\r
}\r
- }\r
\r
- public SequenceGroup getSelectionGroup()\r
- {\r
- return selectionGroup;\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param f DOCUMENT ME!\r
+ */\r
+ public void setFont(Font f)\r
+ {\r
+ font = f;\r
+\r
+ javax.swing.JFrame temp = new javax.swing.JFrame();\r
+ temp.addNotify();\r
\r
- public void setSelectionGroup(SequenceGroup sg)\r
- {\r
- selectionGroup = sg;\r
- }\r
+ java.awt.FontMetrics fm = temp.getGraphics().getFontMetrics(font);\r
+ setCharHeight(fm.getHeight());\r
+ setCharWidth(fm.charWidth('M'));\r
+ }\r
\r
- public boolean getConservationSelected()\r
- {\r
- return conservationColourSelected;\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public Font getFont()\r
+ {\r
+ return font;\r
+ }\r
\r
- public void setConservationSelected(boolean b)\r
- {\r
- conservationColourSelected = b;\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param w DOCUMENT ME!\r
+ */\r
+ public void setCharWidth(int w)\r
+ {\r
+ this.charWidth = w;\r
+ }\r
\r
- public boolean getAbovePIDThreshold()\r
- {\r
- return abovePIDThreshold;\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public int getCharWidth()\r
+ {\r
+ return charWidth;\r
+ }\r
\r
- public void setAbovePIDThreshold(boolean b)\r
- {\r
- abovePIDThreshold = b;\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param h DOCUMENT ME!\r
+ */\r
+ public void setCharHeight(int h)\r
+ {\r
+ this.charHeight = h;\r
+ }\r
\r
- public int getStartRes()\r
- {\r
- return startRes;\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public int getCharHeight()\r
+ {\r
+ return charHeight;\r
+ }\r
\r
- public int getEndRes()\r
- {\r
- return endRes;\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param w DOCUMENT ME!\r
+ */\r
+ public void setChunkWidth(int w)\r
+ {\r
+ this.chunkWidth = w;\r
+ }\r
\r
- public int getStartSeq()\r
- {\r
- return startSeq;\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public int getChunkWidth()\r
+ {\r
+ return chunkWidth;\r
+ }\r
\r
- public void setGlobalColourScheme(ColourSchemeI cs)\r
- {\r
- globalColourScheme = cs;\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param h DOCUMENT ME!\r
+ */\r
+ public void setChunkHeight(int h)\r
+ {\r
+ this.chunkHeight = h;\r
+ }\r
\r
- public ColourSchemeI getGlobalColourScheme()\r
- {\r
- return globalColourScheme;\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public int getChunkHeight()\r
+ {\r
+ return chunkHeight;\r
+ }\r
\r
- public void setStartRes(int res)\r
- {\r
- this.startRes = res;\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public AlignmentI getAlignment()\r
+ {\r
+ return alignment;\r
+ }\r
\r
- public void setStartSeq(int seq)\r
- {\r
- this.startSeq = seq;\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param align DOCUMENT ME!\r
+ */\r
+ public void setAlignment(AlignmentI align)\r
+ {\r
+ this.alignment = align;\r
+ }\r
\r
- public void setEndRes(int res)\r
- {\r
- if (res > (alignment.getWidth() - 1))\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param state DOCUMENT ME!\r
+ */\r
+ public void setWrapAlignment(boolean state)\r
{\r
- // log.System.out.println(" Corrected res from " + res + " to maximum " + (alignment.getWidth()-1));\r
- res = alignment.getWidth() - 1;\r
+ wrapAlignment = state;\r
}\r
\r
- if (res < 0)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param state DOCUMENT ME!\r
+ */\r
+ public void setShowText(boolean state)\r
{\r
- res = 0;\r
+ showText = state;\r
}\r
\r
- this.endRes = res;\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param state DOCUMENT ME!\r
+ */\r
+ public void setRenderGaps(boolean state)\r
+ {\r
+ renderGaps = state;\r
+ }\r
\r
- public void setEndSeq(int seq)\r
- {\r
- if (seq > alignment.getHeight())\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public boolean getColourText()\r
{\r
- seq = alignment.getHeight();\r
+ return showColourText;\r
}\r
\r
- if (seq < 0)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param state DOCUMENT ME!\r
+ */\r
+ public void setColourText(boolean state)\r
{\r
- seq = 0;\r
+ showColourText = state;\r
}\r
\r
- this.endSeq = seq;\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param state DOCUMENT ME!\r
+ */\r
+ public void setShowBoxes(boolean state)\r
+ {\r
+ showBoxes = state;\r
+ }\r
\r
- public int getEndSeq()\r
- {\r
- return endSeq;\r
- }\r
-\r
- public void setFont(Font f)\r
- {\r
- font = f;\r
-\r
- javax.swing.JFrame temp = new javax.swing.JFrame();\r
- temp.addNotify();\r
-\r
- java.awt.FontMetrics fm = temp.getGraphics().getFontMetrics(font);\r
- setCharHeight(fm.getHeight());\r
- setCharWidth(fm.charWidth('M'));\r
- }\r
-\r
- public Font getFont()\r
- {\r
- return font;\r
- }\r
-\r
- public void setCharWidth(int w)\r
- {\r
- this.charWidth = w;\r
- }\r
-\r
- public int getCharWidth()\r
- {\r
- return charWidth;\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public boolean getWrapAlignment()\r
+ {\r
+ return wrapAlignment;\r
+ }\r
\r
- public void setCharHeight(int h)\r
- {\r
- this.charHeight = h;\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public boolean getShowText()\r
+ {\r
+ return showText;\r
+ }\r
\r
- public int getCharHeight()\r
- {\r
- return charHeight;\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public boolean getShowBoxes()\r
+ {\r
+ return showBoxes;\r
+ }\r
\r
- public void setChunkWidth(int w)\r
- {\r
- this.chunkWidth = w;\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public char getGapCharacter()\r
+ {\r
+ return getAlignment().getGapCharacter();\r
+ }\r
\r
- public int getChunkWidth()\r
- {\r
- return chunkWidth;\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param gap DOCUMENT ME!\r
+ */\r
+ public void setGapCharacter(char gap)\r
+ {\r
+ if (getAlignment() != null)\r
+ {\r
+ getAlignment().setGapCharacter(gap);\r
+ }\r
+ }\r
\r
- public void setChunkHeight(int h)\r
- {\r
- this.chunkHeight = h;\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param thresh DOCUMENT ME!\r
+ */\r
+ public void setThreshold(int thresh)\r
+ {\r
+ threshold = thresh;\r
+ }\r
\r
- public int getChunkHeight()\r
- {\r
- return chunkHeight;\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public int getThreshold()\r
+ {\r
+ return threshold;\r
+ }\r
\r
- public AlignmentI getAlignment()\r
- {\r
- return alignment;\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param inc DOCUMENT ME!\r
+ */\r
+ public void setIncrement(int inc)\r
+ {\r
+ increment = inc;\r
+ }\r
\r
- public void setAlignment(AlignmentI align)\r
- {\r
- this.alignment = align;\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public int getIncrement()\r
+ {\r
+ return increment;\r
+ }\r
\r
- public void setWrapAlignment(boolean state)\r
- {\r
- wrapAlignment = state;\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param y DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public int getIndex(int y)\r
+ {\r
+ int y1 = 0;\r
+ int starty = getStartSeq();\r
+ int endy = getEndSeq();\r
\r
- public void setShowText(boolean state)\r
- {\r
- showText = state;\r
- }\r
-\r
- public void setRenderGaps(boolean state)\r
- {\r
- renderGaps = state;\r
- }\r
-\r
- public boolean getColourText()\r
- {\r
- return showColourText;\r
- }\r
-\r
- public void setColourText(boolean state)\r
- {\r
- showColourText = state;\r
- }\r
-\r
- public void setShowBoxes(boolean state)\r
- {\r
- showBoxes = state;\r
- }\r
-\r
- public boolean getWrapAlignment()\r
- {\r
- return wrapAlignment;\r
- }\r
-\r
- public boolean getShowText()\r
- {\r
- return showText;\r
- }\r
-\r
- public boolean getShowBoxes()\r
- {\r
- return showBoxes;\r
- }\r
-\r
- public char getGapCharacter()\r
- {\r
- return getAlignment().getGapCharacter();\r
- }\r
-\r
- public void setGapCharacter(char gap)\r
- {\r
- if (getAlignment() != null)\r
- {\r
- getAlignment().setGapCharacter(gap);\r
- }\r
- }\r
-\r
- public void setThreshold(int thresh)\r
- {\r
- threshold = thresh;\r
- }\r
-\r
- public int getThreshold()\r
- {\r
- return threshold;\r
- }\r
-\r
- public void setIncrement(int inc)\r
- {\r
- increment = inc;\r
- }\r
-\r
- public int getIncrement()\r
- {\r
- return increment;\r
- }\r
-\r
- public int getIndex(int y)\r
- {\r
- int y1 = 0;\r
- int starty = getStartSeq();\r
- int endy = getEndSeq();\r
-\r
- for (int i = starty; i <= endy; i++)\r
- {\r
- if ( (i < alignment.getHeight()) &&\r
- (alignment.getSequenceAt(i) != null))\r
- {\r
- int y2 = y1 + getCharHeight();\r
-\r
- if ( (y >= y1) && (y <= y2))\r
+ for (int i = starty; i <= endy; i++)\r
{\r
- return i;\r
+ if ((i < alignment.getHeight()) &&\r
+ (alignment.getSequenceAt(i) != null))\r
+ {\r
+ int y2 = y1 + getCharHeight();\r
+\r
+ if ((y >= y1) && (y <= y2))\r
+ {\r
+ return i;\r
+ }\r
+\r
+ y1 = y2;\r
+ }\r
+ else\r
+ {\r
+ return -1;\r
+ }\r
}\r
\r
- y1 = y2;\r
- }\r
- else\r
- {\r
return -1;\r
- }\r
- }\r
-\r
- return -1;\r
- }\r
-\r
- public ColumnSelection getColumnSelection()\r
- {\r
- return colSel;\r
- }\r
-\r
- public void resetSeqLimits(int height)\r
- {\r
- setEndSeq(height / getCharHeight());\r
- }\r
-\r
- public void setCurrentTree(NJTree tree)\r
- {\r
- currentTree = tree;\r
- }\r
-\r
- public NJTree getCurrentTree()\r
- {\r
- return currentTree;\r
- }\r
-\r
- public void setColourAppliesToAllGroups(boolean b)\r
- {\r
- colourAppliesToAllGroups = b;\r
- }\r
-\r
- public boolean getColourAppliesToAllGroups()\r
- {\r
- return colourAppliesToAllGroups;\r
- }\r
-\r
- public boolean getShowFullId()\r
- {\r
- return showFullId;\r
- }\r
-\r
- public void setShowFullId(boolean b)\r
- {\r
- showFullId = b;\r
- }\r
-\r
- public boolean getShowAnnotation()\r
- {\r
- return showAnnotation;\r
- }\r
-\r
- public void setShowAnnotation(boolean b)\r
- {\r
- showAnnotation = b;\r
- }\r
-\r
- public boolean getScaleAboveWrapped()\r
- {\r
- return scaleAboveWrapped;\r
- }\r
-\r
- public boolean getScaleLeftWrapped()\r
- {\r
- return scaleLeftWrapped;\r
- }\r
-\r
- public boolean getScaleRightWrapped()\r
- {\r
- return scaleRightWrapped;\r
- }\r
-\r
- public void setScaleAboveWrapped(boolean b)\r
- {\r
- scaleAboveWrapped = b;\r
- }\r
-\r
- public void setScaleLeftWrapped(boolean b)\r
- {\r
- scaleLeftWrapped = b;\r
- }\r
-\r
- public void setScaleRightWrapped(boolean b)\r
- {\r
- scaleRightWrapped = b;\r
- }\r
-\r
- public void addPropertyChangeListener(\r
- java.beans.PropertyChangeListener listener)\r
- {\r
- changeSupport.addPropertyChangeListener(listener);\r
- }\r
-\r
- public void removePropertyChangeListener(\r
- java.beans.PropertyChangeListener listener)\r
- {\r
- changeSupport.removePropertyChangeListener(listener);\r
- }\r
-\r
- public void firePropertyChange(String prop, Object oldvalue, Object newvalue)\r
- {\r
- changeSupport.firePropertyChange(prop, oldvalue, newvalue);\r
- }\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public ColumnSelection getColumnSelection()\r
+ {\r
+ return colSel;\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param height DOCUMENT ME!\r
+ */\r
+ public void resetSeqLimits(int height)\r
+ {\r
+ setEndSeq(height / getCharHeight());\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param tree DOCUMENT ME!\r
+ */\r
+ public void setCurrentTree(NJTree tree)\r
+ {\r
+ currentTree = tree;\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public NJTree getCurrentTree()\r
+ {\r
+ return currentTree;\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param b DOCUMENT ME!\r
+ */\r
+ public void setColourAppliesToAllGroups(boolean b)\r
+ {\r
+ colourAppliesToAllGroups = b;\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public boolean getColourAppliesToAllGroups()\r
+ {\r
+ return colourAppliesToAllGroups;\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public boolean getShowFullId()\r
+ {\r
+ return showFullId;\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param b DOCUMENT ME!\r
+ */\r
+ public void setShowFullId(boolean b)\r
+ {\r
+ showFullId = b;\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public boolean getShowAnnotation()\r
+ {\r
+ return showAnnotation;\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param b DOCUMENT ME!\r
+ */\r
+ public void setShowAnnotation(boolean b)\r
+ {\r
+ showAnnotation = b;\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public boolean getScaleAboveWrapped()\r
+ {\r
+ return scaleAboveWrapped;\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public boolean getScaleLeftWrapped()\r
+ {\r
+ return scaleLeftWrapped;\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public boolean getScaleRightWrapped()\r
+ {\r
+ return scaleRightWrapped;\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param b DOCUMENT ME!\r
+ */\r
+ public void setScaleAboveWrapped(boolean b)\r
+ {\r
+ scaleAboveWrapped = b;\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param b DOCUMENT ME!\r
+ */\r
+ public void setScaleLeftWrapped(boolean b)\r
+ {\r
+ scaleLeftWrapped = b;\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param b DOCUMENT ME!\r
+ */\r
+ public void setScaleRightWrapped(boolean b)\r
+ {\r
+ scaleRightWrapped = b;\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param listener DOCUMENT ME!\r
+ */\r
+ public void addPropertyChangeListener(\r
+ java.beans.PropertyChangeListener listener)\r
+ {\r
+ changeSupport.addPropertyChangeListener(listener);\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param listener DOCUMENT ME!\r
+ */\r
+ public void removePropertyChangeListener(\r
+ java.beans.PropertyChangeListener listener)\r
+ {\r
+ changeSupport.removePropertyChangeListener(listener);\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param prop DOCUMENT ME!\r
+ * @param oldvalue DOCUMENT ME!\r
+ * @param newvalue DOCUMENT ME!\r
+ */\r
+ public void firePropertyChange(String prop, Object oldvalue, Object newvalue)\r
+ {\r
+ changeSupport.firePropertyChange(prop, oldvalue, newvalue);\r
+ }\r
}\r
*/\r
package jalview.gui;\r
\r
-import java.io.*;\r
-import javax.imageio.*;\r
+import jalview.analysis.*;\r
+\r
+import jalview.datamodel.*;\r
+\r
+import jalview.jbgui.*;\r
+\r
+import jalview.schemes.*;\r
+\r
+import org.jibble.epsgraphics.*;\r
\r
import java.awt.*;\r
import java.awt.event.*;\r
import java.awt.image.*;\r
import java.awt.print.*;\r
+\r
+import java.io.*;\r
+\r
+import javax.imageio.*;\r
+\r
import javax.swing.*;\r
\r
-import org.jibble.epsgraphics.*;\r
-import jalview.analysis.*;\r
-import jalview.datamodel.*;\r
-import jalview.jbgui.*;\r
-import jalview.schemes.*;\r
\r
-public class AlignmentPanel\r
- extends GAlignmentPanel implements AdjustmentListener, Printable\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class AlignmentPanel extends GAlignmentPanel\r
+ implements AdjustmentListener, Printable\r
{\r
- AlignViewport av;\r
- OverviewPanel overviewPanel;\r
- SeqPanel seqPanel;\r
- IdPanel idPanel;\r
- IdwidthAdjuster idwidthAdjuster;\r
- public AlignFrame alignFrame;\r
- ScalePanel scalePanel;\r
- AnnotationPanel annotationPanel;\r
- AnnotationLabels alabels;\r
-\r
- // this value is set false when selection area being dragged\r
- boolean fastPaint = true;\r
- int hextent = 0;\r
- int vextent = 0;\r
-\r
- public AlignmentPanel(AlignFrame af, final AlignViewport av)\r
- {\r
- alignFrame = af;\r
- this.av = av;\r
- seqPanel = new SeqPanel(av, this);\r
- idPanel = new IdPanel(av, this);\r
-\r
- scalePanel = new ScalePanel(av, this);\r
-\r
- idPanelHolder.add(idPanel, BorderLayout.CENTER);\r
- idwidthAdjuster = new IdwidthAdjuster(this);\r
- idSpaceFillerPanel1.add(idwidthAdjuster, BorderLayout.CENTER);\r
-\r
- annotationPanel = new AnnotationPanel(this);\r
- alabels = new AnnotationLabels(this);\r
-\r
- annotationSpaceFillerHolder.setPreferredSize(annotationPanel.\r
- getPreferredSize());\r
- annotationScroller.setPreferredSize(annotationPanel.getPreferredSize());\r
- annotationScroller.setViewportView(annotationPanel);\r
- annotationSpaceFillerHolder.add(alabels, BorderLayout.CENTER);\r
-\r
- fontChanged();\r
-\r
- scalePanelHolder.add(scalePanel, BorderLayout.CENTER);\r
- seqPanelHolder.add(seqPanel, BorderLayout.CENTER);\r
-\r
- setScrollValues(0, 0);\r
-\r
- hscroll.addAdjustmentListener(this);\r
- vscroll.addAdjustmentListener(this);\r
-\r
- setFocusable(true);\r
- addKeyListener(new KeyAdapter()\r
+ AlignViewport av;\r
+ OverviewPanel overviewPanel;\r
+ SeqPanel seqPanel;\r
+ IdPanel idPanel;\r
+ IdwidthAdjuster idwidthAdjuster;\r
+\r
+ /** DOCUMENT ME!! */\r
+ public AlignFrame alignFrame;\r
+ ScalePanel scalePanel;\r
+ AnnotationPanel annotationPanel;\r
+ AnnotationLabels alabels;\r
+\r
+ // this value is set false when selection area being dragged\r
+ boolean fastPaint = true;\r
+ int hextent = 0;\r
+ int vextent = 0;\r
+\r
+ /**\r
+ * Creates a new AlignmentPanel object.\r
+ *\r
+ * @param af DOCUMENT ME!\r
+ * @param av DOCUMENT ME!\r
+ */\r
+ public AlignmentPanel(AlignFrame af, final AlignViewport av)\r
{\r
- public void keyPressed(KeyEvent evt)\r
- {\r
- switch (evt.getKeyCode())\r
- {\r
- case 27: // escape key\r
- av.setSelectionGroup(null);\r
- repaint();\r
+ alignFrame = af;\r
+ this.av = av;\r
+ seqPanel = new SeqPanel(av, this);\r
+ idPanel = new IdPanel(av, this);\r
\r
- break;\r
+ scalePanel = new ScalePanel(av, this);\r
\r
- case KeyEvent.VK_DOWN:\r
- alignFrame.moveSelectedSequences(false);\r
+ idPanelHolder.add(idPanel, BorderLayout.CENTER);\r
+ idwidthAdjuster = new IdwidthAdjuster(this);\r
+ idSpaceFillerPanel1.add(idwidthAdjuster, BorderLayout.CENTER);\r
\r
- break;\r
+ annotationPanel = new AnnotationPanel(this);\r
+ alabels = new AnnotationLabels(this);\r
\r
- case KeyEvent.VK_UP:\r
- alignFrame.moveSelectedSequences(true);\r
+ annotationSpaceFillerHolder.setPreferredSize(annotationPanel.getPreferredSize());\r
+ annotationScroller.setPreferredSize(annotationPanel.getPreferredSize());\r
+ annotationScroller.setViewportView(annotationPanel);\r
+ annotationSpaceFillerHolder.add(alabels, BorderLayout.CENTER);\r
\r
- break;\r
- }\r
- }\r
- });\r
- }\r
-\r
- public void fontChanged()\r
- {\r
- // set idCanvas bufferedImage to null\r
- // to prevent drawing old image\r
- FontMetrics fm = getFontMetrics(av.getFont());\r
-\r
- scalePanelHolder.setPreferredSize(new Dimension(10,\r
- av.charHeight + fm.getDescent()));\r
- idSpaceFillerPanel1.setPreferredSize(new Dimension(10,\r
- av.charHeight + fm.getDescent()));\r
-\r
- idPanel.idCanvas.gg = null;\r
- annotationPanel.adjustPanelHeight();\r
-\r
- Dimension d = calculateIdWidth();\r
- d.setSize(d.width + 4, d.height);\r
- idPanel.idCanvas.setPreferredSize(d);\r
- hscrollFillerPanel.setPreferredSize(d);\r
- repaint();\r
- }\r
-\r
- Dimension calculateIdWidth()\r
- {\r
- Graphics g = this.getGraphics();\r
-\r
- if (g == null)\r
- {\r
- javax.swing.JFrame f = new javax.swing.JFrame();\r
- f.addNotify();\r
- g = f.getGraphics();\r
- }\r
+ fontChanged();\r
\r
- FontMetrics fm = g.getFontMetrics(av.font);\r
- AlignmentI al = av.getAlignment();\r
+ scalePanelHolder.add(scalePanel, BorderLayout.CENTER);\r
+ seqPanelHolder.add(seqPanel, BorderLayout.CENTER);\r
\r
- int i = 0;\r
- int idWidth = 0;\r
- String id;\r
+ setScrollValues(0, 0);\r
\r
- while ( (i < al.getHeight()) && (al.getSequenceAt(i) != null))\r
- {\r
- SequenceI s = al.getSequenceAt(i);\r
+ hscroll.addAdjustmentListener(this);\r
+ vscroll.addAdjustmentListener(this);\r
\r
- if (av.getShowFullId())\r
- {\r
- id = s.getDisplayId();\r
- }\r
- else\r
- {\r
- id = s.getName();\r
- }\r
+ setFocusable(true);\r
+ addKeyListener(new KeyAdapter()\r
+ {\r
+ public void keyPressed(KeyEvent evt)\r
+ {\r
+ switch (evt.getKeyCode())\r
+ {\r
+ case 27: // escape key\r
+ av.setSelectionGroup(null);\r
+ repaint();\r
\r
- if (fm.stringWidth(id) > idWidth)\r
- {\r
- idWidth = fm.stringWidth(id);\r
- }\r
+ break;\r
+\r
+ case KeyEvent.VK_DOWN:\r
+ alignFrame.moveSelectedSequences(false);\r
\r
- i++;\r
+ break;\r
+\r
+ case KeyEvent.VK_UP:\r
+ alignFrame.moveSelectedSequences(true);\r
+\r
+ break;\r
+ }\r
+ }\r
+ });\r
}\r
\r
- // Also check annotation label widths\r
- i = 0;\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ public void fontChanged()\r
+ {\r
+ // set idCanvas bufferedImage to null\r
+ // to prevent drawing old image\r
+ FontMetrics fm = getFontMetrics(av.getFont());\r
+\r
+ scalePanelHolder.setPreferredSize(new Dimension(10,\r
+ av.charHeight + fm.getDescent()));\r
+ idSpaceFillerPanel1.setPreferredSize(new Dimension(10,\r
+ av.charHeight + fm.getDescent()));\r
+\r
+ idPanel.idCanvas.gg = null;\r
+ annotationPanel.adjustPanelHeight();\r
+\r
+ Dimension d = calculateIdWidth();\r
+ d.setSize(d.width + 4, d.height);\r
+ idPanel.idCanvas.setPreferredSize(d);\r
+ hscrollFillerPanel.setPreferredSize(d);\r
+ repaint();\r
+ }\r
\r
- if (al.getAlignmentAnnotation() != null)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public Dimension calculateIdWidth()\r
{\r
- fm = g.getFontMetrics(alabels.getFont());\r
+ Graphics g = this.getGraphics();\r
\r
- while (i < al.getAlignmentAnnotation().length)\r
- {\r
- String label = al.getAlignmentAnnotation()[i].label;\r
+ if (g == null)\r
+ {\r
+ javax.swing.JFrame f = new javax.swing.JFrame();\r
+ f.addNotify();\r
+ g = f.getGraphics();\r
+ }\r
+\r
+ FontMetrics fm = g.getFontMetrics(av.font);\r
+ AlignmentI al = av.getAlignment();\r
\r
- if (fm.stringWidth(label) > idWidth)\r
+ int i = 0;\r
+ int idWidth = 0;\r
+ String id;\r
+\r
+ while ((i < al.getHeight()) && (al.getSequenceAt(i) != null))\r
{\r
- idWidth = fm.stringWidth(label);\r
+ SequenceI s = al.getSequenceAt(i);\r
+\r
+ if (av.getShowFullId())\r
+ {\r
+ id = s.getDisplayId();\r
+ }\r
+ else\r
+ {\r
+ id = s.getName();\r
+ }\r
+\r
+ if (fm.stringWidth(id) > idWidth)\r
+ {\r
+ idWidth = fm.stringWidth(id);\r
+ }\r
+\r
+ i++;\r
}\r
\r
- i++;\r
- }\r
- }\r
+ // Also check annotation label widths\r
+ i = 0;\r
\r
- return new Dimension(idWidth, 12);\r
- }\r
+ if (al.getAlignmentAnnotation() != null)\r
+ {\r
+ fm = g.getFontMetrics(alabels.getFont());\r
\r
- public void highlightSearchResults(int[] results)\r
- {\r
- seqPanel.seqCanvas.highlightSearchResults(results);\r
+ while (i < al.getAlignmentAnnotation().length)\r
+ {\r
+ String label = al.getAlignmentAnnotation()[i].label;\r
\r
- // do we need to scroll the panel?\r
- if (results != null)\r
- {\r
- SequenceI seq = av.alignment.getSequenceAt(results[0]);\r
- int start = seq.findIndex(results[1]) - 1;\r
- int end = seq.findIndex(results[2]) - 1;\r
+ if (fm.stringWidth(label) > idWidth)\r
+ {\r
+ idWidth = fm.stringWidth(label);\r
+ }\r
\r
- if ( (av.getStartRes() > start) || (av.getEndRes() < end) ||\r
- ( (av.getStartSeq() > results[0]) ||\r
- (av.getEndSeq() < results[0])))\r
- {\r
- setScrollValues(start, results[0]);\r
- }\r
+ i++;\r
+ }\r
+ }\r
+\r
+ return new Dimension(idWidth, 12);\r
}\r
- }\r
-\r
- public OverviewPanel getOverviewPanel()\r
- {\r
- return overviewPanel;\r
- }\r
-\r
- public void setOverviewPanel(OverviewPanel op)\r
- {\r
- overviewPanel = op;\r
- }\r
-\r
- public void setAnnotationVisible(boolean b)\r
- {\r
- annotationSpaceFillerHolder.setVisible(b);\r
- annotationScroller.setVisible(b);\r
- }\r
-\r
- public void setWrapAlignment(boolean wrap)\r
- {\r
- scalePanelHolder.setVisible(!wrap);\r
- hscroll.setVisible(!wrap);\r
- idwidthAdjuster.setVisible(!wrap);\r
-\r
- av.setShowAnnotation(!wrap);\r
- annotationScroller.setVisible(!wrap);\r
- annotationSpaceFillerHolder.setVisible(!wrap);\r
- idSpaceFillerPanel1.setVisible(!wrap);\r
-\r
- repaint();\r
- }\r
-\r
- public void setColourScheme()\r
- {\r
- ColourSchemeI cs = av.getGlobalColourScheme();\r
-\r
- if (av.getConservationSelected())\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param results DOCUMENT ME!\r
+ */\r
+ public void highlightSearchResults(int[] results)\r
{\r
- Alignment al = (Alignment) av.getAlignment();\r
- Conservation c = new Conservation("All",\r
- ResidueProperties.propHash, 3,\r
- al.getSequences(), 0,\r
- al.getWidth());\r
+ seqPanel.seqCanvas.highlightSearchResults(results);\r
\r
- c.calculate();\r
- c.verdict(false, av.ConsPercGaps);\r
+ // do we need to scroll the panel?\r
+ if (results != null)\r
+ {\r
+ SequenceI seq = av.alignment.getSequenceAt(results[0]);\r
+ int start = seq.findIndex(results[1]) - 1;\r
+ int end = seq.findIndex(results[2]) - 1;\r
+\r
+ if ((av.getStartRes() > start) || (av.getEndRes() < end) ||\r
+ ((av.getStartSeq() > results[0]) ||\r
+ (av.getEndSeq() < results[0])))\r
+ {\r
+ setScrollValues(start, results[0]);\r
+ }\r
+ }\r
+ }\r
\r
- ConservationColourScheme ccs = new ConservationColourScheme(c, cs);\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public OverviewPanel getOverviewPanel()\r
+ {\r
+ return overviewPanel;\r
+ }\r
\r
- av.setGlobalColourScheme(ccs);\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param op DOCUMENT ME!\r
+ */\r
+ public void setOverviewPanel(OverviewPanel op)\r
+ {\r
+ overviewPanel = op;\r
}\r
\r
- repaint();\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param b DOCUMENT ME!\r
+ */\r
+ public void setAnnotationVisible(boolean b)\r
+ {\r
+ annotationSpaceFillerHolder.setVisible(b);\r
+ annotationScroller.setVisible(b);\r
+ }\r
\r
- // return value is true if the scroll is valid\r
- public boolean scrollUp(boolean up)\r
- {\r
- if (up)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param wrap DOCUMENT ME!\r
+ */\r
+ public void setWrapAlignment(boolean wrap)\r
{\r
- if (vscroll.getValue() < 1)\r
- {\r
- return false;\r
- }\r
+ scalePanelHolder.setVisible(!wrap);\r
+ hscroll.setVisible(!wrap);\r
+ idwidthAdjuster.setVisible(!wrap);\r
\r
- fastPaint = false;\r
- vscroll.setValue(vscroll.getValue() - 1);\r
+ av.setShowAnnotation(!wrap);\r
+ annotationScroller.setVisible(!wrap);\r
+ annotationSpaceFillerHolder.setVisible(!wrap);\r
+ idSpaceFillerPanel1.setVisible(!wrap);\r
+\r
+ repaint();\r
}\r
- else\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ public void setColourScheme()\r
{\r
- if ( (vextent + vscroll.getValue()) >= av.getAlignment().getHeight())\r
- {\r
- return false;\r
- }\r
+ ColourSchemeI cs = av.getGlobalColourScheme();\r
\r
- fastPaint = false;\r
- vscroll.setValue(vscroll.getValue() + 1);\r
- }\r
+ if (av.getConservationSelected())\r
+ {\r
+ Alignment al = (Alignment) av.getAlignment();\r
+ Conservation c = new Conservation("All",\r
+ ResidueProperties.propHash, 3, al.getSequences(), 0,\r
+ al.getWidth());\r
\r
- fastPaint = true;\r
+ c.calculate();\r
+ c.verdict(false, av.ConsPercGaps);\r
\r
- return true;\r
- }\r
+ ConservationColourScheme ccs = new ConservationColourScheme(c, cs);\r
\r
- public boolean scrollRight(boolean right)\r
- {\r
- if (right)\r
- {\r
- if (hscroll.getValue() < 1)\r
- {\r
- return false;\r
- }\r
+ av.setGlobalColourScheme(ccs);\r
+ }\r
\r
- fastPaint = false;\r
- hscroll.setValue(hscroll.getValue() - 1);\r
+ repaint();\r
}\r
- else\r
+\r
+ // return value is true if the scroll is valid\r
+ public boolean scrollUp(boolean up)\r
{\r
- if ( (hextent + hscroll.getValue()) >= av.getAlignment().getWidth())\r
- {\r
- return false;\r
- }\r
+ if (up)\r
+ {\r
+ if (vscroll.getValue() < 1)\r
+ {\r
+ return false;\r
+ }\r
+\r
+ fastPaint = false;\r
+ vscroll.setValue(vscroll.getValue() - 1);\r
+ }\r
+ else\r
+ {\r
+ if ((vextent + vscroll.getValue()) >= av.getAlignment().getHeight())\r
+ {\r
+ return false;\r
+ }\r
\r
- fastPaint = false;\r
- hscroll.setValue(hscroll.getValue() + 1);\r
+ fastPaint = false;\r
+ vscroll.setValue(vscroll.getValue() + 1);\r
+ }\r
+\r
+ fastPaint = true;\r
+\r
+ return true;\r
}\r
\r
- fastPaint = true;\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param right DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public boolean scrollRight(boolean right)\r
+ {\r
+ if (right)\r
+ {\r
+ if (hscroll.getValue() < 1)\r
+ {\r
+ return false;\r
+ }\r
\r
- return true;\r
- }\r
+ fastPaint = false;\r
+ hscroll.setValue(hscroll.getValue() - 1);\r
+ }\r
+ else\r
+ {\r
+ if ((hextent + hscroll.getValue()) >= av.getAlignment().getWidth())\r
+ {\r
+ return false;\r
+ }\r
\r
- public void setScrollValues(int x, int y)\r
- {\r
- av.setEndRes( (x + (seqPanel.seqCanvas.getWidth() / av.getCharWidth())) -\r
- 1);\r
+ fastPaint = false;\r
+ hscroll.setValue(hscroll.getValue() + 1);\r
+ }\r
\r
- hextent = seqPanel.seqCanvas.getWidth() / av.charWidth;\r
- vextent = seqPanel.seqCanvas.getHeight() / av.charHeight;\r
+ fastPaint = true;\r
\r
- if (hextent > av.alignment.getWidth())\r
- {\r
- hextent = av.alignment.getWidth();\r
+ return true;\r
}\r
\r
- if (vextent > av.alignment.getHeight())\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param x DOCUMENT ME!\r
+ * @param y DOCUMENT ME!\r
+ */\r
+ public void setScrollValues(int x, int y)\r
{\r
- vextent = av.alignment.getHeight();\r
- }\r
+ av.setEndRes((x + (seqPanel.seqCanvas.getWidth() / av.getCharWidth())) -\r
+ 1);\r
\r
- if ( (hextent + x) > av.getAlignment().getWidth())\r
- {\r
- x = av.getAlignment().getWidth() - hextent;\r
- }\r
+ hextent = seqPanel.seqCanvas.getWidth() / av.charWidth;\r
+ vextent = seqPanel.seqCanvas.getHeight() / av.charHeight;\r
\r
- if ( (vextent + y) > av.getAlignment().getHeight())\r
- {\r
- y = av.getAlignment().getHeight() - vextent;\r
- }\r
+ if (hextent > av.alignment.getWidth())\r
+ {\r
+ hextent = av.alignment.getWidth();\r
+ }\r
\r
- if (y < 0)\r
- {\r
- y = 0;\r
- }\r
+ if (vextent > av.alignment.getHeight())\r
+ {\r
+ vextent = av.alignment.getHeight();\r
+ }\r
\r
- if (x < 0)\r
- {\r
- x = 0;\r
- }\r
+ if ((hextent + x) > av.getAlignment().getWidth())\r
+ {\r
+ x = av.getAlignment().getWidth() - hextent;\r
+ }\r
\r
- hscroll.setValues(x, hextent, 0, av.getAlignment().getWidth());\r
- vscroll.setValues(y, vextent, 0, av.getAlignment().getHeight());\r
- }\r
+ if ((vextent + y) > av.getAlignment().getHeight())\r
+ {\r
+ y = av.getAlignment().getHeight() - vextent;\r
+ }\r
\r
- public void adjustmentValueChanged(AdjustmentEvent evt)\r
- {\r
- int oldX = av.getStartRes();\r
- int oldY = av.getStartSeq();\r
+ if (y < 0)\r
+ {\r
+ y = 0;\r
+ }\r
\r
- if (evt.getSource() == hscroll)\r
- {\r
- int x = hscroll.getValue();\r
- av.setStartRes(x);\r
- av.setEndRes( (x +\r
- (seqPanel.seqCanvas.getWidth() / av.getCharWidth())) - 1);\r
+ if (x < 0)\r
+ {\r
+ x = 0;\r
+ }\r
+\r
+ hscroll.setValues(x, hextent, 0, av.getAlignment().getWidth());\r
+ vscroll.setValues(y, vextent, 0, av.getAlignment().getHeight());\r
}\r
\r
- if (evt.getSource() == vscroll)\r
+ public void this_mouseWheelMoved(MouseWheelEvent e)\r
{\r
- int offy = vscroll.getValue();\r
-\r
- if (av.getWrapAlignment())\r
- {\r
- int rowSize = seqPanel.seqCanvas.getWrappedCanvasWidth(seqPanel.\r
- seqCanvas.getWidth());\r
- av.setStartRes(vscroll.getValue() * rowSize);\r
- av.setEndRes( (vscroll.getValue() + 1) * rowSize);\r
- }\r
+ if(e.getWheelRotation()>0)\r
+ scrollUp(false);\r
else\r
- {\r
- av.setStartSeq(offy);\r
- av.setEndSeq(offy +\r
- (seqPanel.seqCanvas.getHeight() / av.getCharHeight()));\r
- }\r
+ scrollUp(true);\r
}\r
\r
- if (overviewPanel != null)\r
- {\r
- overviewPanel.setBoxPosition();\r
- }\r
\r
- if (av.getWrapAlignment() || !fastPaint)\r
- {\r
- repaint();\r
- }\r
- else\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ */\r
+ public void adjustmentValueChanged(AdjustmentEvent evt)\r
{\r
- idPanel.idCanvas.fastPaint(av.getStartSeq() - oldY);\r
- seqPanel.seqCanvas.fastPaint(av.getStartRes() - oldX,\r
- av.getStartSeq() - oldY);\r
+ int oldX = av.getStartRes();\r
+ int oldY = av.getStartSeq();\r
\r
- scalePanel.repaint();\r
+ if (evt.getSource() == hscroll)\r
+ {\r
+ int x = hscroll.getValue();\r
+ av.setStartRes(x);\r
+ av.setEndRes((x +\r
+ (seqPanel.seqCanvas.getWidth() / av.getCharWidth())) - 1);\r
+ }\r
\r
- if (av.getShowAnnotation())\r
- {\r
- annotationPanel.fastPaint(av.getStartRes() - oldX);\r
- }\r
- }\r
- }\r
+ if (evt.getSource() == vscroll)\r
+ {\r
+ int offy = vscroll.getValue();\r
+\r
+ if (av.getWrapAlignment())\r
+ {\r
+ int rowSize = seqPanel.seqCanvas.getWrappedCanvasWidth(seqPanel.seqCanvas.getWidth());\r
+ av.setStartRes(vscroll.getValue() * rowSize);\r
+ av.setEndRes((vscroll.getValue() + 1) * rowSize);\r
+ }\r
+ else\r
+ {\r
+ av.setStartSeq(offy);\r
+ av.setEndSeq(offy +\r
+ (seqPanel.seqCanvas.getHeight() / av.getCharHeight()));\r
+ }\r
+ }\r
\r
- public void paintComponent(Graphics g)\r
- {\r
- invalidate();\r
+ if (overviewPanel != null)\r
+ {\r
+ overviewPanel.setBoxPosition();\r
+ }\r
\r
- Dimension d = idPanel.idCanvas.getPreferredSize();\r
- idPanelHolder.setPreferredSize(d);\r
- hscrollFillerPanel.setPreferredSize(new Dimension(d.width, 12));\r
- validate();\r
+ if (av.getWrapAlignment() || !fastPaint)\r
+ {\r
+ repaint();\r
+ }\r
+ else\r
+ {\r
+ idPanel.idCanvas.fastPaint(av.getStartSeq() - oldY);\r
+ seqPanel.seqCanvas.fastPaint(av.getStartRes() - oldX,\r
+ av.getStartSeq() - oldY);\r
\r
- if (av.getWrapAlignment())\r
- {\r
- int max = av.alignment.getWidth() /\r
- seqPanel.seqCanvas.getWrappedCanvasWidth(seqPanel.seqCanvas.getWidth());\r
- vscroll.setMaximum(max);\r
- vscroll.setUnitIncrement(1);\r
- vscroll.setVisibleAmount(1);\r
- }\r
- else\r
- {\r
- setScrollValues(av.getStartRes(), av.getStartSeq());\r
+ scalePanel.repaint();\r
+\r
+ if (av.getShowAnnotation())\r
+ {\r
+ annotationPanel.fastPaint(av.getStartRes() - oldX);\r
+ }\r
+ }\r
}\r
- }\r
\r
- public int print(Graphics pg, PageFormat pf, int pi)\r
- throws PrinterException\r
- {\r
- pg.translate( (int) pf.getImageableX(), (int) pf.getImageableY());\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param g DOCUMENT ME!\r
+ */\r
+ public void paintComponent(Graphics g)\r
+ {\r
+ invalidate();\r
\r
- int pwidth = (int) pf.getImageableWidth();\r
- int pheight = (int) pf.getImageableHeight();\r
+ Dimension d = idPanel.idCanvas.getPreferredSize();\r
+ idPanelHolder.setPreferredSize(d);\r
+ hscrollFillerPanel.setPreferredSize(new Dimension(d.width, 12));\r
+ validate();\r
\r
- if (av.getWrapAlignment())\r
- {\r
- return printWrappedAlignment(pg, pwidth, pheight, pi);\r
+ if (av.getWrapAlignment())\r
+ {\r
+ int max = av.alignment.getWidth() / seqPanel.seqCanvas.getWrappedCanvasWidth(seqPanel.seqCanvas.getWidth());\r
+ vscroll.setMaximum(max);\r
+ vscroll.setUnitIncrement(1);\r
+ vscroll.setVisibleAmount(1);\r
+ }\r
+ else\r
+ {\r
+ setScrollValues(av.getStartRes(), av.getStartSeq());\r
+ }\r
}\r
- else\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param pg DOCUMENT ME!\r
+ * @param pf DOCUMENT ME!\r
+ * @param pi DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ *\r
+ * @throws PrinterException DOCUMENT ME!\r
+ */\r
+ public int print(Graphics pg, PageFormat pf, int pi)\r
+ throws PrinterException\r
{\r
- return printUnwrapped(pg, pwidth, pheight, pi);\r
- }\r
- }\r
+ pg.translate((int) pf.getImageableX(), (int) pf.getImageableY());\r
\r
- public int printUnwrapped(Graphics pg, int pwidth, int pheight, int pi)\r
- throws PrinterException\r
- {\r
- int idWidth = calculateIdWidth().width + 4;\r
- FontMetrics fm = getFontMetrics(av.getFont());\r
- int scaleHeight = av.charHeight + fm.getDescent();\r
+ int pwidth = (int) pf.getImageableWidth();\r
+ int pheight = (int) pf.getImageableHeight();\r
\r
- pg.setColor(Color.white);\r
- pg.fillRect(0, 0, pwidth, pheight);\r
- pg.setFont(av.getFont());\r
+ if (av.getWrapAlignment())\r
+ {\r
+ return printWrappedAlignment(pg, pwidth, pheight, pi);\r
+ }\r
+ else\r
+ {\r
+ return printUnwrapped(pg, pwidth, pheight, pi);\r
+ }\r
+ }\r
\r
- ////////////////////////////////////\r
- /// How many sequences and residues can we fit on a printable page?\r
- int totalRes = (pwidth - idWidth) / av.getCharWidth();\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param pg DOCUMENT ME!\r
+ * @param pwidth DOCUMENT ME!\r
+ * @param pheight DOCUMENT ME!\r
+ * @param pi DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ *\r
+ * @throws PrinterException DOCUMENT ME!\r
+ */\r
+ public int printUnwrapped(Graphics pg, int pwidth, int pheight, int pi)\r
+ throws PrinterException\r
+ {\r
+ int idWidth = calculateIdWidth().width + 4;\r
+ FontMetrics fm = getFontMetrics(av.getFont());\r
+ int scaleHeight = av.charHeight + fm.getDescent();\r
\r
- int totalSeq = (int) ( (pheight - scaleHeight) / av.getCharHeight()) -\r
- 1;\r
+ pg.setColor(Color.white);\r
+ pg.fillRect(0, 0, pwidth, pheight);\r
+ pg.setFont(av.getFont());\r
\r
- int pagesWide = (av.getAlignment().getWidth() / totalRes) + 1;\r
+ ////////////////////////////////////\r
+ /// How many sequences and residues can we fit on a printable page?\r
+ int totalRes = (pwidth - idWidth) / av.getCharWidth();\r
\r
- /////////////////////////////\r
- /// Only print these sequences and residues on this page\r
- int startRes;\r
+ int totalSeq = (int) ((pheight - scaleHeight) / av.getCharHeight()) -\r
+ 1;\r
\r
- /////////////////////////////\r
- /// Only print these sequences and residues on this page\r
- int endRes;\r
+ int pagesWide = (av.getAlignment().getWidth() / totalRes) + 1;\r
\r
- /////////////////////////////\r
- /// Only print these sequences and residues on this page\r
- int startSeq;\r
+ /////////////////////////////\r
+ /// Only print these sequences and residues on this page\r
+ int startRes;\r
\r
- /////////////////////////////\r
- /// Only print these sequences and residues on this page\r
- int endSeq;\r
- startRes = (pi % pagesWide) * totalRes;\r
- endRes = (startRes + totalRes) - 1;\r
+ /////////////////////////////\r
+ /// Only print these sequences and residues on this page\r
+ int endRes;\r
\r
- if (endRes > (av.getAlignment().getWidth() - 1))\r
- {\r
- endRes = av.getAlignment().getWidth() - 1;\r
- }\r
+ /////////////////////////////\r
+ /// Only print these sequences and residues on this page\r
+ int startSeq;\r
\r
- startSeq = (pi / pagesWide) * totalSeq;\r
- endSeq = startSeq + totalSeq;\r
+ /////////////////////////////\r
+ /// Only print these sequences and residues on this page\r
+ int endSeq;\r
+ startRes = (pi % pagesWide) * totalRes;\r
+ endRes = (startRes + totalRes) - 1;\r
\r
- if (endSeq > av.getAlignment().getHeight())\r
- {\r
- endSeq = av.getAlignment().getHeight();\r
- }\r
+ if (endRes > (av.getAlignment().getWidth() - 1))\r
+ {\r
+ endRes = av.getAlignment().getWidth() - 1;\r
+ }\r
\r
- int pagesHigh = ( (av.alignment.getHeight() / totalSeq) + 1) * pheight;\r
+ startSeq = (pi / pagesWide) * totalSeq;\r
+ endSeq = startSeq + totalSeq;\r
\r
- if (av.showAnnotation)\r
- {\r
- pagesHigh += annotationPanel.getHeight();\r
- }\r
+ if (endSeq > av.getAlignment().getHeight())\r
+ {\r
+ endSeq = av.getAlignment().getHeight();\r
+ }\r
\r
- pagesHigh /= pheight;\r
+ int pagesHigh = ((av.alignment.getHeight() / totalSeq) + 1) * pheight;\r
\r
- if (pi >= (pagesWide * pagesHigh))\r
- {\r
- return Printable.NO_SUCH_PAGE;\r
- }\r
+ if (av.showAnnotation)\r
+ {\r
+ pagesHigh += annotationPanel.getHeight();\r
+ }\r
\r
- //draw Scale\r
- pg.translate(idWidth, 0);\r
- scalePanel.drawScale(pg, startRes, endRes, pwidth - idWidth, scaleHeight);\r
- pg.translate( -idWidth, scaleHeight);\r
+ pagesHigh /= pheight;\r
\r
- ////////////////\r
- // Draw the ids\r
- Color currentColor = null;\r
- Color currentTextColor = null;\r
+ if (pi >= (pagesWide * pagesHigh))\r
+ {\r
+ return Printable.NO_SUCH_PAGE;\r
+ }\r
\r
- for (int i = startSeq; i < endSeq; i++)\r
- {\r
- if ( (av.getSelectionGroup() != null) &&\r
- av.getSelectionGroup().sequences.contains(\r
- av.getAlignment().getSequenceAt(i)))\r
- {\r
- currentColor = Color.gray;\r
- currentTextColor = Color.black;\r
- }\r
- else\r
- {\r
- currentColor = av.getAlignment().getSequenceAt(i).getColor();\r
- currentTextColor = Color.black;\r
- }\r
+ //draw Scale\r
+ pg.translate(idWidth, 0);\r
+ scalePanel.drawScale(pg, startRes, endRes, pwidth - idWidth, scaleHeight);\r
+ pg.translate(-idWidth, scaleHeight);\r
\r
- pg.setColor(currentColor);\r
- pg.fillRect(0,\r
- jalview.analysis.AlignmentUtil.getPixelHeight(startSeq, i,\r
- av.getCharHeight()), idWidth, av.getCharHeight());\r
+ ////////////////\r
+ // Draw the ids\r
+ Color currentColor = null;\r
+ Color currentTextColor = null;\r
\r
- pg.setColor(currentTextColor);\r
+ for (int i = startSeq; i < endSeq; i++)\r
+ {\r
+ if ((av.getSelectionGroup() != null) &&\r
+ av.getSelectionGroup().sequences.contains(\r
+ av.getAlignment().getSequenceAt(i)))\r
+ {\r
+ currentColor = Color.gray;\r
+ currentTextColor = Color.black;\r
+ }\r
+ else\r
+ {\r
+ currentColor = av.getAlignment().getSequenceAt(i).getColor();\r
+ currentTextColor = Color.black;\r
+ }\r
+\r
+ pg.setColor(currentColor);\r
+ pg.fillRect(0, (i-startSeq) * av.charHeight, idWidth,\r
+ av.getCharHeight());\r
+\r
+ pg.setColor(currentTextColor);\r
+\r
+ String string = av.getAlignment().getSequenceAt(i).getName();\r
+\r
+ if (av.getShowFullId())\r
+ {\r
+ string = av.getAlignment().getSequenceAt(i).getDisplayId();\r
+ }\r
+\r
+ pg.drawString(string, 0,\r
+ (((i-startSeq) * av.charHeight) + av.getCharHeight()) -\r
+ (av.getCharHeight() / 5));\r
+ }\r
\r
- String string = av.getAlignment().getSequenceAt(i).getName();\r
+ // draw main sequence panel\r
+ pg.translate(idWidth, 0);\r
+ seqPanel.seqCanvas.drawPanel(pg, startRes, endRes, startSeq, endSeq,\r
+ startRes, startSeq, 0);\r
\r
- if (av.getShowFullId())\r
- {\r
- string = av.getAlignment().getSequenceAt(i).getDisplayId();\r
- }\r
+ if (av.showAnnotation && (endSeq == av.alignment.getHeight()))\r
+ {\r
+ pg.translate(-idWidth, (endSeq - startSeq) * av.charHeight);\r
+ alabels.drawComponent((Graphics2D) pg);\r
+ pg.translate(idWidth, 0);\r
+ annotationPanel.drawComponent((Graphics2D) pg, startRes, endRes +\r
+ 1);\r
+ }\r
\r
- pg.drawString(string, 0,\r
- (jalview.analysis.AlignmentUtil.getPixelHeight(startSeq, i,\r
- av.getCharHeight()) + av.getCharHeight()) -\r
- (av.getCharHeight() / 5));\r
+ return Printable.PAGE_EXISTS;\r
}\r
\r
- // draw main sequence panel\r
- pg.translate(idWidth, 0);\r
- seqPanel.seqCanvas.drawPanel(pg, startRes, endRes, startSeq, endSeq,\r
- startRes, startSeq, 0);\r
-\r
- if (av.showAnnotation && (endSeq == av.alignment.getHeight()))\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param pg DOCUMENT ME!\r
+ * @param pwidth DOCUMENT ME!\r
+ * @param pheight DOCUMENT ME!\r
+ * @param pi DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ *\r
+ * @throws PrinterException DOCUMENT ME!\r
+ */\r
+ public int printWrappedAlignment(Graphics pg, int pwidth, int pheight,\r
+ int pi) throws PrinterException\r
{\r
- pg.translate( -idWidth, (endSeq - startSeq) * av.charHeight);\r
- alabels.drawComponent( (Graphics2D) pg);\r
- pg.translate(idWidth, 0);\r
- annotationPanel.drawComponent( (Graphics2D) pg, startRes, endRes +\r
- 1);\r
- }\r
+ int idWidth = calculateIdWidth().width + 4;\r
\r
- return Printable.PAGE_EXISTS;\r
- }\r
+ int resWidth = seqPanel.seqCanvas.getWrappedCanvasWidth(pwidth -\r
+ idWidth);\r
+ int totalHeight = totalHeight = (av.alignment.getHeight() + 2) * ((av.alignment.getWidth() / resWidth) +\r
+ 1) * av.charHeight;\r
\r
- public int printWrappedAlignment(Graphics pg, int pwidth, int pheight,\r
- int pi)\r
- throws PrinterException\r
- {\r
- int idWidth = calculateIdWidth().width + 4;\r
+ pg.setColor(Color.white);\r
+ pg.fillRect(0, 0, pwidth, pheight);\r
+ pg.setFont(av.getFont());\r
\r
- int resWidth = seqPanel.seqCanvas.getWrappedCanvasWidth(pwidth -\r
- idWidth);\r
- int totalHeight = totalHeight = (av.alignment.getHeight() + 2) *\r
- ( (av.alignment.getWidth() / resWidth) +\r
- 1) * av.charHeight;\r
+ ////////////////\r
+ // Draw the ids\r
+ pg.setColor(Color.black);\r
\r
- pg.setColor(Color.white);\r
- pg.fillRect(0, 0, pwidth, pheight);\r
- pg.setFont(av.getFont());\r
+ pg.translate(0, -pi * pheight);\r
\r
- ////////////////\r
- // Draw the ids\r
- pg.setColor(Color.black);\r
+ pg.setClip(0, pi * pheight, pwidth, pheight);\r
\r
- pg.translate(0, -pi * pheight);\r
+ int ypos = 2 * av.charHeight;\r
\r
- pg.setClip(0, pi * pheight, pwidth, pheight);\r
+ do\r
+ {\r
+ for (int i = 0; i < av.alignment.getHeight(); i++)\r
+ {\r
+ SequenceI s = av.alignment.getSequenceAt(i);\r
+ String string = s.getName();\r
+\r
+ if (av.getShowFullId())\r
+ {\r
+ string = s.getDisplayId();\r
+ }\r
+\r
+ pg.drawString(string, 0,\r
+ ((i * av.charHeight) + ypos + av.charHeight) -\r
+ (av.charHeight / 5));\r
+ }\r
+\r
+ ypos += ((av.alignment.getHeight() + 2) * av.charHeight);\r
+ }\r
+ while (ypos < totalHeight);\r
\r
- int ypos = 2 * av.charHeight;\r
+ pg.translate(idWidth, 0);\r
\r
- do\r
- {\r
- for (int i = 0; i < av.alignment.getHeight(); i++)\r
- {\r
- SequenceI s = av.alignment.getSequenceAt(i);\r
- String string = s.getName();\r
+ seqPanel.seqCanvas.drawWrappedPanel(pg, pwidth - idWidth, totalHeight, 0);\r
\r
- if (av.getShowFullId())\r
+ if ((pi * pheight) < totalHeight)\r
+ {\r
+ return Printable.PAGE_EXISTS;\r
+ }\r
+ else\r
{\r
- string = s.getDisplayId();\r
+ return Printable.NO_SUCH_PAGE;\r
}\r
+ }\r
\r
- pg.drawString(string, 0,\r
- (AlignmentUtil.getPixelHeight(0, i, av.charHeight) + ypos +\r
- av.charHeight) - (av.charHeight / 5));\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ public void makeEPS(File epsFile)\r
+ {\r
+ if(epsFile == null)\r
+ {\r
+ jalview.io.JalviewFileChooser chooser = new jalview.io.\r
+ JalviewFileChooser(jalview.bin.Cache.getProperty(\r
+ "LAST_DIRECTORY"), new String[]\r
+ {"eps"},\r
+ new String[]\r
+ {"Encapsulated Postscript"},\r
+ "Encapsulated Postscript");\r
+ chooser.setFileView(new jalview.io.JalviewFileView());\r
+ chooser.setDialogTitle("Create EPS file from alignment");\r
+ chooser.setToolTipText("Save");\r
+\r
+ int value = chooser.showSaveDialog(this);\r
+\r
+ if (value != jalview.io.JalviewFileChooser.APPROVE_OPTION)\r
+ {\r
+ return;\r
+ }\r
+\r
+ epsFile = chooser.getSelectedFile();\r
+\r
+ jalview.bin.Cache.setProperty("LAST_DIRECTORY",\r
+ chooser.getSelectedFile().getParent());\r
+ }\r
\r
- ypos += ( (av.alignment.getHeight() + 2) * av.charHeight);\r
- }\r
- while (ypos < totalHeight);\r
+ int height = ( (av.alignment.getHeight() + 1) * av.charHeight) + 30;\r
+ int width = idPanel.getWidth() + (av.alignment.getWidth() * av.charWidth);\r
\r
- pg.translate(idWidth, 0);\r
+ if (av.getWrapAlignment())\r
+ {\r
+ height = ( (av.alignment.getWidth() / av.getChunkWidth()) + 1) *\r
+ av.chunkHeight;\r
+ width = seqPanel.getWidth() + idPanel.getWidth();\r
\r
- seqPanel.seqCanvas.drawWrappedPanel(pg, pwidth - idWidth, totalHeight, 0);\r
+ }\r
\r
- if ( (pi * pheight) < totalHeight)\r
- {\r
- return Printable.PAGE_EXISTS;\r
- }\r
- else\r
- {\r
- return Printable.NO_SUCH_PAGE;\r
- }\r
- }\r
\r
- public void makeEPS()\r
- {\r
- int height = ( (av.alignment.getWidth() / av.getChunkWidth()) + 1) *\r
- av.chunkHeight;\r
- int width = seqPanel.getWidth() + idPanel.getWidth();\r
+ if (av.getShowAnnotation())\r
+ {\r
+ height += annotationPanel.getPreferredSize().height;\r
+ }\r
\r
- if (!av.getWrapAlignment())\r
- {\r
- height = ( (av.alignment.getHeight() + 1) * av.charHeight) + 30;\r
- width = idPanel.getWidth() +\r
- (av.alignment.getWidth() * av.charWidth);\r
+ try\r
+ {\r
+ FileOutputStream out = new FileOutputStream(epsFile);\r
+ EpsGraphics2D pg = new EpsGraphics2D("Example", out, 0, 0, width,\r
+ height);\r
+\r
+ if (av.getWrapAlignment())\r
+ {\r
+ printWrappedAlignment(pg, width, height, 0);\r
+ }\r
+ else\r
+ {\r
+ printUnwrapped(pg, width, height, 0);\r
+ }\r
+\r
+ pg.flush();\r
+ pg.close();\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ ex.printStackTrace();\r
+ }\r
}\r
\r
- if (av.getShowAnnotation())\r
+\r
+ public void makePNGImageMap(File imgMapFile, String imageName)\r
{\r
- height += annotationPanel.getPreferredSize().height;\r
+ ///////ONLY WORKS WITH NONE WRAPPED ALIGNMENTS\r
+ //////////////////////////////////////////////\r
+ int idWidth = calculateIdWidth().width + 4;\r
+ FontMetrics fm = getFontMetrics(av.getFont());\r
+ int scaleHeight = av.charHeight + fm.getDescent();\r
+\r
+ // Gen image map\r
+ //////////////////////////////////\r
+ if(imgMapFile!=null)\r
+ {\r
+ try\r
+ {\r
+ PrintWriter out = new PrintWriter(new FileWriter(imgMapFile));\r
+ out.println(jalview.io.HTMLOutput.getImageMapHTML());\r
+ out.println("<img src=\"" + imageName +\r
+ "\" border=\"0\" usemap=\"#Map\" >"\r
+ +"<map name=\"Map\">");\r
+\r
+ for (int s = 0; s < av.alignment.getHeight(); s++)\r
+ {\r
+ SequenceI seq = av.alignment.getSequenceAt(s);\r
+ SequenceGroup[] groups = av.alignment.findAllGroups(seq);\r
+ for (int i = 0; i < groups.length; i++)\r
+ {\r
+ int sy = s * av.charHeight + scaleHeight;\r
+ for (int res = groups[i].getStartRes();\r
+ res < groups[i].getEndRes() + 1; res++)\r
+ {\r
+ int alIndex = seq.findPosition(res);\r
+ Object obj = ResidueProperties.aa2Triplet.get(\r
+ seq.getCharAt(res) + "");\r
+ if (obj == null)\r
+ continue;\r
+\r
+ String triplet = obj.toString();\r
+\r
+ out.println(\r
+ "<area shape=\"rect\" coords=\""\r
+ + (idWidth + res * av.charWidth) + ","\r
+ + sy + ","\r
+ + (idWidth + (res + 1) * av.charWidth) + ","\r
+ + (av.charHeight + sy) + "\""\r
+ + " onMouseOver=\"toolTip('"\r
+ + alIndex + " " + triplet +\r
+ "<br><em>" + groups[i].getName() +\r
+ "</em>')\"; onMouseOut=\"toolTip()\"; "\r
+ + " href=\"#\">");\r
+ }\r
+ }\r
+ }\r
+\r
+ out.println("</map></body></html>");\r
+ out.close();\r
+\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ ex.printStackTrace();\r
+ }\r
+ }///////////END OF IMAGE MAP\r
+\r
}\r
\r
- try\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ public void makePNG(File pngFile)\r
{\r
- jalview.io.JalviewFileChooser chooser = new jalview.io.JalviewFileChooser(\r
- jalview.bin.Cache.getProperty(\r
- "LAST_DIRECTORY"), new String[]\r
- {"eps"},\r
- new String[]\r
- {"Encapsulated Postscript"},\r
- "Encapsulated Postscript");\r
- chooser.setFileView(new jalview.io.JalviewFileView());\r
- chooser.setDialogTitle("Create EPS file from alignment");\r
- chooser.setToolTipText("Save");\r
-\r
- int value = chooser.showSaveDialog(this);\r
-\r
- if (value != jalview.io.JalviewFileChooser.APPROVE_OPTION)\r
+ if(pngFile==null)\r
{\r
- return;\r
+ jalview.io.JalviewFileChooser chooser = new jalview.io.\r
+ JalviewFileChooser(jalview.bin.Cache.getProperty(\r
+ "LAST_DIRECTORY"), new String[]\r
+ {"png"},\r
+ new String[]\r
+ {"Portable network graphics"},\r
+ "Portable network graphics");\r
+ chooser.setFileView(new jalview.io.JalviewFileView());\r
+ chooser.setDialogTitle("Create EPS file from alignment");\r
+ chooser.setToolTipText("Save");\r
+\r
+ int value = chooser.showSaveDialog(this);\r
+\r
+ if (value != jalview.io.JalviewFileChooser.APPROVE_OPTION)\r
+ {\r
+ return;\r
+ }\r
+\r
+ pngFile = chooser.getSelectedFile();\r
+\r
+ jalview.bin.Cache.setProperty("LAST_DIRECTORY",\r
+ chooser.getSelectedFile().getParent());\r
}\r
\r
- jalview.bin.Cache.setProperty("LAST_DIRECTORY",\r
- chooser.getSelectedFile().getParent());\r
\r
- FileOutputStream out = new FileOutputStream(chooser.getSelectedFile());\r
- EpsGraphics2D pg = new EpsGraphics2D("Example", out, 0, 0, width,\r
- height);\r
+\r
+ int height = ( (av.alignment.getHeight() + 1) * av.charHeight) + 30;\r
+ int width = idPanel.getWidth() + (av.alignment.getWidth() * av.charWidth);\r
\r
if (av.getWrapAlignment())\r
{\r
- printWrappedAlignment(pg, width, height, 0);\r
- }\r
- else\r
- {\r
- printUnwrapped(pg, width, height, 0);\r
- }\r
+ height = ( (av.alignment.getWidth() / av.getChunkWidth()) + 1) *\r
+ av.chunkHeight;\r
+ width = seqPanel.getWidth() + idPanel.getWidth();\r
\r
- pg.flush();\r
- pg.close();\r
- }\r
- catch (Exception ex)\r
- {\r
- ex.printStackTrace();\r
- }\r
- }\r
+ }\r
\r
- public void makePNG()\r
- {\r
- int height = ( (av.alignment.getWidth() / av.getChunkWidth()) + 1) *\r
- av.chunkHeight;\r
- int width = seqPanel.getWidth() + idPanel.getWidth();\r
\r
- if (!av.getWrapAlignment())\r
- {\r
- height = ( (av.alignment.getHeight() + 1) * av.charHeight) + 30;\r
- width = idPanel.getWidth() +\r
- (av.alignment.getWidth() * av.charWidth);\r
- }\r
+ if (av.getShowAnnotation())\r
+ {\r
+ height += annotationPanel.getPreferredSize().height;\r
+ }\r
\r
- if (av.getShowAnnotation())\r
- {\r
- height += annotationPanel.getPreferredSize().height;\r
- }\r
+ try\r
+ {\r
\r
- try\r
- {\r
- jalview.io.JalviewFileChooser chooser = new jalview.io.JalviewFileChooser(\r
- jalview.bin.Cache.getProperty(\r
- "LAST_DIRECTORY"), new String[]\r
- {"png"},\r
- new String[]\r
- {"Portable network graphics"},\r
- "Portable network graphics");\r
- chooser.setFileView(new jalview.io.JalviewFileView());\r
- chooser.setDialogTitle("Create EPS file from alignment");\r
- chooser.setToolTipText("Save");\r
-\r
- int value = chooser.showSaveDialog(this);\r
-\r
- if (value != jalview.io.JalviewFileChooser.APPROVE_OPTION)\r
- {\r
- return;\r
- }\r
+ FileOutputStream out = new FileOutputStream(pngFile);\r
\r
- jalview.bin.Cache.setProperty("LAST_DIRECTORY",\r
- chooser.getSelectedFile().getParent());\r
+ BufferedImage bi = new BufferedImage(width, height,\r
+ BufferedImage.TYPE_INT_RGB);\r
+ Graphics2D png = (Graphics2D) bi.getGraphics();\r
\r
- FileOutputStream out = new FileOutputStream(chooser.getSelectedFile());\r
+ png.setRenderingHint(RenderingHints.KEY_ANTIALIASING,\r
+ RenderingHints.VALUE_ANTIALIAS_ON);\r
\r
- BufferedImage bi = new BufferedImage(width, height,\r
- BufferedImage.TYPE_INT_RGB);\r
- Graphics2D png = (Graphics2D) bi.getGraphics();\r
+ if (av.getWrapAlignment())\r
+ {\r
+ printWrappedAlignment(png, width, height, 0);\r
+ }\r
+ else\r
+ {\r
+ printUnwrapped(png, width, height, 0);\r
+ }\r
\r
- png.setRenderingHint(RenderingHints.KEY_ANTIALIASING,\r
- RenderingHints.VALUE_ANTIALIAS_ON);\r
+ ImageIO.write(bi, "png", out);\r
+ out.close();\r
+ }\r
+ catch(OutOfMemoryError err)\r
+ {\r
+ System.out.println("########################\n"\r
+ +"OUT OF MEMORY "+pngFile+"\n"\r
+ +"########################");\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ ex.printStackTrace();\r
+ }\r
+ }\r
+}\r
\r
- if (av.getWrapAlignment())\r
- {\r
- printWrappedAlignment(png, width, height, 0);\r
- }\r
- else\r
- {\r
- printUnwrapped(png, width, height, 0);\r
- }\r
\r
- ImageIO.write(bi, "png", out);\r
- out.close();\r
- }\r
- catch (Exception ex)\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+class Preview extends JFrame\r
+{\r
+ /**\r
+ * Creates a new Preview object.\r
+ *\r
+ * @param image DOCUMENT ME!\r
+ */\r
+ public Preview(Image image)\r
{\r
- ex.printStackTrace();\r
+ setResizable(true);\r
+ setSize(image.getWidth(this), image.getHeight(this));\r
+ setVisible(true);\r
+ getContentPane().setLayout(new BorderLayout());\r
+ getContentPane().add(new PreviewPanel(image), BorderLayout.CENTER);\r
+ validate();\r
+ repaint();\r
}\r
- }\r
}\r
\r
-class Preview\r
- extends JFrame\r
-{\r
- public Preview(Image image)\r
- {\r
- setResizable(true);\r
- setSize(image.getWidth(this), image.getHeight(this));\r
- setVisible(true);\r
- getContentPane().setLayout(new BorderLayout());\r
- getContentPane().add(new PreviewPanel(image), BorderLayout.CENTER);\r
- validate();\r
- repaint();\r
- }\r
-}\r
\r
-class PreviewPanel\r
- extends JPanel\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+class PreviewPanel extends JPanel\r
{\r
- Image image;\r
-\r
- public PreviewPanel(Image image)\r
- {\r
- this.image = image;\r
- }\r
-\r
- public void paintComponent(Graphics g)\r
- {\r
- if (image != null)\r
+ Image image;\r
+\r
+ /**\r
+ * Creates a new PreviewPanel object.\r
+ *\r
+ * @param image DOCUMENT ME!\r
+ */\r
+ public PreviewPanel(Image image)\r
{\r
- g.drawImage(image, 0, 0, this);\r
+ this.image = image;\r
}\r
- else\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param g DOCUMENT ME!\r
+ */\r
+ public void paintComponent(Graphics g)\r
{\r
- System.out.println("DEBUG:image is null");\r
+ if (image != null)\r
+ {\r
+ g.drawImage(image, 0, 0, this);\r
+ }\r
+ else\r
+ {\r
+ System.out.println("DEBUG:image is null");\r
+ }\r
}\r
- }\r
}\r
*/\r
package jalview.gui;\r
\r
+import jalview.datamodel.*;\r
+\r
import java.awt.*;\r
import java.awt.event.*;\r
import java.awt.image.*;\r
+\r
import javax.swing.*;\r
\r
-import jalview.datamodel.*;\r
\r
-public class AnnotationLabels\r
- extends JPanel implements MouseListener,\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class AnnotationLabels extends JPanel implements MouseListener,\r
MouseMotionListener, ActionListener\r
{\r
- static String ADDNEW = "Add New Row";\r
- static String HIDE = "Hide This Row";\r
- static String DELETE = "Delete This Row";\r
- static String SHOWALL = "Show All Hidden Rows";\r
- static String OUTPUT_TEXT = "Show Values In Textbox";\r
- boolean active = false;\r
- Image image;\r
- AlignmentPanel ap;\r
- boolean resizing = false;\r
- int oldY;\r
- int mouseX;\r
- int selectedRow = 0;\r
- int scrollOffset = 0;\r
-\r
- public AnnotationLabels(AlignmentPanel ap)\r
- {\r
- this.ap = ap;\r
-\r
- java.net.URL url = getClass().getResource("/images/idwidth.gif");\r
- Image temp = null;\r
-\r
- if (url != null)\r
+ static String ADDNEW = "Add New Row";\r
+ static String HIDE = "Hide This Row";\r
+ static String DELETE = "Delete This Row";\r
+ static String SHOWALL = "Show All Hidden Rows";\r
+ static String OUTPUT_TEXT = "Show Values In Textbox";\r
+ boolean active = false;\r
+ Image image;\r
+ AlignmentPanel ap;\r
+ boolean resizing = false;\r
+ int oldY;\r
+ int mouseX;\r
+ int selectedRow = 0;\r
+ int scrollOffset = 0;\r
+\r
+ /**\r
+ * Creates a new AnnotationLabels object.\r
+ *\r
+ * @param ap DOCUMENT ME!\r
+ */\r
+ public AnnotationLabels(AlignmentPanel ap)\r
{\r
- temp = java.awt.Toolkit.getDefaultToolkit().createImage(url);\r
- }\r
+ this.ap = ap;\r
\r
- try\r
- {\r
- MediaTracker mt = new MediaTracker(this);\r
- mt.addImage(temp, 0);\r
- mt.waitForID(0);\r
+ java.net.URL url = getClass().getResource("/images/idwidth.gif");\r
+ Image temp = null;\r
+\r
+ if (url != null)\r
+ {\r
+ temp = java.awt.Toolkit.getDefaultToolkit().createImage(url);\r
+ }\r
+\r
+ try\r
+ {\r
+ MediaTracker mt = new MediaTracker(this);\r
+ mt.addImage(temp, 0);\r
+ mt.waitForID(0);\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ }\r
+\r
+ BufferedImage bi = new BufferedImage(temp.getHeight(this),\r
+ temp.getWidth(this), BufferedImage.TYPE_INT_RGB);\r
+ Graphics2D g = (Graphics2D) bi.getGraphics();\r
+ g.rotate(Math.toRadians(90));\r
+ g.drawImage(temp, 0, -bi.getWidth(this), this);\r
+ image = (Image) bi;\r
+\r
+ addMouseListener(this);\r
+ addMouseMotionListener(this);\r
}\r
- catch (Exception ex)\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param y DOCUMENT ME!\r
+ */\r
+ public void setScrollOffset(int y)\r
{\r
+ scrollOffset = y;\r
+ repaint();\r
}\r
\r
- BufferedImage bi = new BufferedImage(temp.getHeight(this),\r
- temp.getWidth(this),\r
- BufferedImage.TYPE_INT_RGB);\r
- Graphics2D g = (Graphics2D) bi.getGraphics();\r
- g.rotate(Math.toRadians(90));\r
- g.drawImage(temp, 0, -bi.getWidth(this), this);\r
- image = (Image) bi;\r
-\r
- addMouseListener(this);\r
- addMouseMotionListener(this);\r
- }\r
-\r
- public void setScrollOffset(int y)\r
- {\r
- scrollOffset = y;\r
- repaint();\r
- }\r
-\r
- public void actionPerformed(ActionEvent evt)\r
- {\r
- int dif = 0;\r
- AlignmentAnnotation[] aa = ap.av.alignment.getAlignmentAnnotation();\r
-\r
- if (evt.getActionCommand().equals(ADDNEW))\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ */\r
+ public void actionPerformed(ActionEvent evt)\r
{\r
- String label = JOptionPane.showInputDialog(this,\r
- "Label for annotation");\r
- if (label == null)\r
- label = "";\r
+ int dif = 0;\r
+ AlignmentAnnotation[] aa = ap.av.alignment.getAlignmentAnnotation();\r
\r
- ap.av.alignment.addAnnotation(new AlignmentAnnotation(label,\r
- "New description",\r
- new Annotation[ap.av.alignment.getWidth()]));\r
+ if (evt.getActionCommand().equals(ADDNEW))\r
+ {\r
+ String label = JOptionPane.showInputDialog(this,\r
+ "Label for annotation");\r
\r
- dif = aa[aa.length-1].height;\r
- }\r
- else if (evt.getActionCommand().equals(HIDE))\r
- {\r
- aa[selectedRow].visible = false;\r
+ if (label == null)\r
+ {\r
+ label = "";\r
+ }\r
+\r
+ ap.av.alignment.addAnnotation(new AlignmentAnnotation(label,\r
+ "New description",\r
+ new Annotation[ap.av.alignment.getWidth()]));\r
+\r
+ dif = aa[aa.length - 1].height;\r
+ }\r
+ else if (evt.getActionCommand().equals(HIDE))\r
+ {\r
+ aa[selectedRow].visible = false;\r
+\r
+ if (aa[selectedRow].label.equals("Conservation"))\r
+ {\r
+ ap.av.showConservation = false;\r
+ }\r
\r
- if (aa[selectedRow].label.equals("Conservation"))\r
- {\r
- ap.av.showConservation = false;\r
- }\r
+ if (aa[selectedRow].label.equals("Quality"))\r
+ {\r
+ ap.av.showQuality = false;\r
+ }\r
\r
- if (aa[selectedRow].label.equals("Quality"))\r
- {\r
- ap.av.showQuality = false;\r
- }\r
+ if (aa[selectedRow].label.equals("Consensus"))\r
+ {\r
+ ap.av.showIdentity = false;\r
+ }\r
+\r
+ dif = aa[selectedRow].height * -1;\r
+ }\r
+ else if (evt.getActionCommand().equals(DELETE))\r
+ {\r
+ ap.av.alignment.deleteAnnotation(aa[selectedRow]);\r
+ dif = aa[selectedRow].height * -1;\r
+ }\r
+ else if (evt.getActionCommand().equals(SHOWALL))\r
+ {\r
+ for (int i = 0; i < aa.length; i++)\r
+ {\r
+ if (!aa[i].visible)\r
+ {\r
+ dif += aa[i].height;\r
+ aa[i].visible = true;\r
+ }\r
+ }\r
+ }\r
+ else if (evt.getActionCommand().equals(OUTPUT_TEXT))\r
+ {\r
+ CutAndPasteTransfer cap = new CutAndPasteTransfer();\r
+ Desktop.addInternalFrame(cap,\r
+ ap.alignFrame.getTitle() + " - " + aa[selectedRow].label, 500,\r
+ 100);\r
+ cap.setText(aa[selectedRow].toString());\r
+ }\r
\r
- if (aa[selectedRow].label.equals("Consensus"))\r
- {\r
- ap.av.showIdentity = false;\r
- }\r
+ ap.annotationPanel.adjustPanelHeight();\r
\r
- dif = aa[selectedRow].height*-1;\r
+ Dimension d = ap.annotationScroller.getPreferredSize();\r
+ ap.annotationScroller.setPreferredSize(new Dimension(d.width,\r
+ d.height + dif));\r
+ d = ap.annotationSpaceFillerHolder.getPreferredSize();\r
+ ap.annotationSpaceFillerHolder.setPreferredSize(new Dimension(d.width,\r
+ d.height + dif));\r
+\r
+ ap.addNotify();\r
}\r
- else if (evt.getActionCommand().equals(DELETE))\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ */\r
+ public void mousePressed(MouseEvent evt)\r
{\r
- ap.av.alignment.deleteAnnotation(aa[selectedRow]);\r
- dif = aa[selectedRow].height*-1;\r
+ oldY = evt.getY();\r
}\r
- else if (evt.getActionCommand().equals(SHOWALL))\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ */\r
+ public void mouseReleased(MouseEvent evt)\r
{\r
- for (int i = 0; i < aa.length; i++)\r
- {\r
- if(!aa[i].visible)\r
- {\r
- dif+=aa[i].height;\r
- aa[i].visible = true;\r
- }\r
- }\r
+ active = false;\r
+ repaint();\r
}\r
- else if (evt.getActionCommand().equals(OUTPUT_TEXT))\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ */\r
+ public void mouseEntered(MouseEvent evt)\r
{\r
- CutAndPasteTransfer cap = new CutAndPasteTransfer();\r
- Desktop.addInternalFrame(cap,\r
- ap.alignFrame.getTitle() + " - " +\r
- aa[selectedRow].label, 500,\r
- 100);\r
- cap.setText(aa[selectedRow].toString());\r
+ active = true;\r
+ repaint();\r
}\r
\r
- ap.annotationPanel.adjustPanelHeight();\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ */\r
+ public void mouseExited(MouseEvent evt)\r
+ {\r
+ active = false;\r
+ repaint();\r
+ }\r
\r
- Dimension d = ap.annotationScroller.getPreferredSize();\r
- ap.annotationScroller.setPreferredSize(new Dimension(d.width, d.height+dif));\r
- d = ap.annotationSpaceFillerHolder.getPreferredSize();\r
- ap.annotationSpaceFillerHolder.setPreferredSize(new Dimension(\r
- d.width, d.height+dif));\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ */\r
+ public void mouseDragged(MouseEvent evt)\r
+ {\r
+ active = true;\r
\r
- ap.addNotify();\r
+ Dimension d = ap.annotationScroller.getPreferredSize();\r
+ int dif = evt.getY() - oldY;\r
\r
+ dif /= ap.av.charHeight;\r
+ dif *= ap.av.charHeight;\r
\r
- }\r
+ if ((d.height - dif) > 20)\r
+ {\r
+ ap.annotationScroller.setPreferredSize(new Dimension(d.width,\r
+ d.height - dif));\r
+ d = ap.annotationSpaceFillerHolder.getPreferredSize();\r
+ ap.annotationSpaceFillerHolder.setPreferredSize(new Dimension(\r
+ d.width, d.height - dif));\r
+ ap.repaint();\r
+ }\r
\r
- public void mousePressed(MouseEvent evt)\r
- {\r
- oldY = evt.getY();\r
- }\r
+ ap.addNotify();\r
+ }\r
\r
- public void mouseReleased(MouseEvent evt)\r
- {\r
- active = false;\r
- repaint();\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ */\r
+ public void mouseMoved(MouseEvent evt)\r
+ {\r
+ }\r
\r
- public void mouseEntered(MouseEvent evt)\r
- {\r
- active = true;\r
- repaint();\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ */\r
+ public void mouseClicked(MouseEvent evt)\r
+ {\r
+ int y = evt.getY() - scrollOffset;\r
+ AlignmentAnnotation[] aa = ap.av.alignment.getAlignmentAnnotation();\r
\r
- public void mouseExited(MouseEvent evt)\r
- {\r
- active = false;\r
- repaint();\r
- }\r
+ if ((aa == null) || (aa.length == 0))\r
+ {\r
+ JPopupMenu pop = new JPopupMenu("Annotations");\r
+ JMenuItem item = new JMenuItem(ADDNEW);\r
+ item.addActionListener(this);\r
+ pop.add(item);\r
+ pop.show(this, evt.getX(), evt.getY());\r
\r
- public void mouseDragged(MouseEvent evt)\r
- {\r
- active = true;\r
+ return;\r
+ }\r
\r
- Dimension d = ap.annotationScroller.getPreferredSize();\r
- int dif = evt.getY() - oldY;\r
+ int height = 0;\r
\r
- dif /= ap.av.charHeight;\r
- dif *= ap.av.charHeight;\r
+ for (int i = 0; i < aa.length; i++)\r
+ {\r
+ if (!aa[i].visible)\r
+ {\r
+ continue;\r
+ }\r
\r
- if ( (d.height - dif) > 20)\r
- {\r
- ap.annotationScroller.setPreferredSize(new Dimension(d.width,\r
- d.height - dif));\r
- d = ap.annotationSpaceFillerHolder.getPreferredSize();\r
- ap.annotationSpaceFillerHolder.setPreferredSize(new Dimension(\r
- d.width, d.height - dif));\r
- ap.repaint();\r
- }\r
+ height += aa[i].height;\r
\r
- ap.addNotify();\r
- }\r
+ if (y < height)\r
+ {\r
+ selectedRow = i;\r
\r
- public void mouseMoved(MouseEvent evt)\r
- {\r
- }\r
+ break;\r
+ }\r
+ }\r
\r
- public void mouseClicked(MouseEvent evt)\r
- {\r
- int y = evt.getY() - scrollOffset;\r
- AlignmentAnnotation[] aa = ap.av.alignment.getAlignmentAnnotation();\r
+ JPopupMenu pop = new JPopupMenu("Annotations");\r
+ JMenuItem item = new JMenuItem(ADDNEW);\r
+ item.addActionListener(this);\r
+ pop.add(item);\r
+ item = new JMenuItem(HIDE);\r
+ item.addActionListener(this);\r
+ pop.add(item);\r
+ item = new JMenuItem(DELETE);\r
+ item.addActionListener(this);\r
+ pop.add(item);\r
+ item = new JMenuItem(SHOWALL);\r
+ item.addActionListener(this);\r
+ pop.add(item);\r
+ item = new JMenuItem(OUTPUT_TEXT);\r
+ item.addActionListener(this);\r
+ pop.add(item);\r
+ pop.show(this, evt.getX(), evt.getY());\r
+ }\r
\r
- if ( (aa == null) || (aa.length == 0))\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param g1 DOCUMENT ME!\r
+ */\r
+ public void paintComponent(Graphics g1)\r
{\r
- JPopupMenu pop = new JPopupMenu("Annotations");\r
- JMenuItem item = new JMenuItem(ADDNEW);\r
- item.addActionListener(this);\r
- pop.add(item);\r
- pop.show(this, evt.getX(), evt.getY());\r
+ Graphics2D g = (Graphics2D) g1;\r
+ g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,\r
+ RenderingHints.VALUE_ANTIALIAS_ON);\r
\r
- return;\r
+ drawComponent(g);\r
}\r
\r
- int height = 0;\r
-\r
- for (int i = 0; i < aa.length; i++)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param g DOCUMENT ME!\r
+ */\r
+ public void drawComponent(Graphics2D g)\r
{\r
- if (!aa[i].visible)\r
- {\r
- continue;\r
- }\r
+ FontMetrics fm = g.getFontMetrics(g.getFont());\r
+ g.setColor(Color.white);\r
+ g.fillRect(0, 0, getWidth(), getHeight());\r
\r
- height += aa[i].height;\r
+ g.translate(0, scrollOffset);\r
+ g.setColor(Color.black);\r
\r
- if (y < height)\r
- {\r
- selectedRow = i;\r
+ AlignmentAnnotation[] aa = ap.av.alignment.getAlignmentAnnotation();\r
+ int y = g.getFont().getSize();\r
+ int x = 0;\r
+ int width = getWidth();\r
+ if(width==0)\r
+ width = ap.calculateIdWidth().width + 4;\r
\r
- break;\r
- }\r
- }\r
-\r
- JPopupMenu pop = new JPopupMenu("Annotations");\r
- JMenuItem item = new JMenuItem(ADDNEW);\r
- item.addActionListener(this);\r
- pop.add(item);\r
- item = new JMenuItem(HIDE);\r
- item.addActionListener(this);\r
- pop.add(item);\r
- item = new JMenuItem(DELETE);\r
- item.addActionListener(this);\r
- pop.add(item);\r
- item = new JMenuItem(SHOWALL);\r
- item.addActionListener(this);\r
- pop.add(item);\r
- item = new JMenuItem(OUTPUT_TEXT);\r
- item.addActionListener(this);\r
- pop.add(item);\r
- pop.show(this, evt.getX(), evt.getY());\r
- }\r
-\r
- public void paintComponent(Graphics g1)\r
- {\r
- Graphics2D g = (Graphics2D) g1;\r
- g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,\r
- RenderingHints.VALUE_ANTIALIAS_ON);\r
-\r
- drawComponent(g);\r
- }\r
-\r
- public void drawComponent(Graphics2D g)\r
- {\r
- FontMetrics fm = g.getFontMetrics(g.getFont());\r
- g.setColor(Color.white);\r
- g.fillRect(0, 0, getWidth(), getHeight());\r
-\r
- g.translate(0, scrollOffset);\r
- g.setColor(Color.black);\r
-\r
- AlignmentAnnotation[] aa = ap.av.alignment.getAlignmentAnnotation();\r
- int y = g.getFont().getSize();\r
- int x = 0;\r
-\r
- if (aa != null)\r
- {\r
- for (int i = 0; i < aa.length; i++)\r
- {\r
- if (!aa[i].visible)\r
+ if (aa != null)\r
{\r
- continue;\r
+ for (int i = 0; i < aa.length; i++)\r
+ {\r
+ if (!aa[i].visible)\r
+ {\r
+ continue;\r
+ }\r
+\r
+ x = width - fm.stringWidth(aa[i].label) - 3;\r
+\r
+ if (aa[i].isGraph)\r
+ {\r
+ y += (aa[i].height / 3);\r
+ }\r
+\r
+ g.drawString(aa[i].label, x, y);\r
+\r
+ if (aa[i].isGraph)\r
+ {\r
+ y += ((2 * aa[i].height) / 3);\r
+ }\r
+ else\r
+ {\r
+ y += aa[i].height;\r
+ }\r
+ }\r
}\r
\r
- x = getWidth() - fm.stringWidth(aa[i].label) - 3;\r
-\r
- if (aa[i].isGraph)\r
+ if (active)\r
{\r
- y += (aa[i].height / 3);\r
+ if (image != null)\r
+ {\r
+ g.drawImage(image, 2, 0, this);\r
+ }\r
}\r
\r
- g.drawString(aa[i].label, x, y);\r
-\r
- if (aa[i].isGraph)\r
+ if ((aa == null) || (aa.length < 1))\r
{\r
- y += ( (2 * aa[i].height) / 3);\r
+ g.drawString("Right click", 2, 8);\r
+ g.drawString("to add annotation", 2, 18);\r
}\r
- else\r
- {\r
- y += aa[i].height;\r
- }\r
- }\r
- }\r
-\r
- if (active)\r
- {\r
- if (image != null)\r
- {\r
- g.drawImage(image, 2, 0, this);\r
- }\r
- }\r
-\r
- if ( (aa == null) || (aa.length < 1))\r
- {\r
- g.drawString("Right click", 2, 8);\r
- g.drawString("to add annotation", 2, 18);\r
}\r
- }\r
}\r
*/\r
package jalview.gui;\r
\r
-import java.util.*;\r
+import jalview.datamodel.*;\r
\r
import java.awt.*;\r
import java.awt.event.*;\r
import java.awt.image.*;\r
+\r
+import java.util.*;\r
+\r
import javax.swing.*;\r
\r
-import jalview.datamodel.*;\r
\r
-public class AnnotationPanel\r
- extends JPanel implements MouseListener,\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class AnnotationPanel extends JPanel implements MouseListener,\r
MouseMotionListener, ActionListener, AdjustmentListener\r
{\r
- static String HELIX = "Helix";\r
- static String SHEET = "Sheet";\r
- static String LABEL = "Label";\r
- static String REMOVE = "Remove Annotation";\r
- static String COLOUR = "Colour";\r
- static Color HELIX_COLOUR = Color.red.darker();\r
- static Color SHEET_COLOUR = Color.green.darker().darker();\r
-\r
- public static int GRAPH_HEIGHT = 40;\r
- AlignViewport av;\r
- AlignmentPanel ap;\r
- int activeRow = -1;\r
- Vector activeRes;\r
- BufferedImage image;\r
- Graphics2D gg;\r
- FontMetrics fm;\r
- int imgWidth = 0;\r
- boolean fastPaint = false;\r
-\r
- public AnnotationPanel(AlignmentPanel ap)\r
- {\r
- ToolTipManager.sharedInstance().registerComponent(this);\r
- ToolTipManager.sharedInstance().setInitialDelay(0);\r
- ToolTipManager.sharedInstance().setDismissDelay(10000);\r
- this.ap = ap;\r
- av = ap.av;\r
- this.setLayout(null);\r
- addMouseListener(this);\r
- addMouseMotionListener(this);\r
- ap.annotationScroller.getVerticalScrollBar().addAdjustmentListener(this);\r
- }\r
-\r
- public void adjustmentValueChanged(AdjustmentEvent evt)\r
- {\r
- ap.alabels.setScrollOffset( -evt.getValue());\r
- }\r
-\r
- public void adjustPanelHeight()\r
- {\r
- // setHeight of panels\r
- AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();\r
- int height = 0;\r
-\r
- if (aa != null)\r
+ static String HELIX = "Helix";\r
+ static String SHEET = "Sheet";\r
+ static String LABEL = "Label";\r
+ static String REMOVE = "Remove Annotation";\r
+ static String COLOUR = "Colour";\r
+ static Color HELIX_COLOUR = Color.red.darker();\r
+ static Color SHEET_COLOUR = Color.green.darker().darker();\r
+\r
+ /** DOCUMENT ME!! */\r
+ public static int GRAPH_HEIGHT = 40;\r
+ AlignViewport av;\r
+ AlignmentPanel ap;\r
+ int activeRow = -1;\r
+ Vector activeRes;\r
+ BufferedImage image;\r
+ Graphics2D gg;\r
+ FontMetrics fm;\r
+ int imgWidth = 0;\r
+ boolean fastPaint = false;\r
+\r
+ /**\r
+ * Creates a new AnnotationPanel object.\r
+ *\r
+ * @param ap DOCUMENT ME!\r
+ */\r
+ public AnnotationPanel(AlignmentPanel ap)\r
{\r
- for (int i = 0; i < aa.length; i++)\r
- {\r
- if (!aa[i].visible)\r
- {\r
- continue;\r
- }\r
+ ToolTipManager.sharedInstance().registerComponent(this);\r
+ ToolTipManager.sharedInstance().setInitialDelay(0);\r
+ ToolTipManager.sharedInstance().setDismissDelay(10000);\r
+ this.ap = ap;\r
+ av = ap.av;\r
+ this.setLayout(null);\r
+ addMouseListener(this);\r
+ addMouseMotionListener(this);\r
+ ap.annotationScroller.getVerticalScrollBar().addAdjustmentListener(this);\r
+ }\r
\r
- aa[i].height = 0;\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ */\r
+ public void adjustmentValueChanged(AdjustmentEvent evt)\r
+ {\r
+ ap.alabels.setScrollOffset(-evt.getValue());\r
+ }\r
\r
- if (aa[i].hasText)\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ public void adjustPanelHeight()\r
+ {\r
+ // setHeight of panels\r
+ AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();\r
+ int height = 0;\r
+\r
+ if (aa != null)\r
{\r
- aa[i].height += av.charHeight;\r
+ for (int i = 0; i < aa.length; i++)\r
+ {\r
+ if (!aa[i].visible)\r
+ {\r
+ continue;\r
+ }\r
+\r
+ aa[i].height = 0;\r
+\r
+ if (aa[i].hasText)\r
+ {\r
+ aa[i].height += av.charHeight;\r
+ }\r
+\r
+ if (aa[i].hasIcons)\r
+ {\r
+ aa[i].height += 16;\r
+ }\r
+\r
+ if (aa[i].isGraph)\r
+ {\r
+ aa[i].height += GRAPH_HEIGHT;\r
+ }\r
+\r
+ if (aa[i].height == 0)\r
+ {\r
+ aa[i].height = 20;\r
+ }\r
+\r
+ height += aa[i].height;\r
+ }\r
}\r
-\r
- if (aa[i].hasIcons)\r
+ else\r
{\r
- aa[i].height += 16;\r
+ height = 20;\r
}\r
\r
- if (aa[i].isGraph)\r
+ this.setPreferredSize(new Dimension(1, height));\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param col DOCUMENT ME!\r
+ */\r
+ public void removeEditableColumn(int col)\r
+ {\r
+ if (activeRow == -1)\r
{\r
- aa[i].height += GRAPH_HEIGHT;\r
+ AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();\r
+\r
+ for (int j = 0; j < aa.length; j++)\r
+ {\r
+ if (aa[j].editable)\r
+ {\r
+ activeRow = j;\r
+\r
+ break;\r
+ }\r
+ }\r
}\r
\r
- if (aa[i].height == 0)\r
+ if ((activeRes != null) && activeRes.contains(String.valueOf(col)))\r
{\r
- aa[i].height = 20;\r
+ activeRes.removeElement(String.valueOf(col));\r
}\r
\r
- height += aa[i].height;\r
- }\r
+ repaint();\r
}\r
- else\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param col DOCUMENT ME!\r
+ */\r
+ public void addEditableColumn(int col)\r
{\r
- height = 20;\r
- }\r
+ if (activeRow == -1)\r
+ {\r
+ AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();\r
\r
- this.setPreferredSize(new Dimension(1, height));\r
- }\r
+ for (int j = 0; j < aa.length; j++)\r
+ {\r
+ if (aa[j].editable)\r
+ {\r
+ activeRow = j;\r
\r
+ break;\r
+ }\r
+ }\r
+ }\r
\r
- public void removeEditableColumn(int col)\r
- {\r
- if (activeRow == -1)\r
- {\r
- AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();\r
+ if (activeRes == null)\r
+ {\r
+ activeRes = new Vector();\r
+ }\r
\r
- for (int j = 0; j < aa.length; j++)\r
- {\r
- if (aa[j].editable)\r
+ if (!activeRes.contains(String.valueOf(col)))\r
{\r
- activeRow = j;\r
- break;\r
+ activeRes.addElement(String.valueOf(col));\r
}\r
- }\r
- }\r
\r
- if (activeRes != null && activeRes.contains(String.valueOf(col)))\r
- {\r
- activeRes.removeElement(String.valueOf(col));\r
+ repaint();\r
}\r
- repaint();\r
- }\r
-\r
\r
- public void addEditableColumn(int col)\r
- {\r
- if (activeRow == -1)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ */\r
+ public void actionPerformed(ActionEvent evt)\r
{\r
- AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();\r
+ AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();\r
+ Annotation[] anot = aa[activeRow].annotations;\r
\r
- for (int j = 0; j < aa.length; j++)\r
- {\r
- if (aa[j].editable)\r
+ if (evt.getActionCommand().equals(REMOVE))\r
{\r
- activeRow = j;\r
- break;\r
+ for (int i = 0; i < activeRes.size(); i++)\r
+ {\r
+ anot[Integer.parseInt(activeRes.get(i).toString())] = null;\r
+ anot[Integer.parseInt(activeRes.get(i).toString())] = null;\r
+ }\r
}\r
- }\r
- }\r
-\r
- if (activeRes == null)\r
- activeRes = new Vector();\r
+ else if (evt.getActionCommand().equals(LABEL))\r
+ {\r
+ String label = JOptionPane.showInputDialog(this, "Enter Label ",\r
+ "Enter label", JOptionPane.QUESTION_MESSAGE);\r
\r
- if (!activeRes.contains(String.valueOf(col)))\r
- activeRes.addElement(String.valueOf(col));\r
+ if (label == null)\r
+ {\r
+ return;\r
+ }\r
\r
- repaint();\r
- }\r
+ if ((label.length() > 0) && !aa[activeRow].hasText)\r
+ {\r
+ aa[activeRow].hasText = true;\r
+ }\r
\r
- public void actionPerformed(ActionEvent evt)\r
- {\r
- AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();\r
- Annotation[] anot = aa[activeRow].annotations;\r
+ for (int i = 0; i < activeRes.size(); i++)\r
+ {\r
+ int index = Integer.parseInt(activeRes.get(i).toString());\r
\r
- if (evt.getActionCommand().equals(REMOVE))\r
- {\r
- for (int i = 0; i < activeRes.size(); i++)\r
- {\r
- anot[Integer.parseInt(activeRes.get(i).toString())] = null;\r
- anot[Integer.parseInt(activeRes.get(i).toString())] = null;\r
- }\r
- }\r
- else if (evt.getActionCommand().equals(LABEL))\r
- {\r
- String label = JOptionPane.showInputDialog(this, "Enter Label ",\r
- "Enter label",\r
- JOptionPane.QUESTION_MESSAGE);\r
+ if (anot[index] == null)\r
+ {\r
+ anot[index] = new Annotation(label, "", ' ', 0);\r
+ }\r
\r
- if (label == null)\r
- return;\r
+ anot[index].displayCharacter = label;\r
+ }\r
+ }\r
+ else if (evt.getActionCommand().equals(COLOUR))\r
+ {\r
+ Color col = JColorChooser.showDialog(this,\r
+ "Choose foreground colour", Color.black);\r
\r
- if ( (label.length() > 0) && !aa[activeRow].hasText)\r
- {\r
- aa[activeRow].hasText = true;\r
- }\r
+ for (int i = 0; i < activeRes.size(); i++)\r
+ {\r
+ int index = Integer.parseInt(activeRes.get(i).toString());\r
\r
- for (int i = 0; i < activeRes.size(); i++)\r
- {\r
- int index = Integer.parseInt(activeRes.get(i).toString());\r
+ if (anot[index] == null)\r
+ {\r
+ anot[index] = new Annotation("", "", ' ', 0);\r
+ }\r
\r
- if (anot[index] == null)\r
- {\r
- anot[index] = new Annotation(label, "", ' ', 0);\r
+ anot[index].colour = col;\r
+ }\r
}\r
- anot[index].displayCharacter = label;\r
- }\r
- }\r
- else if (evt.getActionCommand().equals(COLOUR))\r
- {\r
- Color col = JColorChooser.showDialog(this,\r
- "Choose foreground colour",\r
- Color.black);\r
-\r
- for (int i = 0; i < activeRes.size(); i++)\r
- {\r
- int index = Integer.parseInt(activeRes.get(i).toString());\r
-\r
- if (anot[index] == null)\r
+ else // HELIX OR SHEET\r
{\r
- anot[index] = new Annotation("", "", ' ', 0);\r
- }\r
+ char type = 0;\r
+ String symbol = "\u03B1";\r
\r
- anot[index].colour = col;\r
- }\r
- }\r
- else // HELIX OR SHEET\r
- {\r
- char type = 0;\r
- String symbol = "\u03B1";\r
-\r
- if (evt.getActionCommand().equals(HELIX))\r
- {\r
- type = 'H';\r
- }\r
- else if (evt.getActionCommand().equals(SHEET))\r
- {\r
- type = 'E';\r
- symbol = "\u03B2";\r
- }\r
-\r
- if (!aa[activeRow].hasIcons)\r
- {\r
- aa[activeRow].hasIcons = true;\r
- }\r
-\r
- String label = JOptionPane.showInputDialog(\r
- "Enter a label for the structure?",\r
- symbol);\r
-\r
- if (label == null)\r
- return;\r
-\r
- if ( (label.length() > 0) && !aa[activeRow].hasText)\r
- {\r
- aa[activeRow].hasText = true;\r
- }\r
+ if (evt.getActionCommand().equals(HELIX))\r
+ {\r
+ type = 'H';\r
+ }\r
+ else if (evt.getActionCommand().equals(SHEET))\r
+ {\r
+ type = 'E';\r
+ symbol = "\u03B2";\r
+ }\r
\r
- for (int i = 0; i < activeRes.size(); i++)\r
- {\r
- int index = Integer.parseInt(activeRes.get(i).toString());\r
+ if (!aa[activeRow].hasIcons)\r
+ {\r
+ aa[activeRow].hasIcons = true;\r
+ }\r
\r
- if (anot[index] == null)\r
- {\r
- anot[index] = new Annotation(label, "", type, 0);\r
- }\r
+ String label = JOptionPane.showInputDialog("Enter a label for the structure?",\r
+ symbol);\r
\r
- anot[index].secondaryStructure = type;\r
- anot[index].displayCharacter = label;\r
- }\r
- }\r
+ if (label == null)\r
+ {\r
+ return;\r
+ }\r
\r
- adjustPanelHeight();\r
- activeRes = null;\r
- repaint();\r
+ if ((label.length() > 0) && !aa[activeRow].hasText)\r
+ {\r
+ aa[activeRow].hasText = true;\r
+ }\r
\r
- return;\r
- }\r
+ for (int i = 0; i < activeRes.size(); i++)\r
+ {\r
+ int index = Integer.parseInt(activeRes.get(i).toString());\r
\r
- public void mousePressed(MouseEvent evt)\r
- {\r
- int height = 0;\r
- activeRow = -1;\r
- AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();\r
+ if (anot[index] == null)\r
+ {\r
+ anot[index] = new Annotation(label, "", type, 0);\r
+ }\r
\r
- for (int i = 0; i < aa.length; i++)\r
- {\r
- height += aa[i].height;\r
+ anot[index].secondaryStructure = type;\r
+ anot[index].displayCharacter = label;\r
+ }\r
+ }\r
\r
- if (evt.getY() < height)\r
- {\r
- if (aa[i].editable)\r
- activeRow = i;\r
- else\r
- activeRes = null;\r
+ adjustPanelHeight();\r
+ activeRes = null;\r
+ repaint();\r
\r
- break;\r
- }\r
+ return;\r
}\r
\r
-\r
- if (SwingUtilities.isRightMouseButton(evt))\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ */\r
+ public void mousePressed(MouseEvent evt)\r
{\r
- if (activeRes == null)\r
- {\r
- return;\r
- }\r
-\r
-\r
- JPopupMenu pop = new JPopupMenu("Structure type");\r
- JMenuItem item = new JMenuItem(HELIX);\r
- item.addActionListener(this);\r
- pop.add(item);\r
- item = new JMenuItem(SHEET);\r
- item.addActionListener(this);\r
- pop.add(item);\r
- item = new JMenuItem(LABEL);\r
- item.addActionListener(this);\r
- pop.add(item);\r
- item = new JMenuItem(COLOUR);\r
- item.addActionListener(this);\r
- pop.add(item);\r
- item = new JMenuItem(REMOVE);\r
- item.addActionListener(this);\r
- pop.add(item);\r
- pop.show(this, evt.getX(), evt.getY());\r
-\r
- return;\r
- }\r
+ int height = 0;\r
+ activeRow = -1;\r
\r
+ AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();\r
\r
- if (aa == null)\r
- {\r
- return;\r
- }\r
+ for (int i = 0; i < aa.length; i++)\r
+ {\r
+ height += aa[i].height;\r
\r
+ if (evt.getY() < height)\r
+ {\r
+ if (aa[i].editable)\r
+ {\r
+ activeRow = i;\r
+ }\r
+ else\r
+ {\r
+ activeRes = null;\r
+ }\r
\r
- int res = (evt.getX() / av.getCharWidth()) + av.getStartRes();\r
+ break;\r
+ }\r
+ }\r
\r
- if (evt.isControlDown() || evt.isAltDown())\r
- {\r
- addEditableColumn(res);\r
- }\r
- else if (evt.isShiftDown())\r
- {\r
- if (activeRes == null)\r
- {\r
- activeRes = new Vector();\r
- }\r
- else\r
- {\r
- int start = Integer.parseInt(activeRes.get(activeRes.size() -\r
- 1).toString());\r
- int end = res;\r
-\r
- if (end < start)\r
+ if (SwingUtilities.isRightMouseButton(evt))\r
{\r
- int temp = end;\r
- end = start;\r
- start = temp;\r
+ if (activeRes == null)\r
+ {\r
+ return;\r
+ }\r
+\r
+ JPopupMenu pop = new JPopupMenu("Structure type");\r
+ JMenuItem item = new JMenuItem(HELIX);\r
+ item.addActionListener(this);\r
+ pop.add(item);\r
+ item = new JMenuItem(SHEET);\r
+ item.addActionListener(this);\r
+ pop.add(item);\r
+ item = new JMenuItem(LABEL);\r
+ item.addActionListener(this);\r
+ pop.add(item);\r
+ item = new JMenuItem(COLOUR);\r
+ item.addActionListener(this);\r
+ pop.add(item);\r
+ item = new JMenuItem(REMOVE);\r
+ item.addActionListener(this);\r
+ pop.add(item);\r
+ pop.show(this, evt.getX(), evt.getY());\r
+\r
+ return;\r
}\r
\r
- for (int n = start; n <= end; n++)\r
+ if (aa == null)\r
{\r
- addEditableColumn(n);\r
+ return;\r
}\r
- }\r
- }\r
- else\r
- {\r
- activeRes = new Vector();\r
- activeRes.addElement(String.valueOf(res));\r
- }\r
-\r
- repaint();\r
- }\r
-\r
- public void mouseReleased(MouseEvent evt)\r
- {\r
- }\r
-\r
- public void mouseEntered(MouseEvent evt)\r
- {\r
- }\r
\r
- public void mouseExited(MouseEvent evt)\r
- {\r
- }\r
+ int res = (evt.getX() / av.getCharWidth()) + av.getStartRes();\r
\r
- public void mouseDragged(MouseEvent evt)\r
- {\r
- }\r
+ if (evt.isControlDown() || evt.isAltDown())\r
+ {\r
+ addEditableColumn(res);\r
+ }\r
+ else if (evt.isShiftDown())\r
+ {\r
+ if (activeRes == null)\r
+ {\r
+ activeRes = new Vector();\r
+ }\r
+ else\r
+ {\r
+ int start = Integer.parseInt(activeRes.get(activeRes.size() -\r
+ 1).toString());\r
+ int end = res;\r
+\r
+ if (end < start)\r
+ {\r
+ int temp = end;\r
+ end = start;\r
+ start = temp;\r
+ }\r
+\r
+ for (int n = start; n <= end; n++)\r
+ {\r
+ addEditableColumn(n);\r
+ }\r
+ }\r
+ }\r
+ else\r
+ {\r
+ activeRes = new Vector();\r
+ activeRes.addElement(String.valueOf(res));\r
+ }\r
\r
- public void mouseMoved(MouseEvent evt)\r
- {\r
- AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();\r
+ repaint();\r
+ }\r
\r
- if (aa == null)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ */\r
+ public void mouseReleased(MouseEvent evt)\r
{\r
- return;\r
}\r
\r
- int row = -1;\r
- int height = 0;\r
-\r
- for (int i = 0; i < aa.length; i++)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ */\r
+ public void mouseEntered(MouseEvent evt)\r
{\r
- if (aa[i].visible)\r
- {\r
- height += aa[i].height;\r
- }\r
-\r
- if (evt.getY() < height)\r
- {\r
- row = i;\r
-\r
- break;\r
- }\r
}\r
\r
- int res = (evt.getX() / av.getCharWidth()) + av.getStartRes();\r
-\r
- if ( (row > -1) && (res < aa[row].annotations.length) &&\r
- (aa[row].annotations[res] != null))\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ */\r
+ public void mouseExited(MouseEvent evt)\r
{\r
- this.setToolTipText(aa[row].annotations[res].description);\r
-\r
- StringBuffer text = new StringBuffer("Sequence position " +\r
- (res + 1) + " " +\r
- aa[row].annotations[res].description);\r
- ap.alignFrame.statusBar.setText(text.toString());\r
}\r
- }\r
\r
- public void mouseClicked(MouseEvent evt)\r
- {\r
- }\r
-\r
- public void paintComponent(Graphics g)\r
- {\r
- g.setColor(Color.white);\r
- g.fillRect(0, 0, getWidth(), getHeight());\r
-\r
- if (fastPaint)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ */\r
+ public void mouseDragged(MouseEvent evt)\r
{\r
- g.drawImage(image, 0, 0, this);\r
- fastPaint = false;\r
-\r
- return;\r
}\r
\r
- imgWidth = (av.endRes - av.startRes + 1) * av.charWidth;\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ */\r
+ public void mouseMoved(MouseEvent evt)\r
+ {\r
+ AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();\r
\r
- image = new BufferedImage(imgWidth, ap.annotationPanel.getHeight(),\r
- BufferedImage.TYPE_INT_RGB);\r
- gg = (Graphics2D) image.getGraphics();\r
- gg.setRenderingHint(RenderingHints.KEY_ANTIALIASING,\r
- RenderingHints.VALUE_ANTIALIAS_ON);\r
+ if (aa == null)\r
+ {\r
+ return;\r
+ }\r
\r
- gg.setFont(av.getFont());\r
- fm = gg.getFontMetrics();\r
+ int row = -1;\r
+ int height = 0;\r
\r
- drawComponent(gg, av.startRes, av.endRes + 1);\r
- g.drawImage(image, 0, 0, this);\r
- }\r
+ for (int i = 0; i < aa.length; i++)\r
+ {\r
+ if (aa[i].visible)\r
+ {\r
+ height += aa[i].height;\r
+ }\r
\r
- public void fastPaint(int horizontal)\r
- {\r
- if ( (horizontal == 0) ||\r
- (av.alignment.getAlignmentAnnotation() == null) ||\r
- (av.alignment.getAlignmentAnnotation().length < 1))\r
- {\r
- repaint();\r
+ if (evt.getY() < height)\r
+ {\r
+ row = i;\r
\r
- return;\r
- }\r
+ break;\r
+ }\r
+ }\r
\r
- gg.copyArea(0, 0, imgWidth, getHeight(), -horizontal * av.charWidth, 0);\r
+ int res = (evt.getX() / av.getCharWidth()) + av.getStartRes();\r
\r
- int sr = av.startRes;\r
- int er = av.endRes + 1;\r
- int transX = 0;\r
+ if ((row > -1) && (res < aa[row].annotations.length) &&\r
+ (aa[row].annotations[res] != null))\r
+ {\r
+ this.setToolTipText(aa[row].annotations[res].description);\r
\r
- if (horizontal > 0) // scrollbar pulled right, image to the left\r
- {\r
- transX = (er - sr - horizontal) * av.charWidth;\r
- sr = er - horizontal;\r
+ StringBuffer text = new StringBuffer("Sequence position " +\r
+ (res + 1) + " " + aa[row].annotations[res].description);\r
+ ap.alignFrame.statusBar.setText(text.toString());\r
+ }\r
}\r
- else if (horizontal < 0)\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ */\r
+ public void mouseClicked(MouseEvent evt)\r
{\r
- er = sr - horizontal;\r
}\r
\r
- gg.translate(transX, 0);\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param g DOCUMENT ME!\r
+ */\r
+ public void paintComponent(Graphics g)\r
+ {\r
+ g.setColor(Color.white);\r
+ g.fillRect(0, 0, getWidth(), getHeight());\r
\r
- drawComponent(gg, sr, er);\r
+ if (fastPaint)\r
+ {\r
+ g.drawImage(image, 0, 0, this);\r
+ fastPaint = false;\r
\r
- gg.translate( -transX, 0);\r
+ return;\r
+ }\r
\r
- fastPaint = true;\r
- repaint();\r
- }\r
+ imgWidth = (av.endRes - av.startRes + 1) * av.charWidth;\r
\r
- public void drawComponent(Graphics2D g, int startRes, int endRes)\r
- {\r
- g.setColor(Color.white);\r
- g.fillRect(0, 0, (endRes - startRes) * av.charWidth, getHeight());\r
+ image = new BufferedImage(imgWidth, ap.annotationPanel.getHeight(),\r
+ BufferedImage.TYPE_INT_RGB);\r
+ gg = (Graphics2D) image.getGraphics();\r
+ gg.setRenderingHint(RenderingHints.KEY_ANTIALIASING,\r
+ RenderingHints.VALUE_ANTIALIAS_ON);\r
\r
- if ( (av.alignment.getAlignmentAnnotation() == null) ||\r
- (av.alignment.getAlignmentAnnotation().length < 1))\r
- {\r
- g.setColor(Color.white);\r
- g.fillRect(0, 0, getWidth(), getHeight());\r
- g.setColor(Color.black);\r
- g.drawString("Alignment has no annotations", 20, 15);\r
+ gg.setFont(av.getFont());\r
\r
- return;\r
+ drawComponent(gg, av.startRes, av.endRes + 1);\r
+ g.drawImage(image, 0, 0, this);\r
}\r
\r
- AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();\r
-\r
- int j;\r
- int x = 0;\r
- int y = 0;\r
- char[] lastSS = new char[aa.length];\r
- int[] lastSSX = new int[aa.length];\r
- int iconOffset = av.charHeight / 2;\r
- boolean validRes = false;\r
-\r
- //\u03B2 \u03B1\r
- for (int i = 0; i < aa.length; i++)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param horizontal DOCUMENT ME!\r
+ */\r
+ public void fastPaint(int horizontal)\r
{\r
- AlignmentAnnotation row = aa[i];\r
+ if ((horizontal == 0) ||\r
+ (av.alignment.getAlignmentAnnotation() == null) ||\r
+ (av.alignment.getAlignmentAnnotation().length < 1))\r
+ {\r
+ repaint();\r
\r
- if (!row.visible)\r
- {\r
- continue;\r
- }\r
+ return;\r
+ }\r
\r
- if (row.isGraph)\r
- {\r
- // this is so that we draw the characters below the graph\r
- y += row.height;\r
+ gg.copyArea(0, 0, imgWidth, getHeight(), -horizontal * av.charWidth, 0);\r
\r
- if (row.hasText)\r
- {\r
- y -= av.charHeight;\r
- }\r
- }\r
-\r
- if (row.hasText)\r
- {\r
- iconOffset = av.charHeight / 2;\r
- }\r
- else\r
- {\r
- iconOffset = 0;\r
- }\r
-\r
- for (j = startRes; j < endRes; j++)\r
- {\r
- if ( (row.annotations.length <= j) ||\r
- (row.annotations[j] == null))\r
+ int sr = av.startRes;\r
+ int er = av.endRes + 1;\r
+ int transX = 0;\r
+\r
+ if (horizontal > 0) // scrollbar pulled right, image to the left\r
{\r
- validRes = false;\r
+ transX = (er - sr - horizontal) * av.charWidth;\r
+ sr = er - horizontal;\r
}\r
- else\r
+ else if (horizontal < 0)\r
{\r
- validRes = true;\r
+ er = sr - horizontal;\r
}\r
\r
- x = (j - startRes) * av.charWidth;\r
+ gg.translate(transX, 0);\r
\r
- if (activeRow == i)\r
- {\r
- g.setColor(Color.red);\r
+ drawComponent(gg, sr, er);\r
\r
- if (activeRes != null)\r
- {\r
- for (int n = 0; n < activeRes.size(); n++)\r
- {\r
- int v = Integer.parseInt(activeRes.get(n).toString());\r
+ gg.translate(-transX, 0);\r
\r
- if (v == j)\r
- {\r
- g.fillRect( (j - startRes) * av.charWidth, y,\r
- av.charWidth, row.height);\r
- }\r
- }\r
- }\r
- }\r
+ fastPaint = true;\r
+ repaint();\r
+ }\r
\r
- if (validRes &&\r
- (row.annotations[j].displayCharacter.length() > 0))\r
- {\r
- int charOffset = (av.charWidth -\r
- fm.charWidth(row.annotations[j].displayCharacter.\r
- charAt(\r
- 0))) / 2;\r
- g.setColor(row.annotations[j].colour);\r
-\r
- if (j == 0)\r
- {\r
- g.drawString(row.annotations[j].displayCharacter,\r
- x, y + iconOffset + 2);\r
- }\r
- else if (\r
- ( (row.annotations[j - 1] == null) ||\r
- (row.annotations[j].displayCharacter != row.annotations[j -\r
- 1].displayCharacter)))\r
- {\r
- g.drawString(row.annotations[j].displayCharacter, x,\r
- y + iconOffset + 2);\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param g DOCUMENT ME!\r
+ * @param startRes DOCUMENT ME!\r
+ * @param endRes DOCUMENT ME!\r
+ */\r
+ public void drawComponent(Graphics2D g, int startRes, int endRes)\r
+ {\r
+ if(fm==null)\r
+ fm = g.getFontMetrics();\r
\r
- }\r
+ g.setColor(Color.white);\r
+ g.fillRect(0, 0, (endRes - startRes) * av.charWidth, getHeight());\r
\r
- if (row.hasIcons)\r
+ if ((av.alignment.getAlignmentAnnotation() == null) ||\r
+ (av.alignment.getAlignmentAnnotation().length < 1))\r
{\r
- if (!validRes ||\r
- (row.annotations[j].secondaryStructure != lastSS[i]))\r
- {\r
- switch (lastSS[i])\r
- {\r
- case 'H':\r
- g.setColor(HELIX_COLOUR);\r
- g.fillRoundRect(lastSSX[i], y + 4 + iconOffset,\r
- x - lastSSX[i], 7, 8, 8);\r
+ g.setColor(Color.white);\r
+ g.fillRect(0, 0, getWidth(), getHeight());\r
+ g.setColor(Color.black);\r
+ g.drawString("Alignment has no annotations", 20, 15);\r
\r
- break;\r
+ return;\r
+ }\r
\r
- case 'E':\r
- g.setColor(SHEET_COLOUR);\r
- g.fillRect(lastSSX[i], y + 4 + iconOffset,\r
- x - lastSSX[i] - 4, 7);\r
- g.fillPolygon(new int[]\r
- {x - 4, x - 4, x},\r
- new int[]\r
- {\r
- y + iconOffset, y + 14 + iconOffset,\r
- y + 8 + iconOffset\r
- }, 3);\r
+ AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();\r
\r
- break;\r
+ int j;\r
+ int x = 0;\r
+ int y = 0;\r
+ char[] lastSS = new char[aa.length];\r
+ int[] lastSSX = new int[aa.length];\r
+ int iconOffset = av.charHeight / 2;\r
+ boolean validRes = false;\r
\r
- case 'C':\r
- break;\r
+ //\u03B2 \u03B1\r
+ for (int i = 0; i < aa.length; i++)\r
+ {\r
+ AlignmentAnnotation row = aa[i];\r
\r
- default:\r
- g.setColor(Color.gray);\r
- g.fillRect(lastSSX[i], y + 6 + iconOffset,\r
- x - lastSSX[i], 2);\r
+ if (!row.visible)\r
+ {\r
+ continue;\r
+ }\r
\r
- break;\r
+ if (row.isGraph)\r
+ {\r
+ // this is so that we draw the characters below the graph\r
+ y += row.height;\r
+\r
+ if (row.hasText)\r
+ {\r
+ y -= av.charHeight;\r
+ }\r
}\r
\r
- if (validRes)\r
+ if (row.hasText)\r
{\r
- lastSS[i] = row.annotations[j].secondaryStructure;\r
+ iconOffset = av.charHeight / 2;\r
}\r
else\r
{\r
- lastSS[i] = ' ';\r
+ iconOffset = 0;\r
}\r
\r
- lastSSX[i] = x;\r
- }\r
- }\r
-\r
- if (validRes && row.isGraph)\r
- {\r
- g.setColor(new Color(0, 0, 180));\r
-\r
- int height = (int) ( (row.annotations[j].value / row.graphMax) *\r
- GRAPH_HEIGHT);\r
-\r
- if (row.windowLength > 1)\r
- {\r
- int total = 0;\r
-\r
- for (int i2 = j - (row.windowLength / 2);\r
- i2 < (j + (row.windowLength / 2)); i2++)\r
+ for (j = startRes; j < endRes; j++)\r
{\r
- if ( (i2 < 0) || (i2 >= av.alignment.getWidth()))\r
- {\r
- continue;\r
- }\r
+ if ((row.annotations.length <= j) ||\r
+ (row.annotations[j] == null))\r
+ {\r
+ validRes = false;\r
+ }\r
+ else\r
+ {\r
+ validRes = true;\r
+ }\r
+\r
+ x = (j - startRes) * av.charWidth;\r
+\r
+ if (activeRow == i)\r
+ {\r
+ g.setColor(Color.red);\r
+\r
+ if (activeRes != null)\r
+ {\r
+ for (int n = 0; n < activeRes.size(); n++)\r
+ {\r
+ int v = Integer.parseInt(activeRes.get(n).toString());\r
+\r
+ if (v == j)\r
+ {\r
+ g.fillRect((j - startRes) * av.charWidth, y,\r
+ av.charWidth, row.height);\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ if (validRes &&\r
+ (row.annotations[j].displayCharacter.length() > 0))\r
+ {\r
+ int charOffset = (av.charWidth -\r
+ fm.charWidth(row.annotations[j].displayCharacter.charAt(\r
+ 0))) / 2;\r
+ g.setColor(row.annotations[j].colour);\r
+\r
+ if (j == 0)\r
+ {\r
+ g.drawString(row.annotations[j].displayCharacter, x+charOffset,\r
+ y + iconOffset + 2);\r
+ }\r
+ else if (((row.annotations[j - 1] == null) ||\r
+ (row.annotations[j].displayCharacter != row.annotations[j -\r
+ 1].displayCharacter)))\r
+ {\r
+ g.drawString(row.annotations[j].displayCharacter, x+charOffset,\r
+ y + iconOffset + 2);\r
+ }\r
+ }\r
+\r
+ if (row.hasIcons)\r
+ {\r
+ if (!validRes ||\r
+ (row.annotations[j].secondaryStructure != lastSS[i]))\r
+ {\r
+ switch (lastSS[i])\r
+ {\r
+ case 'H':\r
+ g.setColor(HELIX_COLOUR);\r
+ g.fillRoundRect(lastSSX[i], y + 4 + iconOffset,\r
+ x - lastSSX[i], 7, 8, 8);\r
\r
- total += row.annotations[i2].value;\r
+ break;\r
+\r
+ case 'E':\r
+ g.setColor(SHEET_COLOUR);\r
+ g.fillRect(lastSSX[i], y + 4 + iconOffset,\r
+ x - lastSSX[i] - 4, 7);\r
+ g.fillPolygon(new int[] { x - 4, x - 4, x },\r
+ new int[]\r
+ {\r
+ y + iconOffset, y + 14 + iconOffset,\r
+ y + 8 + iconOffset\r
+ }, 3);\r
+\r
+ break;\r
+\r
+ case 'C':\r
+ break;\r
+\r
+ default:\r
+ g.setColor(Color.gray);\r
+ g.fillRect(lastSSX[i], y + 6 + iconOffset,\r
+ x - lastSSX[i], 2);\r
+\r
+ break;\r
+ }\r
+\r
+ if (validRes)\r
+ {\r
+ lastSS[i] = row.annotations[j].secondaryStructure;\r
+ }\r
+ else\r
+ {\r
+ lastSS[i] = ' ';\r
+ }\r
+\r
+ lastSSX[i] = x;\r
+ }\r
+ }\r
+\r
+ if (validRes && row.isGraph)\r
+ {\r
+ g.setColor(new Color(0, 0, 180));\r
+\r
+ int height = (int) ((row.annotations[j].value / row.graphMax) * GRAPH_HEIGHT);\r
+\r
+ if (row.windowLength > 1)\r
+ {\r
+ int total = 0;\r
+\r
+ for (int i2 = j - (row.windowLength / 2);\r
+ i2 < (j + (row.windowLength / 2)); i2++)\r
+ {\r
+ if ((i2 < 0) || (i2 >= av.alignment.getWidth()))\r
+ {\r
+ continue;\r
+ }\r
+\r
+ total += row.annotations[i2].value;\r
+ }\r
+\r
+ total /= row.windowLength;\r
+ height = (int) ((total / row.graphMax) * GRAPH_HEIGHT);\r
+ }\r
+\r
+ g.setColor(row.annotations[j].colour);\r
+ g.fillRect(x, y - height, av.charWidth, height);\r
+ }\r
}\r
\r
- total /= row.windowLength;\r
- height = (int) ( (total / row.graphMax) * GRAPH_HEIGHT);\r
- }\r
+ x += av.charWidth;\r
\r
- g.setColor(row.annotations[j].colour);\r
- g.fillRect(x, y - height, av.charWidth, height);\r
- }\r
- }\r
+ if (row.hasIcons)\r
+ {\r
+ switch (lastSS[i])\r
+ {\r
+ case 'H':\r
+ g.setColor(HELIX_COLOUR);\r
+ g.fillRoundRect(lastSSX[i], y + 4 + iconOffset,\r
+ x - lastSSX[i], 7, 8, 8);\r
+\r
+ break;\r
+\r
+ case 'E':\r
+ g.setColor(SHEET_COLOUR);\r
+ g.fillRect(lastSSX[i], y + 4 + iconOffset,\r
+ x - lastSSX[i] - 4, 7);\r
+ g.fillPolygon(new int[] { x - 4, x - 4, x },\r
+ new int[]\r
+ {\r
+ y + iconOffset, y + 14 + iconOffset,\r
+ y + 7 + iconOffset\r
+ }, 3);\r
+\r
+ break;\r
+\r
+ case 'C':\r
+ break;\r
+\r
+ default:\r
+ g.setColor(Color.gray);\r
+ g.fillRect(lastSSX[i], y + 6 + iconOffset, x - lastSSX[i], 2);\r
+\r
+ break;\r
+ }\r
+ }\r
\r
- x += av.charWidth;\r
+ if (row.isGraph && row.hasText)\r
+ {\r
+ y += av.charHeight;\r
+ }\r
\r
- if (row.hasIcons)\r
- {\r
- switch (lastSS[i])\r
- {\r
- case 'H':\r
- g.setColor(HELIX_COLOUR);\r
- g.fillRoundRect(lastSSX[i], y + 4 + iconOffset,\r
- x - lastSSX[i], 7, 8, 8);\r
-\r
- break;\r
-\r
- case 'E':\r
- g.setColor(SHEET_COLOUR);\r
- g.fillRect(lastSSX[i], y + 4 + iconOffset,\r
- x - lastSSX[i] - 4, 7);\r
- g.fillPolygon(new int[]\r
- {x - 4, x - 4, x},\r
- new int[]\r
- {\r
- y + iconOffset, y + 14 + iconOffset,\r
- y + 7 + iconOffset\r
- }, 3);\r
-\r
- break;\r
-\r
- case 'C':\r
- break;\r
-\r
- default:\r
- g.setColor(Color.gray);\r
- g.fillRect(lastSSX[i], y + 6 + iconOffset, x - lastSSX[i], 2);\r
-\r
- break;\r
+ if (!row.isGraph)\r
+ {\r
+ y += aa[i].height;\r
+ }\r
}\r
- }\r
-\r
- if (row.isGraph && row.hasText)\r
- {\r
- y += av.charHeight;\r
- }\r
-\r
- if (!row.isGraph)\r
- {\r
- y += aa[i].height;\r
- }\r
}\r
- }\r
\r
- // used by overview window\r
- public void drawGraph(Graphics g, AlignmentAnnotation aa, int width, int y)\r
- {\r
- g.setColor(Color.white);\r
- g.fillRect(0, 0, width, y);\r
- g.setColor(new Color(0, 0, 180));\r
+ // used by overview window\r
+ public void drawGraph(Graphics g, AlignmentAnnotation aa, int width, int y)\r
+ {\r
+ g.setColor(Color.white);\r
+ g.fillRect(0, 0, width, y);\r
+ g.setColor(new Color(0, 0, 180));\r
\r
- int x = 0;\r
+ int x = 0;\r
\r
- for (int j = 0; j < aa.annotations.length; j++)\r
- {\r
- g.setColor(new Color(0, 0, 180));\r
+ for (int j = 0; j < aa.annotations.length; j++)\r
+ {\r
+ g.setColor(new Color(0, 0, 180));\r
\r
- int height = (int) ( (aa.annotations[j].value / aa.graphMax) *\r
- GRAPH_HEIGHT);\r
- g.fillRect(x, y - height, av.charWidth, height);\r
- x += av.charWidth;\r
+ int height = (int) ((aa.annotations[j].value / aa.graphMax) * GRAPH_HEIGHT);\r
+ g.fillRect(x, y - height, av.charWidth, height);\r
+ x += av.charWidth;\r
+ }\r
}\r
- }\r
}\r
\r
import java.util.*;\r
\r
+\r
/**\r
* NOTE: Columns are zero based.\r
*/\r
public class ColumnSelection\r
{\r
- Vector selected = new Vector();\r
-\r
- public void addElement(int col)\r
- {\r
- if(!selected.contains(new Integer(col)))\r
- selected.addElement(new Integer(col));\r
- }\r
-\r
- public void clear()\r
- {\r
- selected.removeAllElements();\r
- }\r
-\r
- public void removeElement(int col)\r
- {\r
- Integer colInt = new Integer(col);\r
- if (selected.contains(colInt))\r
+ Vector selected = new Vector();\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param col DOCUMENT ME!\r
+ */\r
+ public void addElement(int col)\r
{\r
- selected.removeElement(colInt);\r
+ if (!selected.contains(new Integer(col)))\r
+ {\r
+ selected.addElement(new Integer(col));\r
+ }\r
}\r
- }\r
-\r
- public boolean contains(int col)\r
- {\r
- return selected.contains(new Integer(col));\r
- }\r
\r
- public int columnAt(int i)\r
- {\r
- return ( (Integer) selected.elementAt(i)).intValue();\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ public void clear()\r
+ {\r
+ selected.removeAllElements();\r
+ }\r
\r
- public int size()\r
- {\r
- return selected.size();\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param col DOCUMENT ME!\r
+ */\r
+ public void removeElement(int col)\r
+ {\r
+ Integer colInt = new Integer(col);\r
\r
- public int getMax()\r
- {\r
- int max = -1;\r
+ if (selected.contains(colInt))\r
+ {\r
+ selected.removeElement(colInt);\r
+ }\r
+ }\r
\r
- for (int i = 0; i < selected.size(); i++)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param col DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public boolean contains(int col)\r
{\r
- if (columnAt(i) > max)\r
- {\r
- max = columnAt(i);\r
- }\r
+ return selected.contains(new Integer(col));\r
}\r
\r
- return max;\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param i DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public int columnAt(int i)\r
+ {\r
+ return ((Integer) selected.elementAt(i)).intValue();\r
+ }\r
\r
- public int getMin()\r
- {\r
- int min = 1000000000;\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public int size()\r
+ {\r
+ return selected.size();\r
+ }\r
\r
- for (int i = 0; i < selected.size(); i++)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public int getMax()\r
{\r
- if (columnAt(i) < min)\r
- {\r
- min = columnAt(i);\r
- }\r
+ int max = -1;\r
+\r
+ for (int i = 0; i < selected.size(); i++)\r
+ {\r
+ if (columnAt(i) > max)\r
+ {\r
+ max = columnAt(i);\r
+ }\r
+ }\r
+\r
+ return max;\r
}\r
\r
- return min;\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public int getMin()\r
+ {\r
+ int min = 1000000000;\r
+\r
+ for (int i = 0; i < selected.size(); i++)\r
+ {\r
+ if (columnAt(i) < min)\r
+ {\r
+ min = columnAt(i);\r
+ }\r
+ }\r
\r
- public Vector asVector()\r
- {\r
- return selected;\r
- }\r
+ return min;\r
+ }\r
\r
- public void compensateForEdit(int start, int change)\r
- {\r
- for (int i = 0; i < size(); i++)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public Vector asVector()\r
{\r
- int temp = columnAt(i);\r
+ return selected;\r
+ }\r
\r
- if (temp >= start)\r
- {\r
- selected.setElementAt(new Integer(temp - change), i);\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param start DOCUMENT ME!\r
+ * @param change DOCUMENT ME!\r
+ */\r
+ public void compensateForEdit(int start, int change)\r
+ {\r
+ for (int i = 0; i < size(); i++)\r
+ {\r
+ int temp = columnAt(i);\r
+\r
+ if (temp >= start)\r
+ {\r
+ selected.setElementAt(new Integer(temp - change), i);\r
+ }\r
+ }\r
}\r
- }\r
}\r
*/\r
package jalview.gui;\r
\r
+import jalview.datamodel.*;\r
+\r
+import jalview.io.*;\r
+\r
+import jalview.jbgui.*;\r
+\r
import java.awt.*;\r
import java.awt.datatransfer.*;\r
import java.awt.event.*;\r
+\r
import javax.swing.*;\r
\r
-import jalview.datamodel.*;\r
-import jalview.io.*;\r
-import jalview.jbgui.*;\r
\r
-public class CutAndPasteTransfer\r
- extends GCutAndPasteTransfer\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class CutAndPasteTransfer extends GCutAndPasteTransfer\r
{\r
- public void setForInput()\r
- {\r
- getContentPane().add(inputButtonPanel, java.awt.BorderLayout.SOUTH);\r
- }\r
-\r
- public String getText()\r
- {\r
- return textarea.getText();\r
- }\r
-\r
- public void setText(String text)\r
- {\r
- textarea.setText(text);\r
- }\r
-\r
- public void copyItem_actionPerformed(ActionEvent e)\r
- {\r
- Clipboard c = Toolkit.getDefaultToolkit().getSystemClipboard();\r
- c.setContents(new StringSelection(textarea.getText()), null);\r
- }\r
-\r
- public void pasteMenu_actionPerformed(ActionEvent e)\r
- {\r
- Clipboard c = Toolkit.getDefaultToolkit().getSystemClipboard();\r
- Transferable contents = c.getContents(this);\r
-\r
- if (contents == null)\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ public void setForInput()\r
{\r
- return;\r
+ getContentPane().add(inputButtonPanel, java.awt.BorderLayout.SOUTH);\r
}\r
\r
- try\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public String getText()\r
{\r
- textarea.setText( (String) contents.getTransferData(\r
- DataFlavor.stringFlavor));\r
+ return textarea.getText();\r
}\r
- catch (Exception ex)\r
- {\r
- }\r
- }\r
-\r
- public void ok_actionPerformed(ActionEvent e)\r
- {\r
- String format = IdentifyFile.Identify(getText(), "Paste");\r
- SequenceI[] sequences = null;\r
\r
- if (FormatAdapter.formats.contains(format))\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param text DOCUMENT ME!\r
+ */\r
+ public void setText(String text)\r
{\r
- sequences = FormatAdapter.readFile(getText(), "Paste", format);\r
+ textarea.setText(text);\r
}\r
\r
- if (sequences != null)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void copyItem_actionPerformed(ActionEvent e)\r
{\r
- AlignFrame af = new AlignFrame(new Alignment(sequences));\r
- af.currentFileFormat = format;\r
- Desktop.addInternalFrame(af, "Cut & Paste input - " + format,\r
- AlignFrame.NEW_WINDOW_WIDTH,\r
- AlignFrame.NEW_WINDOW_HEIGHT);\r
- af.statusBar.setText("Successfully pasted alignment file");\r
-\r
- try\r
- {\r
- af.setMaximum(Preferences.showFullscreen);\r
- }\r
- catch (Exception ex)\r
- {\r
- }\r
-\r
- try\r
- {\r
- this.setClosed(true);\r
- }\r
- catch (Exception ex)\r
- {\r
- }\r
+ Clipboard c = Toolkit.getDefaultToolkit().getSystemClipboard();\r
+ c.setContents(new StringSelection(textarea.getText()), null);\r
}\r
- else\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void pasteMenu_actionPerformed(ActionEvent e)\r
{\r
- JOptionPane.showInternalMessageDialog(Desktop.desktop,\r
- "Couldn't read the pasted text.\n" +\r
- "Formats currently supported are\n" +\r
- "Fasta, MSF, Clustal, BLC, PIR, MSP, and PFAM",\r
- "Error parsing text",\r
- JOptionPane.WARNING_MESSAGE);\r
+ Clipboard c = Toolkit.getDefaultToolkit().getSystemClipboard();\r
+ Transferable contents = c.getContents(this);\r
+\r
+ if (contents == null)\r
+ {\r
+ return;\r
+ }\r
+\r
+ try\r
+ {\r
+ textarea.setText((String) contents.getTransferData(\r
+ DataFlavor.stringFlavor));\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ }\r
}\r
- }\r
\r
- public void cancel_actionPerformed(ActionEvent e)\r
- {\r
- try\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void ok_actionPerformed(ActionEvent e)\r
{\r
- this.setClosed(true);\r
+ String format = IdentifyFile.Identify(getText(), "Paste");\r
+ SequenceI[] sequences = null;\r
+\r
+ if (FormatAdapter.formats.contains(format))\r
+ {\r
+ sequences = FormatAdapter.readFile(getText(), "Paste", format);\r
+ }\r
+\r
+ if (sequences != null)\r
+ {\r
+ AlignFrame af = new AlignFrame(new Alignment(sequences));\r
+ af.currentFileFormat = format;\r
+ Desktop.addInternalFrame(af, "Cut & Paste input - " + format,\r
+ AlignFrame.NEW_WINDOW_WIDTH, AlignFrame.NEW_WINDOW_HEIGHT);\r
+ af.statusBar.setText("Successfully pasted alignment file");\r
+\r
+ try\r
+ {\r
+ af.setMaximum(Preferences.showFullscreen);\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ }\r
+\r
+ try\r
+ {\r
+ this.setClosed(true);\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ }\r
+ }\r
+ else\r
+ {\r
+ JOptionPane.showInternalMessageDialog(Desktop.desktop,\r
+ "Couldn't read the pasted text.\n" +\r
+ "Formats currently supported are\n" +\r
+ "Fasta, MSF, Clustal, BLC, PIR, MSP, and PFAM",\r
+ "Error parsing text", JOptionPane.WARNING_MESSAGE);\r
+ }\r
}\r
- catch (Exception ex)\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void cancel_actionPerformed(ActionEvent e)\r
{\r
+ try\r
+ {\r
+ this.setClosed(true);\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ }\r
}\r
- }\r
}\r
*/\r
package jalview.gui;\r
\r
+import jalview.datamodel.*;\r
+\r
+import jalview.io.*;\r
+\r
import java.awt.*;\r
import java.awt.datatransfer.*;\r
import java.awt.dnd.*;\r
import java.awt.event.*;\r
+\r
import javax.swing.*;\r
\r
-import jalview.datamodel.*;\r
-import jalview.io.*;\r
\r
-public class Desktop\r
- extends jalview.jbgui.GDesktop implements DropTargetListener\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class Desktop extends jalview.jbgui.GDesktop\r
+ implements DropTargetListener\r
{\r
- public static JDesktopPane desktop;\r
- static int openFrameCount = 0;\r
- static final int xOffset = 30;\r
- static final int yOffset = 30;\r
-\r
- public Desktop()\r
- {\r
- Image image = null;\r
-\r
- try\r
+ /** DOCUMENT ME!! */\r
+ public static JDesktopPane desktop;\r
+ static int openFrameCount = 0;\r
+ static final int xOffset = 30;\r
+ static final int yOffset = 30;\r
+\r
+ /**\r
+ * Creates a new Desktop object.\r
+ */\r
+ public Desktop()\r
{\r
- java.net.URL url = getClass().getResource("/images/logo.gif");\r
+ Image image = null;\r
+\r
+ try\r
+ {\r
+ java.net.URL url = getClass().getResource("/images/logo.gif");\r
\r
- if (url != null)\r
- {\r
- image = java.awt.Toolkit.getDefaultToolkit().createImage(url);\r
+ if (url != null)\r
+ {\r
+ image = java.awt.Toolkit.getDefaultToolkit().createImage(url);\r
\r
- MediaTracker mt = new MediaTracker(this);\r
- mt.addImage(image, 0);\r
- mt.waitForID(0);\r
- setIconImage(image);\r
- }\r
- }\r
- catch (Exception ex)\r
- {\r
- }\r
+ MediaTracker mt = new MediaTracker(this);\r
+ mt.addImage(image, 0);\r
+ mt.waitForID(0);\r
+ // setIconImage(image);\r
+ }\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ }\r
\r
- setTitle("Jalview 2005");\r
- setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\r
- desktop = new JDesktopPane();\r
- desktop.setBackground(Color.white);\r
- setContentPane(desktop);\r
- desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);\r
+ setTitle("Jalview 2005");\r
+ setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\r
+ desktop = new JDesktopPane();\r
+ desktop.setBackground(Color.white);\r
+ setContentPane(desktop);\r
+ desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);\r
\r
- // This line prevents Windows Look&Feel resizing all new windows to maximum\r
- // if previous window was maximised\r
- desktop.setDesktopManager(new DefaultDesktopManager());\r
+ // This line prevents Windows Look&Feel resizing all new windows to maximum\r
+ // if previous window was maximised\r
+ desktop.setDesktopManager(new DefaultDesktopManager());\r
\r
- Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();\r
- String x = jalview.bin.Cache.getProperty("SCREEN_X");\r
- String y = jalview.bin.Cache.getProperty("SCREEN_Y");\r
- String width = jalview.bin.Cache.getProperty("SCREEN_WIDTH");\r
- String height = jalview.bin.Cache.getProperty("SCREEN_HEIGHT");\r
+ Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();\r
+ String x = jalview.bin.Cache.getProperty("SCREEN_X");\r
+ String y = jalview.bin.Cache.getProperty("SCREEN_Y");\r
+ String width = jalview.bin.Cache.getProperty("SCREEN_WIDTH");\r
+ String height = jalview.bin.Cache.getProperty("SCREEN_HEIGHT");\r
\r
- if ( (x != null) && (y != null) && (width != null) && (height != null))\r
- {\r
- setBounds(Integer.parseInt(x), Integer.parseInt(y),\r
+ if ((x != null) && (y != null) && (width != null) && (height != null))\r
+ {\r
+ setBounds(Integer.parseInt(x), Integer.parseInt(y),\r
Integer.parseInt(width), Integer.parseInt(height));\r
- }\r
- else\r
- {\r
- setBounds( (int) (screenSize.width - 900) / 2,\r
+ }\r
+ else\r
+ {\r
+ setBounds((int) (screenSize.width - 900) / 2,\r
(int) (screenSize.height - 650) / 2, 900, 650);\r
- }\r
+ }\r
\r
- this.addWindowListener(new WindowAdapter()\r
- {\r
- public void windowClosing(WindowEvent evt)\r
- {\r
- quit();\r
- }\r
- });\r
- setVisible(true);\r
-\r
- this.setDropTarget(new java.awt.dnd.DropTarget(desktop, this));\r
-\r
- /////////Add a splashscreen on startup\r
- /////////Add a splashscreen on startup\r
- JInternalFrame frame = new JInternalFrame();\r
-\r
- SplashScreen splash = new SplashScreen(frame, image);\r
- frame.setContentPane(splash);\r
- frame.setLayer(JLayeredPane.PALETTE_LAYER);\r
- addInternalFrame(frame, "", 750, 160, false);\r
- frame.setLocation( (int) ( (getWidth() - 750) / 2),\r
- (int) ( (getHeight() - 160) / 2));\r
- }\r
-\r
- public static void addInternalFrame(final JInternalFrame frame,\r
- String title, int w, int h)\r
- {\r
- addInternalFrame(frame, title, w, h, true);\r
- }\r
-\r
- public static void addInternalFrame(final JInternalFrame frame,\r
- String title, int w, int h,\r
- boolean resizable)\r
- {\r
- desktop.add(frame);\r
- openFrameCount++;\r
-\r
- try\r
- {\r
- frame.setSelected(true);\r
+ this.addWindowListener(new WindowAdapter()\r
+ {\r
+ public void windowClosing(WindowEvent evt)\r
+ {\r
+ quit();\r
+ }\r
+ });\r
+\r
+ this.setDropTarget(new java.awt.dnd.DropTarget(desktop, this));\r
+\r
+ /////////Add a splashscreen on startup\r
+ /////////Add a splashscreen on startup\r
+ JInternalFrame frame = new JInternalFrame();\r
+\r
+ SplashScreen splash = new SplashScreen(frame, image);\r
+ frame.setContentPane(splash);\r
+ frame.setLayer(JLayeredPane.PALETTE_LAYER);\r
+ addInternalFrame(frame, "", 750, 160, false);\r
+ frame.setLocation((int) ((getWidth() - 750) / 2),\r
+ (int) ((getHeight() - 160) / 2));\r
}\r
- catch (java.beans.PropertyVetoException e)\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param frame DOCUMENT ME!\r
+ * @param title DOCUMENT ME!\r
+ * @param w DOCUMENT ME!\r
+ * @param h DOCUMENT ME!\r
+ */\r
+ public static void addInternalFrame(final JInternalFrame frame,\r
+ String title, int w, int h)\r
{\r
+ addInternalFrame(frame, title, w, h, true);\r
}\r
\r
- frame.setTitle(title);\r
- frame.setSize(w, h);\r
- frame.setClosable(true);\r
- frame.setResizable(resizable);\r
- frame.setMaximizable(resizable);\r
- frame.setIconifiable(resizable);\r
- frame.setFrameIcon(null);\r
- frame.setLocation(xOffset * openFrameCount, yOffset * openFrameCount);\r
- frame.toFront();\r
-\r
- final JMenuItem menuItem = new JMenuItem(title);\r
- frame.addInternalFrameListener(new javax.swing.event.InternalFrameAdapter()\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param frame DOCUMENT ME!\r
+ * @param title DOCUMENT ME!\r
+ * @param w DOCUMENT ME!\r
+ * @param h DOCUMENT ME!\r
+ * @param resizable DOCUMENT ME!\r
+ */\r
+ public static void addInternalFrame(final JInternalFrame frame,\r
+ String title, int w, int h, boolean resizable)\r
{\r
- public void internalFrameClosed(\r
- javax.swing.event.InternalFrameEvent evt)\r
- {\r
- openFrameCount--;\r
- windowMenu.remove(menuItem);\r
- }\r
- ;\r
- });\r
-\r
- menuItem.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
+ desktop.add(frame);\r
+ openFrameCount++;\r
+\r
try\r
{\r
- frame.setSelected(true);\r
- frame.setIcon(false);\r
+ frame.setSelected(true);\r
}\r
- catch (java.beans.PropertyVetoException ex)\r
+ catch (java.beans.PropertyVetoException e)\r
{\r
}\r
\r
- ;\r
- }\r
- });\r
-\r
- frame.setVisible(true);\r
- windowMenu.add(menuItem);\r
- }\r
-\r
- public void dragEnter(DropTargetDragEvent evt)\r
- {\r
- }\r
-\r
- public void dragExit(DropTargetEvent evt)\r
- {\r
- }\r
-\r
- public void dragOver(DropTargetDragEvent evt)\r
- {\r
- }\r
+ frame.setTitle(title);\r
+ frame.setSize(w, h);\r
+ frame.setClosable(true);\r
+ frame.setResizable(resizable);\r
+ frame.setMaximizable(resizable);\r
+ frame.setIconifiable(resizable);\r
+ frame.setFrameIcon(null);\r
+ frame.setLocation(xOffset * openFrameCount, yOffset * openFrameCount);\r
+ frame.toFront();\r
+\r
+ final JMenuItem menuItem = new JMenuItem(title);\r
+ frame.addInternalFrameListener(new javax.swing.event.InternalFrameAdapter()\r
+ {\r
+ public void internalFrameClosed(\r
+ javax.swing.event.InternalFrameEvent evt)\r
+ {\r
+ openFrameCount--;\r
+ windowMenu.remove(menuItem);\r
+ }\r
+ ;\r
+ });\r
+\r
+ menuItem.addActionListener(new ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ try\r
+ {\r
+ frame.setSelected(true);\r
+ frame.setIcon(false);\r
+ }\r
+ catch (java.beans.PropertyVetoException ex)\r
+ {\r
+ }\r
+\r
+ ;\r
+ }\r
+ });\r
+\r
+ frame.setVisible(true);\r
+ windowMenu.add(menuItem);\r
+ }\r
\r
- public void dropActionChanged(DropTargetDragEvent evt)\r
- {\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ */\r
+ public void dragEnter(DropTargetDragEvent evt)\r
+ {\r
+ }\r
\r
- public void drop(DropTargetDropEvent evt)\r
- {\r
- Transferable t = evt.getTransferable();\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ */\r
+ public void dragExit(DropTargetEvent evt)\r
+ {\r
+ }\r
\r
- if (!t.isDataFlavorSupported(DataFlavor.javaFileListFlavor))\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ */\r
+ public void dragOver(DropTargetDragEvent evt)\r
{\r
- return;\r
}\r
\r
- evt.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ */\r
+ public void dropActionChanged(DropTargetDragEvent evt)\r
+ {\r
+ }\r
\r
- try\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ */\r
+ public void drop(DropTargetDropEvent evt)\r
{\r
- java.util.List files = (java.util.List) t.getTransferData(DataFlavor.\r
- javaFileListFlavor);\r
+ Transferable t = evt.getTransferable();\r
\r
- for (int i = 0; i < files.size(); i++)\r
- {\r
- String file = files.get(i).toString();\r
- String protocol = "File";\r
+ if (!t.isDataFlavorSupported(DataFlavor.javaFileListFlavor))\r
+ {\r
+ return;\r
+ }\r
+\r
+ evt.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);\r
\r
- if (file.endsWith(".jar"))\r
+ try\r
{\r
- Jalview2XML.LoadJalviewAlign(file);\r
+ java.util.List files = (java.util.List) t.getTransferData(DataFlavor.javaFileListFlavor);\r
+\r
+ for (int i = 0; i < files.size(); i++)\r
+ {\r
+ String file = files.get(i).toString();\r
+ String protocol = "File";\r
+ String format = null;\r
+\r
+ if (file.endsWith(".jar"))\r
+ {\r
+ format = "Jalview";\r
+\r
+ }\r
+ else\r
+ {\r
+ format = jalview.io.IdentifyFile.Identify(file,\r
+ protocol);\r
+ }\r
+ LoadFile(file, protocol, format);\r
+ }\r
}\r
- else\r
+ catch (Exception ex)\r
{\r
- String format = jalview.io.IdentifyFile.Identify(file,\r
- protocol);\r
- LoadFile(file, protocol, format);\r
+ ex.printStackTrace();\r
}\r
- }\r
}\r
- catch (Exception ex)\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void inputLocalFileMenuItem_actionPerformed(ActionEvent e)\r
{\r
- ex.printStackTrace();\r
- }\r
- }\r
-\r
- public void inputLocalFileMenuItem_actionPerformed(ActionEvent e)\r
- {\r
- JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.\r
- getProperty(\r
- "LAST_DIRECTORY"),\r
- new String[]\r
+ JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.getProperty(\r
+ "LAST_DIRECTORY"),\r
+ new String[]\r
+ {\r
+ "fa, fasta, fastq", "aln", "pfam", "msf", "pir", "blc",\r
+ "jar"\r
+ },\r
+ new String[]\r
+ {\r
+ "Fasta", "Clustal", "PFAM", "MSF", "PIR", "BLC", "Jalview"\r
+ }, jalview.bin.Cache.getProperty("DEFAULT_FILE_FORMAT"));\r
+\r
+ chooser.setFileView(new JalviewFileView());\r
+ chooser.setDialogTitle("Open local file");\r
+ chooser.setToolTipText("Open");\r
+\r
+ int value = chooser.showOpenDialog(this);\r
+\r
+ if (value == JalviewFileChooser.APPROVE_OPTION)\r
{\r
- "fa, fasta, fastq", "aln", "pfam", "msf", "pir", "blc",\r
- "jar"\r
- },\r
- new String[]\r
- {\r
- "Fasta", "Clustal", "PFAM", "MSF", "PIR", "BLC", "Jalview"\r
- }, jalview.bin.Cache.getProperty("DEFAULT_FILE_FORMAT"));\r
-\r
- chooser.setFileView(new JalviewFileView());\r
- chooser.setDialogTitle("Open local file");\r
- chooser.setToolTipText("Open");\r
-\r
- int value = chooser.showOpenDialog(this);\r
+ String choice = chooser.getSelectedFile().getPath();\r
+ jalview.bin.Cache.setProperty("LAST_DIRECTORY",\r
+ chooser.getSelectedFile().getParent());\r
+\r
+ String format = null;\r
+ if (chooser.getSelectedFormat().equals("Jalview"))\r
+ {\r
+ format = "Jalview";\r
+ }\r
+ else\r
+ {\r
+ format = IdentifyFile.Identify(choice, "File");\r
+ }\r
+\r
+ jalview.bin.Cache.setProperty("DEFAULT_FILE_FORMAT", format);\r
+ LoadFile(choice, "File", format);\r
+ }\r
+ }\r
\r
- if (value == JalviewFileChooser.APPROVE_OPTION)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param file DOCUMENT ME!\r
+ * @param protocol DOCUMENT ME!\r
+ * @param format DOCUMENT ME!\r
+ */\r
+ public void LoadFile(String file, String protocol, String format)\r
{\r
- String choice = chooser.getSelectedFile().getPath();\r
- jalview.bin.Cache.setProperty("LAST_DIRECTORY",\r
- chooser.getSelectedFile().getParent());\r
-\r
- if (chooser.getSelectedFormat().equals("Jalview"))\r
- {\r
- jalview.bin.Cache.setProperty("DEFAULT_FILE_FORMAT", "Jalivew");\r
- Jalview2XML.LoadJalviewAlign(choice);\r
- }\r
- else\r
- {\r
- String format = IdentifyFile.Identify(choice, "File");\r
- jalview.bin.Cache.setProperty("DEFAULT_FILE_FORMAT", format);\r
- LoadFile(choice, "File", format);\r
- }\r
+ LoadingThread loader = new LoadingThread(file, protocol, format);\r
+ loader.start();\r
}\r
- }\r
-\r
- public void LoadFile(String file, String protocol, String format)\r
- {\r
- LoadingThread loader = new LoadingThread(file, protocol, format);\r
- loader.start();\r
- }\r
-\r
- public void inputURLMenuItem_actionPerformed(ActionEvent e)\r
- {\r
- String url = JOptionPane.showInternalInputDialog(Desktop.desktop,\r
- "Enter url of input file", "Input alignment from URL",\r
- JOptionPane.QUESTION_MESSAGE, null, null, "http://www.")\r
- .toString();\r
-\r
- if (url == null)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param file DOCUMENT ME!\r
+ * @param protocol DOCUMENT ME!\r
+ * @param format DOCUMENT ME!\r
+ */\r
+ public AlignFrame LoadFileWaitTillLoaded(String file, String protocol, String format)\r
{\r
- return;\r
- }\r
+ LoadingThread loader = new LoadingThread(file, protocol, format);\r
+ loader.start();\r
+\r
+ while (loader.isAlive())\r
+ {\r
+ try\r
+ {\r
+ Thread.sleep(50);\r
+ }\r
+ catch (Exception ex)\r
+ {}\r
+ }\r
\r
- String format = IdentifyFile.Identify(url, "URL");\r
+ return loader.af;\r
+ }\r
\r
- if (format.equals("URL NOT FOUND"))\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void inputURLMenuItem_actionPerformed(ActionEvent e)\r
{\r
- JOptionPane.showInternalMessageDialog(Desktop.desktop,\r
- "Couldn't locate " + url,\r
- "URL not found",\r
- JOptionPane.WARNING_MESSAGE);\r
+ String url = JOptionPane.showInternalInputDialog(Desktop.desktop,\r
+ "Enter url of input file", "Input alignment from URL",\r
+ JOptionPane.QUESTION_MESSAGE, null, null, "http://www.")\r
+ .toString();\r
+\r
+ if (url == null)\r
+ {\r
+ return;\r
+ }\r
+\r
+ if (url.trim().toLowerCase().endsWith(".jar"))\r
+ {\r
+ jalview.bin.Cache.setProperty("DEFAULT_FILE_FORMAT", "Jalview");\r
+ Jalview2XML.LoadJalviewAlign(url);\r
+ }\r
+ else\r
+ {\r
\r
- return;\r
+ String format = IdentifyFile.Identify(url, "URL");\r
+\r
+ if (format.equals("URL NOT FOUND"))\r
+ {\r
+ JOptionPane.showInternalMessageDialog(Desktop.desktop,\r
+ "Couldn't locate " + url,\r
+ "URL not found",\r
+ JOptionPane.WARNING_MESSAGE);\r
+\r
+ return;\r
+ }\r
+\r
+ LoadFile(url, "URL", format);\r
+ }\r
}\r
\r
- LoadFile(url, "URL", format);\r
- }\r
-\r
- public void inputTextboxMenuItem_actionPerformed(ActionEvent e)\r
- {\r
- CutAndPasteTransfer cap = new CutAndPasteTransfer();\r
- cap.setForInput();\r
- Desktop.addInternalFrame(cap, "Cut & Paste Alignment File", 600, 500);\r
- }\r
-\r
- /*\r
- * Exit the program\r
- */\r
- public void quit()\r
- {\r
- if (jalview.bin.Jalview.applet != null)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void inputTextboxMenuItem_actionPerformed(ActionEvent e)\r
{\r
- jalview.bin.Jalview.applet.destroy();\r
+ CutAndPasteTransfer cap = new CutAndPasteTransfer();\r
+ cap.setForInput();\r
+ Desktop.addInternalFrame(cap, "Cut & Paste Alignment File", 600, 500);\r
}\r
- else\r
+\r
+ /*\r
+ * Exit the program\r
+ */\r
+ public void quit()\r
{\r
- jalview.bin.Cache.setProperty("SCREEN_X", getBounds().x +\r
- "");\r
- jalview.bin.Cache.setProperty("SCREEN_Y", getBounds().y +\r
- "");\r
- jalview.bin.Cache.setProperty("SCREEN_WIDTH",\r
- getWidth() + "");\r
- jalview.bin.Cache.setProperty("SCREEN_HEIGHT",\r
- getHeight() + "");\r
- System.exit(0);\r
+ jalview.bin.Cache.setProperty("SCREEN_X", getBounds().x + "");\r
+ jalview.bin.Cache.setProperty("SCREEN_Y", getBounds().y + "");\r
+ jalview.bin.Cache.setProperty("SCREEN_WIDTH", getWidth() + "");\r
+ jalview.bin.Cache.setProperty("SCREEN_HEIGHT", getHeight() + "");\r
+ System.exit(0);\r
}\r
- }\r
-\r
- public void aboutMenuItem_actionPerformed(ActionEvent e)\r
- {\r
- JOptionPane.showInternalMessageDialog(Desktop.desktop,\r
- "JalView 2005 version " +\r
- jalview.bin.Cache.VERSION +\r
- "; last updated: " +\r
- jalview.bin.Cache.BUILD_DATE +\r
- "\nAuthors: Michele Clamp, James Cuff, Steve Searle, Andrew Waterhouse, Jim Procter & Geoff Barton." +\r
- "\nCurrent development managed by Andrew Waterhouse; Barton Group, University of Dundee." +\r
- "\nFor all issues relating to Jalview, email help@jalview.org" +\r
- "\n\nIf you use JalView, please cite:" +\r
- "\n\"Clamp, M., Cuff, J., Searle, S. M. and Barton, G. J. (2004), The Jalview Java Alignment Editor\"" +\r
- "\nBioinformatics, 2004 12;426-7.",\r
- "About Jalview",\r
- JOptionPane.INFORMATION_MESSAGE);\r
- }\r
-\r
- public void documentationMenuItem_actionPerformed(ActionEvent e)\r
- {\r
- try\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void aboutMenuItem_actionPerformed(ActionEvent e)\r
{\r
- ClassLoader cl = jalview.gui.Desktop.class.getClassLoader();\r
- java.net.URL url = javax.help.HelpSet.findHelpSet(cl, "help/help");\r
- javax.help.HelpSet hs = new javax.help.HelpSet(cl, url);\r
-\r
- javax.help.HelpBroker hb = hs.createHelpBroker();\r
- hb.setLocation(new Point(200, 50));\r
- hb.setSize(new Dimension(800, 700));\r
- hb.setCurrentID("home");\r
- hb.setDisplayed(true);\r
+ JOptionPane.showInternalMessageDialog(Desktop.desktop,\r
+ "JalView 2005 version " + jalview.bin.Cache.VERSION +\r
+ "; last updated: " + jalview.bin.Cache.BUILD_DATE +\r
+ "\nAuthors: Michele Clamp, James Cuff, Steve Searle, Andrew Waterhouse, Jim Procter & Geoff Barton." +\r
+ "\nCurrent development managed by Andrew Waterhouse; Barton Group, University of Dundee." +\r
+ "\nFor all issues relating to Jalview, email help@jalview.org" +\r
+ "\n\nIf you use JalView, please cite:" +\r
+ "\n\"Clamp, M., Cuff, J., Searle, S. M. and Barton, G. J. (2004), The Jalview Java Alignment Editor\"" +\r
+ "\nBioinformatics, 2004 12;426-7.", "About Jalview",\r
+ JOptionPane.INFORMATION_MESSAGE);\r
}\r
- catch (Exception ex)\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void documentationMenuItem_actionPerformed(ActionEvent e)\r
{\r
- ex.printStackTrace();\r
+ try\r
+ {\r
+ ClassLoader cl = jalview.gui.Desktop.class.getClassLoader();\r
+ java.net.URL url = javax.help.HelpSet.findHelpSet(cl, "help/help");\r
+ javax.help.HelpSet hs = new javax.help.HelpSet(cl, url);\r
+\r
+ javax.help.HelpBroker hb = hs.createHelpBroker();\r
+ hb.setLocation(new Point(200, 50));\r
+ hb.setSize(new Dimension(800, 700));\r
+ hb.setCurrentID("home");\r
+ hb.setDisplayed(true);\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ ex.printStackTrace();\r
+ }\r
}\r
- }\r
\r
- protected void preferences_actionPerformed(ActionEvent e)\r
- {\r
- Preferences pref = new Preferences();\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void preferences_actionPerformed(ActionEvent e)\r
+ {\r
+ new Preferences();\r
+ }\r
\r
- public void saveState_actionPerformed(ActionEvent e)\r
- {\r
- JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.\r
- getProperty(\r
- "LAST_DIRECTORY"), new String[]\r
- {"jar"},\r
- new String[]\r
- {"Jalview Project"}, "Jalview Project");\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void saveState_actionPerformed(ActionEvent e)\r
+ {\r
+ JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.getProperty(\r
+ "LAST_DIRECTORY"), new String[] { "jar" },\r
+ new String[] { "Jalview Project" }, "Jalview Project");\r
\r
- chooser.setFileView(new JalviewFileView());\r
- chooser.setDialogTitle("Save State");\r
+ chooser.setFileView(new JalviewFileView());\r
+ chooser.setDialogTitle("Save State");\r
\r
- int value = chooser.showSaveDialog(this);\r
+ int value = chooser.showSaveDialog(this);\r
\r
- if (value == JalviewFileChooser.APPROVE_OPTION)\r
- {\r
- java.io.File choice = chooser.getSelectedFile();\r
- jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice.getParent());\r
- Jalview2XML.SaveState(choice);\r
+ if (value == JalviewFileChooser.APPROVE_OPTION)\r
+ {\r
+ java.io.File choice = chooser.getSelectedFile();\r
+ jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice.getParent());\r
+ Jalview2XML.SaveState(choice);\r
+ }\r
}\r
- }\r
-\r
- public void loadState_actionPerformed(ActionEvent e)\r
- {\r
- JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.\r
- getProperty(\r
- "LAST_DIRECTORY"), new String[]\r
- {"jar"},\r
- new String[]\r
- {"Jalview Project"}, "Jalview Project");\r
- chooser.setFileView(new JalviewFileView());\r
- chooser.setDialogTitle("Restore state");\r
-\r
- int value = chooser.showOpenDialog(this);\r
-\r
- if (value == JalviewFileChooser.APPROVE_OPTION)\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void loadState_actionPerformed(ActionEvent e)\r
{\r
- String choice = chooser.getSelectedFile().getAbsolutePath();\r
- jalview.bin.Cache.setProperty("LAST_DIRECTORY",\r
- chooser.getSelectedFile().getParent());\r
- Jalview2XML.LoadJalviewAlign(choice);\r
- }\r
- }\r
+ JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.getProperty(\r
+ "LAST_DIRECTORY"), new String[] { "jar" },\r
+ new String[] { "Jalview Project" }, "Jalview Project");\r
+ chooser.setFileView(new JalviewFileView());\r
+ chooser.setDialogTitle("Restore state");\r
\r
- class LoadingThread\r
- extends Thread\r
- {\r
- String file;\r
- String protocol;\r
- String format;\r
+ int value = chooser.showOpenDialog(this);\r
\r
- public LoadingThread(String file, String protocol, String format)\r
- {\r
- this.file = file;\r
- this.protocol = protocol;\r
- this.format = format;\r
+ if (value == JalviewFileChooser.APPROVE_OPTION)\r
+ {\r
+ String choice = chooser.getSelectedFile().getAbsolutePath();\r
+ jalview.bin.Cache.setProperty("LAST_DIRECTORY",\r
+ chooser.getSelectedFile().getParent());\r
+ Jalview2XML.LoadJalviewAlign(choice);\r
+ }\r
}\r
\r
- public void run()\r
+ class LoadingThread extends Thread\r
{\r
- SequenceI[] sequences = null;\r
+ String file;\r
+ String protocol;\r
+ String format;\r
+ AlignFrame af;\r
\r
- if (FormatAdapter.formats.contains(format))\r
- {\r
- sequences = FormatAdapter.readFile(file, protocol, format);\r
- }\r
-\r
- if ( (sequences != null) && (sequences.length > 0))\r
- {\r
- AlignFrame af = new AlignFrame(new Alignment(sequences));\r
- addInternalFrame(af, file, AlignFrame.NEW_WINDOW_WIDTH,\r
- AlignFrame.NEW_WINDOW_HEIGHT);\r
- af.currentFileFormat = format;\r
- af.statusBar.setText("Successfully loaded file " + file);\r
-\r
- try\r
+ public LoadingThread(String file, String protocol, String format)\r
{\r
- af.setMaximum(Preferences.showFullscreen);\r
+ this.file = file;\r
+ this.protocol = protocol;\r
+ this.format = format;\r
}\r
- catch (Exception ex)\r
+\r
+ public void run()\r
{\r
+ SequenceI[] sequences = null;\r
+\r
+ if(format.equalsIgnoreCase("Jalview"))\r
+ {\r
+ Jalview2XML.LoadJalviewAlign(file);\r
+ }\r
+ else\r
+ {\r
+ if (FormatAdapter.formats.contains(format))\r
+ {\r
+ sequences = FormatAdapter.readFile(file, protocol, format);\r
+ }\r
+\r
+ if ( (sequences != null) && (sequences.length > 0))\r
+ {\r
+ af = new AlignFrame(new Alignment(sequences));\r
+ addInternalFrame(af, file, AlignFrame.NEW_WINDOW_WIDTH,\r
+ AlignFrame.NEW_WINDOW_HEIGHT);\r
+ af.currentFileFormat = format;\r
+ af.statusBar.setText("Successfully loaded file " + file);\r
+\r
+ try\r
+ {\r
+ af.setMaximum(Preferences.showFullscreen);\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ }\r
+ }\r
+ else\r
+ {\r
+ JOptionPane.showInternalMessageDialog(Desktop.desktop,\r
+ "Couldn't open file.\n" +\r
+ "Formats currently supported are\n" +\r
+ "Fasta, MSF, Clustal, BLC, PIR, MSP, and PFAM" // JBPNote - message should be generated through FormatAdapter!\r
+ , "Error loading file", JOptionPane.WARNING_MESSAGE);\r
+ }\r
+ }\r
}\r
- }\r
- else\r
- {\r
- JOptionPane.showInternalMessageDialog(Desktop.desktop,\r
- "Couldn't open file.\n" +\r
- "Formats currently supported are\n" +\r
- "Fasta, MSF, Clustal, BLC, PIR, MSP, and PFAM" // JBPNote - message should be generated through FormatAdapter!\r
- , "Error loading file",\r
- JOptionPane.WARNING_MESSAGE);\r
- }\r
}\r
- }\r
}\r
*/\r
package jalview.gui;\r
\r
-import java.util.*;\r
+import jalview.datamodel.*;\r
\r
import java.awt.*;\r
\r
-import jalview.datamodel.*;\r
+import java.util.*;\r
+\r
\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
public class FeatureRenderer\r
{\r
- AlignViewport av;\r
- SequenceGroup currentSequenceGroup = null;\r
- SequenceGroup[] allGroups = null;\r
- Color resBoxColour;\r
- Graphics graphics;\r
-\r
- public FeatureRenderer(AlignViewport av)\r
- {\r
- this.av = av;\r
- }\r
-\r
- public void drawSequence(Graphics g, SequenceI seq, SequenceGroup[] sg,\r
- int start, int end, int x1, int y1, int width,\r
- int height)\r
- {\r
- Vector features = seq.getSequenceFeatures();\r
- Enumeration e = features.elements();\r
-\r
- while (e.hasMoreElements())\r
+ AlignViewport av;\r
+ SequenceGroup currentSequenceGroup = null;\r
+ SequenceGroup[] allGroups = null;\r
+ Color resBoxColour;\r
+ Graphics graphics;\r
+\r
+ /**\r
+ * Creates a new FeatureRenderer object.\r
+ *\r
+ * @param av DOCUMENT ME!\r
+ */\r
+ public FeatureRenderer(AlignViewport av)\r
{\r
- SequenceFeature sf = (SequenceFeature) e.nextElement();\r
-\r
- if (sf.getStart() > seq.getEnd())\r
- {\r
- continue;\r
- }\r
-\r
- int fstart = seq.findIndex(sf.getStart()) - 1;\r
- int fend = seq.findIndex(sf.getEnd()) - 1;\r
+ this.av = av;\r
+ }\r
\r
- if ( ( (fstart <= end) && (fend >= start)))\r
- {\r
- if (fstart < start)\r
- { // fix for if the feature we have starts before the sequence start,\r
- fstart = start; // but the feature end is still valid!!\r
- }\r
- if(fend >=end)\r
- fend = end;\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param g DOCUMENT ME!\r
+ * @param seq DOCUMENT ME!\r
+ * @param sg DOCUMENT ME!\r
+ * @param start DOCUMENT ME!\r
+ * @param end DOCUMENT ME!\r
+ * @param x1 DOCUMENT ME!\r
+ * @param y1 DOCUMENT ME!\r
+ * @param width DOCUMENT ME!\r
+ * @param height DOCUMENT ME!\r
+ */\r
+ public void drawSequence(Graphics g, SequenceI seq, SequenceGroup[] sg,\r
+ int start, int end, int x1, int y1, int width, int height)\r
+ {\r
+ Vector features = seq.getSequenceFeatures();\r
+ Enumeration e = features.elements();\r
\r
- if (fstart == fend)\r
- {\r
- g.setColor(Color.red);\r
- g.fillRoundRect( (fstart - start) * width, y1, width,\r
- height, 4, 4);\r
- g.setColor(Color.white);\r
-\r
- char s = seq.getSequence().charAt(fstart);\r
- FontMetrics fm = g.getFontMetrics();\r
- int charOffset = (width - fm.charWidth(s)) / 2;\r
- int pady = height / 5;\r
- g.drawString(String.valueOf(s),\r
- charOffset + x1 + (width * (fstart - start)),\r
- (y1 + height) - pady);\r
- }\r
- else\r
+ while (e.hasMoreElements())\r
{\r
- for (int i = fstart; i <= fend; i++)\r
- {\r
- char s = seq.getSequence().charAt(i);\r
+ SequenceFeature sf = (SequenceFeature) e.nextElement();\r
\r
- if (jalview.util.Comparison.isGap(s))\r
+ if (sf.getStart() > seq.getEnd())\r
{\r
- continue;\r
+ continue;\r
}\r
\r
- g.setColor(Color.blue);\r
- g.fillRect( (i - start) * width, y1, width, height);\r
-\r
- g.setColor(Color.white);\r
+ int fstart = seq.findIndex(sf.getStart()) - 1;\r
+ int fend = seq.findIndex(sf.getEnd()) - 1;\r
\r
- FontMetrics fm = g.getFontMetrics();\r
- int charOffset = (width - fm.charWidth(s)) / 2;\r
- int pady = height / 5;\r
- g.drawString(String.valueOf(s),\r
- charOffset + x1 + (width * (i - start)),\r
- (y1 + height) - pady);\r
- }\r
+ if (((fstart <= end) && (fend >= start)))\r
+ {\r
+ if (fstart < start)\r
+ { // fix for if the feature we have starts before the sequence start,\r
+ fstart = start; // but the feature end is still valid!!\r
+ }\r
+\r
+ if (fend >= end)\r
+ {\r
+ fend = end;\r
+ }\r
+\r
+ if (fstart == fend)\r
+ {\r
+ g.setColor(Color.red);\r
+ g.fillRoundRect((fstart - start) * width, y1, width,\r
+ height, 4, 4);\r
+ g.setColor(Color.white);\r
+\r
+ char s = seq.getSequence().charAt(fstart);\r
+ FontMetrics fm = g.getFontMetrics();\r
+ int charOffset = (width - fm.charWidth(s)) / 2;\r
+ int pady = height / 5;\r
+ g.drawString(String.valueOf(s),\r
+ charOffset + x1 + (width * (fstart - start)),\r
+ (y1 + height) - pady);\r
+ }\r
+ else\r
+ {\r
+ for (int i = fstart; i <= fend; i++)\r
+ {\r
+ char s = seq.getSequence().charAt(i);\r
+\r
+ if (jalview.util.Comparison.isGap(s))\r
+ {\r
+ continue;\r
+ }\r
+\r
+ g.setColor(Color.blue);\r
+ g.fillRect((i - start) * width, y1, width, height);\r
+\r
+ g.setColor(Color.white);\r
+\r
+ FontMetrics fm = g.getFontMetrics();\r
+ int charOffset = (width - fm.charWidth(s)) / 2;\r
+ int pady = height / 5;\r
+ g.drawString(String.valueOf(s),\r
+ charOffset + x1 + (width * (i - start)),\r
+ (y1 + height) - pady);\r
+ }\r
+ }\r
+ }\r
}\r
- }\r
}\r
- }\r
}\r
*/\r
package jalview.gui;\r
\r
-import java.util.*;\r
+import jalview.datamodel.*;\r
+\r
+import jalview.jbgui.*;\r
\r
import java.awt.*;\r
import java.awt.event.*;\r
+\r
+import java.util.*;\r
+\r
import javax.swing.*;\r
import javax.swing.event.*;\r
\r
-import jalview.datamodel.*;\r
-import jalview.jbgui.*;\r
\r
-public class Finder\r
- extends GFinder\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class Finder extends GFinder\r
{\r
- AlignViewport av;\r
- AlignmentPanel ap;\r
- JInternalFrame frame;\r
- SuperGroup searchGroup;\r
- Vector searchResults;\r
- int seqIndex = 0;\r
- int resIndex = 0;\r
-\r
- public Finder(AlignViewport av, AlignmentPanel ap, JInternalFrame f)\r
- {\r
- this.av = av;\r
- this.ap = ap;\r
- frame = f;\r
-\r
- // all a big pain, but we need to wait until the frame is visible before the textfield can\r
- // obtain the focus/////////////////////////\r
- frame.addInternalFrameListener(new InternalFrameAdapter()\r
- {\r
- public void internalFrameOpened(InternalFrameEvent evt)\r
- {\r
- SwingUtilities.invokeLater(new Runnable()\r
- {\r
- public void run()\r
- {\r
- textfield.requestFocus();\r
- }\r
- });\r
- }\r
-\r
- public void internalFrameClosing(InternalFrameEvent evt)\r
- {\r
- cancel_actionPerformed(null);\r
- }\r
- });\r
- }\r
-\r
- public void textfield_actionPerformed(ActionEvent e)\r
- {\r
- doSearch(false);\r
- }\r
-\r
- public void findNext_actionPerformed(ActionEvent e)\r
- {\r
- doSearch(false);\r
- }\r
-\r
- public void findAll_actionPerformed(ActionEvent e)\r
- {\r
- resIndex = 0;\r
- seqIndex = 0;\r
- doSearch(true);\r
- }\r
-\r
- public void cancel_actionPerformed(ActionEvent e)\r
- {\r
- try\r
+ AlignViewport av;\r
+ AlignmentPanel ap;\r
+ JInternalFrame frame;\r
+ SuperGroup searchGroup;\r
+ Vector searchResults;\r
+ int seqIndex = 0;\r
+ int resIndex = 0;\r
+\r
+ /**\r
+ * Creates a new Finder object.\r
+ *\r
+ * @param av DOCUMENT ME!\r
+ * @param ap DOCUMENT ME!\r
+ * @param f DOCUMENT ME!\r
+ */\r
+ public Finder(AlignViewport av, AlignmentPanel ap, JInternalFrame f)\r
{\r
- // if allResults is null, this effectively switches displaySearch flag in seqCanvas\r
- ap.highlightSearchResults(null);\r
- ap.idPanel.highlightSearchResults(null);\r
-\r
- // frame.setClosed(true);\r
+ this.av = av;\r
+ this.ap = ap;\r
+ frame = f;\r
+\r
+ // all a big pain, but we need to wait until the frame is visible before the textfield can\r
+ // obtain the focus/////////////////////////\r
+ frame.addInternalFrameListener(new InternalFrameAdapter()\r
+ {\r
+ public void internalFrameOpened(InternalFrameEvent evt)\r
+ {\r
+ SwingUtilities.invokeLater(new Runnable()\r
+ {\r
+ public void run()\r
+ {\r
+ textfield.requestFocus();\r
+ }\r
+ });\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ */\r
+ public void internalFrameClosing(InternalFrameEvent evt)\r
+ {\r
+ cancel_actionPerformed(null);\r
+ }\r
+ });\r
}\r
- catch (Exception ex)\r
- {\r
- }\r
- }\r
-\r
- public void createNewGroup_actionPerformed(ActionEvent e)\r
- {\r
- Color[] newColors = new Color[24];\r
\r
- for (int i = 0; i < 24; i++)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void textfield_actionPerformed(ActionEvent e)\r
{\r
- newColors[i] = new Color(60, 160, 115);\r
+ doSearch(false);\r
}\r
\r
- jalview.schemes.UserColourScheme ucs = new jalview.schemes.UserColourScheme(\r
- newColors);\r
- String searchString = textfield.getText();\r
-\r
- searchGroup = new SuperGroup(searchString, ucs, true, true, false);\r
-\r
- for (int i = 0; i < searchResults.size(); i += 3)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void findNext_actionPerformed(ActionEvent e)\r
{\r
- // its possible edits may have occurred since search was performed\r
- // account for this here\r
- SequenceI seq = av.alignment.getSequenceAt(Integer.parseInt(\r
- searchResults.elementAt(i).toString()));\r
- int startRes = seq.findIndex(Integer.parseInt(\r
- searchResults.elementAt(i + 1).toString())) - 1;\r
- int endRes = seq.findIndex(Integer.parseInt(\r
- searchResults.elementAt(i + 2).toString())) - 1;\r
-\r
- SequenceGroup sg = new SequenceGroup(searchString, ucs, true, true,\r
- false, startRes, endRes);\r
- sg.addSequence(seq, false);\r
- av.alignment.addGroup(sg);\r
- searchGroup.addGroup(sg);\r
+ doSearch(false);\r
}\r
\r
- ap.av.alignment.addSuperGroup(searchGroup);\r
- ap.highlightSearchResults(null);\r
- }\r
-\r
- void doSearch(boolean findAll)\r
- {\r
- createNewGroup.setEnabled(false);\r
-\r
- String searchString = textfield.getText().toUpperCase();\r
-\r
- com.stevesoft.pat.Regex regex = new com.stevesoft.pat.Regex(searchString);\r
-\r
- searchResults = new Vector();\r
-\r
- int[] allResults = null;\r
-\r
- Sequence seq;\r
- String item = null;\r
- boolean found = false;\r
-\r
- ////// is the searchString a residue number?\r
- try\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void findAll_actionPerformed(ActionEvent e)\r
{\r
- int res = Integer.parseInt(searchString);\r
- found = true;\r
-\r
- if (av.getSelectionGroup().getSize() > 0)\r
- {\r
- seq = (Sequence) (av.getSelectionGroup().getSequenceAt(0));\r
- }\r
- else\r
- {\r
- seq = (Sequence) av.getAlignment().getSequenceAt(0);\r
- }\r
-\r
- searchResults.add(Integer.toString(av.getAlignment().findIndex(seq)));\r
- searchResults.add(Integer.toString(seq.findIndex(res) - 1));\r
- searchResults.add(Integer.toString(seq.findIndex(res) - 1));\r
+ resIndex = 0;\r
+ seqIndex = 0;\r
+ doSearch(true);\r
}\r
- catch (NumberFormatException ex)\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void cancel_actionPerformed(ActionEvent e)\r
{\r
- }\r
+ try\r
+ {\r
+ // if allResults is null, this effectively switches displaySearch flag in seqCanvas\r
+ ap.highlightSearchResults(null);\r
+ ap.idPanel.highlightSearchResults(null);\r
\r
- ///////////////////////////////////////////////\r
- Color[] newColors = new Color[24];\r
+ // frame.setClosed(true);\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ }\r
+ }\r
\r
- for (int i = 0; i < 24; i++)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void createNewGroup_actionPerformed(ActionEvent e)\r
{\r
- newColors[i] = new Color(60, 160, 115);\r
- }\r
+ Color[] newColors = new Color[24];\r
\r
- jalview.schemes.UserColourScheme ucs = new jalview.schemes.UserColourScheme(\r
- newColors);\r
+ for (int i = 0; i < 24; i++)\r
+ {\r
+ newColors[i] = new Color(60, 160, 115);\r
+ }\r
\r
- searchGroup = new SuperGroup(searchString, ucs, true, true, false);\r
+ jalview.schemes.UserColourScheme ucs = new jalview.schemes.UserColourScheme(newColors);\r
+ String searchString = textfield.getText();\r
\r
- int end = av.alignment.getHeight();\r
+ searchGroup = new SuperGroup(searchString, ucs, true, true, false);\r
\r
- SequenceGroup selection = av.getSelectionGroup();\r
+ for (int i = 0; i < searchResults.size(); i += 3)\r
+ {\r
+ // its possible edits may have occurred since search was performed\r
+ // account for this here\r
+ SequenceI seq = av.alignment.getSequenceAt(Integer.parseInt(\r
+ searchResults.elementAt(i).toString()));\r
+ int startRes = seq.findIndex(Integer.parseInt(\r
+ searchResults.elementAt(i + 1).toString())) - 1;\r
+ int endRes = seq.findIndex(Integer.parseInt(\r
+ searchResults.elementAt(i + 2).toString())) - 1;\r
+\r
+ SequenceGroup sg = new SequenceGroup(searchString, ucs, true, true,\r
+ false, startRes, endRes);\r
+ sg.addSequence(seq, false);\r
+ av.alignment.addGroup(sg);\r
+ searchGroup.addGroup(sg);\r
+ }\r
\r
- if (selection != null)\r
- {\r
- if ( (selection.getSize() < 1) ||\r
- ( (selection.getEndRes() - selection.getStartRes()) < 2))\r
- {\r
- selection = null;\r
- }\r
+ ap.av.alignment.addSuperGroup(searchGroup);\r
+ ap.highlightSearchResults(null);\r
}\r
\r
- while (!found && (seqIndex < end))\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param findAll DOCUMENT ME!\r
+ */\r
+ void doSearch(boolean findAll)\r
{\r
- seq = (Sequence) av.alignment.getSequenceAt(seqIndex);\r
+ createNewGroup.setEnabled(false);\r
\r
- if ( (selection != null) && !selection.sequences.contains(seq))\r
- {\r
- seqIndex++;\r
- resIndex = 0;\r
+ String searchString = textfield.getText().toUpperCase();\r
\r
- continue;\r
- }\r
+ com.stevesoft.pat.Regex regex = new com.stevesoft.pat.Regex(searchString);\r
\r
- item = seq.getSequence().toUpperCase();\r
+ searchResults = new Vector();\r
\r
- if ( (selection != null) &&\r
- (selection.getEndRes() < av.alignment.getWidth()))\r
- {\r
- item = item.substring(0, selection.getEndRes() + 1);\r
- }\r
+ int[] allResults = null;\r
\r
- ///Shall we ignore gaps????\r
- StringBuffer noGaps = new StringBuffer();\r
- int insertCount = 0;\r
- Vector spaces = new Vector();\r
+ Sequence seq;\r
+ String item = null;\r
+ boolean found = false;\r
\r
- for (int j = 0; j < item.length(); j++)\r
- {\r
- if (!jalview.util.Comparison.isGap(item.charAt(j)))\r
+ ////// is the searchString a residue number?\r
+ try\r
{\r
- noGaps.append(item.charAt(j));\r
- spaces.add(new Integer(insertCount));\r
+ int res = Integer.parseInt(searchString);\r
+ found = true;\r
+\r
+ if (av.getSelectionGroup().getSize() > 0)\r
+ {\r
+ seq = (Sequence) (av.getSelectionGroup().getSequenceAt(0));\r
+ }\r
+ else\r
+ {\r
+ seq = (Sequence) av.getAlignment().getSequenceAt(0);\r
+ }\r
+\r
+ searchResults.add(Integer.toString(av.getAlignment().findIndex(seq)));\r
+ searchResults.add(Integer.toString(seq.findIndex(res) - 1));\r
+ searchResults.add(Integer.toString(seq.findIndex(res) - 1));\r
}\r
- else\r
+ catch (NumberFormatException ex)\r
{\r
- insertCount++;\r
}\r
- }\r
\r
- for (int r = resIndex; r < noGaps.length(); r++)\r
- {\r
- if (regex.searchFrom(noGaps.toString(), r))\r
+ ///////////////////////////////////////////////\r
+ Color[] newColors = new Color[24];\r
+\r
+ for (int i = 0; i < 24; i++)\r
{\r
- resIndex = regex.matchedFrom();\r
-\r
- if ( (selection != null) &&\r
- ( (resIndex +\r
- Integer.parseInt(spaces.get(resIndex).toString())) <\r
- selection.getStartRes()))\r
- {\r
- continue;\r
- }\r
-\r
- searchResults.add(Integer.toString(seqIndex));\r
-\r
- int sres = seq.findPosition(resIndex +\r
- Integer.parseInt(spaces.elementAt(\r
- resIndex)\r
- .toString()));\r
- int eres = seq.findPosition(regex.matchedTo() - 1 +\r
- Integer.parseInt(spaces.elementAt(regex.\r
- matchedTo() -\r
- 1).toString()));\r
-\r
- searchResults.addElement(sres + "");\r
- searchResults.addElement(eres + "");\r
-\r
- if (!findAll)\r
- {\r
- // thats enough, break and display the result\r
- found = true;\r
- resIndex++;\r
+ newColors[i] = new Color(60, 160, 115);\r
+ }\r
+\r
+ jalview.schemes.UserColourScheme ucs = new jalview.schemes.UserColourScheme(newColors);\r
\r
- break;\r
- }\r
+ searchGroup = new SuperGroup(searchString, ucs, true, true, false);\r
\r
- r = resIndex;\r
+ int end = av.alignment.getHeight();\r
+\r
+ SequenceGroup selection = av.getSelectionGroup();\r
+\r
+ if (selection != null)\r
+ {\r
+ if ((selection.getSize() < 1) ||\r
+ ((selection.getEndRes() - selection.getStartRes()) < 2))\r
+ {\r
+ selection = null;\r
+ }\r
}\r
- }\r
\r
- if (!found)\r
- {\r
- seqIndex++;\r
- resIndex = 0;\r
- }\r
- }\r
+ while (!found && (seqIndex < end))\r
+ {\r
+ seq = (Sequence) av.alignment.getSequenceAt(seqIndex);\r
+\r
+ if ((selection != null) && !selection.sequences.contains(seq))\r
+ {\r
+ seqIndex++;\r
+ resIndex = 0;\r
+\r
+ continue;\r
+ }\r
+\r
+ item = seq.getSequence().toUpperCase();\r
+\r
+ if ((selection != null) &&\r
+ (selection.getEndRes() < av.alignment.getWidth()))\r
+ {\r
+ item = item.substring(0, selection.getEndRes() + 1);\r
+ }\r
+\r
+ ///Shall we ignore gaps????\r
+ StringBuffer noGaps = new StringBuffer();\r
+ int insertCount = 0;\r
+ Vector spaces = new Vector();\r
+\r
+ for (int j = 0; j < item.length(); j++)\r
+ {\r
+ if (!jalview.util.Comparison.isGap(item.charAt(j)))\r
+ {\r
+ noGaps.append(item.charAt(j));\r
+ spaces.add(new Integer(insertCount));\r
+ }\r
+ else\r
+ {\r
+ insertCount++;\r
+ }\r
+ }\r
+\r
+ for (int r = resIndex; r < noGaps.length(); r++)\r
+ {\r
+ if (regex.searchFrom(noGaps.toString(), r))\r
+ {\r
+ resIndex = regex.matchedFrom();\r
+\r
+ if ((selection != null) &&\r
+ ((resIndex +\r
+ Integer.parseInt(spaces.get(resIndex).toString())) < selection.getStartRes()))\r
+ {\r
+ continue;\r
+ }\r
+\r
+ searchResults.add(Integer.toString(seqIndex));\r
+\r
+ int sres = seq.findPosition(resIndex +\r
+ Integer.parseInt(spaces.elementAt(resIndex)\r
+ .toString()));\r
+ int eres = seq.findPosition(regex.matchedTo() - 1 +\r
+ Integer.parseInt(spaces.elementAt(regex.matchedTo() -\r
+ 1).toString()));\r
+\r
+ searchResults.addElement(sres + "");\r
+ searchResults.addElement(eres + "");\r
+\r
+ if (!findAll)\r
+ {\r
+ // thats enough, break and display the result\r
+ found = true;\r
+ resIndex++;\r
+\r
+ break;\r
+ }\r
+\r
+ r = resIndex;\r
+ }\r
+ }\r
+\r
+ if (!found)\r
+ {\r
+ seqIndex++;\r
+ resIndex = 0;\r
+ }\r
+ }\r
\r
- Vector idMatch = new Vector();\r
+ Vector idMatch = new Vector();\r
\r
- for (int id = 0; id < av.alignment.getHeight(); id++)\r
- {\r
- if (regex.search(av.alignment.getSequenceAt(id).getName()))\r
- {\r
- idMatch.add(av.alignment.getSequenceAt(id));\r
- }\r
- }\r
+ for (int id = 0; id < av.alignment.getHeight(); id++)\r
+ {\r
+ if (regex.search(av.alignment.getSequenceAt(id).getName()))\r
+ {\r
+ idMatch.add(av.alignment.getSequenceAt(id));\r
+ }\r
+ }\r
\r
- if ( (searchResults.size() == 0) && (idMatch.size() > 0))\r
- {\r
- ap.idPanel.highlightSearchResults(idMatch);\r
- }\r
+ if ((searchResults.size() == 0) && (idMatch.size() > 0))\r
+ {\r
+ ap.idPanel.highlightSearchResults(idMatch);\r
+ }\r
\r
- if (searchResults.size() > 0)\r
- {\r
- allResults = new int[searchResults.size()];\r
+ if (searchResults.size() > 0)\r
+ {\r
+ allResults = new int[searchResults.size()];\r
\r
- for (int i = 0; i < searchResults.size(); i++)\r
- {\r
- allResults[i] = Integer.parseInt(searchResults.get(i).toString());\r
- }\r
+ for (int i = 0; i < searchResults.size(); i++)\r
+ {\r
+ allResults[i] = Integer.parseInt(searchResults.get(i).toString());\r
+ }\r
\r
- createNewGroup.setEnabled(true);\r
- }\r
- else\r
- {\r
- JOptionPane.showInternalMessageDialog(this, "Finished searching",\r
- null,\r
- JOptionPane.INFORMATION_MESSAGE);\r
- resIndex = 0;\r
- seqIndex = 0;\r
- }\r
+ createNewGroup.setEnabled(true);\r
+ }\r
+ else\r
+ {\r
+ JOptionPane.showInternalMessageDialog(this, "Finished searching",\r
+ null, JOptionPane.INFORMATION_MESSAGE);\r
+ resIndex = 0;\r
+ seqIndex = 0;\r
+ }\r
\r
- // if allResults is null, this effectively switches displaySearch flag in seqCanvas\r
- ap.highlightSearchResults(allResults);\r
+ // if allResults is null, this effectively switches displaySearch flag in seqCanvas\r
+ ap.highlightSearchResults(allResults);\r
\r
- if (findAll)\r
- {\r
- String message = (searchResults.size() / 3) + " matches found.";\r
- JOptionPane.showInternalMessageDialog(this, message, null,\r
- JOptionPane.INFORMATION_MESSAGE);\r
+ if (findAll)\r
+ {\r
+ String message = (searchResults.size() / 3) + " matches found.";\r
+ JOptionPane.showInternalMessageDialog(this, message, null,\r
+ JOptionPane.INFORMATION_MESSAGE);\r
+ }\r
}\r
- }\r
}\r
*/\r
package jalview.gui;\r
\r
+import jalview.bin.*;\r
+\r
+import jalview.jbgui.*;\r
+\r
import java.awt.*;\r
import java.awt.event.*;\r
+\r
import javax.swing.*;\r
\r
-import jalview.bin.*;\r
-import jalview.jbgui.*;\r
\r
-public class FontChooser\r
- extends GFontChooser\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class FontChooser extends GFontChooser\r
{\r
- AlignmentPanel ap;\r
- Font oldFont;\r
- boolean init = true;\r
- JInternalFrame frame;\r
-\r
- public FontChooser(AlignmentPanel ap)\r
- {\r
- frame = new JInternalFrame();\r
- frame.setContentPane(this);\r
- Desktop.addInternalFrame(frame, "Change Font", 480, 100, false);\r
- frame.setLayer(JLayeredPane.PALETTE_LAYER);\r
-\r
- this.ap = ap;\r
+ AlignmentPanel ap;\r
+ Font oldFont;\r
+ boolean init = true;\r
+ JInternalFrame frame;\r
+\r
+ /**\r
+ * Creates a new FontChooser object.\r
+ *\r
+ * @param ap DOCUMENT ME!\r
+ */\r
+ public FontChooser(AlignmentPanel ap)\r
+ {\r
+ frame = new JInternalFrame();\r
+ frame.setContentPane(this);\r
+ Desktop.addInternalFrame(frame, "Change Font", 480, 100, false);\r
+ frame.setLayer(JLayeredPane.PALETTE_LAYER);\r
\r
- String[] fonts = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment()\r
- .getAvailableFontFamilyNames();\r
+ this.ap = ap;\r
\r
- for (int i = 0; i < fonts.length; i++)\r
- {\r
- fontName.addItem(fonts[i]);\r
- }\r
+ String[] fonts = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment()\r
+ .getAvailableFontFamilyNames();\r
\r
- for (int i = 1; i < 31; i++)\r
- {\r
- fontSize.addItem(i + "");\r
- }\r
+ for (int i = 0; i < fonts.length; i++)\r
+ {\r
+ fontName.addItem(fonts[i]);\r
+ }\r
\r
- fontStyle.addItem("plain");\r
- fontStyle.addItem("bold");\r
- fontStyle.addItem("italic");\r
+ for (int i = 1; i < 31; i++)\r
+ {\r
+ fontSize.addItem(i + "");\r
+ }\r
\r
- oldFont = ap.av.getFont();\r
- fontName.setSelectedItem(oldFont.getName());\r
- fontSize.setSelectedItem(oldFont.getSize() + "");\r
- fontStyle.setSelectedIndex(oldFont.getStyle());\r
+ fontStyle.addItem("plain");\r
+ fontStyle.addItem("bold");\r
+ fontStyle.addItem("italic");\r
\r
- init = false;\r
- }\r
+ oldFont = ap.av.getFont();\r
+ fontName.setSelectedItem(oldFont.getName());\r
+ fontSize.setSelectedItem(oldFont.getSize() + "");\r
+ fontStyle.setSelectedIndex(oldFont.getStyle());\r
\r
- protected void ok_actionPerformed(ActionEvent e)\r
- {\r
- try\r
- {\r
- frame.setClosed(true);\r
+ init = false;\r
}\r
- catch (Exception ex)\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void ok_actionPerformed(ActionEvent e)\r
{\r
+ try\r
+ {\r
+ frame.setClosed(true);\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ }\r
+\r
+ if (ap.getOverviewPanel() != null)\r
+ {\r
+ ap.getOverviewPanel().updateOverviewImage();\r
+ }\r
}\r
\r
- if (ap.getOverviewPanel() != null)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void cancel_actionPerformed(ActionEvent e)\r
{\r
- ap.getOverviewPanel().updateOverviewImage();\r
+ ap.av.setFont(oldFont);\r
+ ap.repaint();\r
+ fontName.setSelectedItem(oldFont.getName());\r
+ fontSize.setSelectedItem(oldFont.getSize() + "");\r
+ fontStyle.setSelectedIndex(oldFont.getStyle());\r
+\r
+ try\r
+ {\r
+ frame.setClosed(true);\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ }\r
}\r
- }\r
\r
- protected void cancel_actionPerformed(ActionEvent e)\r
- {\r
- ap.av.setFont(oldFont);\r
- ap.repaint();\r
- fontName.setSelectedItem(oldFont.getName());\r
- fontSize.setSelectedItem(oldFont.getSize() + "");\r
- fontStyle.setSelectedIndex(oldFont.getStyle());\r
-\r
- try\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ void changeFont()\r
{\r
- frame.setClosed(true);\r
+ Font newFont = new Font(fontName.getSelectedItem().toString(),\r
+ fontStyle.getSelectedIndex(),\r
+ Integer.parseInt(fontSize.getSelectedItem().toString()));\r
+ ap.av.setFont(newFont);\r
+ ap.fontChanged();\r
}\r
- catch (Exception ex)\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void fontName_actionPerformed(ActionEvent e)\r
{\r
+ if (init)\r
+ {\r
+ return;\r
+ }\r
+\r
+ changeFont();\r
}\r
- }\r
-\r
- void changeFont()\r
- {\r
- Font newFont = new Font(fontName.getSelectedItem().toString(),\r
- fontStyle.getSelectedIndex(),\r
- Integer.parseInt(fontSize.getSelectedItem().\r
- toString()));\r
- ap.av.setFont(newFont);\r
- ap.fontChanged();\r
- }\r
-\r
- protected void fontName_actionPerformed(ActionEvent e)\r
- {\r
- if (init)\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void fontSize_actionPerformed(ActionEvent e)\r
{\r
- return;\r
- }\r
+ if (init)\r
+ {\r
+ return;\r
+ }\r
\r
- changeFont();\r
- }\r
+ changeFont();\r
+ }\r
\r
- protected void fontSize_actionPerformed(ActionEvent e)\r
- {\r
- if (init)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void fontStyle_actionPerformed(ActionEvent e)\r
{\r
- return;\r
- }\r
+ if (init)\r
+ {\r
+ return;\r
+ }\r
\r
- changeFont();\r
- }\r
+ changeFont();\r
+ }\r
\r
- protected void fontStyle_actionPerformed(ActionEvent e)\r
- {\r
- if (init)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void defaultButton_actionPerformed(ActionEvent e)\r
{\r
- return;\r
+ Cache.setProperty("FONT_NAME", fontName.getSelectedItem().toString());\r
+ Cache.setProperty("FONT_STYLE", fontStyle.getSelectedIndex() + "");\r
+ Cache.setProperty("FONT_SIZE", fontSize.getSelectedItem().toString());\r
}\r
-\r
- changeFont();\r
- }\r
-\r
- public void defaultButton_actionPerformed(ActionEvent e)\r
- {\r
- Cache.setProperty("FONT_NAME", fontName.getSelectedItem().toString());\r
- Cache.setProperty("FONT_STYLE", fontStyle.getSelectedIndex() + "");\r
- Cache.setProperty("FONT_SIZE", fontSize.getSelectedItem().toString());\r
- }\r
}\r
*/\r
package jalview.gui;\r
\r
+import jalview.analysis.*;\r
+\r
+import jalview.datamodel.*;\r
+\r
import java.awt.*;\r
import java.awt.image.*;\r
+\r
import javax.swing.*;\r
\r
-import jalview.analysis.*;\r
-import jalview.datamodel.*;\r
\r
-public class IdCanvas\r
- extends JPanel\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class IdCanvas extends JPanel\r
{\r
- protected AlignViewport av;\r
- protected boolean showScores = true;\r
- protected int maxIdLength = -1;\r
- protected String maxIdStr = null;\r
- BufferedImage image;\r
- Graphics2D gg;\r
- int imgHeight = 0;\r
- boolean fastPaint = false;\r
- java.util.Vector searchResults;\r
-\r
- public IdCanvas(AlignViewport av)\r
- {\r
- setLayout(new BorderLayout());\r
- this.av = av;\r
- PaintRefresher.Register(this, av.alignment);\r
- }\r
-\r
- public void drawIdString(Graphics2D gg, SequenceI s, int i, int starty,\r
- int ypos)\r
- {\r
- int charHeight = av.getCharHeight();\r
-\r
- if ( (searchResults != null) && searchResults.contains(s))\r
+ protected AlignViewport av;\r
+ protected boolean showScores = true;\r
+ protected int maxIdLength = -1;\r
+ protected String maxIdStr = null;\r
+ BufferedImage image;\r
+ Graphics2D gg;\r
+ int imgHeight = 0;\r
+ boolean fastPaint = false;\r
+ java.util.Vector searchResults;\r
+\r
+ /**\r
+ * Creates a new IdCanvas object.\r
+ *\r
+ * @param av DOCUMENT ME!\r
+ */\r
+ public IdCanvas(AlignViewport av)\r
{\r
- gg.setColor(Color.black);\r
- gg.fillRect(0,\r
- AlignmentUtil.getPixelHeight(starty, i, charHeight) + ypos,\r
- getWidth(), charHeight);\r
- gg.setColor(Color.white);\r
- }\r
- else if ( (av.getSelectionGroup() != null) &&\r
- av.getSelectionGroup().sequences.contains(s))\r
- {\r
- gg.setColor(Color.lightGray);\r
- gg.fillRect(0,\r
- AlignmentUtil.getPixelHeight(starty, i, charHeight) + ypos,\r
- getWidth(), charHeight);\r
- gg.setColor(Color.white);\r
- }\r
- else\r
- {\r
- gg.setColor(s.getColor());\r
- gg.fillRect(0,\r
- AlignmentUtil.getPixelHeight(starty, i, charHeight) + ypos,\r
- getWidth(), charHeight);\r
- gg.setColor(Color.black);\r
+ setLayout(new BorderLayout());\r
+ this.av = av;\r
+ PaintRefresher.Register(this, av.alignment);\r
}\r
\r
- String string = s.getName();\r
-\r
- if (av.getShowFullId())\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param gg DOCUMENT ME!\r
+ * @param s DOCUMENT ME!\r
+ * @param i DOCUMENT ME!\r
+ * @param starty DOCUMENT ME!\r
+ * @param ypos DOCUMENT ME!\r
+ */\r
+ public void drawIdString(Graphics2D gg, SequenceI s, int i, int starty,\r
+ int ypos)\r
{\r
- string = s.getDisplayId();\r
- }\r
+ int charHeight = av.charHeight;\r
\r
- gg.drawString(string, 0,\r
- (AlignmentUtil.getPixelHeight(starty, i, charHeight) + ypos +\r
- charHeight) - (charHeight / 5));\r
- }\r
-\r
- public void fastPaint(int vertical)\r
- {\r
- if (gg == null)\r
- {\r
- repaint();\r
- return;\r
- }\r
+ if ((searchResults != null) && searchResults.contains(s))\r
+ {\r
+ gg.setColor(Color.black);\r
+ gg.fillRect(0, ((i - starty) * charHeight) + ypos, getWidth(),\r
+ charHeight);\r
+ gg.setColor(Color.white);\r
+ }\r
+ else if ((av.getSelectionGroup() != null) &&\r
+ av.getSelectionGroup().sequences.contains(s))\r
+ {\r
+ gg.setColor(Color.lightGray);\r
+ gg.fillRect(0, ((i - starty) * charHeight) + ypos, getWidth(),\r
+ charHeight);\r
+ gg.setColor(Color.white);\r
+ }\r
+ else\r
+ {\r
+ gg.setColor(s.getColor());\r
+ gg.fillRect(0, ((i - starty) * charHeight) + ypos, getWidth(),\r
+ charHeight);\r
+ gg.setColor(Color.black);\r
+ }\r
\r
- gg.copyArea(0, 0, getWidth(), imgHeight, 0, -vertical * av.charHeight);\r
+ String string = s.getName();\r
\r
- int ss = av.startSeq;\r
- int es = av.endSeq;\r
- int transY = 0;\r
+ if (av.getShowFullId())\r
+ {\r
+ string = s.getDisplayId();\r
+ }\r
\r
- if (vertical > 0) // scroll down\r
- {\r
- ss = es - vertical;\r
-\r
- if (ss < av.startSeq)\r
- { // ie scrolling too fast, more than a page at a time\r
- ss = av.startSeq;\r
- }\r
- else\r
- {\r
- transY = imgHeight - (vertical * av.charHeight);\r
- }\r
+ gg.drawString(string, 0,\r
+ (((i - starty + 1) * charHeight) + ypos) - (charHeight / 5));\r
}\r
- else if (vertical < 0)\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param vertical DOCUMENT ME!\r
+ */\r
+ public void fastPaint(int vertical)\r
{\r
- es = ss - vertical;\r
+ if (gg == null)\r
+ {\r
+ repaint();\r
\r
- if (es > av.endSeq)\r
- {\r
- es = av.endSeq;\r
- }\r
- }\r
+ return;\r
+ }\r
\r
- gg.translate(0, transY);\r
+ gg.copyArea(0, 0, getWidth(), imgHeight, 0, -vertical * av.charHeight);\r
\r
- drawIds(ss, es);\r
+ int ss = av.startSeq;\r
+ int es = av.endSeq;\r
+ int transY = 0;\r
\r
- gg.translate(0, -transY);\r
+ if (vertical > 0) // scroll down\r
+ {\r
+ ss = es - vertical;\r
+\r
+ if (ss < av.startSeq)\r
+ { // ie scrolling too fast, more than a page at a time\r
+ ss = av.startSeq;\r
+ }\r
+ else\r
+ {\r
+ transY = imgHeight - (vertical * av.charHeight);\r
+ }\r
+ }\r
+ else if (vertical < 0)\r
+ {\r
+ es = ss - vertical;\r
\r
- fastPaint = true;\r
- repaint();\r
- }\r
+ if (es > av.endSeq)\r
+ {\r
+ es = av.endSeq;\r
+ }\r
+ }\r
\r
- public void paintComponent(Graphics g)\r
- {\r
- g.setColor(Color.white);\r
- g.fillRect(0, 0, getWidth(), getHeight());\r
+ gg.translate(0, transY);\r
\r
- if (fastPaint)\r
- {\r
- fastPaint = false;\r
- g.drawImage(image, 0, 0, this);\r
+ drawIds(ss, es);\r
\r
- return;\r
- }\r
+ gg.translate(0, -transY);\r
\r
- imgHeight = getHeight();\r
- imgHeight -= (imgHeight % av.charHeight);\r
+ fastPaint = true;\r
+ repaint();\r
+ }\r
\r
- if (imgHeight < 1)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param g DOCUMENT ME!\r
+ */\r
+ public void paintComponent(Graphics g)\r
{\r
- return;\r
- }\r
+ g.setColor(Color.white);\r
+ g.fillRect(0, 0, getWidth(), getHeight());\r
\r
- image = new BufferedImage(getWidth(), imgHeight,\r
- BufferedImage.TYPE_INT_RGB);\r
- gg = (Graphics2D) image.getGraphics();\r
+ if (fastPaint)\r
+ {\r
+ fastPaint = false;\r
+ g.drawImage(image, 0, 0, this);\r
\r
- //Fill in the background\r
- gg.setColor(Color.white);\r
- gg.fillRect(0, 0, getWidth(), imgHeight);\r
- gg.setRenderingHint(RenderingHints.KEY_ANTIALIASING,\r
- RenderingHints.VALUE_ANTIALIAS_ON);\r
+ return;\r
+ }\r
\r
- Font italic = new Font(av.getFont().getName(), Font.ITALIC,\r
- av.getFont().getSize());\r
- gg.setFont(italic);\r
+ imgHeight = getHeight();\r
+ imgHeight -= (imgHeight % av.charHeight);\r
\r
- drawIds(av.getStartSeq(), av.endSeq);\r
+ if (imgHeight < 1)\r
+ {\r
+ return;\r
+ }\r
\r
- g.drawImage(image, 0, 0, this);\r
- }\r
+ image = new BufferedImage(getWidth(), imgHeight,\r
+ BufferedImage.TYPE_INT_RGB);\r
+ gg = (Graphics2D) image.getGraphics();\r
\r
- void drawIds(int starty, int endy)\r
- {\r
+ //Fill in the background\r
+ gg.setColor(Color.white);\r
+ gg.fillRect(0, 0, getWidth(), imgHeight);\r
+ gg.setRenderingHint(RenderingHints.KEY_ANTIALIASING,\r
+ RenderingHints.VALUE_ANTIALIAS_ON);\r
\r
- Color currentColor = Color.white;\r
- Color currentTextColor = Color.black;\r
+ Font italic = new Font(av.getFont().getName(), Font.ITALIC,\r
+ av.getFont().getSize());\r
+ gg.setFont(italic);\r
\r
- if (av.getWrapAlignment())\r
- {\r
- int rowSize = av.getEndRes() - av.getStartRes();\r
-\r
- // Draw the rest of the panels\r
- for (int ypos = 2 * av.charHeight, row = av.startRes;\r
- (ypos <= getHeight()) && (row < av.alignment.getWidth());\r
- ypos += av.chunkHeight, row += rowSize)\r
- {\r
- for (int i = starty; i < av.alignment.getHeight(); i++)\r
- {\r
- SequenceI s = av.alignment.getSequenceAt(i);\r
- drawIdString(gg, s, i, 0, ypos);\r
- }\r
- }\r
+ drawIds(av.getStartSeq(), av.endSeq);\r
+\r
+ g.drawImage(image, 0, 0, this);\r
}\r
- else\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param starty DOCUMENT ME!\r
+ * @param endy DOCUMENT ME!\r
+ */\r
+ void drawIds(int starty, int endy)\r
{\r
- //Now draw the id strings\r
- for (int i = starty; i < endy; i++)\r
- {\r
- // Selected sequence colours\r
- if ( (searchResults != null) &&\r
- searchResults.contains(av.alignment.getSequenceAt(i)))\r
- {\r
- gg.setColor(Color.black);\r
- currentColor = Color.black;\r
- currentTextColor = Color.white;\r
- }\r
- else if ( (av.getSelectionGroup() != null) &&\r
- av.getSelectionGroup().sequences.contains(\r
- av.alignment.getSequenceAt(i)))\r
+ Color currentColor = Color.white;\r
+ Color currentTextColor = Color.black;\r
+\r
+ if (av.getWrapAlignment())\r
{\r
- currentColor = Color.lightGray;\r
- currentTextColor = Color.black;\r
+ int rowSize = av.getEndRes() - av.getStartRes();\r
+\r
+ // Draw the rest of the panels\r
+ for (int ypos = 2 * av.charHeight, row = av.startRes;\r
+ (ypos <= getHeight()) && (row < av.alignment.getWidth());\r
+ ypos += av.chunkHeight, row += rowSize)\r
+ {\r
+ for (int i = starty; i < av.alignment.getHeight(); i++)\r
+ {\r
+ SequenceI s = av.alignment.getSequenceAt(i);\r
+ drawIdString(gg, s, i, 0, ypos);\r
+ }\r
+ }\r
}\r
else\r
{\r
- currentColor = av.alignment.getSequenceAt(i).getColor();\r
- currentTextColor = Color.black;\r
- }\r
-\r
- gg.setColor(currentColor);\r
-\r
- gg.fillRect(0,\r
- AlignmentUtil.getPixelHeight(starty, i, av.charHeight),\r
- getWidth(), av.charHeight);\r
-\r
- gg.setColor(currentTextColor);\r
-\r
- String string = av.alignment.getSequenceAt(i).getName();\r
-\r
- if (av.getShowFullId())\r
- {\r
- string = av.alignment.getSequenceAt(i).getDisplayId();\r
+ //Now draw the id strings\r
+ for (int i = starty; i < endy; i++)\r
+ {\r
+ // Selected sequence colours\r
+ if ((searchResults != null) &&\r
+ searchResults.contains(av.alignment.getSequenceAt(i)))\r
+ {\r
+ gg.setColor(Color.black);\r
+ currentColor = Color.black;\r
+ currentTextColor = Color.white;\r
+ }\r
+ else if ((av.getSelectionGroup() != null) &&\r
+ av.getSelectionGroup().sequences.contains(\r
+ av.alignment.getSequenceAt(i)))\r
+ {\r
+ currentColor = Color.lightGray;\r
+ currentTextColor = Color.black;\r
+ }\r
+ else\r
+ {\r
+ currentColor = av.alignment.getSequenceAt(i).getColor();\r
+ currentTextColor = Color.black;\r
+ }\r
+\r
+ gg.setColor(currentColor);\r
+\r
+ gg.fillRect(0, (i - starty) * av.charHeight, getWidth(),\r
+ av.charHeight);\r
+\r
+ gg.setColor(currentTextColor);\r
+\r
+ String string = av.alignment.getSequenceAt(i).getName();\r
+\r
+ if (av.getShowFullId())\r
+ {\r
+ string = av.alignment.getSequenceAt(i).getDisplayId();\r
+ }\r
+\r
+ gg.drawString(string, 0,\r
+ (((i - starty) * av.charHeight) + av.charHeight) -\r
+ (av.charHeight / 5));\r
+ }\r
+\r
+ // add a border\r
+ gg.setColor(Color.white);\r
+ gg.fillRect(getWidth() - 4, 0, 4, getHeight());\r
}\r
-\r
- gg.drawString(string, 0,\r
- (AlignmentUtil.getPixelHeight(starty, i, av.charHeight) +\r
- av.charHeight) - (av.charHeight / 5));\r
- }\r
-\r
- // add a border\r
- gg.setColor(Color.white);\r
- gg.fillRect(getWidth() - 4, 0, 4, getHeight());\r
}\r
- }\r
\r
- public void setHighlighted(java.util.Vector found)\r
- {\r
- searchResults = found;\r
- repaint();\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param found DOCUMENT ME!\r
+ */\r
+ public void setHighlighted(java.util.Vector found)\r
+ {\r
+ searchResults = found;\r
+ repaint();\r
+ }\r
}\r
*/\r
package jalview.gui;\r
\r
+import jalview.datamodel.*;\r
+\r
import java.awt.*;\r
import java.awt.event.*;\r
+\r
import javax.swing.*;\r
\r
-import jalview.datamodel.*;\r
\r
-public class IdPanel\r
- extends JPanel implements MouseListener,\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class IdPanel extends JPanel implements MouseListener,\r
MouseMotionListener\r
{\r
- protected IdCanvas idCanvas;\r
- protected AlignViewport av;\r
- protected AlignmentPanel alignPanel;\r
- ScrollThread scrollThread = null;\r
- int offy;\r
- int width;\r
- int lastid = -1;\r
- boolean mouseDragging = false;\r
-\r
- public IdPanel(AlignViewport av, AlignmentPanel parent)\r
- {\r
- this.av = av;\r
- alignPanel = parent;\r
- idCanvas = new IdCanvas(av);\r
- setLayout(new BorderLayout());\r
- add(idCanvas, BorderLayout.CENTER);\r
- addMouseListener(this);\r
- addMouseMotionListener(this);\r
- }\r
-\r
- public void mouseMoved(MouseEvent e)\r
- {\r
- }\r
-\r
- public void mouseDragged(MouseEvent e)\r
- {\r
- mouseDragging = true;\r
-\r
- int y = e.getY();\r
-\r
- if (av.getWrapAlignment())\r
+ protected IdCanvas idCanvas;\r
+ protected AlignViewport av;\r
+ protected AlignmentPanel alignPanel;\r
+ ScrollThread scrollThread = null;\r
+ int offy;\r
+ int width;\r
+ int lastid = -1;\r
+ boolean mouseDragging = false;\r
+\r
+ /**\r
+ * Creates a new IdPanel object.\r
+ *\r
+ * @param av DOCUMENT ME!\r
+ * @param parent DOCUMENT ME!\r
+ */\r
+ public IdPanel(AlignViewport av, AlignmentPanel parent)\r
{\r
- y -= (2 * av.charHeight);\r
+ this.av = av;\r
+ alignPanel = parent;\r
+ idCanvas = new IdCanvas(av);\r
+ setLayout(new BorderLayout());\r
+ add(idCanvas, BorderLayout.CENTER);\r
+ addMouseListener(this);\r
+ addMouseMotionListener(this);\r
}\r
\r
- int seq = av.getIndex(y);\r
-\r
- if (seq < 0)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void mouseMoved(MouseEvent e)\r
{\r
- return;\r
}\r
\r
- if (seq < lastid)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void mouseDragged(MouseEvent e)\r
{\r
- selectSeqs(lastid - 1, seq);\r
- }\r
- else if (seq > lastid)\r
- {\r
- selectSeqs(lastid + 1, seq);\r
- }\r
+ mouseDragging = true;\r
\r
- lastid = seq;\r
- alignPanel.repaint();\r
- }\r
+ int y = e.getY();\r
\r
- public void mouseClicked(MouseEvent e)\r
- {\r
- if (e.getClickCount() == 2)\r
- {\r
- int y = e.getY();\r
-\r
- if (av.getWrapAlignment())\r
- {\r
- y -= (2 * av.charHeight);\r
- }\r
-\r
- int seq = av.getIndex(y);\r
- String id = av.getAlignment().getSequenceAt(seq).getName();\r
-\r
- try\r
- {\r
- jalview.util.BrowserLauncher.openURL(\r
- "http://srs.ebi.ac.uk/srs7bin/cgi-bin/wgetz?-e+[uniprot-all:" +\r
- id + "]+-vn+2");\r
- }\r
- catch (Exception ex)\r
- {\r
- // TODO: JBPNote : state dependent error message for real browserLaunch problems rather than unix misconfiguration.\r
- System.err.println(ex.getMessage() +\r
- "\nUnixers: Try adding this jalview.browser property line \n" +\r
- "in your jalview.properties file (/usr/local/bin/firefox is an exanmple browser path):\n" +\r
- "jalview.browser=/usr/local/bin/firefox\n");\r
-\r
- //ex.printStackTrace();\r
- }\r
- }\r
- }\r
+ if (av.getWrapAlignment())\r
+ {\r
+ y -= (2 * av.charHeight);\r
+ }\r
\r
- public void mouseEntered(MouseEvent e)\r
- {\r
- if (scrollThread != null)\r
- {\r
- scrollThread.running = false;\r
- }\r
- }\r
+ int seq = av.getIndex(y);\r
\r
- public void mouseExited(MouseEvent e)\r
- {\r
- if (av.getWrapAlignment())\r
- {\r
- return;\r
- }\r
+ if (seq < 0)\r
+ {\r
+ return;\r
+ }\r
\r
- if (mouseDragging && (e.getY() < 0) && (av.getStartSeq() > 0))\r
- {\r
- scrollThread = new ScrollThread(true);\r
+ if (seq < lastid)\r
+ {\r
+ selectSeqs(lastid - 1, seq);\r
+ }\r
+ else if (seq > lastid)\r
+ {\r
+ selectSeqs(lastid + 1, seq);\r
+ }\r
+\r
+ lastid = seq;\r
+ alignPanel.repaint();\r
}\r
\r
- if (mouseDragging && (e.getY() >= getHeight()) &&\r
- (av.alignment.getHeight() > av.getEndSeq()))\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void mouseClicked(MouseEvent e)\r
{\r
- scrollThread = new ScrollThread(false);\r
+ if (e.getClickCount() == 2)\r
+ {\r
+ int y = e.getY();\r
+\r
+ if (av.getWrapAlignment())\r
+ {\r
+ y -= (2 * av.charHeight);\r
+ }\r
+\r
+ int seq = av.getIndex(y);\r
+ String id = av.getAlignment().getSequenceAt(seq).getName();\r
+\r
+ try\r
+ {\r
+ jalview.util.BrowserLauncher.openURL(\r
+ "http://srs.ebi.ac.uk/srs7bin/cgi-bin/wgetz?-e+[uniprot-all:" +\r
+ id + "]+-vn+2");\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ // TODO: JBPNote : state dependent error message for real browserLaunch problems rather than unix misconfiguration.\r
+ System.err.println(ex.getMessage() +\r
+ "\nUnixers: Try adding this jalview.browser property line \n" +\r
+ "in your jalview.properties file (/usr/local/bin/firefox is an exanmple browser path):\n" +\r
+ "jalview.browser=/usr/local/bin/firefox\n");\r
+\r
+ //ex.printStackTrace();\r
+ }\r
+ }\r
}\r
- }\r
\r
- public void mousePressed(MouseEvent e)\r
- {\r
- if (e.getClickCount() == 2)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void mouseEntered(MouseEvent e)\r
{\r
- return;\r
+ if (scrollThread != null)\r
+ {\r
+ scrollThread.running = false;\r
+ }\r
}\r
\r
- int y = e.getY();\r
-\r
- if (av.getWrapAlignment())\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void mouseExited(MouseEvent e)\r
{\r
- y -= (2 * av.charHeight);\r
- }\r
+ if (av.getWrapAlignment())\r
+ {\r
+ return;\r
+ }\r
\r
- int seq = av.getIndex(y);\r
+ if (mouseDragging && (e.getY() < 0) && (av.getStartSeq() > 0))\r
+ {\r
+ scrollThread = new ScrollThread(true);\r
+ }\r
\r
- if (seq == -1)\r
- {\r
- return;\r
+ if (mouseDragging && (e.getY() >= getHeight()) &&\r
+ (av.alignment.getHeight() > av.getEndSeq()))\r
+ {\r
+ scrollThread = new ScrollThread(false);\r
+ }\r
}\r
\r
- if (javax.swing.SwingUtilities.isRightMouseButton(e))\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void mousePressed(MouseEvent e)\r
{\r
- jalview.gui.PopupMenu pop = new jalview.gui.PopupMenu(alignPanel,\r
- (Sequence) av.getAlignment().getSequenceAt(seq));\r
- pop.show(this, e.getX(), y);\r
+ if (e.getClickCount() == 2)\r
+ {\r
+ return;\r
+ }\r
\r
- return;\r
- }\r
+ int y = e.getY();\r
\r
- if (!e.isControlDown() && !e.isShiftDown() &&\r
- (av.alignment.findGroup(av.alignment.getSequenceAt(seq)) != null))\r
- {\r
- SequenceGroup selection = new SequenceGroup();\r
- SequenceGroup sg = av.alignment.findGroup(av.alignment.getSequenceAt(\r
- seq));\r
- selection.setStartRes(0);\r
- selection.setEndRes(av.alignment.getWidth() - 1);\r
+ if (av.getWrapAlignment())\r
+ {\r
+ y -= (2 * av.charHeight);\r
+ }\r
\r
- for (int i = 0; i < sg.getSize(); i++)\r
- {\r
- selection.addSequence(sg.getSequenceAt(i), true);\r
- }\r
+ int seq = av.getIndex(y);\r
\r
- av.setSelectionGroup(selection);\r
+ if (seq == -1)\r
+ {\r
+ return;\r
+ }\r
\r
- return;\r
- }\r
+ if (javax.swing.SwingUtilities.isRightMouseButton(e))\r
+ {\r
+ jalview.gui.PopupMenu pop = new jalview.gui.PopupMenu(alignPanel,\r
+ (Sequence) av.getAlignment().getSequenceAt(seq));\r
+ pop.show(this, e.getX(), y);\r
\r
- if ( (av.getSelectionGroup() == null) ||\r
- (!e.isControlDown() && (av.getSelectionGroup() != null)))\r
- {\r
- av.setSelectionGroup(new SequenceGroup());\r
- }\r
+ return;\r
+ }\r
\r
- av.getSelectionGroup().setStartRes(0);\r
- av.getSelectionGroup().setEndRes(av.alignment.getWidth() - 1);\r
+ if (!e.isControlDown() && !e.isShiftDown() &&\r
+ (av.alignment.findGroup(av.alignment.getSequenceAt(seq)) != null))\r
+ {\r
+ SequenceGroup selection = new SequenceGroup();\r
+ SequenceGroup sg = av.alignment.findGroup(av.alignment.getSequenceAt(\r
+ seq));\r
+ selection.setStartRes(0);\r
+ selection.setEndRes(av.alignment.getWidth() - 1);\r
\r
- if (e.isShiftDown() && (lastid != -1))\r
- {\r
- selectSeqs(lastid, seq);\r
- }\r
- else\r
- {\r
- selectSeq(seq);\r
- }\r
+ for (int i = 0; i < sg.getSize(); i++)\r
+ {\r
+ selection.addSequence(sg.getSequenceAt(i), true);\r
+ }\r
\r
- alignPanel.repaint();\r
- }\r
+ av.setSelectionGroup(selection);\r
\r
- void selectSeq(int seq)\r
- {\r
- lastid = seq;\r
+ return;\r
+ }\r
\r
- SequenceI pickedSeq = av.getAlignment().getSequenceAt(seq);\r
- av.getSelectionGroup().addOrRemove(pickedSeq, true);\r
- }\r
+ if ((av.getSelectionGroup() == null) ||\r
+ (!e.isControlDown() && (av.getSelectionGroup() != null)))\r
+ {\r
+ av.setSelectionGroup(new SequenceGroup());\r
+ }\r
\r
- void selectSeqs(int start, int end)\r
- {\r
- lastid = start;\r
+ av.getSelectionGroup().setStartRes(0);\r
+ av.getSelectionGroup().setEndRes(av.alignment.getWidth() - 1);\r
\r
- if (end < start)\r
- {\r
- int tmp = start;\r
- start = end;\r
- end = tmp;\r
- lastid = end;\r
- }\r
+ if (e.isShiftDown() && (lastid != -1))\r
+ {\r
+ selectSeqs(lastid, seq);\r
+ }\r
+ else\r
+ {\r
+ selectSeq(seq);\r
+ }\r
\r
- for (int i = start; i <= end; i++)\r
- {\r
- av.getSelectionGroup().addSequence(av.getAlignment().getSequenceAt(i), true);\r
+ alignPanel.repaint();\r
}\r
- }\r
\r
- public void mouseReleased(MouseEvent e)\r
- {\r
- if (scrollThread != null)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param seq DOCUMENT ME!\r
+ */\r
+ void selectSeq(int seq)\r
{\r
- scrollThread.running = false;\r
- }\r
-\r
- mouseDragging = false;\r
- PaintRefresher.Refresh(av.alignment);\r
- }\r
-\r
- public void highlightSearchResults(java.util.Vector found)\r
- {\r
- idCanvas.setHighlighted(found);\r
+ lastid = seq;\r
\r
- if (found == null)\r
- {\r
- return;\r
+ SequenceI pickedSeq = av.getAlignment().getSequenceAt(seq);\r
+ av.getSelectionGroup().addOrRemove(pickedSeq, true);\r
}\r
\r
- int index = av.alignment.findIndex( (SequenceI) found.get(0));\r
-\r
- // do we need to scroll the panel?\r
- if ( (av.getStartSeq() > index) || (av.getEndSeq() < index))\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param start DOCUMENT ME!\r
+ * @param end DOCUMENT ME!\r
+ */\r
+ void selectSeqs(int start, int end)\r
{\r
- alignPanel.setScrollValues(av.getStartRes(), index);\r
- }\r
- }\r
+ lastid = start;\r
\r
- // this class allows scrolling off the bottom of the visible alignment\r
- class ScrollThread\r
- extends Thread\r
- {\r
- boolean running = false;\r
- boolean up = true;\r
+ if (end < start)\r
+ {\r
+ int tmp = start;\r
+ start = end;\r
+ end = tmp;\r
+ lastid = end;\r
+ }\r
\r
- public ScrollThread(boolean up)\r
- {\r
- this.up = up;\r
- start();\r
+ for (int i = start; i <= end; i++)\r
+ {\r
+ av.getSelectionGroup().addSequence(av.getAlignment().getSequenceAt(i),\r
+ true);\r
+ }\r
}\r
\r
- public void stopScrolling()\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void mouseReleased(MouseEvent e)\r
{\r
- running = false;\r
+ if (scrollThread != null)\r
+ {\r
+ scrollThread.running = false;\r
+ }\r
+\r
+ mouseDragging = false;\r
+ PaintRefresher.Refresh(av.alignment);\r
}\r
\r
- public void run()\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param found DOCUMENT ME!\r
+ */\r
+ public void highlightSearchResults(java.util.Vector found)\r
{\r
- running = true;\r
+ idCanvas.setHighlighted(found);\r
\r
- while (running)\r
- {\r
- if (alignPanel.scrollUp(up))\r
+ if (found == null)\r
{\r
- // scroll was ok, so add new sequence to selection\r
- int seq = av.getStartSeq();\r
-\r
- if (!up)\r
- {\r
- seq = av.getEndSeq();\r
- }\r
+ return;\r
+ }\r
\r
- if (seq < lastid)\r
- {\r
- selectSeqs(lastid - 1, seq);\r
- }\r
- else if (seq > lastid)\r
- {\r
- selectSeqs(lastid + 1, seq);\r
- }\r
+ int index = av.alignment.findIndex((SequenceI) found.get(0));\r
\r
- lastid = seq;\r
- }\r
- else\r
+ // do we need to scroll the panel?\r
+ if ((av.getStartSeq() > index) || (av.getEndSeq() < index))\r
{\r
- running = false;\r
+ alignPanel.setScrollValues(av.getStartRes(), index);\r
}\r
+ }\r
\r
- alignPanel.repaint();\r
+ // this class allows scrolling off the bottom of the visible alignment\r
+ class ScrollThread extends Thread\r
+ {\r
+ boolean running = false;\r
+ boolean up = true;\r
+\r
+ public ScrollThread(boolean up)\r
+ {\r
+ this.up = up;\r
+ start();\r
+ }\r
\r
- try\r
+ public void stopScrolling()\r
{\r
- Thread.sleep(100);\r
+ running = false;\r
}\r
- catch (Exception ex)\r
+\r
+ public void run()\r
{\r
+ running = true;\r
+\r
+ while (running)\r
+ {\r
+ if (alignPanel.scrollUp(up))\r
+ {\r
+ // scroll was ok, so add new sequence to selection\r
+ int seq = av.getStartSeq();\r
+\r
+ if (!up)\r
+ {\r
+ seq = av.getEndSeq();\r
+ }\r
+\r
+ if (seq < lastid)\r
+ {\r
+ selectSeqs(lastid - 1, seq);\r
+ }\r
+ else if (seq > lastid)\r
+ {\r
+ selectSeqs(lastid + 1, seq);\r
+ }\r
+\r
+ lastid = seq;\r
+ }\r
+ else\r
+ {\r
+ running = false;\r
+ }\r
+\r
+ alignPanel.repaint();\r
+\r
+ try\r
+ {\r
+ Thread.sleep(100);\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ }\r
+ }\r
}\r
- }\r
}\r
- }\r
}\r
\r
import java.awt.*;\r
import java.awt.event.*;\r
+\r
import javax.swing.*;\r
\r
-public class IdwidthAdjuster\r
- extends JPanel implements MouseListener,\r
+\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class IdwidthAdjuster extends JPanel implements MouseListener,\r
MouseMotionListener\r
{\r
- boolean active = false;\r
- int oldX = 0;\r
- Image image;\r
- AlignmentPanel ap;\r
+ boolean active = false;\r
+ int oldX = 0;\r
+ Image image;\r
+ AlignmentPanel ap;\r
+\r
+ /**\r
+ * Creates a new IdwidthAdjuster object.\r
+ *\r
+ * @param ap DOCUMENT ME!\r
+ */\r
+ public IdwidthAdjuster(AlignmentPanel ap)\r
+ {\r
+ this.ap = ap;\r
\r
- public IdwidthAdjuster(AlignmentPanel ap)\r
- {\r
- this.ap = ap;\r
+ java.net.URL url = getClass().getResource("/images/idwidth.gif");\r
\r
- java.net.URL url = getClass().getResource("/images/idwidth.gif");\r
+ if (url != null)\r
+ {\r
+ image = java.awt.Toolkit.getDefaultToolkit().createImage(url);\r
+ }\r
\r
- if (url != null)\r
+ addMouseListener(this);\r
+ addMouseMotionListener(this);\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ */\r
+ public void mousePressed(MouseEvent evt)\r
{\r
- image = java.awt.Toolkit.getDefaultToolkit().createImage(url);\r
+ oldX = evt.getX();\r
}\r
\r
- addMouseListener(this);\r
- addMouseMotionListener(this);\r
- }\r
-\r
- public void mousePressed(MouseEvent evt)\r
- {\r
- oldX = evt.getX();\r
- }\r
-\r
- public void mouseReleased(MouseEvent evt)\r
- {\r
- active = false;\r
- repaint();\r
- }\r
-\r
- public void mouseEntered(MouseEvent evt)\r
- {\r
- active = true;\r
- repaint();\r
- }\r
-\r
- public void mouseExited(MouseEvent evt)\r
- {\r
- active = false;\r
- repaint();\r
- }\r
-\r
- public void mouseDragged(MouseEvent evt)\r
- {\r
- active = true;\r
-\r
- Dimension d = ap.idPanel.idCanvas.getPreferredSize();\r
- int dif = evt.getX() - oldX;\r
-\r
- if ( ( (d.width + dif) > 20) || (dif > 0))\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ */\r
+ public void mouseReleased(MouseEvent evt)\r
{\r
- ap.idPanel.idCanvas.setPreferredSize(new Dimension(d.width + dif,\r
- d.height));\r
- ap.repaint();\r
+ active = false;\r
+ repaint();\r
}\r
\r
- oldX = evt.getX();\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ */\r
+ public void mouseEntered(MouseEvent evt)\r
+ {\r
+ active = true;\r
+ repaint();\r
+ }\r
\r
- public void mouseMoved(MouseEvent evt)\r
- {\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ */\r
+ public void mouseExited(MouseEvent evt)\r
+ {\r
+ active = false;\r
+ repaint();\r
+ }\r
\r
- public void mouseClicked(MouseEvent evt)\r
- {\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ */\r
+ public void mouseDragged(MouseEvent evt)\r
+ {\r
+ active = true;\r
+\r
+ Dimension d = ap.idPanel.idCanvas.getPreferredSize();\r
+ int dif = evt.getX() - oldX;\r
+\r
+ if (((d.width + dif) > 20) || (dif > 0))\r
+ {\r
+ ap.idPanel.idCanvas.setPreferredSize(new Dimension(d.width + dif,\r
+ d.height));\r
+ ap.repaint();\r
+ }\r
+\r
+ oldX = evt.getX();\r
+ }\r
\r
- public void paintComponent(Graphics g)\r
- {\r
- g.setColor(Color.white);\r
- g.fillRect(0, 0, getWidth(), getHeight());\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ */\r
+ public void mouseMoved(MouseEvent evt)\r
+ {\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ */\r
+ public void mouseClicked(MouseEvent evt)\r
+ {\r
+ }\r
\r
- if (active)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param g DOCUMENT ME!\r
+ */\r
+ public void paintComponent(Graphics g)\r
{\r
- if (image != null)\r
- {\r
- g.drawImage(image, getWidth() - 20, 2, this);\r
- }\r
+ g.setColor(Color.white);\r
+ g.fillRect(0, 0, getWidth(), getHeight());\r
+\r
+ if (active)\r
+ {\r
+ if (image != null)\r
+ {\r
+ g.drawImage(image, getWidth() - 20, 2, this);\r
+ }\r
+ }\r
}\r
- }\r
}\r
*/\r
package jalview.gui;\r
\r
+import jalview.binding.*;\r
+\r
+import jalview.io.*;\r
+\r
+import jalview.schemes.*;\r
+\r
import java.io.*;\r
+\r
import java.net.*;\r
+\r
import java.util.*;\r
import java.util.jar.*;\r
\r
import javax.swing.*;\r
\r
-import jalview.binding.*;\r
-import jalview.io.*;\r
-import jalview.schemes.*;\r
\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
public class Jalview2XML\r
{\r
- // SAVES SEVERAL ALIGNEMENT WINDOWS TO SAME JARFILE\r
- public static void SaveState(File statefile)\r
- {\r
- long creation = System.currentTimeMillis();\r
- JInternalFrame[] frames = Desktop.desktop.getAllFrames();\r
-\r
- if (frames == null)\r
- {\r
- return;\r
- }\r
-\r
- try\r
+ // SAVES SEVERAL ALIGNEMENT WINDOWS TO SAME JARFILE\r
+ public static void SaveState(File statefile)\r
{\r
- FileOutputStream fos = new FileOutputStream(statefile);\r
- JarOutputStream jout = new JarOutputStream(fos);\r
+ long creation = System.currentTimeMillis();\r
+ JInternalFrame[] frames = Desktop.desktop.getAllFrames();\r
\r
- //NOTE UTF-8 MUST BE USED FOR WRITING UNICODE CHARS\r
- ////////////////////////////////////////////////////\r
- PrintWriter out = new PrintWriter(new OutputStreamWriter(jout,\r
- "UTF-8"));\r
-\r
- Vector shortNames = new Vector();\r
- int treeCount=1;\r
-\r
- //REVERSE ORDER\r
- for (int i = frames.length - 1; i > -1; i--)\r
- {\r
- if (frames[i] instanceof AlignFrame)\r
+ if (frames == null)\r
{\r
- AlignFrame af = (AlignFrame) frames[i];\r
+ return;\r
+ }\r
\r
- String shortName = af.getTitle();\r
+ try\r
+ {\r
+ FileOutputStream fos = new FileOutputStream(statefile);\r
+ JarOutputStream jout = new JarOutputStream(fos);\r
\r
- if (shortName.indexOf(File.separatorChar) > -1)\r
- {\r
- shortName = shortName.substring(shortName.lastIndexOf(\r
- File.separatorChar) + 1);\r
- }\r
+ //NOTE UTF-8 MUST BE USED FOR WRITING UNICODE CHARS\r
+ ////////////////////////////////////////////////////\r
+ PrintWriter out = new PrintWriter(new OutputStreamWriter(jout,\r
+ "UTF-8"));\r
\r
- int count = 1;\r
+ Vector shortNames = new Vector();\r
\r
- while (shortNames.contains(shortName))\r
- {\r
- if (shortName.endsWith("_" + (count - 1)))\r
+ //REVERSE ORDER\r
+ for (int i = frames.length - 1; i > -1; i--)\r
{\r
- shortName = shortName.substring(0,\r
- shortName.lastIndexOf("_"));\r
- }\r
+ if (frames[i] instanceof AlignFrame)\r
+ {\r
+ AlignFrame af = (AlignFrame) frames[i];\r
\r
- shortName = shortName.concat("_" + count);\r
- count++;\r
- }\r
+ String shortName = af.getTitle();\r
\r
- shortNames.addElement(shortName);\r
+ if (shortName.indexOf(File.separatorChar) > -1)\r
+ {\r
+ shortName = shortName.substring(shortName.lastIndexOf(\r
+ File.separatorChar) + 1);\r
+ }\r
\r
- if (!shortName.endsWith(".xml"))\r
- {\r
- shortName = shortName + ".xml";\r
- }\r
+ int count = 1;\r
\r
- SaveState(af, creation, shortName, jout, out);\r
- }\r
- }\r
+ while (shortNames.contains(shortName))\r
+ {\r
+ if (shortName.endsWith("_" + (count - 1)))\r
+ {\r
+ shortName = shortName.substring(0,\r
+ shortName.lastIndexOf("_"));\r
+ }\r
\r
- out.close();\r
- jout.close();\r
- }\r
- catch (Exception ex)\r
- {\r
- ex.printStackTrace();\r
- }\r
- }\r
+ shortName = shortName.concat("_" + count);\r
+ count++;\r
+ }\r
\r
+ shortNames.addElement(shortName);\r
\r
- // USE THIS METHOD TO SAVE A SINGLE ALIGNMENT WINDOW\r
- public static void SaveAlignment(AlignFrame af, String jarFile, String fileName)\r
- {\r
- try\r
- {\r
- FileOutputStream fos = new FileOutputStream(jarFile);\r
- JarOutputStream jout = new JarOutputStream(fos);\r
+ if (!shortName.endsWith(".xml"))\r
+ {\r
+ shortName = shortName + ".xml";\r
+ }\r
\r
- //NOTE UTF-8 MUST BE USED FOR WRITING UNICODE CHARS\r
- ////////////////////////////////////////////////////\r
- PrintWriter out = new PrintWriter(new OutputStreamWriter(jout,\r
- "UTF-8"));\r
+ SaveState(af, creation, shortName, jout, out);\r
+ }\r
+ }\r
\r
- SaveState(af, System.currentTimeMillis(), fileName, jout, out);\r
- out.close();\r
- jout.close();\r
- }\r
- catch (Exception ex)\r
- {\r
+ out.close();\r
+ jout.close();\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ ex.printStackTrace();\r
+ }\r
}\r
- }\r
\r
- public static void SaveState(AlignFrame af, long timeStamp,\r
- String fileName, JarOutputStream jout,\r
- PrintWriter out)\r
- {\r
- Vector seqids = new Vector();\r
- Vector userColours = new Vector();\r
+ // USE THIS METHOD TO SAVE A SINGLE ALIGNMENT WINDOW\r
+ public static void SaveAlignment(AlignFrame af, String jarFile,\r
+ String fileName)\r
+ {\r
+ try\r
+ {\r
+ FileOutputStream fos = new FileOutputStream(jarFile);\r
+ JarOutputStream jout = new JarOutputStream(fos);\r
\r
- AlignViewport av = af.viewport;\r
+ //NOTE UTF-8 MUST BE USED FOR WRITING UNICODE CHARS\r
+ ////////////////////////////////////////////////////\r
+ PrintWriter out = new PrintWriter(new OutputStreamWriter(jout,\r
+ "UTF-8"));\r
\r
- JalviewModel object = new JalviewModel();\r
- object.setVamsasModel(new VamsasModel());\r
+ SaveState(af, System.currentTimeMillis(), fileName, jout, out);\r
+ out.close();\r
+ jout.close();\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ }\r
+ }\r
\r
- object.setCreationDate(new java.util.Date(timeStamp));\r
- object.setVersion(jalview.bin.Cache.VERSION);\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param af DOCUMENT ME!\r
+ * @param timeStamp DOCUMENT ME!\r
+ * @param fileName DOCUMENT ME!\r
+ * @param jout DOCUMENT ME!\r
+ * @param out DOCUMENT ME!\r
+ */\r
+ public static void SaveState(AlignFrame af, long timeStamp,\r
+ String fileName, JarOutputStream jout, PrintWriter out)\r
+ {\r
+ Vector seqids = new Vector();\r
+ Vector userColours = new Vector();\r
\r
- jalview.datamodel.AlignmentI jal = af.viewport.alignment;\r
+ AlignViewport av = af.viewport;\r
\r
- SequenceSet vamsasSet = new SequenceSet();\r
- Sequence vamsasSeq;\r
- JalviewModelSequence jms = new JalviewModelSequence();\r
+ JalviewModel object = new JalviewModel();\r
+ object.setVamsasModel(new VamsasModel());\r
\r
- vamsasSet.setGapChar(jal.getGapCharacter() + "");\r
+ object.setCreationDate(new java.util.Date(timeStamp));\r
+ object.setVersion(jalview.bin.Cache.VERSION);\r
\r
- JSeq jseq;\r
+ jalview.datamodel.AlignmentI jal = af.viewport.alignment;\r
\r
- //SAVE SEQUENCES\r
- int id = 0;\r
+ SequenceSet vamsasSet = new SequenceSet();\r
+ Sequence vamsasSeq;\r
+ JalviewModelSequence jms = new JalviewModelSequence();\r
\r
- for (int i = 0; i < jal.getHeight(); i++)\r
- {\r
- seqids.add(jal.getSequenceAt(i));\r
+ vamsasSet.setGapChar(jal.getGapCharacter() + "");\r
\r
- vamsasSeq = new Sequence();\r
- vamsasSeq.setId(id + "");\r
- vamsasSeq.setName(jal.getSequenceAt(i).getName());\r
- vamsasSeq.setSequence(jal.getSequenceAt(i).getSequence());\r
+ JSeq jseq;\r
\r
- jseq = new JSeq();\r
- jseq.setStart(jal.getSequenceAt(i).getStart());\r
- jseq.setEnd(jal.getSequenceAt(i).getEnd());\r
+ //SAVE SEQUENCES\r
+ int id = 0;\r
\r
- jseq.setColour(jal.getSequenceAt(i).getColor().getRGB());\r
+ for (int i = 0; i < jal.getHeight(); i++)\r
+ {\r
+ seqids.add(jal.getSequenceAt(i));\r
\r
- jseq.setId(id);\r
+ vamsasSeq = new Sequence();\r
+ vamsasSeq.setId(id + "");\r
+ vamsasSeq.setName(jal.getSequenceAt(i).getName());\r
+ vamsasSeq.setSequence(jal.getSequenceAt(i).getSequence());\r
\r
- jms.addJSeq(jseq);\r
- vamsasSet.addSequence(vamsasSeq);\r
- id++;\r
- }\r
+ jseq = new JSeq();\r
+ jseq.setStart(jal.getSequenceAt(i).getStart());\r
+ jseq.setEnd(jal.getSequenceAt(i).getEnd());\r
\r
- //SAVE TREES\r
- ///////////////////////////////////\r
- if (af.viewport.currentTree != null)\r
- {\r
- // FIND ANY ASSOCIATED TREES\r
- JInternalFrame[] frames = Desktop.desktop.getAllFrames();\r
- for(int t=0; t<frames.length; t++)\r
- {\r
- if (frames[t] instanceof TreePanel)\r
- {\r
- TreePanel tp = (TreePanel) frames[t];\r
- if(tp.treeCanvas.av.alignment==jal)\r
- {\r
- Tree tree = new Tree();\r
- tree.setTitle(tp.getTitle());\r
- tree.setCurrentTree((af.viewport.currentTree == tp.getTree()));\r
- tree.setNewick(tp.getTree().toString());\r
- tree.setThreshold(tp.treeCanvas.threshold);\r
-\r
- tree.setFitToWindow(tp.fitToWindow.getState());\r
- tree.setFontSize(tp.treeCanvas.fontSize);\r
- tree.setMarkUnlinked( tp.placeholdersMenu.getState() );\r
- tree.setShowBootstrap( tp.bootstrapMenu.getState() );\r
- tree.setShowDistances( tp.distanceMenu.getState() );\r
-\r
- tree.setHeight(tp.getHeight());\r
- tree.setWidth(tp.getWidth());\r
- tree.setXpos(tp.getX());\r
- tree.setYpos(tp.getY());\r
-\r
- jms.addTree(tree);\r
- }\r
- }\r
- }\r
- }\r
+ jseq.setColour(jal.getSequenceAt(i).getColor().getRGB());\r
\r
- //SAVE ANNOTATIONS\r
- if (jal.getAlignmentAnnotation() != null)\r
- {\r
- jalview.datamodel.AlignmentAnnotation[] aa = jal.getAlignmentAnnotation();\r
+ jseq.setId(id);\r
\r
- for (int i = 0; i < aa.length; i++)\r
- {\r
- if (aa[i].label.equals("Quality") ||\r
- aa[i].label.equals("Conservation") ||\r
- aa[i].label.equals("Consensus"))\r
- {\r
- continue;\r
+ jms.addJSeq(jseq);\r
+ vamsasSet.addSequence(vamsasSeq);\r
+ id++;\r
}\r
\r
- Annotation an = new Annotation();\r
- an.setDescription(aa[i].description);\r
- an.setGraph(aa[i].isGraph);\r
- an.setLabel(aa[i].label);\r
+ //SAVE TREES\r
+ ///////////////////////////////////\r
+ if (af.viewport.currentTree != null)\r
+ {\r
+ // FIND ANY ASSOCIATED TREES\r
+ JInternalFrame[] frames = Desktop.desktop.getAllFrames();\r
\r
- AnnotationElement ae;\r
+ for (int t = 0; t < frames.length; t++)\r
+ {\r
+ if (frames[t] instanceof TreePanel)\r
+ {\r
+ TreePanel tp = (TreePanel) frames[t];\r
+\r
+ if (tp.treeCanvas.av.alignment == jal)\r
+ {\r
+ Tree tree = new Tree();\r
+ tree.setTitle(tp.getTitle());\r
+ tree.setCurrentTree((af.viewport.currentTree == tp.getTree()));\r
+ tree.setNewick(tp.getTree().toString());\r
+ tree.setThreshold(tp.treeCanvas.threshold);\r
+\r
+ tree.setFitToWindow(tp.fitToWindow.getState());\r
+ tree.setFontSize(tp.treeCanvas.fontSize);\r
+ tree.setMarkUnlinked(tp.placeholdersMenu.getState());\r
+ tree.setShowBootstrap(tp.bootstrapMenu.getState());\r
+ tree.setShowDistances(tp.distanceMenu.getState());\r
+\r
+ tree.setHeight(tp.getHeight());\r
+ tree.setWidth(tp.getWidth());\r
+ tree.setXpos(tp.getX());\r
+ tree.setYpos(tp.getY());\r
+\r
+ jms.addTree(tree);\r
+ }\r
+ }\r
+ }\r
+ }\r
\r
- for (int a = 0; a < aa[i].annotations.length; a++)\r
+ //SAVE ANNOTATIONS\r
+ if (jal.getAlignmentAnnotation() != null)\r
{\r
- if ( (aa[i] == null) || (aa[i].annotations[a] == null))\r
- {\r
- continue;\r
- }\r
-\r
- ae = new AnnotationElement();\r
- ae.setDescription(aa[i].annotations[a].description);\r
- ae.setDisplayCharacter(aa[i].annotations[a].displayCharacter);\r
- ae.setValue(aa[i].annotations[a].value);\r
- ae.setPosition(a);\r
- ae.setSecondaryStructure(aa[i].annotations[a].secondaryStructure +\r
- "");\r
- an.addAnnotationElement(ae);\r
- }\r
+ jalview.datamodel.AlignmentAnnotation[] aa = jal.getAlignmentAnnotation();\r
\r
- vamsasSet.addAnnotation(an);\r
- }\r
- }\r
+ for (int i = 0; i < aa.length; i++)\r
+ {\r
+ if (aa[i].label.equals("Quality") ||\r
+ aa[i].label.equals("Conservation") ||\r
+ aa[i].label.equals("Consensus"))\r
+ {\r
+ continue;\r
+ }\r
+\r
+ Annotation an = new Annotation();\r
+ an.setDescription(aa[i].description);\r
+ an.setGraph(aa[i].isGraph);\r
+ an.setLabel(aa[i].label);\r
+\r
+ AnnotationElement ae;\r
+\r
+ for (int a = 0; a < aa[i].annotations.length; a++)\r
+ {\r
+ if ((aa[i] == null) || (aa[i].annotations[a] == null))\r
+ {\r
+ continue;\r
+ }\r
+\r
+ ae = new AnnotationElement();\r
+ ae.setDescription(aa[i].annotations[a].description);\r
+ ae.setDisplayCharacter(aa[i].annotations[a].displayCharacter);\r
+ ae.setValue(aa[i].annotations[a].value);\r
+ ae.setPosition(a);\r
+ ae.setSecondaryStructure(aa[i].annotations[a].secondaryStructure +\r
+ "");\r
+ an.addAnnotationElement(ae);\r
+ }\r
+\r
+ vamsasSet.addAnnotation(an);\r
+ }\r
+ }\r
\r
- //SAVE GROUPS\r
- if (jal.getGroups() != null)\r
- {\r
- JGroup[] groups = new JGroup[jal.getGroups().size()];\r
+ //SAVE GROUPS\r
+ if (jal.getGroups() != null)\r
+ {\r
+ JGroup[] groups = new JGroup[jal.getGroups().size()];\r
\r
- for (int i = 0; i < groups.length; i++)\r
- {\r
- groups[i] = new JGroup();\r
+ for (int i = 0; i < groups.length; i++)\r
+ {\r
+ groups[i] = new JGroup();\r
+\r
+ jalview.datamodel.SequenceGroup sg = (jalview.datamodel.SequenceGroup) jal.getGroups()\r
+ .elementAt(i);\r
+ groups[i].setStart(sg.getStartRes());\r
+ groups[i].setEnd(sg.getEndRes());\r
+ groups[i].setName(sg.getName());\r
+\r
+ if (sg.cs instanceof ConservationColourScheme)\r
+ {\r
+ groups[i].setConsThreshold(((ConservationColourScheme) sg.cs).inc);\r
+ }\r
+\r
+ if (sg.cs instanceof ResidueColourScheme)\r
+ {\r
+ groups[i].setPidThreshold(((ResidueColourScheme) sg.cs).getThreshold());\r
+ }\r
+ else if (sg.cs instanceof ScoreColourScheme)\r
+ {\r
+ groups[i].setPidThreshold(((ScoreColourScheme) sg.cs).getThreshold());\r
+ }\r
+\r
+ if (sg.cs instanceof jalview.schemes.UserColourScheme)\r
+ {\r
+ groups[i].setColour(SetUserColourScheme(sg.cs, userColours,\r
+ jms));\r
+ }\r
+ else\r
+ {\r
+ groups[i].setColour(ColourSchemeProperty.getColourName(\r
+ sg.cs));\r
+ }\r
+\r
+ groups[i].setOutlineColour(sg.getOutlineColour().getRGB());\r
+ groups[i].setDisplayBoxes(sg.getDisplayBoxes());\r
+ groups[i].setDisplayText(sg.getDisplayText());\r
+ groups[i].setColourText(sg.getColourText());\r
+\r
+ for (int s = 0; s < sg.getSize(); s++)\r
+ {\r
+ jalview.datamodel.Sequence seq = (jalview.datamodel.Sequence) sg.getSequenceAt(s);\r
+ int index = seqids.indexOf(seq);\r
+ groups[i].addSeq(index);\r
+ }\r
+ }\r
\r
- jalview.datamodel.SequenceGroup sg = (jalview.datamodel.SequenceGroup)\r
- jal.getGroups()\r
- .elementAt(i);\r
- groups[i].setStart(sg.getStartRes());\r
- groups[i].setEnd(sg.getEndRes());\r
- groups[i].setName(sg.getName());\r
+ jms.setJGroup(groups);\r
+ }\r
\r
- if (sg.cs instanceof ConservationColourScheme)\r
+ ///////////SAVE VIEWPORT\r
+ Viewport view = new Viewport();\r
+ view.setTitle(af.getTitle());\r
+ view.setXpos(af.getX());\r
+ view.setYpos(af.getY());\r
+ view.setWidth(af.getWidth());\r
+ view.setHeight(af.getHeight());\r
+ view.setStartRes(av.startRes);\r
+ view.setStartSeq(av.startSeq);\r
+\r
+ if (av.getGlobalColourScheme() instanceof jalview.schemes.UserColourScheme)\r
{\r
- groups[i].setConsThreshold( ( (ConservationColourScheme) sg.cs).inc);\r
+ view.setBgColour(SetUserColourScheme(av.getGlobalColourScheme(),\r
+ userColours, jms));\r
}\r
-\r
- if (sg.cs instanceof ResidueColourScheme)\r
+ else\r
{\r
- groups[i].setPidThreshold( ( (ResidueColourScheme) sg.cs).\r
- getThreshold());\r
+ view.setBgColour(ColourSchemeProperty.getColourName(\r
+ av.getGlobalColourScheme()));\r
}\r
- else if (sg.cs instanceof ScoreColourScheme)\r
+\r
+ ColourSchemeI cs = av.getGlobalColourScheme();\r
+\r
+ if (cs instanceof ConservationColourScheme)\r
{\r
- groups[i].setPidThreshold( ( (ScoreColourScheme) sg.cs).getThreshold());\r
+ view.setConsThreshold(((ConservationColourScheme) cs).inc);\r
}\r
\r
- if (sg.cs instanceof jalview.schemes.UserColourScheme)\r
+ if (cs instanceof ResidueColourScheme)\r
{\r
- groups[i].setColour(SetUserColourScheme(sg.cs, userColours,\r
- jms));\r
+ view.setPidThreshold(((ResidueColourScheme) cs).getThreshold());\r
}\r
- else\r
+ else if (cs instanceof ScoreColourScheme)\r
{\r
- groups[i].setColour(ColourSchemeProperty.getColourName(\r
- sg.cs));\r
+ view.setPidThreshold(((ScoreColourScheme) cs).getThreshold());\r
}\r
\r
- groups[i].setOutlineColour(sg.getOutlineColour().getRGB());\r
- groups[i].setDisplayBoxes(sg.getDisplayBoxes());\r
- groups[i].setDisplayText(sg.getDisplayText());\r
- groups[i].setColourText(sg.getColourText());\r
+ view.setConservationSelected(av.getConservationSelected());\r
+ view.setPidSelected(av.getAbovePIDThreshold());\r
+ view.setFontName(av.font.getFontName());\r
+ view.setFontSize(av.font.getSize());\r
+ view.setFontStyle(av.font.getStyle());\r
+ view.setRenderGaps(av.renderGaps);\r
+ view.setShowAnnotation(av.getShowAnnotation());\r
+ view.setShowBoxes(av.getShowBoxes());\r
+ view.setShowColourText(av.getColourText());\r
+ view.setShowConservation(av.showConservation);\r
+ view.setShowFullId(av.getShowFullId());\r
+ view.setShowIdentity(av.showIdentity);\r
+ view.setShowQuality(av.showQuality);\r
+ view.setShowSequenceFeatures(av.showSequenceFeatures);\r
+ view.setShowText(av.getShowText());\r
+ view.setWrapAlignment(av.getWrapAlignment());\r
+\r
+ jms.addViewport(view);\r
+\r
+ object.setJalviewModelSequence(jms);\r
+ object.getVamsasModel().addSequenceSet(vamsasSet);\r
+\r
+ try\r
+ {\r
+ if (!fileName.endsWith(".xml"))\r
+ {\r
+ fileName = fileName + ".xml";\r
+ }\r
\r
- for (int s = 0; s < sg.getSize(); s++)\r
+ JarEntry entry = new JarEntry(fileName);\r
+ jout.putNextEntry(entry);\r
+\r
+ object.marshal(out);\r
+ }\r
+ catch (Exception ex)\r
{\r
- jalview.datamodel.Sequence seq = (jalview.datamodel.Sequence) sg.\r
- getSequenceAt(s);\r
- int index = seqids.indexOf(seq);\r
- groups[i].addSeq(index);\r
+ ex.printStackTrace();\r
}\r
- }\r
-\r
- jms.setJGroup(groups);\r
}\r
\r
- ///////////SAVE VIEWPORT\r
- Viewport view = new Viewport();\r
- view.setTitle(af.getTitle());\r
- view.setXpos(af.getX());\r
- view.setYpos(af.getY());\r
- view.setWidth(af.getWidth());\r
- view.setHeight(af.getHeight());\r
- view.setStartRes(av.startRes);\r
- view.setStartSeq(av.startSeq);\r
-\r
- if (av.getGlobalColourScheme() instanceof jalview.schemes.UserColourScheme)\r
- {\r
- view.setBgColour(SetUserColourScheme(av.getGlobalColourScheme(),\r
- userColours, jms));\r
- }\r
- else\r
+ static String SetUserColourScheme(jalview.schemes.ColourSchemeI cs,\r
+ Vector userColours, JalviewModelSequence jms)\r
{\r
- view.setBgColour(ColourSchemeProperty.getColourName(\r
- av.getGlobalColourScheme()));\r
- }\r
-\r
- ColourSchemeI cs = av.getGlobalColourScheme();\r
+ String id = null;\r
+ jalview.schemes.UserColourScheme ucs = (jalview.schemes.UserColourScheme) cs;\r
\r
- if (cs instanceof ConservationColourScheme)\r
- {\r
- view.setConsThreshold( ( (ConservationColourScheme) cs).inc);\r
- }\r
+ if (!userColours.contains(ucs))\r
+ {\r
+ userColours.add(ucs);\r
\r
- if (cs instanceof ResidueColourScheme)\r
- {\r
- view.setPidThreshold( ( (ResidueColourScheme) cs).getThreshold());\r
- }\r
- else if (cs instanceof ScoreColourScheme)\r
- {\r
- view.setPidThreshold( ( (ScoreColourScheme) cs).getThreshold());\r
- }\r
+ java.awt.Color[] colours = ucs.getColours();\r
+ jalview.binding.UserColours uc = new jalview.binding.UserColours();\r
+ jalview.binding.UserColourScheme jbucs = new jalview.binding.UserColourScheme();\r
\r
- view.setConservationSelected(av.getConservationSelected());\r
- view.setPidSelected(av.getAbovePIDThreshold());\r
- view.setFontName(av.font.getFontName());\r
- view.setFontSize(av.font.getSize());\r
- view.setFontStyle(av.font.getStyle());\r
- view.setRenderGaps(av.renderGaps);\r
- view.setShowAnnotation(av.getShowAnnotation());\r
- view.setShowBoxes(av.getShowBoxes());\r
- view.setShowColourText(av.getColourText());\r
- view.setShowConservation(av.showConservation);\r
- view.setShowFullId(av.getShowFullId());\r
- view.setShowIdentity(av.showIdentity);\r
- view.setShowQuality(av.showQuality);\r
- view.setShowSequenceFeatures(av.showSequenceFeatures);\r
- view.setShowText(av.getShowText());\r
- view.setWrapAlignment(av.getWrapAlignment());\r
-\r
- jms.addViewport(view);\r
-\r
- object.setJalviewModelSequence(jms);\r
- object.getVamsasModel().addSequenceSet(vamsasSet);\r
-\r
- try\r
- {\r
- if (!fileName.endsWith(".xml"))\r
- {\r
- fileName = fileName + ".xml";\r
- }\r
+ for (int i = 0; i < colours.length; i++)\r
+ {\r
+ jalview.binding.Colour col = new jalview.binding.Colour();\r
+ col.setRGB(jalview.util.Format.getHexString(colours[i]));\r
+ jbucs.addColour(col);\r
+ }\r
\r
- JarEntry entry = new JarEntry(fileName);\r
- jout.putNextEntry(entry);\r
+ id = "ucs" + userColours.indexOf(ucs);\r
+ uc.setId(id);\r
+ uc.setUserColourScheme(jbucs);\r
+ jms.addUserColours(uc);\r
+ }\r
\r
- object.marshal(out);\r
+ return id;\r
}\r
- catch (Exception ex)\r
- {\r
- ex.printStackTrace();\r
- }\r
- }\r
-\r
- static String SetUserColourScheme(jalview.schemes.ColourSchemeI cs,\r
- Vector userColours,\r
- JalviewModelSequence jms)\r
- {\r
- String id = null;\r
- jalview.schemes.UserColourScheme ucs = (jalview.schemes.UserColourScheme)\r
- cs;\r
\r
- if (!userColours.contains(ucs))\r
+ static jalview.schemes.UserColourScheme GetUserColourScheme(\r
+ JalviewModelSequence jms, String id)\r
{\r
- userColours.add(ucs);\r
-\r
- java.awt.Color[] colours = ucs.getColours();\r
- jalview.binding.UserColours uc = new jalview.binding.UserColours();\r
- jalview.binding.UserColourScheme jbucs = new jalview.binding.\r
- UserColourScheme();\r
-\r
- for (int i = 0; i < colours.length; i++)\r
- {\r
- jalview.binding.Colour col = new jalview.binding.Colour();\r
- col.setRGB(jalview.util.Format.getHexString(colours[i]));\r
- jbucs.addColour(col);\r
- }\r
-\r
- id = "ucs" + userColours.indexOf(ucs);\r
- uc.setId(id);\r
- uc.setUserColourScheme(jbucs);\r
- jms.addUserColours(uc);\r
- }\r
-\r
- return id;\r
- }\r
+ UserColours[] uc = jms.getUserColours();\r
+ UserColours colours = null;\r
\r
- static jalview.schemes.UserColourScheme GetUserColourScheme(\r
- JalviewModelSequence jms, String id)\r
- {\r
- UserColours[] uc = jms.getUserColours();\r
- UserColours colours = null;\r
+ for (int i = 0; i < uc.length; i++)\r
+ {\r
+ if (uc[i].getId().equals(id))\r
+ {\r
+ colours = uc[i];\r
\r
- for (int i = 0; i < uc.length; i++)\r
- {\r
- if (uc[i].getId().equals(id))\r
- {\r
- colours = uc[i];\r
+ break;\r
+ }\r
+ }\r
\r
- break;\r
- }\r
- }\r
+ int csize = colours.getUserColourScheme().getColourCount();\r
+ java.awt.Color[] newColours = new java.awt.Color[csize];\r
\r
- int csize = colours.getUserColourScheme().getColourCount();\r
- java.awt.Color[] newColours = new java.awt.Color[csize];\r
+ for (int i = 0; i < csize; i++)\r
+ {\r
+ newColours[i] = new java.awt.Color(Integer.parseInt(\r
+ colours.getUserColourScheme().getColour(i).getRGB(), 16));\r
+ }\r
\r
- for (int i = 0; i < csize; i++)\r
- {\r
- newColours[i] = new java.awt.Color(Integer.parseInt(\r
- colours.getUserColourScheme().getColour(i).getRGB(), 16));\r
+ return new jalview.schemes.UserColourScheme(newColours);\r
}\r
\r
- return new jalview.schemes.UserColourScheme(newColours);\r
- }\r
-\r
- public static void LoadJalviewAlign(String file)\r
- {\r
- JalviewModel object = new JalviewModel();\r
-\r
- try\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param file DOCUMENT ME!\r
+ */\r
+ public static AlignFrame LoadJalviewAlign(String file)\r
{\r
- //UNMARSHALLER SEEMS TO CLOSE JARINPUTSTREAM, MOST ANNOYING\r
- URL url = null;\r
+ JalviewModel object = new JalviewModel();\r
+ jalview.gui.AlignFrame af = null;\r
\r
- if (file.startsWith("http://"))\r
- {\r
- url = new URL(file);\r
- }\r
+ try\r
+ {\r
+ //UNMARSHALLER SEEMS TO CLOSE JARINPUTSTREAM, MOST ANNOYING\r
+ URL url = null;\r
\r
- JarInputStream jin = null;\r
- JarEntry jarentry = null;\r
- int entryCount = 1;\r
+ if (file.startsWith("http://"))\r
+ {\r
+ url = new URL(file);\r
+ }\r
\r
- do\r
- {\r
- if (url != null)\r
- {\r
- jin = new JarInputStream(url.openStream());\r
+ JarInputStream jin = null;\r
+ JarEntry jarentry = null;\r
+ int entryCount = 1;\r
+\r
+ do\r
+ {\r
+ if (url != null)\r
+ {\r
+ jin = new JarInputStream(url.openStream());\r
+ }\r
+ else\r
+ {\r
+ jin = new JarInputStream(new FileInputStream(file));\r
+ }\r
+\r
+ for (int i = 0; i < entryCount; i++)\r
+ {\r
+ jarentry = jin.getNextJarEntry();\r
+ }\r
+\r
+ if (jarentry != null)\r
+ {\r
+ InputStreamReader in = new InputStreamReader(jin, "UTF-8");\r
+ object = (JalviewModel) object.unmarshal(in);\r
+ af = LoadFromObject(object);\r
+ entryCount++;\r
+ }\r
+ }\r
+ while (jarentry != null);\r
}\r
- else\r
+ catch (Exception ex)\r
{\r
- jin = new JarInputStream(new FileInputStream(file));\r
- }\r
+ System.err.println("Exception whilst loading jalview XML file : " +\r
+ ex + "\n");\r
+ JOptionPane.showInternalMessageDialog(Desktop.desktop,\r
+ "Couldn't locate " + file,\r
+ "URL not found",\r
+ JOptionPane.WARNING_MESSAGE);\r
\r
- for (int i = 0; i < entryCount; i++)\r
- {\r
- jarentry = jin.getNextJarEntry();\r
}\r
\r
- if (jarentry != null)\r
- {\r
- InputStreamReader in = new InputStreamReader(jin, "UTF-8");\r
- object = (JalviewModel) object.unmarshal(in);\r
- LoadFromObject(object);\r
- entryCount++;\r
- }\r
- }\r
- while (jarentry != null);\r
+ return af;\r
}\r
- catch (Exception ex)\r
+\r
+ static AlignFrame LoadFromObject(JalviewModel object)\r
{\r
- System.err.println("Exception whilst loading jalview XML file : " +\r
- ex + "\n");\r
- ex.printStackTrace();\r
+ Vector seqids = new Vector();\r
+ SequenceSet vamsasSet = object.getVamsasModel().getSequenceSet(0);\r
+ Sequence[] vamsasSeq = vamsasSet.getSequence();\r
\r
- return;\r
- }\r
- }\r
+ JalviewModelSequence jms = object.getJalviewModelSequence();\r
\r
- static void LoadFromObject(JalviewModel object)\r
- {\r
- Vector seqids = new Vector();\r
- SequenceSet vamsasSet = object.getVamsasModel().getSequenceSet(0);\r
- Sequence[] vamsasSeq = vamsasSet.getSequence();\r
+ //////////////////////////////////\r
+ //LOAD SEQUENCES\r
+ jalview.datamodel.Sequence[] jseqs = new jalview.datamodel.Sequence[vamsasSeq.length];\r
+ JSeq[] JSEQ = object.getJalviewModelSequence().getJSeq();\r
\r
- JalviewModelSequence jms = object.getJalviewModelSequence();\r
+ for (int i = 0; i < vamsasSeq.length; i++)\r
+ {\r
+ jseqs[i] = new jalview.datamodel.Sequence(vamsasSeq[i].getName(),\r
+ vamsasSeq[i].getSequence());\r
\r
- //////////////////////////////////\r
- //LOAD SEQUENCES\r
- jalview.datamodel.Sequence[] jseqs = new jalview.datamodel.Sequence[\r
- vamsasSeq.length];\r
- JSeq[] JSEQ = object.getJalviewModelSequence().getJSeq();\r
+ jseqs[i].setStart(JSEQ[i].getStart());\r
+ jseqs[i].setEnd(JSEQ[i].getEnd());\r
+ jseqs[i].setColor(new java.awt.Color(JSEQ[i].getColour()));\r
+ seqids.add(jseqs[i]);\r
+ }\r
\r
- for (int i = 0; i < vamsasSeq.length; i++)\r
- {\r
- jseqs[i] = new jalview.datamodel.Sequence(vamsasSeq[i].getName(),\r
- vamsasSeq[i].getSequence());\r
+ /////////////////////////////////\r
+ jalview.datamodel.Alignment al = new jalview.datamodel.Alignment(jseqs);\r
\r
- jseqs[i].setStart(JSEQ[i].getStart());\r
- jseqs[i].setEnd(JSEQ[i].getEnd());\r
- jseqs[i].setColor(new java.awt.Color(JSEQ[i].getColour()));\r
- seqids.add(jseqs[i]);\r
- }\r
+ /////////////////////////////////\r
+ //////////////////////////////////\r
+ //LOAD ANNOTATIONS\r
+ if (vamsasSet.getAnnotation() != null)\r
+ {\r
+ Annotation[] an = vamsasSet.getAnnotation();\r
\r
- /////////////////////////////////\r
- jalview.datamodel.Alignment al = new jalview.datamodel.Alignment(jseqs);\r
+ for (int i = 0; i < an.length; i++)\r
+ {\r
+ AnnotationElement[] ae = an[i].getAnnotationElement();\r
+ jalview.datamodel.Annotation[] anot = new jalview.datamodel.Annotation[al.getWidth()];\r
+\r
+ for (int aa = 0; aa < ae.length; aa++)\r
+ {\r
+ anot[ae[aa].getPosition()] = new jalview.datamodel.Annotation(ae[aa].getDisplayCharacter(),\r
+ ae[aa].getDescription(),\r
+ ae[aa].getSecondaryStructure().charAt(0),\r
+ ae[aa].getValue());\r
+ }\r
+\r
+ jalview.datamodel.AlignmentAnnotation jaa = null;\r
+\r
+ if (an[i].getGraph())\r
+ {\r
+ jaa = new jalview.datamodel.AlignmentAnnotation(an[i].getLabel(),\r
+ an[i].getDescription(), anot, 0, 0, 1);\r
+ }\r
+ else\r
+ {\r
+ jaa = new jalview.datamodel.AlignmentAnnotation(an[i].getLabel(),\r
+ an[i].getDescription(), anot);\r
+ }\r
+\r
+ al.addAnnotation(jaa);\r
+ }\r
+ }\r
\r
- /////////////////////////////////\r
- //////////////////////////////////\r
- //LOAD ANNOTATIONS\r
- if (vamsasSet.getAnnotation() != null)\r
- {\r
- Annotation[] an = vamsasSet.getAnnotation();\r
+ /////////////////////////////////\r
+ // LOAD VIEWPORT\r
+ Viewport[] views = jms.getViewport();\r
+ Viewport view = views[0]; // DEAL WITH MULTIPLE VIEWPORTS LATER\r
\r
- for (int i = 0; i < an.length; i++)\r
- {\r
- AnnotationElement[] ae = an[i].getAnnotationElement();\r
- jalview.datamodel.Annotation[] anot = new jalview.datamodel.Annotation[\r
- al.getWidth()];\r
+ AlignFrame af = new AlignFrame(al);\r
\r
- for (int aa = 0; aa < ae.length; aa++)\r
+ // af.changeColour() );\r
+ /////////////////////////\r
+ //LOAD GROUPS\r
+ if (jms.getJGroupCount() > 0)\r
{\r
- anot[ae[aa].getPosition()] = new jalview.datamodel.Annotation(ae[aa].\r
- getDisplayCharacter(),\r
- ae[aa].getDescription(),\r
- ae[aa].getSecondaryStructure().charAt(0),\r
- ae[aa].getValue());\r
- }\r
+ JGroup[] groups = jms.getJGroup();\r
\r
- jalview.datamodel.AlignmentAnnotation jaa = null;\r
+ for (int i = 0; i < groups.length; i++)\r
+ {\r
+ ColourSchemeI cs = null;\r
+\r
+ if (groups[i].getColour() != null)\r
+ {\r
+ if (groups[i].getColour().startsWith("ucs"))\r
+ {\r
+ cs = GetUserColourScheme(jms, groups[i].getColour());\r
+ }\r
+ else\r
+ {\r
+ cs = ColourSchemeProperty.getColour(al,\r
+ groups[i].getColour());\r
+ }\r
+\r
+ if (cs instanceof ResidueColourScheme)\r
+ {\r
+ ((ResidueColourScheme) cs).setThreshold(groups[i].getPidThreshold());\r
+ }\r
+ else if (cs instanceof ScoreColourScheme)\r
+ {\r
+ ((ScoreColourScheme) cs).setThreshold(groups[i].getPidThreshold());\r
+ }\r
+ }\r
+\r
+ Vector seqs = new Vector();\r
+ int[] ids = groups[i].getSeq();\r
+\r
+ for (int s = 0; s < ids.length; s++)\r
+ {\r
+ seqs.addElement((jalview.datamodel.SequenceI) seqids.elementAt(\r
+ ids[s]));\r
+ }\r
+\r
+ jalview.datamodel.SequenceGroup sg = new jalview.datamodel.SequenceGroup(seqs,\r
+ groups[i].getName(), cs, groups[i].getDisplayBoxes(),\r
+ groups[i].getDisplayText(), groups[i].getColourText(),\r
+ groups[i].getStart(), groups[i].getEnd());\r
+\r
+ sg.setOutlineColour(new java.awt.Color(\r
+ groups[i].getOutlineColour()));\r
+\r
+ if (groups[i].getConsThreshold() != 0)\r
+ {\r
+ jalview.analysis.Conservation c = new jalview.analysis.Conservation("All",\r
+ ResidueProperties.propHash, 3, sg.sequences, 0,\r
+ sg.getWidth() - 1);\r
+ c.calculate();\r
+ c.verdict(false, 25);\r
+ cs = new ConservationColourScheme(c, cs);\r
+ sg.cs = cs;\r
+ }\r
+\r
+ al.addGroup(sg);\r
+ }\r
+ }\r
\r
- if (an[i].getGraph())\r
+ Desktop.addInternalFrame(af, view.getTitle(),\r
+ AlignFrame.NEW_WINDOW_WIDTH, AlignFrame.NEW_WINDOW_HEIGHT);\r
+ af.setBounds(view.getXpos(), view.getYpos(), view.getWidth(),\r
+ view.getHeight());\r
+ af.viewport.setStartRes(view.getStartRes());\r
+ af.viewport.setStartSeq(view.getStartSeq());\r
+ af.viewport.showConservation = view.getShowConservation();\r
+ af.viewport.showQuality = view.getShowQuality();\r
+ af.viewport.showIdentity = view.getShowIdentity();\r
+ af.viewport.setAbovePIDThreshold(view.getPidSelected());\r
+ af.abovePIDThreshold.setSelected(view.getPidSelected());\r
+ af.viewport.setColourText(view.getShowColourText());\r
+ af.colourTextMenuItem.setSelected(view.getShowColourText());\r
+ af.viewport.setConservationSelected(view.getConservationSelected());\r
+ af.conservationMenuItem.setSelected(view.getConservationSelected());\r
+\r
+ af.viewport.setShowFullId(view.getShowFullId());\r
+ af.fullSeqId.setSelected(view.getShowFullId());\r
+\r
+ af.viewport.setFont(new java.awt.Font(view.getFontName(),\r
+ view.getFontStyle(), view.getFontSize()));\r
+ af.alignPanel.fontChanged();\r
+\r
+ af.viewport.setRenderGaps(view.getRenderGaps());\r
+ af.renderGapsMenuItem.setSelected(view.getRenderGaps());\r
+\r
+ af.viewport.setWrapAlignment(view.getWrapAlignment());\r
+ af.wrapMenuItem.setSelected(view.getWrapAlignment());\r
+\r
+ if (view.getWrapAlignment())\r
{\r
- jaa = new jalview.datamodel.AlignmentAnnotation(an[i].getLabel(),\r
- an[i].getDescription(), anot, 0, 0, 1);\r
+ af.alignPanel.setWrapAlignment(view.getWrapAlignment());\r
}\r
else\r
{\r
- jaa = new jalview.datamodel.AlignmentAnnotation(an[i].getLabel(),\r
- an[i].getDescription(), anot);\r
+ af.annotationPanelMenuItem.setState(view.getShowAnnotation());\r
+ af.viewport.setShowAnnotation(view.getShowAnnotation());\r
+ af.alignPanel.setAnnotationVisible(view.getShowAnnotation());\r
}\r
\r
- al.addAnnotation(jaa);\r
- }\r
- }\r
-\r
- /////////////////////////////////\r
- // LOAD VIEWPORT\r
- Viewport[] views = jms.getViewport();\r
- Viewport view = views[0]; // DEAL WITH MULTIPLE VIEWPORTS LATER\r
-\r
- AlignFrame af = new AlignFrame(al);\r
+ af.viewport.setShowBoxes(view.getShowBoxes());\r
+ af.viewBoxesMenuItem.setSelected(view.getShowBoxes());\r
+ af.viewport.setShowText(view.getShowText());\r
+ af.viewTextMenuItem.setSelected(view.getShowText());\r
\r
- // af.changeColour() );\r
- /////////////////////////\r
- //LOAD GROUPS\r
- if (jms.getJGroupCount() > 0)\r
- {\r
- JGroup[] groups = jms.getJGroup();\r
-\r
- for (int i = 0; i < groups.length; i++)\r
- {\r
ColourSchemeI cs = null;\r
\r
- if (groups[i].getColour() != null)\r
+ if (view.getBgColour() != null)\r
{\r
- if (groups[i].getColour().startsWith("ucs"))\r
- {\r
- cs = GetUserColourScheme(jms, groups[i].getColour());\r
- }\r
- else\r
- {\r
- cs = ColourSchemeProperty.getColour(al,\r
- groups[i].getColour());\r
- }\r
-\r
- if (cs instanceof ResidueColourScheme)\r
- {\r
- ( (ResidueColourScheme) cs).setThreshold(groups[i].getPidThreshold());\r
- }\r
- else if (cs instanceof ScoreColourScheme)\r
- {\r
- ( (ScoreColourScheme) cs).setThreshold(groups[i].getPidThreshold());\r
- }\r
- }\r
+ if (view.getBgColour().startsWith("ucs"))\r
+ {\r
+ cs = GetUserColourScheme(jms, view.getBgColour());\r
+ }\r
+ else\r
+ {\r
+ cs = ColourSchemeProperty.getColour(al, view.getBgColour());\r
+ }\r
\r
- Vector seqs = new Vector();\r
- int[] ids = groups[i].getSeq();\r
+ if (cs instanceof ConservationColourScheme)\r
+ {\r
+ ((ConservationColourScheme) cs).inc = view.getConsThreshold();\r
+ }\r
\r
- for (int s = 0; s < ids.length; s++)\r
- {\r
- seqs.addElement( (jalview.datamodel.SequenceI) seqids.elementAt(\r
- ids[s]));\r
+ if (cs instanceof ResidueColourScheme)\r
+ {\r
+ ((ResidueColourScheme) cs).setThreshold(view.getPidThreshold());\r
+ }\r
+ else if (cs instanceof ScoreColourScheme)\r
+ {\r
+ ((ScoreColourScheme) cs).setThreshold(view.getPidThreshold());\r
+ }\r
}\r
\r
- jalview.datamodel.SequenceGroup sg = new jalview.datamodel.\r
- SequenceGroup(seqs, groups[i].getName(),\r
- cs, groups[i].getDisplayBoxes(),\r
- groups[i].getDisplayText(), groups[i].getColourText(),\r
- groups[i].getStart(), groups[i].getEnd());\r
+ af.viewport.setGlobalColourScheme(cs);\r
\r
- sg.setOutlineColour(new java.awt.Color(\r
- groups[i].getOutlineColour()));\r
+ af.viewport.setColourAppliesToAllGroups(false);\r
+ af.changeColour(af.viewport.getGlobalColourScheme());\r
+ af.viewport.setColourAppliesToAllGroups(true);\r
\r
-\r
- if (groups[i].getConsThreshold() != 0)\r
+ if (view.getShowSequenceFeatures())\r
{\r
- jalview.analysis.Conservation c = new jalview.analysis.Conservation(\r
- "All",\r
- ResidueProperties.propHash, 3, sg.sequences, 0,\r
- sg.getWidth() - 1);\r
- c.calculate();\r
- c.verdict(false, 25);\r
- cs = new ConservationColourScheme(c, cs);\r
- sg.cs = cs;\r
+ af.viewport.showSequenceFeatures = true;\r
+ af.sequenceFeatures.setSelected(true);\r
+ new SequenceFeatureFetcher(al, af.alignPanel);\r
+ al.featuresAdded = true;\r
}\r
\r
- al.addGroup(sg);\r
- }\r
- }\r
-\r
- Desktop.addInternalFrame(af, view.getTitle(),\r
- AlignFrame.NEW_WINDOW_WIDTH,\r
- AlignFrame.NEW_WINDOW_HEIGHT);\r
- af.setBounds(view.getXpos(), view.getYpos(), view.getWidth(),\r
- view.getHeight());\r
- af.viewport.setStartRes(view.getStartRes());\r
- af.viewport.setStartSeq(view.getStartSeq());\r
- af.viewport.showConservation = view.getShowConservation();\r
- af.viewport.showQuality = view.getShowQuality();\r
- af.viewport.showIdentity = view.getShowIdentity();\r
- af.viewport.setAbovePIDThreshold(view.getPidSelected());\r
- af.abovePIDThreshold.setSelected(view.getPidSelected());\r
- af.viewport.setColourText(view.getShowColourText());\r
- af.colourTextMenuItem.setSelected(view.getShowColourText());\r
- af.viewport.setConservationSelected(view.getConservationSelected());\r
- af.conservationMenuItem.setSelected(view.getConservationSelected());\r
-\r
- af.viewport.setShowFullId(view.getShowFullId());\r
- af.fullSeqId.setSelected(view.getShowFullId());\r
-\r
- af.viewport.setFont(new java.awt.Font(view.getFontName(),\r
- view.getFontStyle(), view.getFontSize()));\r
- af.alignPanel.fontChanged();\r
-\r
- af.viewport.setRenderGaps(view.getRenderGaps());\r
- af.renderGapsMenuItem.setSelected(view.getRenderGaps());\r
-\r
- af.viewport.setWrapAlignment(view.getWrapAlignment());\r
- af.wrapMenuItem.setSelected(view.getWrapAlignment());\r
-\r
- if (view.getWrapAlignment())\r
- {\r
- af.alignPanel.setWrapAlignment(view.getWrapAlignment());\r
- }\r
- else\r
- {\r
- af.annotationPanelMenuItem.setState(view.getShowAnnotation());\r
- af.viewport.setShowAnnotation(view.getShowAnnotation());\r
- af.alignPanel.setAnnotationVisible(view.getShowAnnotation());\r
- }\r
-\r
- af.viewport.setShowBoxes(view.getShowBoxes());\r
- af.viewBoxesMenuItem.setSelected(view.getShowBoxes());\r
- af.viewport.setShowText(view.getShowText());\r
- af.viewTextMenuItem.setSelected(view.getShowText());\r
-\r
- ColourSchemeI cs = null;\r
-\r
- if (view.getBgColour() != null)\r
- {\r
- if (view.getBgColour().startsWith("ucs"))\r
- {\r
- cs = GetUserColourScheme(jms, view.getBgColour());\r
- }\r
- else\r
- {\r
- cs = ColourSchemeProperty.getColour(al, view.getBgColour());\r
- }\r
-\r
- if (cs instanceof ConservationColourScheme)\r
- {\r
- ( (ConservationColourScheme) cs).inc = view.getConsThreshold();\r
- }\r
-\r
- if (cs instanceof ResidueColourScheme)\r
- {\r
- ( (ResidueColourScheme) cs).setThreshold(view.getPidThreshold());\r
- }\r
- else if (cs instanceof ScoreColourScheme)\r
- {\r
- ( (ScoreColourScheme) cs).setThreshold(view.getPidThreshold());\r
- }\r
- }\r
-\r
- af.viewport.setGlobalColourScheme(cs);\r
-\r
- af.viewport.setColourAppliesToAllGroups(false);\r
- af.changeColour(af.viewport.getGlobalColourScheme());\r
- af.viewport.setColourAppliesToAllGroups(true);\r
-\r
- if (view.getShowSequenceFeatures())\r
- {\r
- af.viewport.showSequenceFeatures = true;\r
- af.sequenceFeatures.setSelected(true);\r
- new SequenceFeatureFetcher(al, af.alignPanel);\r
- al.featuresAdded = true;\r
- }\r
-\r
- //LOAD TREES\r
- ///////////////////////////////////////\r
- if (jms.getTreeCount() > 0)\r
- {\r
- try\r
- {\r
- for(int t = 0; t<jms.getTreeCount(); t++)\r
+ //LOAD TREES\r
+ ///////////////////////////////////////\r
+ if (jms.getTreeCount() > 0)\r
{\r
- Tree tree = jms.getTree(t);\r
-\r
- TreePanel tp = af.ShowNewickTree(new jalview.io.NewickFile(\r
- tree.getNewick()), tree.getTitle());\r
-\r
- tp.setBounds( tree.getXpos(),\r
- tree.getYpos(),\r
- tree.getWidth(),\r
- tree.getHeight());\r
-\r
- tp.fitToWindow.setState(tree.getFitToWindow());\r
- tp.fitToWindow_actionPerformed(null);\r
- tp.treeCanvas.fontSize = tree.getFontSize();\r
- tp.fontSize.setText("Font Size - "+tree.getFontSize());\r
- tp.placeholdersMenu.setState(tree.getMarkUnlinked());\r
- tp.placeholdersMenu_actionPerformed(null);\r
- tp.bootstrapMenu.setState(tree.getShowBootstrap());\r
- tp.bootstrapMenu_actionPerformed(null);\r
- tp.distanceMenu.setState(tree.getShowDistances());\r
- tp.distanceMenu_actionPerformed(null);\r
- tp.treeCanvas.threshold = tree.getThreshold();\r
- if(tree.getCurrentTree());\r
- af.viewport.setCurrentTree(tp.getTree());\r
+ try\r
+ {\r
+ for (int t = 0; t < jms.getTreeCount(); t++)\r
+ {\r
+ Tree tree = jms.getTree(t);\r
+\r
+ TreePanel tp = af.ShowNewickTree(new jalview.io.NewickFile(\r
+ tree.getNewick()), tree.getTitle());\r
+\r
+ tp.setBounds(tree.getXpos(), tree.getYpos(),\r
+ tree.getWidth(), tree.getHeight());\r
+\r
+ tp.fitToWindow.setState(tree.getFitToWindow());\r
+ tp.fitToWindow_actionPerformed(null);\r
+ tp.treeCanvas.fontSize = tree.getFontSize();\r
+ tp.fontSize.setText("Font Size - " + tree.getFontSize());\r
+ tp.placeholdersMenu.setState(tree.getMarkUnlinked());\r
+ tp.placeholdersMenu_actionPerformed(null);\r
+ tp.bootstrapMenu.setState(tree.getShowBootstrap());\r
+ tp.bootstrapMenu_actionPerformed(null);\r
+ tp.distanceMenu.setState(tree.getShowDistances());\r
+ tp.distanceMenu_actionPerformed(null);\r
+ tp.treeCanvas.threshold = tree.getThreshold();\r
+\r
+ if (tree.getCurrentTree())\r
+ af.viewport.setCurrentTree(tp.getTree());\r
+ }\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ ex.printStackTrace();\r
+ }\r
}\r
- }\r
- catch (Exception ex)\r
- {\r
- ex.printStackTrace();\r
- }\r
+ return af;\r
}\r
- }\r
}\r
import java.awt.*;\r
import java.awt.event.*;\r
import java.awt.image.*;\r
+\r
import javax.swing.*;\r
\r
-public class OverviewPanel\r
- extends JPanel implements Runnable\r
+\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class OverviewPanel extends JPanel implements Runnable\r
{\r
- BufferedImage miniMe;\r
- AlignViewport av;\r
- AlignmentPanel ap;\r
- float scalew = 1f;\r
- float scaleh = 1f;\r
- int width;\r
- int sequencesHeight;\r
- int graphHeight = 30;\r
- int boxX = -1;\r
- int boxY = -1;\r
- int boxWidth = -1;\r
- int boxHeight = -1;\r
- boolean resizing = false;\r
-\r
- public OverviewPanel(AlignmentPanel ap)\r
- {\r
- this.av = ap.av;\r
- this.ap = ap;\r
- setLayout(null);\r
-\r
- // scale the initial size of overviewpanel to shape of alignment\r
- float initialScale = (float) av.alignment.getWidth() /\r
- (float) av.alignment.getHeight();\r
-\r
- if (av.alignment.getWidth() > av.alignment.getHeight())\r
+ BufferedImage miniMe;\r
+ AlignViewport av;\r
+ AlignmentPanel ap;\r
+ float scalew = 1f;\r
+ float scaleh = 1f;\r
+ int width;\r
+ int sequencesHeight;\r
+ int graphHeight = 30;\r
+ int boxX = -1;\r
+ int boxY = -1;\r
+ int boxWidth = -1;\r
+ int boxHeight = -1;\r
+ boolean resizing = false;\r
+\r
+ /**\r
+ * Creates a new OverviewPanel object.\r
+ *\r
+ * @param ap DOCUMENT ME!\r
+ */\r
+ public OverviewPanel(AlignmentPanel ap)\r
{\r
- // wider\r
- width = 400;\r
- sequencesHeight = (int) (400f / initialScale);\r
- }\r
- else\r
- {\r
- // taller\r
- width = (int) (400f * initialScale);\r
- sequencesHeight = 300;\r
-\r
- if (width < 120)\r
- {\r
- width = 120;\r
- }\r
- }\r
+ this.av = ap.av;\r
+ this.ap = ap;\r
+ setLayout(null);\r
\r
- addComponentListener(new ComponentAdapter()\r
- {\r
- public void componentResized(ComponentEvent evt)\r
- {\r
- if ( (getWidth() != width) ||\r
- (getHeight() != (sequencesHeight + graphHeight)))\r
+ // scale the initial size of overviewpanel to shape of alignment\r
+ float initialScale = (float) av.alignment.getWidth() / (float) av.alignment.getHeight();\r
+\r
+ if (av.alignment.getWidth() > av.alignment.getHeight())\r
{\r
- updateOverviewImage();\r
+ // wider\r
+ width = 400;\r
+ sequencesHeight = (int) (400f / initialScale);\r
+ }\r
+ else\r
+ {\r
+ // taller\r
+ width = (int) (400f * initialScale);\r
+ sequencesHeight = 300;\r
+\r
+ if (width < 120)\r
+ {\r
+ width = 120;\r
+ }\r
}\r
- }\r
- });\r
-\r
- addMouseMotionListener(new MouseMotionAdapter()\r
- {\r
- public void mouseDragged(MouseEvent evt)\r
- {\r
- doMouseDragged(evt);\r
- }\r
- });\r
\r
- addMouseListener(new MouseAdapter()\r
- {\r
- public void mousePressed(MouseEvent evt)\r
- {\r
- doMousePressed(evt);\r
- }\r
-\r
- public void mouseReleased(MouseEvent evt)\r
- {\r
- doMouseReleased(evt);\r
- }\r
- });\r
-\r
- updateOverviewImage();\r
- }\r
-\r
- public void doMousePressed(MouseEvent evt)\r
- {\r
- boxX = evt.getX();\r
- boxY = evt.getY();\r
-\r
- checkValid();\r
- repaint();\r
- }\r
-\r
- public void doMouseReleased(MouseEvent evt)\r
- {\r
- boxX = evt.getX();\r
- boxY = evt.getY();\r
- checkValid();\r
-\r
- if (!resizing)\r
- {\r
- ap.setScrollValues( (int) (boxX / scalew / av.getCharWidth()),\r
- (int) (boxY / scaleh / av.getCharHeight()));\r
+ addComponentListener(new ComponentAdapter()\r
+ {\r
+ public void componentResized(ComponentEvent evt)\r
+ {\r
+ if ((getWidth() != width) ||\r
+ (getHeight() != (sequencesHeight + graphHeight)))\r
+ {\r
+ updateOverviewImage();\r
+ }\r
+ }\r
+ });\r
+\r
+ addMouseMotionListener(new MouseMotionAdapter()\r
+ {\r
+ public void mouseDragged(MouseEvent evt)\r
+ {\r
+ doMouseDragged(evt);\r
+ }\r
+ });\r
+\r
+ addMouseListener(new MouseAdapter()\r
+ {\r
+ public void mousePressed(MouseEvent evt)\r
+ {\r
+ doMousePressed(evt);\r
+ }\r
+\r
+ public void mouseReleased(MouseEvent evt)\r
+ {\r
+ doMouseReleased(evt);\r
+ }\r
+ });\r
+\r
+ updateOverviewImage();\r
}\r
- }\r
\r
- public void doMouseDragged(MouseEvent evt)\r
- {\r
- boxX = evt.getX();\r
- boxY = evt.getY();\r
- checkValid();\r
-\r
- if (!resizing)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ */\r
+ public void doMousePressed(MouseEvent evt)\r
{\r
- ap.setScrollValues( (int) (boxX / scalew / av.getCharWidth()),\r
- (int) (boxY / scaleh / av.getCharHeight()));\r
- }\r
- }\r
+ boxX = evt.getX();\r
+ boxY = evt.getY();\r
\r
- void checkValid()\r
- {\r
- if (boxY < 0)\r
- {\r
- boxY = 0;\r
+ checkValid();\r
+ repaint();\r
}\r
\r
- if (boxY > (sequencesHeight - boxHeight))\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ */\r
+ public void doMouseReleased(MouseEvent evt)\r
{\r
- boxY = sequencesHeight - boxHeight + 1;\r
- }\r
+ boxX = evt.getX();\r
+ boxY = evt.getY();\r
+ checkValid();\r
\r
- if (boxX < 0)\r
- {\r
- boxX = 0;\r
+ if (!resizing)\r
+ {\r
+ ap.setScrollValues((int) (boxX / scalew / av.getCharWidth()),\r
+ (int) (boxY / scaleh / av.getCharHeight()));\r
+ }\r
}\r
\r
- if (boxX > (width - boxWidth))\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ */\r
+ public void doMouseDragged(MouseEvent evt)\r
{\r
- boxX = width - boxWidth;\r
- }\r
- }\r
+ boxX = evt.getX();\r
+ boxY = evt.getY();\r
+ checkValid();\r
\r
- public void updateOverviewImage()\r
- {\r
- if (resizing)\r
- {\r
- return;\r
+ if (!resizing)\r
+ {\r
+ ap.setScrollValues((int) (boxX / scalew / av.getCharWidth()),\r
+ (int) (boxY / scaleh / av.getCharHeight()));\r
+ }\r
}\r
\r
- resizing = true;\r
-\r
- Thread thread = new Thread(this);\r
- thread.start();\r
- repaint();\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ void checkValid()\r
+ {\r
+ if (boxY < 0)\r
+ {\r
+ boxY = 0;\r
+ }\r
\r
- public void run()\r
- {\r
- miniMe = null;\r
+ if (boxY > (sequencesHeight - boxHeight))\r
+ {\r
+ boxY = sequencesHeight - boxHeight + 1;\r
+ }\r
\r
- int alwidth = av.alignment.getWidth();\r
- int alheight = av.alignment.getHeight();\r
+ if (boxX < 0)\r
+ {\r
+ boxX = 0;\r
+ }\r
\r
- if ( (getWidth() > 0) && (getHeight() > 0))\r
- {\r
- width = getWidth();\r
- sequencesHeight = getHeight() - graphHeight;\r
+ if (boxX > (width - boxWidth))\r
+ {\r
+ boxX = width - boxWidth;\r
+ }\r
}\r
\r
- setPreferredSize(new Dimension(width, sequencesHeight + graphHeight));\r
-\r
- int fullsizeWidth = alwidth * av.getCharWidth();\r
- int fullsizeHeight = alheight * av.getCharHeight();\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ public void updateOverviewImage()\r
+ {\r
+ if (resizing)\r
+ {\r
+ return;\r
+ }\r
\r
- scalew = (float) width / (float) fullsizeWidth;\r
- scaleh = (float) sequencesHeight / (float) fullsizeHeight;\r
+ resizing = true;\r
\r
- miniMe = new BufferedImage(width, sequencesHeight + graphHeight,\r
- BufferedImage.TYPE_INT_RGB);\r
+ Thread thread = new Thread(this);\r
+ thread.start();\r
+ repaint();\r
+ }\r
\r
- Graphics mg = miniMe.getGraphics();\r
- BufferedImage consensus = new BufferedImage(fullsizeWidth, 60,\r
- BufferedImage.TYPE_3BYTE_BGR);\r
- Graphics g = consensus.getGraphics();\r
- ap.annotationPanel.drawGraph(g, av.conservation, fullsizeWidth, 60);\r
- mg.drawImage(consensus, 0, sequencesHeight, width,\r
- sequencesHeight + graphHeight, 0, 0, fullsizeWidth, 60, this);\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ public void run()\r
+ {\r
+ miniMe = null;\r
\r
- boolean oldRenderGaps = av.renderGaps;\r
+ int alwidth = av.alignment.getWidth();\r
+ int alheight = av.alignment.getHeight();\r
\r
- try\r
- {\r
- // We'll have to draw the full size alignment in chunks, as an image of the\r
- // whole alignment requires too much memory\r
- // Max size depends on the font size, the following is a\r
- // guess at a size which works\r
- int maxSize = 2000 / av.getFont().getSize();\r
- BufferedImage block;\r
- int blockx = 0;\r
- int blocky = 0;\r
- int blockw = 0;\r
- int blockh = 0;\r
- int eRes = 0;\r
- int eSeq = 0;\r
-\r
- av.setRenderGaps(false);\r
-\r
- for (int sRes = 0, chunkx = 0; sRes < alwidth;\r
- sRes += maxSize, chunkx++)\r
- {\r
- eSeq = 0;\r
- eRes += maxSize;\r
-\r
- if (eRes > alwidth)\r
+ if ((getWidth() > 0) && (getHeight() > 0))\r
{\r
- eRes = alwidth;\r
+ width = getWidth();\r
+ sequencesHeight = getHeight() - graphHeight;\r
}\r
\r
- for (int sSeq = 0, chunky = 0; sSeq < alheight;\r
- sSeq += maxSize, chunky++)\r
- {\r
- eSeq += maxSize;\r
+ setPreferredSize(new Dimension(width, sequencesHeight + graphHeight));\r
\r
- if (eSeq > alheight)\r
- {\r
- eSeq = alheight;\r
- }\r
+ int fullsizeWidth = alwidth * av.getCharWidth();\r
+ int fullsizeHeight = alheight * av.getCharHeight();\r
\r
- blocky = 0;\r
- blockx = (int) ( (float) sRes / (float) alwidth * width);\r
+ scalew = (float) width / (float) fullsizeWidth;\r
+ scaleh = (float) sequencesHeight / (float) fullsizeHeight;\r
\r
- block = new BufferedImage( (eRes - sRes) * av.charWidth,\r
- (eSeq - sSeq) * av.charHeight,\r
- BufferedImage.TYPE_3BYTE_BGR);\r
- g = block.getGraphics();\r
+ miniMe = new BufferedImage(width, sequencesHeight + graphHeight,\r
+ BufferedImage.TYPE_INT_RGB);\r
\r
- ap.seqPanel.seqCanvas.drawPanel(g, sRes, eRes, sSeq, eSeq,\r
- sRes, sSeq, 0);\r
+ Graphics mg = miniMe.getGraphics();\r
+ BufferedImage consensus = new BufferedImage(fullsizeWidth, 60,\r
+ BufferedImage.TYPE_3BYTE_BGR);\r
+ Graphics g = consensus.getGraphics();\r
+ ap.annotationPanel.drawGraph(g, av.conservation, fullsizeWidth, 60);\r
+ mg.drawImage(consensus, 0, sequencesHeight, width,\r
+ sequencesHeight + graphHeight, 0, 0, fullsizeWidth, 60, this);\r
\r
- blockh = (int) ( (float) (eSeq - sSeq) / (float) alheight *\r
- sequencesHeight) +\r
- 1;\r
- blockw = (int) ( (float) (eRes - sRes) / (float) alwidth * width) +\r
- 1;\r
+ boolean oldRenderGaps = av.renderGaps;\r
\r
- blocky += (int) ( (float) sSeq / (float) alheight * sequencesHeight);\r
+ try\r
+ {\r
+ // We'll have to draw the full size alignment in chunks, as an image of the\r
+ // whole alignment requires too much memory\r
+ // Max size depends on the font size, the following is a\r
+ // guess at a size which works\r
+ int maxSize = 2000 / av.getFont().getSize();\r
+ BufferedImage block;\r
+ int blockx = 0;\r
+ int blocky = 0;\r
+ int blockw = 0;\r
+ int blockh = 0;\r
+ int eRes = 0;\r
+ int eSeq = 0;\r
+\r
+ av.setRenderGaps(false);\r
+\r
+ for (int sRes = 0, chunkx = 0; sRes < alwidth;\r
+ sRes += maxSize, chunkx++)\r
+ {\r
+ eSeq = 0;\r
+ eRes += maxSize;\r
+\r
+ if (eRes > alwidth)\r
+ {\r
+ eRes = alwidth;\r
+ }\r
+\r
+ for (int sSeq = 0, chunky = 0; sSeq < alheight;\r
+ sSeq += maxSize, chunky++)\r
+ {\r
+ eSeq += maxSize;\r
+\r
+ if (eSeq > alheight)\r
+ {\r
+ eSeq = alheight;\r
+ }\r
+\r
+ blocky = 0;\r
+ blockx = (int) ((float) sRes / (float) alwidth * width);\r
+\r
+ block = new BufferedImage((eRes - sRes) * av.charWidth,\r
+ (eSeq - sSeq) * av.charHeight,\r
+ BufferedImage.TYPE_3BYTE_BGR);\r
+ g = block.getGraphics();\r
+\r
+ ap.seqPanel.seqCanvas.drawPanel(g, sRes, eRes, sSeq, eSeq,\r
+ sRes, sSeq, 0);\r
+\r
+ blockh = (int) ((float) (eSeq - sSeq) / (float) alheight * sequencesHeight) +\r
+ 1;\r
+ blockw = (int) ((float) (eRes - sRes) / (float) alwidth * width) +\r
+ 1;\r
+\r
+ blocky += (int) ((float) sSeq / (float) alheight * sequencesHeight);\r
+\r
+ mg.drawImage(block, blockx, blocky, blockx + blockw,\r
+ blocky + blockh, 0, 0, block.getWidth(),\r
+ block.getHeight(), this);\r
+\r
+ block = null;\r
+ }\r
+ }\r
+ }\r
+ catch (OutOfMemoryError error)\r
+ {\r
+ System.err.println(\r
+ "Out of memory when trying to calculate the overview window image!");\r
+ }\r
\r
- mg.drawImage(block, blockx, blocky, blockx + blockw,\r
- blocky + blockh, 0, 0, block.getWidth(),\r
- block.getHeight(), this);\r
+ av.setRenderGaps(oldRenderGaps);\r
+ resizing = false;\r
\r
- block = null;\r
- }\r
- }\r
- }\r
- catch (OutOfMemoryError error)\r
- {\r
- System.err.println(\r
- "Out of memory when trying to calculate the overview window image!");\r
+ setBoxPosition();\r
}\r
\r
- av.setRenderGaps(oldRenderGaps);\r
- resizing = false;\r
-\r
- setBoxPosition();\r
- }\r
-\r
- public void setBoxPosition()\r
- {\r
- boxX = (int) (av.getStartRes() * av.getCharWidth() * scalew);\r
- boxY = (int) (av.getStartSeq() * av.getCharHeight() * scaleh);\r
- boxWidth = (int) ( (av.getEndRes() - av.getStartRes() + 1) *\r
- av.getCharWidth() * scalew);\r
- boxHeight = (int) (av.getEndSeq() * av.getCharHeight() * scaleh) -\r
- boxY;\r
- repaint();\r
- }\r
-\r
- public void paintComponent(Graphics g)\r
- {\r
- g.setColor(Color.white);\r
- g.fillRect(0, 0, getWidth(), getHeight());\r
- g.setColor(Color.black);\r
-\r
- if (resizing)\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ public void setBoxPosition()\r
{\r
- g.setFont(new Font("Verdana", Font.BOLD, 15));\r
- g.drawString("Recalculating", 5, sequencesHeight / 2);\r
- g.drawString("Overview.....", 5, (sequencesHeight / 2) + 20);\r
+ boxX = (int) (av.getStartRes() * av.getCharWidth() * scalew);\r
+ boxY = (int) (av.getStartSeq() * av.getCharHeight() * scaleh);\r
+ boxWidth = (int) ((av.getEndRes() - av.getStartRes() + 1) * av.getCharWidth() * scalew);\r
+ boxHeight = (int) (av.getEndSeq() * av.getCharHeight() * scaleh) -\r
+ boxY;\r
+ repaint();\r
}\r
- else\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param g DOCUMENT ME!\r
+ */\r
+ public void paintComponent(Graphics g)\r
{\r
- if (miniMe != null)\r
- {\r
- g.drawImage(miniMe, 0, 0, this);\r
- }\r
-\r
- g.setColor(Color.red);\r
- g.drawRect(boxX, boxY, boxWidth, boxHeight);\r
- g.drawRect(boxX + 1, boxY + 1, boxWidth - 2, boxHeight - 2);\r
+ g.setColor(Color.white);\r
+ g.fillRect(0, 0, getWidth(), getHeight());\r
+ g.setColor(Color.black);\r
+\r
+ if (resizing)\r
+ {\r
+ g.setFont(new Font("Verdana", Font.BOLD, 15));\r
+ g.drawString("Recalculating", 5, sequencesHeight / 2);\r
+ g.drawString("Overview.....", 5, (sequencesHeight / 2) + 20);\r
+ }\r
+ else\r
+ {\r
+ if (miniMe != null)\r
+ {\r
+ g.drawImage(miniMe, 0, 0, this);\r
+ }\r
+\r
+ g.setColor(Color.red);\r
+ g.drawRect(boxX, boxY, boxWidth, boxHeight);\r
+ g.drawRect(boxX + 1, boxY + 1, boxWidth - 2, boxHeight - 2);\r
+ }\r
}\r
- }\r
}\r
*/\r
package jalview.gui;\r
\r
-import java.util.*;\r
-\r
-import java.awt.*;\r
-import java.awt.event.*;\r
-\r
import jalview.analysis.*;\r
+\r
import jalview.datamodel.*;\r
-import jalview.jbgui.*;\r
\r
-public class PCAPanel\r
- extends GPCAPanel implements Runnable\r
-{\r
- PCA pca;\r
- int top;\r
- RotatableCanvas rc;\r
- AlignViewport av;\r
+import jalview.jbgui.*;\r
\r
- public PCAPanel(AlignViewport av, SequenceI[] s)\r
- {\r
- this.av = av;\r
+import java.awt.*;\r
+import java.awt.event.*;\r
\r
- if ( (av.getSelectionGroup() != null) &&\r
- (av.getSelectionGroup().getSize() > 3))\r
- {\r
- s = new Sequence[av.getSelectionGroup().getSize()];\r
+import java.util.*;\r
\r
- for (int i = 0; i < s.length; i++)\r
- {\r
- s[i] = av.getSelectionGroup().getSequenceAt(i);\r
- }\r
- }\r
\r
- if (s == null)\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class PCAPanel extends GPCAPanel implements Runnable\r
+{\r
+ PCA pca;\r
+ int top;\r
+ RotatableCanvas rc;\r
+ AlignViewport av;\r
+\r
+ /**\r
+ * Creates a new PCAPanel object.\r
+ *\r
+ * @param av DOCUMENT ME!\r
+ * @param s DOCUMENT ME!\r
+ */\r
+ public PCAPanel(AlignViewport av, SequenceI[] s)\r
{\r
- s = new Sequence[av.getAlignment().getHeight()];\r
-\r
- for (int i = 0; i < av.getAlignment().getHeight(); i++)\r
- {\r
- s[i] = av.getAlignment().getSequenceAt(i);\r
- }\r
+ this.av = av;\r
+\r
+ if ((av.getSelectionGroup() != null) &&\r
+ (av.getSelectionGroup().getSize() > 3))\r
+ {\r
+ s = new Sequence[av.getSelectionGroup().getSize()];\r
+\r
+ for (int i = 0; i < s.length; i++)\r
+ {\r
+ s[i] = av.getSelectionGroup().getSequenceAt(i);\r
+ }\r
+ }\r
+\r
+ if (s == null)\r
+ {\r
+ s = new Sequence[av.getAlignment().getHeight()];\r
+\r
+ for (int i = 0; i < av.getAlignment().getHeight(); i++)\r
+ {\r
+ s[i] = av.getAlignment().getSequenceAt(i);\r
+ }\r
+ }\r
+\r
+ //////////////////////This part was done in PCATHread originally. Is it too slow???\r
+ pca = new PCA(s);\r
+ pca.run();\r
+\r
+ // Now find the component coordinates\r
+ int ii = 0;\r
+\r
+ while ((ii < s.length) && (s[ii] != null))\r
+ {\r
+ ii++;\r
+ }\r
+\r
+ double[][] comps = new double[ii][ii];\r
+\r
+ for (int i = 0; i < ii; i++)\r
+ {\r
+ if (pca.getEigenvalue(i) > 1e-4)\r
+ {\r
+ comps[i] = pca.component(i);\r
+ }\r
+ }\r
+\r
+ //////////////////\r
+ xCombobox.setSelectedIndex(0);\r
+ yCombobox.setSelectedIndex(1);\r
+ zCombobox.setSelectedIndex(2);\r
+\r
+ top = pca.getM().rows - 1;\r
+\r
+ Vector points = new Vector();\r
+ float[][] scores = pca.getComponents(top - 1, top - 2, top - 3, 100);\r
+\r
+ for (int i = 0; i < pca.getM().rows; i++)\r
+ {\r
+ SequencePoint sp = new SequencePoint(s[i], scores[i]);\r
+ points.addElement(sp);\r
+ }\r
+\r
+ rc = new RotatableCanvas(av, points, pca.getM().rows);\r
+\r
+ //rc.printPoints();\r
+ add(rc, BorderLayout.CENTER);\r
}\r
\r
- //////////////////////This part was done in PCATHread originally. Is it too slow???\r
- pca = new PCA(s);\r
- pca.run();\r
-\r
- // Now find the component coordinates\r
- int ii = 0;\r
-\r
- while ( (ii < s.length) && (s[ii] != null))\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ public void run()\r
{\r
- ii++;\r
+ // do stuff\r
}\r
\r
- double[][] comps = new double[ii][ii];\r
-\r
- for (int i = 0; i < ii; i++)\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ void doDimensionChange()\r
{\r
- if (pca.getEigenvalue(i) > 1e-4)\r
- {\r
- comps[i] = pca.component(i);\r
- }\r
+ if (top == 0)\r
+ {\r
+ return;\r
+ }\r
+\r
+ int dim1 = top - xCombobox.getSelectedIndex();\r
+ int dim2 = top - yCombobox.getSelectedIndex();\r
+ int dim3 = top - zCombobox.getSelectedIndex();\r
+\r
+ float[][] scores = pca.getComponents(dim1, dim2, dim3, 100);\r
+\r
+ for (int i = 0; i < pca.getM().rows; i++)\r
+ {\r
+ ((SequencePoint) rc.points.elementAt(i)).coord = scores[i];\r
+ }\r
+\r
+ rc.img = null;\r
+ rc.rotmat.setIdentity();\r
+ rc.initAxes();\r
+ rc.paint(rc.getGraphics());\r
}\r
\r
- //////////////////\r
- xCombobox.setSelectedIndex(0);\r
- yCombobox.setSelectedIndex(1);\r
- zCombobox.setSelectedIndex(2);\r
-\r
- top = pca.getM().rows - 1;\r
-\r
- Vector points = new Vector();\r
- float[][] scores = pca.getComponents(top - 1, top - 2, top - 3, 100);\r
-\r
- for (int i = 0; i < pca.getM().rows; i++)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void xCombobox_actionPerformed(ActionEvent e)\r
{\r
- SequencePoint sp = new SequencePoint(s[i], scores[i]);\r
- points.addElement(sp);\r
+ doDimensionChange();\r
}\r
\r
- rc = new RotatableCanvas(av, points, pca.getM().rows);\r
-\r
- //rc.printPoints();\r
- add(rc, BorderLayout.CENTER);\r
- }\r
-\r
- public void run()\r
- {\r
- // do stuff\r
- }\r
-\r
- void doDimensionChange()\r
- {\r
- if (top == 0)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void yCombobox_actionPerformed(ActionEvent e)\r
{\r
- return;\r
+ doDimensionChange();\r
}\r
\r
- int dim1 = top - xCombobox.getSelectedIndex();\r
- int dim2 = top - yCombobox.getSelectedIndex();\r
- int dim3 = top - zCombobox.getSelectedIndex();\r
-\r
- float[][] scores = pca.getComponents(dim1, dim2, dim3, 100);\r
-\r
- for (int i = 0; i < pca.getM().rows; i++)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void zCombobox_actionPerformed(ActionEvent e)\r
{\r
- ( (SequencePoint) rc.points.elementAt(i)).coord = scores[i];\r
+ doDimensionChange();\r
}\r
-\r
- rc.img = null;\r
- rc.rotmat.setIdentity();\r
- rc.initAxes();\r
- rc.paint(rc.getGraphics());\r
- }\r
-\r
- protected void xCombobox_actionPerformed(ActionEvent e)\r
- {\r
- doDimensionChange();\r
- }\r
-\r
- protected void yCombobox_actionPerformed(ActionEvent e)\r
- {\r
- doDimensionChange();\r
- }\r
-\r
- protected void zCombobox_actionPerformed(ActionEvent e)\r
- {\r
- doDimensionChange();\r
- }\r
}\r
* along with this program; if not, write to the Free Software\r
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
*/\r
-\r
package jalview.gui;\r
+\r
+import jalview.datamodel.*;\r
+\r
import java.awt.*;\r
+\r
import java.util.*;\r
-import jalview.datamodel.*;\r
\r
+\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
public class PaintRefresher\r
{\r
- static Hashtable components = new Hashtable();\r
+ static Hashtable components = new Hashtable();\r
\r
- public static void Register(Component comp, AlignmentI al)\r
- {\r
- if(components.containsKey(al))\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param comp DOCUMENT ME!\r
+ * @param al DOCUMENT ME!\r
+ */\r
+ public static void Register(Component comp, AlignmentI al)\r
{\r
- Vector comps = (Vector)components.get(al);\r
- comps.addElement(comp);\r
+ if (components.containsKey(al))\r
+ {\r
+ Vector comps = (Vector) components.get(al);\r
+ comps.addElement(comp);\r
+ }\r
+ else\r
+ {\r
+ Vector vcoms = new Vector();\r
+ vcoms.addElement(comp);\r
+ components.put(al, vcoms);\r
+ }\r
}\r
- else\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param al DOCUMENT ME!\r
+ */\r
+ public static void Refresh(AlignmentI al)\r
{\r
- Vector vcoms = new Vector();\r
- vcoms.addElement(comp);\r
- components.put(al, vcoms);\r
+ Refresh(null, al);\r
}\r
- }\r
-\r
- public static void Refresh(AlignmentI al)\r
- {\r
- Refresh(null, al);\r
- }\r
\r
- public static void Refresh(Component c, AlignmentI al)\r
- {\r
- Component temp;\r
- Vector coms = (Vector)components.get(al);\r
- Enumeration e = coms.elements();\r
- while( e.hasMoreElements() )\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param c DOCUMENT ME!\r
+ * @param al DOCUMENT ME!\r
+ */\r
+ public static void Refresh(Component c, AlignmentI al)\r
{\r
- temp = (Component)e.nextElement();\r
+ Component temp;\r
+ Vector coms = (Vector) components.get(al);\r
+ Enumeration e = coms.elements();\r
\r
- if(!temp.isValid())\r
- coms.removeElement( temp );\r
- else if( temp == c )\r
- continue;\r
+ while (e.hasMoreElements())\r
+ {\r
+ temp = (Component) e.nextElement();\r
\r
- temp.repaint();\r
- }\r
-\r
- }\r
+ if (!temp.isValid())\r
+ {\r
+ coms.removeElement(temp);\r
+ }\r
+ else if (temp == c)\r
+ {\r
+ continue;\r
+ }\r
\r
+ temp.repaint();\r
+ }\r
+ }\r
}\r
*/\r
package jalview.gui;\r
\r
-import java.util.*;\r
-\r
-import java.awt.event.*;\r
-\r
import jalview.analysis.*;\r
+\r
import jalview.datamodel.*;\r
+\r
import jalview.jbgui.*;\r
\r
-public class PairwiseAlignPanel\r
- extends GPairwiseAlignPanel\r
-{\r
- Vector sequences = new Vector();\r
- AlignViewport av;\r
+import java.awt.event.*;\r
\r
- public PairwiseAlignPanel(AlignViewport av)\r
- {\r
- super();\r
- this.av = av;\r
+import java.util.*;\r
\r
- Vector selsubset = new Vector();\r
\r
- for (int i = 0, j = av.getSelectionGroup().getSize(); i < j; i++)\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class PairwiseAlignPanel extends GPairwiseAlignPanel\r
+{\r
+ Vector sequences = new Vector();\r
+ AlignViewport av;\r
+\r
+ /**\r
+ * Creates a new PairwiseAlignPanel object.\r
+ *\r
+ * @param av DOCUMENT ME!\r
+ */\r
+ public PairwiseAlignPanel(AlignViewport av)\r
{\r
- if (av.getAlignment().getSequences().contains(av.getSelectionGroup()\r
- .getSequenceAt(i)))\r
- {\r
- selsubset.add(av.getSelectionGroup().getSequenceAt(i));\r
- }\r
- }\r
-\r
- float[][] scores = new float[selsubset.size()][selsubset.size()];\r
- double totscore = 0;\r
- int count = selsubset.size();\r
+ super();\r
+ this.av = av;\r
\r
- int acount = 0;\r
+ Vector selsubset = new Vector();\r
\r
- for (int i = 1; i < count; i++)\r
- {\r
- for (int j = 0; j < i; j++)\r
- {\r
- acount++;\r
-\r
- AlignSeq as = new AlignSeq( (SequenceI) selsubset.elementAt(i),\r
- (SequenceI) selsubset.elementAt(j), "pep");\r
- as.calcScoreMatrix();\r
- as.traceAlignment();\r
- as.printAlignment();\r
- scores[i][j] = (float) as.getMaxScore() / (float) as.getASeq1().length;\r
- totscore = totscore + scores[i][j];\r
-\r
- textarea.append(as.getOutput());\r
- sequences.add(new Sequence(as.getS1().getName(), as.getAStr1()));\r
- sequences.add(new Sequence(as.getS2().getName(), as.getAStr2()));\r
- }\r
- }\r
-\r
- if (count > 2)\r
- {\r
- System.out.println(\r
- "Pairwise alignment scaled similarity score matrix\n");\r
+ for (int i = 0, j = av.getSelectionGroup().getSize(); i < j; i++)\r
+ {\r
+ if (av.getAlignment().getSequences().contains(av.getSelectionGroup()\r
+ .getSequenceAt(i)))\r
+ {\r
+ selsubset.add(av.getSelectionGroup().getSequenceAt(i));\r
+ }\r
+ }\r
\r
- for (int i = 0; i < count; i++)\r
- {\r
- jalview.util.Format.print(System.out, "%s \n",\r
- ("" + i) + " " +\r
- ( (SequenceI) selsubset.elementAt(i)).getName());\r
- }\r
+ float[][] scores = new float[selsubset.size()][selsubset.size()];\r
+ double totscore = 0;\r
+ int count = selsubset.size();\r
\r
- System.out.println("\n");\r
+ int acount = 0;\r
\r
- for (int i = 0; i < count; i++)\r
- {\r
- for (int j = 0; j < i; j++)\r
+ for (int i = 1; i < count; i++)\r
{\r
- jalview.util.Format.print(System.out, "%7.3f",\r
- scores[i][j] / totscore);\r
+ for (int j = 0; j < i; j++)\r
+ {\r
+ acount++;\r
+\r
+ AlignSeq as = new AlignSeq((SequenceI) selsubset.elementAt(i),\r
+ (SequenceI) selsubset.elementAt(j), "pep");\r
+ as.calcScoreMatrix();\r
+ as.traceAlignment();\r
+ as.printAlignment();\r
+ scores[i][j] = (float) as.getMaxScore() / (float) as.getASeq1().length;\r
+ totscore = totscore + scores[i][j];\r
+\r
+ textarea.append(as.getOutput());\r
+ sequences.add(new Sequence(as.getS1().getName(), as.getAStr1()));\r
+ sequences.add(new Sequence(as.getS2().getName(), as.getAStr2()));\r
+ }\r
}\r
- }\r
\r
- System.out.println("\n");\r
+ if (count > 2)\r
+ {\r
+ System.out.println(\r
+ "Pairwise alignment scaled similarity score matrix\n");\r
+\r
+ for (int i = 0; i < count; i++)\r
+ {\r
+ jalview.util.Format.print(System.out, "%s \n",\r
+ ("" + i) + " " +\r
+ ((SequenceI) selsubset.elementAt(i)).getName());\r
+ }\r
+\r
+ System.out.println("\n");\r
+\r
+ for (int i = 0; i < count; i++)\r
+ {\r
+ for (int j = 0; j < i; j++)\r
+ {\r
+ jalview.util.Format.print(System.out, "%7.3f",\r
+ scores[i][j] / totscore);\r
+ }\r
+ }\r
+\r
+ System.out.println("\n");\r
+ }\r
}\r
- }\r
-\r
- protected void viewInEditorButton_actionPerformed(ActionEvent e)\r
- {\r
- Sequence[] seq = new Sequence[sequences.size()];\r
\r
- for (int i = 0; i < sequences.size(); i++)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void viewInEditorButton_actionPerformed(ActionEvent e)\r
{\r
- seq[i] = (Sequence) sequences.elementAt(i);\r
- }\r
+ Sequence[] seq = new Sequence[sequences.size()];\r
\r
- AlignFrame af = new AlignFrame(new Alignment(seq));\r
- Desktop.addInternalFrame(af, "Pairwise Aligned Sequences",\r
- AlignFrame.NEW_WINDOW_WIDTH,\r
- AlignFrame.NEW_WINDOW_HEIGHT);\r
- }\r
+ for (int i = 0; i < sequences.size(); i++)\r
+ {\r
+ seq[i] = (Sequence) sequences.elementAt(i);\r
+ }\r
+\r
+ AlignFrame af = new AlignFrame(new Alignment(seq));\r
+ Desktop.addInternalFrame(af, "Pairwise Aligned Sequences",\r
+ AlignFrame.NEW_WINDOW_WIDTH, AlignFrame.NEW_WINDOW_HEIGHT);\r
+ }\r
}\r
*/\r
package jalview.gui;\r
\r
-import java.awt.*;\r
-import java.awt.event.*;\r
-import javax.swing.*;\r
-\r
import MCview.*;\r
+\r
import jalview.analysis.*;\r
+\r
import jalview.datamodel.*;\r
+\r
import jalview.io.*;\r
+\r
import jalview.schemes.*;\r
\r
-public class PopupMenu\r
- extends JPopupMenu\r
+import java.awt.*;\r
+import java.awt.event.*;\r
+\r
+import javax.swing.*;\r
+\r
+\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class PopupMenu extends JPopupMenu\r
{\r
- JMenu groupMenu = new JMenu();\r
- JMenuItem groupName = new JMenuItem();\r
- protected JRadioButtonMenuItem clustalColour = new JRadioButtonMenuItem();\r
- protected JRadioButtonMenuItem zappoColour = new JRadioButtonMenuItem();\r
- protected JRadioButtonMenuItem taylorColour = new JRadioButtonMenuItem();\r
- protected JRadioButtonMenuItem hydrophobicityColour = new\r
- JRadioButtonMenuItem();\r
- protected JRadioButtonMenuItem helixColour = new JRadioButtonMenuItem();\r
- protected JRadioButtonMenuItem strandColour = new JRadioButtonMenuItem();\r
- protected JRadioButtonMenuItem turnColour = new JRadioButtonMenuItem();\r
- protected JRadioButtonMenuItem buriedColour = new JRadioButtonMenuItem();\r
- protected JCheckBoxMenuItem abovePIDColour = new JCheckBoxMenuItem();\r
- protected JRadioButtonMenuItem userDefinedColour = new JRadioButtonMenuItem();\r
- protected JRadioButtonMenuItem PIDColour = new JRadioButtonMenuItem();\r
- protected JRadioButtonMenuItem BLOSUM62Colour = new JRadioButtonMenuItem();\r
- JRadioButtonMenuItem noColourmenuItem = new JRadioButtonMenuItem();\r
- protected JCheckBoxMenuItem conservationMenuItem = new JCheckBoxMenuItem();\r
- AlignmentPanel ap;\r
- JMenu sequenceMenu = new JMenu();\r
- JMenuItem sequenceName = new JMenuItem();\r
- Sequence sequence;\r
- JMenuItem unGroupMenuItem = new JMenuItem();\r
- JMenuItem pdbMenuItem = new JMenuItem();\r
- JMenuItem outline = new JMenuItem();\r
- JRadioButtonMenuItem nucleotideMenuItem = new JRadioButtonMenuItem();\r
- JMenu colourMenu = new JMenu();\r
- JCheckBoxMenuItem showBoxes = new JCheckBoxMenuItem();\r
- JCheckBoxMenuItem showText = new JCheckBoxMenuItem();\r
- JCheckBoxMenuItem showColourText = new JCheckBoxMenuItem();\r
-\r
- public PopupMenu(AlignmentPanel ap, Sequence seq)\r
- {\r
- ///////////////////////////////////////////////////////////\r
- // If this is activated from the sequence panel, the user may want to\r
- // edit or annotate a particular residue. Therefore display the residue menu\r
- //\r
- // If from the IDPanel, we must display the sequence menu\r
- //////////////////////////////////////////////////////////\r
- this.ap = ap;\r
- sequence = seq;\r
-\r
- ButtonGroup colours = new ButtonGroup();\r
- colours.add(noColourmenuItem);\r
- colours.add(clustalColour);\r
- colours.add(zappoColour);\r
- colours.add(taylorColour);\r
- colours.add(hydrophobicityColour);\r
- colours.add(helixColour);\r
- colours.add(strandColour);\r
- colours.add(turnColour);\r
- colours.add(buriedColour);\r
- colours.add(abovePIDColour);\r
- colours.add(userDefinedColour);\r
- colours.add(PIDColour);\r
- colours.add(BLOSUM62Colour);\r
-\r
- try\r
- {\r
- jbInit();\r
+ JMenu groupMenu = new JMenu();\r
+ JMenuItem groupName = new JMenuItem();\r
+ protected JRadioButtonMenuItem clustalColour = new JRadioButtonMenuItem();\r
+ protected JRadioButtonMenuItem zappoColour = new JRadioButtonMenuItem();\r
+ protected JRadioButtonMenuItem taylorColour = new JRadioButtonMenuItem();\r
+ protected JRadioButtonMenuItem hydrophobicityColour = new JRadioButtonMenuItem();\r
+ protected JRadioButtonMenuItem helixColour = new JRadioButtonMenuItem();\r
+ protected JRadioButtonMenuItem strandColour = new JRadioButtonMenuItem();\r
+ protected JRadioButtonMenuItem turnColour = new JRadioButtonMenuItem();\r
+ protected JRadioButtonMenuItem buriedColour = new JRadioButtonMenuItem();\r
+ protected JCheckBoxMenuItem abovePIDColour = new JCheckBoxMenuItem();\r
+ protected JRadioButtonMenuItem userDefinedColour = new JRadioButtonMenuItem();\r
+ protected JRadioButtonMenuItem PIDColour = new JRadioButtonMenuItem();\r
+ protected JRadioButtonMenuItem BLOSUM62Colour = new JRadioButtonMenuItem();\r
+ JRadioButtonMenuItem noColourmenuItem = new JRadioButtonMenuItem();\r
+ protected JCheckBoxMenuItem conservationMenuItem = new JCheckBoxMenuItem();\r
+ AlignmentPanel ap;\r
+ JMenu sequenceMenu = new JMenu();\r
+ JMenuItem sequenceName = new JMenuItem();\r
+ Sequence sequence;\r
+ JMenuItem unGroupMenuItem = new JMenuItem();\r
+ JMenuItem pdbMenuItem = new JMenuItem();\r
+ JMenuItem outline = new JMenuItem();\r
+ JRadioButtonMenuItem nucleotideMenuItem = new JRadioButtonMenuItem();\r
+ JMenu colourMenu = new JMenu();\r
+ JCheckBoxMenuItem showBoxes = new JCheckBoxMenuItem();\r
+ JCheckBoxMenuItem showText = new JCheckBoxMenuItem();\r
+ JCheckBoxMenuItem showColourText = new JCheckBoxMenuItem();\r
+\r
+ /**\r
+ * Creates a new PopupMenu object.\r
+ *\r
+ * @param ap DOCUMENT ME!\r
+ * @param seq DOCUMENT ME!\r
+ */\r
+ public PopupMenu(AlignmentPanel ap, Sequence seq)\r
+ {\r
+ ///////////////////////////////////////////////////////////\r
+ // If this is activated from the sequence panel, the user may want to\r
+ // edit or annotate a particular residue. Therefore display the residue menu\r
+ //\r
+ // If from the IDPanel, we must display the sequence menu\r
+ //////////////////////////////////////////////////////////\r
+ this.ap = ap;\r
+ sequence = seq;\r
+\r
+ ButtonGroup colours = new ButtonGroup();\r
+ colours.add(noColourmenuItem);\r
+ colours.add(clustalColour);\r
+ colours.add(zappoColour);\r
+ colours.add(taylorColour);\r
+ colours.add(hydrophobicityColour);\r
+ colours.add(helixColour);\r
+ colours.add(strandColour);\r
+ colours.add(turnColour);\r
+ colours.add(buriedColour);\r
+ colours.add(abovePIDColour);\r
+ colours.add(userDefinedColour);\r
+ colours.add(PIDColour);\r
+ colours.add(BLOSUM62Colour);\r
+\r
+ try\r
+ {\r
+ jbInit();\r
+ }\r
+ catch (Exception e)\r
+ {\r
+ e.printStackTrace();\r
+ }\r
+\r
+ if ((seq == null) || (seq.getPDBId() == null))\r
+ {\r
+ pdbMenuItem.setVisible(false);\r
+ }\r
+\r
+ SequenceGroup sg = ap.av.getSelectionGroup();\r
+\r
+ if (sg != null)\r
+ {\r
+ groupName.setText(sg.getName());\r
+\r
+ if (sg.cs instanceof ZappoColourScheme)\r
+ {\r
+ zappoColour.setSelected(true);\r
+ }\r
+ else if (sg.cs instanceof TaylorColourScheme)\r
+ {\r
+ taylorColour.setSelected(true);\r
+ }\r
+ else if (sg.cs instanceof PIDColourScheme)\r
+ {\r
+ PIDColour.setSelected(true);\r
+ }\r
+ else if (sg.cs instanceof Blosum62ColourScheme)\r
+ {\r
+ BLOSUM62Colour.setSelected(true);\r
+ }\r
+ else if (sg.cs instanceof UserColourScheme)\r
+ {\r
+ userDefinedColour.setSelected(true);\r
+ }\r
+ else if (sg.cs instanceof HydrophobicColourScheme)\r
+ {\r
+ hydrophobicityColour.setSelected(true);\r
+ }\r
+ else if (sg.cs instanceof HelixColourScheme)\r
+ {\r
+ helixColour.setSelected(true);\r
+ }\r
+ else if (sg.cs instanceof StrandColourScheme)\r
+ {\r
+ strandColour.setSelected(true);\r
+ }\r
+ else if (sg.cs instanceof TurnColourScheme)\r
+ {\r
+ turnColour.setSelected(true);\r
+ }\r
+ else if (sg.cs instanceof BuriedColourScheme)\r
+ {\r
+ buriedColour.setSelected(true);\r
+ }\r
+ else if (sg.cs instanceof ClustalxColourScheme)\r
+ {\r
+ clustalColour.setSelected(true);\r
+ }\r
+ else\r
+ {\r
+ noColourmenuItem.setSelected(true);\r
+ }\r
+\r
+ if (sg.cs instanceof ConservationColourScheme)\r
+ {\r
+ conservationMenuItem.setSelected(true);\r
+ }\r
+\r
+ showText.setSelected(sg.getDisplayText());\r
+ showColourText.setSelected(sg.getColourText());\r
+ showBoxes.setSelected(sg.getDisplayBoxes());\r
+ }\r
+\r
+ if (!ap.av.alignment.getGroups().contains(sg))\r
+ {\r
+ unGroupMenuItem.setVisible(false);\r
+ }\r
+ else\r
+ {\r
+ groupMenu.insertSeparator(3);\r
+ }\r
+\r
+ if (seq == null)\r
+ {\r
+ sequenceMenu.setVisible(false);\r
+ }\r
}\r
- catch (Exception e)\r
- {\r
- e.printStackTrace();\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @throws Exception DOCUMENT ME!\r
+ */\r
+ private void jbInit() throws Exception\r
+ {\r
+ groupMenu.setText("Group");\r
+ groupMenu.setText("Define");\r
+ groupName.setText("Name");\r
+ groupName.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ groupName_actionPerformed(e);\r
+ }\r
+ });\r
+ sequenceMenu.setText("Sequence");\r
+ sequenceName.setText("Edit name");\r
+ sequenceName.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ sequenceName_actionPerformed(e);\r
+ }\r
+ });\r
+ PIDColour.setFocusPainted(false);\r
+ unGroupMenuItem.setText("Remove Group");\r
+ unGroupMenuItem.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ unGroupMenuItem_actionPerformed(e);\r
+ }\r
+ });\r
+ pdbMenuItem.setText("View PDB structure");\r
+ pdbMenuItem.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ pdbMenuItem_actionPerformed(e);\r
+ }\r
+ });\r
+ outline.setText("Border colour");\r
+ outline.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ outline_actionPerformed(e);\r
+ }\r
+ });\r
+ nucleotideMenuItem.setText("Nucleotide");\r
+ nucleotideMenuItem.addActionListener(new ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ nucleotideMenuItem_actionPerformed(e);\r
+ }\r
+ });\r
+ colourMenu.setText("Group Colour");\r
+ showBoxes.setText("Boxes");\r
+ showBoxes.setState(true);\r
+ showBoxes.addActionListener(new ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ showBoxes_actionPerformed(e);\r
+ }\r
+ });\r
+ showText.setText("Text");\r
+ showText.setState(true);\r
+ showText.addActionListener(new ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ showText_actionPerformed(e);\r
+ }\r
+ });\r
+ showColourText.setText("Colour Text");\r
+ showColourText.addActionListener(new ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ showColourText_actionPerformed(e);\r
+ }\r
+ });\r
+ add(groupMenu);\r
+ add(sequenceMenu);\r
+ groupMenu.add(groupName);\r
+ groupMenu.addSeparator();\r
+ groupMenu.add(unGroupMenuItem);\r
+ groupMenu.add(colourMenu);\r
+ groupMenu.addSeparator();\r
+ groupMenu.add(showBoxes);\r
+ groupMenu.add(showText);\r
+ groupMenu.add(showColourText);\r
+ groupMenu.addSeparator();\r
+ groupMenu.add(outline);\r
+ sequenceMenu.add(sequenceName);\r
+ sequenceMenu.add(pdbMenuItem);\r
+ colourMenu.add(noColourmenuItem);\r
+ colourMenu.add(clustalColour);\r
+ colourMenu.add(BLOSUM62Colour);\r
+ colourMenu.add(PIDColour);\r
+ colourMenu.add(zappoColour);\r
+ colourMenu.add(taylorColour);\r
+ colourMenu.add(hydrophobicityColour);\r
+ colourMenu.add(helixColour);\r
+ colourMenu.add(strandColour);\r
+ colourMenu.add(turnColour);\r
+ colourMenu.add(buriedColour);\r
+ colourMenu.add(nucleotideMenuItem);\r
+ colourMenu.add(userDefinedColour);\r
+ colourMenu.addSeparator();\r
+ colourMenu.add(abovePIDColour);\r
+ colourMenu.add(conservationMenuItem);\r
+ noColourmenuItem.setText("None");\r
+ noColourmenuItem.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ noColourmenuItem_actionPerformed(e);\r
+ }\r
+ });\r
+\r
+ clustalColour.setText("Clustalx colours");\r
+ clustalColour.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ clustalColour_actionPerformed(e);\r
+ }\r
+ });\r
+ zappoColour.setText("Zappo");\r
+ zappoColour.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ zappoColour_actionPerformed(e);\r
+ }\r
+ });\r
+ taylorColour.setText("Taylor");\r
+ taylorColour.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ taylorColour_actionPerformed(e);\r
+ }\r
+ });\r
+ hydrophobicityColour.setText("Hydrophobicity");\r
+ hydrophobicityColour.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ hydrophobicityColour_actionPerformed(e);\r
+ }\r
+ });\r
+ helixColour.setText("Helix propensity");\r
+ helixColour.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ helixColour_actionPerformed(e);\r
+ }\r
+ });\r
+ strandColour.setText("Strand propensity");\r
+ strandColour.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ strandColour_actionPerformed(e);\r
+ }\r
+ });\r
+ turnColour.setText("Turn propensity");\r
+ turnColour.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ turnColour_actionPerformed(e);\r
+ }\r
+ });\r
+ buriedColour.setText("Buried Index");\r
+ buriedColour.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ buriedColour_actionPerformed(e);\r
+ }\r
+ });\r
+ abovePIDColour.setText("Above % Identity");\r
+ abovePIDColour.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ abovePIDColour_actionPerformed(e);\r
+ }\r
+ });\r
+ userDefinedColour.setText("User Defined");\r
+ userDefinedColour.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ userDefinedColour_actionPerformed(e);\r
+ }\r
+ });\r
+ PIDColour.setText("Percentage Identity");\r
+ PIDColour.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ PIDColour_actionPerformed(e);\r
+ }\r
+ });\r
+ BLOSUM62Colour.setText("BLOSUM62");\r
+ BLOSUM62Colour.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ BLOSUM62Colour_actionPerformed(e);\r
+ }\r
+ });\r
+ conservationMenuItem.setText("Conservation");\r
+ conservationMenuItem.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ conservationMenuItem_actionPerformed(e);\r
+ }\r
+ });\r
}\r
\r
- if(seq==null || seq.getPDBId()==null)\r
- pdbMenuItem.setVisible(false);\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ void refresh()\r
+ {\r
+ SequenceGroup sg = getGroup();\r
+ SuperGroup superG = ap.av.alignment.getSuperGroup(sg);\r
\r
- SequenceGroup sg = ap.av.getSelectionGroup();\r
+ if (superG != null)\r
+ {\r
+ superG.setSuperGroupProperties(sg);\r
+ }\r
\r
- if (sg != null)\r
- {\r
- groupName.setText(sg.getName());\r
-\r
- if (sg.cs instanceof ZappoColourScheme)\r
- {\r
- zappoColour.setSelected(true);\r
- }\r
- else if (sg.cs instanceof TaylorColourScheme)\r
- {\r
- taylorColour.setSelected(true);\r
- }\r
- else if (sg.cs instanceof PIDColourScheme)\r
- {\r
- PIDColour.setSelected(true);\r
- }\r
- else if (sg.cs instanceof Blosum62ColourScheme)\r
- {\r
- BLOSUM62Colour.setSelected(true);\r
- }\r
- else if (sg.cs instanceof UserColourScheme)\r
- {\r
- userDefinedColour.setSelected(true);\r
- }\r
- else if (sg.cs instanceof HydrophobicColourScheme)\r
- {\r
- hydrophobicityColour.setSelected(true);\r
- }\r
- else if (sg.cs instanceof HelixColourScheme)\r
- {\r
- helixColour.setSelected(true);\r
- }\r
- else if (sg.cs instanceof StrandColourScheme)\r
- {\r
- strandColour.setSelected(true);\r
- }\r
- else if (sg.cs instanceof TurnColourScheme)\r
- {\r
- turnColour.setSelected(true);\r
- }\r
- else if (sg.cs instanceof BuriedColourScheme)\r
- {\r
- buriedColour.setSelected(true);\r
- }\r
- else if (sg.cs instanceof ClustalxColourScheme)\r
- {\r
- clustalColour.setSelected(true);\r
- }\r
- else\r
- {\r
- noColourmenuItem.setSelected(true);\r
- }\r
-\r
- if (sg.cs instanceof ConservationColourScheme)\r
- {\r
- conservationMenuItem.setSelected(true);\r
- }\r
-\r
- showText.setSelected(sg.getDisplayText());\r
- showColourText.setSelected(sg.getColourText());\r
- showBoxes.setSelected(sg.getDisplayBoxes());\r
+ ap.seqPanel.repaint();\r
}\r
\r
- if (!ap.av.alignment.getGroups().contains(sg))\r
- {\r
- unGroupMenuItem.setVisible(false);\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void clustalColour_actionPerformed(ActionEvent e)\r
+ {\r
+ SequenceGroup sg = getGroup();\r
+ sg.cs = new ClustalxColourScheme(sg.sequences,\r
+ ap.av.alignment.getWidth());\r
+ refresh();\r
}\r
- else\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void zappoColour_actionPerformed(ActionEvent e)\r
{\r
- groupMenu.insertSeparator(3);\r
+ getGroup().cs = new ZappoColourScheme();\r
+ refresh();\r
}\r
\r
- if (seq == null)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void taylorColour_actionPerformed(ActionEvent e)\r
{\r
- sequenceMenu.setVisible(false);\r
+ getGroup().cs = new TaylorColourScheme();\r
+ refresh();\r
}\r
- }\r
-\r
- private void jbInit()\r
- throws Exception\r
- {\r
- groupMenu.setText("Group");\r
- groupMenu.setText("Define");\r
- groupName.setText("Name");\r
- groupName.addActionListener(new java.awt.event.ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- groupName_actionPerformed(e);\r
- }\r
- });\r
- sequenceMenu.setText("Sequence");\r
- sequenceName.setText("Edit name");\r
- sequenceName.addActionListener(new java.awt.event.ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- sequenceName_actionPerformed(e);\r
- }\r
- });\r
- PIDColour.setFocusPainted(false);\r
- unGroupMenuItem.setText("Remove Group");\r
- unGroupMenuItem.addActionListener(new java.awt.event.ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- unGroupMenuItem_actionPerformed(e);\r
- }\r
- });\r
- pdbMenuItem.setText("View PDB structure");\r
- pdbMenuItem.addActionListener(new java.awt.event.ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- pdbMenuItem_actionPerformed(e);\r
- }\r
- });\r
- outline.setText("Border colour");\r
- outline.addActionListener(new java.awt.event.ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- outline_actionPerformed(e);\r
- }\r
- });\r
- nucleotideMenuItem.setText("Nucleotide");\r
- nucleotideMenuItem.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- nucleotideMenuItem_actionPerformed(e);\r
- }\r
- });\r
- colourMenu.setText("Group Colour");\r
- showBoxes.setText("Boxes");\r
- showBoxes.setState(true);\r
- showBoxes.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- showBoxes_actionPerformed(e);\r
- }\r
- });\r
- showText.setText("Text");\r
- showText.setState(true);\r
- showText.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- showText_actionPerformed(e);\r
- }\r
- });\r
- showColourText.setText("Colour Text");\r
- showColourText.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- showColourText_actionPerformed(e);\r
- }\r
- });\r
- add(groupMenu);\r
- add(sequenceMenu);\r
- groupMenu.add(groupName);\r
- groupMenu.addSeparator();\r
- groupMenu.add(unGroupMenuItem);\r
- groupMenu.add(colourMenu);\r
- groupMenu.addSeparator();\r
- groupMenu.add(showBoxes);\r
- groupMenu.add(showText);\r
- groupMenu.add(showColourText);\r
- groupMenu.addSeparator();\r
- groupMenu.add(outline);\r
- sequenceMenu.add(sequenceName);\r
- sequenceMenu.add(pdbMenuItem);\r
- colourMenu.add(noColourmenuItem);\r
- colourMenu.add(clustalColour);\r
- colourMenu.add(BLOSUM62Colour);\r
- colourMenu.add(PIDColour);\r
- colourMenu.add(zappoColour);\r
- colourMenu.add(taylorColour);\r
- colourMenu.add(hydrophobicityColour);\r
- colourMenu.add(helixColour);\r
- colourMenu.add(strandColour);\r
- colourMenu.add(turnColour);\r
- colourMenu.add(buriedColour);\r
- colourMenu.add(nucleotideMenuItem);\r
- colourMenu.add(userDefinedColour);\r
- colourMenu.addSeparator();\r
- colourMenu.add(abovePIDColour);\r
- colourMenu.add(conservationMenuItem);\r
- noColourmenuItem.setText("None");\r
- noColourmenuItem.addActionListener(new java.awt.event.ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- noColourmenuItem_actionPerformed(e);\r
- }\r
- });\r
-\r
- clustalColour.setText("Clustalx colours");\r
- clustalColour.addActionListener(new java.awt.event.ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- clustalColour_actionPerformed(e);\r
- }\r
- });\r
- zappoColour.setText("Zappo");\r
- zappoColour.addActionListener(new java.awt.event.ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- zappoColour_actionPerformed(e);\r
- }\r
- });\r
- taylorColour.setText("Taylor");\r
- taylorColour.addActionListener(new java.awt.event.ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- taylorColour_actionPerformed(e);\r
- }\r
- });\r
- hydrophobicityColour.setText("Hydrophobicity");\r
- hydrophobicityColour.addActionListener(new java.awt.event.ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- hydrophobicityColour_actionPerformed(e);\r
- }\r
- });\r
- helixColour.setText("Helix propensity");\r
- helixColour.addActionListener(new java.awt.event.ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- helixColour_actionPerformed(e);\r
- }\r
- });\r
- strandColour.setText("Strand propensity");\r
- strandColour.addActionListener(new java.awt.event.ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- strandColour_actionPerformed(e);\r
- }\r
- });\r
- turnColour.setText("Turn propensity");\r
- turnColour.addActionListener(new java.awt.event.ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- turnColour_actionPerformed(e);\r
- }\r
- });\r
- buriedColour.setText("Buried Index");\r
- buriedColour.addActionListener(new java.awt.event.ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- buriedColour_actionPerformed(e);\r
- }\r
- });\r
- abovePIDColour.setText("Above % Identity");\r
- abovePIDColour.addActionListener(new java.awt.event.ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- abovePIDColour_actionPerformed(e);\r
- }\r
- });\r
- userDefinedColour.setText("User Defined");\r
- userDefinedColour.addActionListener(new java.awt.event.ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- userDefinedColour_actionPerformed(e);\r
- }\r
- });\r
- PIDColour.setText("Percentage Identity");\r
- PIDColour.addActionListener(new java.awt.event.ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- PIDColour_actionPerformed(e);\r
- }\r
- });\r
- BLOSUM62Colour.setText("BLOSUM62");\r
- BLOSUM62Colour.addActionListener(new java.awt.event.ActionListener()\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void hydrophobicityColour_actionPerformed(ActionEvent e)\r
{\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- BLOSUM62Colour_actionPerformed(e);\r
- }\r
- });\r
- conservationMenuItem.setText("Conservation");\r
- conservationMenuItem.addActionListener(new java.awt.event.ActionListener()\r
+ getGroup().cs = new HydrophobicColourScheme();\r
+ refresh();\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void helixColour_actionPerformed(ActionEvent e)\r
{\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- conservationMenuItem_actionPerformed(e);\r
- }\r
- });\r
- }\r
-\r
- void refresh()\r
- {\r
- SequenceGroup sg = getGroup();\r
- SuperGroup superG = ap.av.alignment.getSuperGroup(sg);\r
-\r
- if (superG != null)\r
+ getGroup().cs = new HelixColourScheme();\r
+ refresh();\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void strandColour_actionPerformed(ActionEvent e)\r
{\r
- superG.setSuperGroupProperties(sg);\r
+ getGroup().cs = new StrandColourScheme();\r
+ refresh();\r
}\r
\r
- ap.seqPanel.repaint();\r
- }\r
-\r
- protected void clustalColour_actionPerformed(ActionEvent e)\r
- {\r
- SequenceGroup sg = getGroup();\r
- sg.cs = new ClustalxColourScheme(sg.sequences,\r
- ap.av.alignment.getWidth());\r
- refresh();\r
- }\r
-\r
- protected void zappoColour_actionPerformed(ActionEvent e)\r
- {\r
- getGroup().cs = new ZappoColourScheme();\r
- refresh();\r
- }\r
-\r
- protected void taylorColour_actionPerformed(ActionEvent e)\r
- {\r
- getGroup().cs = new TaylorColourScheme();\r
- refresh();\r
- }\r
-\r
- protected void hydrophobicityColour_actionPerformed(ActionEvent e)\r
- {\r
- getGroup().cs = new HydrophobicColourScheme();\r
- refresh();\r
- }\r
-\r
- protected void helixColour_actionPerformed(ActionEvent e)\r
- {\r
- getGroup().cs = new HelixColourScheme();\r
- refresh();\r
- }\r
-\r
- protected void strandColour_actionPerformed(ActionEvent e)\r
- {\r
- getGroup().cs = new StrandColourScheme();\r
- refresh();\r
- }\r
-\r
- protected void turnColour_actionPerformed(ActionEvent e)\r
- {\r
- getGroup().cs = new TurnColourScheme();\r
- refresh();\r
- }\r
-\r
- protected void buriedColour_actionPerformed(ActionEvent e)\r
- {\r
- getGroup().cs = new BuriedColourScheme();\r
- refresh();\r
- }\r
-\r
- public void nucleotideMenuItem_actionPerformed(ActionEvent e)\r
- {\r
- getGroup().cs = new NucleotideColourScheme();\r
- refresh();\r
- }\r
-\r
- protected void abovePIDColour_actionPerformed(ActionEvent e)\r
- {\r
- SequenceGroup sg = getGroup();\r
-\r
- if (abovePIDColour.isSelected())\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void turnColour_actionPerformed(ActionEvent e)\r
{\r
- sg.cs.setConsensus(AAFrequency.calculate(sg.sequences, 0,\r
- ap.av.alignment.getWidth()));\r
-\r
- int threshold = SliderPanel.setPIDSliderSource(ap, sg.cs,\r
- getGroup().getName());\r
-\r
- if (sg.cs instanceof ResidueColourScheme)\r
- {\r
- ( (ResidueColourScheme) sg.cs).setThreshold(threshold);\r
- }\r
- else if (sg.cs instanceof ScoreColourScheme)\r
- {\r
- ( (ScoreColourScheme) sg.cs).setThreshold(threshold);\r
- }\r
-\r
- SliderPanel.showPIDSlider();\r
+ getGroup().cs = new TurnColourScheme();\r
+ refresh();\r
}\r
- else // remove PIDColouring\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void buriedColour_actionPerformed(ActionEvent e)\r
{\r
- ResidueColourScheme rcs = (ResidueColourScheme) sg.cs;\r
- rcs.setThreshold(0);\r
- sg.cs = rcs;\r
+ getGroup().cs = new BuriedColourScheme();\r
+ refresh();\r
}\r
\r
- refresh();\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void nucleotideMenuItem_actionPerformed(ActionEvent e)\r
+ {\r
+ getGroup().cs = new NucleotideColourScheme();\r
+ refresh();\r
+ }\r
\r
- protected void userDefinedColour_actionPerformed(ActionEvent e)\r
- {\r
- new UserDefinedColours(ap, getGroup());\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void abovePIDColour_actionPerformed(ActionEvent e)\r
+ {\r
+ SequenceGroup sg = getGroup();\r
+\r
+ if (abovePIDColour.isSelected())\r
+ {\r
+ sg.cs.setConsensus(AAFrequency.calculate(sg.sequences, 0,\r
+ ap.av.alignment.getWidth()));\r
+\r
+ int threshold = SliderPanel.setPIDSliderSource(ap, sg.cs,\r
+ getGroup().getName());\r
+\r
+ if (sg.cs instanceof ResidueColourScheme)\r
+ {\r
+ ((ResidueColourScheme) sg.cs).setThreshold(threshold);\r
+ }\r
+ else if (sg.cs instanceof ScoreColourScheme)\r
+ {\r
+ ((ScoreColourScheme) sg.cs).setThreshold(threshold);\r
+ }\r
+\r
+ SliderPanel.showPIDSlider();\r
+ }\r
+ else // remove PIDColouring\r
+ {\r
+ ResidueColourScheme rcs = (ResidueColourScheme) sg.cs;\r
+ rcs.setThreshold(0);\r
+ sg.cs = rcs;\r
+ }\r
+\r
+ refresh();\r
+ }\r
\r
- protected void PIDColour_actionPerformed(ActionEvent e)\r
- {\r
- SequenceGroup sg = getGroup();\r
- sg.cs = new PIDColourScheme();\r
- sg.cs.setConsensus(AAFrequency.calculate(sg.sequences, 0,\r
- ap.av.alignment.getWidth()));\r
- refresh();\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void userDefinedColour_actionPerformed(ActionEvent e)\r
+ {\r
+ new UserDefinedColours(ap, getGroup());\r
+ }\r
\r
- protected void BLOSUM62Colour_actionPerformed(ActionEvent e)\r
- {\r
- SequenceGroup sg = getGroup();\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void PIDColour_actionPerformed(ActionEvent e)\r
+ {\r
+ SequenceGroup sg = getGroup();\r
+ sg.cs = new PIDColourScheme();\r
+ sg.cs.setConsensus(AAFrequency.calculate(sg.sequences, 0,\r
+ ap.av.alignment.getWidth()));\r
+ refresh();\r
+ }\r
\r
- sg.cs = new Blosum62ColourScheme();\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void BLOSUM62Colour_actionPerformed(ActionEvent e)\r
+ {\r
+ SequenceGroup sg = getGroup();\r
\r
- sg.cs.setConsensus(AAFrequency.calculate(sg.sequences, 0,\r
- ap.av.alignment.getWidth()));\r
+ sg.cs = new Blosum62ColourScheme();\r
\r
- refresh();\r
- }\r
+ sg.cs.setConsensus(AAFrequency.calculate(sg.sequences, 0,\r
+ ap.av.alignment.getWidth()));\r
\r
- protected void noColourmenuItem_actionPerformed(ActionEvent e)\r
- {\r
- getGroup().cs = null;\r
- refresh();\r
- }\r
+ refresh();\r
+ }\r
\r
- protected void conservationMenuItem_actionPerformed(ActionEvent e)\r
- {\r
- SequenceGroup sg = getGroup();\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void noColourmenuItem_actionPerformed(ActionEvent e)\r
+ {\r
+ getGroup().cs = null;\r
+ refresh();\r
+ }\r
\r
- if (conservationMenuItem.isSelected())\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void conservationMenuItem_actionPerformed(ActionEvent e)\r
{\r
- Conservation c = new Conservation("Group",\r
- ResidueProperties.propHash, 3,\r
- sg.sequences, 0,\r
- ap.av.alignment.getWidth());\r
+ SequenceGroup sg = getGroup();\r
\r
- c.calculate();\r
- c.verdict(false, ap.av.ConsPercGaps);\r
+ if (conservationMenuItem.isSelected())\r
+ {\r
+ Conservation c = new Conservation("Group",\r
+ ResidueProperties.propHash, 3, sg.sequences, 0,\r
+ ap.av.alignment.getWidth());\r
\r
- ConservationColourScheme ccs = new ConservationColourScheme(c, sg.cs);\r
+ c.calculate();\r
+ c.verdict(false, ap.av.ConsPercGaps);\r
\r
- sg.cs = ccs;\r
+ ConservationColourScheme ccs = new ConservationColourScheme(c, sg.cs);\r
\r
- SliderPanel.setConservationSlider(ap, ccs, sg.getName());\r
- SliderPanel.showConservationSlider();\r
- }\r
- else // remove ConservationColouring\r
- {\r
- ConservationColourScheme ccs = (ConservationColourScheme) sg.cs;\r
- sg.cs = ccs.cs;\r
- }\r
+ sg.cs = ccs;\r
\r
- refresh();\r
- }\r
+ SliderPanel.setConservationSlider(ap, ccs, sg.getName());\r
+ SliderPanel.showConservationSlider();\r
+ }\r
+ else // remove ConservationColouring\r
+ {\r
+ ConservationColourScheme ccs = (ConservationColourScheme) sg.cs;\r
+ sg.cs = ccs.cs;\r
+ }\r
\r
- protected void groupName_actionPerformed(ActionEvent e)\r
- {\r
- SequenceGroup sg = getGroup();\r
- String reply = JOptionPane.showInternalInputDialog(Desktop.desktop,\r
- "Enter new group name", "Edit group name",\r
- JOptionPane.QUESTION_MESSAGE);\r
+ refresh();\r
+ }\r
\r
- if (reply == null)\r
- {\r
- return;\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void groupName_actionPerformed(ActionEvent e)\r
+ {\r
+ SequenceGroup sg = getGroup();\r
+ String reply = JOptionPane.showInternalInputDialog(Desktop.desktop,\r
+ "Enter new group name", "Edit group name",\r
+ JOptionPane.QUESTION_MESSAGE);\r
+\r
+ if (reply == null)\r
+ {\r
+ return;\r
+ }\r
+\r
+ sg.setName(reply);\r
+ groupName.setText(reply);\r
}\r
\r
- sg.setName(reply);\r
- groupName.setText(reply);\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void analyze_actionPerformed(ActionEvent e)\r
+ {\r
+ CutAndPasteTransfer cap = new CutAndPasteTransfer();\r
+ JInternalFrame frame = new JInternalFrame();\r
+ frame.setContentPane(cap);\r
+ Desktop.addInternalFrame(frame, "Analyze this - ", 400, 300);\r
+\r
+ SequenceGroup sg = getGroup();\r
+ StringBuffer sb = new StringBuffer();\r
+\r
+ for (int i = 0; i < sg.sequences.size(); i++)\r
+ {\r
+ Sequence tmp = (Sequence) sg.sequences.get(i);\r
+ sb.append(tmp.getSequence(sg.getStartRes(), sg.getEndRes() + 1));\r
+ sb.append("\n");\r
+ }\r
+\r
+ sb.append("Something amazing will happen soon");\r
+ cap.setText(sb.toString());\r
+ }\r
\r
- protected void analyze_actionPerformed(ActionEvent e)\r
- {\r
- CutAndPasteTransfer cap = new CutAndPasteTransfer();\r
- JInternalFrame frame = new JInternalFrame();\r
- frame.setContentPane(cap);\r
- Desktop.addInternalFrame(frame, "Analyze this - ", 400, 300);\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ SequenceGroup getGroup()\r
+ {\r
+ SequenceGroup sg = ap.av.getSelectionGroup();\r
\r
- SequenceGroup sg = getGroup();\r
- StringBuffer sb = new StringBuffer();\r
+ // this method won't add a new group if it already exists\r
+ ap.av.alignment.addGroup(sg);\r
\r
- for (int i = 0; i < sg.sequences.size(); i++)\r
- {\r
- Sequence tmp = (Sequence) sg.sequences.get(i);\r
- sb.append(tmp.getSequence(sg.getStartRes(), sg.getEndRes() + 1));\r
- sb.append("\n");\r
+ return sg;\r
}\r
\r
- sb.append("Something amazing will happen soon");\r
- cap.setText(sb.toString());\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ void sequenceName_actionPerformed(ActionEvent e)\r
+ {\r
+ String id = sequence.getName();\r
+ String s = (String) JOptionPane.showInternalInputDialog(ap,\r
+ "Edit sequence name",\r
+ "Edit sequence name (" + sequence.getName() + ")",\r
+ JOptionPane.PLAIN_MESSAGE, null, null, id);\r
+\r
+ if (s != null)\r
+ {\r
+ if (s.indexOf(" ") > -1)\r
+ {\r
+ JOptionPane.showMessageDialog(ap,\r
+ "Spaces have been converted to \"_\"",\r
+ "No spaces allowed in Sequence Name",\r
+ JOptionPane.WARNING_MESSAGE);\r
+ }\r
+\r
+ s = s.replace(' ', '_');\r
+ sequence.setName(s);\r
+ ap.repaint();\r
+ }\r
+ }\r
\r
- SequenceGroup getGroup()\r
- {\r
- SequenceGroup sg = ap.av.getSelectionGroup();\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ void unGroupMenuItem_actionPerformed(ActionEvent e)\r
+ {\r
+ SequenceGroup sg = ap.av.getSelectionGroup();\r
+ ap.av.alignment.deleteGroup(sg);\r
+ ap.av.setSelectionGroup(null);\r
+ refresh();\r
+ }\r
\r
- // this method won't add a new group if it already exists\r
- ap.av.alignment.addGroup(sg);\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ void pdbMenuItem_actionPerformed(ActionEvent e)\r
+ {\r
+ if (sequence.getPDBId() == null)\r
+ {\r
+ return;\r
+ }\r
+\r
+ try\r
+ {\r
+ EBIFetchClient ebi = new EBIFetchClient();\r
+ String[] result = ebi.fetchData("pdb:" + sequence.getPDBId(), null,\r
+ null);\r
+\r
+ PDBfile pdb = new PDBfile(result);\r
+\r
+ rotCanvas rc = new rotCanvas(pdb, sequence, ap.av);\r
+ JInternalFrame frame = new JInternalFrame();\r
+ frame.setContentPane(rc);\r
+ Desktop.addInternalFrame(frame,\r
+ sequence.getName() + " " + sequence.getPDBId(), 400, 400);\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ ex.printStackTrace();\r
+ }\r
+ }\r
\r
- return sg;\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void outline_actionPerformed(ActionEvent e)\r
+ {\r
+ SequenceGroup sg = getGroup();\r
+ Color col = JColorChooser.showDialog(this, "Select Outline Colour",\r
+ Color.BLUE);\r
\r
- void sequenceName_actionPerformed(ActionEvent e)\r
- {\r
- String id = sequence.getName();\r
- String s = (String) JOptionPane.showInternalInputDialog(ap,\r
- "Edit sequence name",\r
- "Edit sequence name (" + sequence.getName() + ")",\r
- JOptionPane.PLAIN_MESSAGE, null, null, id);\r
+ if (col != null)\r
+ {\r
+ sg.setOutlineColour(col);\r
+ }\r
\r
- if (s != null)\r
- {\r
- if(s.indexOf(" ")>-1)\r
- JOptionPane.showMessageDialog(ap, "Spaces have been converted to \"_\"",\r
- "No spaces allowed in Sequence Name", JOptionPane.WARNING_MESSAGE);\r
- s = s.replace(' ', '_');\r
- sequence.setName(s);\r
- ap.repaint();\r
- }\r
- }\r
-\r
- void unGroupMenuItem_actionPerformed(ActionEvent e)\r
- {\r
- SequenceGroup sg = ap.av.getSelectionGroup();\r
- ap.av.alignment.deleteGroup(sg);\r
- ap.av.setSelectionGroup(null);\r
- refresh();\r
- }\r
-\r
- void pdbMenuItem_actionPerformed(ActionEvent e)\r
- {\r
- if (sequence.getPDBId() == null)\r
- {\r
- return;\r
+ refresh();\r
}\r
\r
- try\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void showBoxes_actionPerformed(ActionEvent e)\r
{\r
- EBIFetchClient ebi = new EBIFetchClient();\r
- String[] result = ebi.fetchData("pdb:" + sequence.getPDBId(), null,\r
- null);\r
-\r
- PDBfile pdb = new PDBfile(result);\r
-\r
- rotCanvas rc = new rotCanvas(pdb, sequence, ap.av);\r
- JInternalFrame frame = new JInternalFrame();\r
- frame.setContentPane(rc);\r
- Desktop.addInternalFrame(frame,\r
- sequence.getName() + " " + sequence.getPDBId(),\r
- 400, 400);\r
+ getGroup().setDisplayBoxes(showBoxes.isSelected());\r
+ refresh();\r
}\r
- catch (Exception ex)\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void showText_actionPerformed(ActionEvent e)\r
{\r
- ex.printStackTrace();\r
+ getGroup().setDisplayText(showText.isSelected());\r
+ refresh();\r
}\r
- }\r
\r
- protected void outline_actionPerformed(ActionEvent e)\r
- {\r
- SequenceGroup sg = getGroup();\r
- Color col = JColorChooser.showDialog(this, "Select Outline Colour",\r
- Color.BLUE);\r
-\r
- if (col != null)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void showColourText_actionPerformed(ActionEvent e)\r
{\r
- sg.setOutlineColour(col);\r
+ getGroup().setColourText(showColourText.isSelected());\r
+ refresh();\r
}\r
-\r
- refresh();\r
- }\r
-\r
- public void showBoxes_actionPerformed(ActionEvent e)\r
- {\r
- getGroup().setDisplayBoxes(showBoxes.isSelected());\r
- refresh();\r
- }\r
-\r
- public void showText_actionPerformed(ActionEvent e)\r
- {\r
- getGroup().setDisplayText(showText.isSelected());\r
- refresh();\r
- }\r
-\r
- public void showColourText_actionPerformed(ActionEvent e)\r
- {\r
- getGroup().setColourText(showColourText.isSelected());\r
- refresh();\r
- }\r
}\r
*/\r
package jalview.gui;\r
\r
-import java.awt.*;\r
-import java.awt.event.*;\r
-import javax.swing.*;\r
-\r
import jalview.bin.*;\r
+\r
import jalview.io.*;\r
+\r
import jalview.jbgui.*;\r
+\r
import jalview.schemes.*;\r
\r
-public class Preferences\r
- extends GPreferences\r
+import java.awt.*;\r
+import java.awt.event.*;\r
+\r
+import javax.swing.*;\r
+\r
+\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class Preferences extends GPreferences\r
{\r
- static boolean preferencesLoaded = false;\r
- public static boolean showFullscreen = false;\r
- public static boolean showFullId = true;\r
- public static boolean showAnnotation = true;\r
- public static boolean showConservation = true;\r
- public static boolean showQuality = true;\r
- public static boolean showIdentity = true;\r
- public static String fontName = "SansSerif";\r
- public static String fontSize = "10";\r
- public static String fontStyle = Font.PLAIN + "";\r
- public static char gapSymbol = '-';\r
- public static String defaultColour = null;\r
- public static boolean showStartupFile = true;\r
- public static String startupFile =\r
- "http://www.jalview.org/examples/exampleFile.jar";\r
- JInternalFrame frame;\r
-\r
- public Preferences()\r
- {\r
- initPreferences();\r
-\r
- frame = new JInternalFrame();\r
- frame.setContentPane(this);\r
- Desktop.addInternalFrame(frame, "Preferences", 480, 390);\r
-\r
- fullID.setSelected(showFullId);\r
-\r
- String string = Cache.getProperty("SHOW_FULLSCREEN");\r
- boolean value = false;\r
-\r
- if (string != null)\r
- {\r
- value = Boolean.valueOf(string).booleanValue();\r
- }\r
+ static boolean preferencesLoaded = false;\r
\r
- fullScreen.setSelected(value);\r
- annotations.setSelected(showAnnotation);\r
+ /** DOCUMENT ME!! */\r
+ public static boolean showFullscreen = false;\r
\r
- conservation.setEnabled(showAnnotation);\r
- quality.setEnabled(showAnnotation);\r
- identity.setEnabled(showAnnotation);\r
+ /** DOCUMENT ME!! */\r
+ public static boolean showFullId = true;\r
\r
- conservation.setSelected(showConservation);\r
- quality.setSelected(showQuality);\r
- identity.setSelected(showIdentity);\r
+ /** DOCUMENT ME!! */\r
+ public static boolean showAnnotation = true;\r
\r
- for (int i = 0; i < 12; i++)\r
- {\r
- colour.addItem(ColourSchemeProperty.getColourName(i));\r
- }\r
+ /** DOCUMENT ME!! */\r
+ public static boolean showConservation = true;\r
\r
- string = Cache.getProperty("DEFAULT_COLOUR");\r
+ /** DOCUMENT ME!! */\r
+ public static boolean showQuality = true;\r
\r
- if (string != null)\r
- {\r
- colour.setSelectedItem(string);\r
- }\r
- else\r
- {\r
- colour.setSelectedIndex(11);\r
- }\r
+ /** DOCUMENT ME!! */\r
+ public static boolean showIdentity = true;\r
\r
- String[] fonts = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment()\r
- .getAvailableFontFamilyNames();\r
+ /** DOCUMENT ME!! */\r
+ public static String fontName = "SansSerif";\r
\r
- for (int i = 0; i < fonts.length; i++)\r
- {\r
- fontNameCB.addItem(fonts[i]);\r
- }\r
+ /** DOCUMENT ME!! */\r
+ public static String fontSize = "10";\r
+\r
+ /** DOCUMENT ME!! */\r
+ public static String fontStyle = Font.PLAIN + "";\r
\r
- for (int i = 1; i < 31; i++)\r
+ /** DOCUMENT ME!! */\r
+ public static char gapSymbol = '-';\r
+\r
+ /** DOCUMENT ME!! */\r
+ public static String defaultColour = null;\r
+\r
+ /** DOCUMENT ME!! */\r
+ public static boolean showStartupFile = true;\r
+\r
+ /** DOCUMENT ME!! */\r
+ public static String startupFile = "http://www.jalview.org/examples/exampleFile.jar";\r
+ JInternalFrame frame;\r
+\r
+ /**\r
+ * Creates a new Preferences object.\r
+ */\r
+ public Preferences()\r
{\r
- fontSizeCB.addItem(i + "");\r
- }\r
+ initPreferences();\r
\r
- fontStyleCB.addItem("plain");\r
- fontStyleCB.addItem("bold");\r
- fontStyleCB.addItem("italic");\r
+ frame = new JInternalFrame();\r
+ frame.setContentPane(this);\r
+ Desktop.addInternalFrame(frame, "Preferences", 480, 390);\r
\r
- fontNameCB.setSelectedItem(fontName);\r
- fontSizeCB.setSelectedItem(fontSize);\r
- fontStyleCB.setSelectedItem(fontStyle);\r
+ fullID.setSelected(showFullId);\r
\r
- gapSymbolCB.addItem("-");\r
- gapSymbolCB.addItem(".");\r
+ String string = Cache.getProperty("SHOW_FULLSCREEN");\r
+ boolean value = false;\r
\r
- gapSymbolCB.setSelectedItem(gapSymbol + "");\r
+ if (string != null)\r
+ {\r
+ value = Boolean.valueOf(string).booleanValue();\r
+ }\r
\r
- startupCheckbox.setSelected(showStartupFile);\r
- startupFileTextfield.setText(startupFile);\r
- }\r
+ fullScreen.setSelected(value);\r
+ annotations.setSelected(showAnnotation);\r
\r
- public static void initPreferences()\r
- {\r
- String string = Cache.getProperty("SHOW_FULL_ID");\r
+ conservation.setEnabled(showAnnotation);\r
+ quality.setEnabled(showAnnotation);\r
+ identity.setEnabled(showAnnotation);\r
\r
- if (string != null)\r
- {\r
- showFullId = Boolean.valueOf(string).booleanValue();\r
- }\r
+ conservation.setSelected(showConservation);\r
+ quality.setSelected(showQuality);\r
+ identity.setSelected(showIdentity);\r
\r
- string = Cache.getProperty("SHOW_FULLSCREEN");\r
+ for (int i = 0; i < 12; i++)\r
+ {\r
+ colour.addItem(ColourSchemeProperty.getColourName(i));\r
+ }\r
\r
- if (string != null)\r
- {\r
- showFullscreen = Boolean.valueOf(string).booleanValue();\r
- }\r
+ string = Cache.getProperty("DEFAULT_COLOUR");\r
\r
- string = Cache.getProperty("SHOW_ANNOTATIONS");\r
+ if (string != null)\r
+ {\r
+ colour.setSelectedItem(string);\r
+ }\r
+ else\r
+ {\r
+ colour.setSelectedIndex(11);\r
+ }\r
\r
- if (string != null)\r
- {\r
- showAnnotation = Boolean.valueOf(string).booleanValue();\r
- }\r
+ String[] fonts = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment()\r
+ .getAvailableFontFamilyNames();\r
\r
- string = Cache.getProperty("SHOW_CONSERVATION");\r
+ for (int i = 0; i < fonts.length; i++)\r
+ {\r
+ fontNameCB.addItem(fonts[i]);\r
+ }\r
\r
- if (string != null)\r
- {\r
- showConservation = Boolean.valueOf(string).booleanValue();\r
- }\r
+ for (int i = 1; i < 31; i++)\r
+ {\r
+ fontSizeCB.addItem(i + "");\r
+ }\r
\r
- string = Cache.getProperty("SHOW_QUALITY");\r
+ fontStyleCB.addItem("plain");\r
+ fontStyleCB.addItem("bold");\r
+ fontStyleCB.addItem("italic");\r
\r
- if (string != null)\r
- {\r
- showQuality = Boolean.valueOf(string).booleanValue();\r
- }\r
+ fontNameCB.setSelectedItem(fontName);\r
+ fontSizeCB.setSelectedItem(fontSize);\r
+ fontStyleCB.setSelectedItem(fontStyle);\r
\r
- string = Cache.getProperty("SHOW_IDENTITY");\r
+ gapSymbolCB.addItem("-");\r
+ gapSymbolCB.addItem(".");\r
\r
- if (string != null)\r
- {\r
- showIdentity = Boolean.valueOf(string).booleanValue();\r
- }\r
+ gapSymbolCB.setSelectedItem(gapSymbol + "");\r
\r
- string = Cache.getProperty("GAP_SYMBOL");\r
+ startupCheckbox.setSelected(showStartupFile);\r
+ startupFileTextfield.setText(startupFile);\r
+ }\r
\r
- if (string != null)\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ public static void initPreferences()\r
{\r
- gapSymbol = string.charAt(0);\r
- }\r
+ String string = Cache.getProperty("SHOW_FULL_ID");\r
\r
- string = Cache.getProperty("SHOW_FULL_ID");\r
+ if (string != null)\r
+ {\r
+ showFullId = Boolean.valueOf(string).booleanValue();\r
+ }\r
\r
- if (string != null)\r
- {\r
- showFullId = Boolean.valueOf(string).booleanValue();\r
- }\r
+ string = Cache.getProperty("SHOW_FULLSCREEN");\r
\r
- string = Cache.getProperty("FONT_NAME");\r
+ if (string != null)\r
+ {\r
+ showFullscreen = Boolean.valueOf(string).booleanValue();\r
+ }\r
\r
- if (string != null)\r
- {\r
- fontName = string;\r
- }\r
+ string = Cache.getProperty("SHOW_ANNOTATIONS");\r
\r
- string = Cache.getProperty("FONT_STYLE");\r
+ if (string != null)\r
+ {\r
+ showAnnotation = Boolean.valueOf(string).booleanValue();\r
+ }\r
\r
- if (string != null)\r
- {\r
- fontStyle = string;\r
- }\r
+ string = Cache.getProperty("SHOW_CONSERVATION");\r
\r
- string = Cache.getProperty("FONT_SIZE");\r
+ if (string != null)\r
+ {\r
+ showConservation = Boolean.valueOf(string).booleanValue();\r
+ }\r
\r
- if (string != null)\r
- {\r
- fontSize = string;\r
- }\r
+ string = Cache.getProperty("SHOW_QUALITY");\r
\r
- string = Cache.getProperty("DEFAULT_COLOUR");\r
+ if (string != null)\r
+ {\r
+ showQuality = Boolean.valueOf(string).booleanValue();\r
+ }\r
\r
- if (string != null)\r
- {\r
- defaultColour = string;\r
- }\r
+ string = Cache.getProperty("SHOW_IDENTITY");\r
+\r
+ if (string != null)\r
+ {\r
+ showIdentity = Boolean.valueOf(string).booleanValue();\r
+ }\r
\r
- string = Cache.getProperty("STARTUP_FILE");\r
+ string = Cache.getProperty("GAP_SYMBOL");\r
\r
- if (string != null)\r
- {\r
- startupFile = string;\r
- }\r
+ if (string != null)\r
+ {\r
+ gapSymbol = string.charAt(0);\r
+ }\r
\r
- string = Cache.getProperty("SHOW_STARTUP_FILE");\r
+ string = Cache.getProperty("SHOW_FULL_ID");\r
\r
- if (string != null)\r
- {\r
- showStartupFile = Boolean.valueOf(string).booleanValue();\r
- }\r
+ if (string != null)\r
+ {\r
+ showFullId = Boolean.valueOf(string).booleanValue();\r
+ }\r
\r
- preferencesLoaded = true;\r
- }\r
-\r
- public void ok_actionPerformed(ActionEvent e)\r
- {\r
- showFullId = fullID.isSelected();\r
- showFullscreen = fullScreen.isSelected();\r
- showAnnotation = annotations.isSelected();\r
- showConservation = conservation.isSelected();\r
- showQuality = quality.isSelected();\r
- showIdentity = identity.isSelected();\r
- defaultColour = colour.getSelectedItem().toString();\r
- gapSymbol = gapSymbolCB.getSelectedItem().toString().charAt(0);\r
- fontName = fontNameCB.getSelectedItem().toString();\r
- fontSize = fontSizeCB.getSelectedItem().toString();\r
- fontStyle = fontStyleCB.getSelectedItem().toString();\r
- startupFile = startupFileTextfield.getText();\r
- showStartupFile = startupCheckbox.isSelected();\r
-\r
- Cache.setProperty("SHOW_FULL_ID", Boolean.toString(showFullId));\r
- Cache.setProperty("SHOW_FULLSCREEN", Boolean.toString(showFullscreen));\r
-\r
- Cache.setProperty("SHOW_ANNOTATIONS", Boolean.toString(showAnnotation));\r
- Cache.setProperty("SHOW_CONSERVATION",\r
- Boolean.toString(showConservation));\r
- Cache.setProperty("SHOW_QUALITY", Boolean.toString(showQuality));\r
- Cache.setProperty("SHOW_IDENTITY", Boolean.toString(showIdentity));\r
-\r
- Cache.setProperty("DEFAULT_COLOUR", defaultColour);\r
- Cache.setProperty("GAP_SYMBOL", gapSymbol + "");\r
-\r
- Cache.setProperty("FONT_NAME", fontName);\r
- Cache.setProperty("FONT_STYLE", fontStyle);\r
- Cache.setProperty("FONT_SIZE", fontSize);\r
-\r
- Cache.setProperty("STARTUP_FILE", startupFile);\r
- Cache.setProperty("SHOW_STARTUP_FILE", Boolean.toString(showStartupFile));\r
-\r
- try\r
- {\r
- frame.setClosed(true);\r
+ string = Cache.getProperty("FONT_NAME");\r
+\r
+ if (string != null)\r
+ {\r
+ fontName = string;\r
+ }\r
+\r
+ string = Cache.getProperty("FONT_STYLE");\r
+\r
+ if (string != null)\r
+ {\r
+ fontStyle = string;\r
+ }\r
+\r
+ string = Cache.getProperty("FONT_SIZE");\r
+\r
+ if (string != null)\r
+ {\r
+ fontSize = string;\r
+ }\r
+\r
+ string = Cache.getProperty("DEFAULT_COLOUR");\r
+\r
+ if (string != null)\r
+ {\r
+ defaultColour = string;\r
+ }\r
+\r
+ string = Cache.getProperty("STARTUP_FILE");\r
+\r
+ if (string != null)\r
+ {\r
+ startupFile = string;\r
+ }\r
+\r
+ string = Cache.getProperty("SHOW_STARTUP_FILE");\r
+\r
+ if (string != null)\r
+ {\r
+ showStartupFile = Boolean.valueOf(string).booleanValue();\r
+ }\r
+\r
+ preferencesLoaded = true;\r
}\r
- catch (Exception ex)\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void ok_actionPerformed(ActionEvent e)\r
{\r
- }\r
- }\r
-\r
- public void startupFileTextfield_mouseClicked()\r
- {\r
- JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.\r
- getProperty(\r
- "LAST_DIRECTORY"),\r
- new String[]\r
+ showFullId = fullID.isSelected();\r
+ showFullscreen = fullScreen.isSelected();\r
+ showAnnotation = annotations.isSelected();\r
+ showConservation = conservation.isSelected();\r
+ showQuality = quality.isSelected();\r
+ showIdentity = identity.isSelected();\r
+ defaultColour = colour.getSelectedItem().toString();\r
+ gapSymbol = gapSymbolCB.getSelectedItem().toString().charAt(0);\r
+ fontName = fontNameCB.getSelectedItem().toString();\r
+ fontSize = fontSizeCB.getSelectedItem().toString();\r
+ fontStyle = fontStyleCB.getSelectedItem().toString();\r
+ startupFile = startupFileTextfield.getText();\r
+ showStartupFile = startupCheckbox.isSelected();\r
+\r
+ Cache.setProperty("SHOW_FULL_ID", Boolean.toString(showFullId));\r
+ Cache.setProperty("SHOW_FULLSCREEN", Boolean.toString(showFullscreen));\r
+\r
+ Cache.setProperty("SHOW_ANNOTATIONS", Boolean.toString(showAnnotation));\r
+ Cache.setProperty("SHOW_CONSERVATION",\r
+ Boolean.toString(showConservation));\r
+ Cache.setProperty("SHOW_QUALITY", Boolean.toString(showQuality));\r
+ Cache.setProperty("SHOW_IDENTITY", Boolean.toString(showIdentity));\r
+\r
+ Cache.setProperty("DEFAULT_COLOUR", defaultColour);\r
+ Cache.setProperty("GAP_SYMBOL", gapSymbol + "");\r
+\r
+ Cache.setProperty("FONT_NAME", fontName);\r
+ Cache.setProperty("FONT_STYLE", fontStyle);\r
+ Cache.setProperty("FONT_SIZE", fontSize);\r
+\r
+ Cache.setProperty("STARTUP_FILE", startupFile);\r
+ Cache.setProperty("SHOW_STARTUP_FILE", Boolean.toString(showStartupFile));\r
+\r
+ try\r
{\r
- "fa, fasta, fastq", "aln", "pfam", "msf", "pir", "blc",\r
- "jar"\r
- },\r
- new String[]\r
+ frame.setClosed(true);\r
+ }\r
+ catch (Exception ex)\r
{\r
- "Fasta", "Clustal", "PFAM", "MSF", "PIR", "BLC", "Jalview"\r
- }, jalview.bin.Cache.getProperty("DEFAULT_FILE_FORMAT"));\r
- chooser.setFileView(new JalviewFileView());\r
- chooser.setDialogTitle("Select startup file");\r
-\r
- int value = chooser.showOpenDialog(this);\r
+ }\r
+ }\r
\r
- if (value == JalviewFileChooser.APPROVE_OPTION)\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ public void startupFileTextfield_mouseClicked()\r
{\r
- jalview.bin.Cache.setProperty("DEFAULT_FILE_FORMAT",\r
- chooser.getSelectedFormat());\r
- startupFileTextfield.setText(chooser.getSelectedFile()\r
- .getAbsolutePath());\r
+ JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.getProperty(\r
+ "LAST_DIRECTORY"),\r
+ new String[]\r
+ {\r
+ "fa, fasta, fastq", "aln", "pfam", "msf", "pir", "blc",\r
+ "jar"\r
+ },\r
+ new String[]\r
+ {\r
+ "Fasta", "Clustal", "PFAM", "MSF", "PIR", "BLC", "Jalview"\r
+ }, jalview.bin.Cache.getProperty("DEFAULT_FILE_FORMAT"));\r
+ chooser.setFileView(new JalviewFileView());\r
+ chooser.setDialogTitle("Select startup file");\r
+\r
+ int value = chooser.showOpenDialog(this);\r
+\r
+ if (value == JalviewFileChooser.APPROVE_OPTION)\r
+ {\r
+ jalview.bin.Cache.setProperty("DEFAULT_FILE_FORMAT",\r
+ chooser.getSelectedFormat());\r
+ startupFileTextfield.setText(chooser.getSelectedFile()\r
+ .getAbsolutePath());\r
+ }\r
}\r
- }\r
\r
- public void cancel_actionPerformed(ActionEvent e)\r
- {\r
- try\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void cancel_actionPerformed(ActionEvent e)\r
{\r
- frame.setClosed(true);\r
+ try\r
+ {\r
+ frame.setClosed(true);\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ }\r
}\r
- catch (Exception ex)\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void annotations_actionPerformed(ActionEvent e)\r
{\r
+ conservation.setEnabled(annotations.isSelected());\r
+ quality.setEnabled(annotations.isSelected());\r
+ identity.setEnabled(annotations.isSelected());\r
}\r
- }\r
-\r
- public void annotations_actionPerformed(ActionEvent e)\r
- {\r
- conservation.setEnabled(annotations.isSelected());\r
- quality.setEnabled(annotations.isSelected());\r
- identity.setEnabled(annotations.isSelected());\r
- }\r
}\r
*/\r
package jalview.gui;\r
\r
-import java.util.*;\r
+import jalview.datamodel.*;\r
+\r
+import jalview.jbgui.*;\r
\r
import java.awt.event.*;\r
-import javax.swing.event.*;\r
\r
-import jalview.datamodel.*;\r
-import jalview.jbgui.*;\r
+import java.util.*;\r
\r
-public class RedundancyPanel\r
- extends GSliderPanel\r
-{\r
- AlignFrame af;\r
- AlignmentPanel ap;\r
- Stack historyList = new Stack(); // simpler than synching with alignFrame.\r
+import javax.swing.event.*;\r
\r
- public RedundancyPanel(AlignmentPanel ap, AlignFrame af)\r
- {\r
- this.ap = ap;\r
- this.af = af;\r
- label.setText("Enter the redundancy threshold");\r
\r
- slider.addChangeListener(new ChangeListener()\r
- {\r
- public void stateChanged(ChangeEvent evt)\r
- {\r
- valueField.setText(slider.getValue() + "");\r
- }\r
- });\r
-\r
- slider.setMinimum(0);\r
- slider.setMaximum(100);\r
- slider.setValue(100);\r
- }\r
-\r
- public void applyButton_actionPerformed(ActionEvent e)\r
- {\r
- float threshold = slider.getValue();\r
- Vector del;\r
- HistoryItem it;\r
- historyList.push(it = new HistoryItem("Remove redundancy",\r
- ap.av.alignment, HistoryItem.HIDE));\r
-\r
- if ( (historyList.size() == 1) ||\r
- !af.historyList.contains(historyList.firstElement()))\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class RedundancyPanel extends GSliderPanel\r
+{\r
+ AlignFrame af;\r
+ AlignmentPanel ap;\r
+ Stack historyList = new Stack(); // simpler than synching with alignFrame.\r
+\r
+ /**\r
+ * Creates a new RedundancyPanel object.\r
+ *\r
+ * @param ap DOCUMENT ME!\r
+ * @param af DOCUMENT ME!\r
+ */\r
+ public RedundancyPanel(AlignmentPanel ap, AlignFrame af)\r
{\r
- af.addHistoryItem( (HistoryItem) historyList.firstElement());\r
- af.updateEditMenuBar();\r
+ this.ap = ap;\r
+ this.af = af;\r
+ label.setText("Enter the redundancy threshold");\r
+\r
+ slider.addChangeListener(new ChangeListener()\r
+ {\r
+ public void stateChanged(ChangeEvent evt)\r
+ {\r
+ valueField.setText(slider.getValue() + "");\r
+ }\r
+ });\r
+\r
+ slider.setMinimum(0);\r
+ slider.setMaximum(100);\r
+ slider.setValue(100);\r
}\r
\r
- undoButton.setEnabled(true);\r
-\r
- SequenceGroup sg = ap.av.getSelectionGroup();\r
-\r
- if ( (sg != null) && (sg.getSize() >= 1))\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void applyButton_actionPerformed(ActionEvent e)\r
{\r
- del = ap.av.alignment.removeRedundancy(threshold, sg.sequences);\r
-\r
- for (int i = 0; i < del.size(); i++)\r
- {\r
- if (sg.sequences.contains( (SequenceI) del.elementAt(i)))\r
+ float threshold = slider.getValue();\r
+ Vector del;\r
+ HistoryItem it;\r
+ historyList.push(it = new HistoryItem("Remove redundancy",\r
+ ap.av.alignment, HistoryItem.HIDE));\r
+\r
+ if ((historyList.size() == 1) ||\r
+ !af.historyList.contains(historyList.firstElement()))\r
{\r
- sg.deleteSequence( (SequenceI) del.elementAt(i), true);\r
+ af.addHistoryItem((HistoryItem) historyList.firstElement());\r
+ af.updateEditMenuBar();\r
}\r
- }\r
- }\r
- else\r
- {\r
- Vector s = new Vector();\r
- int i = 0;\r
\r
- while (i < ap.av.alignment.getHeight())\r
- {\r
- s.addElement(ap.av.alignment.getSequenceAt(i));\r
- i++;\r
- }\r
+ undoButton.setEnabled(true);\r
\r
- del = ap.av.alignment.removeRedundancy(threshold, s);\r
- }\r
+ SequenceGroup sg = ap.av.getSelectionGroup();\r
\r
- // This has to be done before the restoreHistoryItem method of alignFrame will\r
- // actually restore these sequences.\r
- if (del.size() > 0)\r
- {\r
- for (int i = 0, j = del.size(); i < j; i++)\r
- {\r
- SequenceI sq = (SequenceI) del.elementAt(i);\r
- sq.deleteChars(0, sq.getLength());\r
- }\r
- }\r
+ if ((sg != null) && (sg.getSize() >= 1))\r
+ {\r
+ del = ap.av.alignment.removeRedundancy(threshold, sg.sequences);\r
+\r
+ for (int i = 0; i < del.size(); i++)\r
+ {\r
+ if (sg.sequences.contains((SequenceI) del.elementAt(i)))\r
+ {\r
+ sg.deleteSequence((SequenceI) del.elementAt(i), true);\r
+ }\r
+ }\r
+ }\r
+ else\r
+ {\r
+ Vector s = new Vector();\r
+ int i = 0;\r
\r
- ap.av.firePropertyChange("alignment", null,\r
- ap.av.getAlignment().getSequences());\r
- ap.av.resetSeqLimits(ap.seqPanel.seqCanvas.getHeight());\r
+ while (i < ap.av.alignment.getHeight())\r
+ {\r
+ s.addElement(ap.av.alignment.getSequenceAt(i));\r
+ i++;\r
+ }\r
\r
- if (ap.av.getAlignment().getHeight() < 1)\r
- {\r
- try\r
- {\r
- af.setClosed(true);\r
- }\r
- catch (Exception ex)\r
- {\r
- }\r
- }\r
+ del = ap.av.alignment.removeRedundancy(threshold, s);\r
+ }\r
\r
- ap.av.updateConservation();\r
- ap.av.updateConsensus();\r
- af.updateEditMenuBar();\r
- ap.repaint();\r
- }\r
+ // This has to be done before the restoreHistoryItem method of alignFrame will\r
+ // actually restore these sequences.\r
+ if (del.size() > 0)\r
+ {\r
+ for (int i = 0, j = del.size(); i < j; i++)\r
+ {\r
+ SequenceI sq = (SequenceI) del.elementAt(i);\r
+ sq.deleteChars(0, sq.getLength());\r
+ }\r
+ }\r
\r
- public void undoButton_actionPerformed(ActionEvent e)\r
- {\r
- HistoryItem hi = (HistoryItem) historyList.pop();\r
- af.restoreHistoryItem(hi);\r
+ ap.av.firePropertyChange("alignment", null,\r
+ ap.av.getAlignment().getSequences());\r
+ ap.av.resetSeqLimits(ap.seqPanel.seqCanvas.getHeight());\r
\r
- if (historyList.size() == 0)\r
- {\r
- undoButton.setEnabled(false);\r
+ if (ap.av.getAlignment().getHeight() < 1)\r
+ {\r
+ try\r
+ {\r
+ af.setClosed(true);\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ }\r
+ }\r
\r
- if (af.historyList.contains(hi))\r
- {\r
- af.historyList.remove(hi);\r
+ ap.av.updateConservation();\r
+ ap.av.updateConsensus();\r
af.updateEditMenuBar();\r
- }\r
+ ap.repaint();\r
}\r
- }\r
\r
- public void valueField_actionPerformed(ActionEvent e)\r
- {\r
- try\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void undoButton_actionPerformed(ActionEvent e)\r
{\r
- int i = Integer.parseInt(valueField.getText());\r
- slider.setValue(i);\r
+ HistoryItem hi = (HistoryItem) historyList.pop();\r
+ af.restoreHistoryItem(hi);\r
+\r
+ if (historyList.size() == 0)\r
+ {\r
+ undoButton.setEnabled(false);\r
+\r
+ if (af.historyList.contains(hi))\r
+ {\r
+ af.historyList.remove(hi);\r
+ af.updateEditMenuBar();\r
+ }\r
+ }\r
}\r
- catch (Exception ex)\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void valueField_actionPerformed(ActionEvent e)\r
{\r
- valueField.setText(slider.getValue() + "");\r
+ try\r
+ {\r
+ int i = Integer.parseInt(valueField.getText());\r
+ slider.setValue(i);\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ valueField.setText(slider.getValue() + "");\r
+ }\r
}\r
- }\r
}\r
*/\r
package jalview.gui;\r
\r
-import java.util.*;\r
+import jalview.datamodel.*;\r
+\r
+import jalview.math.*;\r
+\r
+import jalview.util.*;\r
\r
import java.awt.*;\r
import java.awt.event.*;\r
+\r
+import java.util.*;\r
+\r
import javax.swing.*;\r
\r
-import jalview.datamodel.*;\r
-import jalview.math.*;\r
-import jalview.util.*;\r
\r
-public class RotatableCanvas\r
- extends JPanel implements MouseListener,\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class RotatableCanvas extends JPanel implements MouseListener,\r
MouseMotionListener, KeyListener\r
//RubberbandListener,\r
//SequenceSelectionListener\r
{\r
- RotatableMatrix idmat = new RotatableMatrix(3, 3);\r
- RotatableMatrix objmat = new RotatableMatrix(3, 3);\r
- RotatableMatrix rotmat = new RotatableMatrix(3, 3);\r
-\r
- //RubberbandRectangle rubberband;\r
- boolean drawAxes = true;\r
- int omx = 0;\r
- int mx = 0;\r
- int omy = 0;\r
- int my = 0;\r
- Image img;\r
- Graphics ig;\r
- Dimension prefsize;\r
- float[] centre = new float[3];\r
- float[] width = new float[3];\r
- float[] max = new float[3];\r
- float[] min = new float[3];\r
- float maxwidth;\r
- float scale;\r
- int npoint;\r
- Vector points;\r
- float[][] orig;\r
- float[][] axes;\r
- int startx;\r
- int starty;\r
- int lastx;\r
- int lasty;\r
- int rectx1;\r
- int recty1;\r
- int rectx2;\r
- int recty2;\r
- float scalefactor = 1;\r
- AlignViewport av;\r
-\r
- // Controller controller;\r
- public RotatableCanvas(AlignViewport av, Vector points, int npoint)\r
- {\r
- this.points = points;\r
- this.npoint = npoint;\r
- this.av = av;\r
- ToolTipManager.sharedInstance().registerComponent(this);\r
- ToolTipManager.sharedInstance().setInitialDelay(0);\r
- ToolTipManager.sharedInstance().setDismissDelay(10000);\r
- PaintRefresher.Register(this, av.alignment);\r
-\r
- prefsize = getPreferredSize();\r
- orig = new float[npoint][3];\r
-\r
- for (int i = 0; i < npoint; i++)\r
- {\r
- SequencePoint sp = (SequencePoint) points.elementAt(i);\r
-\r
- for (int j = 0; j < 3; j++)\r
- {\r
- orig[i][j] = sp.coord[j];\r
- }\r
- }\r
-\r
- //Initialize the matrices to identity\r
- for (int i = 0; i < 3; i++)\r
+ RotatableMatrix idmat = new RotatableMatrix(3, 3);\r
+ RotatableMatrix objmat = new RotatableMatrix(3, 3);\r
+ RotatableMatrix rotmat = new RotatableMatrix(3, 3);\r
+\r
+ //RubberbandRectangle rubberband;\r
+ boolean drawAxes = true;\r
+ int omx = 0;\r
+ int mx = 0;\r
+ int omy = 0;\r
+ int my = 0;\r
+ Image img;\r
+ Graphics ig;\r
+ Dimension prefsize;\r
+ float[] centre = new float[3];\r
+ float[] width = new float[3];\r
+ float[] max = new float[3];\r
+ float[] min = new float[3];\r
+ float maxwidth;\r
+ float scale;\r
+ int npoint;\r
+ Vector points;\r
+ float[][] orig;\r
+ float[][] axes;\r
+ int startx;\r
+ int starty;\r
+ int lastx;\r
+ int lasty;\r
+ int rectx1;\r
+ int recty1;\r
+ int rectx2;\r
+ int recty2;\r
+ float scalefactor = 1;\r
+ AlignViewport av;\r
+\r
+ // Controller controller;\r
+ public RotatableCanvas(AlignViewport av, Vector points, int npoint)\r
{\r
- for (int j = 0; j < 3; j++)\r
- {\r
- if (i != j)\r
+ this.points = points;\r
+ this.npoint = npoint;\r
+ this.av = av;\r
+ ToolTipManager.sharedInstance().registerComponent(this);\r
+ ToolTipManager.sharedInstance().setInitialDelay(0);\r
+ ToolTipManager.sharedInstance().setDismissDelay(10000);\r
+ PaintRefresher.Register(this, av.alignment);\r
+\r
+ prefsize = getPreferredSize();\r
+ orig = new float[npoint][3];\r
+\r
+ for (int i = 0; i < npoint; i++)\r
{\r
- idmat.addElement(i, j, 0);\r
- objmat.addElement(i, j, 0);\r
- rotmat.addElement(i, j, 0);\r
+ SequencePoint sp = (SequencePoint) points.elementAt(i);\r
+\r
+ for (int j = 0; j < 3; j++)\r
+ {\r
+ orig[i][j] = sp.coord[j];\r
+ }\r
}\r
- else\r
+\r
+ //Initialize the matrices to identity\r
+ for (int i = 0; i < 3; i++)\r
{\r
- idmat.addElement(i, j, 0);\r
- objmat.addElement(i, j, 0);\r
- rotmat.addElement(i, j, 0);\r
+ for (int j = 0; j < 3; j++)\r
+ {\r
+ if (i != j)\r
+ {\r
+ idmat.addElement(i, j, 0);\r
+ objmat.addElement(i, j, 0);\r
+ rotmat.addElement(i, j, 0);\r
+ }\r
+ else\r
+ {\r
+ idmat.addElement(i, j, 0);\r
+ objmat.addElement(i, j, 0);\r
+ rotmat.addElement(i, j, 0);\r
+ }\r
+ }\r
}\r
- }\r
- }\r
\r
- axes = new float[3][3];\r
- initAxes();\r
+ axes = new float[3][3];\r
+ initAxes();\r
\r
- findCentre();\r
- findWidth();\r
+ findCentre();\r
+ findWidth();\r
\r
- scale = findScale();\r
+ scale = findScale();\r
\r
- // System.out.println("Scale factor = " + scale);\r
- addMouseListener(this);\r
- addKeyListener(this);\r
+ // System.out.println("Scale factor = " + scale);\r
+ addMouseListener(this);\r
+ addKeyListener(this);\r
\r
- // if (getParent() != null) {\r
- // getParent().addKeyListener(this);\r
- //}\r
- addMouseMotionListener(this);\r
-\r
- // Add rubberband\r
- // rubberband = new RubberbandRectangle(this);\r
- // rubberband.setActive(true);\r
- // rubberband.addListener(this);\r
- }\r
-\r
- /* public boolean handleSequenceSelectionEvent(SequenceSelectionEvent evt) {\r
- redrawneeded = true;\r
- repaint();\r
- return true;\r
- }\r
-\r
- public void removeNotify() {\r
- controller.removeListener(this);\r
- super.removeNotify();\r
- }*/\r
- public void initAxes()\r
- {\r
- for (int i = 0; i < 3; i++)\r
+ // if (getParent() != null) {\r
+ // getParent().addKeyListener(this);\r
+ //}\r
+ addMouseMotionListener(this);\r
+\r
+ // Add rubberband\r
+ // rubberband = new RubberbandRectangle(this);\r
+ // rubberband.setActive(true);\r
+ // rubberband.addListener(this);\r
+ }\r
+\r
+ /* public boolean handleSequenceSelectionEvent(SequenceSelectionEvent evt) {\r
+ redrawneeded = true;\r
+ repaint();\r
+ return true;\r
+ }\r
+\r
+ public void removeNotify() {\r
+ controller.removeListener(this);\r
+ super.removeNotify();\r
+ }*/\r
+ public void initAxes()\r
{\r
- for (int j = 0; j < 3; j++)\r
- {\r
- if (i != j)\r
- {\r
- axes[i][j] = 0;\r
- }\r
- else\r
+ for (int i = 0; i < 3; i++)\r
{\r
- axes[i][j] = 1;\r
+ for (int j = 0; j < 3; j++)\r
+ {\r
+ if (i != j)\r
+ {\r
+ axes[i][j] = 0;\r
+ }\r
+ else\r
+ {\r
+ axes[i][j] = 1;\r
+ }\r
+ }\r
}\r
- }\r
}\r
- }\r
\r
- public void findWidth()\r
- {\r
- max = new float[3];\r
- min = new float[3];\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ public void findWidth()\r
+ {\r
+ max = new float[3];\r
+ min = new float[3];\r
\r
- max[0] = (float) - 1e30;\r
- max[1] = (float) - 1e30;\r
- max[2] = (float) - 1e30;\r
+ max[0] = (float) -1e30;\r
+ max[1] = (float) -1e30;\r
+ max[2] = (float) -1e30;\r
\r
- min[0] = (float) 1e30;\r
- min[1] = (float) 1e30;\r
- min[2] = (float) 1e30;\r
+ min[0] = (float) 1e30;\r
+ min[1] = (float) 1e30;\r
+ min[2] = (float) 1e30;\r
\r
- for (int i = 0; i < 3; i++)\r
- {\r
- for (int j = 0; j < npoint; j++)\r
- {\r
- SequencePoint sp = (SequencePoint) points.elementAt(j);\r
+ for (int i = 0; i < 3; i++)\r
+ {\r
+ for (int j = 0; j < npoint; j++)\r
+ {\r
+ SequencePoint sp = (SequencePoint) points.elementAt(j);\r
+\r
+ if (sp.coord[i] >= max[i])\r
+ {\r
+ max[i] = sp.coord[i];\r
+ }\r
+\r
+ if (sp.coord[i] <= min[i])\r
+ {\r
+ min[i] = sp.coord[i];\r
+ }\r
+ }\r
+ }\r
+\r
+ // System.out.println("xmax " + max[0] + " min " + min[0]);\r
+ //System.out.println("ymax " + max[1] + " min " + min[1]);\r
+ //System.out.println("zmax " + max[2] + " min " + min[2]);\r
+ width[0] = Math.abs(max[0] - min[0]);\r
+ width[1] = Math.abs(max[1] - min[1]);\r
+ width[2] = Math.abs(max[2] - min[2]);\r
\r
- if (sp.coord[i] >= max[i])\r
+ maxwidth = width[0];\r
+\r
+ if (width[1] > width[0])\r
{\r
- max[i] = sp.coord[i];\r
+ maxwidth = width[1];\r
}\r
\r
- if (sp.coord[i] <= min[i])\r
+ if (width[2] > width[1])\r
{\r
- min[i] = sp.coord[i];\r
+ maxwidth = width[2];\r
}\r
- }\r
+\r
+ //System.out.println("Maxwidth = " + maxwidth);\r
}\r
\r
- // System.out.println("xmax " + max[0] + " min " + min[0]);\r
- //System.out.println("ymax " + max[1] + " min " + min[1]);\r
- //System.out.println("zmax " + max[2] + " min " + min[2]);\r
- width[0] = Math.abs(max[0] - min[0]);\r
- width[1] = Math.abs(max[1] - min[1]);\r
- width[2] = Math.abs(max[2] - min[2]);\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public float findScale()\r
+ {\r
+ int dim;\r
+ int width;\r
+ int height;\r
\r
- maxwidth = width[0];\r
+ if (getWidth() != 0)\r
+ {\r
+ width = getWidth();\r
+ height = getHeight();\r
+ }\r
+ else\r
+ {\r
+ width = prefsize.width;\r
+ height = prefsize.height;\r
+ }\r
\r
- if (width[1] > width[0])\r
- {\r
- maxwidth = width[1];\r
- }\r
+ if (width < height)\r
+ {\r
+ dim = width;\r
+ }\r
+ else\r
+ {\r
+ dim = height;\r
+ }\r
\r
- if (width[2] > width[1])\r
- {\r
- maxwidth = width[2];\r
+ return (float) ((dim * scalefactor) / (2 * maxwidth));\r
}\r
\r
- //System.out.println("Maxwidth = " + maxwidth);\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ public void findCentre()\r
+ {\r
+ //Find centre coordinate\r
+ findWidth();\r
\r
- public float findScale()\r
- {\r
- int dim;\r
- int width;\r
- int height;\r
+ centre[0] = (max[0] + min[0]) / 2;\r
+ centre[1] = (max[1] + min[1]) / 2;\r
+ centre[2] = (max[2] + min[2]) / 2;\r
\r
- if (getWidth() != 0)\r
- {\r
- width = getWidth();\r
- height = getHeight();\r
+ // System.out.println("Centre x " + centre[0]);\r
+ //System.out.println("Centre y " + centre[1]);\r
+ //System.out.println("Centre z " + centre[2]);\r
}\r
- else\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public Dimension getPreferredSize()\r
{\r
- width = prefsize.width;\r
- height = prefsize.height;\r
+ if (prefsize != null)\r
+ {\r
+ return prefsize;\r
+ }\r
+ else\r
+ {\r
+ return new Dimension(400, 400);\r
+ }\r
}\r
\r
- if (width < height)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public Dimension getMinimumSize()\r
{\r
- dim = width;\r
+ return getPreferredSize();\r
}\r
- else\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param g DOCUMENT ME!\r
+ */\r
+ public void paintComponent(Graphics g)\r
{\r
- dim = height;\r
- }\r
+ //Only create the image at the beginning -\r
+ if ((img == null) || (prefsize.width != getWidth()) ||\r
+ (prefsize.height != getHeight()))\r
+ {\r
+ prefsize.width = getWidth();\r
+ prefsize.height = getHeight();\r
\r
- return (float) ( (dim * scalefactor) / (2 * maxwidth));\r
- }\r
+ scale = findScale();\r
\r
- public void findCentre()\r
- {\r
- //Find centre coordinate\r
- findWidth();\r
+ // System.out.println("New scale = " + scale);\r
+ img = createImage(getWidth(), getHeight());\r
+ ig = img.getGraphics();\r
+ }\r
\r
- centre[0] = (max[0] + min[0]) / 2;\r
- centre[1] = (max[1] + min[1]) / 2;\r
- centre[2] = (max[2] + min[2]) / 2;\r
+ drawBackground(ig, Color.black);\r
+ drawScene(ig);\r
\r
- // System.out.println("Centre x " + centre[0]);\r
- //System.out.println("Centre y " + centre[1]);\r
- //System.out.println("Centre z " + centre[2]);\r
- }\r
+ if (drawAxes == true)\r
+ {\r
+ drawAxes(ig);\r
+ }\r
+\r
+ g.drawImage(img, 0, 0, this);\r
+ }\r
\r
- public Dimension getPreferredSize()\r
- {\r
- if (prefsize != null)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param g DOCUMENT ME!\r
+ */\r
+ public void drawAxes(Graphics g)\r
{\r
- return prefsize;\r
+ g.setColor(Color.yellow);\r
+\r
+ for (int i = 0; i < 3; i++)\r
+ {\r
+ g.drawLine(getWidth() / 2, getHeight() / 2,\r
+ (int) ((axes[i][0] * scale * max[0]) + (getWidth() / 2)),\r
+ (int) ((axes[i][1] * scale * max[1]) + (getHeight() / 2)));\r
+ }\r
}\r
- else\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param g DOCUMENT ME!\r
+ * @param col DOCUMENT ME!\r
+ */\r
+ public void drawBackground(Graphics g, Color col)\r
{\r
- return new Dimension(400, 400);\r
+ g.setColor(col);\r
+ g.fillRect(0, 0, prefsize.width, prefsize.height);\r
}\r
- }\r
-\r
- public Dimension getMinimumSize()\r
- {\r
- return getPreferredSize();\r
- }\r
-\r
- public void paintComponent(Graphics g)\r
- {\r
- //Only create the image at the beginning -\r
- if ( (img == null) || (prefsize.width != getWidth()) ||\r
- (prefsize.height != getHeight()))\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param g DOCUMENT ME!\r
+ */\r
+ public void drawScene(Graphics g)\r
{\r
- prefsize.width = getWidth();\r
- prefsize.height = getHeight();\r
+ boolean darker = false;\r
\r
- scale = findScale();\r
+ int halfwidth = getWidth() / 2;\r
+ int halfheight = getHeight() / 2;\r
\r
- // System.out.println("New scale = " + scale);\r
- img = createImage(getWidth(), getHeight());\r
- ig = img.getGraphics();\r
- }\r
+ for (int i = 0; i < npoint; i++)\r
+ {\r
+ SequencePoint sp = (SequencePoint) points.elementAt(i);\r
+ int x = (int) ((float) (sp.coord[0] - centre[0]) * scale) +\r
+ halfwidth;\r
+ int y = (int) ((float) (sp.coord[1] - centre[1]) * scale) +\r
+ halfheight;\r
+ float z = sp.coord[1] - centre[2];\r
+\r
+ if (sp.sequence.getColor() == Color.black)\r
+ {\r
+ g.setColor(Color.white);\r
+ }\r
+ else\r
+ {\r
+ g.setColor(sp.sequence.getColor());\r
+ }\r
+\r
+ if (av.getSelectionGroup() != null)\r
+ {\r
+ if (av.getSelectionGroup().sequences.contains(\r
+ ((SequencePoint) points.elementAt(i)).sequence))\r
+ {\r
+ g.setColor(Color.gray);\r
+ }\r
+ }\r
+\r
+ if (z < 0)\r
+ {\r
+ g.setColor(g.getColor().darker());\r
+ }\r
+\r
+ g.fillRect(x - 3, y - 3, 6, 6);\r
+ g.setColor(Color.red);\r
+ }\r
\r
- drawBackground(ig, Color.black);\r
- drawScene(ig);\r
+ // //Now the rectangle\r
+ // if (rectx2 != -1 && recty2 != -1) {\r
+ // g.setColor(Color.white);\r
+ //\r
+ // g.drawRect(rectx1,recty1,rectx2-rectx1,recty2-recty1);\r
+ // }\r
+ }\r
\r
- if (drawAxes == true)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public Dimension minimumsize()\r
{\r
- drawAxes(ig);\r
+ return prefsize;\r
}\r
\r
- g.drawImage(img, 0, 0, this);\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public Dimension preferredsize()\r
+ {\r
+ return prefsize;\r
+ }\r
\r
- public void drawAxes(Graphics g)\r
- {\r
- g.setColor(Color.yellow);\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ */\r
+ public void keyTyped(KeyEvent evt)\r
+ {\r
+ }\r
\r
- for (int i = 0; i < 3; i++)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ */\r
+ public void keyReleased(KeyEvent evt)\r
{\r
- g.drawLine(getWidth() / 2, getHeight() / 2,\r
- (int) ( (axes[i][0] * scale * max[0]) + (getWidth() / 2)),\r
- (int) ( (axes[i][1] * scale * max[1]) + (getHeight() / 2)));\r
}\r
- }\r
\r
- public void drawBackground(Graphics g, Color col)\r
- {\r
- g.setColor(col);\r
- g.fillRect(0, 0, prefsize.width, prefsize.height);\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ */\r
+ public void keyPressed(KeyEvent evt)\r
+ {\r
+ requestFocus();\r
+\r
+ if (evt.getKeyCode() == KeyEvent.VK_UP)\r
+ {\r
+ scalefactor = (float) (scalefactor * 1.1);\r
+ scale = findScale();\r
+ }\r
+ else if (evt.getKeyCode() == KeyEvent.VK_DOWN)\r
+ {\r
+ scalefactor = (float) (scalefactor * 0.9);\r
+ scale = findScale();\r
+ }\r
+ else if (evt.getKeyChar() == 's')\r
+ {\r
+ System.err.println("DEBUG: Rectangle selection"); // log.debug\r
\r
- public void drawScene(Graphics g)\r
- {\r
- boolean darker = false;\r
+ if ((rectx2 != -1) && (recty2 != -1))\r
+ {\r
+ rectSelect(rectx1, recty1, rectx2, recty2);\r
+ }\r
+ }\r
\r
- int halfwidth = getWidth() / 2;\r
- int halfheight = getHeight() / 2;\r
+ repaint();\r
+ }\r
\r
- for (int i = 0; i < npoint; i++)\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ public void printPoints()\r
{\r
- SequencePoint sp = (SequencePoint) points.elementAt(i);\r
- int x = (int) ( (float) (sp.coord[0] - centre[0]) * scale) +\r
- halfwidth;\r
- int y = (int) ( (float) (sp.coord[1] - centre[1]) * scale) +\r
- halfheight;\r
- float z = sp.coord[1] - centre[2];\r
-\r
- if (sp.sequence.getColor() == Color.black)\r
- {\r
- g.setColor(Color.white);\r
- }\r
- else\r
- {\r
- g.setColor(sp.sequence.getColor());\r
- }\r
-\r
- if (av.getSelectionGroup() != null)\r
- {\r
- if (av.getSelectionGroup().sequences.contains(\r
- ( (SequencePoint) points.elementAt(i)).sequence))\r
+ for (int i = 0; i < npoint; i++)\r
{\r
- g.setColor(Color.gray);\r
- }\r
- }\r
+ SequencePoint sp = (SequencePoint) points.elementAt(i);\r
+ Format.print(System.out, "%5d ", i);\r
\r
- if (z < 0)\r
- {\r
- g.setColor(g.getColor().darker());\r
- }\r
+ for (int j = 0; j < 3; j++)\r
+ {\r
+ Format.print(System.out, "%13.3f ", sp.coord[j]);\r
+ }\r
\r
- g.fillRect(x - 3, y - 3, 6, 6);\r
- g.setColor(Color.red);\r
+ System.out.println();\r
+ }\r
}\r
\r
- // //Now the rectangle\r
- // if (rectx2 != -1 && recty2 != -1) {\r
- // g.setColor(Color.white);\r
- //\r
- // g.drawRect(rectx1,recty1,rectx2-rectx1,recty2-recty1);\r
- // }\r
- }\r
-\r
- public Dimension minimumsize()\r
- {\r
- return prefsize;\r
- }\r
-\r
- public Dimension preferredsize()\r
- {\r
- return prefsize;\r
- }\r
-\r
- public void keyTyped(KeyEvent evt)\r
- {\r
- }\r
-\r
- public void keyReleased(KeyEvent evt)\r
- {\r
- }\r
-\r
- public void keyPressed(KeyEvent evt)\r
- {\r
- requestFocus();\r
-\r
- if (evt.getKeyCode() == KeyEvent.VK_UP)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ */\r
+ public void mouseClicked(MouseEvent evt)\r
{\r
- scalefactor = (float) (scalefactor * 1.1);\r
- scale = findScale();\r
}\r
- else if (evt.getKeyCode() == KeyEvent.VK_DOWN)\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ */\r
+ public void mouseEntered(MouseEvent evt)\r
{\r
- scalefactor = (float) (scalefactor * 0.9);\r
- scale = findScale();\r
}\r
- else if (evt.getKeyChar() == 's')\r
- {\r
- System.err.println("DEBUG: Rectangle selection"); // log.debug\r
\r
- if ( (rectx2 != -1) && (recty2 != -1))\r
- {\r
- rectSelect(rectx1, recty1, rectx2, recty2);\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ */\r
+ public void mouseExited(MouseEvent evt)\r
+ {\r
}\r
\r
- repaint();\r
- }\r
-\r
- public void printPoints()\r
- {\r
- for (int i = 0; i < npoint; i++)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ */\r
+ public void mouseReleased(MouseEvent evt)\r
{\r
- SequencePoint sp = (SequencePoint) points.elementAt(i);\r
- Format.print(System.out, "%5d ", i);\r
-\r
- for (int j = 0; j < 3; j++)\r
- {\r
- Format.print(System.out, "%13.3f ", sp.coord[j]);\r
- }\r
-\r
- System.out.println();\r
}\r
- }\r
-\r
- public void mouseClicked(MouseEvent evt)\r
- {\r
- }\r
-\r
- public void mouseEntered(MouseEvent evt)\r
- {\r
- }\r
\r
- public void mouseExited(MouseEvent evt)\r
- {\r
- }\r
-\r
- public void mouseReleased(MouseEvent evt)\r
- {\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ */\r
+ public void mousePressed(MouseEvent evt)\r
+ {\r
+ int x = evt.getX();\r
+ int y = evt.getY();\r
\r
- public void mousePressed(MouseEvent evt)\r
- {\r
- int x = evt.getX();\r
- int y = evt.getY();\r
+ mx = x;\r
+ my = y;\r
\r
- mx = x;\r
- my = y;\r
+ omx = mx;\r
+ omy = my;\r
\r
- omx = mx;\r
- omy = my;\r
+ startx = x;\r
+ starty = y;\r
\r
- startx = x;\r
- starty = y;\r
+ rectx1 = x;\r
+ recty1 = y;\r
\r
- rectx1 = x;\r
- recty1 = y;\r
+ rectx2 = -1;\r
+ recty2 = -1;\r
\r
- rectx2 = -1;\r
- recty2 = -1;\r
+ SequenceI found = findPoint(x, y);\r
\r
- SequenceI found = findPoint(x, y);\r
+ if (found != null)\r
+ {\r
+ if (av.getSelectionGroup() != null)\r
+ {\r
+ av.getSelectionGroup().addOrRemove(found, true);\r
+ PaintRefresher.Refresh(this, av.alignment);\r
+ }\r
+ else\r
+ {\r
+ av.setSelectionGroup(new SequenceGroup());\r
+ av.getSelectionGroup().addOrRemove(found, true);\r
+ av.getSelectionGroup().setEndRes(av.alignment.getWidth());\r
+ }\r
+ }\r
\r
- if (found != null)\r
- {\r
- if (av.getSelectionGroup() != null)\r
- {\r
- av.getSelectionGroup().addOrRemove(found, true);\r
- PaintRefresher.Refresh(this, av.alignment);\r
- }\r
- else\r
- {\r
- av.setSelectionGroup(new SequenceGroup());\r
- av.getSelectionGroup().addOrRemove(found, true);\r
- av.getSelectionGroup().setEndRes(av.alignment.getWidth());\r
- }\r
+ repaint();\r
}\r
\r
- repaint();\r
- }\r
-\r
- // private void fireSequenceSelectionEvent(Selection sel) {\r
- // controller.handleSequenceSelectionEvent(new SequenceSelectionEvent(this,sel));\r
- //}\r
- public void mouseMoved(MouseEvent evt)\r
- {\r
- SequenceI found = findPoint(evt.getX(), evt.getY());\r
-\r
- if (found != null)\r
- {\r
- this.setToolTipText(found.getName());\r
- }\r
- else\r
+ // private void fireSequenceSelectionEvent(Selection sel) {\r
+ // controller.handleSequenceSelectionEvent(new SequenceSelectionEvent(this,sel));\r
+ //}\r
+ public void mouseMoved(MouseEvent evt)\r
{\r
- this.setToolTipText(null);\r
- }\r
- }\r
+ SequenceI found = findPoint(evt.getX(), evt.getY());\r
\r
- public void mouseDragged(MouseEvent evt)\r
- {\r
- mx = evt.getX();\r
- my = evt.getY();\r
-\r
- //Check if this is a rectangle drawing drag\r
- if ( (evt.getModifiers() & InputEvent.BUTTON2_MASK) != 0)\r
- {\r
- // rectx2 = evt.getX();\r
- // recty2 = evt.getY();\r
+ if (found != null)\r
+ {\r
+ this.setToolTipText(found.getName());\r
+ }\r
+ else\r
+ {\r
+ this.setToolTipText(null);\r
+ }\r
}\r
- else\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ */\r
+ public void mouseDragged(MouseEvent evt)\r
{\r
- rotmat.setIdentity();\r
+ mx = evt.getX();\r
+ my = evt.getY();\r
\r
- rotmat.rotate( (float) (my - omy), 'x');\r
- rotmat.rotate( (float) (mx - omx), 'y');\r
+ //Check if this is a rectangle drawing drag\r
+ if ((evt.getModifiers() & InputEvent.BUTTON2_MASK) != 0)\r
+ {\r
+ // rectx2 = evt.getX();\r
+ // recty2 = evt.getY();\r
+ }\r
+ else\r
+ {\r
+ rotmat.setIdentity();\r
\r
- for (int i = 0; i < npoint; i++)\r
- {\r
- SequencePoint sp = (SequencePoint) points.elementAt(i);\r
- sp.coord[0] -= centre[0];\r
- sp.coord[1] -= centre[1];\r
- sp.coord[2] -= centre[2];\r
+ rotmat.rotate((float) (my - omy), 'x');\r
+ rotmat.rotate((float) (mx - omx), 'y');\r
\r
- //Now apply the rotation matrix\r
- sp.coord = rotmat.vectorMultiply(sp.coord);\r
+ for (int i = 0; i < npoint; i++)\r
+ {\r
+ SequencePoint sp = (SequencePoint) points.elementAt(i);\r
+ sp.coord[0] -= centre[0];\r
+ sp.coord[1] -= centre[1];\r
+ sp.coord[2] -= centre[2];\r
\r
- //Now translate back again\r
- sp.coord[0] += centre[0];\r
- sp.coord[1] += centre[1];\r
- sp.coord[2] += centre[2];\r
- }\r
+ //Now apply the rotation matrix\r
+ sp.coord = rotmat.vectorMultiply(sp.coord);\r
\r
- for (int i = 0; i < 3; i++)\r
- {\r
- axes[i] = rotmat.vectorMultiply(axes[i]);\r
- }\r
+ //Now translate back again\r
+ sp.coord[0] += centre[0];\r
+ sp.coord[1] += centre[1];\r
+ sp.coord[2] += centre[2];\r
+ }\r
\r
- omx = mx;\r
- omy = my;\r
+ for (int i = 0; i < 3; i++)\r
+ {\r
+ axes[i] = rotmat.vectorMultiply(axes[i]);\r
+ }\r
\r
- paint(this.getGraphics());\r
- }\r
- }\r
+ omx = mx;\r
+ omy = my;\r
\r
- public void rectSelect(int x1, int y1, int x2, int y2)\r
- {\r
- boolean changedSel = false;\r
+ paint(this.getGraphics());\r
+ }\r
+ }\r
\r
- for (int i = 0; i < npoint; i++)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param x1 DOCUMENT ME!\r
+ * @param y1 DOCUMENT ME!\r
+ * @param x2 DOCUMENT ME!\r
+ * @param y2 DOCUMENT ME!\r
+ */\r
+ public void rectSelect(int x1, int y1, int x2, int y2)\r
{\r
- SequencePoint sp = (SequencePoint) points.elementAt(i);\r
- int tmp1 = (int) ( ( (sp.coord[0] - centre[0]) * scale) +\r
- ( (float) getWidth() / 2.0));\r
- int tmp2 = (int) ( ( (sp.coord[1] - centre[1]) * scale) +\r
- ( (float) getHeight() / 2.0));\r
-\r
- if ( (tmp1 > x1) && (tmp1 < x2) && (tmp2 > y1) && (tmp2 < y2))\r
- {\r
- if (av != null)\r
+ boolean changedSel = false;\r
+\r
+ for (int i = 0; i < npoint; i++)\r
{\r
- if (!av.getSelectionGroup().sequences.contains(sp.sequence))\r
- {\r
- changedSel = true;\r
- av.getSelectionGroup().addSequence(sp.sequence, true);\r
- }\r
+ SequencePoint sp = (SequencePoint) points.elementAt(i);\r
+ int tmp1 = (int) (((sp.coord[0] - centre[0]) * scale) +\r
+ ((float) getWidth() / 2.0));\r
+ int tmp2 = (int) (((sp.coord[1] - centre[1]) * scale) +\r
+ ((float) getHeight() / 2.0));\r
+\r
+ if ((tmp1 > x1) && (tmp1 < x2) && (tmp2 > y1) && (tmp2 < y2))\r
+ {\r
+ if (av != null)\r
+ {\r
+ if (!av.getSelectionGroup().sequences.contains(sp.sequence))\r
+ {\r
+ changedSel = true;\r
+ av.getSelectionGroup().addSequence(sp.sequence, true);\r
+ }\r
+ }\r
+ }\r
}\r
- }\r
- }\r
\r
- // if (changedSel) {\r
- // fireSequenceSelectionEvent(av.getSelection());\r
- // }\r
- }\r
+ // if (changedSel) {\r
+ // fireSequenceSelectionEvent(av.getSelection());\r
+ // }\r
+ }\r
\r
- public SequenceI findPoint(int x, int y)\r
- {\r
- int halfwidth = getWidth() / 2;\r
- int halfheight = getHeight() / 2;\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param x DOCUMENT ME!\r
+ * @param y DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public SequenceI findPoint(int x, int y)\r
+ {\r
+ int halfwidth = getWidth() / 2;\r
+ int halfheight = getHeight() / 2;\r
\r
- int found = -1;\r
+ int found = -1;\r
\r
- for (int i = 0; i < npoint; i++)\r
- {\r
- SequencePoint sp = (SequencePoint) points.elementAt(i);\r
- int px = (int) ( (float) (sp.coord[0] - centre[0]) * scale) +\r
- halfwidth;\r
- int py = (int) ( (float) (sp.coord[1] - centre[1]) * scale) +\r
- halfheight;\r
-\r
- if ( (Math.abs(px - x) < 3) && (Math.abs(py - y) < 3))\r
- {\r
- found = i;\r
- }\r
- }\r
+ for (int i = 0; i < npoint; i++)\r
+ {\r
+ SequencePoint sp = (SequencePoint) points.elementAt(i);\r
+ int px = (int) ((float) (sp.coord[0] - centre[0]) * scale) +\r
+ halfwidth;\r
+ int py = (int) ((float) (sp.coord[1] - centre[1]) * scale) +\r
+ halfheight;\r
+\r
+ if ((Math.abs(px - x) < 3) && (Math.abs(py - y) < 3))\r
+ {\r
+ found = i;\r
+ }\r
+ }\r
\r
- if (found != -1)\r
- {\r
- return ( (SequencePoint) points.elementAt(found)).sequence;\r
- }\r
- else\r
- {\r
- return null;\r
+ if (found != -1)\r
+ {\r
+ return ((SequencePoint) points.elementAt(found)).sequence;\r
+ }\r
+ else\r
+ {\r
+ return null;\r
+ }\r
}\r
- }\r
\r
- /* public boolean handleRubberbandEvent(RubberbandEvent evt) {\r
- System.out.println("Rubberband handler called in RotatableCanvas with " +\r
- evt.getBounds());\r
+ /* public boolean handleRubberbandEvent(RubberbandEvent evt) {\r
+ System.out.println("Rubberband handler called in RotatableCanvas with " +\r
+ evt.getBounds());\r
\r
- Rubberband rb = (Rubberband)evt.getSource();\r
+ Rubberband rb = (Rubberband)evt.getSource();\r
\r
- // Clear the current selection (instance variable)\r
- //if ((rb.getModifiers() & Event.SHIFT_MASK) == 0) {\r
- // clearSelection();\r
- //}\r
+ // Clear the current selection (instance variable)\r
+ //if ((rb.getModifiers() & Event.SHIFT_MASK) == 0) {\r
+ // clearSelection();\r
+ //}\r
\r
- if (rb.getComponent() == this) {\r
- Rectangle bounds = evt.getBounds();\r
- rectSelect(bounds.x,bounds.y,bounds.x+bounds.width,bounds.y+bounds.height);\r
- }\r
+ if (rb.getComponent() == this) {\r
+ Rectangle bounds = evt.getBounds();\r
+ rectSelect(bounds.x,bounds.y,bounds.x+bounds.width,bounds.y+bounds.height);\r
+ }\r
\r
- redrawneeded = true;\r
- paint(this.getGraphics());\r
+ redrawneeded = true;\r
+ paint(this.getGraphics());\r
\r
- return true;\r
- }*/\r
+ return true;\r
+ }*/\r
}\r
*/\r
package jalview.gui;\r
\r
+import jalview.datamodel.*;\r
+\r
import java.awt.*;\r
import java.awt.event.*;\r
+\r
import javax.swing.*;\r
\r
-import jalview.datamodel.*;\r
\r
-public class ScalePanel\r
- extends JPanel\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class ScalePanel extends JPanel\r
{\r
- protected int offy = 4;\r
- public int width;\r
- protected AlignViewport av;\r
- AlignmentPanel ap;\r
- boolean stretchingGroup = false;\r
-\r
- int min, max; //used by mouseDragged to see if user\r
- // wants to delete columns\r
-\r
- public ScalePanel(AlignViewport av, AlignmentPanel ap)\r
- {\r
- this.av = av;\r
- this.ap = ap;\r
-\r
- addMouseListener(new MouseAdapter()\r
+ protected int offy = 4;\r
+\r
+ /** DOCUMENT ME!! */\r
+ public int width;\r
+ protected AlignViewport av;\r
+ AlignmentPanel ap;\r
+ boolean stretchingGroup = false;\r
+ int min; //used by mouseDragged to see if user\r
+ int max; //used by mouseDragged to see if user\r
+\r
+ // wants to delete columns\r
+ public ScalePanel(AlignViewport av, AlignmentPanel ap)\r
{\r
- public void mousePressed(MouseEvent evt)\r
- {\r
- doMousePressed(evt);\r
- }\r
-\r
- public void mouseReleased(MouseEvent evt)\r
- {\r
- doMouseReleased(evt);\r
- }\r
- });\r
- addMouseMotionListener(new MouseMotionAdapter()\r
- {\r
- public void mouseDragged(MouseEvent evt)\r
- {\r
- doMouseDragged(evt);\r
- }\r
- });\r
- }\r
-\r
- public void doMousePressed(MouseEvent evt)\r
- {\r
- int x = evt.getX();\r
- int res = (x / av.getCharWidth()) + av.getStartRes();\r
- SequenceGroup sg = null;\r
-\r
- min=res;\r
- max=res;\r
-\r
- if (av.getColumnSelection().contains(res))\r
- {\r
- av.getColumnSelection().removeElement(res);\r
- ap.annotationPanel.removeEditableColumn(res);\r
+ this.av = av;\r
+ this.ap = ap;\r
+\r
+ addMouseListener(new MouseAdapter()\r
+ {\r
+ public void mousePressed(MouseEvent evt)\r
+ {\r
+ doMousePressed(evt);\r
+ }\r
+\r
+ public void mouseReleased(MouseEvent evt)\r
+ {\r
+ doMouseReleased(evt);\r
+ }\r
+ });\r
+ addMouseMotionListener(new MouseMotionAdapter()\r
+ {\r
+ public void mouseDragged(MouseEvent evt)\r
+ {\r
+ doMouseDragged(evt);\r
+ }\r
+ });\r
}\r
- else\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ */\r
+ public void doMousePressed(MouseEvent evt)\r
{\r
- av.getColumnSelection().addElement(res);\r
- sg = new SequenceGroup();\r
+ int x = evt.getX();\r
+ int res = (x / av.getCharWidth()) + av.getStartRes();\r
+ SequenceGroup sg = null;\r
+\r
+ min = res;\r
+ max = res;\r
+\r
+ if (av.getColumnSelection().contains(res))\r
+ {\r
+ av.getColumnSelection().removeElement(res);\r
+ ap.annotationPanel.removeEditableColumn(res);\r
+ }\r
+ else\r
+ {\r
+ av.getColumnSelection().addElement(res);\r
+ sg = new SequenceGroup();\r
\r
- for (int i = 0; i < av.alignment.getSequences().size(); i++)\r
- {\r
- sg.addSequence(av.alignment.getSequenceAt(i), false);\r
- }\r
+ for (int i = 0; i < av.alignment.getSequences().size(); i++)\r
+ {\r
+ sg.addSequence(av.alignment.getSequenceAt(i), false);\r
+ }\r
\r
- sg.setStartRes(res);\r
- sg.setEndRes(res);\r
+ sg.setStartRes(res);\r
+ sg.setEndRes(res);\r
+ }\r
\r
+ av.setSelectionGroup(sg);\r
+ ap.repaint();\r
}\r
\r
- av.setSelectionGroup(sg);\r
- ap.repaint();\r
- }\r
-\r
- public void doMouseReleased(MouseEvent evt)\r
- {\r
- int x = evt.getX();\r
- int res = (x / av.getCharWidth()) + av.getStartRes();\r
-\r
- if(av.getColumnSelection()!=null)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ */\r
+ public void doMouseReleased(MouseEvent evt)\r
{\r
- for(int i=0; i<av.getColumnSelection().size(); i++)\r
- {\r
- ap.annotationPanel.addEditableColumn(\r
- av.getColumnSelection().columnAt(i));\r
- }\r
+ int x = evt.getX();\r
+ int res = (x / av.getCharWidth()) + av.getStartRes();\r
+\r
+ if (av.getColumnSelection() != null)\r
+ {\r
+ for (int i = 0; i < av.getColumnSelection().size(); i++)\r
+ {\r
+ ap.annotationPanel.addEditableColumn(av.getColumnSelection()\r
+ .columnAt(i));\r
+ }\r
+ }\r
+\r
+ if (!stretchingGroup)\r
+ {\r
+ ap.repaint();\r
+\r
+ return;\r
+ }\r
+\r
+ SequenceGroup sg = av.getSelectionGroup();\r
+\r
+ if (res > sg.getStartRes())\r
+ {\r
+ sg.setEndRes(res);\r
+ }\r
+ else if (res < sg.getStartRes())\r
+ {\r
+ sg.setStartRes(res);\r
+ }\r
+\r
+ stretchingGroup = false;\r
+ ap.repaint();\r
}\r
\r
- if (!stretchingGroup)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ */\r
+ public void doMouseDragged(MouseEvent evt)\r
{\r
- ap.repaint();\r
- return;\r
+ int x = evt.getX();\r
+ int res = (x / av.getCharWidth()) + av.getStartRes();\r
+\r
+ if (res < min)\r
+ {\r
+ min = res;\r
+ }\r
+\r
+ if (res > max)\r
+ {\r
+ max = res;\r
+ }\r
+\r
+ SequenceGroup sg = av.getSelectionGroup();\r
+\r
+ if (sg != null)\r
+ {\r
+ stretchingGroup = true;\r
+\r
+ if (!av.getColumnSelection().contains(res))\r
+ {\r
+ av.getColumnSelection().addElement(res);\r
+ }\r
+\r
+ if (res > sg.getStartRes())\r
+ {\r
+ sg.setEndRes(res);\r
+ }\r
+ else if (res < sg.getStartRes())\r
+ {\r
+ sg.setStartRes(res);\r
+ }\r
+\r
+ for (int i = min; i <= max; i++)\r
+ {\r
+ if ((i < sg.getStartRes()) || (i > sg.getEndRes()))\r
+ {\r
+ av.getColumnSelection().removeElement(i);\r
+ ap.annotationPanel.removeEditableColumn(res);\r
+ }\r
+ else\r
+ {\r
+ av.getColumnSelection().addElement(i);\r
+ }\r
+ }\r
+\r
+ ap.repaint();\r
+ }\r
}\r
\r
- SequenceGroup sg = av.getSelectionGroup();\r
-\r
- if (res > sg.getStartRes())\r
- {\r
- sg.setEndRes(res);\r
- }\r
- else if (res < sg.getStartRes())\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param g DOCUMENT ME!\r
+ */\r
+ public void paintComponent(Graphics g)\r
{\r
- sg.setStartRes(res);\r
+ drawScale(g, av.getStartRes(), av.getEndRes(), getWidth(), getHeight());\r
}\r
\r
- stretchingGroup = false;\r
- ap.repaint();\r
- }\r
-\r
- public void doMouseDragged(MouseEvent evt)\r
- {\r
- int x = evt.getX();\r
- int res = (x / av.getCharWidth()) + av.getStartRes();\r
-\r
- if(res < min)\r
- min = res;\r
- if(res>max)\r
- max = res;\r
-\r
- SequenceGroup sg = av.getSelectionGroup();\r
-\r
- if (sg != null)\r
+ // scalewidth will normally be screenwidth,\r
+ public void drawScale(Graphics g, int startx, int endx, int width,\r
+ int height)\r
{\r
- stretchingGroup = true;\r
- if (!av.getColumnSelection().contains(res))\r
- {\r
- av.getColumnSelection().addElement(res);\r
- }\r
-\r
-\r
- if (res > sg.getStartRes())\r
- {\r
- sg.setEndRes(res);\r
- }\r
- else if (res < sg.getStartRes())\r
- {\r
- sg.setStartRes(res);\r
- }\r
-\r
- for(int i=min; i<=max; i++)\r
- {\r
- if (i < sg.getStartRes() || i > sg.getEndRes())\r
- {\r
- av.getColumnSelection().removeElement(i);\r
- ap.annotationPanel.removeEditableColumn(res);\r
- }\r
- else\r
- av.getColumnSelection().addElement(i);\r
- }\r
- ap.repaint();\r
- }\r
- }\r
-\r
- public void paintComponent(Graphics g)\r
- {\r
- drawScale(g, av.getStartRes(), av.getEndRes(), getWidth(), getHeight());\r
- }\r
-\r
- // scalewidth will normally be screenwidth,\r
- public void drawScale(Graphics g, int startx, int endx, int width,\r
- int height)\r
- {\r
- Graphics2D gg = (Graphics2D) g;\r
- gg.setFont(av.getFont());\r
- gg.setRenderingHint(RenderingHints.KEY_ANTIALIASING,\r
- RenderingHints.VALUE_ANTIALIAS_ON);\r
-\r
- //Fill in the background\r
- gg.setColor(Color.white);\r
- gg.fillRect(0, 0, width, height);\r
- gg.setColor(Color.black);\r
-\r
- //Fill the selected columns\r
- ColumnSelection cs = av.getColumnSelection();\r
- gg.setColor(new Color(220, 0, 0));\r
-\r
- for (int i = 0; i < cs.size(); i++)\r
- {\r
- int sel = cs.columnAt(i);\r
-\r
- if ( (sel >= startx) && (sel <= endx))\r
- {\r
- gg.fillRect( (sel - startx) * av.charWidth, 0, av.charWidth,\r
+ Graphics2D gg = (Graphics2D) g;\r
+ gg.setFont(av.getFont());\r
+ gg.setRenderingHint(RenderingHints.KEY_ANTIALIASING,\r
+ RenderingHints.VALUE_ANTIALIAS_ON);\r
+\r
+ //Fill in the background\r
+ gg.setColor(Color.white);\r
+ gg.fillRect(0, 0, width, height);\r
+ gg.setColor(Color.black);\r
+\r
+ //Fill the selected columns\r
+ ColumnSelection cs = av.getColumnSelection();\r
+ gg.setColor(new Color(220, 0, 0));\r
+\r
+ for (int i = 0; i < cs.size(); i++)\r
+ {\r
+ int sel = cs.columnAt(i);\r
+\r
+ if ((sel >= startx) && (sel <= endx))\r
+ {\r
+ gg.fillRect((sel - startx) * av.charWidth, 0, av.charWidth,\r
getHeight());\r
- }\r
- }\r
-\r
- // Draw the scale numbers\r
- gg.setColor(Color.black);\r
-\r
- int scalestartx = (startx / 10) * 10;\r
-\r
- FontMetrics fm = gg.getFontMetrics(av.getFont());\r
- int y = av.charHeight - fm.getDescent();\r
-\r
- if ( (scalestartx % 10) == 0)\r
- {\r
- scalestartx += 5;\r
- }\r
-\r
- for (int i = scalestartx; i < endx; i += 5)\r
- {\r
- if ( (i % 10) == 0)\r
- {\r
- gg.drawString(String.valueOf(i),\r
- (i - startx - 1) * av.charWidth, y);\r
- gg.drawLine( (int) ( ( (i - startx - 1) * av.charWidth) +\r
- (av.charWidth / 2)), y + 2,\r
- (int) ( ( (i - startx - 1) * av.charWidth) +\r
- (av.charWidth / 2)), y + (fm.getDescent() * 2));\r
- }\r
- else\r
- {\r
- gg.drawLine( (int) ( ( (i - startx - 1) * av.charWidth) +\r
- (av.charWidth / 2)), y + fm.getDescent(),\r
- (int) ( ( (i - startx - 1) * av.charWidth) +\r
- (av.charWidth / 2)), y + (fm.getDescent() * 2));\r
- }\r
+ }\r
+ }\r
+\r
+ // Draw the scale numbers\r
+ gg.setColor(Color.black);\r
+\r
+ int scalestartx = (startx / 10) * 10;\r
+\r
+ FontMetrics fm = gg.getFontMetrics(av.getFont());\r
+ int y = av.charHeight - fm.getDescent();\r
+\r
+ if ((scalestartx % 10) == 0)\r
+ {\r
+ scalestartx += 5;\r
+ }\r
+\r
+ for (int i = scalestartx; i < endx; i += 5)\r
+ {\r
+ if ((i % 10) == 0)\r
+ {\r
+ gg.drawString(String.valueOf(i),\r
+ (i - startx - 1) * av.charWidth, y);\r
+ gg.drawLine((int) (((i - startx - 1) * av.charWidth) +\r
+ (av.charWidth / 2)), y + 2,\r
+ (int) (((i - startx - 1) * av.charWidth) +\r
+ (av.charWidth / 2)), y + (fm.getDescent() * 2));\r
+ }\r
+ else\r
+ {\r
+ gg.drawLine((int) (((i - startx - 1) * av.charWidth) +\r
+ (av.charWidth / 2)), y + fm.getDescent(),\r
+ (int) (((i - startx - 1) * av.charWidth) +\r
+ (av.charWidth / 2)), y + (fm.getDescent() * 2));\r
+ }\r
+ }\r
}\r
- }\r
}\r
*/\r
package jalview.gui;\r
\r
+import jalview.datamodel.*;\r
+\r
import java.awt.*;\r
import java.awt.image.*;\r
+\r
import javax.swing.*;\r
\r
-import jalview.analysis.*;\r
-import jalview.datamodel.*;\r
\r
-public class SeqCanvas\r
- extends JComponent\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class SeqCanvas extends JComponent\r
{\r
- FeatureRenderer fr;\r
- SequenceRenderer sr;\r
- BufferedImage img;\r
- Graphics2D gg;\r
- int imgWidth;\r
- int imgHeight;\r
- AlignViewport av;\r
- boolean showScores = false;\r
- boolean displaySearch = false;\r
- int[] searchResults = null;\r
- int chunkHeight;\r
- int chunkWidth;\r
- boolean fastPaint = false;\r
- int LABEL_WEST;\r
- int LABEL_EAST;\r
-\r
-\r
- public SeqCanvas(AlignViewport av)\r
- {\r
- this.av = av;\r
- fr = new FeatureRenderer(av);\r
- sr = new SequenceRenderer(av);\r
- setLayout(new BorderLayout());\r
- PaintRefresher.Register(this, av.alignment);\r
- setBackground(Color.white);\r
- }\r
-\r
- void drawNorthScale(Graphics g, int startx, int endx, int ypos)\r
- {\r
- int scalestartx = startx - (startx % 10) + 10;\r
-\r
- g.setColor(Color.black);\r
-\r
- // NORTH SCALE\r
- for (int i = scalestartx; i < endx; i += 10)\r
+ FeatureRenderer fr;\r
+ SequenceRenderer sr;\r
+ BufferedImage img;\r
+ Graphics2D gg;\r
+ int imgWidth;\r
+ int imgHeight;\r
+ AlignViewport av;\r
+ boolean showScores = false;\r
+ boolean displaySearch = false;\r
+ int[] searchResults = null;\r
+ int chunkHeight;\r
+ int chunkWidth;\r
+ boolean fastPaint = false;\r
+ int LABEL_WEST;\r
+ int LABEL_EAST;\r
+\r
+ /**\r
+ * Creates a new SeqCanvas object.\r
+ *\r
+ * @param av DOCUMENT ME!\r
+ */\r
+ public SeqCanvas(AlignViewport av)\r
{\r
- String string = String.valueOf(i);\r
- g.drawString(string, (i - startx - 1) * av.charWidth,\r
- ypos - (av.charHeight / 2));\r
-\r
- g.drawLine( ( (i - startx - 1) * av.charWidth) + (av.charWidth / 2),\r
- (ypos + 2) - (av.charHeight / 2),\r
- ( (i - startx - 1) * av.charWidth) + (av.charWidth / 2), ypos -\r
- 2);\r
+ this.av = av;\r
+ fr = new FeatureRenderer(av);\r
+ sr = new SequenceRenderer(av);\r
+ setLayout(new BorderLayout());\r
+ PaintRefresher.Register(this, av.alignment);\r
+ setBackground(Color.white);\r
}\r
- }\r
\r
- void drawWestScale(Graphics g, int startx, int endx, int ypos)\r
- {\r
- FontMetrics fm = getFontMetrics(av.getFont());\r
- ypos += av.charHeight;\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param g DOCUMENT ME!\r
+ * @param startx DOCUMENT ME!\r
+ * @param endx DOCUMENT ME!\r
+ * @param ypos DOCUMENT ME!\r
+ */\r
+ void drawNorthScale(Graphics g, int startx, int endx, int ypos)\r
+ {\r
+ int scalestartx = startx - (startx % 10) + 10;\r
+\r
+ g.setColor(Color.black);\r
\r
- // EAST SCALE\r
- for (int i = 0; i < av.alignment.getHeight(); i++)\r
+ // NORTH SCALE\r
+ for (int i = scalestartx; i < endx; i += 10)\r
+ {\r
+ String string = String.valueOf(i);\r
+ g.drawString(string, (i - startx - 1) * av.charWidth,\r
+ ypos - (av.charHeight / 2));\r
+\r
+ g.drawLine(((i - startx - 1) * av.charWidth) + (av.charWidth / 2),\r
+ (ypos + 2) - (av.charHeight / 2),\r
+ ((i - startx - 1) * av.charWidth) + (av.charWidth / 2), ypos -\r
+ 2);\r
+ }\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param g DOCUMENT ME!\r
+ * @param startx DOCUMENT ME!\r
+ * @param endx DOCUMENT ME!\r
+ * @param ypos DOCUMENT ME!\r
+ */\r
+ void drawWestScale(Graphics g, int startx, int endx, int ypos)\r
{\r
- SequenceI seq = av.alignment.getSequenceAt(i);\r
- int index = startx;\r
- int value = -1;\r
+ FontMetrics fm = getFontMetrics(av.getFont());\r
+ ypos += av.charHeight;\r
\r
- while (index < endx)\r
- {\r
- if (jalview.util.Comparison.isGap(seq.getCharAt(index)))\r
+ // EAST SCALE\r
+ for (int i = 0; i < av.alignment.getHeight(); i++)\r
{\r
- index++;\r
+ SequenceI seq = av.alignment.getSequenceAt(i);\r
+ int index = startx;\r
+ int value = -1;\r
\r
- continue;\r
- }\r
+ while (index < endx)\r
+ {\r
+ if (jalview.util.Comparison.isGap(seq.getCharAt(index)))\r
+ {\r
+ index++;\r
\r
- value = av.alignment.getSequenceAt(i).findPosition(index);\r
+ continue;\r
+ }\r
\r
- break;\r
- }\r
+ value = av.alignment.getSequenceAt(i).findPosition(index);\r
\r
- if (value != -1)\r
- {\r
- int x = LABEL_WEST - fm.stringWidth(value + "");\r
- g.drawString(value + "", x,\r
- (ypos + (i * av.charHeight)) - (av.charHeight / 5));\r
- }\r
- }\r
- }\r
+ break;\r
+ }\r
\r
- void drawEastScale(Graphics g, int startx, int endx, int ypos)\r
- {\r
- ypos += av.charHeight;\r
+ if (value != -1)\r
+ {\r
+ int x = LABEL_WEST - fm.stringWidth(value + "");\r
+ g.drawString(value + "", x,\r
+ (ypos + (i * av.charHeight)) - (av.charHeight / 5));\r
+ }\r
+ }\r
+ }\r
\r
- // EAST SCALE\r
- for (int i = 0; i < av.alignment.getHeight(); i++)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param g DOCUMENT ME!\r
+ * @param startx DOCUMENT ME!\r
+ * @param endx DOCUMENT ME!\r
+ * @param ypos DOCUMENT ME!\r
+ */\r
+ void drawEastScale(Graphics g, int startx, int endx, int ypos)\r
{\r
- SequenceI seq = av.alignment.getSequenceAt(i);\r
- int index = endx;\r
- int value = -1;\r
+ ypos += av.charHeight;\r
\r
- while (index > startx)\r
- {\r
- if (jalview.util.Comparison.isGap(seq.getCharAt(index)))\r
+ // EAST SCALE\r
+ for (int i = 0; i < av.alignment.getHeight(); i++)\r
{\r
- index--;\r
+ SequenceI seq = av.alignment.getSequenceAt(i);\r
+ int index = endx;\r
+ int value = -1;\r
\r
- continue;\r
- }\r
+ while (index > startx)\r
+ {\r
+ if (jalview.util.Comparison.isGap(seq.getCharAt(index)))\r
+ {\r
+ index--;\r
+\r
+ continue;\r
+ }\r
\r
- value = av.alignment.getSequenceAt(i).findPosition(index);\r
+ value = av.alignment.getSequenceAt(i).findPosition(index);\r
\r
- break;\r
- }\r
+ break;\r
+ }\r
\r
- if (value != -1)\r
- {\r
- g.drawString(value + "", 0,\r
- (ypos + (i * av.charHeight)) - (av.charHeight / 5));\r
- }\r
+ if (value != -1)\r
+ {\r
+ g.drawString(value + "", 0,\r
+ (ypos + (i * av.charHeight)) - (av.charHeight / 5));\r
+ }\r
+ }\r
}\r
- }\r
\r
- public void fastPaint(int horizontal, int vertical)\r
- {\r
- if ( ( (horizontal == 0) && (vertical == 0)) || (gg == null))\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param horizontal DOCUMENT ME!\r
+ * @param vertical DOCUMENT ME!\r
+ */\r
+ public void fastPaint(int horizontal, int vertical)\r
{\r
- return;\r
- }\r
+ if (((horizontal == 0) && (vertical == 0)) || (gg == null))\r
+ {\r
+ return;\r
+ }\r
\r
- gg.copyArea(0, 0, imgWidth, imgHeight, -horizontal * av.charWidth,\r
- -vertical * av.charHeight);\r
+ gg.copyArea(0, 0, imgWidth, imgHeight, -horizontal * av.charWidth,\r
+ -vertical * av.charHeight);\r
\r
- int sr = av.startRes;\r
- int er = av.endRes;\r
- int ss = av.startSeq;\r
- int es = av.endSeq;\r
- int transX = 0;\r
- int transY = 0;\r
+ int sr = av.startRes;\r
+ int er = av.endRes;\r
+ int ss = av.startSeq;\r
+ int es = av.endSeq;\r
+ int transX = 0;\r
+ int transY = 0;\r
\r
- if (horizontal > 0) // scrollbar pulled right, image to the left\r
- {\r
- transX = (er - sr - horizontal) * av.charWidth;\r
- sr = er - horizontal;\r
- }\r
- else if (horizontal < 0)\r
- {\r
- er = sr - horizontal;\r
- }\r
- else if (vertical > 0) // scroll down\r
- {\r
- ss = es - vertical;\r
-\r
- if (ss < av.startSeq)\r
- { // ie scrolling too fast, more than a page at a time\r
- ss = av.startSeq;\r
- }\r
- else\r
- {\r
- transY = imgHeight - (vertical * av.charHeight);\r
- }\r
- }\r
- else if (vertical < 0)\r
- {\r
- es = ss - vertical;\r
+ if (horizontal > 0) // scrollbar pulled right, image to the left\r
+ {\r
+ transX = (er - sr - horizontal) * av.charWidth;\r
+ sr = er - horizontal;\r
+ }\r
+ else if (horizontal < 0)\r
+ {\r
+ er = sr - horizontal;\r
+ }\r
+ else if (vertical > 0) // scroll down\r
+ {\r
+ ss = es - vertical;\r
\r
- if (es > av.endSeq)\r
- {\r
- es = av.endSeq;\r
- }\r
- }\r
+ if (ss < av.startSeq)\r
+ { // ie scrolling too fast, more than a page at a time\r
+ ss = av.startSeq;\r
+ }\r
+ else\r
+ {\r
+ transY = imgHeight - (vertical * av.charHeight);\r
+ }\r
+ }\r
+ else if (vertical < 0)\r
+ {\r
+ es = ss - vertical;\r
\r
- gg.translate(transX, transY);\r
-\r
- gg.setColor(Color.white);\r
- gg.fillRect(0, 0, (er - sr + 1) * av.charWidth,\r
- (es - ss) * av.charHeight);\r
- drawPanel(gg, sr, er, ss, es, sr, ss, 0);\r
- gg.translate( -transX, -transY);\r
-\r
- fastPaint = true;\r
- repaint();\r
- }\r
-\r
- /**\r
- * Definitions of startx and endx (hopefully):\r
- * SMJS This is what I'm working towards!\r
- * startx is the first residue (starting at 0) to display.\r
- * endx is the last residue to display (starting at 0).\r
- * starty is the first sequence to display (starting at 0).\r
- * endy is the last sequence to display (starting at 0).\r
- * NOTE 1: The av limits are set in setFont in this class and\r
- * in the adjustment listener in SeqPanel when the scrollbars move.\r
- */\r
-\r
-\r
- // Set this to false to force a full panel paint\r
- public void paintComponent(Graphics g)\r
- {\r
- if (img!=null\r
- && (fastPaint || getWidth() != g.getClipBounds().width\r
- || getHeight() != g.getClipBounds().height))\r
- {\r
- g.drawImage(img, 0, 0, this);\r
- fastPaint = false;\r
- return;\r
- }\r
+ if (es > av.endSeq)\r
+ {\r
+ es = av.endSeq;\r
+ }\r
+ }\r
\r
- // this draws the whole of the alignment\r
- imgWidth = getWidth();\r
- imgHeight = getHeight();\r
+ gg.translate(transX, transY);\r
\r
- imgWidth -= (imgWidth % av.charWidth);\r
- imgHeight -= (imgHeight % av.charHeight);\r
+ gg.setColor(Color.white);\r
+ gg.fillRect(0, 0, (er - sr + 1) * av.charWidth,\r
+ (es - ss) * av.charHeight);\r
+ drawPanel(gg, sr, er, ss, es, sr, ss, 0);\r
+ gg.translate(-transX, -transY);\r
\r
- if ( (imgWidth < 1) || (imgHeight < 1))\r
- {\r
- return;\r
+ fastPaint = true;\r
+ repaint();\r
}\r
\r
- img = new BufferedImage(imgWidth, imgHeight, BufferedImage.TYPE_INT_RGB);\r
- gg = (Graphics2D) img.getGraphics();\r
- gg.setFont(av.getFont());\r
- gg.setRenderingHint(RenderingHints.KEY_ANTIALIASING,\r
- RenderingHints.VALUE_ANTIALIAS_ON);\r
+ /**\r
+ * Definitions of startx and endx (hopefully):\r
+ * SMJS This is what I'm working towards!\r
+ * startx is the first residue (starting at 0) to display.\r
+ * endx is the last residue to display (starting at 0).\r
+ * starty is the first sequence to display (starting at 0).\r
+ * endy is the last sequence to display (starting at 0).\r
+ * NOTE 1: The av limits are set in setFont in this class and\r
+ * in the adjustment listener in SeqPanel when the scrollbars move.\r
+ */\r
+\r
+ // Set this to false to force a full panel paint\r
+ public void paintComponent(Graphics g)\r
+ {\r
+ if ((img != null) &&\r
+ (fastPaint || (getWidth() != g.getClipBounds().width) ||\r
+ (getHeight() != g.getClipBounds().height)))\r
+ {\r
+ g.drawImage(img, 0, 0, this);\r
+ fastPaint = false;\r
\r
- gg.setColor(Color.white);\r
- gg.fillRect(0, 0, imgWidth, imgHeight);\r
+ return;\r
+ }\r
\r
- chunkWidth = getWrappedCanvasWidth(getWidth());\r
- chunkHeight = (av.getAlignment().getHeight() + 2) * av.charHeight;\r
+ // this draws the whole of the alignment\r
+ imgWidth = getWidth();\r
+ imgHeight = getHeight();\r
\r
- av.setChunkHeight(chunkHeight);\r
- av.setChunkWidth(chunkWidth);\r
+ imgWidth -= (imgWidth % av.charWidth);\r
+ imgHeight -= (imgHeight % av.charHeight);\r
\r
- if (av.getWrapAlignment())\r
- {\r
- drawWrappedPanel(gg, getWidth(), getHeight(), av.startRes);\r
- }\r
- else\r
- {\r
- drawPanel(gg, av.startRes, av.endRes, av.startSeq, av.endSeq,\r
- av.startRes, av.startSeq, 0);\r
- }\r
+ if ((imgWidth < 1) || (imgHeight < 1))\r
+ {\r
+ return;\r
+ }\r
\r
- g.drawImage(img, 0, 0, this);\r
- }\r
+ img = new BufferedImage(imgWidth, imgHeight, BufferedImage.TYPE_INT_RGB);\r
+ gg = (Graphics2D) img.getGraphics();\r
+ gg.setFont(av.getFont());\r
+ gg.setRenderingHint(RenderingHints.KEY_ANTIALIASING,\r
+ RenderingHints.VALUE_ANTIALIAS_ON);\r
\r
- public int getWrappedCanvasWidth(int cwidth)\r
- {\r
- FontMetrics fm = getFontMetrics(av.getFont());\r
+ gg.setColor(Color.white);\r
+ gg.fillRect(0, 0, imgWidth, imgHeight);\r
\r
- LABEL_EAST = 0;\r
- LABEL_WEST = 0;\r
+ chunkWidth = getWrappedCanvasWidth(getWidth());\r
+ chunkHeight = (av.getAlignment().getHeight() + 2) * av.charHeight;\r
\r
- if (av.scaleRightWrapped)\r
- {\r
- LABEL_EAST = fm.stringWidth(av.alignment.getWidth() + "000");\r
+ av.setChunkHeight(chunkHeight);\r
+ av.setChunkWidth(chunkWidth);\r
+\r
+ if (av.getWrapAlignment())\r
+ {\r
+ drawWrappedPanel(gg, getWidth(), getHeight(), av.startRes);\r
+ }\r
+ else\r
+ {\r
+ drawPanel(gg, av.startRes, av.endRes, av.startSeq, av.endSeq,\r
+ av.startRes, av.startSeq, 0);\r
+ }\r
+\r
+ g.drawImage(img, 0, 0, this);\r
}\r
\r
- if (av.scaleLeftWrapped)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param cwidth DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public int getWrappedCanvasWidth(int cwidth)\r
{\r
- LABEL_WEST = fm.stringWidth(av.alignment.getWidth() + "");\r
- }\r
+ FontMetrics fm = getFontMetrics(av.getFont());\r
\r
- return (cwidth - LABEL_EAST - LABEL_WEST) / av.charWidth;\r
- }\r
+ LABEL_EAST = 0;\r
+ LABEL_WEST = 0;\r
\r
- public void drawWrappedPanel(Graphics g, int canvasWidth, int canvasHeight,\r
- int startRes)\r
- {\r
- AlignmentI al = av.getAlignment();\r
+ if (av.scaleRightWrapped)\r
+ {\r
+ LABEL_EAST = fm.stringWidth(av.alignment.getWidth() + "000");\r
+ }\r
\r
- FontMetrics fm = getFontMetrics(av.getFont());\r
+ if (av.scaleLeftWrapped)\r
+ {\r
+ LABEL_WEST = fm.stringWidth(av.alignment.getWidth() + "");\r
+ }\r
\r
- int LABEL_EAST = 0;\r
+ return (cwidth - LABEL_EAST - LABEL_WEST) / av.charWidth;\r
+ }\r
\r
- if (av.scaleRightWrapped)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param g DOCUMENT ME!\r
+ * @param canvasWidth DOCUMENT ME!\r
+ * @param canvasHeight DOCUMENT ME!\r
+ * @param startRes DOCUMENT ME!\r
+ */\r
+ public void drawWrappedPanel(Graphics g, int canvasWidth, int canvasHeight,\r
+ int startRes)\r
{\r
- LABEL_EAST = fm.stringWidth(al.getWidth() + "000");\r
- }\r
+ AlignmentI al = av.getAlignment();\r
\r
- int LABEL_WEST = 0;\r
+ FontMetrics fm = getFontMetrics(av.getFont());\r
\r
- if (av.scaleLeftWrapped)\r
- {\r
- LABEL_WEST = fm.stringWidth(al.getWidth() + "0");\r
- }\r
+ int LABEL_EAST = 0;\r
\r
- int cWidth = (canvasWidth - LABEL_EAST - LABEL_WEST) / av.charWidth;\r
- int cHeight = (av.getAlignment().getHeight() + 2) * av.charHeight;\r
+ if (av.scaleRightWrapped)\r
+ {\r
+ LABEL_EAST = fm.stringWidth(al.getWidth() + "000");\r
+ }\r
\r
- av.endRes = av.startRes + cWidth;\r
+ int LABEL_WEST = 0;\r
\r
- int endx = (startRes + cWidth) - 1;\r
- int ypos = 2 * av.charHeight;\r
+ if (av.scaleLeftWrapped)\r
+ {\r
+ LABEL_WEST = fm.stringWidth(al.getWidth() + "0");\r
+ }\r
\r
- while ( (ypos <= canvasHeight) && (startRes < av.alignment.getWidth()))\r
- {\r
- g.setColor(Color.black);\r
-\r
- if (av.scaleLeftWrapped)\r
- {\r
- drawWestScale(g, startRes, endx, ypos);\r
- }\r
-\r
- if (av.scaleRightWrapped)\r
- {\r
- g.translate(canvasWidth - LABEL_EAST + av.charWidth, 0);\r
- drawEastScale(g, startRes, endx, ypos);\r
- g.translate( - (canvasWidth - LABEL_EAST + av.charWidth), 0);\r
- }\r
-\r
- g.translate(LABEL_WEST, 0);\r
-\r
- if (av.scaleAboveWrapped)\r
- {\r
- drawNorthScale(g, startRes, endx, ypos);\r
- }\r
-\r
- // When printing we have an extra clipped region,\r
- // the Printable page which we need to account for here\r
- Shape clip = g.getClip();\r
-\r
- if (clip == null)\r
- {\r
- g.setClip(0, 0, cWidth * av.charWidth, canvasHeight);\r
- }\r
- else\r
- {\r
- g.setClip(0, (int) clip.getBounds().getY(),\r
- cWidth * av.charWidth, (int) clip.getBounds().getHeight());\r
- }\r
-\r
- drawPanel(g, startRes, endx, 0, al.getHeight(), startRes, 0, ypos);\r
- g.setClip(clip);\r
- g.translate( -LABEL_WEST, 0);\r
-\r
- ypos += cHeight;\r
- startRes += cWidth;\r
- endx = (startRes + cWidth) - 1;\r
-\r
- if (endx > al.getWidth())\r
- {\r
- endx = al.getWidth();\r
- }\r
- }\r
- }\r
+ int cWidth = (canvasWidth - LABEL_EAST - LABEL_WEST) / av.charWidth;\r
+ int cHeight = (av.getAlignment().getHeight() + 2) * av.charHeight;\r
\r
- synchronized public void drawPanel(Graphics g1, int x1, int x2, int y1,\r
- int y2, int startx, int starty, int offset)\r
- {\r
- Graphics2D g = (Graphics2D) g1;\r
- g.setFont(av.getFont());\r
- sr.renderGaps(av.renderGaps);\r
+ av.endRes = av.startRes + cWidth;\r
\r
- SequenceI nextSeq;\r
+ int endx = (startRes + cWidth) - 1;\r
+ int ypos = 2 * av.charHeight;\r
\r
- /// First draw the sequences\r
- /////////////////////////////\r
- for (int i = y1; i < y2; i++)\r
- {\r
- nextSeq = av.alignment.getSequenceAt(i);\r
-\r
- sr.drawSequence(g, nextSeq, av.alignment.findAllGroups(nextSeq),\r
- x1, x2, (x1 - startx) * av.charWidth,\r
- offset +\r
- AlignmentUtil.getPixelHeight(starty, i, av.charHeight),\r
- av.charWidth, av.charHeight);\r
-\r
- if (av.showSequenceFeatures)\r
- {\r
- fr.drawSequence(g, nextSeq,\r
- av.alignment.findAllGroups(nextSeq), x1, x2,\r
- (x1 - startx) * av.charWidth,\r
- offset +\r
- AlignmentUtil.getPixelHeight(starty, i, av.charHeight),\r
- av.charWidth, av.charHeight);\r
- }\r
- }\r
+ while ((ypos <= canvasHeight) && (startRes < av.alignment.getWidth()))\r
+ {\r
+ g.setColor(Color.black);\r
\r
- //\r
- /////////////////////////////////////\r
- // Now outline any areas if necessary\r
- /////////////////////////////////////\r
- SequenceGroup group = av.getSelectionGroup();\r
- java.util.Vector groups = av.alignment.getGroups();\r
+ if (av.scaleLeftWrapped)\r
+ {\r
+ drawWestScale(g, startRes, endx, ypos);\r
+ }\r
\r
- int sx = -1;\r
- int sy = -1;\r
- int ex = -1;\r
- int groupIndex = -1;\r
+ if (av.scaleRightWrapped)\r
+ {\r
+ g.translate(canvasWidth - LABEL_EAST + av.charWidth, 0);\r
+ drawEastScale(g, startRes, endx, ypos);\r
+ g.translate(-(canvasWidth - LABEL_EAST + av.charWidth), 0);\r
+ }\r
\r
- if ( (group == null) && (groups.size() > 0))\r
- {\r
- group = (SequenceGroup) groups.elementAt(0);\r
- groupIndex = 0;\r
- }\r
+ g.translate(LABEL_WEST, 0);\r
\r
- if (group != null)\r
- {\r
- do\r
- {\r
- int oldY = -1;\r
- int i = 0;\r
- boolean inGroup = false;\r
- int top = -1;\r
- int bottom = -1;\r
-\r
- for (i = y1; i < y2; i++)\r
- {\r
- sx = (group.getStartRes() - startx) * av.charWidth;\r
- sy = offset +\r
- AlignmentUtil.getPixelHeight(starty, i, av.charHeight);\r
- ex = ( ( (group.getEndRes() + 1) - group.getStartRes()) *\r
- av.charWidth) -\r
- 1;\r
-\r
- if ( (sx < getWidth()) && (ex > 0) &&\r
- group.sequences.contains(av.alignment.getSequenceAt(\r
- i)))\r
- {\r
- if ( (bottom == -1) &&\r
- !group.sequences.contains(\r
- av.alignment.getSequenceAt(i + 1)))\r
+ if (av.scaleAboveWrapped)\r
{\r
- bottom = sy + av.charHeight;\r
+ drawNorthScale(g, startRes, endx, ypos);\r
}\r
\r
- if (!inGroup)\r
+ // When printing we have an extra clipped region,\r
+ // the Printable page which we need to account for here\r
+ Shape clip = g.getClip();\r
+\r
+ if (clip == null)\r
{\r
- if ( ( (top == -1) && (i == 0)) ||\r
- !group.sequences.contains(\r
- av.alignment.getSequenceAt(i - 1)))\r
- {\r
- top = sy;\r
- }\r
-\r
- oldY = sy;\r
- inGroup = true;\r
-\r
- if (group == av.getSelectionGroup())\r
- {\r
- g.setStroke(new BasicStroke(1,\r
- BasicStroke.CAP_BUTT,\r
- BasicStroke.JOIN_ROUND, 3f,\r
- new float[]\r
- {5f, 3f}, 0f));\r
- g.setColor(Color.RED);\r
- }\r
- else\r
- {\r
- g.setStroke(new BasicStroke());\r
- g.setColor(group.getOutlineColour());\r
- }\r
+ g.setClip(0, 0, cWidth * av.charWidth, canvasHeight);\r
}\r
- }\r
- else\r
- {\r
- if (inGroup)\r
+ else\r
{\r
- g.drawLine(sx, oldY, sx, sy);\r
- g.drawLine(sx + ex, oldY, sx + ex, sy);\r
-\r
- if (top != -1)\r
- {\r
- g.drawLine(sx, top, sx + ex, top);\r
- top = -1;\r
- }\r
-\r
- if (bottom != -1)\r
- {\r
- g.drawLine(sx, bottom, sx + ex, bottom);\r
- bottom = -1;\r
- }\r
-\r
- inGroup = false;\r
+ g.setClip(0, (int) clip.getBounds().getY(),\r
+ cWidth * av.charWidth, (int) clip.getBounds().getHeight());\r
+ }\r
+\r
+ drawPanel(g, startRes, endx, 0, al.getHeight(), startRes, 0, ypos);\r
+ g.setClip(clip);\r
+ g.translate(-LABEL_WEST, 0);\r
+\r
+ ypos += cHeight;\r
+ startRes += cWidth;\r
+ endx = (startRes + cWidth) - 1;\r
+\r
+ if (endx > al.getWidth())\r
+ {\r
+ endx = al.getWidth();\r
}\r
- }\r
}\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param g1 DOCUMENT ME!\r
+ * @param x1 DOCUMENT ME!\r
+ * @param x2 DOCUMENT ME!\r
+ * @param y1 DOCUMENT ME!\r
+ * @param y2 DOCUMENT ME!\r
+ * @param startx DOCUMENT ME!\r
+ * @param starty DOCUMENT ME!\r
+ * @param offset DOCUMENT ME!\r
+ */\r
+ synchronized public void drawPanel(Graphics g1, int x1, int x2, int y1,\r
+ int y2, int startx, int starty, int offset)\r
+ {\r
+ Graphics2D g = (Graphics2D) g1;\r
+ g.setFont(av.getFont());\r
+ sr.renderGaps(av.renderGaps);\r
\r
- if (inGroup)\r
+ SequenceI nextSeq;\r
+\r
+ /// First draw the sequences\r
+ /////////////////////////////\r
+ for (int i = y1; i < y2; i++)\r
{\r
- if (top != -1)\r
- {\r
- g.drawLine(sx, top, sx + ex, top);\r
- top = -1;\r
- }\r
-\r
- if (bottom != -1)\r
- {\r
- g.drawLine(sx, bottom - 1, sx + ex, bottom - 1);\r
- bottom = -1;\r
- }\r
-\r
- sy = offset +\r
- AlignmentUtil.getPixelHeight(starty, i, av.charHeight);\r
- g.drawLine(sx, oldY, sx, sy);\r
- g.drawLine(sx + ex, oldY, sx + ex, sy);\r
- inGroup = false;\r
+ nextSeq = av.alignment.getSequenceAt(i);\r
+\r
+ sr.drawSequence(g, nextSeq, av.alignment.findAllGroups(nextSeq),\r
+ x1, x2, (x1 - startx) * av.charWidth,\r
+ offset + ((i - starty) * av.charHeight), av.charWidth,\r
+ av.charHeight);\r
+\r
+ if (av.showSequenceFeatures)\r
+ {\r
+ fr.drawSequence(g, nextSeq,\r
+ av.alignment.findAllGroups(nextSeq), x1, x2,\r
+ (x1 - startx) * av.charWidth,\r
+ offset + ((i - starty) * av.charHeight), av.charWidth,\r
+ av.charHeight);\r
+ }\r
}\r
\r
- groupIndex++;\r
+ //\r
+ /////////////////////////////////////\r
+ // Now outline any areas if necessary\r
+ /////////////////////////////////////\r
+ SequenceGroup group = av.getSelectionGroup();\r
+ java.util.Vector groups = av.alignment.getGroups();\r
+\r
+ int sx = -1;\r
+ int sy = -1;\r
+ int ex = -1;\r
+ int groupIndex = -1;\r
\r
- if (groupIndex >= groups.size())\r
+ if ((group == null) && (groups.size() > 0))\r
{\r
- break;\r
+ group = (SequenceGroup) groups.elementAt(0);\r
+ groupIndex = 0;\r
}\r
\r
- group = (SequenceGroup) groups.elementAt(groupIndex);\r
- }\r
- while (groupIndex < groups.size());\r
- }\r
\r
- /// Highlight search Results once all sequences have been drawn\r
- //////////////////////////////////////////////////////////\r
- if (displaySearch)\r
- {\r
- for (int r = 0; r < searchResults.length; r += 3)\r
- {\r
- int searchSeq = searchResults[r];\r
+ if (group != null)\r
+ {\r
+ do\r
+ {\r
+ int oldY = -1;\r
+ int i = 0;\r
+ boolean inGroup = false;\r
+ int top = -1;\r
+ int bottom = -1;\r
+\r
+ for (i = y1; i < y2; i++)\r
+ {\r
+ sx = (group.getStartRes() - startx) * av.charWidth;\r
+ sy = offset + ((i - starty) * av.charHeight);\r
+ ex = (((group.getEndRes() + 1) - group.getStartRes()) * av.charWidth) -\r
+ 1;\r
+\r
+\r
+ if ((sx < (x2-x1)*av.charWidth) &&\r
+ group.sequences.contains(av.alignment.getSequenceAt(\r
+ i)))\r
+ {\r
+ if ((bottom == -1) &&\r
+ !group.sequences.contains(\r
+ av.alignment.getSequenceAt(i + 1)))\r
+ {\r
+ bottom = sy + av.charHeight;\r
+ }\r
+\r
+ if (!inGroup)\r
+ {\r
+ if (((top == -1) && (i == 0)) ||\r
+ !group.sequences.contains(\r
+ av.alignment.getSequenceAt(i - 1)))\r
+ {\r
+ top = sy;\r
+ }\r
+\r
+ oldY = sy;\r
+ inGroup = true;\r
+\r
+ if (group == av.getSelectionGroup())\r
+ {\r
+ g.setStroke(new BasicStroke(1,\r
+ BasicStroke.CAP_BUTT,\r
+ BasicStroke.JOIN_ROUND, 3f,\r
+ new float[] { 5f, 3f }, 0f));\r
+ g.setColor(Color.RED);\r
+ }\r
+ else\r
+ {\r
+ g.setStroke(new BasicStroke());\r
+ g.setColor(group.getOutlineColour());\r
+ }\r
+ }\r
+ }\r
+ else\r
+ {\r
+ if (inGroup)\r
+ {\r
+ g.drawLine(sx, oldY, sx, sy);\r
+ g.drawLine(sx + ex, oldY, sx + ex, sy);\r
+\r
+ if (top != -1)\r
+ {\r
+ g.drawLine(sx, top, sx + ex, top);\r
+ top = -1;\r
+ }\r
+\r
+ if (bottom != -1)\r
+ {\r
+ g.drawLine(sx, bottom, sx + ex, bottom);\r
+ bottom = -1;\r
+ }\r
+\r
+ inGroup = false;\r
+ }\r
+ }\r
+ }\r
+\r
+\r
+ if (inGroup)\r
+ {\r
+ if (top != -1)\r
+ {\r
+ g.drawLine(sx, top, sx + ex, top);\r
+ top = -1;\r
+ }\r
+\r
+ if (bottom != -1)\r
+ {\r
+ g.drawLine(sx, bottom - 1, sx + ex, bottom - 1);\r
+ bottom = -1;\r
+ }\r
+\r
+ sy = offset + ((i - starty) * av.charHeight);\r
+ g.drawLine(sx, oldY, sx, sy);\r
+ g.drawLine(sx + ex, oldY, sx + ex, sy);\r
+ inGroup = false;\r
+ }\r
+\r
+ groupIndex++;\r
+\r
+ if (groupIndex >= groups.size())\r
+ {\r
+ break;\r
+ }\r
+\r
+ group = (SequenceGroup) groups.elementAt(groupIndex);\r
+ }\r
+ while (groupIndex < groups.size());\r
+ }\r
\r
- if ( (searchSeq >= y1) && (searchSeq < y2))\r
+ /// Highlight search Results once all sequences have been drawn\r
+ //////////////////////////////////////////////////////////\r
+ if (displaySearch)\r
{\r
- SequenceI seq = av.getAlignment().getSequenceAt(searchSeq);\r
+ for (int r = 0; r < searchResults.length; r += 3)\r
+ {\r
+ int searchSeq = searchResults[r];\r
+\r
+ if ((searchSeq >= y1) && (searchSeq < y2))\r
+ {\r
+ SequenceI seq = av.getAlignment().getSequenceAt(searchSeq);\r
\r
- int searchStart = seq.findIndex(searchResults[r + 1]) - 1;\r
- int searchEnd = seq.findIndex(searchResults[r + 2]) - 1;\r
+ int searchStart = seq.findIndex(searchResults[r + 1]) - 1;\r
+ int searchEnd = seq.findIndex(searchResults[r + 2]) - 1;\r
\r
- SequenceRenderer ssr = (SequenceRenderer) sr;\r
+ SequenceRenderer ssr = (SequenceRenderer) sr;\r
\r
- if (searchStart < x1)\r
- {\r
- searchStart = x1;\r
- }\r
+ if (searchStart < x1)\r
+ {\r
+ searchStart = x1;\r
+ }\r
\r
- if (searchEnd > x2)\r
- {\r
- searchEnd = x2;\r
- }\r
+ if (searchEnd > x2)\r
+ {\r
+ searchEnd = x2;\r
+ }\r
\r
- ssr.drawHighlightedText(seq, searchStart, searchEnd,\r
- (searchStart - startx) * av.charWidth,\r
- offset +\r
- AlignmentUtil.getPixelHeight(starty,\r
- searchSeq,\r
- av.charHeight), av.charWidth, av.charHeight);\r
+ ssr.drawHighlightedText(seq, searchStart, searchEnd,\r
+ (searchStart - startx) * av.charWidth,\r
+ offset + ((searchSeq - starty) * av.charHeight),\r
+ av.charWidth, av.charHeight);\r
+ }\r
+ }\r
}\r
- }\r
}\r
- }\r
\r
- public void highlightSearchResults(int[] results)\r
- {\r
- // results are in the order sequence, startRes, endRes\r
- if (results == null)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param results DOCUMENT ME!\r
+ */\r
+ public void highlightSearchResults(int[] results)\r
{\r
- displaySearch = false;\r
- }\r
- else\r
- {\r
- displaySearch = true;\r
- }\r
+ // results are in the order sequence, startRes, endRes\r
+ if (results == null)\r
+ {\r
+ displaySearch = false;\r
+ }\r
+ else\r
+ {\r
+ displaySearch = true;\r
+ }\r
\r
- searchResults = results;\r
+ searchResults = results;\r
\r
- repaint();\r
- }\r
+ repaint();\r
+ }\r
}\r
*/\r
package jalview.gui;\r
\r
-import java.util.*;\r
+import jalview.analysis.*;\r
+\r
+import jalview.datamodel.*;\r
+\r
+import jalview.schemes.*;\r
\r
import java.awt.*;\r
import java.awt.event.*;\r
+\r
+import java.util.*;\r
+\r
import javax.swing.*;\r
\r
-import jalview.analysis.*;\r
-import jalview.datamodel.*;\r
-import jalview.schemes.*;\r
\r
-public class SeqPanel\r
- extends JPanel\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class SeqPanel extends JPanel\r
{\r
- public SeqCanvas seqCanvas;\r
- public AlignmentPanel ap;\r
- protected int lastres;\r
- protected int startseq;\r
- int startEdit = -1;\r
- int endEdit = -1;\r
- protected AlignViewport av;\r
-\r
- // if character is inserted or deleted, we will need to recalculate the conservation\r
- int seqEditOccurred = -1;\r
- ScrollThread scrollThread = null;\r
- boolean mouseDragging = false;\r
- boolean editingSeqs = false;\r
- boolean groupEditing = false;\r
-\r
- //////////////////////////////////////////\r
- /////Everything below this is for defining the boundary of the rubberband\r
- //////////////////////////////////////////\r
- int oldSeq = -1;\r
- boolean changeEndSeq = false;\r
- boolean changeStartSeq = false;\r
- boolean changeEndRes = false;\r
- boolean changeStartRes = false;\r
- SequenceGroup stretchGroup = null;\r
- boolean remove = false;\r
-\r
- public SeqPanel(AlignViewport avp, AlignmentPanel p)\r
- {\r
- ToolTipManager.sharedInstance().registerComponent(this);\r
- ToolTipManager.sharedInstance().setInitialDelay(0);\r
- ToolTipManager.sharedInstance().setDismissDelay(10000);\r
- this.av = avp;\r
- setBackground(Color.white);\r
-\r
- seqCanvas = new SeqCanvas(avp);\r
- setLayout(new BorderLayout());\r
- add(seqCanvas, BorderLayout.CENTER);\r
-\r
- ap = p;\r
-\r
- addMouseMotionListener(new MouseMotionAdapter()\r
- {\r
- public void mouseMoved(MouseEvent evt)\r
- {\r
- if (av.getWrapAlignment())\r
+ /** DOCUMENT ME!! */\r
+ public SeqCanvas seqCanvas;\r
+\r
+ /** DOCUMENT ME!! */\r
+ public AlignmentPanel ap;\r
+ protected int lastres;\r
+ protected int startseq;\r
+ int startEdit = -1;\r
+ int endEdit = -1;\r
+ protected AlignViewport av;\r
+\r
+ // if character is inserted or deleted, we will need to recalculate the conservation\r
+ int seqEditOccurred = -1;\r
+ ScrollThread scrollThread = null;\r
+ boolean mouseDragging = false;\r
+ boolean editingSeqs = false;\r
+ boolean groupEditing = false;\r
+\r
+ //////////////////////////////////////////\r
+ /////Everything below this is for defining the boundary of the rubberband\r
+ //////////////////////////////////////////\r
+ int oldSeq = -1;\r
+ boolean changeEndSeq = false;\r
+ boolean changeStartSeq = false;\r
+ boolean changeEndRes = false;\r
+ boolean changeStartRes = false;\r
+ SequenceGroup stretchGroup = null;\r
+ boolean remove = false;\r
+\r
+ /**\r
+ * Creates a new SeqPanel object.\r
+ *\r
+ * @param avp DOCUMENT ME!\r
+ * @param p DOCUMENT ME!\r
+ */\r
+ public SeqPanel(AlignViewport avp, AlignmentPanel p)\r
+ {\r
+ ToolTipManager.sharedInstance().registerComponent(this);\r
+ ToolTipManager.sharedInstance().setInitialDelay(0);\r
+ ToolTipManager.sharedInstance().setDismissDelay(10000);\r
+ this.av = avp;\r
+ setBackground(Color.white);\r
+\r
+ seqCanvas = new SeqCanvas(avp);\r
+ setLayout(new BorderLayout());\r
+ add(seqCanvas, BorderLayout.CENTER);\r
+\r
+ ap = p;\r
+\r
+ addMouseMotionListener(new MouseMotionAdapter()\r
+ {\r
+ public void mouseMoved(MouseEvent evt)\r
+ {\r
+ if (av.getWrapAlignment())\r
+ {\r
+ return;\r
+ }\r
+\r
+ doMouseMoved(evt);\r
+ }\r
+\r
+ public void mouseDragged(MouseEvent evt)\r
+ {\r
+ if (av.getWrapAlignment())\r
+ {\r
+ return;\r
+ }\r
+\r
+ if (editingSeqs)\r
+ {\r
+ doMouseDragged(evt);\r
+ }\r
+ else\r
+ {\r
+ doMouseDraggedDefineMode(evt);\r
+ }\r
+ }\r
+ });\r
+\r
+ addMouseListener(new MouseAdapter()\r
+ {\r
+ public void mouseReleased(MouseEvent evt)\r
+ {\r
+ if (av.getWrapAlignment())\r
+ {\r
+ return;\r
+ }\r
+\r
+ if (editingSeqs)\r
+ {\r
+ doMouseReleased(evt);\r
+ }\r
+ else\r
+ {\r
+ doMouseReleasedDefineMode(evt);\r
+ }\r
+ }\r
+\r
+ public void mousePressed(MouseEvent evt)\r
+ {\r
+ if (av.getWrapAlignment())\r
+ {\r
+ return;\r
+ }\r
+\r
+ if (evt.isShiftDown() || evt.isAltDown() ||\r
+ evt.isControlDown())\r
+ {\r
+ if (evt.isAltDown() || evt.isControlDown())\r
+ {\r
+ groupEditing = true;\r
+ }\r
+\r
+ editingSeqs = true;\r
+ doMousePressed(evt);\r
+ }\r
+ else\r
+ {\r
+ doMousePressedDefineMode(evt);\r
+ }\r
+ }\r
+\r
+ public void mouseExited(MouseEvent evt)\r
+ {\r
+ if (av.getWrapAlignment() || editingSeqs)\r
+ {\r
+ return;\r
+ }\r
+\r
+ doMouseExitedDefineMode(evt);\r
+ }\r
+\r
+ public void mouseEntered(MouseEvent evt)\r
+ {\r
+ if (av.getWrapAlignment() || editingSeqs)\r
+ {\r
+ return;\r
+ }\r
+\r
+ doMouseEnteredDefineMode(evt);\r
+ }\r
+ });\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ */\r
+ public void doMouseReleased(MouseEvent evt)\r
+ {\r
+ if (seqEditOccurred > -1)\r
{\r
- return;\r
+ editOccurred(seqEditOccurred);\r
}\r
\r
- doMouseMoved(evt);\r
- }\r
+ startseq = -1;\r
+ lastres = -1;\r
+ seqEditOccurred = -1;\r
+ editingSeqs = false;\r
+ groupEditing = false;\r
\r
- public void mouseDragged(MouseEvent evt)\r
- {\r
- if (av.getWrapAlignment())\r
- {\r
- return;\r
- }\r
+ ap.repaint();\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ */\r
+ public void doMousePressed(MouseEvent evt)\r
+ {\r
+ ap.alignFrame.addHistoryItem(new HistoryItem("Edit Sequence",\r
+ av.alignment, HistoryItem.EDIT));\r
+\r
+ int seq;\r
+ int res;\r
+\r
+ int x = evt.getX();\r
+ int y = evt.getY();\r
\r
- if (editingSeqs)\r
+ res = (x / av.getCharWidth()) + av.getStartRes();\r
+ seq = (y / av.getCharHeight()) + av.getStartSeq();\r
+\r
+ if ((seq < av.getAlignment().getHeight()) &&\r
+ (res < av.getAlignment().getSequenceAt(seq).getLength()))\r
{\r
- doMouseDragged(evt);\r
+ startseq = seq;\r
+ lastres = res;\r
}\r
else\r
{\r
- doMouseDraggedDefineMode(evt);\r
+ startseq = -1;\r
+ lastres = -1;\r
}\r
- }\r
- });\r
\r
- addMouseListener(new MouseAdapter()\r
+ startEdit = lastres;\r
+ endEdit = lastres;\r
+\r
+ return;\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ */\r
+ public void doMouseMoved(MouseEvent evt)\r
{\r
- public void mouseReleased(MouseEvent evt)\r
- {\r
- if (av.getWrapAlignment())\r
- {\r
- return;\r
- }\r
+ int res = 0;\r
+ int seq = 0;\r
+ int x = evt.getX();\r
+ int y = evt.getY();\r
\r
- if (editingSeqs)\r
+ if (av.wrapAlignment)\r
{\r
- doMouseReleased(evt);\r
- }\r
- else\r
- {\r
- doMouseReleasedDefineMode(evt);\r
- }\r
- }\r
+ y -= (2 * av.charHeight);\r
\r
- public void mousePressed(MouseEvent evt)\r
- {\r
- if (av.getWrapAlignment())\r
- {\r
- return;\r
- }\r
+ int chunkHeight = (av.getAlignment().getHeight() + 2) * av.charHeight;\r
\r
- if (evt.isShiftDown() || evt.isAltDown() ||\r
- evt.isControlDown())\r
- {\r
- if (evt.isAltDown() || evt.isControlDown())\r
- {\r
- groupEditing = true;\r
- }\r
+ res = (int) ((y / chunkHeight) * (getWidth() / av.charWidth)) +\r
+ (x / av.getCharWidth()) + av.getStartRes();\r
\r
- editingSeqs = true;\r
- doMousePressed(evt);\r
+ y %= chunkHeight;\r
+ seq = (y / av.getCharHeight()) + av.getStartSeq();\r
}\r
else\r
{\r
- doMousePressedDefineMode(evt);\r
+ res = (x / av.getCharWidth()) + av.getStartRes();\r
+ seq = (y / av.getCharHeight()) + av.getStartSeq();\r
}\r
- }\r
\r
- public void mouseExited(MouseEvent evt)\r
- {\r
- if (av.getWrapAlignment() || editingSeqs)\r
+ if (seq >= av.getAlignment().getHeight())\r
{\r
- return;\r
+ return;\r
}\r
\r
- doMouseExitedDefineMode(evt);\r
- }\r
+ SequenceI sequence = av.getAlignment().getSequenceAt(seq);\r
\r
- public void mouseEntered(MouseEvent evt)\r
- {\r
- if (av.getWrapAlignment() || editingSeqs)\r
+ if (res > sequence.getLength())\r
{\r
- return;\r
+ return;\r
}\r
\r
- doMouseEnteredDefineMode(evt);\r
- }\r
- });\r
- }\r
-\r
-\r
- public void doMouseReleased(MouseEvent evt)\r
- {\r
- if (seqEditOccurred > -1)\r
- {\r
- editOccurred(seqEditOccurred);\r
- }\r
+ Object obj = ResidueProperties.aa2Triplet.get(sequence.getCharAt(res) +\r
+ "");\r
+ String aa = "";\r
\r
- startseq = -1;\r
- lastres = -1;\r
- seqEditOccurred = -1;\r
- editingSeqs = false;\r
- groupEditing = false;\r
+ if (obj != null)\r
+ {\r
+ aa = obj.toString();\r
+ }\r
\r
- ap.repaint();\r
- }\r
+ StringBuffer text = new StringBuffer("Sequence " + (seq + 1) + " ID: " +\r
+ sequence.getName());\r
\r
- public void doMousePressed(MouseEvent evt)\r
- {\r
- ap.alignFrame.addHistoryItem(new HistoryItem("Edit Sequence",\r
- av.alignment, HistoryItem.EDIT));\r
+ if (aa != "")\r
+ {\r
+ text.append(" Residue: " + aa + " (" +\r
+ av.getAlignment().getSequenceAt(seq).findPosition(res) + ")");\r
+ }\r
\r
- int seq;\r
- int res;\r
+ ap.alignFrame.statusBar.setText(text.toString());\r
\r
- int x = evt.getX();\r
- int y = evt.getY();\r
+ // use aa to see if the mouse pointer is on a\r
+ if (av.showSequenceFeatures)\r
+ {\r
+ Vector features = sequence.getSequenceFeatures();\r
+ Enumeration e = features.elements();\r
+ StringBuffer sbuffer = new StringBuffer();\r
\r
- res = (x / av.getCharWidth()) + av.getStartRes();\r
- seq = (y / av.getCharHeight()) + av.getStartSeq();\r
+ while (e.hasMoreElements())\r
+ {\r
+ SequenceFeature sf = (SequenceFeature) e.nextElement();\r
+\r
+ if ((sf.getStart() <= sequence.findPosition(res)) &&\r
+ (sf.getEnd() >= sequence.findPosition(res)))\r
+ {\r
+ if (sbuffer.length() > 0)\r
+ {\r
+ sbuffer.append("; ");\r
+ }\r
+\r
+ sbuffer.append(sf.getType() + " " + sf.getDescription());\r
+\r
+ if (sf.getStatus().length() > 0)\r
+ {\r
+ sbuffer.append(" (" + sf.getStatus() + ")");\r
+ }\r
+ }\r
+ }\r
\r
- if ( (seq < av.getAlignment().getHeight()) &&\r
- (res < av.getAlignment().getSequenceAt(seq).getLength()))\r
- {\r
- startseq = seq;\r
- lastres = res;\r
- }\r
- else\r
- {\r
- startseq = -1;\r
- lastres = -1;\r
+ this.setToolTipText(sbuffer.toString());\r
+ }\r
}\r
\r
- startEdit = lastres;\r
- endEdit = lastres;\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ */\r
+ public void doMouseDragged(MouseEvent evt)\r
+ {\r
+ // If we're dragging we're editing\r
+ int res = (evt.getX() / av.getCharWidth()) + av.getStartRes();\r
\r
- return;\r
- }\r
+ if (res < 0)\r
+ {\r
+ res = 0;\r
+ }\r
\r
- public void doMouseMoved(MouseEvent evt)\r
- {\r
- int res = 0;\r
- int seq = 0;\r
- int x = evt.getX();\r
- int y = evt.getY();\r
+ if ((lastres == -1) || (lastres == res))\r
+ {\r
+ return;\r
+ }\r
\r
- if (av.wrapAlignment)\r
- {\r
- y -= (2 * av.charHeight);\r
+ boolean dragRight = true;\r
\r
- int chunkHeight = (av.getAlignment().getHeight() + 2) * av.charHeight;\r
+ if ((res < av.getAlignment().getWidth()) && (res < lastres))\r
+ {\r
+ dragRight = false;\r
+ }\r
\r
- res = (int) ( (y / chunkHeight) * (getWidth() / av.charWidth)) +\r
- (x / av.getCharWidth()) + av.getStartRes();\r
+ if (res != lastres)\r
+ {\r
+ // Group editing\r
+ if (groupEditing)\r
+ {\r
+ SequenceGroup sg = av.getSelectionGroup();\r
+\r
+ if (sg == null)\r
+ {\r
+ lastres = -1;\r
+\r
+ return;\r
+ }\r
+\r
+ // drag to right\r
+ if (dragRight)\r
+ {\r
+ sg.setEndRes(sg.getEndRes() + (res - lastres));\r
+ }\r
+\r
+ // drag to left\r
+ else\r
+ {\r
+ /// Are we able to delete?\r
+ // ie are all columns blank?\r
+ boolean deleteAllowed = false;\r
+\r
+ for (int s = 0; s < sg.getSize(); s++)\r
+ {\r
+ SequenceI seq = sg.getSequenceAt(s);\r
+\r
+ for (int j = res; j < lastres; j++)\r
+ {\r
+ if (seq.getSequence().length() <= j)\r
+ {\r
+ continue;\r
+ }\r
+\r
+ if (!jalview.util.Comparison.isGap(\r
+ seq.getSequence().charAt(j)))\r
+ {\r
+ // Not a gap, block edit not valid\r
+ res = j + 1;\r
+ deleteAllowed = false;\r
+\r
+ continue;\r
+ }\r
+\r
+ deleteAllowed = true;\r
+ }\r
+ }\r
+\r
+ if (!deleteAllowed)\r
+ {\r
+ lastres = -1;\r
+\r
+ return;\r
+ }\r
+\r
+ sg.setEndRes(sg.getEndRes() - (lastres - res));\r
+ }\r
+\r
+ for (int i = 0; i < sg.getSize(); i++)\r
+ {\r
+ SequenceI s = sg.getSequenceAt(i);\r
+ int k = av.alignment.findIndex(s);\r
+\r
+ // drag to right\r
+ if (dragRight)\r
+ {\r
+ for (int j = lastres; j < res; j++)\r
+ {\r
+ insertChar(j, k);\r
+ }\r
+ }\r
+\r
+ // drag to left\r
+ else\r
+ {\r
+ for (int j = res; j < lastres; j++)\r
+ {\r
+ if (s.getLength() > j)\r
+ {\r
+ deleteChar(res, k);\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+ else /////Editing a single sequence///////////\r
+ {\r
+ if ((res < av.getAlignment().getWidth()) && (res > lastres))\r
+ {\r
+ // dragging to the right\r
+ for (int j = lastres; j < res; j++)\r
+ {\r
+ insertChar(j, startseq);\r
+ }\r
+ }\r
+ else if ((res < av.getAlignment().getWidth()) &&\r
+ (res < lastres))\r
+ {\r
+ // dragging to the left\r
+ for (int j = lastres; j > res; j--)\r
+ {\r
+ if (jalview.util.Comparison.isGap(\r
+ av.alignment.getSequenceAt(startseq)\r
+ .getSequence().charAt(res)))\r
+ {\r
+ deleteChar(res, startseq);\r
+ }\r
+ else\r
+ {\r
+ break;\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
\r
- y %= chunkHeight;\r
- seq = (y / av.getCharHeight()) + av.getStartSeq();\r
- }\r
- else\r
- {\r
- res = (x / av.getCharWidth()) + av.getStartRes();\r
- seq = (y / av.getCharHeight()) + av.getStartSeq();\r
+ endEdit = res;\r
+ lastres = res;\r
+ seqCanvas.repaint();\r
}\r
\r
- if (seq >= av.getAlignment().getHeight())\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param seqstart DOCUMENT ME!\r
+ * @param seqend DOCUMENT ME!\r
+ * @param start DOCUMENT ME!\r
+ */\r
+ public void drawChars(int seqstart, int seqend, int start)\r
{\r
- return;\r
+ seqCanvas.drawPanel(seqCanvas.gg, start, av.getEndRes(), seqstart,\r
+ seqend, av.getStartRes(), av.getStartSeq(), 0);\r
+ seqCanvas.repaint();\r
}\r
\r
- SequenceI sequence = av.getAlignment().getSequenceAt(seq);\r
-\r
- if (res > sequence.getLength())\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param j DOCUMENT ME!\r
+ * @param seq DOCUMENT ME!\r
+ */\r
+ public void insertChar(int j, int seq)\r
{\r
- return;\r
+ av.alignment.getSequenceAt(seq).insertCharAt(j, av.getGapCharacter());\r
+ seqEditOccurred = seq;\r
}\r
\r
- Object obj = ResidueProperties.aa2Triplet.get(sequence.getCharAt(res) +\r
- "");\r
- String aa = "";\r
-\r
- if (obj != null)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param j DOCUMENT ME!\r
+ * @param seq DOCUMENT ME!\r
+ */\r
+ public void deleteChar(int j, int seq)\r
{\r
- aa = obj.toString();\r
- }\r
+ av.alignment.getSequenceAt(seq).deleteCharAt(j);\r
+ seqEditOccurred = seq;\r
\r
- StringBuffer text = new StringBuffer("Sequence " + (seq + 1) + " ID: " +\r
- sequence.getName());\r
-\r
- if (aa != "")\r
- {\r
- text.append(" Residue: " + aa + " (" +\r
- av.getAlignment().getSequenceAt(seq).findPosition(res) + ")");\r
+ av.alignment.getWidth();\r
+ seqCanvas.repaint();\r
}\r
\r
- ap.alignFrame.statusBar.setText(text.toString());\r
-\r
- // use aa to see if the mouse pointer is on a\r
- if (av.showSequenceFeatures)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param i DOCUMENT ME!\r
+ */\r
+ void editOccurred(int i)\r
{\r
- Vector features = sequence.getSequenceFeatures();\r
- Enumeration e = features.elements();\r
- StringBuffer sbuffer = new StringBuffer();\r
-\r
- while (e.hasMoreElements())\r
- {\r
- SequenceFeature sf = (SequenceFeature) e.nextElement();\r
-\r
- if ( (sf.getStart() <= sequence.findPosition(res)) &&\r
- (sf.getEnd() >= sequence.findPosition(res)))\r
+ if (endEdit == startEdit)\r
{\r
- if (sbuffer.length() > 0)\r
- {\r
- sbuffer.append("; ");\r
- }\r
-\r
- sbuffer.append(sf.getType() + " " + sf.getDescription());\r
-\r
- if (sf.getStatus().length() > 0)\r
- {\r
- sbuffer.append(" (" + sf.getStatus() + ")");\r
- }\r
+ ap.alignFrame.historyList.pop();\r
+ ap.alignFrame.updateEditMenuBar();\r
}\r
- }\r
-\r
- this.setToolTipText(sbuffer.toString());\r
- }\r
- }\r
\r
- public void doMouseDragged(MouseEvent evt)\r
- {\r
- // If we're dragging we're editing\r
- int res = (evt.getX() / av.getCharWidth()) + av.getStartRes();\r
-\r
- if (res < 0)\r
- {\r
- res = 0;\r
- }\r
-\r
- if ( (lastres == -1) || (lastres == res))\r
- {\r
- return;\r
- }\r
+ av.updateConservation();\r
+ av.updateConsensus();\r
\r
- boolean dragRight = true;\r
+ // Y O Y CLUSTALX\r
+ ColourSchemeI cs = av.getGlobalColourScheme();\r
\r
- if ( (res < av.getAlignment().getWidth()) && (res < lastres))\r
- {\r
- dragRight = false;\r
- }\r
-\r
- if (res != lastres)\r
- {\r
- // Group editing\r
- if (groupEditing)\r
- {\r
- SequenceGroup sg = av.getSelectionGroup();\r
-\r
- if (sg == null)\r
+ if (av.getSelectionGroup() != null)\r
{\r
- lastres = -1;\r
-\r
- return;\r
+ av.getSelectionGroup().recalcConservation();\r
}\r
\r
- // drag to right\r
- if (dragRight)\r
+ if (cs instanceof ConservationColourScheme)\r
{\r
- sg.setEndRes(sg.getEndRes() + (res - lastres));\r
+ ConservationColourScheme ccs = (ConservationColourScheme) cs;\r
+ Conservation c = new Conservation("All",\r
+ ResidueProperties.propHash, 3, av.alignment.getSequences(),\r
+ 0, av.alignment.getWidth() - 1);\r
+ c.calculate();\r
+ c.verdict(false, av.ConsPercGaps);\r
+\r
+ if (ccs.cs instanceof ClustalxColourScheme)\r
+ {\r
+ ClustalxColourScheme cxs = (ClustalxColourScheme) ccs.cs;\r
+ cxs.resetClustalX(av.alignment.getSequences(),\r
+ av.alignment.getWidth());\r
+ ccs = new ConservationColourScheme(c, cxs);\r
+ av.setGlobalColourScheme(ccs);\r
+ }\r
+ else\r
+ {\r
+ ccs = new ConservationColourScheme(c, ccs.cs);\r
+ av.setGlobalColourScheme(ccs);\r
+ }\r
}\r
- // drag to left\r
- else\r
- {\r
- /// Are we able to delete?\r
- // ie are all columns blank?\r
- boolean deleteAllowed = false;\r
\r
- for (int s = 0; s < sg.getSize(); s++)\r
- {\r
- SequenceI seq = sg.getSequenceAt(s);\r
+ if (cs instanceof ClustalxColourScheme)\r
+ {\r
+ ((ClustalxColourScheme) cs).resetClustalX(av.alignment.getSequences(),\r
+ av.alignment.getWidth());\r
+ av.setGlobalColourScheme(cs);\r
+ }\r
+ }\r
\r
- for (int j = res; j < lastres; j++)\r
- {\r
- if (seq.getSequence().length() <= j)\r
- {\r
- continue;\r
- }\r
-\r
- if (!jalview.util.Comparison.isGap(\r
- seq.getSequence().charAt(j)))\r
- {\r
- // Not a gap, block edit not valid\r
- res = j + 1;\r
- deleteAllowed = false;\r
-\r
- continue;\r
- }\r
-\r
- deleteAllowed = true;\r
- }\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ */\r
+ public void doMousePressedDefineMode(MouseEvent evt)\r
+ {\r
+ int res = (evt.getX() / av.getCharWidth()) + av.getStartRes();\r
+ int seq = (evt.getY() / av.getCharHeight()) + av.getStartSeq();\r
+ oldSeq = seq;\r
\r
- if (!deleteAllowed)\r
- {\r
- lastres = -1;\r
+ SequenceI sequence = (Sequence) av.getAlignment().getSequenceAt(seq);\r
\r
+ if ((sequence == null) || (res > sequence.getLength()))\r
+ {\r
return;\r
- }\r
-\r
- sg.setEndRes(sg.getEndRes() - (lastres - res));\r
}\r
\r
- for (int i = 0; i < sg.getSize(); i++)\r
+ stretchGroup = av.getSelectionGroup();\r
+\r
+ if (stretchGroup == null)\r
{\r
- SequenceI s = sg.getSequenceAt(i);\r
- int k = av.alignment.findIndex(s);\r
+ stretchGroup = av.alignment.findGroup(sequence);\r
\r
- // drag to right\r
- if (dragRight)\r
- {\r
- for (int j = lastres; j < res; j++)\r
- {\r
- insertChar(j, k);\r
- }\r
- }\r
- // drag to left\r
- else\r
- {\r
- for (int j = res; j < lastres; j++)\r
+ if ((stretchGroup != null) && (res > stretchGroup.getStartRes()) &&\r
+ (res < stretchGroup.getEndRes()))\r
{\r
- if (s.getLength() > j)\r
- {\r
- deleteChar(res, k);\r
- }\r
- }\r
- }\r
- }\r
- }\r
- else /////Editing a single sequence///////////\r
- {\r
- if ( (res < av.getAlignment().getWidth()) && (res > lastres))\r
- {\r
- // dragging to the right\r
- for (int j = lastres; j < res; j++)\r
- {\r
- insertChar(j, startseq);\r
- }\r
- }\r
- else if ( (res < av.getAlignment().getWidth()) &&\r
- (res < lastres))\r
- {\r
- // dragging to the left\r
- for (int j = lastres; j > res; j--)\r
- {\r
- if (jalview.util.Comparison.isGap(\r
- av.alignment.getSequenceAt(startseq)\r
- .getSequence().charAt(res)))\r
- {\r
- deleteChar(res, startseq);\r
+ av.setSelectionGroup(stretchGroup);\r
}\r
else\r
{\r
- break;\r
+ stretchGroup = null;\r
}\r
- }\r
}\r
- }\r
- }\r
-\r
- endEdit = res;\r
- lastres = res;\r
- seqCanvas.repaint();\r
- }\r
-\r
- public void drawChars(int seqstart, int seqend, int start)\r
- {\r
- seqCanvas.drawPanel(seqCanvas.gg, start, av.getEndRes(), seqstart,\r
- seqend, av.getStartRes(), av.getStartSeq(), 0);\r
- seqCanvas.repaint();\r
- }\r
-\r
- public void insertChar(int j, int seq)\r
- {\r
- av.alignment.getSequenceAt(seq).insertCharAt(j, av.getGapCharacter());\r
- seqEditOccurred = seq;\r
- }\r
-\r
- public void deleteChar(int j, int seq)\r
- {\r
- av.alignment.getSequenceAt(seq).deleteCharAt(j);\r
- seqEditOccurred = seq;\r
-\r
- av.alignment.getWidth();\r
- seqCanvas.repaint();\r
- }\r
-\r
- void editOccurred(int i)\r
- {\r
- if (endEdit == startEdit)\r
- {\r
- ap.alignFrame.historyList.pop();\r
- ap.alignFrame.updateEditMenuBar();\r
- }\r
-\r
- av.updateConservation();\r
- av.updateConsensus();\r
-\r
- // Y O Y CLUSTALX\r
- ColourSchemeI cs = av.getGlobalColourScheme();\r
-\r
- if(av.getSelectionGroup()!=null)\r
- av.getSelectionGroup().recalcConservation();\r
-\r
-\r
- if (cs instanceof ConservationColourScheme)\r
- {\r
- ConservationColourScheme ccs = (ConservationColourScheme) cs;\r
- Conservation c = new Conservation("All",\r
- ResidueProperties.propHash, 3,\r
- av.alignment.getSequences(), 0,\r
- av.alignment.getWidth() - 1);\r
- c.calculate();\r
- c.verdict(false, av.ConsPercGaps);\r
-\r
- if (ccs.cs instanceof ClustalxColourScheme)\r
- {\r
-\r
- ClustalxColourScheme cxs = (ClustalxColourScheme) ccs.cs;\r
- cxs.resetClustalX(av.alignment.getSequences(),\r
- av.alignment.getWidth());\r
- ccs = new ConservationColourScheme(c, cxs);\r
- av.setGlobalColourScheme(ccs);\r
- }\r
- else\r
- {\r
- ccs = new ConservationColourScheme(c, ccs.cs);\r
- av.setGlobalColourScheme(ccs);\r
- }\r
- }\r
-\r
- if (cs instanceof ClustalxColourScheme)\r
- {\r
- ( (ClustalxColourScheme) cs).resetClustalX(av.alignment.getSequences(),\r
- av.alignment.getWidth());\r
- av.setGlobalColourScheme(cs);\r
- }\r
- }\r
-\r
- public void doMousePressedDefineMode(MouseEvent evt)\r
- {\r
- int res = (evt.getX() / av.getCharWidth()) + av.getStartRes();\r
- int seq = (evt.getY() / av.getCharHeight()) + av.getStartSeq();\r
- oldSeq = seq;\r
+ else if (!stretchGroup.sequences.contains(sequence) ||\r
+ (stretchGroup.getStartRes() > res) ||\r
+ (stretchGroup.getEndRes() < res))\r
+ {\r
+ stretchGroup = null;\r
\r
- SequenceI sequence = (Sequence) av.getAlignment().getSequenceAt(seq);\r
+ SequenceGroup[] allGroups = av.alignment.findAllGroups(sequence);\r
\r
- if ( (sequence == null) || (res > sequence.getLength()))\r
- {\r
- return;\r
- }\r
+ if (allGroups != null)\r
+ {\r
+ for (int i = 0; i < allGroups.length; i++)\r
+ {\r
+ if ((allGroups[i].getStartRes() <= res) &&\r
+ (allGroups[i].getEndRes() >= res))\r
+ {\r
+ stretchGroup = allGroups[i];\r
+ av.setSelectionGroup(stretchGroup);\r
+\r
+ break;\r
+ }\r
+ }\r
+ }\r
+ }\r
\r
- stretchGroup = av.getSelectionGroup();\r
+ if (stretchGroup == null)\r
+ {\r
+ // define a new group here\r
+ SequenceGroup sg = new SequenceGroup();\r
+ sg.setStartRes(res);\r
+ sg.setEndRes(res);\r
+ sg.addSequence(sequence, false);\r
+ av.setSelectionGroup(sg);\r
+ stretchGroup = sg;\r
+\r
+ if (av.getConservationSelected())\r
+ {\r
+ SliderPanel.setConservationSlider(ap,\r
+ av.getGlobalColourScheme(), "Background");\r
+ }\r
\r
- if (stretchGroup == null)\r
- {\r
- stretchGroup = av.alignment.findGroup(sequence);\r
-\r
- if ( (stretchGroup != null) && (res > stretchGroup.getStartRes()) &&\r
- (res < stretchGroup.getEndRes()))\r
- {\r
- av.setSelectionGroup(stretchGroup);\r
- }\r
- else\r
- {\r
- stretchGroup = null;\r
- }\r
- }\r
- else if (!stretchGroup.sequences.contains(sequence) ||\r
- (stretchGroup.getStartRes() > res) ||\r
- (stretchGroup.getEndRes() < res))\r
- {\r
- stretchGroup = null;\r
+ if (av.getAbovePIDThreshold())\r
+ {\r
+ SliderPanel.setPIDSliderSource(ap, av.getGlobalColourScheme(),\r
+ "Background");\r
+ }\r
+ }\r
+ else if (javax.swing.SwingUtilities.isRightMouseButton(evt))\r
+ {\r
+ jalview.gui.PopupMenu pop = new jalview.gui.PopupMenu(ap, null);\r
+ pop.show(this, evt.getX(), evt.getY());\r
\r
- SequenceGroup[] allGroups = av.alignment.findAllGroups(sequence);\r
+ // edit the properties of existing group\r
+ }\r
\r
- if (allGroups != null)\r
- {\r
- for (int i = 0; i < allGroups.length; i++)\r
+ if ((stretchGroup != null) && (stretchGroup.getEndRes() == res))\r
{\r
- if ( (allGroups[i].getStartRes() <= res) &&\r
- (allGroups[i].getEndRes() >= res))\r
- {\r
- stretchGroup = allGroups[i];\r
- av.setSelectionGroup(stretchGroup);\r
-\r
- break;\r
- }\r
+ // Edit end res position of selected group\r
+ changeEndRes = true;\r
+ }\r
+ else if ((stretchGroup != null) && (stretchGroup.getStartRes() == res))\r
+ {\r
+ // Edit end res position of selected group\r
+ changeStartRes = true;\r
}\r
- }\r
- }\r
\r
- if (stretchGroup == null)\r
- {\r
- // define a new group here\r
- SequenceGroup sg = new SequenceGroup();\r
- sg.setStartRes(res);\r
- sg.setEndRes(res);\r
- sg.addSequence(sequence, false);\r
- av.setSelectionGroup(sg);\r
- stretchGroup = sg;\r
-\r
- if (av.getConservationSelected())\r
- {\r
- SliderPanel.setConservationSlider(ap,\r
- av.getGlobalColourScheme(),\r
- "Background");\r
- }\r
-\r
- if (av.getAbovePIDThreshold())\r
- {\r
- SliderPanel.setPIDSliderSource(ap, av.getGlobalColourScheme(),\r
- "Background");\r
- }\r
- }\r
- else if (javax.swing.SwingUtilities.isRightMouseButton(evt))\r
- {\r
- jalview.gui.PopupMenu pop = new jalview.gui.PopupMenu(ap, null);\r
- pop.show(this, evt.getX(), evt.getY());\r
+ stretchGroup.getWidth();\r
\r
- // edit the properties of existing group\r
+ seqCanvas.repaint();\r
}\r
\r
- if ( (stretchGroup != null) && (stretchGroup.getEndRes() == res))\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ */\r
+ public void doMouseReleasedDefineMode(MouseEvent evt)\r
{\r
- // Edit end res position of selected group\r
- changeEndRes = true;\r
- }\r
- else if ( (stretchGroup != null) && (stretchGroup.getStartRes() == res))\r
- {\r
- // Edit end res position of selected group\r
- changeStartRes = true;\r
- }\r
-\r
- stretchGroup.getWidth();\r
+ if (mouseDragging)\r
+ {\r
+ stretchGroup.recalcConservation();\r
+ mouseDragging = false;\r
+ }\r
\r
- seqCanvas.repaint();\r
- }\r
+ if (stretchGroup == null)\r
+ {\r
+ return;\r
+ }\r
\r
- public void doMouseReleasedDefineMode(MouseEvent evt)\r
- {\r
- if(mouseDragging)\r
- {\r
- stretchGroup.recalcConservation();\r
- mouseDragging = false;\r
- }\r
+ if (stretchGroup.cs instanceof ClustalxColourScheme)\r
+ {\r
+ ((ClustalxColourScheme) stretchGroup.cs).resetClustalX(stretchGroup.sequences,\r
+ stretchGroup.getWidth());\r
+ }\r
\r
- if (stretchGroup == null)\r
- {\r
- return;\r
- }\r
+ if (stretchGroup.cs instanceof ConservationColourScheme)\r
+ {\r
+ ConservationColourScheme ccs = (ConservationColourScheme) stretchGroup.cs;\r
+ stretchGroup.cs = ccs;\r
+ SliderPanel.setConservationSlider(ap, stretchGroup.cs,\r
+ stretchGroup.getName());\r
+ }\r
+ else\r
+ {\r
+ SliderPanel.setPIDSliderSource(ap, stretchGroup.cs,\r
+ stretchGroup.getName());\r
+ }\r
\r
- if (stretchGroup.cs instanceof ClustalxColourScheme)\r
- {\r
- ( (ClustalxColourScheme) stretchGroup.cs).resetClustalX(stretchGroup.sequences,\r
- stretchGroup.getWidth());\r
+ changeEndRes = false;\r
+ changeStartRes = false;\r
+ stretchGroup = null;\r
+ PaintRefresher.Refresh(av.alignment);\r
}\r
\r
- if (stretchGroup.cs instanceof ConservationColourScheme)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ */\r
+ public void doMouseDraggedDefineMode(MouseEvent evt)\r
{\r
- ConservationColourScheme ccs = (ConservationColourScheme) stretchGroup.cs;\r
- stretchGroup.cs = ccs;\r
- SliderPanel.setConservationSlider(ap, stretchGroup.cs,\r
- stretchGroup.getName());\r
+ int res = (evt.getX() / av.getCharWidth()) + av.getStartRes();\r
+ int y = (evt.getY() / av.getCharHeight()) + av.getStartSeq();\r
\r
- }\r
- else\r
- {\r
- SliderPanel.setPIDSliderSource(ap, stretchGroup.cs,\r
- stretchGroup.getName());\r
- }\r
+ if (stretchGroup == null)\r
+ {\r
+ return;\r
+ }\r
\r
- changeEndRes = false;\r
- changeStartRes = false;\r
- stretchGroup = null;\r
- PaintRefresher.Refresh(av.alignment);\r
- }\r
+ if (res > av.alignment.getWidth())\r
+ {\r
+ res = av.alignment.getWidth() - 1;\r
+ }\r
\r
- public void doMouseDraggedDefineMode(MouseEvent evt)\r
- {\r
- int res = (evt.getX() / av.getCharWidth()) + av.getStartRes();\r
- int y = (evt.getY() / av.getCharHeight()) + av.getStartSeq();\r
+ if (stretchGroup.getEndRes() == res)\r
+ {\r
+ // Edit end res position of selected group\r
+ changeEndRes = true;\r
+ }\r
+ else if (stretchGroup.getStartRes() == res)\r
+ {\r
+ // Edit start res position of selected group\r
+ changeStartRes = true;\r
+ }\r
\r
- if (stretchGroup == null)\r
- {\r
- return;\r
- }\r
+ if (res < av.getStartRes())\r
+ {\r
+ res = av.getStartRes();\r
+ }\r
+ else if (res > av.getEndRes())\r
+ {\r
+ res = av.getEndRes();\r
+ }\r
\r
- if (res > av.alignment.getWidth())\r
- {\r
- res = av.alignment.getWidth() - 1;\r
- }\r
+ if (changeEndRes)\r
+ {\r
+ if (res > (stretchGroup.getStartRes() - 1))\r
+ {\r
+ stretchGroup.setEndRes(res);\r
+ }\r
+ }\r
+ else if (changeStartRes)\r
+ {\r
+ if (res < (stretchGroup.getEndRes() + 1))\r
+ {\r
+ stretchGroup.setStartRes(res);\r
+ }\r
+ }\r
\r
- if (stretchGroup.getEndRes() == res)\r
- {\r
- // Edit end res position of selected group\r
- changeEndRes = true;\r
- }\r
- else if (stretchGroup.getStartRes() == res)\r
- {\r
- // Edit start res position of selected group\r
- changeStartRes = true;\r
- }\r
+ int dragDirection = 0;\r
\r
- if (res < av.getStartRes())\r
- {\r
- res = av.getStartRes();\r
- }\r
- else if (res > av.getEndRes())\r
- {\r
- res = av.getEndRes();\r
- }\r
+ if (y > oldSeq)\r
+ {\r
+ dragDirection = 1;\r
+ }\r
+ else if (y < oldSeq)\r
+ {\r
+ dragDirection = -1;\r
+ }\r
\r
- if (changeEndRes)\r
- {\r
- if (res > (stretchGroup.getStartRes() - 1))\r
- {\r
- stretchGroup.setEndRes(res);\r
- }\r
- }\r
- else if (changeStartRes)\r
- {\r
- if (res < (stretchGroup.getEndRes() + 1))\r
- {\r
- stretchGroup.setStartRes(res);\r
- }\r
- }\r
+ while ((y != oldSeq) && (oldSeq > 0) && (y < av.alignment.getHeight()))\r
+ {\r
+ // This routine ensures we don't skip any sequences, as the\r
+ // selection is quite slow.\r
+ Sequence seq = (Sequence) av.getAlignment().getSequenceAt(oldSeq);\r
\r
- int dragDirection = 0;\r
+ oldSeq += dragDirection;\r
\r
- if (y > oldSeq)\r
- {\r
- dragDirection = 1;\r
- }\r
- else if (y < oldSeq)\r
- {\r
- dragDirection = -1;\r
- }\r
+ Sequence nextSeq = (Sequence) av.getAlignment().getSequenceAt(oldSeq);\r
\r
- while ( (y != oldSeq) && (oldSeq > 0) && (y < av.alignment.getHeight()))\r
- {\r
- // This routine ensures we don't skip any sequences, as the\r
- // selection is quite slow.\r
- Sequence seq = (Sequence) av.getAlignment().getSequenceAt(oldSeq);\r
+ if (stretchGroup.sequences.contains(nextSeq))\r
+ {\r
+ stretchGroup.deleteSequence(seq, false);\r
+ }\r
+ else\r
+ {\r
+ if (seq != null)\r
+ {\r
+ stretchGroup.addSequence(seq, false);\r
+ }\r
\r
- oldSeq += dragDirection;\r
+ stretchGroup.addSequence(nextSeq, false);\r
+ }\r
+ }\r
\r
- Sequence nextSeq = (Sequence) av.getAlignment().getSequenceAt(oldSeq);\r
+ oldSeq = y;\r
+ mouseDragging = true;\r
\r
- if (stretchGroup.sequences.contains(nextSeq))\r
- {\r
- stretchGroup.deleteSequence(seq, false);\r
- }\r
- else\r
- {\r
- if (seq != null)\r
+ if (scrollThread != null)\r
{\r
- stretchGroup.addSequence(seq, false);\r
+ scrollThread.setEvent(evt);\r
}\r
- stretchGroup.addSequence(nextSeq, false);\r
- }\r
- }\r
\r
- oldSeq = y;\r
- mouseDragging = true;\r
-\r
- if (scrollThread != null)\r
- {\r
- scrollThread.setEvent(evt);\r
- }\r
-\r
- seqCanvas.repaint();\r
- }\r
-\r
- public void doMouseEnteredDefineMode(MouseEvent e)\r
- {\r
- if (scrollThread != null)\r
- {\r
- scrollThread.running = false;\r
+ seqCanvas.repaint();\r
}\r
- }\r
\r
- public void doMouseExitedDefineMode(MouseEvent e)\r
- {\r
- if (av.getWrapAlignment())\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void doMouseEnteredDefineMode(MouseEvent e)\r
{\r
- return;\r
- }\r
-\r
- if (mouseDragging)\r
- {\r
- scrollThread = new ScrollThread();\r
- }\r
- }\r
-\r
- // this class allows scrolling off the bottom of the visible alignment\r
- class ScrollThread\r
- extends Thread\r
- {\r
- MouseEvent evt;\r
- boolean running = false;\r
-\r
- public ScrollThread()\r
- {\r
- start();\r
+ if (scrollThread != null)\r
+ {\r
+ scrollThread.running = false;\r
+ }\r
}\r
\r
- public void setEvent(MouseEvent e)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void doMouseExitedDefineMode(MouseEvent e)\r
{\r
- evt = e;\r
- }\r
+ if (av.getWrapAlignment())\r
+ {\r
+ return;\r
+ }\r
\r
- public void stopScrolling()\r
- {\r
- running = false;\r
+ if (mouseDragging)\r
+ {\r
+ scrollThread = new ScrollThread();\r
+ }\r
}\r
\r
- public void run()\r
+ // this class allows scrolling off the bottom of the visible alignment\r
+ class ScrollThread extends Thread\r
{\r
- running = true;\r
+ MouseEvent evt;\r
+ boolean running = false;\r
\r
- while (running)\r
- {\r
- if (evt != null)\r
+ public ScrollThread()\r
{\r
- if (mouseDragging && (evt.getY() < 0) &&\r
- (av.getStartSeq() > 0))\r
- {\r
- running = ap.scrollUp(true);\r
- }\r
-\r
- if (mouseDragging && (evt.getY() >= getHeight()) &&\r
- (av.alignment.getHeight() > av.getEndSeq()))\r
- {\r
- running = ap.scrollUp(false);\r
- }\r
+ start();\r
+ }\r
\r
- if (mouseDragging && (evt.getX() < 0))\r
- {\r
- running = ap.scrollRight(true);\r
- }\r
- else if (mouseDragging && (evt.getX() >= getWidth()))\r
- {\r
- running = ap.scrollRight(false);\r
- }\r
+ public void setEvent(MouseEvent e)\r
+ {\r
+ evt = e;\r
}\r
\r
- try\r
+ public void stopScrolling()\r
{\r
- Thread.sleep(75);\r
+ running = false;\r
}\r
- catch (Exception ex)\r
+\r
+ public void run()\r
{\r
+ running = true;\r
+\r
+ while (running)\r
+ {\r
+ if (evt != null)\r
+ {\r
+ if (mouseDragging && (evt.getY() < 0) &&\r
+ (av.getStartSeq() > 0))\r
+ {\r
+ running = ap.scrollUp(true);\r
+ }\r
+\r
+ if (mouseDragging && (evt.getY() >= getHeight()) &&\r
+ (av.alignment.getHeight() > av.getEndSeq()))\r
+ {\r
+ running = ap.scrollUp(false);\r
+ }\r
+\r
+ if (mouseDragging && (evt.getX() < 0))\r
+ {\r
+ running = ap.scrollRight(true);\r
+ }\r
+ else if (mouseDragging && (evt.getX() >= getWidth()))\r
+ {\r
+ running = ap.scrollRight(false);\r
+ }\r
+ }\r
+\r
+ try\r
+ {\r
+ Thread.sleep(75);\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ }\r
+ }\r
}\r
- }\r
}\r
- }\r
}\r
*/\r
package jalview.gui;\r
\r
-import java.awt.*;\r
-\r
import jalview.datamodel.*;\r
+\r
import jalview.schemes.*;\r
\r
+import java.awt.*;\r
+\r
+\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
public class SequenceRenderer\r
{\r
- AlignViewport av;\r
- FontMetrics fm;\r
- boolean renderGaps = true;\r
- SequenceGroup currentSequenceGroup = null;\r
- SequenceGroup[] allGroups = null;\r
- Color resBoxColour;\r
- Graphics graphics;\r
-\r
- public SequenceRenderer(AlignViewport av)\r
- {\r
- this.av = av;\r
- }\r
-\r
- public void renderGaps(boolean b)\r
- {\r
- renderGaps = b;\r
- }\r
-\r
- public Color getResidueBoxColour(ColourSchemeI cs, SequenceI seq, int i)\r
- {\r
- getBoxColour(cs, seq, i);\r
-\r
- return resBoxColour;\r
- }\r
-\r
- void getBoxColour(ColourSchemeI cs, SequenceI seq, int i)\r
- {\r
- if (cs != null)\r
+ AlignViewport av;\r
+ FontMetrics fm;\r
+ boolean renderGaps = true;\r
+ SequenceGroup currentSequenceGroup = null;\r
+ SequenceGroup[] allGroups = null;\r
+ Color resBoxColour;\r
+ Graphics graphics;\r
+\r
+ /**\r
+ * Creates a new SequenceRenderer object.\r
+ *\r
+ * @param av DOCUMENT ME!\r
+ */\r
+ public SequenceRenderer(AlignViewport av)\r
{\r
- resBoxColour = cs.findColour(seq.getSequence(i, i + 1), i);\r
+ this.av = av;\r
}\r
- else\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param b DOCUMENT ME!\r
+ */\r
+ public void renderGaps(boolean b)\r
{\r
- resBoxColour = Color.white;\r
+ renderGaps = b;\r
}\r
- }\r
-\r
- public void drawSequence(Graphics g, SequenceI seq, SequenceGroup[] sg,\r
- int start, int end, int x1, int y1, int width,\r
- int height)\r
- {\r
- allGroups = sg;\r
-\r
- graphics = g;\r
\r
- drawBoxes(seq, start, end, x1, y1, (int) width, height);\r
-\r
- fm = g.getFontMetrics();\r
- drawText(seq, start, end, x1, y1, (int) width, height);\r
- }\r
-\r
- public void drawBoxes(SequenceI seq, int start, int end, int x1, int y1,\r
- int width, int height)\r
- {\r
- int i = start;\r
- int length = seq.getLength();\r
-\r
- int curStart = -1;\r
- int curWidth = width;\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param cs DOCUMENT ME!\r
+ * @param seq DOCUMENT ME!\r
+ * @param i DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public Color getResidueBoxColour(ColourSchemeI cs, SequenceI seq, int i)\r
+ {\r
+ getBoxColour(cs, seq, i);\r
\r
- Color tempColour = null;\r
+ return resBoxColour;\r
+ }\r
\r
- while ( (i <= end) && (i < length))\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param cs DOCUMENT ME!\r
+ * @param seq DOCUMENT ME!\r
+ * @param i DOCUMENT ME!\r
+ */\r
+ void getBoxColour(ColourSchemeI cs, SequenceI seq, int i)\r
{\r
- if (inCurrentSequenceGroup(i))\r
- {\r
- if (currentSequenceGroup.getDisplayBoxes())\r
+ if (cs != null)\r
{\r
- getBoxColour(currentSequenceGroup.cs, seq, i);\r
+ resBoxColour = cs.findColour(seq.getSequence(i, i + 1), i);\r
}\r
else\r
{\r
- resBoxColour = Color.white;\r
- }\r
- }\r
- else if (av.getShowBoxes())\r
- {\r
- getBoxColour(av.getGlobalColourScheme(), seq, i);\r
- }\r
- else\r
- {\r
- resBoxColour = Color.white;\r
- }\r
-\r
- if (resBoxColour != tempColour)\r
- {\r
- if (tempColour != null)\r
- {\r
- graphics.fillRect(x1 + (width * (curStart - start)), y1,\r
- curWidth, height);\r
+ resBoxColour = Color.white;\r
}\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param g DOCUMENT ME!\r
+ * @param seq DOCUMENT ME!\r
+ * @param sg DOCUMENT ME!\r
+ * @param start DOCUMENT ME!\r
+ * @param end DOCUMENT ME!\r
+ * @param x1 DOCUMENT ME!\r
+ * @param y1 DOCUMENT ME!\r
+ * @param width DOCUMENT ME!\r
+ * @param height DOCUMENT ME!\r
+ */\r
+ public void drawSequence(Graphics g, SequenceI seq, SequenceGroup[] sg,\r
+ int start, int end, int x1, int y1, int width, int height)\r
+ {\r
+ allGroups = sg;\r
\r
- graphics.setColor(resBoxColour);\r
+ graphics = g;\r
\r
- curStart = i;\r
- curWidth = width;\r
- tempColour = resBoxColour;\r
- }\r
- else\r
- {\r
- curWidth += width;\r
- }\r
+ drawBoxes(seq, start, end, x1, y1, (int) width, height);\r
\r
- i++;\r
+ fm = g.getFontMetrics();\r
+ drawText(seq, start, end, x1, y1, (int) width, height);\r
}\r
\r
- graphics.fillRect(x1 + (width * (curStart - start)), y1, curWidth,\r
- height);\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param seq DOCUMENT ME!\r
+ * @param start DOCUMENT ME!\r
+ * @param end DOCUMENT ME!\r
+ * @param x1 DOCUMENT ME!\r
+ * @param y1 DOCUMENT ME!\r
+ * @param width DOCUMENT ME!\r
+ * @param height DOCUMENT ME!\r
+ */\r
+ public void drawBoxes(SequenceI seq, int start, int end, int x1, int y1,\r
+ int width, int height)\r
+ {\r
+ int i = start;\r
+ int length = seq.getLength();\r
\r
- public void drawText(SequenceI seq, int start, int end, int x1, int y1,\r
- int width, int height)\r
- {\r
- int pady = height / 5;\r
- int charOffset = 0;\r
- char s;\r
+ int curStart = -1;\r
+ int curWidth = width;\r
\r
- // Need to find the sequence position here.\r
- String sequence = seq.getSequence();\r
+ Color tempColour = null;\r
\r
- for (int i = start; i <= end; i++)\r
- {\r
- graphics.setColor(Color.black);\r
-\r
- if (i < sequence.length())\r
- {\r
- s = sequence.charAt(i);\r
- }\r
- else\r
- {\r
- s = ' ';\r
- }\r
-\r
- if (!renderGaps && jalview.util.Comparison.isGap(s))\r
- {\r
- continue;\r
- }\r
-\r
- if (inCurrentSequenceGroup(i))\r
- {\r
- if (!currentSequenceGroup.getDisplayText())\r
+ while ((i <= end) && (i < length))\r
{\r
- continue;\r
+ if (inCurrentSequenceGroup(i))\r
+ {\r
+ if (currentSequenceGroup.getDisplayBoxes())\r
+ {\r
+ getBoxColour(currentSequenceGroup.cs, seq, i);\r
+ }\r
+ else\r
+ {\r
+ resBoxColour = Color.white;\r
+ }\r
+ }\r
+ else if (av.getShowBoxes())\r
+ {\r
+ getBoxColour(av.getGlobalColourScheme(), seq, i);\r
+ }\r
+ else\r
+ {\r
+ resBoxColour = Color.white;\r
+ }\r
+\r
+ if (resBoxColour != tempColour)\r
+ {\r
+ if (tempColour != null)\r
+ {\r
+ graphics.fillRect(x1 + (width * (curStart - start)), y1,\r
+ curWidth, height);\r
+ }\r
+\r
+ graphics.setColor(resBoxColour);\r
+\r
+ curStart = i;\r
+ curWidth = width;\r
+ tempColour = resBoxColour;\r
+ }\r
+ else\r
+ {\r
+ curWidth += width;\r
+ }\r
+\r
+ i++;\r
}\r
\r
- if (currentSequenceGroup.getColourText())\r
+ graphics.fillRect(x1 + (width * (curStart - start)), y1, curWidth,\r
+ height);\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param seq DOCUMENT ME!\r
+ * @param start DOCUMENT ME!\r
+ * @param end DOCUMENT ME!\r
+ * @param x1 DOCUMENT ME!\r
+ * @param y1 DOCUMENT ME!\r
+ * @param width DOCUMENT ME!\r
+ * @param height DOCUMENT ME!\r
+ */\r
+ public void drawText(SequenceI seq, int start, int end, int x1, int y1,\r
+ int width, int height)\r
+ {\r
+ int pady = height / 5;\r
+ int charOffset = 0;\r
+ char s;\r
+\r
+ // Need to find the sequence position here.\r
+ String sequence = seq.getSequence();\r
+\r
+ for (int i = start; i <= end; i++)\r
{\r
- getBoxColour(currentSequenceGroup.cs, seq, i);\r
- graphics.setColor(resBoxColour.darker());\r
+ graphics.setColor(Color.black);\r
+\r
+ if (i < sequence.length())\r
+ {\r
+ s = sequence.charAt(i);\r
+ }\r
+ else\r
+ {\r
+ s = ' ';\r
+ }\r
+\r
+ if (!renderGaps && jalview.util.Comparison.isGap(s))\r
+ {\r
+ continue;\r
+ }\r
+\r
+ if (inCurrentSequenceGroup(i))\r
+ {\r
+ if (!currentSequenceGroup.getDisplayText())\r
+ {\r
+ continue;\r
+ }\r
+\r
+ if (currentSequenceGroup.getColourText())\r
+ {\r
+ getBoxColour(currentSequenceGroup.cs, seq, i);\r
+ graphics.setColor(resBoxColour.darker());\r
+ }\r
+ }\r
+ else\r
+ {\r
+ if (!av.getShowText())\r
+ {\r
+ continue;\r
+ }\r
+\r
+ if (av.getColourText())\r
+ {\r
+ getBoxColour(av.getGlobalColourScheme(), seq, i);\r
+\r
+ if (av.getShowBoxes())\r
+ {\r
+ graphics.setColor(resBoxColour.darker());\r
+ }\r
+ else\r
+ {\r
+ graphics.setColor(resBoxColour);\r
+ }\r
+ }\r
+ }\r
+\r
+ charOffset = (width - fm.charWidth(s)) / 2;\r
+ graphics.drawString(String.valueOf(s),\r
+ charOffset + x1 + (width * (i - start)), (y1 + height) - pady);\r
}\r
- }\r
- else\r
- {\r
- if (!av.getShowText())\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param res DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ boolean inCurrentSequenceGroup(int res)\r
+ {\r
+ if (allGroups == null)\r
{\r
- continue;\r
+ return false;\r
}\r
\r
- if (av.getColourText())\r
+ for (int i = 0; i < allGroups.length; i++)\r
{\r
- getBoxColour(av.getGlobalColourScheme(), seq, i);\r
-\r
- if (av.getShowBoxes())\r
- {\r
- graphics.setColor(resBoxColour.darker());\r
- }\r
- else\r
- {\r
- graphics.setColor(resBoxColour);\r
- }\r
- }\r
- }\r
+ if ((allGroups[i].getStartRes() <= res) &&\r
+ (allGroups[i].getEndRes() >= res))\r
+ {\r
+ currentSequenceGroup = allGroups[i];\r
\r
- charOffset = (width - fm.charWidth(s)) / 2;\r
- graphics.drawString(String.valueOf(s),\r
- charOffset + x1 + (width * (i - start)),\r
- (y1 + height) - pady);\r
- }\r
- }\r
+ return true;\r
+ }\r
+ }\r
\r
- boolean inCurrentSequenceGroup(int res)\r
- {\r
- if (allGroups == null)\r
- {\r
- return false;\r
+ return false;\r
}\r
\r
- for (int i = 0; i < allGroups.length; i++)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param seq DOCUMENT ME!\r
+ * @param start DOCUMENT ME!\r
+ * @param end DOCUMENT ME!\r
+ * @param x1 DOCUMENT ME!\r
+ * @param y1 DOCUMENT ME!\r
+ * @param width DOCUMENT ME!\r
+ * @param height DOCUMENT ME!\r
+ */\r
+ public void drawHighlightedText(SequenceI seq, int start, int end, int x1,\r
+ int y1, int width, int height)\r
{\r
- if ( (allGroups[i].getStartRes() <= res) &&\r
- (allGroups[i].getEndRes() >= res))\r
- {\r
- currentSequenceGroup = allGroups[i];\r
-\r
- return true;\r
- }\r
- }\r
+ int pady = height / 5;\r
+ int charOffset = 0;\r
+ graphics.setColor(Color.BLACK);\r
+ graphics.fillRect(x1, y1, width * (end - start + 1), height);\r
+ graphics.setColor(Color.white);\r
\r
- return false;\r
- }\r
+ char s = '~';\r
\r
- public void drawHighlightedText(SequenceI seq, int start, int end, int x1,\r
- int y1, int width, int height)\r
- {\r
- int pady = height / 5;\r
- int charOffset = 0;\r
- graphics.setColor(Color.BLACK);\r
- graphics.fillRect(x1, y1, width * (end - start + 1), height);\r
- graphics.setColor(Color.white);\r
-\r
- char s = '~';\r
-\r
- // Need to find the sequence position here.\r
- for (int i = start; i <= end; i++)\r
- {\r
- if (i < seq.getLength())\r
- {\r
- s = seq.getSequence().charAt(i);\r
- }\r
-\r
- charOffset = (width - fm.charWidth(s)) / 2;\r
- graphics.drawString(String.valueOf(s),\r
- charOffset + x1 + (width * (i - start)),\r
- (y1 + height) - pady);\r
+ // Need to find the sequence position here.\r
+ for (int i = start; i <= end; i++)\r
+ {\r
+ if (i < seq.getLength())\r
+ {\r
+ s = seq.getSequence().charAt(i);\r
+ }\r
+\r
+ charOffset = (width - fm.charWidth(s)) / 2;\r
+ graphics.drawString(String.valueOf(s),\r
+ charOffset + x1 + (width * (i - start)), (y1 + height) - pady);\r
+ }\r
}\r
- }\r
}\r
*/\r
package jalview.gui;\r
\r
-import java.util.*;\r
+import jalview.datamodel.*;\r
+\r
+import jalview.jbgui.*;\r
+\r
+import jalview.schemes.*;\r
\r
import java.awt.event.*;\r
+\r
+import java.util.*;\r
+\r
import javax.swing.*;\r
import javax.swing.event.*;\r
\r
-import jalview.datamodel.*;\r
-import jalview.jbgui.*;\r
-import jalview.schemes.*;\r
\r
-public class SliderPanel\r
- extends GSliderPanel\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class SliderPanel extends GSliderPanel\r
{\r
- static JInternalFrame conservationSlider;\r
- static JInternalFrame PIDSlider;\r
- AlignmentPanel ap;\r
- boolean forConservation = true;\r
- ColourSchemeI cs;\r
-\r
- public SliderPanel(AlignmentPanel ap, int value, boolean forConserve,\r
- ColourSchemeI cs)\r
- {\r
- this.ap = ap;\r
- this.cs = cs;\r
- forConservation = forConserve;\r
- undoButton.setVisible(false);\r
- applyButton.setVisible(false);\r
-\r
- if (forConservation)\r
- {\r
- label.setText("Enter value to increase conservation visibility");\r
- slider.setMinimum(0);\r
- slider.setMaximum(50);\r
- }\r
- else\r
- {\r
- label.setText("Enter % identity above which to colour residues");\r
- slider.setMinimum(0);\r
- slider.setMaximum(100);\r
- }\r
-\r
- slider.addChangeListener(new ChangeListener()\r
+ static JInternalFrame conservationSlider;\r
+ static JInternalFrame PIDSlider;\r
+ AlignmentPanel ap;\r
+ boolean forConservation = true;\r
+ ColourSchemeI cs;\r
+\r
+ /**\r
+ * Creates a new SliderPanel object.\r
+ *\r
+ * @param ap DOCUMENT ME!\r
+ * @param value DOCUMENT ME!\r
+ * @param forConserve DOCUMENT ME!\r
+ * @param cs DOCUMENT ME!\r
+ */\r
+ public SliderPanel(AlignmentPanel ap, int value, boolean forConserve,\r
+ ColourSchemeI cs)\r
{\r
- public void stateChanged(ChangeEvent evt)\r
- {\r
- valueField.setText(slider.getValue() + "");\r
- valueChanged(slider.getValue());\r
- }\r
- });\r
-\r
- slider.setValue(value);\r
- valueField.setText(value + "");\r
- }\r
-\r
- public static int setConservationSlider(AlignmentPanel ap,\r
- ColourSchemeI cs, String source)\r
- {\r
- SliderPanel sp = null;\r
- ConservationColourScheme ccs = (ConservationColourScheme) cs;\r
-\r
- if (conservationSlider == null)\r
- {\r
- sp = new SliderPanel(ap, ccs.inc, true, cs);\r
- conservationSlider = new JInternalFrame();\r
- conservationSlider.setContentPane(sp);\r
- conservationSlider.setLayer(JLayeredPane.PALETTE_LAYER);\r
- }\r
- else\r
- {\r
- sp = (SliderPanel) conservationSlider.getContentPane();\r
- sp.cs = cs;\r
- }\r
+ this.ap = ap;\r
+ this.cs = cs;\r
+ forConservation = forConserve;\r
+ undoButton.setVisible(false);\r
+ applyButton.setVisible(false);\r
\r
- conservationSlider.setTitle("Conservation Colour Increment (" +\r
- source + ")");\r
+ if (forConservation)\r
+ {\r
+ label.setText("Enter value to increase conservation visibility");\r
+ slider.setMinimum(0);\r
+ slider.setMaximum(50);\r
+ }\r
+ else\r
+ {\r
+ label.setText("Enter % identity above which to colour residues");\r
+ slider.setMinimum(0);\r
+ slider.setMaximum(100);\r
+ }\r
\r
- if (ap.av.alignment.getGroups() != null)\r
- {\r
- sp.setAllGroupsCheckEnabled(true);\r
+ slider.addChangeListener(new ChangeListener()\r
+ {\r
+ public void stateChanged(ChangeEvent evt)\r
+ {\r
+ valueField.setText(slider.getValue() + "");\r
+ valueChanged(slider.getValue());\r
+ }\r
+ });\r
+\r
+ slider.setValue(value);\r
+ valueField.setText(value + "");\r
}\r
- else\r
- {\r
- sp.setAllGroupsCheckEnabled(false);\r
- }\r
-\r
- return sp.getValue();\r
- }\r
\r
- public static void showConservationSlider()\r
- {\r
- try\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param ap DOCUMENT ME!\r
+ * @param cs DOCUMENT ME!\r
+ * @param source DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public static int setConservationSlider(AlignmentPanel ap,\r
+ ColourSchemeI cs, String source)\r
{\r
- PIDSlider.setClosed(true);\r
- PIDSlider = null;\r
- }\r
- catch (Exception ex)\r
- {\r
- }\r
+ SliderPanel sp = null;\r
+ ConservationColourScheme ccs = (ConservationColourScheme) cs;\r
\r
- if (!conservationSlider.isVisible())\r
- {\r
- Desktop.addInternalFrame(conservationSlider,\r
- conservationSlider.getTitle(), 420, 90, false);\r
- conservationSlider.addInternalFrameListener(new javax.swing.event.\r
- InternalFrameAdapter()\r
- {\r
- public void internalFrameClosed(\r
- javax.swing.event.InternalFrameEvent e)\r
+ if (conservationSlider == null)\r
{\r
- conservationSlider = null;\r
+ sp = new SliderPanel(ap, ccs.inc, true, cs);\r
+ conservationSlider = new JInternalFrame();\r
+ conservationSlider.setContentPane(sp);\r
+ conservationSlider.setLayer(JLayeredPane.PALETTE_LAYER);\r
+ }\r
+ else\r
+ {\r
+ sp = (SliderPanel) conservationSlider.getContentPane();\r
+ sp.cs = cs;\r
}\r
- });\r
- conservationSlider.setLayer(JLayeredPane.PALETTE_LAYER);\r
- }\r
- }\r
\r
- public static int setPIDSliderSource(AlignmentPanel ap, ColourSchemeI cs,\r
- String source)\r
- {\r
- SliderPanel pid = null;\r
+ conservationSlider.setTitle("Conservation Colour Increment (" +\r
+ source + ")");\r
\r
- int threshold = 50;\r
+ if (ap.av.alignment.getGroups() != null)\r
+ {\r
+ sp.setAllGroupsCheckEnabled(true);\r
+ }\r
+ else\r
+ {\r
+ sp.setAllGroupsCheckEnabled(false);\r
+ }\r
\r
- if (cs instanceof ResidueColourScheme)\r
- {\r
- threshold = ( ( (ResidueColourScheme) cs).getThreshold());\r
- }\r
- else if (cs instanceof ScoreColourScheme)\r
- {\r
- threshold = ( ( (ScoreColourScheme) cs).getThreshold());\r
+ return sp.getValue();\r
}\r
\r
- if (PIDSlider == null)\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ public static void showConservationSlider()\r
{\r
- pid = new SliderPanel(ap, threshold, false, cs);\r
- PIDSlider = new JInternalFrame();\r
- PIDSlider.setContentPane(pid);\r
- PIDSlider.setLayer(JLayeredPane.PALETTE_LAYER);\r
+ try\r
+ {\r
+ PIDSlider.setClosed(true);\r
+ PIDSlider = null;\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ }\r
+\r
+ if (!conservationSlider.isVisible())\r
+ {\r
+ Desktop.addInternalFrame(conservationSlider,\r
+ conservationSlider.getTitle(), 420, 90, false);\r
+ conservationSlider.addInternalFrameListener(new javax.swing.event.InternalFrameAdapter()\r
+ {\r
+ public void internalFrameClosed(\r
+ javax.swing.event.InternalFrameEvent e)\r
+ {\r
+ conservationSlider = null;\r
+ }\r
+ });\r
+ conservationSlider.setLayer(JLayeredPane.PALETTE_LAYER);\r
+ }\r
}\r
- else\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param ap DOCUMENT ME!\r
+ * @param cs DOCUMENT ME!\r
+ * @param source DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public static int setPIDSliderSource(AlignmentPanel ap, ColourSchemeI cs,\r
+ String source)\r
{\r
- pid = (SliderPanel) PIDSlider.getContentPane();\r
- pid.cs = cs;\r
- }\r
+ SliderPanel pid = null;\r
\r
- PIDSlider.setTitle("Percentage Identity Threshold (" + source + ")");\r
+ int threshold = 50;\r
\r
- if (ap.av.alignment.getGroups() != null)\r
- {\r
- pid.setAllGroupsCheckEnabled(true);\r
- }\r
- else\r
- {\r
- pid.setAllGroupsCheckEnabled(false);\r
- }\r
+ if (cs instanceof ResidueColourScheme)\r
+ {\r
+ threshold = (((ResidueColourScheme) cs).getThreshold());\r
+ }\r
+ else if (cs instanceof ScoreColourScheme)\r
+ {\r
+ threshold = (((ScoreColourScheme) cs).getThreshold());\r
+ }\r
\r
- return pid.getValue();\r
- }\r
+ if (PIDSlider == null)\r
+ {\r
+ pid = new SliderPanel(ap, threshold, false, cs);\r
+ PIDSlider = new JInternalFrame();\r
+ PIDSlider.setContentPane(pid);\r
+ PIDSlider.setLayer(JLayeredPane.PALETTE_LAYER);\r
+ }\r
+ else\r
+ {\r
+ pid = (SliderPanel) PIDSlider.getContentPane();\r
+ pid.cs = cs;\r
+ }\r
\r
- public static void showPIDSlider()\r
- {\r
- try\r
- {\r
- conservationSlider.setClosed(true);\r
- conservationSlider = null;\r
- }\r
- catch (Exception ex)\r
- {\r
+ PIDSlider.setTitle("Percentage Identity Threshold (" + source + ")");\r
+\r
+ if (ap.av.alignment.getGroups() != null)\r
+ {\r
+ pid.setAllGroupsCheckEnabled(true);\r
+ }\r
+ else\r
+ {\r
+ pid.setAllGroupsCheckEnabled(false);\r
+ }\r
+\r
+ return pid.getValue();\r
}\r
\r
- if (!PIDSlider.isVisible())\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ public static void showPIDSlider()\r
{\r
- Desktop.addInternalFrame(PIDSlider, PIDSlider.getTitle(), 420, 90,\r
- false);\r
- PIDSlider.setLayer(JLayeredPane.PALETTE_LAYER);\r
- PIDSlider.addInternalFrameListener(new javax.swing.event.\r
- InternalFrameAdapter()\r
- {\r
- public void internalFrameClosed(\r
- javax.swing.event.InternalFrameEvent e)\r
+ try\r
{\r
- PIDSlider = null;\r
+ conservationSlider.setClosed(true);\r
+ conservationSlider = null;\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ }\r
+\r
+ if (!PIDSlider.isVisible())\r
+ {\r
+ Desktop.addInternalFrame(PIDSlider, PIDSlider.getTitle(), 420, 90,\r
+ false);\r
+ PIDSlider.setLayer(JLayeredPane.PALETTE_LAYER);\r
+ PIDSlider.addInternalFrameListener(new javax.swing.event.InternalFrameAdapter()\r
+ {\r
+ public void internalFrameClosed(\r
+ javax.swing.event.InternalFrameEvent e)\r
+ {\r
+ PIDSlider = null;\r
+ }\r
+ });\r
+ PIDSlider.setLayer(JLayeredPane.PALETTE_LAYER);\r
}\r
- });\r
- PIDSlider.setLayer(JLayeredPane.PALETTE_LAYER);\r
}\r
- }\r
\r
- public void valueChanged(int i)\r
- {\r
- if (cs == null)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param i DOCUMENT ME!\r
+ */\r
+ public void valueChanged(int i)\r
{\r
- return;\r
- }\r
+ if (cs == null)\r
+ {\r
+ return;\r
+ }\r
\r
- ColourSchemeI toChange = null;\r
- Vector allGroups = null;\r
- int groupIndex = 0;\r
+ ColourSchemeI toChange = null;\r
+ Vector allGroups = null;\r
+ int groupIndex = 0;\r
\r
- if (allGroupsCheck.isSelected())\r
- {\r
- allGroups = ap.av.alignment.getGroups();\r
- groupIndex = allGroups.size() - 1;\r
+ if (allGroupsCheck.isSelected())\r
+ {\r
+ allGroups = ap.av.alignment.getGroups();\r
+ groupIndex = allGroups.size() - 1;\r
+ }\r
+ else\r
+ {\r
+ toChange = cs;\r
+ }\r
+\r
+ while (groupIndex > -1)\r
+ {\r
+ if (allGroups != null)\r
+ {\r
+ toChange = ((SequenceGroup) allGroups.get(groupIndex)).cs;\r
+\r
+ if (toChange == null)\r
+ {\r
+ groupIndex--;\r
+\r
+ continue;\r
+ }\r
+ }\r
+\r
+ if (forConservation)\r
+ {\r
+ if (toChange instanceof ConservationColourScheme)\r
+ {\r
+ ((ConservationColourScheme) toChange).inc = i;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ ((ResidueColourScheme) toChange).setThreshold(i);\r
+ }\r
+\r
+ groupIndex--;\r
+ }\r
+\r
+ ap.seqPanel.seqCanvas.repaint();\r
}\r
- else\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param b DOCUMENT ME!\r
+ */\r
+ public void setAllGroupsCheckEnabled(boolean b)\r
{\r
- toChange = cs;\r
+ allGroupsCheck.setEnabled(b);\r
}\r
\r
- while (groupIndex > -1)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void valueField_actionPerformed(ActionEvent e)\r
{\r
- if (allGroups != null)\r
- {\r
- toChange = ( (SequenceGroup) allGroups.get(groupIndex)).cs;\r
- if(toChange==null)\r
+ try\r
{\r
- groupIndex--;\r
- continue;\r
+ int i = Integer.parseInt(valueField.getText());\r
+ slider.setValue(i);\r
}\r
- }\r
-\r
- if (forConservation)\r
- {\r
- if (toChange instanceof ConservationColourScheme)\r
+ catch (Exception ex)\r
{\r
- ( (ConservationColourScheme) toChange).inc = i;\r
+ valueField.setText(slider.getValue() + "");\r
}\r
- }\r
- else\r
- {\r
- ( (ResidueColourScheme) toChange).setThreshold(i);\r
- }\r
-\r
- groupIndex--;\r
}\r
\r
- ap.seqPanel.seqCanvas.repaint();\r
- }\r
-\r
- public void setAllGroupsCheckEnabled(boolean b)\r
- {\r
- allGroupsCheck.setEnabled(b);\r
- }\r
-\r
- public void valueField_actionPerformed(ActionEvent e)\r
- {\r
- try\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param value DOCUMENT ME!\r
+ */\r
+ public void setValue(int value)\r
{\r
- int i = Integer.parseInt(valueField.getText());\r
- slider.setValue(i);\r
+ slider.setValue(value);\r
}\r
- catch (Exception ex)\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public int getValue()\r
{\r
- valueField.setText(slider.getValue() + "");\r
+ return Integer.parseInt(valueField.getText());\r
}\r
- }\r
-\r
- public void setValue(int value)\r
- {\r
- slider.setValue(value);\r
- }\r
-\r
- public int getValue()\r
- {\r
- return Integer.parseInt(valueField.getText());\r
- }\r
}\r
\r
import java.awt.*;\r
import java.awt.event.*;\r
+\r
import javax.swing.*;\r
\r
-public class SplashScreen\r
- extends JPanel implements Runnable\r
+\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class SplashScreen extends JPanel implements Runnable\r
{\r
- boolean visible = true;\r
- JInternalFrame iframe;\r
- Image image;\r
- int fontSize = 11;\r
- int yoffset = 30;\r
+ boolean visible = true;\r
+ JInternalFrame iframe;\r
+ Image image;\r
+ int fontSize = 11;\r
+ int yoffset = 30;\r
\r
- public SplashScreen(JInternalFrame iframe, Image i)\r
- {\r
- this.iframe = iframe;\r
- image = i;\r
+ /**\r
+ * Creates a new SplashScreen object.\r
+ *\r
+ * @param iframe DOCUMENT ME!\r
+ * @param i DOCUMENT ME!\r
+ */\r
+ public SplashScreen(JInternalFrame iframe, Image i)\r
+ {\r
+ this.iframe = iframe;\r
+ image = i;\r
+\r
+ Thread t = new Thread(this);\r
+ t.start();\r
+ addMouseListener(new MouseAdapter()\r
+ {\r
+ public void mousePressed(MouseEvent evt)\r
+ {\r
+ try\r
+ {\r
+ closeSplash();\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ }\r
+ }\r
+ });\r
+ }\r
\r
- Thread t = new Thread(this);\r
- t.start();\r
- addMouseListener(new MouseAdapter()\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ public void run()\r
+ {\r
+ long startTime = System.currentTimeMillis() / 1000;\r
+\r
+ while (visible)\r
+ {\r
+ if (((System.currentTimeMillis() / 1000) - startTime) > 5)\r
+ {\r
+ visible = false;\r
+ }\r
+\r
+ try\r
+ {\r
+ Thread.sleep(1000);\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ }\r
+ }\r
+\r
+ closeSplash();\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ public void closeSplash()\r
{\r
- public void mousePressed(MouseEvent evt)\r
- {\r
try\r
{\r
- closeSplash();\r
+ iframe.setClosed(true);\r
}\r
catch (Exception ex)\r
{\r
}\r
- }\r
- });\r
- }\r
-\r
- public void run()\r
- {\r
- long startTime = System.currentTimeMillis() / 1000;\r
-\r
- while (visible)\r
- {\r
- if ( ( (System.currentTimeMillis() / 1000) - startTime) > 5)\r
- {\r
- visible = false;\r
- }\r
-\r
- try\r
- {\r
- Thread.sleep(1000);\r
- }\r
- catch (Exception ex)\r
- {\r
- }\r
}\r
\r
- closeSplash();\r
- }\r
-\r
- public void closeSplash()\r
- {\r
- try\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param g DOCUMENT ME!\r
+ */\r
+ public void paintComponent(Graphics g)\r
{\r
- iframe.setClosed(true);\r
- }\r
- catch (Exception ex)\r
- {\r
- }\r
- }\r
+ g.setColor(Color.white);\r
+ g.fillRect(0, 0, getWidth(), getHeight());\r
+ g.setColor(Color.black);\r
+ g.setFont(new Font("Verdana", Font.BOLD, fontSize + 6));\r
\r
- public void paintComponent(Graphics g)\r
- {\r
- g.setColor(Color.white);\r
- g.fillRect(0, 0, getWidth(), getHeight());\r
- g.setColor(Color.black);\r
- g.setFont(new Font("Verdana", Font.BOLD, fontSize + 6));\r
+ if (image != null)\r
+ {\r
+ g.drawImage(image, 5, yoffset + 12, this);\r
+ }\r
\r
- if (image != null)\r
- {\r
- g.drawImage(image, 5, yoffset + 12, this);\r
+ g.drawString("JalView 2005 ", 50, yoffset);\r
+ g.setFont(new Font("Verdana", Font.BOLD, fontSize + 2));\r
+ g.drawString("Version " + jalview.bin.Cache.VERSION +\r
+ "; Last updated: " + jalview.bin.Cache.BUILD_DATE, 180, yoffset);\r
+ g.setFont(new Font("Verdana", Font.BOLD, fontSize));\r
+ g.drawString("Authors: Michele Clamp, James Cuff, Steve Searle, Andrew Waterhouse, Jim Procter & Geoff Barton.",\r
+ 50, yoffset + 20);\r
+ g.drawString("Current development managed by Andrew Waterhouse; Barton Group, University of Dundee.",\r
+ 50, yoffset + 24 + fontSize);\r
+ g.drawString("If you use JalView, please cite: Clamp, M., Cuff, J., Searle, S. M. and Barton, G. J. (2004),",\r
+ 50, yoffset + 28 + (fontSize * 2));\r
+ g.drawString("\"The Jalview Java Alignment Editor\" Bioinformatics, 2004 12;426-7.",\r
+ 50, yoffset + 32 + (fontSize * 3));\r
}\r
-\r
- g.drawString("JalView 2005 ", 50, yoffset);\r
- g.setFont(new Font("Verdana", Font.BOLD, fontSize + 2));\r
- g.drawString("Version " + jalview.bin.Cache.VERSION +\r
- "; Last updated: " + jalview.bin.Cache.BUILD_DATE, 180,\r
- yoffset);\r
- g.setFont(new Font("Verdana", Font.BOLD, fontSize));\r
- g.drawString("Authors: Michele Clamp, James Cuff, Steve Searle, Andrew Waterhouse, Jim Procter & Geoff Barton.",\r
- 50, yoffset + 20);\r
- g.drawString("Current development managed by Andrew Waterhouse; Barton Group, University of Dundee.",\r
- 50, yoffset + 24 + fontSize);\r
- g.drawString("If you use JalView, please cite: Clamp, M., Cuff, J., Searle, S. M. and Barton, G. J. (2004),",\r
- 50, yoffset + 28 + (fontSize * 2));\r
- g.drawString(\r
- "\"The Jalview Java Alignment Editor\" Bioinformatics, 2004 12;426-7.",\r
- 50, yoffset + 32 + (fontSize * 3));\r
- }\r
}\r
*/\r
package jalview.gui;\r
\r
-import java.util.*;\r
+import jalview.analysis.*;\r
+\r
+import jalview.datamodel.*;\r
+\r
+import jalview.schemes.*;\r
+\r
+import jalview.util.*;\r
\r
import java.awt.*;\r
import java.awt.event.*;\r
import java.awt.print.*;\r
+\r
+import java.util.*;\r
+\r
import javax.swing.*;\r
\r
-import jalview.analysis.*;\r
-import jalview.datamodel.*;\r
-import jalview.schemes.*;\r
-import jalview.util.*;\r
\r
-public class TreeCanvas\r
- extends JPanel implements MouseListener, Runnable,\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class TreeCanvas extends JPanel implements MouseListener, Runnable,\r
Printable\r
{\r
- public static final String PLACEHOLDER = " * ";\r
- NJTree tree;\r
- JScrollPane scrollPane;\r
- AlignViewport av;\r
- Font font;\r
- int fontSize = 12;\r
- boolean fitToWindow = true;\r
- boolean showDistances = false;\r
- boolean showBootstrap = false;\r
- boolean markPlaceholders = false;\r
- int offx = 20;\r
- int offy = 20;\r
- float threshold;\r
- String longestName;\r
- int labelLength = -1;\r
-\r
- //RubberbandRectangle rubberband;\r
- Vector listeners;\r
- Hashtable nameHash = new Hashtable();\r
- Hashtable nodeHash = new Hashtable();\r
-\r
- public TreeCanvas(AlignViewport av, NJTree tree, JScrollPane scroller,\r
- String label)\r
- {\r
- this.av = av;\r
- this.tree = tree;\r
- scrollPane = scroller;\r
- addMouseListener(this);\r
- tree.findHeight(tree.getTopNode());\r
- longestName = label;\r
-\r
- PaintRefresher.Register(this, av.alignment);\r
- }\r
-\r
- public void TreeSelectionChanged(Sequence sequence)\r
- {\r
- SequenceGroup selected = av.getSelectionGroup();\r
-\r
- if (selected == null)\r
+ /** DOCUMENT ME!! */\r
+ public static final String PLACEHOLDER = " * ";\r
+ NJTree tree;\r
+ JScrollPane scrollPane;\r
+ AlignViewport av;\r
+ Font font;\r
+ int fontSize = 12;\r
+ boolean fitToWindow = true;\r
+ boolean showDistances = false;\r
+ boolean showBootstrap = false;\r
+ boolean markPlaceholders = false;\r
+ int offx = 20;\r
+ int offy = 20;\r
+ float threshold;\r
+ String longestName;\r
+ int labelLength = -1;\r
+\r
+ //RubberbandRectangle rubberband;\r
+ Vector listeners;\r
+ Hashtable nameHash = new Hashtable();\r
+ Hashtable nodeHash = new Hashtable();\r
+\r
+ /**\r
+ * Creates a new TreeCanvas object.\r
+ *\r
+ * @param av DOCUMENT ME!\r
+ * @param tree DOCUMENT ME!\r
+ * @param scroller DOCUMENT ME!\r
+ * @param label DOCUMENT ME!\r
+ */\r
+ public TreeCanvas(AlignViewport av, NJTree tree, JScrollPane scroller,\r
+ String label)\r
{\r
- selected = new SequenceGroup();\r
- av.setSelectionGroup(selected);\r
+ this.av = av;\r
+ this.tree = tree;\r
+ scrollPane = scroller;\r
+ addMouseListener(this);\r
+ tree.findHeight(tree.getTopNode());\r
+ longestName = label;\r
+\r
+ PaintRefresher.Register(this, av.alignment);\r
}\r
\r
- selected.setEndRes(av.alignment.getWidth());\r
- selected.addOrRemove(sequence, true);\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param sequence DOCUMENT ME!\r
+ */\r
+ public void TreeSelectionChanged(Sequence sequence)\r
+ {\r
+ SequenceGroup selected = av.getSelectionGroup();\r
+\r
+ if (selected == null)\r
+ {\r
+ selected = new SequenceGroup();\r
+ av.setSelectionGroup(selected);\r
+ }\r
\r
- PaintRefresher.Refresh(this, av.alignment);\r
- repaint();\r
- }\r
+ selected.setEndRes(av.alignment.getWidth());\r
+ selected.addOrRemove(sequence, true);\r
\r
- public void setTree(NJTree tree)\r
- {\r
- this.tree = tree;\r
- tree.findHeight(tree.getTopNode());\r
- }\r
+ PaintRefresher.Refresh(this, av.alignment);\r
+ repaint();\r
+ }\r
\r
- public void drawNode(Graphics g, SequenceNode node, float chunk,\r
- float scale, int width, int offx, int offy)\r
- {\r
- if (node == null)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param tree DOCUMENT ME!\r
+ */\r
+ public void setTree(NJTree tree)\r
{\r
- return;\r
+ this.tree = tree;\r
+ tree.findHeight(tree.getTopNode());\r
}\r
\r
- if ( (node.left() == null) && (node.right() == null))\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param g DOCUMENT ME!\r
+ * @param node DOCUMENT ME!\r
+ * @param chunk DOCUMENT ME!\r
+ * @param scale DOCUMENT ME!\r
+ * @param width DOCUMENT ME!\r
+ * @param offx DOCUMENT ME!\r
+ * @param offy DOCUMENT ME!\r
+ */\r
+ public void drawNode(Graphics g, SequenceNode node, float chunk,\r
+ float scale, int width, int offx, int offy)\r
{\r
- // Drawing leaf node\r
- float height = node.height;\r
- float dist = node.dist;\r
-\r
- int xstart = (int) ( (height - dist) * scale) + offx;\r
- int xend = (int) (height * scale) + offx;\r
-\r
- int ypos = (int) (node.ycount * chunk) + offy;\r
-\r
- if (node.element() instanceof SequenceI)\r
- {\r
- if ( ( (SequenceI) ( (SequenceNode) node).element()).getColor() ==\r
- Color.white)\r
- {\r
- g.setColor(Color.black);\r
- }\r
- else\r
+ if (node == null)\r
{\r
- g.setColor( ( (SequenceI) ( (SequenceNode) node).element()).getColor()\r
- .darker());\r
+ return;\r
}\r
- }\r
- else\r
- {\r
- g.setColor(Color.black);\r
- }\r
-\r
- // Draw horizontal line\r
- g.drawLine(xstart, ypos, xend, ypos);\r
-\r
- String nodeLabel = "";\r
\r
- if (showDistances && (node.dist > 0))\r
- {\r
- nodeLabel = new Format("%5.2f").form(node.dist);\r
- }\r
-\r
- if (showBootstrap)\r
- {\r
- if (showDistances)\r
+ if ((node.left() == null) && (node.right() == null))\r
{\r
- nodeLabel = nodeLabel + " : ";\r
+ // Drawing leaf node\r
+ float height = node.height;\r
+ float dist = node.dist;\r
+\r
+ int xstart = (int) ((height - dist) * scale) + offx;\r
+ int xend = (int) (height * scale) + offx;\r
+\r
+ int ypos = (int) (node.ycount * chunk) + offy;\r
+\r
+ if (node.element() instanceof SequenceI)\r
+ {\r
+ if (((SequenceI) ((SequenceNode) node).element()).getColor() == Color.white)\r
+ {\r
+ g.setColor(Color.black);\r
+ }\r
+ else\r
+ {\r
+ g.setColor(((SequenceI) ((SequenceNode) node).element()).getColor()\r
+ .darker());\r
+ }\r
+ }\r
+ else\r
+ {\r
+ g.setColor(Color.black);\r
+ }\r
+\r
+ // Draw horizontal line\r
+ g.drawLine(xstart, ypos, xend, ypos);\r
+\r
+ String nodeLabel = "";\r
+\r
+ if (showDistances && (node.dist > 0))\r
+ {\r
+ nodeLabel = new Format("%5.2f").form(node.dist);\r
+ }\r
+\r
+ if (showBootstrap)\r
+ {\r
+ if (showDistances)\r
+ {\r
+ nodeLabel = nodeLabel + " : ";\r
+ }\r
+\r
+ nodeLabel = nodeLabel + String.valueOf(node.getBootstrap());\r
+ }\r
+\r
+ if (!nodeLabel.equals(""))\r
+ {\r
+ g.drawString(nodeLabel, xstart, ypos - 10);\r
+ }\r
+\r
+ String name = (markPlaceholders && node.isPlaceholder())\r
+ ? (PLACEHOLDER + node.getName()) : node.getName();\r
+ FontMetrics fm = g.getFontMetrics(font);\r
+ int charWidth = fm.stringWidth(name) + 3;\r
+ int charHeight = fm.getHeight();\r
+\r
+ Rectangle rect = new Rectangle(xend + 20, ypos - charHeight,\r
+ charWidth, charHeight);\r
+\r
+ nameHash.put((SequenceI) node.element(), rect);\r
+\r
+ // Colour selected leaves differently\r
+ SequenceGroup selected = av.getSelectionGroup();\r
+\r
+ if ((selected != null) &&\r
+ selected.sequences.contains((SequenceI) node.element()))\r
+ {\r
+ g.setColor(Color.gray);\r
+\r
+ g.fillRect(xend + 10, ypos - charHeight + 3, charWidth,\r
+ charHeight);\r
+ g.setColor(Color.white);\r
+ }\r
+\r
+ g.drawString(name, xend + 10, ypos);\r
+ g.setColor(Color.black);\r
}\r
+ else\r
+ {\r
+ drawNode(g, (SequenceNode) node.left(), chunk, scale, width, offx,\r
+ offy);\r
+ drawNode(g, (SequenceNode) node.right(), chunk, scale, width, offx,\r
+ offy);\r
\r
- nodeLabel = nodeLabel + String.valueOf(node.getBootstrap());\r
- }\r
-\r
- if (!nodeLabel.equals(""))\r
- {\r
- g.drawString(nodeLabel, xstart, ypos - 10);\r
- }\r
+ float height = node.height;\r
+ float dist = node.dist;\r
\r
- String name = (markPlaceholders && node.isPlaceholder())\r
- ? (PLACEHOLDER + node.getName()) : node.getName();\r
- FontMetrics fm = g.getFontMetrics(font);\r
- int charWidth = fm.stringWidth(name) + 3;\r
- int charHeight = fm.getHeight();\r
+ int xstart = (int) ((height - dist) * scale) + offx;\r
+ int xend = (int) (height * scale) + offx;\r
+ int ypos = (int) (node.ycount * chunk) + offy;\r
\r
- Rectangle rect = new Rectangle(xend + 20, ypos - charHeight,\r
- charWidth, charHeight);\r
+ g.setColor(((SequenceNode) node).color.darker());\r
\r
- nameHash.put( (SequenceI) node.element(), rect);\r
+ // Draw horizontal line\r
+ g.drawLine(xstart, ypos, xend, ypos);\r
+ g.fillRect(xend - 2, ypos - 2, 4, 4);\r
\r
- // Colour selected leaves differently\r
- SequenceGroup selected = av.getSelectionGroup();\r
+ int ystart = (int) (((SequenceNode) node.left()).ycount * chunk) +\r
+ offy;\r
+ int yend = (int) (((SequenceNode) node.right()).ycount * chunk) +\r
+ offy;\r
\r
- if ( (selected != null) &&\r
- selected.sequences.contains( (SequenceI) node.element()))\r
- {\r
- g.setColor(Color.gray);\r
+ Rectangle pos = new Rectangle(xend - 2, ypos - 2, 5, 5);\r
+ nodeHash.put(node, pos);\r
\r
- g.fillRect(xend + 10, ypos - charHeight + 3, charWidth,\r
- charHeight);\r
- g.setColor(Color.white);\r
- }\r
+ g.drawLine((int) (height * scale) + offx, ystart,\r
+ (int) (height * scale) + offx, yend);\r
\r
- g.drawString(name, xend + 10, ypos);\r
- g.setColor(Color.black);\r
+ if (showDistances && (node.dist > 0))\r
+ {\r
+ g.drawString(new Format("%5.2f").form(node.dist), xstart,\r
+ ypos - 5);\r
+ }\r
+ }\r
}\r
- else\r
- {\r
- drawNode(g, (SequenceNode) node.left(), chunk, scale, width, offx,\r
- offy);\r
- drawNode(g, (SequenceNode) node.right(), chunk, scale, width, offx,\r
- offy);\r
\r
- float height = node.height;\r
- float dist = node.dist;\r
-\r
- int xstart = (int) ( (height - dist) * scale) + offx;\r
- int xend = (int) (height * scale) + offx;\r
- int ypos = (int) (node.ycount * chunk) + offy;\r
-\r
- g.setColor( ( (SequenceNode) node).color.darker());\r
-\r
- // Draw horizontal line\r
- g.drawLine(xstart, ypos, xend, ypos);\r
- g.fillRect(xend - 2, ypos - 2, 4, 4);\r
-\r
- int ystart = (int) ( ( (SequenceNode) node.left()).ycount * chunk) +\r
- offy;\r
- int yend = (int) ( ( (SequenceNode) node.right()).ycount * chunk) +\r
- offy;\r
-\r
- Rectangle pos = new Rectangle(xend - 2, ypos - 2, 5, 5);\r
- nodeHash.put(node, pos);\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param x DOCUMENT ME!\r
+ * @param y DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public Object findElement(int x, int y)\r
+ {\r
+ Enumeration keys = nameHash.keys();\r
\r
- g.drawLine( (int) (height * scale) + offx, ystart,\r
- (int) (height * scale) + offx, yend);\r
+ while (keys.hasMoreElements())\r
+ {\r
+ Object ob = keys.nextElement();\r
+ Rectangle rect = (Rectangle) nameHash.get(ob);\r
+\r
+ if ((x >= rect.x) && (x <= (rect.x + rect.width)) && (y >= rect.y) &&\r
+ (y <= (rect.y + rect.height)))\r
+ {\r
+ return ob;\r
+ }\r
+ }\r
\r
- if (showDistances && (node.dist > 0))\r
- {\r
- g.drawString(new Format("%5.2f").form(node.dist), xstart,\r
- ypos - 5);\r
- }\r
- }\r
- }\r
+ keys = nodeHash.keys();\r
\r
- public Object findElement(int x, int y)\r
- {\r
- Enumeration keys = nameHash.keys();\r
+ while (keys.hasMoreElements())\r
+ {\r
+ Object ob = keys.nextElement();\r
+ Rectangle rect = (Rectangle) nodeHash.get(ob);\r
+\r
+ if ((x >= rect.x) && (x <= (rect.x + rect.width)) && (y >= rect.y) &&\r
+ (y <= (rect.y + rect.height)))\r
+ {\r
+ return ob;\r
+ }\r
+ }\r
\r
- while (keys.hasMoreElements())\r
- {\r
- Object ob = keys.nextElement();\r
- Rectangle rect = (Rectangle) nameHash.get(ob);\r
-\r
- if ( (x >= rect.x) && (x <= (rect.x + rect.width)) && (y >= rect.y) &&\r
- (y <= (rect.y + rect.height)))\r
- {\r
- return ob;\r
- }\r
+ return null;\r
}\r
\r
- keys = nodeHash.keys();\r
-\r
- while (keys.hasMoreElements())\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param pickBox DOCUMENT ME!\r
+ */\r
+ public void pickNodes(Rectangle pickBox)\r
{\r
- Object ob = keys.nextElement();\r
- Rectangle rect = (Rectangle) nodeHash.get(ob);\r
-\r
- if ( (x >= rect.x) && (x <= (rect.x + rect.width)) && (y >= rect.y) &&\r
- (y <= (rect.y + rect.height)))\r
- {\r
- return ob;\r
- }\r
- }\r
+ int width = getWidth();\r
+ int height = getHeight();\r
\r
- return null;\r
- }\r
+ SequenceNode top = tree.getTopNode();\r
\r
- public void pickNodes(Rectangle pickBox)\r
- {\r
- int width = getWidth();\r
- int height = getHeight();\r
+ float wscale = (float) ((width * .8) - (offx * 2)) / tree.getMaxHeight();\r
\r
- SequenceNode top = tree.getTopNode();\r
+ if (top.count == 0)\r
+ {\r
+ top.count = ((SequenceNode) top.left()).count +\r
+ ((SequenceNode) top.right()).count;\r
+ }\r
\r
- float wscale = (float) ( (width * .8) - (offx * 2)) / tree.getMaxHeight();\r
+ float chunk = (float) (height - (offy * 2)) / top.count;\r
\r
- if (top.count == 0)\r
- {\r
- top.count = ( (SequenceNode) top.left()).count +\r
- ( (SequenceNode) top.right()).count;\r
+ pickNode(pickBox, top, chunk, wscale, width, offx, offy);\r
}\r
\r
- float chunk = (float) (height - (offy * 2)) / top.count;\r
-\r
- pickNode(pickBox, top, chunk, wscale, width, offx, offy);\r
- }\r
-\r
- public void pickNode(Rectangle pickBox, SequenceNode node, float chunk,\r
- float scale, int width, int offx, int offy)\r
- {\r
- if (node == null)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param pickBox DOCUMENT ME!\r
+ * @param node DOCUMENT ME!\r
+ * @param chunk DOCUMENT ME!\r
+ * @param scale DOCUMENT ME!\r
+ * @param width DOCUMENT ME!\r
+ * @param offx DOCUMENT ME!\r
+ * @param offy DOCUMENT ME!\r
+ */\r
+ public void pickNode(Rectangle pickBox, SequenceNode node, float chunk,\r
+ float scale, int width, int offx, int offy)\r
{\r
- return;\r
+ if (node == null)\r
+ {\r
+ return;\r
+ }\r
+\r
+ if ((node.left() == null) && (node.right() == null))\r
+ {\r
+ float height = node.height;\r
+ float dist = node.dist;\r
+\r
+ int xstart = (int) ((height - dist) * scale) + offx;\r
+ int xend = (int) (height * scale) + offx;\r
+\r
+ int ypos = (int) (node.ycount * chunk) + offy;\r
+\r
+ if (pickBox.contains(new Point(xend, ypos)))\r
+ {\r
+ if (node.element() instanceof SequenceI)\r
+ {\r
+ SequenceI seq = (SequenceI) node.element();\r
+ SequenceGroup sg = av.getSelectionGroup();\r
+\r
+ if (sg != null)\r
+ {\r
+ sg.addOrRemove(seq, true);\r
+ }\r
+ }\r
+ }\r
+ }\r
+ else\r
+ {\r
+ pickNode(pickBox, (SequenceNode) node.left(), chunk, scale, width,\r
+ offx, offy);\r
+ pickNode(pickBox, (SequenceNode) node.right(), chunk, scale, width,\r
+ offx, offy);\r
+ }\r
}\r
\r
- if ( (node.left() == null) && (node.right() == null))\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param node DOCUMENT ME!\r
+ * @param c DOCUMENT ME!\r
+ */\r
+ public void setColor(SequenceNode node, Color c)\r
{\r
- float height = node.height;\r
- float dist = node.dist;\r
-\r
- int xstart = (int) ( (height - dist) * scale) + offx;\r
- int xend = (int) (height * scale) + offx;\r
-\r
- int ypos = (int) (node.ycount * chunk) + offy;\r
+ if (node == null)\r
+ {\r
+ return;\r
+ }\r
\r
- if (pickBox.contains(new Point(xend, ypos)))\r
- {\r
- if (node.element() instanceof SequenceI)\r
+ if ((node.left() == null) && (node.right() == null))\r
{\r
- SequenceI seq = (SequenceI) node.element();\r
- SequenceGroup sg = av.getSelectionGroup();\r
+ node.color = c;\r
\r
- if (sg != null)\r
- {\r
- sg.addOrRemove(seq, true);\r
- }\r
+ if (node.element() instanceof SequenceI)\r
+ {\r
+ ((SequenceI) node.element()).setColor(c);\r
+ }\r
+ }\r
+ else\r
+ {\r
+ node.color = c;\r
+ setColor((SequenceNode) node.left(), c);\r
+ setColor((SequenceNode) node.right(), c);\r
}\r
- }\r
- }\r
- else\r
- {\r
- pickNode(pickBox, (SequenceNode) node.left(), chunk, scale, width,\r
- offx, offy);\r
- pickNode(pickBox, (SequenceNode) node.right(), chunk, scale, width,\r
- offx, offy);\r
}\r
- }\r
\r
- public void setColor(SequenceNode node, Color c)\r
- {\r
- if (node == null)\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ void startPrinting()\r
{\r
- return;\r
+ Thread thread = new Thread(this);\r
+ thread.start();\r
}\r
\r
- if ( (node.left() == null) && (node.right() == null))\r
+ // put printing in a thread to avoid painting problems\r
+ public void run()\r
{\r
- node.color = c;\r
+ PrinterJob printJob = PrinterJob.getPrinterJob();\r
+ PageFormat pf = printJob.pageDialog(printJob.defaultPage());\r
\r
- if (node.element() instanceof SequenceI)\r
- {\r
- ( (SequenceI) node.element()).setColor(c);\r
- }\r
- }\r
- else\r
- {\r
- node.color = c;\r
- setColor( (SequenceNode) node.left(), c);\r
- setColor( (SequenceNode) node.right(), c);\r
+ printJob.setPrintable(this, pf);\r
+\r
+ if (printJob.printDialog())\r
+ {\r
+ try\r
+ {\r
+ printJob.print();\r
+ }\r
+ catch (Exception PrintException)\r
+ {\r
+ PrintException.printStackTrace();\r
+ }\r
+ }\r
}\r
- }\r
\r
- void startPrinting()\r
- {\r
- Thread thread = new Thread(this);\r
- thread.start();\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param pg DOCUMENT ME!\r
+ * @param pf DOCUMENT ME!\r
+ * @param pi DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ *\r
+ * @throws PrinterException DOCUMENT ME!\r
+ */\r
+ public int print(Graphics pg, PageFormat pf, int pi)\r
+ throws PrinterException\r
+ {\r
+ pg.setFont(font);\r
+ pg.translate((int) pf.getImageableX(), (int) pf.getImageableY());\r
\r
- // put printing in a thread to avoid painting problems\r
- public void run()\r
- {\r
- PrinterJob printJob = PrinterJob.getPrinterJob();\r
- PageFormat pf = printJob.pageDialog(printJob.defaultPage());\r
+ int pwidth = (int) pf.getImageableWidth();\r
+ int pheight = (int) pf.getImageableHeight();\r
\r
- printJob.setPrintable(this, pf);\r
+ int noPages = getHeight() / pheight;\r
\r
- if (printJob.printDialog())\r
- {\r
- try\r
- {\r
- printJob.print();\r
- }\r
- catch (Exception PrintException)\r
- {\r
- PrintException.printStackTrace();\r
- }\r
- }\r
- }\r
+ if (pi > noPages)\r
+ {\r
+ return Printable.NO_SUCH_PAGE;\r
+ }\r
\r
- public int print(Graphics pg, PageFormat pf, int pi)\r
- throws PrinterException\r
- {\r
- pg.setFont(font);\r
- pg.translate( (int) pf.getImageableX(), (int) pf.getImageableY());\r
+ if (pwidth > getWidth())\r
+ {\r
+ pwidth = getWidth();\r
+ }\r
\r
- int pwidth = (int) pf.getImageableWidth();\r
- int pheight = (int) pf.getImageableHeight();\r
+ if (fitToWindow)\r
+ {\r
+ if (pheight > getHeight())\r
+ {\r
+ pheight = getHeight();\r
+ }\r
\r
- int noPages = getHeight() / pheight;\r
+ noPages = 0;\r
+ }\r
+ else\r
+ {\r
+ FontMetrics fm = pg.getFontMetrics(font);\r
+ int height = fm.getHeight() * nameHash.size();\r
+ pg.translate(0, -pi * pheight);\r
+ pg.setClip(0, pi * pheight, pwidth, (pi * pheight) + pheight);\r
+\r
+ // translate number of pages,\r
+ // height is screen size as this is the\r
+ // non overlapping text size\r
+ pheight = height;\r
+ }\r
\r
- if (pi > noPages)\r
- {\r
- return Printable.NO_SUCH_PAGE;\r
- }\r
+ draw(pg, pwidth, pheight);\r
\r
- if (pwidth > getWidth())\r
- {\r
- pwidth = getWidth();\r
+ return Printable.PAGE_EXISTS;\r
}\r
\r
- if (fitToWindow)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param g DOCUMENT ME!\r
+ */\r
+ public void paintComponent(Graphics g)\r
{\r
- if (pheight > getHeight())\r
- {\r
- pheight = getHeight();\r
- }\r
+ super.paintComponent(g);\r
+ font = new Font("Verdana", Font.PLAIN, fontSize);\r
+ g.setFont(font);\r
\r
- noPages = 0;\r
- }\r
- else\r
- {\r
- FontMetrics fm = pg.getFontMetrics(font);\r
- int height = fm.getHeight() * nameHash.size();\r
- pg.translate(0, -pi * pheight);\r
- pg.setClip(0, pi * pheight, pwidth, (pi * pheight) + pheight);\r
-\r
- // translate number of pages,\r
- // height is screen size as this is the\r
- // non overlapping text size\r
- pheight = height;\r
- }\r
+ FontMetrics fm = g.getFontMetrics(font);\r
\r
- draw(pg, pwidth, pheight);\r
-\r
- return Printable.PAGE_EXISTS;\r
- }\r
+ if (nameHash.size() == 0)\r
+ {\r
+ repaint();\r
+ }\r
\r
- public void paintComponent(Graphics g)\r
- {\r
- super.paintComponent(g);\r
- font = new Font("Verdana", Font.PLAIN, fontSize);\r
- g.setFont(font);\r
+ if (fitToWindow ||\r
+ (!fitToWindow &&\r
+ (scrollPane.getHeight() > ((fm.getHeight() * nameHash.size()) +\r
+ offy))))\r
+ {\r
+ draw(g, scrollPane.getWidth(), scrollPane.getHeight());\r
+ setPreferredSize(null);\r
+ }\r
+ else\r
+ {\r
+ setPreferredSize(new Dimension(scrollPane.getWidth(),\r
+ fm.getHeight() * nameHash.size()));\r
+ draw(g, scrollPane.getWidth(), fm.getHeight() * nameHash.size());\r
+ }\r
\r
- FontMetrics fm = g.getFontMetrics(font);\r
+ scrollPane.revalidate();\r
+ }\r
\r
- if (nameHash.size() == 0)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public int getFontSize()\r
{\r
- repaint();\r
+ return fontSize;\r
}\r
\r
- if (fitToWindow ||\r
- (!fitToWindow &&\r
- (scrollPane.getHeight() > ( (fm.getHeight() * nameHash.size()) +\r
- offy))))\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param fontSize DOCUMENT ME!\r
+ */\r
+ public void setFontSize(int fontSize)\r
{\r
- draw(g, scrollPane.getWidth(), scrollPane.getHeight());\r
- setPreferredSize(null);\r
+ this.fontSize = fontSize;\r
+ repaint();\r
}\r
- else\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param g1 DOCUMENT ME!\r
+ * @param width DOCUMENT ME!\r
+ * @param height DOCUMENT ME!\r
+ */\r
+ public void draw(Graphics g1, int width, int height)\r
{\r
- setPreferredSize(new Dimension(scrollPane.getWidth(),\r
- fm.getHeight() * nameHash.size()));\r
- draw(g, scrollPane.getWidth(), fm.getHeight() * nameHash.size());\r
- }\r
+ Graphics2D g2 = (Graphics2D) g1;\r
+ g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,\r
+ RenderingHints.VALUE_ANTIALIAS_ON);\r
+ g2.setColor(Color.white);\r
+ g2.fillRect(0, 0, width, height);\r
\r
- scrollPane.revalidate();\r
- }\r
+ labelLength = g2.getFontMetrics(font).stringWidth(longestName) + 20; //20 allows for scrollbar\r
\r
- public int getFontSize()\r
- {\r
- return fontSize;\r
- }\r
+ float wscale = (float) (width - labelLength - (offx * 2)) / tree.getMaxHeight();\r
\r
- public void setFontSize(int fontSize)\r
- {\r
- this.fontSize = fontSize;\r
- repaint();\r
- }\r
+ SequenceNode top = tree.getTopNode();\r
\r
- public void draw(Graphics g1, int width, int height)\r
- {\r
- Graphics2D g2 = (Graphics2D) g1;\r
- g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,\r
- RenderingHints.VALUE_ANTIALIAS_ON);\r
- g2.setColor(Color.white);\r
- g2.fillRect(0, 0, width, height);\r
+ if (top.count == 0)\r
+ {\r
+ top.count = ((SequenceNode) top.left()).count +\r
+ ((SequenceNode) top.right()).count;\r
+ }\r
\r
- labelLength = g2.getFontMetrics(font).stringWidth(longestName) + 20; //20 allows for scrollbar\r
+ float chunk = (float) (height - (offy * 2)) / top.count;\r
\r
- float wscale = (float) (width - labelLength - (offx * 2)) /\r
- tree.getMaxHeight();\r
+ drawNode(g2, tree.getTopNode(), chunk, wscale, width, offx, offy);\r
\r
- SequenceNode top = tree.getTopNode();\r
+ if (threshold != 0)\r
+ {\r
+ if (av.getCurrentTree() == tree)\r
+ {\r
+ g2.setColor(Color.red);\r
+ }\r
+ else\r
+ {\r
+ g2.setColor(Color.gray);\r
+ }\r
+\r
+ int x = (int) ((threshold * (float) (getWidth() - labelLength -\r
+ (2 * offx))) + offx);\r
+\r
+ g2.drawLine(x, 0, x, getHeight());\r
+ }\r
+ }\r
\r
- if (top.count == 0)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void mouseReleased(MouseEvent e)\r
{\r
- top.count = ( (SequenceNode) top.left()).count +\r
- ( (SequenceNode) top.right()).count;\r
}\r
\r
- float chunk = (float) (height - (offy * 2)) / top.count;\r
-\r
- drawNode(g2, tree.getTopNode(), chunk, wscale, width, offx, offy);\r
-\r
- if (threshold != 0)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void mouseEntered(MouseEvent e)\r
{\r
- if (av.getCurrentTree() == tree)\r
- {\r
- g2.setColor(Color.red);\r
- }\r
- else\r
- {\r
- g2.setColor(Color.gray);\r
- }\r
-\r
- int x = (int) ( (threshold * (float) (getWidth() - labelLength -\r
- (2 * offx))) + offx);\r
-\r
- g2.drawLine(x, 0, x, getHeight());\r
}\r
- }\r
-\r
- public void mouseReleased(MouseEvent e)\r
- {\r
- }\r
-\r
- public void mouseEntered(MouseEvent e)\r
- {\r
- }\r
-\r
- public void mouseExited(MouseEvent e)\r
- {\r
- }\r
-\r
- public void mouseClicked(MouseEvent e)\r
- {\r
- }\r
\r
- public void mousePressed(MouseEvent e)\r
- {\r
- av.setCurrentTree(tree);\r
-\r
- int x = e.getX();\r
- int y = e.getY();\r
-\r
- Object ob = findElement(x, y);\r
-\r
- if (ob instanceof SequenceI)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void mouseExited(MouseEvent e)\r
{\r
- TreeSelectionChanged( (Sequence) ob);\r
- repaint();\r
-\r
- return;\r
}\r
- else if (ob instanceof SequenceNode)\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void mouseClicked(MouseEvent e)\r
{\r
- SequenceNode tmpnode = (SequenceNode) ob;\r
- tree.swapNodes(tmpnode);\r
- tree.reCount(tree.getTopNode());\r
- tree.findHeight(tree.getTopNode());\r
}\r
- else\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void mousePressed(MouseEvent e)\r
{\r
- // Find threshold\r
- if (tree.getMaxHeight() != 0)\r
- {\r
- threshold = (float) (x - offx) / (float) (getWidth() -\r
- labelLength - (2 * offx));\r
+ av.setCurrentTree(tree);\r
\r
- tree.getGroups().removeAllElements();\r
- tree.groupNodes(tree.getTopNode(), threshold);\r
- setColor(tree.getTopNode(), Color.black);\r
+ int x = e.getX();\r
+ int y = e.getY();\r
\r
- av.setSelectionGroup(null);\r
- av.alignment.deleteAllGroups();\r
+ Object ob = findElement(x, y);\r
\r
- for (int i = 0; i < tree.getGroups().size(); i++)\r
+ if (ob instanceof SequenceI)\r
{\r
- Color col = new Color( (int) (Math.random() * 255),\r
- (int) (Math.random() * 255),\r
- (int) (Math.random() * 255));\r
- setColor( (SequenceNode) tree.getGroups().elementAt(i),\r
- col.brighter());\r
-\r
- Vector l = tree.findLeaves( (SequenceNode) tree.getGroups()\r
- .elementAt(i),\r
- new Vector());\r
-\r
- Vector sequences = new Vector();\r
- for (int j = 0; j < l.size(); j++)\r
- {\r
- SequenceI s1 = (SequenceI) ( (SequenceNode) l.elementAt(j)).element();\r
- if (!sequences.contains(s1))\r
- sequences.addElement(s1);\r
-\r
- }\r
+ TreeSelectionChanged((Sequence) ob);\r
+ repaint();\r
\r
- ColourSchemeI cs = ColourSchemeProperty.getColour(sequences, av.alignment.getWidth(),\r
- ColourSchemeProperty.getColourName(av.getGlobalColourScheme()));\r
-\r
- SequenceGroup sg = new SequenceGroup(sequences, "TreeGroup",\r
- cs, true, true,\r
- false, 0, av.alignment.getWidth());\r
-\r
- if(sg.cs !=null)\r
- ( (ResidueColourScheme) sg.cs).setThreshold(25);\r
-\r
-\r
- if (av.getGlobalColourScheme() instanceof ConservationColourScheme)\r
- {\r
- ConservationColourScheme ccs = (ConservationColourScheme) av.\r
- getGlobalColourScheme();\r
- Conservation c = new Conservation("Group",\r
- ResidueProperties.propHash, 3,\r
- sg.sequences,\r
- sg.getStartRes(), sg.getEndRes());\r
+ return;\r
+ }\r
+ else if (ob instanceof SequenceNode)\r
+ {\r
+ SequenceNode tmpnode = (SequenceNode) ob;\r
+ tree.swapNodes(tmpnode);\r
+ tree.reCount(tree.getTopNode());\r
+ tree.findHeight(tree.getTopNode());\r
+ }\r
+ else\r
+ {\r
+ // Find threshold\r
+ if (tree.getMaxHeight() != 0)\r
+ {\r
+ threshold = (float) (x - offx) / (float) (getWidth() -\r
+ labelLength - (2 * offx));\r
+\r
+ tree.getGroups().removeAllElements();\r
+ tree.groupNodes(tree.getTopNode(), threshold);\r
+ setColor(tree.getTopNode(), Color.black);\r
+\r
+ av.setSelectionGroup(null);\r
+ av.alignment.deleteAllGroups();\r
+\r
+ for (int i = 0; i < tree.getGroups().size(); i++)\r
+ {\r
+ Color col = new Color((int) (Math.random() * 255),\r
+ (int) (Math.random() * 255),\r
+ (int) (Math.random() * 255));\r
+ setColor((SequenceNode) tree.getGroups().elementAt(i),\r
+ col.brighter());\r
+\r
+ Vector l = tree.findLeaves((SequenceNode) tree.getGroups()\r
+ .elementAt(i),\r
+ new Vector());\r
+\r
+ Vector sequences = new Vector();\r
+\r
+ for (int j = 0; j < l.size(); j++)\r
+ {\r
+ SequenceI s1 = (SequenceI) ((SequenceNode) l.elementAt(j)).element();\r
+\r
+ if (!sequences.contains(s1))\r
+ {\r
+ sequences.addElement(s1);\r
+ }\r
+ }\r
+\r
+ ColourSchemeI cs = ColourSchemeProperty.getColour(sequences,\r
+ av.alignment.getWidth(),\r
+ ColourSchemeProperty.getColourName(\r
+ av.getGlobalColourScheme()));\r
+\r
+ SequenceGroup sg = new SequenceGroup(sequences,\r
+ "TreeGroup", cs, true, true, false, 0,\r
+ av.alignment.getWidth());\r
+\r
+ if (sg.cs != null)\r
+ {\r
+ ((ResidueColourScheme) sg.cs).setThreshold(25);\r
+ }\r
+\r
+ if (av.getGlobalColourScheme() instanceof ConservationColourScheme)\r
+ {\r
+ ConservationColourScheme ccs = (ConservationColourScheme) av.getGlobalColourScheme();\r
+ Conservation c = new Conservation("Group",\r
+ ResidueProperties.propHash, 3, sg.sequences,\r
+ sg.getStartRes(), sg.getEndRes());\r
+\r
+ c.calculate();\r
+ c.verdict(false, av.ConsPercGaps);\r
+ ccs = new ConservationColourScheme(c, ccs.cs);\r
+\r
+ sg.cs = ccs;\r
+ }\r
+\r
+ av.alignment.addGroup(sg);\r
+ }\r
+ }\r
+ }\r
\r
- c.calculate();\r
- c.verdict(false, av.ConsPercGaps);\r
- ccs = new ConservationColourScheme(c, ccs.cs);\r
+ PaintRefresher.Refresh(this, av.alignment);\r
+ repaint();\r
+ }\r
\r
- sg.cs = ccs;\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param state DOCUMENT ME!\r
+ */\r
+ public void setShowDistances(boolean state)\r
+ {\r
+ this.showDistances = state;\r
+ repaint();\r
+ }\r
\r
- av.alignment.addGroup(sg);\r
- }\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param state DOCUMENT ME!\r
+ */\r
+ public void setShowBootstrap(boolean state)\r
+ {\r
+ this.showBootstrap = state;\r
+ repaint();\r
}\r
\r
- PaintRefresher.Refresh(this, av.alignment);\r
- repaint();\r
- }\r
-\r
- public void setShowDistances(boolean state)\r
- {\r
- this.showDistances = state;\r
- repaint();\r
- }\r
-\r
- public void setShowBootstrap(boolean state)\r
- {\r
- this.showBootstrap = state;\r
- repaint();\r
- }\r
-\r
- public void setMarkPlaceholders(boolean state)\r
- {\r
- this.markPlaceholders = state;\r
- repaint();\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param state DOCUMENT ME!\r
+ */\r
+ public void setMarkPlaceholders(boolean state)\r
+ {\r
+ this.markPlaceholders = state;\r
+ repaint();\r
+ }\r
}\r
*/\r
package jalview.gui;\r
\r
-import java.io.*;\r
-import java.util.*;\r
-import javax.imageio.*;\r
-\r
-import java.awt.*;\r
-import java.awt.event.*;\r
-import java.awt.image.*;\r
-import javax.swing.*;\r
-\r
-import org.jibble.epsgraphics.*;\r
import jalview.analysis.*;\r
+\r
import jalview.datamodel.*;\r
+\r
import jalview.io.*;\r
+\r
import jalview.jbgui.*;\r
\r
-public class TreePanel\r
- extends GTreePanel\r
-{\r
- SequenceI[] seq;\r
- String type;\r
- String pwtype;\r
- int start;\r
- int end;\r
- TreeCanvas treeCanvas;\r
- NJTree tree;\r
+import org.jibble.epsgraphics.*;\r
\r
- public TreePanel(AlignViewport av, Vector seqVector, String type,\r
- String pwtype, int s, int e)\r
- {\r
- super();\r
+import java.awt.*;\r
+import java.awt.event.*;\r
+import java.awt.image.*;\r
\r
- this.type = type;\r
- this.pwtype = pwtype;\r
+import java.io.*;\r
\r
- start = s;\r
- end = e;\r
+import java.util.*;\r
\r
- String longestName = "";\r
- seq = new Sequence[seqVector.size()];\r
+import javax.imageio.*;\r
+\r
+import javax.swing.*;\r
\r
- for (int i = 0; i < seqVector.size(); i++)\r
+\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class TreePanel extends GTreePanel\r
+{\r
+ SequenceI[] seq;\r
+ String type;\r
+ String pwtype;\r
+ int start;\r
+ int end;\r
+ TreeCanvas treeCanvas;\r
+ NJTree tree;\r
+\r
+ /**\r
+ * Creates a new TreePanel object.\r
+ *\r
+ * @param av DOCUMENT ME!\r
+ * @param seqVector DOCUMENT ME!\r
+ * @param type DOCUMENT ME!\r
+ * @param pwtype DOCUMENT ME!\r
+ * @param s DOCUMENT ME!\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public TreePanel(AlignViewport av, Vector seqVector, String type,\r
+ String pwtype, int s, int e)\r
{\r
- seq[i] = (Sequence) seqVector.elementAt(i);\r
+ super();\r
\r
- if (seq[i].getName().length() > longestName.length())\r
- {\r
- longestName = seq[i].getName();\r
- }\r
- }\r
+ this.type = type;\r
+ this.pwtype = pwtype;\r
\r
- tree = new NJTree(seq, type, pwtype, start, end);\r
+ start = s;\r
+ end = e;\r
\r
- treeCanvas = new TreeCanvas(av, tree, scrollPane, longestName);\r
- treeCanvas.setShowDistances(true); // We know this tree has distances. JBPNote TODO: prolly should add this as a userdefined default\r
- setViewStateFromTreeCanvas(treeCanvas);\r
- tree.reCount(tree.getTopNode());\r
- tree.findHeight(tree.getTopNode());\r
- scrollPane.setViewportView(treeCanvas);\r
- }\r
+ String longestName = "";\r
+ seq = new Sequence[seqVector.size()];\r
\r
- public TreePanel(AlignViewport av, Vector seqVector, NewickFile newtree,\r
- String type, String pwtype)\r
- {\r
- super();\r
+ for (int i = 0; i < seqVector.size(); i++)\r
+ {\r
+ seq[i] = (Sequence) seqVector.elementAt(i);\r
+\r
+ if (seq[i].getName().length() > longestName.length())\r
+ {\r
+ longestName = seq[i].getName();\r
+ }\r
+ }\r
+\r
+ tree = new NJTree(seq, type, pwtype, start, end);\r
+\r
+ treeCanvas = new TreeCanvas(av, tree, scrollPane, longestName);\r
+ treeCanvas.setShowDistances(true); // We know this tree has distances. JBPNote TODO: prolly should add this as a userdefined default\r
+ setViewStateFromTreeCanvas(treeCanvas);\r
+ tree.reCount(tree.getTopNode());\r
+ tree.findHeight(tree.getTopNode());\r
+ scrollPane.setViewportView(treeCanvas);\r
+ }\r
\r
- // These are probably only arbitrary strings reflecting source of tree\r
- this.type = type;\r
- this.pwtype = pwtype;\r
+ /**\r
+ * Creates a new TreePanel object.\r
+ *\r
+ * @param av DOCUMENT ME!\r
+ * @param seqVector DOCUMENT ME!\r
+ * @param newtree DOCUMENT ME!\r
+ * @param type DOCUMENT ME!\r
+ * @param pwtype DOCUMENT ME!\r
+ */\r
+ public TreePanel(AlignViewport av, Vector seqVector, NewickFile newtree,\r
+ String type, String pwtype)\r
+ {\r
+ super();\r
\r
- start = 0;\r
- end = seqVector.size();\r
+ // These are probably only arbitrary strings reflecting source of tree\r
+ this.type = type;\r
+ this.pwtype = pwtype;\r
\r
- String longestName = "";\r
- seq = new Sequence[seqVector.size()];\r
+ start = 0;\r
+ end = seqVector.size();\r
\r
- for (int i = 0; i < seqVector.size(); i++)\r
- {\r
- seq[i] = (Sequence) seqVector.elementAt(i);\r
- }\r
+ String longestName = "";\r
+ seq = new Sequence[seqVector.size()];\r
\r
- // This constructor matches sequence names to treenodes and sets up the tree layouts.\r
- tree = new NJTree(seq, newtree);\r
+ for (int i = 0; i < seqVector.size(); i++)\r
+ {\r
+ seq[i] = (Sequence) seqVector.elementAt(i);\r
+ }\r
\r
- // Now have to calculate longest name based on the leaves\r
- Vector leaves = tree.findLeaves(tree.getTopNode(), new Vector());\r
- boolean has_placeholders = false;\r
+ // This constructor matches sequence names to treenodes and sets up the tree layouts.\r
+ tree = new NJTree(seq, newtree);\r
\r
- for (int i = 0; i < leaves.size(); i++)\r
- {\r
- SequenceNode lf = (SequenceNode) leaves.elementAt(i);\r
-\r
- if (lf.isPlaceholder())\r
- {\r
- has_placeholders = true;\r
- }\r
-\r
- if (longestName.length() < ( (Sequence) lf.element()).getName()\r
- .length())\r
- {\r
- longestName = TreeCanvas.PLACEHOLDER +\r
- ( (Sequence) lf.element()).getName();\r
- }\r
- }\r
+ // Now have to calculate longest name based on the leaves\r
+ Vector leaves = tree.findLeaves(tree.getTopNode(), new Vector());\r
+ boolean has_placeholders = false;\r
\r
- tree.reCount(tree.getTopNode());\r
- tree.findHeight(tree.getTopNode());\r
-\r
- treeCanvas = new TreeCanvas(av, tree, scrollPane, longestName);\r
- treeCanvas.setShowBootstrap(newtree.HasBootstrap());\r
- treeCanvas.setShowDistances(newtree.HasDistances());\r
- scrollPane.setViewportView(treeCanvas);\r
- treeCanvas.setMarkPlaceholders(has_placeholders);\r
- setViewStateFromTreeCanvas(treeCanvas);\r
-\r
- // JBPNote TODO: preference for always marking placeholders in new associated tree\r
- }\r
-\r
- public NJTree getTree()\r
- {\r
- return tree;\r
- }\r
-\r
- private void setViewStateFromTreeCanvas(TreeCanvas tree)\r
- {\r
- // update view menu state from treeCanvas render state\r
- distanceMenu.setSelected(tree.showDistances);\r
- bootstrapMenu.setSelected(tree.showBootstrap);\r
- placeholdersMenu.setSelected(tree.markPlaceholders);\r
- }\r
-\r
- private void setTreeCanvasFromViewState(TreeCanvas tree)\r
- {\r
- // update view menu state from treeCanvas render state\r
- tree.showDistances = distanceMenu.isSelected();\r
- tree.showBootstrap = bootstrapMenu.isSelected();\r
- tree.markPlaceholders = placeholdersMenu.isSelected();\r
- }\r
-\r
- public void textbox_actionPerformed(ActionEvent e)\r
- {\r
- CutAndPasteTransfer cap = new CutAndPasteTransfer();\r
-\r
- StringBuffer buffer = new StringBuffer();\r
-\r
- if (type.equals("AV"))\r
- {\r
- buffer.append("Average distance tree using ");\r
+ for (int i = 0; i < leaves.size(); i++)\r
+ {\r
+ SequenceNode lf = (SequenceNode) leaves.elementAt(i);\r
+\r
+ if (lf.isPlaceholder())\r
+ {\r
+ has_placeholders = true;\r
+ }\r
+\r
+ if (longestName.length() < ((Sequence) lf.element()).getName()\r
+ .length())\r
+ {\r
+ longestName = TreeCanvas.PLACEHOLDER +\r
+ ((Sequence) lf.element()).getName();\r
+ }\r
+ }\r
+\r
+ tree.reCount(tree.getTopNode());\r
+ tree.findHeight(tree.getTopNode());\r
+\r
+ treeCanvas = new TreeCanvas(av, tree, scrollPane, longestName);\r
+ treeCanvas.setShowBootstrap(newtree.HasBootstrap());\r
+ treeCanvas.setShowDistances(newtree.HasDistances());\r
+ scrollPane.setViewportView(treeCanvas);\r
+ treeCanvas.setMarkPlaceholders(has_placeholders);\r
+ setViewStateFromTreeCanvas(treeCanvas);\r
+\r
+ // JBPNote TODO: preference for always marking placeholders in new associated tree\r
}\r
- else\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public NJTree getTree()\r
{\r
- buffer.append("Neighbour joining tree using ");\r
+ return tree;\r
}\r
\r
- if (pwtype.equals("BL"))\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param tree DOCUMENT ME!\r
+ */\r
+ private void setViewStateFromTreeCanvas(TreeCanvas tree)\r
{\r
- buffer.append("BLOSUM62");\r
+ // update view menu state from treeCanvas render state\r
+ distanceMenu.setSelected(tree.showDistances);\r
+ bootstrapMenu.setSelected(tree.showBootstrap);\r
+ placeholdersMenu.setSelected(tree.markPlaceholders);\r
}\r
- else\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param tree DOCUMENT ME!\r
+ */\r
+ private void setTreeCanvasFromViewState(TreeCanvas tree)\r
{\r
- buffer.append("PID");\r
+ // update view menu state from treeCanvas render state\r
+ tree.showDistances = distanceMenu.isSelected();\r
+ tree.showBootstrap = bootstrapMenu.isSelected();\r
+ tree.markPlaceholders = placeholdersMenu.isSelected();\r
}\r
\r
- Desktop.addInternalFrame(cap, buffer.toString(), 500, 100);\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void textbox_actionPerformed(ActionEvent e)\r
+ {\r
+ CutAndPasteTransfer cap = new CutAndPasteTransfer();\r
\r
- jalview.io.NewickFile fout = new jalview.io.NewickFile(tree.getTopNode());\r
- cap.setText(fout.print(false, true));\r
- }\r
+ StringBuffer buffer = new StringBuffer();\r
\r
- public void saveAsNewick_actionPerformed(ActionEvent e)\r
- {\r
- JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.\r
- getProperty(\r
- "LAST_DIRECTORY"));\r
- chooser.setFileView(new JalviewFileView());\r
- chooser.setDialogTitle("Save tree as newick file");\r
- chooser.setToolTipText("Save");\r
+ if (type.equals("AV"))\r
+ {\r
+ buffer.append("Average distance tree using ");\r
+ }\r
+ else\r
+ {\r
+ buffer.append("Neighbour joining tree using ");\r
+ }\r
\r
- int value = chooser.showSaveDialog(null);\r
+ if (pwtype.equals("BL"))\r
+ {\r
+ buffer.append("BLOSUM62");\r
+ }\r
+ else\r
+ {\r
+ buffer.append("PID");\r
+ }\r
\r
- if (value == JalviewFileChooser.APPROVE_OPTION)\r
- {\r
- String choice = chooser.getSelectedFile().getPath();\r
- jalview.bin.Cache.setProperty("LAST_DIRECTORY",\r
- chooser.getSelectedFile().getParent());\r
+ Desktop.addInternalFrame(cap, buffer.toString(), 500, 100);\r
\r
- try\r
- {\r
jalview.io.NewickFile fout = new jalview.io.NewickFile(tree.getTopNode());\r
- String output = fout.print(false, true); // distances only\r
- java.io.PrintWriter out = new java.io.PrintWriter(new java.io.\r
- FileWriter(\r
- choice));\r
- out.println(output);\r
- out.close();\r
- }\r
- catch (Exception ex)\r
- {\r
- ex.printStackTrace();\r
- }\r
+ cap.setText(fout.print(false, true));\r
}\r
- }\r
-\r
- public void printMenu_actionPerformed(ActionEvent e)\r
- {\r
- //Putting in a thread avoids Swing painting problems\r
- treeCanvas.startPrinting();\r
- }\r
-\r
- public void fitToWindow_actionPerformed(ActionEvent e)\r
- {\r
- treeCanvas.fitToWindow = fitToWindow.isSelected();\r
- repaint();\r
- }\r
-\r
- public void fontSize_actionPerformed(ActionEvent e)\r
- {\r
- if (treeCanvas == null)\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void saveAsNewick_actionPerformed(ActionEvent e)\r
{\r
- return;\r
- }\r
+ JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.getProperty(\r
+ "LAST_DIRECTORY"));\r
+ chooser.setFileView(new JalviewFileView());\r
+ chooser.setDialogTitle("Save tree as newick file");\r
+ chooser.setToolTipText("Save");\r
\r
- String size = fontSize.getText().substring(fontSize.getText().indexOf("-") +\r
- 1);\r
+ int value = chooser.showSaveDialog(null);\r
\r
- Object selection = JOptionPane.showInternalInputDialog(Desktop.desktop,\r
- "Select font size", "Font size", JOptionPane.QUESTION_MESSAGE,\r
- null,\r
- new String[]\r
+ if (value == JalviewFileChooser.APPROVE_OPTION)\r
{\r
- "1", "2", "4", "6", "8", "10", "12", "14", "16", "18", "20"\r
- }, "Font Size - " + size);\r
+ String choice = chooser.getSelectedFile().getPath();\r
+ jalview.bin.Cache.setProperty("LAST_DIRECTORY",\r
+ chooser.getSelectedFile().getParent());\r
+\r
+ try\r
+ {\r
+ jalview.io.NewickFile fout = new jalview.io.NewickFile(tree.getTopNode());\r
+ String output = fout.print(false, true); // distances only\r
+ java.io.PrintWriter out = new java.io.PrintWriter(new java.io.FileWriter(\r
+ choice));\r
+ out.println(output);\r
+ out.close();\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ ex.printStackTrace();\r
+ }\r
+ }\r
+ }\r
\r
- if (selection != null)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void printMenu_actionPerformed(ActionEvent e)\r
{\r
- fontSize.setText("Font Size - " + selection);\r
+ //Putting in a thread avoids Swing painting problems\r
+ treeCanvas.startPrinting();\r
+ }\r
\r
- int i = Integer.parseInt(selection.toString());\r
- treeCanvas.setFontSize(i);\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void fitToWindow_actionPerformed(ActionEvent e)\r
+ {\r
+ treeCanvas.fitToWindow = fitToWindow.isSelected();\r
+ repaint();\r
}\r
\r
- scrollPane.setViewportView(treeCanvas);\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void fontSize_actionPerformed(ActionEvent e)\r
+ {\r
+ if (treeCanvas == null)\r
+ {\r
+ return;\r
+ }\r
\r
- public void distanceMenu_actionPerformed(ActionEvent e)\r
- {\r
- treeCanvas.setShowDistances(distanceMenu.isSelected());\r
- }\r
+ String size = fontSize.getText().substring(fontSize.getText().indexOf("-") +\r
+ 1);\r
\r
- public void bootstrapMenu_actionPerformed(ActionEvent e)\r
- {\r
- treeCanvas.setShowBootstrap(bootstrapMenu.isSelected());\r
- }\r
+ Object selection = JOptionPane.showInternalInputDialog(Desktop.desktop,\r
+ "Select font size", "Font size", JOptionPane.QUESTION_MESSAGE,\r
+ null,\r
+ new String[]\r
+ {\r
+ "1", "2", "4", "6", "8", "10", "12", "14", "16", "18", "20"\r
+ }, "Font Size - " + size);\r
\r
- public void placeholdersMenu_actionPerformed(ActionEvent e)\r
- {\r
- treeCanvas.setMarkPlaceholders(placeholdersMenu.isSelected());\r
- }\r
+ if (selection != null)\r
+ {\r
+ fontSize.setText("Font Size - " + selection);\r
+\r
+ int i = Integer.parseInt(selection.toString());\r
+ treeCanvas.setFontSize(i);\r
+ }\r
\r
- public void epsTree_actionPerformed(ActionEvent e)\r
- {\r
- int width = treeCanvas.getWidth();\r
- int height = treeCanvas.getHeight();\r
+ scrollPane.setViewportView(treeCanvas);\r
+ }\r
\r
- try\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void distanceMenu_actionPerformed(ActionEvent e)\r
{\r
- jalview.io.JalviewFileChooser chooser = new jalview.io.JalviewFileChooser(\r
- jalview.bin.Cache.getProperty(\r
- "LAST_DIRECTORY"), new String[]\r
- {"eps"},\r
- new String[]\r
- {"Encapsulated Postscript"},\r
- "Encapsulated Postscript");\r
- chooser.setFileView(new jalview.io.JalviewFileView());\r
- chooser.setDialogTitle("Create EPS file from tree");\r
- chooser.setToolTipText("Save");\r
-\r
- int value = chooser.showSaveDialog(this);\r
-\r
- if (value != jalview.io.JalviewFileChooser.APPROVE_OPTION)\r
- {\r
- return;\r
- }\r
-\r
- jalview.bin.Cache.setProperty("LAST_DIRECTORY",\r
- chooser.getSelectedFile().getParent());\r
-\r
- FileOutputStream out = new FileOutputStream(chooser.getSelectedFile());\r
- EpsGraphics2D pg = new EpsGraphics2D("Tree", out, 0, 0, width,\r
- height);\r
-\r
- treeCanvas.draw(pg, width, height);\r
-\r
- pg.flush();\r
- pg.close();\r
+ treeCanvas.setShowDistances(distanceMenu.isSelected());\r
}\r
- catch (Exception ex)\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void bootstrapMenu_actionPerformed(ActionEvent e)\r
{\r
- ex.printStackTrace();\r
+ treeCanvas.setShowBootstrap(bootstrapMenu.isSelected());\r
}\r
- }\r
\r
- public void pngTree_actionPerformed(ActionEvent e)\r
- {\r
- int width = treeCanvas.getWidth();\r
- int height = treeCanvas.getHeight();\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void placeholdersMenu_actionPerformed(ActionEvent e)\r
+ {\r
+ treeCanvas.setMarkPlaceholders(placeholdersMenu.isSelected());\r
+ }\r
\r
- try\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void epsTree_actionPerformed(ActionEvent e)\r
{\r
- jalview.io.JalviewFileChooser chooser = new jalview.io.JalviewFileChooser(\r
- jalview.bin.Cache.getProperty(\r
- "LAST_DIRECTORY"), new String[]\r
- {"png"},\r
- new String[]\r
- {"Portable network graphics"},\r
- "Portable network graphics");\r
+ int width = treeCanvas.getWidth();\r
+ int height = treeCanvas.getHeight();\r
\r
- chooser.setFileView(new jalview.io.JalviewFileView());\r
- chooser.setDialogTitle("Create PNG image from tree");\r
- chooser.setToolTipText("Save");\r
+ try\r
+ {\r
+ jalview.io.JalviewFileChooser chooser = new jalview.io.JalviewFileChooser(jalview.bin.Cache.getProperty(\r
+ "LAST_DIRECTORY"), new String[] { "eps" },\r
+ new String[] { "Encapsulated Postscript" },\r
+ "Encapsulated Postscript");\r
+ chooser.setFileView(new jalview.io.JalviewFileView());\r
+ chooser.setDialogTitle("Create EPS file from tree");\r
+ chooser.setToolTipText("Save");\r
+\r
+ int value = chooser.showSaveDialog(this);\r
+\r
+ if (value != jalview.io.JalviewFileChooser.APPROVE_OPTION)\r
+ {\r
+ return;\r
+ }\r
+\r
+ jalview.bin.Cache.setProperty("LAST_DIRECTORY",\r
+ chooser.getSelectedFile().getParent());\r
+\r
+ FileOutputStream out = new FileOutputStream(chooser.getSelectedFile());\r
+ EpsGraphics2D pg = new EpsGraphics2D("Tree", out, 0, 0, width,\r
+ height);\r
+\r
+ treeCanvas.draw(pg, width, height);\r
+\r
+ pg.flush();\r
+ pg.close();\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ ex.printStackTrace();\r
+ }\r
+ }\r
\r
- int value = chooser.showSaveDialog(this);\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void pngTree_actionPerformed(ActionEvent e)\r
+ {\r
+ int width = treeCanvas.getWidth();\r
+ int height = treeCanvas.getHeight();\r
\r
- if (value != jalview.io.JalviewFileChooser.APPROVE_OPTION)\r
- {\r
- return;\r
- }\r
+ try\r
+ {\r
+ jalview.io.JalviewFileChooser chooser = new jalview.io.JalviewFileChooser(jalview.bin.Cache.getProperty(\r
+ "LAST_DIRECTORY"), new String[] { "png" },\r
+ new String[] { "Portable network graphics" },\r
+ "Portable network graphics");\r
\r
- jalview.bin.Cache.setProperty("LAST_DIRECTORY",\r
- chooser.getSelectedFile().getParent());\r
+ chooser.setFileView(new jalview.io.JalviewFileView());\r
+ chooser.setDialogTitle("Create PNG image from tree");\r
+ chooser.setToolTipText("Save");\r
\r
- FileOutputStream out = new FileOutputStream(chooser.getSelectedFile());\r
+ int value = chooser.showSaveDialog(this);\r
\r
- BufferedImage bi = new BufferedImage(width, height,\r
- BufferedImage.TYPE_INT_RGB);\r
- Graphics png = bi.getGraphics();\r
+ if (value != jalview.io.JalviewFileChooser.APPROVE_OPTION)\r
+ {\r
+ return;\r
+ }\r
\r
- treeCanvas.draw(png, width, height);\r
+ jalview.bin.Cache.setProperty("LAST_DIRECTORY",\r
+ chooser.getSelectedFile().getParent());\r
\r
- ImageIO.write(bi, "png", out);\r
- out.close();\r
- }\r
- catch (Exception ex)\r
- {\r
- ex.printStackTrace();\r
+ FileOutputStream out = new FileOutputStream(chooser.getSelectedFile());\r
+\r
+ BufferedImage bi = new BufferedImage(width, height,\r
+ BufferedImage.TYPE_INT_RGB);\r
+ Graphics png = bi.getGraphics();\r
+\r
+ treeCanvas.draw(png, width, height);\r
+\r
+ ImageIO.write(bi, "png", out);\r
+ out.close();\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ ex.printStackTrace();\r
+ }\r
}\r
- }\r
}\r
*/\r
package jalview.gui;\r
\r
-import java.io.*;\r
-import java.util.*;\r
+import jalview.datamodel.*;\r
+\r
+import jalview.io.*;\r
+\r
+import jalview.jbgui.*;\r
+\r
+import jalview.schemes.*;\r
\r
import java.awt.*;\r
import java.awt.event.*;\r
+\r
+import java.io.*;\r
+\r
+import java.util.*;\r
+\r
import javax.swing.*;\r
import javax.swing.event.*;\r
\r
-import jalview.datamodel.*;\r
-import jalview.io.*;\r
-import jalview.jbgui.*;\r
-import jalview.schemes.*;\r
\r
-public class UserDefinedColours\r
- extends GUserDefinedColours implements ChangeListener\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class UserDefinedColours extends GUserDefinedColours\r
+ implements ChangeListener\r
{\r
- AlignmentPanel ap;\r
- SequenceGroup seqGroup;\r
- JButton selectedButton;\r
- Vector oldColours = new Vector();\r
- ColourSchemeI oldColourScheme;\r
- JInternalFrame frame;\r
-\r
- public UserDefinedColours(AlignmentPanel ap, SequenceGroup sg)\r
- {\r
- super();\r
- frame = new JInternalFrame();\r
- frame.setContentPane(this);\r
- Desktop.addInternalFrame(frame, "User Defined Colours", 450, 530, false);\r
-\r
- if (System.getProperty("os.name").startsWith("Mac"))\r
+ AlignmentPanel ap;\r
+ SequenceGroup seqGroup;\r
+ Vector selectedButtons;\r
+ Vector oldColours = new Vector();\r
+ ColourSchemeI oldColourScheme;\r
+ JInternalFrame frame;\r
+\r
+ /**\r
+ * Creates a new UserDefinedColours object.\r
+ *\r
+ * @param ap DOCUMENT ME!\r
+ * @param sg DOCUMENT ME!\r
+ */\r
+ public UserDefinedColours(AlignmentPanel ap, SequenceGroup sg)\r
{\r
- frame.setSize(450, 560);\r
- }\r
+ super();\r
+ frame = new JInternalFrame();\r
+ frame.setContentPane(this);\r
+ Desktop.addInternalFrame(frame, "User Defined Colours", 450, 530, false);\r
\r
- if (sg != null)\r
- {\r
- frame.setTitle(frame.getTitle() + " (" + sg.getName() + ")");\r
- }\r
+ if (System.getProperty("os.name").startsWith("Mac"))\r
+ {\r
+ frame.setSize(450, 560);\r
+ }\r
\r
- colorChooser.getSelectionModel().addChangeListener(this);\r
+ if (sg != null)\r
+ {\r
+ frame.setTitle(frame.getTitle() + " (" + sg.getName() + ")");\r
+ }\r
\r
- this.ap = ap;\r
- seqGroup = sg;\r
+ colorChooser.getSelectionModel().addChangeListener(this);\r
\r
- if (seqGroup != null)\r
- {\r
- oldColourScheme = seqGroup.cs;\r
- }\r
- else\r
- {\r
- oldColourScheme = ap.av.getGlobalColourScheme();\r
- }\r
+ this.ap = ap;\r
+ seqGroup = sg;\r
\r
- for (int i = 0; i < 20; i++)\r
- {\r
- makeButton(ResidueProperties.aa2Triplet.get(ResidueProperties.aa[i]) +\r
- "", ResidueProperties.aa[i]);\r
- }\r
+ if (seqGroup != null)\r
+ {\r
+ oldColourScheme = seqGroup.cs;\r
+ }\r
+ else\r
+ {\r
+ oldColourScheme = ap.av.getGlobalColourScheme();\r
+ }\r
+\r
+ for (int i = 0; i < 20; i++)\r
+ {\r
+ makeButton(ResidueProperties.aa2Triplet.get(ResidueProperties.aa[i]) +\r
+ "", ResidueProperties.aa[i]);\r
+ }\r
\r
- makeButton("B", "B");\r
- makeButton("Z", "Z");\r
- makeButton("X", "X");\r
- makeButton("Gap", "'.','-',' '");\r
+ makeButton("B", "B");\r
+ makeButton("Z", "Z");\r
+ makeButton("X", "X");\r
+ makeButton("Gap", "'.','-',' '");\r
\r
- if (jalview.bin.Cache.getProperty("USER_DEFINED_COLOUR") != null)\r
- {\r
- loadColours(jalview.bin.Cache.getProperty("USER_DEFINED_COLOUR"));\r
+ if (jalview.bin.Cache.getProperty("USER_DEFINED_COLOUR") != null)\r
+ {\r
+ loadColours(jalview.bin.Cache.getProperty("USER_DEFINED_COLOUR"));\r
+ }\r
}\r
- }\r
\r
- public void stateChanged(ChangeEvent evt)\r
- {\r
- if (selectedButton != null)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ */\r
+ public void stateChanged(ChangeEvent evt)\r
{\r
- selectedButton.setBackground(colorChooser.getColor());\r
+ if (selectedButtons != null)\r
+ {\r
+ JButton button;\r
+ for(int i=0; i<selectedButtons.size(); i++)\r
+ {\r
+ button = (JButton)selectedButtons.elementAt(i);\r
+ button.setBackground(colorChooser.getColor());\r
+ button.setForeground( button.getBackground().brighter().brighter().brighter());\r
+ }\r
+ }\r
}\r
- }\r
-\r
- public void colourButtonPressed(MouseEvent e)\r
- {\r
- selectedButton = (JButton) e.getSource();\r
- colorChooser.setColor(selectedButton.getBackground());\r
- }\r
\r
- void makeButton(String label, String aa)\r
- {\r
- final JButton button = new JButton();\r
- Color col = Color.white;\r
-\r
- try\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void colourButtonPressed(MouseEvent e)\r
{\r
- col = oldColourScheme.findColour(aa, -1);\r
- }\r
- catch (Exception ex)\r
- {\r
- }\r
+ if(selectedButtons == null)\r
+ selectedButtons = new Vector();\r
\r
- button.setBackground(col);\r
- oldColours.addElement(col);\r
- button.setText(label);\r
- button.setForeground(col.darker().darker().darker());\r
- button.setFont(new java.awt.Font("Verdana", 1, 10));\r
- button.addMouseListener(new java.awt.event.MouseAdapter()\r
- {\r
- public void mouseClicked(MouseEvent e)\r
+ JButton pressed = (JButton) e.getSource();\r
+\r
+ if(e.isShiftDown())\r
{\r
- colourButtonPressed(e);\r
- }\r
- });\r
+ JButton start = (JButton)selectedButtons.elementAt(selectedButtons.size()-1);\r
+ JButton end = (JButton) e.getSource();\r
+ int startIndex=0, endIndex=0;\r
+ for(int b=0; b<buttonPanel.getComponentCount(); b++)\r
+ {\r
+ if(buttonPanel.getComponent(b)==start)\r
+ startIndex = b;\r
+ if(buttonPanel.getComponent(b)==end)\r
+ endIndex = b;\r
+ }\r
+\r
+ if(startIndex > endIndex)\r
+ {\r
+ int temp = startIndex;\r
+ startIndex = endIndex;\r
+ endIndex = temp;\r
+ }\r
\r
- buttonPanel.add(button, null);\r
- }\r
+ for(int b=startIndex; b<=endIndex; b++)\r
+ {\r
+ JButton button = (JButton)buttonPanel.getComponent(b);\r
+ if(!selectedButtons.contains(button))\r
+ {\r
+ button.setForeground(button.getBackground().brighter().brighter());\r
+ selectedButtons.add(button);\r
+ }\r
+ }\r
+ }\r
+ else if(!e.isControlDown())\r
+ {\r
+ for(int b=0; b<selectedButtons.size(); b++)\r
+ {\r
+ JButton button = (JButton)selectedButtons.elementAt(b);\r
+ button.setForeground(button.getBackground().darker().darker());\r
+ }\r
+ selectedButtons.clear();\r
+ pressed.setForeground( pressed.getBackground().brighter().brighter());\r
+ selectedButtons.addElement(pressed);\r
\r
- protected void okButton_actionPerformed(ActionEvent e)\r
- {\r
- applyButton_actionPerformed(null);\r
+ }\r
+ else if(e.isControlDown())\r
+ {\r
+ if(selectedButtons.contains(pressed))\r
+ {\r
+ pressed.setForeground(pressed.getBackground().darker().darker());\r
+ selectedButtons.remove(pressed);\r
+ }\r
+ else\r
+ {\r
+ pressed.setForeground( pressed.getBackground().brighter().brighter());\r
+ selectedButtons.addElement(pressed);\r
+ }\r
+ }\r
\r
- try\r
- {\r
- frame.setClosed(true);\r
+ if(selectedButtons.size()>0)\r
+ colorChooser.setColor( ((JButton)selectedButtons.elementAt(0)).getBackground());\r
}\r
- catch (Exception ex)\r
- {\r
- }\r
- }\r
\r
- protected void applyButton_actionPerformed(ActionEvent e)\r
- {\r
- Color[] newColours = new Color[24];\r
-\r
- for (int i = 0; i < 24; i++)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param label DOCUMENT ME!\r
+ * @param aa DOCUMENT ME!\r
+ */\r
+ void makeButton(String label, String aa)\r
{\r
- JButton button = (JButton) buttonPanel.getComponent(i);\r
- newColours[i] = button.getBackground();\r
- }\r
+ final JButton button = new JButton();\r
+ Color col = Color.white;\r
\r
- UserColourScheme ucs = new UserColourScheme(newColours);\r
- ucs.setThreshold(0);\r
+ try\r
+ {\r
+ col = oldColourScheme.findColour(aa, -1);\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ }\r
\r
- if (seqGroup != null)\r
- {\r
- seqGroup.cs = ucs;\r
- ap.repaint();\r
+ button.setBackground(col);\r
+ oldColours.addElement(col);\r
+ button.setText(label);\r
+ button.setForeground(col.darker().darker().darker());\r
+ button.setFont(new java.awt.Font("Verdana", 1, 10));\r
+ button.addMouseListener(new java.awt.event.MouseAdapter()\r
+ {\r
+ public void mouseClicked(MouseEvent e)\r
+ {\r
+ colourButtonPressed(e);\r
+ }\r
+ });\r
+\r
+ buttonPanel.add(button, null);\r
}\r
- else\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void okButton_actionPerformed(ActionEvent e)\r
{\r
- ap.alignFrame.changeColour(ucs);\r
+ applyButton_actionPerformed(null);\r
+\r
+ try\r
+ {\r
+ frame.setClosed(true);\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ }\r
}\r
- }\r
-\r
- protected void loadbutton_actionPerformed(ActionEvent e)\r
- {\r
- JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.\r
- getProperty(\r
- "LAST_DIRECTORY"), new String[]\r
- {"jc"},\r
- new String[]\r
- {"Jalview User Colours"}, "Jalview User Colours");\r
- chooser.setFileView(new jalview.io.JalviewFileView());\r
- chooser.setDialogTitle("Load colour scheme");\r
- chooser.setToolTipText("Load");\r
-\r
- int value = chooser.showOpenDialog(this);\r
-\r
- if (value == JalviewFileChooser.APPROVE_OPTION)\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void applyButton_actionPerformed(ActionEvent e)\r
{\r
- File choice = chooser.getSelectedFile();\r
- jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice.getParent());\r
- jalview.bin.Cache.setProperty("USER_DEFINED_COLOUR",\r
- choice.getPath());\r
+ Color[] newColours = new Color[24];\r
\r
- Color[] colors = loadColours(choice.getAbsolutePath());\r
+ for (int i = 0; i < 24; i++)\r
+ {\r
+ JButton button = (JButton) buttonPanel.getComponent(i);\r
+ newColours[i] = button.getBackground();\r
+ }\r
\r
- for (int i = 0; i < colors.length; i++)\r
- {\r
- JButton button = (JButton) buttonPanel.getComponent(i);\r
- button.setBackground(colors[i]);\r
- }\r
- }\r
- }\r
+ UserColourScheme ucs = new UserColourScheme(newColours);\r
+ ucs.setThreshold(0);\r
\r
- public static UserColourScheme loadDefaultColours()\r
- {\r
- if (jalview.bin.Cache.getProperty("USER_DEFINED_COLOUR") != null)\r
- {\r
- return loadDefaultColours(jalview.bin.Cache.getProperty(\r
- "USER_DEFINED_COLOUR"));\r
- }\r
- else\r
- {\r
- return null;\r
+ if (seqGroup != null)\r
+ {\r
+ seqGroup.cs = ucs;\r
+ ap.repaint();\r
+ }\r
+ else\r
+ {\r
+ ap.alignFrame.changeColour(ucs);\r
+ }\r
}\r
- }\r
-\r
- public static UserColourScheme loadDefaultColours(String file)\r
- {\r
- UserColourScheme ucs = null;\r
- Color[] cols = loadColours(file);\r
\r
- if (cols != null)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void loadbutton_actionPerformed(ActionEvent e)\r
{\r
- ucs = new UserColourScheme(cols);\r
- ucs.setThreshold(0);\r
- }\r
+ JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.getProperty(\r
+ "LAST_DIRECTORY"), new String[] { "jc" },\r
+ new String[] { "Jalview User Colours" }, "Jalview User Colours");\r
+ chooser.setFileView(new jalview.io.JalviewFileView());\r
+ chooser.setDialogTitle("Load colour scheme");\r
+ chooser.setToolTipText("Load");\r
\r
- return ucs;\r
- }\r
+ int value = chooser.showOpenDialog(this);\r
\r
- static Color[] loadColours(String file)\r
- {\r
- Color[] newColours = null;\r
+ if (value == JalviewFileChooser.APPROVE_OPTION)\r
+ {\r
+ File choice = chooser.getSelectedFile();\r
+ jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice.getParent());\r
+ jalview.bin.Cache.setProperty("USER_DEFINED_COLOUR",\r
+ choice.getPath());\r
+\r
+ Color[] colors = loadColours(choice.getAbsolutePath());\r
+\r
+ for (int i = 0; i < colors.length; i++)\r
+ {\r
+ JButton button = (JButton) buttonPanel.getComponent(i);\r
+ button.setBackground(colors[i]);\r
+ }\r
+ }\r
+ }\r
\r
- try\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public static UserColourScheme loadDefaultColours()\r
{\r
- InputStreamReader in = new InputStreamReader(new FileInputStream(\r
- file), "UTF-8");\r
+ if (jalview.bin.Cache.getProperty("USER_DEFINED_COLOUR") != null)\r
+ {\r
+ return loadDefaultColours(jalview.bin.Cache.getProperty(\r
+ "USER_DEFINED_COLOUR"));\r
+ }\r
+ else\r
+ {\r
+ return null;\r
+ }\r
+ }\r
\r
- jalview.binding.JalviewUserColours ucs = new jalview.binding.\r
- JalviewUserColours();\r
- ucs = (jalview.binding.JalviewUserColours) ucs.unmarshal(in);\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param file DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public static UserColourScheme loadDefaultColours(String file)\r
+ {\r
+ UserColourScheme ucs = null;\r
+ Color[] cols = loadColours(file);\r
\r
- newColours = new Color[ucs.getColourCount()];\r
+ if (cols != null)\r
+ {\r
+ ucs = new UserColourScheme(cols);\r
+ ucs.setThreshold(0);\r
+ }\r
\r
- for (int i = 0; i < 24; i++)\r
- {\r
- newColours[i] = new Color(Integer.parseInt(\r
- ucs.getColour(i).getRGB(), 16));\r
- }\r
+ return ucs;\r
}\r
- catch (Exception ex)\r
+\r
+ static Color[] loadColours(String file)\r
{\r
- System.out.println("Error loading UserColourFile " + file);\r
- }\r
+ Color[] newColours = null;\r
+\r
+ try\r
+ {\r
+ InputStreamReader in = new InputStreamReader(new FileInputStream(\r
+ file), "UTF-8");\r
\r
- return newColours;\r
- }\r
+ jalview.binding.JalviewUserColours ucs = new jalview.binding.JalviewUserColours();\r
+ ucs = (jalview.binding.JalviewUserColours) ucs.unmarshal(in);\r
\r
- protected void savebutton_actionPerformed(ActionEvent e)\r
- {\r
- JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.\r
- getProperty(\r
- "LAST_DIRECTORY"), new String[]\r
- {"jc"},\r
- new String[]\r
- {"Jalview User Colours"}, "Jalview User Colours");\r
+ newColours = new Color[ucs.getColourCount()];\r
\r
- chooser.setFileView(new jalview.io.JalviewFileView());\r
- chooser.setDialogTitle("Save colour scheme");\r
- chooser.setToolTipText("Save");\r
+ for (int i = 0; i < 24; i++)\r
+ {\r
+ newColours[i] = new Color(Integer.parseInt(\r
+ ucs.getColour(i).getRGB(), 16));\r
+ }\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ System.out.println("Error loading UserColourFile " + file);\r
+ }\r
\r
- int value = chooser.showSaveDialog(this);\r
+ return newColours;\r
+ }\r
\r
- if (value == JalviewFileChooser.APPROVE_OPTION)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void savebutton_actionPerformed(ActionEvent e)\r
{\r
- String choice = chooser.getSelectedFile().getPath();\r
- jalview.bin.Cache.setProperty("USER_DEFINED_COLOUR", choice);\r
+ JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.getProperty(\r
+ "LAST_DIRECTORY"), new String[] { "jc" },\r
+ new String[] { "Jalview User Colours" }, "Jalview User Colours");\r
\r
- jalview.binding.JalviewUserColours ucs = new jalview.binding.\r
- JalviewUserColours();\r
+ chooser.setFileView(new jalview.io.JalviewFileView());\r
+ chooser.setDialogTitle("Save colour scheme");\r
+ chooser.setToolTipText("Save");\r
\r
- try\r
- {\r
- PrintWriter out = new PrintWriter(new OutputStreamWriter(\r
- new FileOutputStream(choice), "UTF-8"));\r
+ int value = chooser.showSaveDialog(this);\r
\r
- for (int i = 0; i < 24; i++)\r
+ if (value == JalviewFileChooser.APPROVE_OPTION)\r
{\r
- JButton button = (JButton) buttonPanel.getComponent(i);\r
- jalview.binding.Colour col = new jalview.binding.Colour();\r
- col.setName(button.getText());\r
- col.setRGB(jalview.util.Format.getHexString(\r
- button.getBackground()));\r
- ucs.addColour(col);\r
+ String choice = chooser.getSelectedFile().getPath();\r
+ jalview.bin.Cache.setProperty("USER_DEFINED_COLOUR", choice);\r
+\r
+ jalview.binding.JalviewUserColours ucs = new jalview.binding.JalviewUserColours();\r
+\r
+ try\r
+ {\r
+ PrintWriter out = new PrintWriter(new OutputStreamWriter(\r
+ new FileOutputStream(choice), "UTF-8"));\r
+\r
+ for (int i = 0; i < 24; i++)\r
+ {\r
+ JButton button = (JButton) buttonPanel.getComponent(i);\r
+ jalview.binding.Colour col = new jalview.binding.Colour();\r
+ col.setName(button.getText());\r
+ col.setRGB(jalview.util.Format.getHexString(\r
+ button.getBackground()));\r
+ ucs.addColour(col);\r
+ }\r
+\r
+ ucs.marshal(out);\r
+ out.close();\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ ex.printStackTrace();\r
+ }\r
}\r
-\r
- ucs.marshal(out);\r
- out.close();\r
- }\r
- catch (Exception ex)\r
- {\r
- ex.printStackTrace();\r
- }\r
}\r
- }\r
-\r
- protected void cancelButton_actionPerformed(ActionEvent e)\r
- {\r
- Color[] newColours = new Color[24];\r
\r
- for (int i = 0; i < 24; i++)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void cancelButton_actionPerformed(ActionEvent e)\r
{\r
- newColours[i] = (Color) oldColours.elementAt(i);\r
- buttonPanel.getComponent(i).setBackground(newColours[i]);\r
- }\r
+ Color[] newColours = new Color[24];\r
\r
- UserColourScheme ucs = new UserColourScheme(newColours);\r
+ for (int i = 0; i < 24; i++)\r
+ {\r
+ newColours[i] = (Color) oldColours.elementAt(i);\r
+ buttonPanel.getComponent(i).setBackground(newColours[i]);\r
+ }\r
\r
- if (seqGroup != null)\r
- {\r
- seqGroup.cs = ucs;\r
- }\r
- else\r
- {\r
- ap.av.setGlobalColourScheme(ucs);\r
- }\r
+ UserColourScheme ucs = new UserColourScheme(newColours);\r
+\r
+ if (seqGroup != null)\r
+ {\r
+ seqGroup.cs = ucs;\r
+ }\r
+ else\r
+ {\r
+ ap.av.setGlobalColourScheme(ucs);\r
+ }\r
\r
- ap.repaint();\r
+ ap.repaint();\r
\r
- try\r
- {\r
- frame.setClosed(true);\r
- }\r
- catch (Exception ex)\r
- {\r
+ try\r
+ {\r
+ frame.setClosed(true);\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ }\r
}\r
- }\r
}\r
*/\r
package jalview.gui;\r
\r
+import jalview.jbgui.*;\r
+\r
import java.awt.*;\r
import java.awt.event.*;\r
+\r
import javax.swing.*;\r
\r
-import jalview.jbgui.*;\r
\r
-public class WebserviceInfo\r
- extends GWebserviceInfo\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class WebserviceInfo extends GWebserviceInfo\r
{\r
- public static final int STATE_QUEUING = 0;\r
- public static final int STATE_RUNNING = 1;\r
- public static final int STATE_STOPPED_OK = 2;\r
- public static final int STATE_CANCELLED_OK = 3;\r
- public static final int STATE_STOPPED_ERROR = 4;\r
- public static final int STATE_STOPPED_SERVERERROR = 5;\r
- int currentStatus = STATE_QUEUING;\r
- Image image;\r
- int angle = 0;\r
- String title = "";\r
- jalview.ws.WSClientI thisService;\r
- boolean serviceIsCancellable;\r
-\r
- public WebserviceInfo(String title, String info)\r
- {\r
- init(title, info, 520, 500);\r
- }\r
-\r
- public WebserviceInfo(String title, String info, int width, int height)\r
- {\r
- init(title, info, width, height);\r
- }\r
-\r
- public jalview.ws.WSClientI getthisService()\r
- {\r
- return thisService;\r
- }\r
-\r
- public void setthisService(jalview.ws.WSClientI newservice)\r
- {\r
- thisService = newservice;\r
- serviceIsCancellable = newservice.isCancellable();\r
- }\r
-\r
- void init(String title, String info, int width, int height)\r
- {\r
- JInternalFrame frame = new JInternalFrame();\r
- frame.setContentPane(this);\r
- Desktop.addInternalFrame(frame, title, width, height);\r
-\r
- this.title = title;\r
- setInfoText(info);\r
-\r
- java.net.URL url = getClass().getResource("/images/logo.gif");\r
- image = java.awt.Toolkit.getDefaultToolkit().createImage(url);\r
-\r
- MediaTracker mt = new MediaTracker(this);\r
- mt.addImage(image, 0);\r
-\r
- try\r
+ /** DOCUMENT ME!! */\r
+ public static final int STATE_QUEUING = 0;\r
+\r
+ /** DOCUMENT ME!! */\r
+ public static final int STATE_RUNNING = 1;\r
+\r
+ /** DOCUMENT ME!! */\r
+ public static final int STATE_STOPPED_OK = 2;\r
+\r
+ /** DOCUMENT ME!! */\r
+ public static final int STATE_CANCELLED_OK = 3;\r
+\r
+ /** DOCUMENT ME!! */\r
+ public static final int STATE_STOPPED_ERROR = 4;\r
+\r
+ /** DOCUMENT ME!! */\r
+ public static final int STATE_STOPPED_SERVERERROR = 5;\r
+ int currentStatus = STATE_QUEUING;\r
+ Image image;\r
+ int angle = 0;\r
+ String title = "";\r
+ jalview.ws.WSClientI thisService;\r
+ boolean serviceIsCancellable;\r
+\r
+ /**\r
+ * Creates a new WebserviceInfo object.\r
+ *\r
+ * @param title DOCUMENT ME!\r
+ * @param info DOCUMENT ME!\r
+ */\r
+ public WebserviceInfo(String title, String info)\r
{\r
- mt.waitForID(0);\r
+ init(title, info, 520, 500);\r
}\r
- catch (Exception ex)\r
+\r
+ /**\r
+ * Creates a new WebserviceInfo object.\r
+ *\r
+ * @param title DOCUMENT ME!\r
+ * @param info DOCUMENT ME!\r
+ * @param width DOCUMENT ME!\r
+ * @param height DOCUMENT ME!\r
+ */\r
+ public WebserviceInfo(String title, String info, int width, int height)\r
{\r
+ init(title, info, width, height);\r
}\r
\r
- AnimatedPanel ap = new AnimatedPanel();\r
- titlePanel.add(ap, BorderLayout.CENTER);\r
-\r
- Thread thread = new Thread(ap);\r
- thread.start();\r
- }\r
-\r
- public void setStatus(int status)\r
- {\r
- currentStatus = status;\r
- }\r
-\r
- public String getInfoText()\r
- {\r
- return infoText.getText();\r
- }\r
-\r
- public void setInfoText(String text)\r
- {\r
- infoText.setText(text);\r
- }\r
-\r
- public void appendInfoText(String text)\r
- {\r
- infoText.append(text);\r
- }\r
-\r
- public String getProgressText()\r
- {\r
- return progressText.getText();\r
- }\r
-\r
- public void setProgressText(String text)\r
- {\r
- progressText.setText(text);\r
- }\r
-\r
- public void appendProgressText(String text)\r
- {\r
- progressText.append(text);\r
- }\r
-\r
- protected void cancel_actionPerformed(ActionEvent e)\r
- {\r
- if (!serviceIsCancellable)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public jalview.ws.WSClientI getthisService()\r
{\r
- JOptionPane.showInternalMessageDialog(Desktop.desktop,\r
- "This job cannot be cancelled.",\r
- "Cancel job",\r
- JOptionPane.WARNING_MESSAGE);\r
+ return thisService;\r
}\r
- else\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param newservice DOCUMENT ME!\r
+ */\r
+ public void setthisService(jalview.ws.WSClientI newservice)\r
{\r
- thisService.cancelJob();\r
+ thisService = newservice;\r
+ serviceIsCancellable = newservice.isCancellable();\r
}\r
- }\r
-\r
- class AnimatedPanel\r
- extends JPanel implements Runnable\r
- {\r
- long startTime = 0;\r
\r
- public void run()\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param title DOCUMENT ME!\r
+ * @param info DOCUMENT ME!\r
+ * @param width DOCUMENT ME!\r
+ * @param height DOCUMENT ME!\r
+ */\r
+ void init(String title, String info, int width, int height)\r
{\r
- startTime = System.currentTimeMillis();\r
+ JInternalFrame frame = new JInternalFrame();\r
+ frame.setContentPane(this);\r
+ Desktop.addInternalFrame(frame, title, width, height);\r
\r
- while (currentStatus < STATE_STOPPED_OK)\r
- {\r
+ this.title = title;\r
+ setInfoText(info);\r
+\r
+ java.net.URL url = getClass().getResource("/images/logo.gif");\r
+ image = java.awt.Toolkit.getDefaultToolkit().createImage(url);\r
+\r
+ MediaTracker mt = new MediaTracker(this);\r
+ mt.addImage(image, 0);\r
\r
try\r
{\r
- Thread.sleep(50);\r
-\r
- int units = (int) ( (System.currentTimeMillis() - startTime) / 10f);\r
- angle += units;\r
- angle %= 360;\r
- startTime = System.currentTimeMillis();\r
- repaint();\r
+ mt.waitForID(0);\r
}\r
catch (Exception ex)\r
{\r
}\r
- }\r
\r
- angle = 0;\r
- cancel.setEnabled(false);\r
+ AnimatedPanel ap = new AnimatedPanel();\r
+ titlePanel.add(ap, BorderLayout.CENTER);\r
+\r
+ Thread thread = new Thread(ap);\r
+ thread.start();\r
}\r
\r
- synchronized public void paintComponent(Graphics g1)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param status DOCUMENT ME!\r
+ */\r
+ public void setStatus(int status)\r
{\r
- Graphics2D g = (Graphics2D) g1;\r
- g.setColor(Color.white);\r
- g.fillRect(0, 0, getWidth(), getHeight());\r
+ currentStatus = status;\r
+ }\r
\r
- if (image != null)\r
- {\r
- g.rotate(Math.toRadians(angle), 28, 28);\r
- g.drawImage(image, 10, 10, this);\r
- g.rotate( -Math.toRadians(angle), 28, 28);\r
- }\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public String getInfoText()\r
+ {\r
+ return infoText.getText();\r
+ }\r
\r
- g.setFont(new Font("Arial", Font.BOLD, 12));\r
- g.setColor(Color.black);\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param text DOCUMENT ME!\r
+ */\r
+ public void setInfoText(String text)\r
+ {\r
+ infoText.setText(text);\r
+ }\r
\r
- switch (currentStatus)\r
- {\r
- case STATE_QUEUING:\r
- g.drawString(title.concat(" - queuing"), 60, 30);\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param text DOCUMENT ME!\r
+ */\r
+ public void appendInfoText(String text)\r
+ {\r
+ infoText.append(text);\r
+ }\r
\r
- break;\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public String getProgressText()\r
+ {\r
+ return progressText.getText();\r
+ }\r
\r
- case STATE_RUNNING:\r
- g.drawString(title.concat(" - running"), 60, 30);\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param text DOCUMENT ME!\r
+ */\r
+ public void setProgressText(String text)\r
+ {\r
+ progressText.setText(text);\r
+ }\r
\r
- break;\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param text DOCUMENT ME!\r
+ */\r
+ public void appendProgressText(String text)\r
+ {\r
+ progressText.append(text);\r
+ }\r
\r
- case STATE_STOPPED_OK:\r
- g.drawString(title.concat(" - complete"), 60, 30);\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void cancel_actionPerformed(ActionEvent e)\r
+ {\r
+ if (!serviceIsCancellable)\r
+ {\r
+ JOptionPane.showInternalMessageDialog(Desktop.desktop,\r
+ "This job cannot be cancelled.", "Cancel job",\r
+ JOptionPane.WARNING_MESSAGE);\r
+ }\r
+ else\r
+ {\r
+ thisService.cancelJob();\r
+ }\r
+ }\r
\r
- break;\r
+ class AnimatedPanel extends JPanel implements Runnable\r
+ {\r
+ long startTime = 0;\r
\r
- case STATE_CANCELLED_OK:\r
- g.drawString(title.concat(" - job cancelled!"), 60, 30);\r
+ public void run()\r
+ {\r
+ startTime = System.currentTimeMillis();\r
+\r
+ while (currentStatus < STATE_STOPPED_OK)\r
+ {\r
+ try\r
+ {\r
+ Thread.sleep(50);\r
+\r
+ int units = (int) ((System.currentTimeMillis() - startTime) / 10f);\r
+ angle += units;\r
+ angle %= 360;\r
+ startTime = System.currentTimeMillis();\r
+ repaint();\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ }\r
+ }\r
+\r
+ angle = 0;\r
+ cancel.setEnabled(false);\r
+ }\r
\r
- break;\r
+ synchronized public void paintComponent(Graphics g1)\r
+ {\r
+ Graphics2D g = (Graphics2D) g1;\r
+ g.setColor(Color.white);\r
+ g.fillRect(0, 0, getWidth(), getHeight());\r
\r
- case STATE_STOPPED_ERROR:\r
- g.drawString(title.concat(" - job error!"), 60, 30);\r
+ if (image != null)\r
+ {\r
+ g.rotate(Math.toRadians(angle), 28, 28);\r
+ g.drawImage(image, 10, 10, this);\r
+ g.rotate(-Math.toRadians(angle), 28, 28);\r
+ }\r
\r
- break;\r
+ g.setFont(new Font("Arial", Font.BOLD, 12));\r
+ g.setColor(Color.black);\r
\r
- case STATE_STOPPED_SERVERERROR:\r
- g.drawString(title.concat(" - Server Error! (try later)"), 60,\r
- 30);\r
+ switch (currentStatus)\r
+ {\r
+ case STATE_QUEUING:\r
+ g.drawString(title.concat(" - queuing"), 60, 30);\r
\r
- break;\r
- }\r
+ break;\r
+\r
+ case STATE_RUNNING:\r
+ g.drawString(title.concat(" - running"), 60, 30);\r
+\r
+ break;\r
+\r
+ case STATE_STOPPED_OK:\r
+ g.drawString(title.concat(" - complete"), 60, 30);\r
+\r
+ break;\r
+\r
+ case STATE_CANCELLED_OK:\r
+ g.drawString(title.concat(" - job cancelled!"), 60, 30);\r
+\r
+ break;\r
+\r
+ case STATE_STOPPED_ERROR:\r
+ g.drawString(title.concat(" - job error!"), 60, 30);\r
+\r
+ break;\r
+\r
+ case STATE_STOPPED_SERVERERROR:\r
+ g.drawString(title.concat(" - Server Error! (try later)"), 60,\r
+ 30);\r
+\r
+ break;\r
+ }\r
+ }\r
}\r
- }\r
}\r
import java.util.*;\r
\r
\r
-public abstract class AlignFile extends FileParse {\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public abstract class AlignFile extends FileParse\r
+{\r
int noSeqs = 0;\r
int maxLength = 0;\r
Vector seqs;\r
long start;\r
long end;\r
\r
- public AlignFile() {\r
+ /**\r
+ * Creates a new AlignFile object.\r
+ */\r
+ public AlignFile()\r
+ {\r
}\r
\r
- public AlignFile(String inStr) {\r
+ /**\r
+ * Creates a new AlignFile object.\r
+ *\r
+ * @param inStr DOCUMENT ME!\r
+ */\r
+ public AlignFile(String inStr)\r
+ {\r
initData();\r
System.out.println("is this ever called??");\r
\r
- try {\r
+ try\r
+ {\r
parse();\r
- } catch (Exception ex) {\r
+ }\r
+ catch (Exception ex)\r
+ {\r
}\r
}\r
\r
* @param inFile Filename to read from.\r
* @param type What type of file to read from (File, URL)\r
*/\r
- public AlignFile(String inFile, String type) throws IOException {\r
+ public AlignFile(String inFile, String type) throws IOException\r
+ {\r
super(inFile, type);\r
\r
initData();\r
/**\r
* Return the seqs Vector\r
*/\r
- public Vector getSeqs() {\r
+ public Vector getSeqs()\r
+ {\r
return seqs;\r
}\r
\r
/**\r
* Return the Sequences in the seqs Vector as an array of Sequences\r
*/\r
- public SequenceI[] getSeqsAsArray() {\r
+ public SequenceI[] getSeqsAsArray()\r
+ {\r
SequenceI[] s = new SequenceI[seqs.size()];\r
\r
- for (int i = 0; i < seqs.size(); i++) {\r
+ for (int i = 0; i < seqs.size(); i++)\r
+ {\r
s[i] = (SequenceI) seqs.elementAt(i);\r
}\r
\r
/**\r
* Initialise objects to store sequence data in.\r
*/\r
- protected void initData() {\r
+ protected void initData()\r
+ {\r
seqs = new Vector();\r
headers = new Vector();\r
}\r
\r
- protected void setSeqs(SequenceI[] s) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param s DOCUMENT ME!\r
+ */\r
+ protected void setSeqs(SequenceI[] s)\r
+ {\r
seqs = new Vector();\r
\r
- for (int i = 0; i < s.length; i++) {\r
+ for (int i = 0; i < s.length; i++)\r
+ {\r
seqs.addElement(s[i]);\r
}\r
}\r
\r
// Checks whether sequence is valid aa characters\r
- protected boolean isValidProteinSequence(String sequence) {\r
+ protected boolean isValidProteinSequence(String sequence)\r
+ {\r
for (int i = 0; i < sequence.length(); i++)\r
if (!jalview.schemes.ResidueProperties.aaHash.containsKey(\r
- String.valueOf(sequence.charAt(i)))) {\r
+ String.valueOf(sequence.charAt(i))))\r
+ {\r
return false;\r
}\r
\r
import java.util.*;\r
\r
\r
-public class BLCFile extends AlignFile {\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class BLCFile extends AlignFile\r
+{\r
Vector titles;\r
\r
- public BLCFile() {\r
+ /**\r
+ * Creates a new BLCFile object.\r
+ */\r
+ public BLCFile()\r
+ {\r
}\r
\r
- public BLCFile(String inStr) {\r
+ /**\r
+ * Creates a new BLCFile object.\r
+ *\r
+ * @param inStr DOCUMENT ME!\r
+ */\r
+ public BLCFile(String inStr)\r
+ {\r
super(inStr);\r
}\r
\r
- public BLCFile(String inFile, String type) throws IOException {\r
+ /**\r
+ * Creates a new BLCFile object.\r
+ *\r
+ * @param inFile DOCUMENT ME!\r
+ * @param type DOCUMENT ME!\r
+ *\r
+ * @throws IOException DOCUMENT ME!\r
+ */\r
+ public BLCFile(String inFile, String type) throws IOException\r
+ {\r
super(inFile, type);\r
}\r
\r
- public void initData() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ public void initData()\r
+ {\r
super.initData();\r
titles = new Vector();\r
}\r
\r
- public void parse() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ public void parse()\r
+ {\r
boolean idsFound = false;\r
Vector ids = new Vector();\r
StringBuffer[] seqstrings;\r
\r
String line = null;\r
\r
- try {\r
- do {\r
+ try\r
+ {\r
+ do\r
+ {\r
line = nextLine();\r
\r
// seek end of ids\r
- if (line.indexOf("*") > -1) {\r
+ if (line.indexOf("*") > -1)\r
+ {\r
idsFound = true;\r
\r
break;\r
\r
int abracket = line.indexOf(">");\r
\r
- if (abracket > -1) {\r
+ if (abracket > -1)\r
+ {\r
if (line.indexOf(" ") > -1) //\r
- {\r
+ {\r
///Colur it be this format?\r
//>54402046 0 1 137 137:\r
// or this??\r
// 1 >L1H14 30539 343\r
- try {\r
+ try\r
+ {\r
ids.addElement(line.substring(abracket + 1,\r
line.indexOf(" ", abracket + 1)));\r
\r
value = Integer.parseInt(line.substring(0,\r
line.indexOf(" ")));\r
ends.addElement(value + "");\r
- } catch (Exception ex) {\r
+ }\r
+ catch (Exception ex)\r
+ {\r
System.err.println("Error during blockfile read.");\r
ex.printStackTrace();\r
starts.addElement("0");\r
ends.addElement("0");\r
}\r
- } else {\r
- if(line.indexOf("/")>-1)\r
+ }\r
+ else\r
+ {\r
+ if (line.indexOf("/") > -1)\r
{\r
- ids.addElement(line.substring(abracket + 1,\r
- line.indexOf("/")));\r
- line = line.substring(line.indexOf("/") + 1);\r
- starts.addElement(line.substring(0, line.indexOf("-")));\r
- ends.addElement(line.substring(line.indexOf("-") + 1));\r
+ ids.addElement(line.substring(abracket + 1,\r
+ line.indexOf("/")));\r
+ line = line.substring(line.indexOf("/") + 1);\r
+ starts.addElement(line.substring(0,\r
+ line.indexOf("-")));\r
+ ends.addElement(line.substring(line.indexOf("-") +\r
+ 1));\r
}\r
- else{\r
- ids.addElement(line.substring(abracket+1));\r
- starts.addElement("0");\r
- ends.addElement("0");\r
+ else\r
+ {\r
+ ids.addElement(line.substring(abracket + 1));\r
+ starts.addElement("0");\r
+ ends.addElement("0");\r
}\r
-\r
}\r
}\r
- } while (!idsFound);\r
+ }\r
+ while (!idsFound);\r
\r
int starCol = line.indexOf("*");\r
seqstrings = new StringBuffer[ids.size()];\r
\r
- for (int i = 0; i < ids.size(); i++) {\r
- if (seqstrings[i] == null) {\r
+ for (int i = 0; i < ids.size(); i++)\r
+ {\r
+ if (seqstrings[i] == null)\r
+ {\r
seqstrings[i] = new StringBuffer();\r
}\r
}\r
\r
- while ((line = nextLine()).indexOf("*") == -1) {\r
- for (int i = 0; i < ids.size(); i++) {\r
- if (line.length() > (i + starCol)) {\r
+ while ((line = nextLine()).indexOf("*") == -1)\r
+ {\r
+ for (int i = 0; i < ids.size(); i++)\r
+ {\r
+ if (line.length() > (i + starCol))\r
+ {\r
seqstrings[i].append(line.charAt(i + starCol));\r
}\r
}\r
}\r
\r
- for (int i = 0; i < ids.size(); i++) {\r
+ for (int i = 0; i < ids.size(); i++)\r
+ {\r
Sequence newSeq = new Sequence(ids.elementAt(i).toString(),\r
seqstrings[i].toString(),\r
Integer.parseInt(starts.elementAt(i).toString()),\r
Integer.parseInt(ends.elementAt(i).toString()));\r
seqs.addElement(newSeq);\r
}\r
- } catch (Exception ex) {\r
+ }\r
+ catch (Exception ex)\r
+ {\r
ex.printStackTrace();\r
}\r
}\r
\r
- public String print() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public String print()\r
+ {\r
return print(getSeqsAsArray());\r
}\r
\r
- public static String print(SequenceI[] s) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param s DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public static String print(SequenceI[] s)\r
+ {\r
StringBuffer out = new StringBuffer();\r
\r
int i = 0;\r
int max = -1;\r
\r
- while ((i < s.length) && (s[i] != null)) {\r
+ while ((i < s.length) && (s[i] != null))\r
+ {\r
out.append(">" + s[i].getName() + "/" + s[i].getStart() + "-" +\r
s[i].getEnd() + "\n");\r
\r
- if (s[i].getSequence().length() > max) {\r
+ if (s[i].getSequence().length() > max)\r
+ {\r
max = s[i].getSequence().length();\r
}\r
\r
\r
out.append("* iteration 1\n");\r
\r
- for (int j = 0; j < max; j++) {\r
+ for (int j = 0; j < max; j++)\r
+ {\r
i = 0;\r
\r
- while ((i < s.length) && (s[i] != null)) {\r
- if (s[i].getSequence().length() > j) {\r
+ while ((i < s.length) && (s[i] != null))\r
+ {\r
+ if (s[i].getSequence().length() > j)\r
+ {\r
out.append(s[i].getSequence().substring(j, j + 1));\r
- } else {\r
+ }\r
+ else\r
+ {\r
out.append("-");\r
}\r
\r
/*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
-*\r
-* This program is free software; you can redistribute it and/or\r
-* modify it under the terms of the GNU General Public License\r
-* as published by the Free Software Foundation; either version 2\r
-* of the License, or (at your option) any later version.\r
-*\r
-* This program is distributed in the hope that it will be useful,\r
-* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-* GNU General Public License for more details.\r
-*\r
-* You should have received a copy of the GNU General Public License\r
-* along with this program; if not, write to the Free Software\r
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
-*/\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
+ */\r
package jalview.io;\r
\r
-import jalview.datamodel.*;\r
-\r
-import jalview.util.*;\r
-\r
import java.io.*;\r
-\r
import java.util.*;\r
\r
+import jalview.datamodel.*;\r
+import jalview.util.*;\r
\r
-public class ClustalFile extends AlignFile {\r
- Vector ids;\r
-\r
- public ClustalFile() {\r
- }\r
-\r
- public ClustalFile(String inStr) {\r
- super(inStr);\r
- }\r
-\r
- public ClustalFile(String inFile, String type) throws IOException {\r
- super(inFile, type);\r
- }\r
-\r
- public void initData() {\r
- super.initData();\r
- ids = new Vector();\r
- }\r
+public class ClustalFile\r
+ extends AlignFile\r
+{\r
+ Vector ids;\r
+\r
+ public ClustalFile()\r
+ {\r
+ }\r
+\r
+ public ClustalFile(String inStr)\r
+ {\r
+ super(inStr);\r
+ }\r
+\r
+ public ClustalFile(String inFile, String type)\r
+ throws IOException\r
+ {\r
+ super(inFile, type);\r
+ }\r
+\r
+ public void initData()\r
+ {\r
+ super.initData();\r
+ ids = new Vector();\r
+ }\r
+\r
+ public void parse()\r
+ {\r
+ int i = 0;\r
+ boolean flag = false;\r
+\r
+ Vector headers = new Vector();\r
+ Hashtable seqhash = new Hashtable();\r
+\r
+ String line;\r
+\r
+ try\r
+ {\r
+ while ( (line = nextLine()) != null)\r
+ {\r
+ if (line.indexOf(" ") != 0)\r
+ {\r
+ StringTokenizer str = new StringTokenizer(line, " ");\r
+ String id = "";\r
+\r
+ if (str.hasMoreTokens())\r
+ {\r
+ id = str.nextToken();\r
+\r
+ if (id.equals("CLUSTAL"))\r
+ {\r
+ flag = true;\r
+ }\r
+ else\r
+ {\r
+ if (flag)\r
+ {\r
+ StringBuffer tempseq;\r
+\r
+ if (seqhash.containsKey(id))\r
+ {\r
+ tempseq = (StringBuffer) seqhash.get(id);\r
+ }\r
+ else\r
+ {\r
+ tempseq = new StringBuffer();\r
+ seqhash.put(id, tempseq);\r
+ }\r
\r
- public void parse() {\r
- int i = 0;\r
- boolean flag = false;\r
-\r
- Vector headers = new Vector();\r
- Hashtable seqhash = new Hashtable();\r
-\r
- String line;\r
-\r
- try {\r
- while ((line = nextLine()) != null) {\r
- if (line.indexOf(" ") != 0) {\r
- StringTokenizer str = new StringTokenizer(line, " ");\r
- String id = "";\r
-\r
- if (str.hasMoreTokens()) {\r
- id = str.nextToken();\r
-\r
- if (id.equals("CLUSTAL")) {\r
- flag = true;\r
- } else {\r
- if (flag) {\r
- StringBuffer tempseq;\r
-\r
- if (seqhash.containsKey(id)) {\r
- tempseq = (StringBuffer) seqhash.get(id);\r
- } else {\r
- tempseq = new StringBuffer();\r
- seqhash.put(id, tempseq);\r
- }\r
-\r
- if (!(headers.contains(id))) {\r
- headers.addElement(id);\r
- }\r
-\r
- if (str.hasMoreTokens()) {\r
- tempseq.append(str.nextToken());\r
- }\r
- }\r
- }\r
- }\r
+ if (! (headers.contains(id)))\r
+ {\r
+ headers.addElement(id);\r
}\r
- }\r
- } catch (IOException e) {\r
- System.err.println("Exception parsing clustal file " + e);\r
- e.printStackTrace();\r
- }\r
\r
- if (flag) {\r
- this.noSeqs = headers.size();\r
-\r
- //Add sequences to the hash\r
- for (i = 0; i < headers.size(); i++) {\r
- int start = -1;\r
- int end = -1;\r
-\r
- if (seqhash.get(headers.elementAt(i)) != null) {\r
- if (maxLength < seqhash.get(headers.elementAt(i)).toString()\r
- .length()) {\r
- maxLength = seqhash.get(headers.elementAt(i)).toString()\r
- .length();\r
- }\r
-\r
- String head = headers.elementAt(i).toString();\r
- start = 1;\r
- end = seqhash.get(headers.elementAt(i)).toString().length();\r
-\r
- if (head.indexOf("/") > 0) {\r
- StringTokenizer st = new StringTokenizer(head, "/");\r
-\r
- if (st.countTokens() == 2) {\r
- ids.addElement(st.nextToken());\r
-\r
- String tmp = st.nextToken();\r
- st = new StringTokenizer(tmp, "-");\r
-\r
- if (st.countTokens() == 2) {\r
- start = Integer.valueOf(st.nextToken())\r
- .intValue();\r
- end = Integer.valueOf(st.nextToken()).intValue();\r
- }\r
- } else {\r
- ids.addElement(headers.elementAt(i));\r
- }\r
- } else {\r
- ids.addElement(headers.elementAt(i));\r
- }\r
-\r
- Sequence newSeq = new Sequence(ids.elementAt(i).toString(),\r
- seqhash.get(headers.elementAt(i).toString())\r
- .toString(), start, end);\r
-\r
- seqs.addElement(newSeq);\r
- } else {\r
- System.err.println(\r
- "Clustal File Reader: Can't find sequence for " +\r
- headers.elementAt(i));\r
+ if (str.hasMoreTokens())\r
+ {\r
+ tempseq.append(str.nextToken());\r
}\r
+ }\r
}\r
+ }\r
}\r
+ }\r
}\r
-\r
- public String print() {\r
- return print(getSeqsAsArray());\r
+ catch (IOException e)\r
+ {\r
+ System.err.println("Exception parsing clustal file " + e);\r
+ e.printStackTrace();\r
}\r
\r
- public static String print(SequenceI[] s) {\r
- StringBuffer out = new StringBuffer("CLUSTAL\n\n");\r
+ if (flag)\r
+ {\r
+ this.noSeqs = headers.size();\r
+\r
+ //Add sequences to the hash\r
+ for (i = 0; i < headers.size(); i++)\r
+ {\r
+ int start = -1;\r
+ int end = -1;\r
+\r
+ if (seqhash.get(headers.elementAt(i)) != null)\r
+ {\r
+ if (maxLength < seqhash.get(headers.elementAt(i)).toString()\r
+ .length())\r
+ {\r
+ maxLength = seqhash.get(headers.elementAt(i)).toString()\r
+ .length();\r
+ }\r
+\r
+ String head = headers.elementAt(i).toString();\r
+ start = 1;\r
+ end = seqhash.get(headers.elementAt(i)).toString().length();\r
+\r
+ if (head.indexOf("/") > 0)\r
+ {\r
+ StringTokenizer st = new StringTokenizer(head, "/");\r
+\r
+ if (st.countTokens() == 2)\r
+ {\r
+ ids.addElement(st.nextToken());\r
+\r
+ String tmp = st.nextToken();\r
+ st = new StringTokenizer(tmp, "-");\r
+\r
+ if (st.countTokens() == 2)\r
+ {\r
+ start = Integer.valueOf(st.nextToken())\r
+ .intValue();\r
+ end = Integer.valueOf(st.nextToken()).intValue();\r
+ }\r
+ }\r
+ else\r
+ {\r
+ ids.addElement(headers.elementAt(i));\r
+ }\r
+ }\r
+ else\r
+ {\r
+ ids.addElement(headers.elementAt(i));\r
+ }\r
+\r
+ Sequence newSeq = new Sequence(ids.elementAt(i).toString(),\r
+ seqhash.get(headers.elementAt(i).\r
+ toString())\r
+ .toString(), start, end);\r
+\r
+ seqs.addElement(newSeq);\r
+ }\r
+ else\r
+ {\r
+ System.err.println(\r
+ "Clustal File Reader: Can't find sequence for " +\r
+ headers.elementAt(i));\r
+ }\r
+ }\r
+ }\r
+ }\r
\r
- int max = 0;\r
- int maxid = 0;\r
+ public String print()\r
+ {\r
+ return print(getSeqsAsArray());\r
+ }\r
\r
- int i = 0;\r
+ public static String print(SequenceI[] s)\r
+ {\r
+ StringBuffer out = new StringBuffer("CLUSTAL\n\n");\r
\r
- while ((i < s.length) && (s[i] != null)) {\r
- String tmp = s[i].getName() + "/" + s[i].getStart() + "-" +\r
- s[i].getEnd();\r
+ int max = 0;\r
+ int maxid = 0;\r
\r
- if (s[i].getSequence().length() > max) {\r
- max = s[i].getSequence().length();\r
- }\r
+ int i = 0;\r
\r
- if (tmp.length() > maxid) {\r
- maxid = tmp.length();\r
- }\r
+ while ( (i < s.length) && (s[i] != null))\r
+ {\r
+ String tmp = s[i].getName() + "/" + s[i].getStart() + "-" +\r
+ s[i].getEnd();\r
\r
- i++;\r
- }\r
+ if (s[i].getSequence().length() > max)\r
+ {\r
+ max = s[i].getSequence().length();\r
+ }\r
\r
- if (maxid < 15) {\r
- maxid = 15;\r
- }\r
+ if (tmp.length() > maxid)\r
+ {\r
+ maxid = tmp.length();\r
+ }\r
\r
- maxid++;\r
+ i++;\r
+ }\r
\r
- int len = 60;\r
- int nochunks = (max / len) + 1;\r
+ if (maxid < 15)\r
+ {\r
+ maxid = 15;\r
+ }\r
\r
- for (i = 0; i < nochunks; i++) {\r
- int j = 0;\r
+ maxid++;\r
\r
- while ((j < s.length) && (s[j] != null)) {\r
- out.append(new Format("%-" + maxid + "s").form(s[j].getName() +\r
- "/" + s[j].getStart() + "-" + s[j].getEnd()) + " ");\r
+ int len = 60;\r
+ int nochunks = (max / len) + 1;\r
\r
- int start = i * len;\r
- int end = start + len;\r
+ for (i = 0; i < nochunks; i++)\r
+ {\r
+ int j = 0;\r
\r
- if ((end < s[j].getSequence().length()) &&\r
- (start < s[j].getSequence().length())) {\r
- out.append(s[j].getSequence().substring(start, end));\r
- } else {\r
- if (start < s[j].getSequence().length()) {\r
- out.append(s[j].getSequence().substring(start));\r
- }\r
- }\r
+ while ( (j < s.length) && (s[j] != null))\r
+ {\r
+ out.append(new Format("%-" + maxid + "s").form(s[j].getName() +\r
+ "/" + s[j].getStart() + "-" + s[j].getEnd()) + " ");\r
\r
- out.append("\n");\r
- j++;\r
- }\r
+ int start = i * len;\r
+ int end = start + len;\r
\r
- out.append("\n");\r
+ if ( (end < s[j].getSequence().length()) &&\r
+ (start < s[j].getSequence().length()))\r
+ {\r
+ out.append(s[j].getSequence().substring(start, end));\r
+ }\r
+ else\r
+ {\r
+ if (start < s[j].getSequence().length())\r
+ {\r
+ out.append(s[j].getSequence().substring(start));\r
+ }\r
}\r
\r
- return out.toString();\r
+ out.append("\n");\r
+ j++;\r
+ }\r
+\r
+ out.append("\n");\r
}\r
+\r
+ return out.toString();\r
+ }\r
}\r
import javax.xml.rpc.ParameterMode;\r
\r
\r
-public class EBIFetchClient {\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class EBIFetchClient\r
+{\r
Call call;\r
String format = "default";\r
String style = "raw";\r
\r
- public EBIFetchClient() {\r
- try {\r
+ /**\r
+ * Creates a new EBIFetchClient object.\r
+ */\r
+ public EBIFetchClient()\r
+ {\r
+ try\r
+ {\r
call = (Call) new Service().createCall();\r
call.setTargetEndpointAddress(new java.net.URL(\r
"http://www.ebi.ac.uk/ws/services/Dbfetch"));\r
- } catch (Exception ex) {\r
+ }\r
+ catch (Exception ex)\r
+ {\r
}\r
}\r
\r
- public String[] getSupportedDBs() {\r
- try {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public String[] getSupportedDBs()\r
+ {\r
+ try\r
+ {\r
call.setOperationName(new QName("urn:Dbfetch", "getSupportedDBs"));\r
call.setReturnType(XMLType.SOAP_ARRAY);\r
\r
return (String[]) call.invoke(new Object[] { });\r
- } catch (Exception ex) {\r
+ }\r
+ catch (Exception ex)\r
+ {\r
return null;\r
}\r
}\r
\r
- public String[] getSupportedFormats() {\r
- try {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public String[] getSupportedFormats()\r
+ {\r
+ try\r
+ {\r
call.setOperationName(new QName("urn:Dbfetch", "getSupportedFormats"));\r
call.setReturnType(XMLType.SOAP_ARRAY);\r
\r
return (String[]) call.invoke(new Object[] { });\r
- } catch (Exception ex) {\r
+ }\r
+ catch (Exception ex)\r
+ {\r
return null;\r
}\r
}\r
\r
- public String[] getSupportedStyles() {\r
- try {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public String[] getSupportedStyles()\r
+ {\r
+ try\r
+ {\r
call.setOperationName(new QName("urn:Dbfetch", "getSupportedStyles"));\r
call.setReturnType(XMLType.SOAP_ARRAY);\r
\r
return (String[]) call.invoke(new Object[] { });\r
- } catch (Exception ex) {\r
+ }\r
+ catch (Exception ex)\r
+ {\r
return null;\r
}\r
}\r
\r
- public String[] fetchData(String ids, String f, String s) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param ids DOCUMENT ME!\r
+ * @param f DOCUMENT ME!\r
+ * @param s DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public String[] fetchData(String ids, String f, String s)\r
+ {\r
// ids should be of the form uniprot:25KD_SARPE;ADHR_DROPS;\r
// max 50 ids can be added at one time\r
- try {\r
+ try\r
+ {\r
call.setOperationName(new QName("urn:Dbfetch", "fetchData"));\r
call.addParameter("query", XMLType.XSD_STRING, ParameterMode.IN);\r
call.addParameter("format", XMLType.XSD_STRING, ParameterMode.IN);\r
call.addParameter("style", XMLType.XSD_STRING, ParameterMode.IN);\r
call.setReturnType(XMLType.SOAP_ARRAY);\r
\r
- if (f != null) {\r
+ if (f != null)\r
+ {\r
format = f;\r
}\r
\r
- if (s != null) {\r
+ if (s != null)\r
+ {\r
style = s;\r
}\r
\r
return (String[]) call.invoke(new Object[] { ids, format, style });\r
- } catch (Exception ex) {\r
+ }\r
+ catch (Exception ex)\r
+ {\r
return null;\r
}\r
}\r
\r
- public String fetchDataFile(String arg, String f, String s) {\r
- if (f != null) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param arg DOCUMENT ME!\r
+ * @param f DOCUMENT ME!\r
+ * @param s DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public String fetchDataFile(String arg, String f, String s)\r
+ {\r
+ if (f != null)\r
+ {\r
format = f;\r
}\r
\r
- if (s != null) {\r
+ if (s != null)\r
+ {\r
style = s;\r
}\r
\r
\r
call.setReturnType(qnameAttachment);\r
\r
- try {\r
+ try\r
+ {\r
Object ret = call.invoke(new Object[] { arg, format, style });\r
\r
- if (null == ret) {\r
+ if (null == ret)\r
+ {\r
System.err.println("Received null ");\r
throw new AxisFault("", "Received null", null, null);\r
}\r
\r
- if (ret instanceof String) {\r
+ if (ret instanceof String)\r
+ {\r
System.err.println("Received problem response from server: " +\r
ret);\r
throw new AxisFault("", (String) ret, null, null);\r
}\r
\r
- if (!(ret instanceof DataHandler)) {\r
+ if (!(ret instanceof DataHandler))\r
+ {\r
//The wrong type of object that what was expected.\r
System.err.println("Received problem response from server:" +\r
ret.getClass().getName());\r
//From here we'll just treat the data resource as file.\r
String receivedfileName = rdh.getName(); //Get the filename.\r
\r
- if (receivedfileName == null) {\r
+ if (receivedfileName == null)\r
+ {\r
System.err.println("Could not get the file name.");\r
throw new AxisFault("", "Could not get the file name.", null,\r
null);\r
}\r
\r
- if (arg.equalsIgnoreCase("medline")) {\r
+ if (arg.equalsIgnoreCase("medline"))\r
+ {\r
return receivedfileName;\r
- } else if (arg.equalsIgnoreCase("interpro")) {\r
+ }\r
+ else if (arg.equalsIgnoreCase("interpro"))\r
+ {\r
return receivedfileName;\r
- } else {\r
+ }\r
+ else\r
+ {\r
System.err.println(receivedfileName);\r
}\r
- } catch (Exception ex) {\r
+ }\r
+ catch (Exception ex)\r
+ {\r
ex.printStackTrace();\r
}\r
\r
import java.util.*;\r
\r
\r
-public class FastaFile extends AlignFile {\r
- public FastaFile() {\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class FastaFile extends AlignFile\r
+{\r
+ /**\r
+ * Creates a new FastaFile object.\r
+ */\r
+ public FastaFile()\r
+ {\r
}\r
\r
- public FastaFile(String inStr) {\r
+ /**\r
+ * Creates a new FastaFile object.\r
+ *\r
+ * @param inStr DOCUMENT ME!\r
+ */\r
+ public FastaFile(String inStr)\r
+ {\r
super(inStr);\r
}\r
\r
- public FastaFile(String inFile, String type) throws IOException {\r
+ /**\r
+ * Creates a new FastaFile object.\r
+ *\r
+ * @param inFile DOCUMENT ME!\r
+ * @param type DOCUMENT ME!\r
+ *\r
+ * @throws IOException DOCUMENT ME!\r
+ */\r
+ public FastaFile(String inFile, String type) throws IOException\r
+ {\r
super(inFile, type);\r
}\r
\r
- public void parse() throws IOException {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @throws IOException DOCUMENT ME!\r
+ */\r
+ public void parse() throws IOException\r
+ {\r
String id = "";\r
StringBuffer seq = new StringBuffer();\r
int count = 0;\r
\r
String line;\r
\r
- while ((line = nextLine()) != null) {\r
- if (line.length() > 0) {\r
+ while ((line = nextLine()) != null)\r
+ {\r
+ if (line.length() > 0)\r
+ {\r
// Do we have an id line?\r
// JBPNote - this code needs to be standardised to EBI/whatever for the\r
// >dbref/dbref/dbref|refid1|refid2|refid3 'human-readable' style of naming (should it really exist)\r
-\r
- if (line.substring(0, 1).equals(">")) {\r
- if (count != 0) {\r
- if (sstart != 0) {\r
- seqs.addElement(new Sequence(id,\r
- seq.toString(), sstart, send));\r
- } else {\r
- seqs.addElement(new Sequence(id,\r
- seq.toString(), 1,\r
+ if (line.substring(0, 1).equals(">"))\r
+ {\r
+ if (count != 0)\r
+ {\r
+ if (sstart != 0)\r
+ {\r
+ seqs.addElement(new Sequence(id, seq.toString(),\r
+ sstart, send));\r
+ }\r
+ else\r
+ {\r
+ seqs.addElement(new Sequence(id, seq.toString(), 1,\r
seq.length()));\r
}\r
}\r
\r
com.stevesoft.pat.Regex dbId = new com.stevesoft.pat.Regex(\r
"[A-Za-z-]+/?[A-Za-z-]+\\|(\\w+)\\|(.+)");\r
+\r
// JBPNote At the moment - we don't get rid of the friendly names but this\r
// behaviour is probably wrong in the long run.\r
- if (dbId.search(id)) {\r
+ if (dbId.search(id))\r
+ {\r
String dbid = dbId.stringMatched(1);\r
String idname = dbId.stringMatched(2);\r
- if ( (idname.length() > 0) &&\r
- (idname.indexOf("_") > -1)) {\r
- id = idname; // use the friendly name - apparently no dbid\r
- } else\r
- if (dbid.length()>1) {\r
+\r
+ if ((idname.length() > 0) &&\r
+ (idname.indexOf("_") > -1))\r
+ {\r
+ id = idname; // use the friendly name - apparently no dbid\r
+ }\r
+ else if (dbid.length() > 1)\r
+ {\r
id = dbid; // ignore the friendly name - we lose uniprot accession ID otherwise\r
}\r
}\r
\r
- if (id.indexOf("/") > 0) {\r
+ if (id.indexOf("/") > 0)\r
+ {\r
StringTokenizer st = new StringTokenizer(id, "/");\r
\r
- if (st.countTokens() == 2) {\r
+ if (st.countTokens() == 2)\r
+ {\r
id = st.nextToken();\r
\r
String tmp = st.nextToken();\r
\r
st = new StringTokenizer(tmp, "-");\r
\r
- if (st.countTokens() == 2) {\r
+ if (st.countTokens() == 2)\r
+ {\r
sstart = Integer.valueOf(st.nextToken())\r
.intValue();\r
send = Integer.valueOf(st.nextToken()).intValue();\r
}\r
\r
seq = new StringBuffer();\r
- } else {\r
+ }\r
+ else\r
+ {\r
seq = seq.append(line);\r
}\r
}\r
}\r
\r
- if (count > 0) {\r
- if (!isValidProteinSequence(seq.toString().toUpperCase())) {\r
+ if (count > 0)\r
+ {\r
+ if (!isValidProteinSequence(seq.toString().toUpperCase()))\r
+ {\r
throw new IOException("Invalid protein sequence");\r
}\r
\r
- if (sstart != 0) {\r
+ if (sstart != 0)\r
+ {\r
seqs.addElement(new Sequence(id, seq.toString().toUpperCase(),\r
sstart, send));\r
- } else {\r
+ }\r
+ else\r
+ {\r
seqs.addElement(new Sequence(id, seq.toString().toUpperCase(),\r
1, seq.length()));\r
}\r
}\r
}\r
\r
- public static String print(SequenceI[] s) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param s DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public static String print(SequenceI[] s)\r
+ {\r
return print(s, 72);\r
}\r
\r
- public static String print(SequenceI[] s, int len) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param s DOCUMENT ME!\r
+ * @param len DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public static String print(SequenceI[] s, int len)\r
+ {\r
return print(s, len, true);\r
}\r
\r
- public static String print(SequenceI[] s, int len, boolean gaps) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param s DOCUMENT ME!\r
+ * @param len DOCUMENT ME!\r
+ * @param gaps DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public static String print(SequenceI[] s, int len, boolean gaps)\r
+ {\r
return print(s, len, gaps, true);\r
}\r
\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param s DOCUMENT ME!\r
+ * @param len DOCUMENT ME!\r
+ * @param gaps DOCUMENT ME!\r
+ * @param displayId DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
public static String print(SequenceI[] s, int len, boolean gaps,\r
- boolean displayId) {\r
+ boolean displayId)\r
+ {\r
StringBuffer out = new StringBuffer();\r
int i = 0;\r
\r
- while ((i < s.length) && (s[i] != null)) {\r
+ while ((i < s.length) && (s[i] != null))\r
+ {\r
String seq = "";\r
\r
- if (gaps) {\r
+ if (gaps)\r
+ {\r
seq = s[i].getSequence();\r
- } else {\r
+ }\r
+ else\r
+ {\r
seq = AlignSeq.extractGaps("-. ", s[i].getSequence());\r
}\r
\r
\r
int nochunks = (seq.length() / len) + 1;\r
\r
- for (int j = 0; j < nochunks; j++) {\r
+ for (int j = 0; j < nochunks; j++)\r
+ {\r
int start = j * len;\r
int end = start + len;\r
\r
- if (end < seq.length()) {\r
+ if (end < seq.length())\r
+ {\r
out.append(seq.substring(start, end) + "\n");\r
- } else if (start < seq.length()) {\r
+ }\r
+ else if (start < seq.length())\r
+ {\r
out.append(seq.substring(start) + "\n");\r
}\r
}\r
return out.toString();\r
}\r
\r
- public String print() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public String print()\r
+ {\r
return print(getSeqsAsArray());\r
}\r
}\r
/*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
-*\r
-* This program is free software; you can redistribute it and/or\r
-* modify it under the terms of the GNU General Public License\r
-* as published by the Free Software Foundation; either version 2\r
-* of the License, or (at your option) any later version.\r
-*\r
-* This program is distributed in the hope that it will be useful,\r
-* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-* GNU General Public License for more details.\r
-*\r
-* You should have received a copy of the GNU General Public License\r
-* along with this program; if not, write to the Free Software\r
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
-*/\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
+ */\r
package jalview.io;\r
\r
import java.io.*;\r
-\r
import java.net.*;\r
\r
+public class FileParse\r
+{\r
+ public File inFile;\r
+ public int fileSize;\r
+ public int noLines;\r
+ protected String type;\r
+ protected BufferedReader dataIn;\r
\r
-public class FileParse {\r
- public File inFile;\r
- public int fileSize;\r
- public int noLines;\r
- protected String type;\r
- protected BufferedReader dataIn;\r
+ public FileParse()\r
+ {\r
+ }\r
\r
- public FileParse() {\r
- }\r
+ public FileParse(String fileStr, String type)\r
+ throws MalformedURLException, IOException\r
+ {\r
+ this.type = type;\r
\r
- public FileParse(String fileStr, String type)\r
- throws MalformedURLException, IOException {\r
- this.type = type;\r
-\r
- if (type.equals("File")) {\r
- this.inFile = new File(fileStr);\r
- this.fileSize = (int) inFile.length();\r
-\r
- dataIn = new BufferedReader(new FileReader(fileStr));\r
- } else if (type.equals("URL")) {\r
- URL url = new URL(fileStr);\r
- this.fileSize = 0;\r
- dataIn = new BufferedReader(new InputStreamReader(url.openStream()));\r
- } else if (type.equals("Paste")) {\r
- dataIn = new BufferedReader(new StringReader(fileStr));\r
- }\r
- }\r
+ if (type.equals("File"))\r
+ {\r
+ this.inFile = new File(fileStr);\r
+ this.fileSize = (int) inFile.length();\r
\r
- public String nextLine() throws IOException {\r
- String next = dataIn.readLine();\r
+ dataIn = new BufferedReader(new FileReader(fileStr));\r
+ }\r
+ else if (type.equals("URL"))\r
+ {\r
+ URL url = new URL(fileStr);\r
+ this.fileSize = 0;\r
+ dataIn = new BufferedReader(new InputStreamReader(url.openStream()));\r
+ }\r
+ else if (type.equals("Paste"))\r
+ {\r
+ dataIn = new BufferedReader(new StringReader(fileStr));\r
+ }\r
+ }\r
\r
- if (next != null) {\r
- noLines++;\r
- }\r
+ public String nextLine()\r
+ throws IOException\r
+ {\r
+ String next = dataIn.readLine();\r
\r
- return next;\r
+ if (next != null)\r
+ {\r
+ noLines++;\r
}\r
+\r
+ return next;\r
+ }\r
}\r
import java.util.Vector;\r
\r
\r
-public class FormatAdapter {\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class FormatAdapter\r
+{\r
+ /** DOCUMENT ME!! */\r
public static Vector formats = new Vector();\r
\r
- static {\r
+ static\r
+ {\r
formats.addElement("FASTA");\r
formats.addElement("MSF");\r
formats.addElement("PileUp");\r
formats.addElement("PFAM");\r
}\r
\r
- public static SequenceI[] readFile(String inFile, String type, String format) {\r
- try {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param inFile DOCUMENT ME!\r
+ * @param type DOCUMENT ME!\r
+ * @param format DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public static SequenceI[] readFile(String inFile, String type, String format)\r
+ {\r
+ try\r
+ {\r
AlignFile afile = null;\r
\r
- if (format.equals("FASTA")) {\r
+ if (format.equals("FASTA"))\r
+ {\r
afile = new FastaFile(inFile, type);\r
- } else if (format.equals("MSF")) {\r
+ }\r
+ else if (format.equals("MSF"))\r
+ {\r
afile = new MSFfile(inFile, type);\r
- } else if (format.equals("PileUp")) {\r
+ }\r
+ else if (format.equals("PileUp"))\r
+ {\r
afile = new PileUpfile(inFile, type);\r
- } else if (format.equals("CLUSTAL")) {\r
+ }\r
+ else if (format.equals("CLUSTAL"))\r
+ {\r
afile = new ClustalFile(inFile, type);\r
- } else if (format.equals("BLC")) {\r
+ }\r
+ else if (format.equals("BLC"))\r
+ {\r
afile = new BLCFile(inFile, type);\r
- } else if (format.equals("PIR")) {\r
+ }\r
+ else if (format.equals("PIR"))\r
+ {\r
afile = new PIRFile(inFile, type);\r
- } else if (format.equals("PFAM")) {\r
+ }\r
+ else if (format.equals("PFAM"))\r
+ {\r
afile = new PfamFile(inFile, type);\r
}\r
\r
return afile.getSeqsAsArray();\r
- } catch (Exception e) {\r
+ }\r
+ catch (Exception e)\r
+ {\r
System.err.println("Failed to read alignment using the '" + format +\r
"' reader.");\r
e.printStackTrace();\r
return null;\r
}\r
\r
- public static String formatSequences(String format, Vector seqs) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param format DOCUMENT ME!\r
+ * @param seqs DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public static String formatSequences(String format, Vector seqs)\r
+ {\r
SequenceI[] s = new SequenceI[seqs.size()];\r
\r
for (int i = 0; i < seqs.size(); i++)\r
s[i] = (SequenceI) seqs.elementAt(i);\r
\r
- try {\r
+ try\r
+ {\r
AlignFile afile = null;\r
\r
- if (format.equals("FASTA")) {\r
+ if (format.equalsIgnoreCase("FASTA"))\r
+ {\r
afile = new FastaFile();\r
- } else if (format.equals("MSF")) {\r
+ }\r
+ else if (format.equalsIgnoreCase("MSF"))\r
+ {\r
afile = new MSFfile();\r
- } else if (format.equals("PileUp")) {\r
+ }\r
+ else if (format.equalsIgnoreCase("PileUp"))\r
+ {\r
afile = new PileUpfile();\r
- } else if (format.equals("CLUSTAL")) {\r
+ }\r
+ else if (format.equalsIgnoreCase("CLUSTAL"))\r
+ {\r
afile = new ClustalFile();\r
- } else if (format.equals("BLC")) {\r
+ }\r
+ else if (format.equalsIgnoreCase("BLC"))\r
+ {\r
afile = new BLCFile();\r
- } else if (format.equals("PIR")) {\r
+ }\r
+ else if (format.equalsIgnoreCase("PIR"))\r
+ {\r
afile = new PIRFile();\r
- } else if (format.equals("PFAM")) {\r
+ }\r
+ else if (format.equalsIgnoreCase("PFAM"))\r
+ {\r
afile = new PfamFile();\r
}\r
\r
afile.setSeqs(s);\r
\r
return afile.print();\r
- } catch (Exception e) {\r
+ }\r
+ catch (Exception e)\r
+ {\r
System.err.println("Failed to write alignment as a '" + format +\r
"' file\n");\r
e.printStackTrace();\r
/*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
-*\r
-* This program is free software; you can redistribute it and/or\r
-* modify it under the terms of the GNU General Public License\r
-* as published by the Free Software Foundation; either version 2\r
-* of the License, or (at your option) any later version.\r
-*\r
-* This program is distributed in the hope that it will be useful,\r
-* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-* GNU General Public License for more details.\r
-*\r
-* You should have received a copy of the GNU General Public License\r
-* along with this program; if not, write to the Free Software\r
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
-*/\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
+ */\r
package jalview.io;\r
\r
-import jalview.datamodel.*;\r
-\r
-import jalview.gui.*;\r
-\r
-import jalview.schemes.*;\r
-\r
-import java.awt.*;\r
-\r
import java.io.*;\r
\r
-import java.util.*;\r
-\r
-import javax.swing.*;\r
-\r
-\r
-public class HTMLOutput {\r
- AlignViewport av;\r
- SequenceRenderer sr;\r
- Color color;\r
-\r
- public HTMLOutput(AlignViewport av) {\r
- this.av = av;\r
- sr = new SequenceRenderer(av);\r
-\r
- JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.getProperty(\r
- "LAST_DIRECTORY"), new String[] { "html" },\r
- new String[] { "HTML files" }, "HTML files");\r
-\r
- chooser.setFileView(new JalviewFileView());\r
- chooser.setDialogTitle("Save as HTML");\r
- chooser.setToolTipText("Save");\r
-\r
- int value = chooser.showSaveDialog(null);\r
-\r
- if (value == JalviewFileChooser.APPROVE_OPTION) {\r
- String choice = chooser.getSelectedFile().getPath();\r
- jalview.bin.Cache.setProperty("LAST_DIRECTORY",\r
- chooser.getSelectedFile().getParent());\r
-\r
- try {\r
- PrintWriter out = new java.io.PrintWriter(new java.io.FileWriter(\r
- choice));\r
- out.println("<HTML>");\r
- out.println("<style type=\"text/css\">");\r
- out.println("<!--");\r
- out.print("td {font-family: \"" + av.getFont().getFamily() +\r
- "\", \"" + av.getFont().getName() + "\", mono; " +\r
- "font-size: " + av.getFont().getSize() + "px; ");\r
-\r
- if (av.getFont().getStyle() == Font.BOLD) {\r
- out.print("font-weight: BOLD; ");\r
- }\r
-\r
- if (av.getFont().getStyle() == Font.ITALIC) {\r
- out.print("font-style: italic; ");\r
- }\r
-\r
- out.println("text-align: center; }");\r
-\r
- out.println("-->");\r
- out.println("</style>");\r
- out.println("<BODY>");\r
+import java.awt.*;\r
\r
- if (av.getWrapAlignment()) {\r
- drawWrappedAlignment(out);\r
- } else {\r
- drawUnwrappedAlignment(out);\r
- }\r
+import jalview.datamodel.*;\r
+import jalview.gui.*;\r
+import jalview.schemes.*;\r
\r
- out.println("\n</body>\n</html>");\r
- out.close();\r
- jalview.util.BrowserLauncher.openURL("file:///" + choice);\r
- } catch (Exception ex) {\r
- ex.printStackTrace();\r
- }\r
+public class HTMLOutput\r
+{\r
+ AlignViewport av;\r
+ SequenceRenderer sr;\r
+ Color color;\r
+\r
+ public HTMLOutput(AlignViewport av)\r
+ {\r
+ this.av = av;\r
+ sr = new SequenceRenderer(av);\r
+\r
+ JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.\r
+ getProperty(\r
+ "LAST_DIRECTORY"), new String[]\r
+ {"html"},\r
+ new String[]\r
+ {"HTML files"}, "HTML files");\r
+\r
+ chooser.setFileView(new JalviewFileView());\r
+ chooser.setDialogTitle("Save as HTML");\r
+ chooser.setToolTipText("Save");\r
+\r
+ int value = chooser.showSaveDialog(null);\r
+\r
+ if (value == JalviewFileChooser.APPROVE_OPTION)\r
+ {\r
+ String choice = chooser.getSelectedFile().getPath();\r
+ jalview.bin.Cache.setProperty("LAST_DIRECTORY",\r
+ chooser.getSelectedFile().getParent());\r
+\r
+ try\r
+ {\r
+ PrintWriter out = new java.io.PrintWriter(new java.io.FileWriter(\r
+ choice));\r
+ out.println("<HTML>");\r
+ out.println("<style type=\"text/css\">");\r
+ out.println("<!--");\r
+ out.print("td {font-family: \"" + av.getFont().getFamily() +\r
+ "\", \"" + av.getFont().getName() + "\", mono; " +\r
+ "font-size: " + av.getFont().getSize() + "px; ");\r
+\r
+ if (av.getFont().getStyle() == Font.BOLD)\r
+ {\r
+ out.print("font-weight: BOLD; ");\r
}\r
- }\r
\r
- void drawUnwrappedAlignment(PrintWriter out) {\r
- out.println("<table border=\"1\"><tr><td>\n");\r
- out.println(\r
- "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n");\r
+ if (av.getFont().getStyle() == Font.ITALIC)\r
+ {\r
+ out.print("font-style: italic; ");\r
+ }\r
\r
- //////////////\r
- SequenceGroup[] groups;\r
- SequenceI seq;\r
- ColourSchemeI cs = null;\r
- AlignmentI alignment = av.getAlignment();\r
- String r;\r
- String g;\r
- String b;\r
+ out.println("text-align: center; }");\r
\r
- // draws the top row, the measure rule\r
- out.println("<tr><td colspan=\"6\"></td>");\r
+ out.println("-->");\r
+ out.println("</style>");\r
+ out.println("<BODY>");\r
\r
- int i = 0;\r
+ if (av.getWrapAlignment())\r
+ {\r
+ drawWrappedAlignment(out);\r
+ }\r
+ else\r
+ {\r
+ drawUnwrappedAlignment(out);\r
+ }\r
\r
- for (i = 10; i < (alignment.getWidth() - 10); i += 10)\r
- out.println("<td colspan=\"9\">" + i + "<br>|</td><td></td>");\r
+ out.println("\n</body>\n</html>");\r
+ out.close();\r
+ jalview.util.BrowserLauncher.openURL("file:///" + choice);\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ ex.printStackTrace();\r
+ }\r
+ }\r
+ }\r
+\r
+ void drawUnwrappedAlignment(PrintWriter out)\r
+ {\r
+ out.println("<table border=\"1\"><tr><td>\n");\r
+ out.println(\r
+ "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n");\r
+\r
+ //////////////\r
+ SequenceGroup[] groups;\r
+ SequenceI seq;\r
+ ColourSchemeI cs = null;\r
+ AlignmentI alignment = av.getAlignment();\r
+ String r;\r
+ String g;\r
+ String b;\r
+\r
+ // draws the top row, the measure rule\r
+ out.println("<tr><td colspan=\"6\"></td>");\r
+\r
+ int i = 0;\r
+\r
+ for (i = 10; i < (alignment.getWidth() - 10); i += 10)\r
+ {\r
+ out.println("<td colspan=\"9\">" + i + "<br>|</td><td></td>");\r
+ }\r
\r
- out.println("<td colspan=\"3\"></td><td colspan=\"3\">" + i +\r
- "<br>|</td>");\r
- out.println("</tr>");\r
+ out.println("<td colspan=\"3\"></td><td colspan=\"3\">" + i +\r
+ "<br>|</td>");\r
+ out.println("</tr>");\r
\r
- for (i = 0; i < alignment.getHeight(); i++) {\r
- seq = alignment.getSequenceAt(i);\r
- groups = alignment.findAllGroups(seq);\r
+ for (i = 0; i < alignment.getHeight(); i++)\r
+ {\r
+ seq = alignment.getSequenceAt(i);\r
+ groups = alignment.findAllGroups(seq);\r
\r
- if (av.getShowFullId()) {\r
- out.println("<tr><td nowrap>" + seq.getDisplayId() +\r
+ if (av.getShowFullId())\r
+ {\r
+ out.println("<tr><td nowrap>" + seq.getDisplayId() +\r
" </td>");\r
- } else {\r
- out.println("<tr><td nowrap>" + seq.getName() +\r
+ }\r
+ else\r
+ {\r
+ out.println("<tr><td nowrap>" + seq.getName() +\r
" </td>");\r
+ }\r
+\r
+ for (int res = 0; res < seq.getLength(); res++)\r
+ {\r
+ cs = av.getGlobalColourScheme();\r
+\r
+ if (groups != null)\r
+ {\r
+ for (int k = 0; k < groups.length; k++)\r
+ {\r
+ if ( (groups[k].getStartRes() <= res) &&\r
+ (groups[k].getEndRes() >= res))\r
+ {\r
+ cs = groups[k].cs;\r
+\r
+ break;\r
}\r
+ }\r
+ }\r
\r
- for (int res = 0; res < seq.getLength(); res++) {\r
- cs = av.getGlobalColourScheme();\r
-\r
- if (groups != null) {\r
- for (int k = 0; k < groups.length; k++)\r
- if ((groups[k].getStartRes() <= res) &&\r
- (groups[k].getEndRes() >= res)) {\r
- cs = groups[k].cs;\r
-\r
- break;\r
- }\r
- }\r
-\r
- color = sr.getResidueBoxColour(cs, seq, res);\r
+ color = sr.getResidueBoxColour(cs, seq, res);\r
\r
- if (color.getRGB() < -1) {\r
- out.println("<td bgcolor=\"#" +\r
- jalview.util.Format.getHexString(color) + "\">" +\r
- seq.getCharAt(res) + "</td>");\r
- } else {\r
- out.println("<td>" + seq.getCharAt(res) + "</td>");\r
- }\r
- }\r
-\r
- out.println("</tr>");\r
+ if (color.getRGB() < -1)\r
+ {\r
+ out.println("<td bgcolor=\"#" +\r
+ jalview.util.Format.getHexString(color) + "\">" +\r
+ seq.getCharAt(res) + "</td>");\r
+ }\r
+ else\r
+ {\r
+ out.println("<td>" + seq.getCharAt(res) + "</td>");\r
}\r
+ }\r
\r
- //////////////\r
- out.println("</table>");\r
- out.println("</td></tr></table>");\r
+ out.println("</tr>");\r
}\r
\r
- void drawWrappedAlignment(PrintWriter out) {\r
- ////////////////////////////////////\r
- /// How many sequences and residues can we fit on a printable page?\r
- AlignmentI al = av.getAlignment();\r
- SequenceGroup[] groups;\r
- SequenceI seq;\r
- ColourSchemeI cs = null;\r
- String r;\r
- String g;\r
- String b;\r
-\r
- out.println("<table border=\"1\"><tr><td>\n");\r
- out.println(\r
- "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n");\r
-\r
- for (int startRes = 0; startRes < al.getWidth();\r
- startRes += av.getChunkWidth()) {\r
- int endRes = startRes + av.getChunkWidth();\r
-\r
- if (endRes > al.getWidth()) {\r
- endRes = al.getWidth();\r
- }\r
-\r
- out.println("<tr>");\r
- out.println("<td colspan=\"6\"> </td>");\r
-\r
- for (int i = startRes + 10; i < endRes; i += 10)\r
- out.println("<td colspan=\"9\">" + i + "<br>|</td><td></td>");\r
-\r
- // out.println("<td colspan=\"3\"></td><td colspan=\"3\">" + i +\r
- // "<br>|</td>");\r
- out.println("</tr>");\r
-\r
- for (int s = 0; s < al.getHeight(); s++) {\r
- out.println("<tr>");\r
- seq = al.getSequenceAt(s);\r
- groups = al.findAllGroups(seq);\r
-\r
- if (av.getShowFullId()) {\r
- out.println("<td nowrap>" + seq.getDisplayId() +\r
- " </td>");\r
- } else {\r
- out.println("<td nowrap>" + seq.getName() +\r
- " </td>");\r
- }\r
-\r
- for (int res = startRes; res < endRes; res++) {\r
- cs = av.getGlobalColourScheme();\r
-\r
- if (groups != null) {\r
- for (int k = 0; k < groups.length; k++)\r
- if ((groups[k].getStartRes() <= res) &&\r
- (groups[k].getEndRes() >= res)) {\r
- cs = groups[k].cs;\r
-\r
- break;\r
- }\r
- }\r
-\r
- color = sr.getResidueBoxColour(cs, seq, res);\r
+ //////////////\r
+ out.println("</table>");\r
+ out.println("</td></tr></table>");\r
+ }\r
+\r
+ void drawWrappedAlignment(PrintWriter out)\r
+ {\r
+ ////////////////////////////////////\r
+ /// How many sequences and residues can we fit on a printable page?\r
+ AlignmentI al = av.getAlignment();\r
+ SequenceGroup[] groups;\r
+ SequenceI seq;\r
+ ColourSchemeI cs = null;\r
+ String r;\r
+ String g;\r
+ String b;\r
+\r
+ out.println("<table border=\"1\"><tr><td>\n");\r
+ out.println(\r
+ "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n");\r
+\r
+ for (int startRes = 0; startRes < al.getWidth();\r
+ startRes += av.getChunkWidth())\r
+ {\r
+ int endRes = startRes + av.getChunkWidth();\r
+\r
+ if (endRes > al.getWidth())\r
+ {\r
+ endRes = al.getWidth();\r
+ }\r
+\r
+ out.println("<tr>");\r
+ out.println("<td colspan=\"6\"> </td>");\r
+\r
+ for (int i = startRes + 10; i < endRes; i += 10)\r
+ {\r
+ out.println("<td colspan=\"9\">" + i + "<br>|</td><td></td>");\r
+ }\r
+\r
+ // out.println("<td colspan=\"3\"></td><td colspan=\"3\">" + i +\r
+ // "<br>|</td>");\r
+ out.println("</tr>");\r
+\r
+ for (int s = 0; s < al.getHeight(); s++)\r
+ {\r
+ out.println("<tr>");\r
+ seq = al.getSequenceAt(s);\r
+ groups = al.findAllGroups(seq);\r
+\r
+ if (av.getShowFullId())\r
+ {\r
+ out.println("<td nowrap>" + seq.getDisplayId() +\r
+ " </td>");\r
+ }\r
+ else\r
+ {\r
+ out.println("<td nowrap>" + seq.getName() +\r
+ " </td>");\r
+ }\r
\r
- if (color.getRGB() < -1) {\r
- r = Integer.toHexString(color.getRed());\r
+ for (int res = startRes; res < endRes; res++)\r
+ {\r
+ cs = av.getGlobalColourScheme();\r
+\r
+ if (groups != null)\r
+ {\r
+ for (int k = 0; k < groups.length; k++)\r
+ {\r
+ if ( (groups[k].getStartRes() <= res) &&\r
+ (groups[k].getEndRes() >= res))\r
+ {\r
+ cs = groups[k].cs;\r
+\r
+ break;\r
+ }\r
+ }\r
+ }\r
\r
- if (r.length() < 2) {\r
- r = "0" + r;\r
- }\r
+ color = sr.getResidueBoxColour(cs, seq, res);\r
\r
- g = Integer.toHexString(color.getGreen());\r
+ if (color.getRGB() < -1)\r
+ {\r
+ r = Integer.toHexString(color.getRed());\r
\r
- if (g.length() < 2) {\r
- g = "0" + g;\r
- }\r
+ if (r.length() < 2)\r
+ {\r
+ r = "0" + r;\r
+ }\r
\r
- b = Integer.toHexString(color.getBlue());\r
+ g = Integer.toHexString(color.getGreen());\r
\r
- if (b.length() < 2) {\r
- b = "0" + b;\r
- }\r
+ if (g.length() < 2)\r
+ {\r
+ g = "0" + g;\r
+ }\r
\r
- out.println("<td bgcolor=\"#" + r + g + b + "\">" +\r
- seq.getCharAt(res) + "</td>");\r
- } else {\r
- out.println("<td>" + seq.getCharAt(res) + "</td>");\r
- }\r
- }\r
+ b = Integer.toHexString(color.getBlue());\r
\r
- out.println("</tr>");\r
+ if (b.length() < 2)\r
+ {\r
+ b = "0" + b;\r
}\r
\r
- if (endRes < al.getWidth()) {\r
- out.println("<tr><td height=\"5\"></td></tr>");\r
- }\r
+ out.println("<td bgcolor=\"#" + r + g + b + "\">" +\r
+ seq.getCharAt(res) + "</td>");\r
+ }\r
+ else\r
+ {\r
+ out.println("<td>" + seq.getCharAt(res) + "</td>");\r
+ }\r
}\r
\r
- out.println("</table>");\r
- out.println("</table>");\r
+ out.println("</tr>");\r
+ }\r
+\r
+ if (endRes < al.getWidth())\r
+ {\r
+ out.println("<tr><td height=\"5\"></td></tr>");\r
+ }\r
}\r
+\r
+ out.println("</table>");\r
+ out.println("</table>");\r
+ }\r
+\r
+ public static String getImageMapHTML()\r
+ {\r
+ return new String(\r
+ "<html>\n"\r
+ +"<head>\n"\r
+ +"<script language=\"JavaScript\">\n"\r
+ +"var ns4 = document.layers;\n"\r
+ +"var ns6 = document.getElementById && !document.all;\n"\r
+ +"var ie4 = document.all;\n"\r
+ +"offsetX = 0;\n"\r
+ +"offsetY = 20;\n"\r
+ +"var toolTipSTYLE=\"\";\n"\r
+ +"function initToolTips()\n"\r
+ +"{\n"\r
+ +" if(ns4||ns6||ie4)\n"\r
+ +" {\n"\r
+ +" if(ns4) toolTipSTYLE = document.toolTipLayer;\n"\r
+ +" else if(ns6) toolTipSTYLE = document.getElementById(\"toolTipLayer\").style;\n"\r
+ +" else if(ie4) toolTipSTYLE = document.all.toolTipLayer.style;\n"\r
+ +" if(ns4) document.captureEvents(Event.MOUSEMOVE);\n"\r
+ +" else\n"\r
+ +" {\n"\r
+ +" toolTipSTYLE.visibility = \"visible\";\n"\r
+ +" toolTipSTYLE.display = \"none\";\n"\r
+ +" }\n"\r
+ +" document.onmousemove = moveToMouseLoc;\n"\r
+ +" }\n"\r
+ +"}\n"\r
+ +"function toolTip(msg, fg, bg)\n"\r
+ +"{\n"\r
+ +" if(toolTip.arguments.length < 1) // hide\n"\r
+ +" {\n"\r
+ +" if(ns4) toolTipSTYLE.visibility = \"hidden\";\n"\r
+ +" else toolTipSTYLE.display = \"none\";\n"\r
+ +" }\n"\r
+ +" else // show\n"\r
+ +" {\n"\r
+ +" if(!fg) fg = \"#555555\";\n"\r
+ +" if(!bg) bg = \"#FFFFFF\";\n"\r
+ +" var content =\n"\r
+ +" '<table border=\"0\" cellspacing=\"0\" cellpadding=\"1\" bgcolor=\"' + fg + '\"><td>' +\n"\r
+ +" '<table border=\"0\" cellspacing=\"0\" cellpadding=\"1\" bgcolor=\"' + bg + \n"\r
+ +" '\"><td align=\"center\"><font face=\"sans-serif\" color=\"' + fg +\n"\r
+ +" '\" size=\"-2\"> ' + msg +\n"\r
+ +" ' </font></td></table></td></table>';\n"\r
+ +" if(ns4)\n"\r
+ +" {\n"\r
+ +" toolTipSTYLE.document.write(content);\n"\r
+ +" toolTipSTYLE.document.close();\n"\r
+ +" toolTipSTYLE.visibility = \"visible\";\n"\r
+ +" }\n"\r
+ +" if(ns6)\n"\r
+ +" {\n"\r
+ +" document.getElementById(\"toolTipLayer\").innerHTML = content;\n"\r
+ +" toolTipSTYLE.display='block'\n"\r
+ +" }\n"\r
+ +" if(ie4)\n"\r
+ +" {\n"\r
+ +" document.all(\"toolTipLayer\").innerHTML=content;\n"\r
+ +" toolTipSTYLE.display='block'\n"\r
+ +" }\n"\r
+ +" }\n"\r
+ +"}\n"\r
+ +"function moveToMouseLoc(e)\n"\r
+ +"{\n"\r
+ +" if(ns4||ns6)\n"\r
+ +" {\n"\r
+ +" x = e.pageX;\n"\r
+ +" y = e.pageY;\n"\r
+ +" }\n"\r
+ +" else\n"\r
+ +" {\n"\r
+ +" x = event.x + document.body.scrollLeft;\n"\r
+ +" y = event.y + document.body.scrollTop;\n"\r
+ +" }\n"\r
+ +" toolTipSTYLE.left = x + offsetX;\n"\r
+ +" toolTipSTYLE.top = y + offsetY;\n"\r
+ +" return true;\n"\r
+ +"}\n"\r
+ +"</script>\n"\r
+ +"</head>\n"\r
+ +"<body>\n"\r
+ +"<div id=\"toolTipLayer\" style=\"position:absolute; visibility: hidden\"></div>\n"\r
+ +"<script language=\"JavaScript\"><!--\n"\r
+ +"initToolTips(); //--></script>\n");\r
+\r
+ }\r
}\r
import java.net.*;\r
\r
\r
-public class IdentifyFile {\r
- public static String Identify(String file, String protocol) {\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class IdentifyFile\r
+{\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param file DOCUMENT ME!\r
+ * @param protocol DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public static String Identify(String file, String protocol)\r
+ {\r
String reply = "PFAM";\r
\r
- try {\r
+ try\r
+ {\r
BufferedReader reader = null;\r
\r
- if (protocol.equals("File")) {\r
+ if (protocol.equals("File"))\r
+ {\r
reader = new BufferedReader(new FileReader(file));\r
}\r
- else if (protocol.equals("URL")) {\r
+ else if (protocol.equals("URL"))\r
+ {\r
reply = "URL NOT FOUND";\r
\r
URL url = new URL(file);\r
reader = new BufferedReader(new InputStreamReader(\r
url.openStream()));\r
reply = "error";\r
- } else if (protocol.equals("Paste")) {\r
+ }\r
+ else if (protocol.equals("Paste"))\r
+ {\r
reader = new BufferedReader(new StringReader(file));\r
}\r
\r
String data;\r
\r
- while ((data = reader.readLine()) != null) {\r
+ while ((data = reader.readLine()) != null)\r
+ {\r
data = data.toUpperCase();\r
\r
- if ((data.indexOf("#") == 0) || (data.length() < 1)) {\r
+ if ((data.indexOf("#") == 0) || (data.length() < 1))\r
+ {\r
continue;\r
}\r
\r
- if (data.indexOf("PILEUP") > -1) {\r
+ if (data.indexOf("PILEUP") > -1)\r
+ {\r
reply = "PileUp";\r
\r
break;\r
if ((data.indexOf("//") == 0) ||\r
((data.indexOf("!!") > -1) &&\r
(data.indexOf("!!") < data.indexOf(\r
- "_MULTIPLE_ALIGNMENT ")))) {\r
+ "_MULTIPLE_ALIGNMENT "))))\r
+ {\r
reply = "MSF";\r
\r
break;\r
- } else if (data.indexOf("CLUSTAL") > -1) {\r
+ }\r
+ else if (data.indexOf("CLUSTAL") > -1)\r
+ {\r
reply = "CLUSTAL";\r
\r
break;\r
- } else if ((data.indexOf(">P1;") > -1) ||\r
- (data.indexOf(">DL;") > -1)) {\r
+ }\r
+ else if ((data.indexOf(">P1;") > -1) ||\r
+ (data.indexOf(">DL;") > -1))\r
+ {\r
reply = "PIR";\r
\r
break;\r
- } else if (data.indexOf(">") > -1) {\r
+ }\r
+ else if (data.indexOf(">") > -1)\r
+ {\r
// could be BLC file, read next line to confirm\r
data = reader.readLine();\r
\r
- if (data.indexOf(">") > -1) {\r
+ if (data.indexOf(">") > -1)\r
+ {\r
reply = "BLC";\r
- } else {\r
+ }\r
+ else\r
+ {\r
reply = "FASTA";\r
}\r
\r
}\r
\r
reader.close();\r
- } catch (Exception ex) {\r
+ }\r
+ catch (Exception ex)\r
+ {\r
System.err.println("File Identification failed!\n" + ex);\r
}\r
\r
import java.util.*;\r
\r
\r
-public class JPredFile extends AlignFile {\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class JPredFile extends AlignFile\r
+{\r
Vector ids;\r
Vector conf;\r
Hashtable Scores; // Hash of names and score vectors\r
Hashtable Symscores; // indexes of symbol annotation properties in sequenceI vector\r
private int QuerySeqPosition;\r
\r
- public JPredFile(String inStr) {\r
+ /**\r
+ * Creates a new JPredFile object.\r
+ *\r
+ * @param inStr DOCUMENT ME!\r
+ */\r
+ public JPredFile(String inStr)\r
+ {\r
super(inStr);\r
}\r
\r
- public JPredFile(String inFile, String type) throws IOException {\r
+ /**\r
+ * Creates a new JPredFile object.\r
+ *\r
+ * @param inFile DOCUMENT ME!\r
+ * @param type DOCUMENT ME!\r
+ *\r
+ * @throws IOException DOCUMENT ME!\r
+ */\r
+ public JPredFile(String inFile, String type) throws IOException\r
+ {\r
super(inFile, type);\r
}\r
\r
- public void setQuerySeqPosition(int QuerySeqPosition) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param QuerySeqPosition DOCUMENT ME!\r
+ */\r
+ public void setQuerySeqPosition(int QuerySeqPosition)\r
+ {\r
this.QuerySeqPosition = QuerySeqPosition;\r
}\r
\r
- public int getQuerySeqPosition() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public int getQuerySeqPosition()\r
+ {\r
return QuerySeqPosition;\r
}\r
\r
- public Hashtable getScores() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public Hashtable getScores()\r
+ {\r
return Scores;\r
}\r
\r
- public Hashtable getSymscores() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public Hashtable getSymscores()\r
+ {\r
return Symscores;\r
}\r
\r
- public void initData() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ public void initData()\r
+ {\r
super.initData();\r
Scores = new Hashtable();\r
ids = null;\r
/**
* parse a JPred concise file into a sequence-alignment like object.
*/\r
- public void parse() throws IOException {\r
+ public void parse() throws IOException\r
+ {\r
// JBPNote log.System.out.println("all read in ");\r
String line;\r
QuerySeqPosition = -1;\r
Vector ids = new Vector();\r
Hashtable Symscores = new Hashtable();\r
\r
- while ((line = nextLine()) != null) {\r
+ while ((line = nextLine()) != null)\r
+ {\r
// Concise format allows no comments or non comma-formatted data\r
StringTokenizer str = new StringTokenizer(line, ":");\r
String id = "";\r
\r
- if (!str.hasMoreTokens()) {\r
+ if (!str.hasMoreTokens())\r
+ {\r
continue;\r
}\r
\r
// decide if we have more than just alphanumeric symbols\r
int numSymbols = symbols.countTokens();\r
\r
- if (numSymbols == 0) {\r
+ if (numSymbols == 0)\r
+ {\r
continue;\r
}\r
\r
- if (seqsym.length() != (2 * numSymbols)) {\r
+ if (seqsym.length() != (2 * numSymbols))\r
+ {\r
// Set of scalars for some property\r
- if (Scores.containsKey(id)) {\r
+ if (Scores.containsKey(id))\r
+ {\r
int i = 1;\r
\r
- while (Scores.containsKey(id + "_" + i)) {\r
+ while (Scores.containsKey(id + "_" + i))\r
+ {\r
i++;\r
}\r
\r
int i = 0;\r
String ascore = "dead";\r
\r
- try {\r
+ try\r
+ {\r
// store elements as floats...\r
- while (symbols.hasMoreTokens()) {\r
+ while (symbols.hasMoreTokens())\r
+ {\r
ascore = symbols.nextToken();\r
\r
Float score = new Float(ascore);\r
}\r
\r
Scores.put(id, scores);\r
- } catch (Exception e) {\r
+ }\r
+ catch (Exception e)\r
+ {\r
// or just keep them as strings\r
i = scores.size();\r
\r
- for (int j = 0; j < i; j++) {\r
+ for (int j = 0; j < i; j++)\r
+ {\r
scores.set(j,\r
(Object) ((Float) scores.get(j)).toString());\r
}\r
\r
scores.addElement((Object) ascore);\r
\r
- while (symbols.hasMoreTokens()) {\r
+ while (symbols.hasMoreTokens())\r
+ {\r
ascore = symbols.nextToken();\r
scores.addElement((Object) ascore);\r
}\r
\r
Scores.put(id, scores);\r
}\r
- } else if (id.equals("jnetconf")) {\r
+ }\r
+ else if (id.equals("jnetconf"))\r
+ {\r
// log.debug System.out.println("here");\r
id = "Prediction Confidence";\r
this.conf = new Vector(numSymbols);\r
\r
- for (int i = 0; i < numSymbols; i++) {\r
+ for (int i = 0; i < numSymbols; i++)\r
+ {\r
conf.set(i, (Object) symbols.nextToken());\r
}\r
- } else {\r
+ }\r
+ else\r
+ {\r
// Sequence or a prediction string (rendered as sequence)\r
StringBuffer newseq = new StringBuffer();\r
\r
- for (int i = 0; i < numSymbols; i++) {\r
+ for (int i = 0; i < numSymbols; i++)\r
+ {\r
newseq.append(symbols.nextToken());\r
}\r
\r
- if (id.indexOf(";") > -1) {\r
+ if (id.indexOf(";") > -1)\r
+ {\r
seq_entries.addElement(newseq);\r
\r
int i = 1;\r
String name = id.substring(id.indexOf(";") + 1);\r
\r
- while (ids.lastIndexOf(name) > -1) {\r
+ while (ids.lastIndexOf(name) > -1)\r
+ {\r
name = id.substring(id.indexOf(";") + 1) + "_" + 1;\r
}\r
\r
ids.addElement(name);\r
\r
noSeqs++;\r
- } else {\r
- if (id.equals("JNETPRED")) {\r
+ }\r
+ else\r
+ {\r
+ if (id.equals("JNETPRED"))\r
+ {\r
id = "Predicted Secondary Structure";\r
}\r
\r
}\r
}\r
\r
- if (noSeqs < 1) {\r
+ if (noSeqs < 1)\r
+ {\r
throw new IOException(\r
"JpredFile Parser: No sequence in the prediction!");\r
}\r
\r
maxLength = seq_entries.elementAt(0).toString().length();\r
\r
- for (int i = 0; i < ids.size(); i++) {\r
+ for (int i = 0; i < ids.size(); i++)\r
+ {\r
// Add all sequence like objects\r
Sequence newSeq = new Sequence(ids.elementAt(i).toString(),\r
seq_entries.elementAt(i).toString(), 1,\r
seq_entries.elementAt(i).toString().length());\r
\r
if (!Symscores.containsKey(ids.elementAt(i)) &&\r
- !isValidProteinSequence(newSeq.getSequence())) {\r
+ !isValidProteinSequence(newSeq.getSequence()))\r
+ {\r
throw new IOException(\r
"JPredConcise: Not a valid protein sequence - (" +\r
ids.elementAt(i).toString() + ")");\r
}\r
\r
- if (maxLength != seq_entries.elementAt(i).toString().length()) {\r
+ if (maxLength != seq_entries.elementAt(i).toString().length())\r
+ {\r
throw new IOException("JPredConcise: Entry (" +\r
ids.elementAt(i).toString() +\r
") has an unexpected number of columns");\r
}\r
\r
if (newSeq.getName().startsWith("QUERY") &&\r
- (QuerySeqPosition == -1)) {\r
+ (QuerySeqPosition == -1))\r
+ {\r
QuerySeqPosition = seqs.size();\r
}\r
\r
*
* @return String
*/\r
- public String print() {\r
+ public String print()\r
+ {\r
return "Not Supported";\r
}\r
\r
- public static void main(String[] args) {\r
- try {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param args DOCUMENT ME!\r
+ */\r
+ public static void main(String[] args)\r
+ {\r
+ try\r
+ {\r
JPredFile blc = new JPredFile(args[0], "File");\r
\r
- for (int i = 0; i < blc.seqs.size(); i++) {\r
+ for (int i = 0; i < blc.seqs.size(); i++)\r
+ {\r
System.out.println(((Sequence) blc.seqs.elementAt(i)).getName() +\r
"\n" + ((Sequence) blc.seqs.elementAt(i)).getSequence() +\r
"\n");\r
}\r
- } catch (java.io.IOException e) {\r
+ }\r
+ catch (java.io.IOException e)\r
+ {\r
System.err.println("Exception " + e);\r
e.printStackTrace();\r
}\r
/*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
-*\r
-* This program is free software; you can redistribute it and/or\r
-* modify it under the terms of the GNU General Public License\r
-* as published by the Free Software Foundation; either version 2\r
-* of the License, or (at your option) any later version.\r
-*\r
-* This program is distributed in the hope that it will be useful,\r
-* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-* GNU General Public License for more details.\r
-*\r
-* You should have received a copy of the GNU General Public License\r
-* along with this program; if not, write to the Free Software\r
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
-*/\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
+ */\r
/*///////////////////////////////////////////////////////////////////\r
// This file was taken from java forum\r
// Re: JFileChooser functioning like normal Windows Apps FileChooser\r
//////////////////////////////////////////////////////////////////\r
package jalview.io;\r
\r
-import java.awt.*;\r
-import java.awt.event.*;\r
-\r
import java.io.*;\r
-\r
import java.util.*;\r
\r
+import java.awt.*;\r
+import java.awt.event.*;\r
import javax.swing.*;\r
import javax.swing.plaf.*;\r
import javax.swing.plaf.basic.*;\r
import javax.swing.plaf.metal.*;\r
import javax.swing.table.*;\r
\r
+public class JalviewFileChooser\r
+ extends JFileChooser\r
+{\r
\r
-public class JalviewFileChooser extends JFileChooser {\r
- private static final int COLUMN_FILENAME = 0;\r
- private static final int COLUMN_FILESIZE = 1;\r
- private static final int COLUMN_FILETYPE = 2;\r
- private static final int COLUMN_FILEDATE = 3;\r
- private static final int COLUMN_FILEATTR = 4;\r
- private static final int COLUMN_COLCOUNT = 5;\r
- private static String[] COLUMNS = null;\r
-\r
- public JalviewFileChooser(String dir, String[] suffix, String[] desc,\r
- String selected) {\r
- super(dir);\r
\r
- JalviewFileFilter chosen = null;\r
+ public JalviewFileChooser(String dir, String[] suffix, String[] desc,\r
+ String selected)\r
+ {\r
+ super(dir);\r
\r
- for (int i = 0; i < suffix.length; i++) {\r
- JalviewFileFilter jvf = new JalviewFileFilter(suffix[i], desc[i]);\r
- addChoosableFileFilter(jvf);\r
-\r
- if ((selected != null) && selected.equalsIgnoreCase(desc[i])) {\r
- chosen = jvf;\r
- }\r
- }\r
+ JalviewFileFilter chosen = null;\r
\r
- if (chosen != null) {\r
- setFileFilter(chosen);\r
- }\r
+ for (int i = 0; i < suffix.length; i++)\r
+ {\r
+ JalviewFileFilter jvf = new JalviewFileFilter(suffix[i], desc[i]);\r
+ addChoosableFileFilter(jvf);\r
\r
- initColumns();\r
+ if ( (selected != null) && selected.equalsIgnoreCase(desc[i]))\r
+ {\r
+ chosen = jvf;\r
+ }\r
}\r
\r
- public JalviewFileChooser(String dir) {\r
- super(dir);\r
- initColumns();\r
+ if (chosen != null)\r
+ {\r
+ setFileFilter(chosen);\r
}\r
\r
- public String getSelectedFormat() {\r
- String format = getFileFilter().getDescription();\r
-\r
- if (format.toUpperCase().startsWith("JALVIEW")) {\r
- format = "Jalview";\r
- } else if (format.toUpperCase().startsWith("FASTA")) {\r
- format = "FASTA";\r
- } else if (format.toUpperCase().startsWith("MSF")) {\r
- format = "MSF";\r
- } else if (format.toUpperCase().startsWith("CLUSTAL")) {\r
- format = "CLUSTAL";\r
- } else if (format.toUpperCase().startsWith("BLC")) {\r
- format = "BLC";\r
- } else if (format.toUpperCase().startsWith("PIR")) {\r
- format = "PIR";\r
- } else if (format.toUpperCase().startsWith("PFAM")) {\r
- format = "PFAM";\r
- }\r
+ }\r
+\r
+\r
+ public void setFileFilter(javax.swing.filechooser.FileFilter filter)\r
+ {\r
+ super.setFileFilter(filter);\r
+\r
+ if (!(getUI() instanceof BasicFileChooserUI)) {\r
+ return;\r
+ }\r
+\r
+ final BasicFileChooserUI ui = (BasicFileChooserUI) getUI();\r
+ final String name = ui.getFileName().trim();\r
+\r
+ if ((name == null) || (name.length() == 0)) {\r
+ return;\r
+ }\r
+\r
+ EventQueue.invokeLater(new Thread() {\r
+ public void run() {\r
+ String currentName = ui.getFileName();\r
+ if ((currentName == null) || (currentName.length() == 0)) {\r
+ ui.setFileName(name);\r
+ }\r
+ }\r
+ });\r
+ }\r
+\r
\r
- return format;\r
+ public JalviewFileChooser(String dir)\r
+ {\r
+ super(dir);\r
+ }\r
+\r
+ public String getSelectedFormat()\r
+ {\r
+ String format = getFileFilter().getDescription();\r
+\r
+ if (format.toUpperCase().startsWith("JALVIEW"))\r
+ {\r
+ format = "Jalview";\r
+ }\r
+ else if (format.toUpperCase().startsWith("FASTA"))\r
+ {\r
+ format = "FASTA";\r
+ }\r
+ else if (format.toUpperCase().startsWith("MSF"))\r
+ {\r
+ format = "MSF";\r
+ }\r
+ else if (format.toUpperCase().startsWith("CLUSTAL"))\r
+ {\r
+ format = "CLUSTAL";\r
+ }\r
+ else if (format.toUpperCase().startsWith("BLC"))\r
+ {\r
+ format = "BLC";\r
+ }\r
+ else if (format.toUpperCase().startsWith("PIR"))\r
+ {\r
+ format = "PIR";\r
+ }\r
+ else if (format.toUpperCase().startsWith("PFAM"))\r
+ {\r
+ format = "PFAM";\r
}\r
\r
- public int showSaveDialog(Component parent) throws HeadlessException {\r
- setDialogType(SAVE_DIALOG);\r
+ return format;\r
+ }\r
\r
- int ret = showDialog(parent, null);\r
+ public int showSaveDialog(Component parent)\r
+ throws HeadlessException\r
+ {\r
+ setDialogType(SAVE_DIALOG);\r
\r
- if (getFileFilter() instanceof JalviewFileFilter) {\r
- JalviewFileFilter jvf = (JalviewFileFilter) getFileFilter();\r
+ int ret = showDialog(parent, null);\r
\r
- if (!jvf.accept(getSelectedFile())) {\r
- String withExtension = getSelectedFile() + "." +\r
- jvf.getAcceptableExtension();\r
- setSelectedFile(new File(withExtension));\r
- }\r
- }\r
+ if (getFileFilter() instanceof JalviewFileFilter)\r
+ {\r
+ JalviewFileFilter jvf = (JalviewFileFilter) getFileFilter();\r
\r
- if ((ret == JalviewFileChooser.APPROVE_OPTION) &&\r
- getSelectedFile().exists()) {\r
- int confirm = JOptionPane.showConfirmDialog(parent,\r
- "Overwrite existing file?", "File exists",\r
- JOptionPane.YES_NO_OPTION);\r
+ if (!jvf.accept(getSelectedFile()))\r
+ {\r
+ String withExtension = getSelectedFile() + "." +\r
+ jvf.getAcceptableExtension();\r
+ setSelectedFile(new File(withExtension));\r
+ }\r
+ }\r
\r
- if (confirm != JOptionPane.YES_OPTION) {\r
- ret = this.CANCEL_OPTION;\r
- }\r
- }\r
+ if ( (ret == JalviewFileChooser.APPROVE_OPTION) &&\r
+ getSelectedFile().exists())\r
+ {\r
+ int confirm = JOptionPane.showConfirmDialog(parent,\r
+ "Overwrite existing file?",\r
+ "File exists",\r
+ JOptionPane.YES_NO_OPTION);\r
+\r
+ if (confirm != JOptionPane.YES_OPTION)\r
+ {\r
+ ret = this.CANCEL_OPTION;\r
+ }\r
+ }\r
+\r
+ return ret;\r
+ }\r
+\r
+ /**************************************************************************\r
+ * Always create the local UI\r
+ * @param comp\r
+ *************************************************************************/\r
+ public final void setUI(ComponentUI comp)\r
+ {\r
+ super.setUI(new UI(this));\r
+ }\r
+\r
+ /**************************************************************************\r
+ * Internal implementation of Metal LookAndFeel to create the table sorting\r
+ * ability.\r
+ *************************************************************************/\r
+ private class UI\r
+ extends MetalFileChooserUI\r
+ {\r
+ private DirectoryModel model;\r
\r
- return ret;\r
+ /**************************************************************************\r
+ * Must be overridden to extend\r
+ * @param e\r
+ *************************************************************************/\r
+ public UI(JFileChooser e)\r
+ {\r
+ super(e);\r
}\r
\r
- void initColumns() {\r
- if (COLUMNS == null) {\r
- Locale l = getLocale();\r
- COLUMNS = new String[] {\r
- UIManager.getString("FileChooser.fileNameHeaderText", l),\r
- UIManager.getString("FileChooser.fileSizeHeaderText", l),\r
- UIManager.getString("FileChooser.fileTypeHeaderText", l),\r
- UIManager.getString("FileChooser.fileDateHeaderText", l),\r
- UIManager.getString("FileChooser.fileAttrHeaderText", l)\r
- };\r
- }\r
+ /**************************************************************************\r
+ * Overridden to create our own model\r
+ *************************************************************************/\r
+ protected final void createModel()\r
+ {\r
+ model = new DirectoryModel(getFileChooser());\r
}\r
\r
/**************************************************************************\r
- * Always create the local UI\r
- * @param comp\r
+ * Overridden to get our own model\r
+ * @return\r
*************************************************************************/\r
- public final void setUI(ComponentUI comp) {\r
- super.setUI(new UI(this));\r
+ public final BasicDirectoryModel getModel()\r
+ {\r
+ return model;\r
}\r
\r
/**************************************************************************\r
- * Internal implementation of Metal LookAndFeel to create the table sorting\r
- * ability.\r
+ * Calls the default method then adds a MouseListener to the JTable\r
+ * @param chooser\r
+ * @return\r
*************************************************************************/\r
- private final static class UI extends MetalFileChooserUI {\r
- private DirectoryModel model;\r
-\r
- /**************************************************************************\r
- * Must be overridden to extend\r
- * @param e\r
- *************************************************************************/\r
- public UI(JFileChooser e) {\r
- super(e);\r
- }\r
+ protected final JPanel createDetailsView(JFileChooser chooser)\r
+ {\r
+ final JPanel panel = super.createDetailsView(chooser);\r
\r
- /**************************************************************************\r
- * Overridden to create our own model\r
- *************************************************************************/\r
- protected final void createModel() {\r
- model = new DirectoryModel(getFileChooser());\r
- }\r
+ //Since we can't access MetalFileChooserUI's private member detailsTable\r
+ //directly, we have to find it in the JPanel\r
+ final JTable tbl = findJTable(panel.getComponents());\r
\r
- /**************************************************************************\r
- * Overridden to get our own model\r
- * @return\r
- *************************************************************************/\r
- public final BasicDirectoryModel getModel() {\r
- return model;\r
- }\r
+ if (tbl != null)\r
+ {\r
+ //Add a mouselistener to listen for presses on column headers\r
+ tbl.getTableHeader().addMouseListener(new MouseAdapter()\r
+ {\r
+ public void mousePressed(MouseEvent e)\r
+ {\r
\r
- /**************************************************************************\r
- * Calls the default method then adds a MouseListener to the JTable\r
- * @param chooser\r
- * @return\r
- *************************************************************************/\r
- protected final JPanel createDetailsView(JFileChooser chooser) {\r
- final JPanel panel = super.createDetailsView(chooser);\r
-\r
- //Since we can't access MetalFileChooserUI's private member detailsTable\r
- //directly, we have to find it in the JPanel\r
- final JTable tbl = findJTable(panel.getComponents());\r
-\r
- if (tbl != null) {\r
- //Fix the columns so they can't be rearranged, if we don't do this\r
- //we would need to keep track when each column is moved\r
- tbl.getTableHeader().setReorderingAllowed(false);\r
-\r
- //Add a mouselistener to listen for clicks on column headers\r
- tbl.getTableHeader().addMouseListener(new MouseAdapter() {\r
- public void mouseClicked(MouseEvent e) {\r
- //Only process single clicks\r
- if (e.getClickCount() > 1) {\r
- return;\r
- }\r
-\r
- e.consume();\r
-\r
- final int col = tbl.getTableHeader().columnAtPoint(e.getPoint());\r
-\r
- if ((col == COLUMN_FILENAME) ||\r
- (col == COLUMN_FILESIZE) ||\r
- (col == COLUMN_FILEDATE)) {\r
- model.sort(col, tbl);\r
- }\r
- }\r
- });\r
- }\r
+ e.consume();\r
\r
- return panel;\r
- }\r
+ final int col = tbl.getTableHeader().columnAtPoint(e.getPoint());\r
+ model.sort(col, tbl);\r
\r
- /**************************************************************************\r
- * Finds the JTable in the panel so we can add MouseListener\r
- * @param comp\r
- * @return\r
- *************************************************************************/\r
- private final static JTable findJTable(Component[] comp) {\r
- for (int i = 0; i < comp.length; i++) {\r
- if (comp[i] instanceof JTable) {\r
- return (JTable) comp[i];\r
- }\r
-\r
- if (comp[i] instanceof Container) {\r
- JTable tbl = findJTable(((Container) comp[i]).getComponents());\r
-\r
- if (tbl != null) {\r
- return tbl;\r
- }\r
- }\r
- }\r
+ }\r
+ });\r
+ }\r
\r
- return null;\r
- }\r
+ return panel;\r
}\r
\r
- /***************************************************************************\r
- * Implementation of BasicDirectoryModel that sorts the Files by column\r
- **************************************************************************/\r
- private final static class DirectoryModel extends BasicDirectoryModel {\r
- int col = 0;\r
- boolean ascending;\r
-\r
- /**************************************************************************\r
- * Must be overridden to extend BasicDirectoryModel\r
- * @param chooser\r
- *************************************************************************/\r
- DirectoryModel(JFileChooser chooser) {\r
- super(chooser);\r
+ /**************************************************************************\r
+ * Finds the JTable in the panel so we can add MouseListener\r
+ * @param comp\r
+ * @return\r
+ *************************************************************************/\r
+ private JTable findJTable(Component[] comp)\r
+ {\r
+ for (int i = 0; i < comp.length; i++)\r
+ {\r
+ if (comp[i] instanceof JTable)\r
+ {\r
+ return (JTable) comp[i];\r
}\r
\r
- /**************************************************************************\r
- * Supposedly this is not used anymore, hopefully not. We implemented\r
- * some basic attempt at sorting just in case\r
- * @param a\r
- * @param b\r
- * @return\r
- *************************************************************************/\r
- protected final boolean lt(File a, File b) {\r
- System.out.println("DEBUG:LT called?");\r
-\r
- boolean less = false;\r
+ if (comp[i] instanceof Container)\r
+ {\r
+ JTable tbl = findJTable( ( (Container) comp[i]).getComponents());\r
\r
- switch (col) {\r
- case COLUMN_FILEDATE:\r
- less = a.lastModified() > b.lastModified();\r
-\r
- break;\r
+ if (tbl != null)\r
+ {\r
+ return tbl;\r
+ }\r
+ }\r
+ }\r
\r
- case COLUMN_FILESIZE:\r
- less = a.length() > b.length();\r
+ return null;\r
+ }\r
+ }\r
+\r
+ /***************************************************************************\r
+ * Implementation of BasicDirectoryModel that sorts the Files by column\r
+ **************************************************************************/\r
+ private final class DirectoryModel\r
+ extends BasicDirectoryModel\r
+ {\r
+ String sortingColumnName=null;\r
+ int col = 0;\r
+ boolean ascending;\r
\r
- break;\r
+ /**************************************************************************\r
+ * Must be overridden to extend BasicDirectoryModel\r
+ * @param chooser\r
+ *************************************************************************/\r
+ DirectoryModel(JFileChooser chooser)\r
+ {\r
+ super(chooser);\r
+ }\r
\r
- default:\r
- less = a.getName().compareToIgnoreCase(b.getName()) > 0;\r
\r
- break;\r
- }\r
+ /**************************************************************************\r
+ * Resorts the JFileChooser table based on new column\r
+ * @param c\r
+ *************************************************************************/\r
+ protected final void sort(int c, JTable tbl)\r
+ {\r
\r
- if (ascending) {\r
- return less = !less;\r
- }\r
\r
- return less;\r
- }\r
+ //Set column and order\r
+ col = c;\r
+ ascending = !ascending;\r
\r
- /**************************************************************************\r
- * Resorts the JFileChooser table based on new column\r
- * @param c\r
- *************************************************************************/\r
- protected final void sort(int c, JTable tbl) {\r
- //Set column and order\r
- col = c;\r
- ascending = !ascending;\r
+ String indicator = " (^)";\r
\r
- String indicator = " (^)";\r
+ if (ascending)\r
+ {\r
+ indicator = " (v)";\r
+ }\r
\r
- if (ascending) {\r
- indicator = " (v)";\r
- }\r
+ final JTableHeader th = tbl.getTableHeader();\r
+ final TableColumnModel tcm = th.getColumnModel();\r
+ TableColumn tc = null;\r
+ String title = null;\r
\r
- final JTableHeader th = tbl.getTableHeader();\r
- final TableColumnModel tcm = th.getColumnModel();\r
\r
- for (int i = 0; i < JalviewFileChooser.COLUMN_COLCOUNT; i++) {\r
- final TableColumn tc = tcm.getColumn(i); // the column to change\r
- tc.setHeaderValue(COLUMNS[i]);\r
- }\r
+ //Remove indicator from old sort, and add to new\r
+ for(int i=0; i<tcm.getColumnCount(); i++)\r
+ {\r
+ tc = tcm.getColumn(i);\r
+ title = tc.getHeaderValue().toString();\r
+ if (title.endsWith(" (^)") || title.endsWith(" (v)"))\r
+ {\r
+ title = title.substring(0, title.length() - 4);\r
+ }\r
\r
- final TableColumn tc = tcm.getColumn(col); // the column to change\r
- tc.setHeaderValue(COLUMNS[col] + indicator);\r
+ if(i==col)\r
+ {\r
+ sortingColumnName = title;\r
+ title = title + indicator;\r
+ }\r
\r
- th.repaint();\r
+ tc.setHeaderValue(title);\r
+ }\r
\r
- //Requery the file listing\r
- validateFileCache();\r
- }\r
+ //Requery the file listing\r
+ validateFileCache();\r
+ }\r
\r
- /**************************************************************************\r
- * Sorts the data based on current column setting\r
- * @param data\r
- *************************************************************************/\r
- protected final void sort(Vector data) {\r
- switch (col) {\r
- case COLUMN_FILEDATE:\r
- Collections.sort(data,\r
- new Comparator() {\r
- public int compare(Object o1, Object o2) {\r
- int ret = 1;\r
- final File a = (File) o1;\r
- final File b = (File) o2;\r
-\r
- if (a.lastModified() > b.lastModified()) {\r
- ret = -1;\r
- } else if (a.lastModified() == b.lastModified()) {\r
- ret = 0;\r
- }\r
-\r
- if (ascending) {\r
- ret *= -1;\r
- }\r
-\r
- return ret;\r
- }\r
- });\r
-\r
-\r
- break;\r
-\r
- case COLUMN_FILESIZE:\r
- Collections.sort(data,\r
- new Comparator() {\r
- public int compare(Object o1, Object o2) {\r
- int ret = 1;\r
- final File a = (File) o1;\r
- final File b = (File) o2;\r
-\r
- if (a.length() > b.length()) {\r
- ret = -1;\r
- } else if (a.length() == b.length()) {\r
- ret = 0;\r
- }\r
-\r
- if (ascending) {\r
- ret *= -1;\r
- }\r
-\r
- return ret;\r
- }\r
- });\r
-\r
-\r
- break;\r
-\r
- case COLUMN_FILENAME:\r
- Collections.sort(data,\r
- new Comparator() {\r
- public int compare(Object o1, Object o2) {\r
- final File a = (File) o1;\r
- final File b = (File) o2;\r
-\r
- if (ascending) {\r
- return a.getName().compareToIgnoreCase(b.getName());\r
- } else {\r
- return -1 * a.getName().compareToIgnoreCase(b.getName());\r
- }\r
- }\r
- });\r
-\r
-\r
- break;\r
+ /**************************************************************************\r
+ * Sorts the data based on current column setting\r
+ * @param data\r
+ *************************************************************************/\r
+ protected final void sort(Vector data)\r
+ {\r
+ /*\r
+ UIManager.getString("FileChooser.fileTypeHeaderText", l),\r
+ UIManager.getString("FileChooser.fileAttrHeaderText", l)\r
+*/\r
+ if(sortingColumnName==null)\r
+ return;\r
+\r
+\r
+ if(sortingColumnName.equals(UIManager.getString("FileChooser.fileDateHeaderText")))\r
+ {\r
+ Collections.sort(data,\r
+ new Comparator()\r
+ {\r
+\r
+ public int compare(Object o1, Object o2)\r
+ {\r
+ int ret = 1;\r
+ final File a = (File) o1;\r
+ final File b = (File) o2;\r
+\r
+ if (a.lastModified() > b.lastModified())\r
+ {\r
+ ret = -1;\r
+ }\r
+ else if (a.lastModified() == b.lastModified())\r
+ {\r
+ ret = 0;\r
+ }\r
+\r
+ if (ascending)\r
+ {\r
+ ret *= -1;\r
+ }\r
+\r
+ return ret;\r
}\r
+ });\r
+ }\r
+ else if(sortingColumnName.equals(UIManager.getString("FileChooser.fileSizeHeaderText")))\r
+ {\r
+\r
+ Collections.sort(data,\r
+ new Comparator()\r
+ {\r
+\r
+ public int compare(Object o1, Object o2)\r
+ {\r
+ int ret = 1;\r
+ final File a = (File) o1;\r
+ final File b = (File) o2;\r
+\r
+ if (a.length() > b.length())\r
+ {\r
+ ret = -1;\r
+ }\r
+ else if (a.length() == b.length())\r
+ {\r
+ ret = 0;\r
+ }\r
+\r
+ if (ascending)\r
+ {\r
+ ret *= -1;\r
+ }\r
+\r
+ return ret;\r
+ }\r
+ });\r
+ }\r
+ else if(sortingColumnName.equals(UIManager.getString("FileChooser.fileTypeHeaderText")))\r
+ {\r
+ Collections.sort(data,\r
+ new Comparator()\r
+ {\r
+ public int compare(Object o1, Object o2)\r
+ {\r
+ final String a = getFileSystemView().getSystemTypeDescription( (File)o1 );\r
+ final String b = getFileSystemView().getSystemTypeDescription( (File)o2 );\r
+ if (ascending)\r
+ {\r
+ return a.compareToIgnoreCase(b);\r
+ }\r
+ else\r
+ {\r
+ return -1 * a.compareToIgnoreCase(b);\r
+ }\r
+ }\r
+ });\r
+ }\r
+ else if(sortingColumnName.equals(UIManager.getString("FileChooser.fileNameHeaderText")))\r
+{\r
+ Collections.sort(data,\r
+ new Comparator()\r
+ {\r
+ public int compare(Object o1, Object o2)\r
+ {\r
+ final String a = ((File) o1).getName();\r
+ final String b = ((File) o2).getName();\r
+\r
+ if (ascending)\r
+ {\r
+ return a.compareToIgnoreCase(b);\r
+ }\r
+ else\r
+ {\r
+ return -1 * a.compareToIgnoreCase(b);\r
+ }\r
}\r
+ });\r
+ }\r
+\r
}\r
+ }\r
}\r
/*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
-*\r
-* This program is free software; you can redistribute it and/or\r
-* modify it under the terms of the GNU General Public License\r
-* as published by the Free Software Foundation; either version 2\r
-* of the License, or (at your option) any later version.\r
-*\r
-* This program is distributed in the hope that it will be useful,\r
-* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-* GNU General Public License for more details.\r
-*\r
-* You should have received a copy of the GNU General Public License\r
-* along with this program; if not, write to the Free Software\r
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
-*/\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
+ */\r
package jalview.io;\r
\r
-import java.io.File;\r
-\r
+import java.io.*;\r
import java.util.*;\r
\r
-import javax.swing.filechooser.*;\r
-\r
-\r
-public class JalviewFileFilter extends FileFilter {\r
- private static String TYPE_UNKNOWN = "Type Unknown";\r
- private static String HIDDEN_FILE = "Hidden File";\r
- public static Hashtable suffixHash = new Hashtable();\r
- private Hashtable filters = null;\r
- private String description = "no description";\r
- private String fullDescription = "full description";\r
- private boolean useExtensionsInDescription = true;\r
-\r
- public JalviewFileFilter(String extension, String description) {\r
- StringTokenizer st = new StringTokenizer(extension, ",");\r
-\r
- while (st.hasMoreElements()) {\r
- addExtension(st.nextToken().trim());\r
- }\r
-\r
- setDescription(description);\r
+import javax.swing.filechooser.FileFilter;\r
+\r
+public class JalviewFileFilter\r
+ extends FileFilter\r
+{\r
+ private static String TYPE_UNKNOWN = "Type Unknown";\r
+ private static String HIDDEN_FILE = "Hidden File";\r
+ public static Hashtable suffixHash = new Hashtable();\r
+ private Hashtable filters = null;\r
+ private String description = "no description";\r
+ private String fullDescription = "full description";\r
+ private boolean useExtensionsInDescription = true;\r
+\r
+ public JalviewFileFilter(String extension, String description)\r
+ {\r
+ StringTokenizer st = new StringTokenizer(extension, ",");\r
+\r
+ while (st.hasMoreElements())\r
+ {\r
+ addExtension(st.nextToken().trim());\r
}\r
\r
- public JalviewFileFilter(String[] filts) {\r
- this(filts, null);\r
- }\r
+ setDescription(description);\r
+ }\r
\r
- public JalviewFileFilter(String[] filts, String description) {\r
- for (int i = 0; i < filts.length; i++) {\r
- // add filters one by one\r
- addExtension(filts[i]);\r
- }\r
+ public JalviewFileFilter(String[] filts)\r
+ {\r
+ this(filts, null);\r
+ }\r
\r
- if (description != null) {\r
- setDescription(description);\r
- }\r
+ public JalviewFileFilter(String[] filts, String description)\r
+ {\r
+ for (int i = 0; i < filts.length; i++)\r
+ {\r
+ // add filters one by one\r
+ addExtension(filts[i]);\r
}\r
\r
- public String getAcceptableExtension() {\r
- return filters.keys().nextElement().toString();\r
+ if (description != null)\r
+ {\r
+ setDescription(description);\r
}\r
-\r
- // takes account of the fact that database is a directory\r
- public boolean accept(File f) {\r
- if (f != null) {\r
- String extension = getExtension(f);\r
-\r
- if (f.isDirectory()) {\r
- if ((extension == null) || extension.equals("")) {\r
- return true;\r
- } else {\r
- if (filters.get(getExtension(f)) != null) {\r
- return true;\r
- }\r
- }\r
- }\r
-\r
- if ((extension != null) && (filters.get(getExtension(f)) != null)) {\r
- return true;\r
- }\r
+ }\r
+\r
+ public String getAcceptableExtension()\r
+ {\r
+ return filters.keys().nextElement().toString();\r
+ }\r
+\r
+ // takes account of the fact that database is a directory\r
+ public boolean accept(File f)\r
+ {\r
+ if (f != null)\r
+ {\r
+ String extension = getExtension(f);\r
+\r
+ if (f.isDirectory())\r
+ {\r
+ if ( (extension == null) || extension.equals(""))\r
+ {\r
+ return true;\r
+ }\r
+ else\r
+ {\r
+ if (filters.get(getExtension(f)) != null)\r
+ {\r
+ return true;\r
+ }\r
}\r
+ }\r
\r
- return false;\r
+ if ( (extension != null) && (filters.get(getExtension(f)) != null))\r
+ {\r
+ return true;\r
+ }\r
}\r
\r
- public String getExtension(File f) {\r
- if (f != null) {\r
- String filename = f.getName();\r
- int i = filename.lastIndexOf('.');\r
+ return false;\r
+ }\r
\r
- if ((i > 0) && (i < (filename.length() - 1))) {\r
- return filename.substring(i + 1).toLowerCase();\r
- }\r
+ public String getExtension(File f)\r
+ {\r
+ if (f != null)\r
+ {\r
+ String filename = f.getName();\r
+ int i = filename.lastIndexOf('.');\r
\r
- ;\r
- }\r
+ if ( (i > 0) && (i < (filename.length() - 1)))\r
+ {\r
+ return filename.substring(i + 1).toLowerCase();\r
+ }\r
\r
- return "";\r
+ ;\r
}\r
\r
- public void addExtension(String extension) {\r
- if (filters == null) {\r
- filters = new Hashtable(5);\r
- }\r
+ return "";\r
+ }\r
\r
- filters.put(extension.toLowerCase(), this);\r
- fullDescription = null;\r
+ public void addExtension(String extension)\r
+ {\r
+ if (filters == null)\r
+ {\r
+ filters = new Hashtable(5);\r
}\r
\r
- public String getDescription() {\r
- if (fullDescription == null) {\r
- if ((description == null) || isExtensionListInDescription()) {\r
- fullDescription = (description == null) ? "(" : (description +\r
- " (");\r
-\r
- // build the description from the extension list\r
- Enumeration extensions = filters.keys();\r
-\r
- if (extensions != null) {\r
- fullDescription += ("." +\r
- (String) extensions.nextElement());\r
-\r
- while (extensions.hasMoreElements()) {\r
- fullDescription += (", " +\r
- (String) extensions.nextElement());\r
- }\r
- }\r
-\r
- fullDescription += ")";\r
- } else {\r
- fullDescription = description;\r
- }\r
+ filters.put(extension.toLowerCase(), this);\r
+ fullDescription = null;\r
+ }\r
+\r
+ public String getDescription()\r
+ {\r
+ if (fullDescription == null)\r
+ {\r
+ if ( (description == null) || isExtensionListInDescription())\r
+ {\r
+ fullDescription = (description == null) ? "(" : (description +\r
+ " (");\r
+\r
+ // build the description from the extension list\r
+ Enumeration extensions = filters.keys();\r
+\r
+ if (extensions != null)\r
+ {\r
+ fullDescription += ("." +\r
+ (String) extensions.nextElement());\r
+\r
+ while (extensions.hasMoreElements())\r
+ {\r
+ fullDescription += (", " +\r
+ (String) extensions.nextElement());\r
+ }\r
}\r
\r
- return fullDescription;\r
+ fullDescription += ")";\r
+ }\r
+ else\r
+ {\r
+ fullDescription = description;\r
+ }\r
}\r
\r
- public void setDescription(String description) {\r
- this.description = description;\r
- fullDescription = null;\r
- }\r
-\r
- public void setExtensionListInDescription(boolean b) {\r
- useExtensionsInDescription = b;\r
- fullDescription = null;\r
- }\r
-\r
- public boolean isExtensionListInDescription() {\r
- return useExtensionsInDescription;\r
- }\r
+ return fullDescription;\r
+ }\r
+\r
+ public void setDescription(String description)\r
+ {\r
+ this.description = description;\r
+ fullDescription = null;\r
+ }\r
+\r
+ public void setExtensionListInDescription(boolean b)\r
+ {\r
+ useExtensionsInDescription = b;\r
+ fullDescription = null;\r
+ }\r
+\r
+ public boolean isExtensionListInDescription()\r
+ {\r
+ return useExtensionsInDescription;\r
+ }\r
}\r
/*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
-*\r
-* This program is free software; you can redistribute it and/or\r
-* modify it under the terms of the GNU General Public License\r
-* as published by the Free Software Foundation; either version 2\r
-* of the License, or (at your option) any later version.\r
-*\r
-* This program is distributed in the hope that it will be useful,\r
-* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-* GNU General Public License for more details.\r
-*\r
-* You should have received a copy of the GNU General Public License\r
-* along with this program; if not, write to the Free Software\r
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
-*/\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
+ */\r
package jalview.io;\r
\r
import java.io.*;\r
-\r
import java.util.*;\r
\r
import javax.swing.*;\r
-import javax.swing.filechooser.FileView;\r
-\r
-\r
-public class JalviewFileView extends FileView {\r
- static Hashtable alignSuffix = new Hashtable();\r
-\r
- static {\r
- alignSuffix.put("fasta", "Fasta file");\r
- alignSuffix.put("fa", "Fasta file");\r
- alignSuffix.put("fastq", "Fasta file");\r
- alignSuffix.put("blc", "BLC file");\r
- alignSuffix.put("msf", "MSF file");\r
- alignSuffix.put("pfam", "PFAM file");\r
- alignSuffix.put("aln", "Clustal file");\r
- alignSuffix.put("pir", "PIR file");\r
+import javax.swing.filechooser.*;\r
+\r
+public class JalviewFileView\r
+ extends FileView\r
+{\r
+ static Hashtable alignSuffix = new Hashtable();\r
+\r
+ static\r
+ {\r
+ alignSuffix.put("fasta", "Fasta file");\r
+ alignSuffix.put("fa", "Fasta file");\r
+ alignSuffix.put("fastq", "Fasta file");\r
+ alignSuffix.put("blc", "BLC file");\r
+ alignSuffix.put("msf", "MSF file");\r
+ alignSuffix.put("pfam", "PFAM file");\r
+ alignSuffix.put("aln", "Clustal file");\r
+ alignSuffix.put("pir", "PIR file");\r
+ alignSuffix.put("jar", "Jalview file");\r
+ }\r
+\r
+ public String getTypeDescription(File f)\r
+ {\r
+ String extension = getExtension(f);\r
+ String type = null;\r
+\r
+ if (extension != null)\r
+ {\r
+ if (alignSuffix.containsKey(extension))\r
+ {\r
+ type = alignSuffix.get(extension).toString();\r
+ }\r
}\r
\r
- public String getTypeDescription(File f) {\r
- String extension = getExtension(f);\r
- String type = null;\r
+ return type;\r
+ }\r
\r
- if (extension != null) {\r
- if (alignSuffix.containsKey(extension)) {\r
- type = alignSuffix.get(extension).toString();\r
- }\r
- }\r
+ public Icon getIcon(File f)\r
+ {\r
+ String extension = getExtension(f);\r
+ Icon icon = null;\r
\r
- return type;\r
+ if (extension != null)\r
+ {\r
+ if (alignSuffix.containsKey(extension))\r
+ {\r
+ icon = createImageIcon("/images/file.png");\r
+ }\r
}\r
\r
- public Icon getIcon(File f) {\r
- String extension = getExtension(f);\r
- Icon icon = null;\r
-\r
- if (extension != null) {\r
- if (alignSuffix.containsKey(extension)) {\r
- icon = createImageIcon("/images/file.png");\r
- }\r
- }\r
-\r
- return icon;\r
+ return icon;\r
+ }\r
+\r
+ /*\r
+ * Get the extension of a file.\r
+ */\r
+ public static String getExtension(File f)\r
+ {\r
+ String ext = null;\r
+ String s = f.getName();\r
+ int i = s.lastIndexOf('.');\r
+\r
+ if ( (i > 0) && (i < (s.length() - 1)))\r
+ {\r
+ ext = s.substring(i + 1).toLowerCase();\r
}\r
\r
- /*\r
- * Get the extension of a file.\r
- */\r
- public static String getExtension(File f) {\r
- String ext = null;\r
- String s = f.getName();\r
- int i = s.lastIndexOf('.');\r
+ return ext;\r
+ }\r
\r
- if ((i > 0) && (i < (s.length() - 1))) {\r
- ext = s.substring(i + 1).toLowerCase();\r
- }\r
+ /** Returns an ImageIcon, or null if the path was invalid. */\r
+ protected static ImageIcon createImageIcon(String path)\r
+ {\r
+ java.net.URL imgURL = JalviewFileView.class.getResource(path);\r
\r
- return ext;\r
+ if (imgURL != null)\r
+ {\r
+ return new ImageIcon(imgURL);\r
}\r
+ else\r
+ {\r
+ System.err.println(\r
+ "JalviewFileView.createImageIcon: Couldn't find file: " + path);\r
\r
- /** Returns an ImageIcon, or null if the path was invalid. */\r
- protected static ImageIcon createImageIcon(String path) {\r
- java.net.URL imgURL = JalviewFileView.class.getResource(path);\r
-\r
- if (imgURL != null) {\r
- return new ImageIcon(imgURL);\r
- } else {\r
- System.err.println(\r
- "JalviewFileView.createImageIcon: Couldn't find file: " + path);\r
-\r
- return null;\r
- }\r
+ return null;\r
}\r
+ }\r
}\r
import java.util.*;\r
\r
\r
-public class MSFfile extends AlignFile {\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class MSFfile extends AlignFile\r
+{\r
private static com.stevesoft.pat.Regex gapre = new com.stevesoft.pat.Regex("\\~",\r
"-");\r
private static com.stevesoft.pat.Regex re2gap = new com.stevesoft.pat.Regex(\r
"[" + jalview.util.Comparison.GapChars + "]", "\\~");\r
\r
- public MSFfile() {\r
+ /**\r
+ * Creates a new MSFfile object.\r
+ */\r
+ public MSFfile()\r
+ {\r
}\r
\r
- public MSFfile(String inStr) {\r
+ /**\r
+ * Creates a new MSFfile object.\r
+ *\r
+ * @param inStr DOCUMENT ME!\r
+ */\r
+ public MSFfile(String inStr)\r
+ {\r
super(inStr);\r
}\r
\r
- public MSFfile(String inFile, String type) throws IOException {\r
+ /**\r
+ * Creates a new MSFfile object.\r
+ *\r
+ * @param inFile DOCUMENT ME!\r
+ * @param type DOCUMENT ME!\r
+ *\r
+ * @throws IOException DOCUMENT ME!\r
+ */\r
+ public MSFfile(String inFile, String type) throws IOException\r
+ {\r
super(inFile, type);\r
}\r
\r
- public void parse() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ public void parse()\r
+ {\r
int i = 0;\r
boolean seqFlag = false;\r
String key = new String();\r
Hashtable seqhash = new Hashtable();\r
String line;\r
\r
- try {\r
- while ((line = nextLine()) != null) {\r
+ try\r
+ {\r
+ while ((line = nextLine()) != null)\r
+ {\r
StringTokenizer str = new StringTokenizer(line);\r
\r
- while (str.hasMoreTokens()) {\r
+ while (str.hasMoreTokens())\r
+ {\r
String inStr = str.nextToken();\r
\r
//If line has header information add to the headers vector\r
- if (inStr.indexOf("Name:") != -1) {\r
+ if (inStr.indexOf("Name:") != -1)\r
+ {\r
key = str.nextToken();\r
headers.addElement(key);\r
}\r
\r
//if line has // set SeqFlag to 1 so we know sequences are coming\r
- if (inStr.indexOf("//") != -1) {\r
+ if (inStr.indexOf("//") != -1)\r
+ {\r
seqFlag = true;\r
}\r
\r
//Process lines as sequence lines if seqFlag is set\r
- if ((inStr.indexOf("//") == -1) && (seqFlag == true)) {\r
+ if ((inStr.indexOf("//") == -1) && (seqFlag == true))\r
+ {\r
//seqeunce id is the first field\r
key = inStr;\r
\r
StringBuffer tempseq;\r
\r
//Get sequence from hash if it exists\r
- if (seqhash.containsKey(key)) {\r
+ if (seqhash.containsKey(key))\r
+ {\r
tempseq = (StringBuffer) seqhash.get(key);\r
- } else {\r
+ }\r
+ else\r
+ {\r
tempseq = new StringBuffer();\r
seqhash.put(key, tempseq);\r
}\r
\r
//loop through the rest of the words\r
- while (str.hasMoreTokens()) {\r
+ while (str.hasMoreTokens())\r
+ {\r
//append the word to the sequence\r
tempseq.append(str.nextToken());\r
}\r
}\r
}\r
}\r
- } catch (IOException e) {\r
+ }\r
+ catch (IOException e)\r
+ {\r
System.err.println("Exception parsing MSFFile " + e);\r
e.printStackTrace();\r
}\r
this.noSeqs = headers.size();\r
\r
//Add sequences to the hash\r
- for (i = 0; i < headers.size(); i++) {\r
- if (seqhash.get(headers.elementAt(i)) != null) {\r
+ for (i = 0; i < headers.size(); i++)\r
+ {\r
+ if (seqhash.get(headers.elementAt(i)) != null)\r
+ {\r
String head = headers.elementAt(i).toString();\r
String seq = seqhash.get(head).toString();\r
\r
int start = 1;\r
int end = seq.length();\r
\r
- if (maxLength < head.length()) {\r
+ if (maxLength < head.length())\r
+ {\r
maxLength = head.length();\r
}\r
\r
- if (head.indexOf("/") > 0) {\r
+ if (head.indexOf("/") > 0)\r
+ {\r
StringTokenizer st = new StringTokenizer(head, "/");\r
\r
- if (st.countTokens() == 2) {\r
+ if (st.countTokens() == 2)\r
+ {\r
head = st.nextToken();\r
\r
String tmp = st.nextToken();\r
st = new StringTokenizer(tmp, "-");\r
\r
- if (st.countTokens() == 2) {\r
+ if (st.countTokens() == 2)\r
+ {\r
start = Integer.valueOf(st.nextToken()).intValue();\r
end = Integer.valueOf(st.nextToken()).intValue();\r
}\r
Sequence newSeq = new Sequence(head, seq, start, end);\r
\r
seqs.addElement(newSeq);\r
- } else {\r
+ }\r
+ else\r
+ {\r
System.err.println("MSFFile Parser: Can't find sequence for " +\r
headers.elementAt(i));\r
}\r
}\r
}\r
\r
- public static int checkSum(String seq) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param seq DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public static int checkSum(String seq)\r
+ {\r
//String chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.*~&@";\r
int check = 0;\r
+ String sequence = seq.toUpperCase();\r
\r
String index = "--------------------------------------&---*---.-----------------@ABCDEFGHIJKLMNOPQRSTUVWXYZ------ABCDEFGHIJKLMNOPQRSTUVWXYZ----@";\r
- index += "--------------------------------------------------------------------------------------------------------------------------------";\r
+ index += "--------------------------------------------------------------------------------------------------------------------------------";\r
\r
- for (int i = 0; i < seq.length(); i++) {\r
- try {\r
- if (i < seq.length()) {\r
- int pos = index.indexOf(seq.substring(i, i + 1));\r
+ for (int i = 0; i < sequence.length(); i++)\r
+ {\r
+ try\r
+ {\r
+ int pos = index.indexOf(sequence.charAt(i));\r
\r
- if (!index.substring(pos, pos + 1).equals("_")) {\r
+ if (index.charAt(pos)!='_')\r
+ {\r
check += (((i % 57) + 1) * pos);\r
}\r
- }\r
- } catch (Exception e) {\r
+ }\r
+ catch (Exception e)\r
+ {\r
System.err.println("Exception during MSF Checksum calculation");\r
e.printStackTrace();\r
}\r
return check % 10000;\r
}\r
\r
- public static String print(SequenceI[] s) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param s DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public static String print(SequenceI[] s)\r
+ {\r
return print(s, false);\r
}\r
\r
- public static String print(SequenceI[] s, boolean is_NA) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param s DOCUMENT ME!\r
+ * @param is_NA DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public static String print(SequenceI[] s, boolean is_NA)\r
+ {\r
StringBuffer out = new StringBuffer("!!" + (is_NA ? "NA" : "AA") +\r
"_MULTIPLE_ALIGNMENT 1.0\n\n"); // TODO: JBPNote : Jalview doesn't remember NA or AA yet.\r
\r
int i = 0;\r
String big = "";\r
\r
- while ((i < s.length) && (s[i] != null)) {\r
+ while ((i < s.length) && (s[i] != null))\r
+ {\r
String sq;\r
big += (sq = s[i].getSequence());\r
\r
- if (sq.length() > max) {\r
+ if (sq.length() > max)\r
+ {\r
max = sq.length();\r
}\r
\r
String[] nameBlock = new String[s.length];\r
String[] idBlock = new String[s.length];\r
\r
- while ((i < s.length) && (s[i] != null)) {\r
- String seq = s[i].getSequence();\r
+ while ((i < s.length) && (s[i] != null))\r
+ {\r
String name = s[i].getName() + "/" + s[i].getStart() + "-" +\r
s[i].getEnd();\r
int check = checkSum(s[i].getSequence());\r
maxLenpad.form(s[i].getSequence().length()) + " Check:" +\r
maxChkpad.form(check) + " Weight: 1.00\n");\r
\r
- if (name.length() > maxid) {\r
+ if (name.length() > maxid)\r
+ {\r
maxid = name.length();\r
}\r
\r
- if (nameBlock[i].length() > maxNB) {\r
+ if (nameBlock[i].length() > maxNB)\r
+ {\r
maxNB = nameBlock[i].length();\r
}\r
\r
i++;\r
}\r
\r
- if (maxid < 10) {\r
+ if (maxid < 10)\r
+ {\r
maxid = 10;\r
}\r
\r
- if (maxNB < 15) {\r
+ if (maxNB < 15)\r
+ {\r
maxNB = 15;\r
}\r
\r
Format nbFormat = new Format("%-" + maxNB + "s");\r
\r
- for (i = 0; (i < s.length) && (s[i] != null); i++) {\r
+ for (i = 0; (i < s.length) && (s[i] != null); i++)\r
+ {\r
out.append(nbFormat.form(nameBlock[i]) + idBlock[i]);\r
}\r
\r
\r
int nochunks = (max / len) + 1;\r
\r
- if ((max % len) == 0) {\r
+ if ((max % len) == 0)\r
+ {\r
nochunks--;\r
}\r
\r
- for (i = 0; i < nochunks; i++) {\r
+ for (i = 0; i < nochunks; i++)\r
+ {\r
int j = 0;\r
\r
- while ((j < s.length) && (s[j] != null)) {\r
+ while ((j < s.length) && (s[j] != null))\r
+ {\r
String name = s[j].getName();\r
out.append(new Format("%-" + maxid + "s").form(name + "/" +\r
s[j].getStart() + "-" + s[j].getEnd()) + " ");\r
\r
- for (int k = 0; k < 5; k++) {\r
+ for (int k = 0; k < 5; k++)\r
+ {\r
int start = (i * 50) + (k * 10);\r
int end = start + 10;\r
\r
if ((end < s[j].getSequence().length()) &&\r
- (start < s[j].getSequence().length())) {\r
+ (start < s[j].getSequence().length()))\r
+ {\r
out.append(re2gap.replaceAll(s[j].getSequence()\r
.substring(start, end)));\r
\r
- if (k < 4) {\r
+ if (k < 4)\r
+ {\r
// out.append(" ");\r
- } else {\r
+ }\r
+ else\r
+ {\r
out.append("\n");\r
}\r
- } else {\r
- if (start < s[j].getSequence().length()) {\r
+ }\r
+ else\r
+ {\r
+ if (start < s[j].getSequence().length())\r
+ {\r
out.append(re2gap.replaceAll(\r
s[j].getSequence().substring(start)));\r
out.append("\n");\r
- } else {\r
- if (k == 0) {\r
+ }\r
+ else\r
+ {\r
+ if (k == 0)\r
+ {\r
out.append("\n");\r
}\r
}\r
return out.toString();\r
}\r
\r
- public String print() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public String print()\r
+ {\r
return print(getSeqsAsArray());\r
}\r
}\r
import java.util.*;\r
\r
\r
-public class NewickFile extends FileParse {\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class NewickFile extends FileParse\r
+{\r
SequenceNode root;\r
private boolean HasBootstrap = false;\r
private boolean HasDistances = false;\r
// File IO Flags\r
boolean ReplaceUnderscores = false;\r
boolean printRootInfo = false;\r
- private com.stevesoft.pat.Regex[] NodeSafeName = new com.stevesoft.pat.Regex[] {\r
+ private com.stevesoft.pat.Regex[] NodeSafeName = new com.stevesoft.pat.Regex[]\r
+ {\r
new com.stevesoft.pat.Regex().perlCode("m/[\\[,:'()]/"), // test for requiring quotes\r
new com.stevesoft.pat.Regex().perlCode("s/'/''/"), // escaping quote characters\r
new com.stevesoft.pat.Regex().perlCode("s/\\/w/_/") // unqoted whitespace transformation\r
};\r
char QuoteChar = '\'';\r
\r
- public NewickFile(String inStr) throws IOException {\r
+ /**\r
+ * Creates a new NewickFile object.\r
+ *\r
+ * @param inStr DOCUMENT ME!\r
+ *\r
+ * @throws IOException DOCUMENT ME!\r
+ */\r
+ public NewickFile(String inStr) throws IOException\r
+ {\r
super(inStr, "Paste");\r
}\r
\r
- public NewickFile(String inFile, String type) throws IOException {\r
+ /**\r
+ * Creates a new NewickFile object.\r
+ *\r
+ * @param inFile DOCUMENT ME!\r
+ * @param type DOCUMENT ME!\r
+ *\r
+ * @throws IOException DOCUMENT ME!\r
+ */\r
+ public NewickFile(String inFile, String type) throws IOException\r
+ {\r
super(inFile, type);\r
}\r
\r
- public NewickFile(SequenceNode newtree) {\r
+ /**\r
+ * Creates a new NewickFile object.\r
+ *\r
+ * @param newtree DOCUMENT ME!\r
+ */\r
+ public NewickFile(SequenceNode newtree)\r
+ {\r
root = newtree;\r
}\r
\r
- public NewickFile(SequenceNode newtree, boolean bootstrap) {\r
+ /**\r
+ * Creates a new NewickFile object.\r
+ *\r
+ * @param newtree DOCUMENT ME!\r
+ * @param bootstrap DOCUMENT ME!\r
+ */\r
+ public NewickFile(SequenceNode newtree, boolean bootstrap)\r
+ {\r
HasBootstrap = bootstrap;\r
root = newtree;\r
}\r
\r
- public NewickFile(SequenceNode newtree, boolean bootstrap, boolean distances) {\r
+ /**\r
+ * Creates a new NewickFile object.\r
+ *\r
+ * @param newtree DOCUMENT ME!\r
+ * @param bootstrap DOCUMENT ME!\r
+ * @param distances DOCUMENT ME!\r
+ */\r
+ public NewickFile(SequenceNode newtree, boolean bootstrap, boolean distances)\r
+ {\r
root = newtree;\r
HasBootstrap = bootstrap;\r
HasDistances = distances;\r
}\r
\r
+ /**\r
+ * Creates a new NewickFile object.\r
+ *\r
+ * @param newtree DOCUMENT ME!\r
+ * @param bootstrap DOCUMENT ME!\r
+ * @param distances DOCUMENT ME!\r
+ * @param rootdistance DOCUMENT ME!\r
+ */\r
public NewickFile(SequenceNode newtree, boolean bootstrap,\r
- boolean distances, boolean rootdistance) {\r
+ boolean distances, boolean rootdistance)\r
+ {\r
root = newtree;\r
HasBootstrap = bootstrap;\r
HasDistances = distances;\r
RootHasDistance = rootdistance;\r
}\r
\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param Error DOCUMENT ME!\r
+ * @param Er DOCUMENT ME!\r
+ * @param r DOCUMENT ME!\r
+ * @param p DOCUMENT ME!\r
+ * @param s DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
private String ErrorStringrange(String Error, String Er, int r, int p,\r
- String s) {\r
+ String s)\r
+ {\r
return ((Error == null) ? "" : Error) + Er + " at position " + p +\r
" ( " +\r
s.substring(((p - r) < 0) ? 0 : (p - r),\r
\r
// @tree annotations\r
// These are set automatically by the reader\r
- public boolean HasBootstrap() {\r
+ public boolean HasBootstrap()\r
+ {\r
return HasBootstrap;\r
}\r
\r
- public boolean HasDistances() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public boolean HasDistances()\r
+ {\r
return HasDistances;\r
}\r
\r
- public void parse() throws IOException {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @throws IOException DOCUMENT ME!\r
+ */\r
+ public void parse() throws IOException\r
+ {\r
String nf;\r
\r
{ // fill nf with complete tree file\r
\r
StringBuffer file = new StringBuffer();\r
\r
- while ((nf = nextLine()) != null) {\r
+ while ((nf = nextLine()) != null)\r
+ {\r
file.append(nf);\r
}\r
\r
com.stevesoft.pat.Regex majorsyms = new com.stevesoft.pat.Regex(\r
"[(\\['),;]");\r
\r
- while (majorsyms.searchFrom(nf, cp) && (Error == null)) {\r
+ while (majorsyms.searchFrom(nf, cp) && (Error == null))\r
+ {\r
int fcp = majorsyms.matchedFrom();\r
\r
- switch (nf.charAt(fcp)) {\r
+ switch (nf.charAt(fcp))\r
+ {\r
case '[': // Comment or structured/extended NH format info\r
\r
com.stevesoft.pat.Regex comment = new com.stevesoft.pat.Regex(\r
"]");\r
\r
- if (comment.searchFrom(nf, fcp)) {\r
+ if (comment.searchFrom(nf, fcp))\r
+ {\r
// Skip the comment field\r
cp = 1 + comment.matchedFrom();\r
- } else {\r
+ }\r
+ else\r
+ {\r
Error = ErrorStringrange(Error, "Unterminated comment", 3,\r
fcp, nf);\r
}\r
\r
// ascending should not be set\r
// New Internal node\r
- if (ascending) {\r
+ if (ascending)\r
+ {\r
Error = ErrorStringrange(Error, "Unexpected '('", 7, fcp, nf);\r
\r
continue;\r
;\r
d++;\r
\r
- if (c.right() == null) {\r
+ if (c.right() == null)\r
+ {\r
c.setRight(new SequenceNode(null, c, null, DefDistance,\r
DefBootstrap, false));\r
c = (SequenceNode) c.right();\r
- } else {\r
- if (c.left() != null) {\r
+ }\r
+ else\r
+ {\r
+ if (c.left() != null)\r
+ {\r
// Dummy node for polytomy - keeps c.left free for new node\r
SequenceNode tmpn = new SequenceNode(null, c, null, 0,\r
0, true);\r
c = (SequenceNode) c.left();\r
}\r
\r
- if (realroot == null) {\r
+ if (realroot == null)\r
+ {\r
realroot = c;\r
}\r
\r
com.stevesoft.pat.Regex qnodename = new com.stevesoft.pat.Regex(\r
"([^']|'')+'");\r
\r
- if (qnodename.searchFrom(nf, fcp)) {\r
+ if (qnodename.searchFrom(nf, fcp))\r
+ {\r
int nl = qnodename.stringMatched().length();\r
nodename = new String(qnodename.stringMatched().substring(0,\r
nl - 1));\r
cp = fcp + nl + 1;\r
- } else {\r
+ }\r
+ else\r
+ {\r
Error = ErrorStringrange(Error,\r
"Unterminated quotes for nodename", 7, fcp, nf);\r
}\r
\r
case ';':\r
\r
- if (d != -1) {\r
+ if (d != -1)\r
+ {\r
Error = ErrorStringrange(Error,\r
"Wayward semicolon (depth=" + d + ")", 7, fcp, nf);\r
}\r
if (uqnodename.search(fstring) &&\r
((uqnodename.matchedFrom(1) == 0) ||\r
(fstring.charAt(uqnodename.matchedFrom(1) - 1) != ':'))) // JBPNote HACK!\r
- {\r
- if (nodename == null) {\r
- if (ReplaceUnderscores) {\r
+ {\r
+ if (nodename == null)\r
+ {\r
+ if (ReplaceUnderscores)\r
+ {\r
nodename = uqnodename.stringMatched(1).replace('_',\r
' ');\r
- } else {\r
+ }\r
+ else\r
+ {\r
nodename = uqnodename.stringMatched(1);\r
}\r
- } else {\r
+ }\r
+ else\r
+ {\r
Error = ErrorStringrange(Error,\r
"File has broken algorithm - overwritten nodename",\r
10, fcp, nf);\r
\r
if (nbootstrap.search(fstring) &&\r
(nbootstrap.matchedFrom(1) > (uqnodename.matchedFrom(1) +\r
- uqnodename.stringMatched().length()))) {\r
- try {\r
+ uqnodename.stringMatched().length())))\r
+ {\r
+ try\r
+ {\r
bootstrap = (new Integer(nbootstrap.stringMatched(1))).intValue();\r
HasBootstrap = true;\r
- } catch (Exception e) {\r
+ }\r
+ catch (Exception e)\r
+ {\r
Error = ErrorStringrange(Error,\r
"Can't parse bootstrap value", 4,\r
cp + nbootstrap.matchedFrom(), nf);\r
\r
boolean nodehasdistance = false;\r
\r
- if (ndist.search(fstring)) {\r
- try {\r
+ if (ndist.search(fstring))\r
+ {\r
+ try\r
+ {\r
distance = (new Float(ndist.stringMatched(1))).floatValue();\r
HasDistances = true;\r
nodehasdistance = true;\r
- } catch (Exception e) {\r
+ }\r
+ catch (Exception e)\r
+ {\r
Error = ErrorStringrange(Error,\r
"Can't parse node distance value", 7,\r
cp + ndist.matchedFrom(), nf);\r
}\r
}\r
\r
- if (ascending) {\r
+ if (ascending)\r
+ {\r
// Write node info here\r
c.setName(nodename);\r
c.dist = (HasDistances) ? distance : 0;\r
c.setBootstrap((HasBootstrap) ? bootstrap : 0);\r
\r
- if (c == realroot) {\r
+ if (c == realroot)\r
+ {\r
RootHasDistance = nodehasdistance; // JBPNote This is really UGLY!!!\r
}\r
- } else {\r
+ }\r
+ else\r
+ {\r
// Find a place to put the leaf\r
SequenceNode newnode = new SequenceNode(null, c, nodename,\r
(HasDistances) ? distance : DefDistance,\r
(HasBootstrap) ? bootstrap : DefBootstrap, false);\r
\r
- if (c.right() == null) {\r
+ if (c.right() == null)\r
+ {\r
c.setRight(newnode);\r
- } else {\r
- if (c.left() == null) {\r
+ }\r
+ else\r
+ {\r
+ if (c.left() == null)\r
+ {\r
c.setLeft(newnode);\r
- } else {\r
+ }\r
+ else\r
+ {\r
// Insert a dummy node for polytomy\r
SequenceNode newdummy = new SequenceNode(null, c,\r
null, 0, 0, true);\r
}\r
}\r
\r
- if (ascending) {\r
+ if (ascending)\r
+ {\r
// move back up the tree from preceding closure\r
c = c.AscendTree();\r
\r
- if ((d > -1) && (c == null)) {\r
+ if ((d > -1) && (c == null))\r
+ {\r
Error = ErrorStringrange(Error,\r
"File broke algorithm: Lost place in tree (is there an extra ')' ?)",\r
7, fcp, nf);\r
}\r
}\r
\r
- if (nf.charAt(fcp) == ')') {\r
+ if (nf.charAt(fcp) == ')')\r
+ {\r
d--;\r
ascending = true;\r
- } else {\r
- if (nf.charAt(fcp) == ',') {\r
- if (ascending) {\r
+ }\r
+ else\r
+ {\r
+ if (nf.charAt(fcp) == ',')\r
+ {\r
+ if (ascending)\r
+ {\r
ascending = false;\r
- } else {\r
+ }\r
+ else\r
+ {\r
// Just advance focus, if we need to\r
- if ((c.left() != null) && (!c.left().isLeaf())) {\r
+ if ((c.left() != null) && (!c.left().isLeaf()))\r
+ {\r
c = (SequenceNode) c.left();\r
}\r
}\r
}\r
- // else : We do nothing if ';' is encountered.\r
+\r
+ // else : We do nothing if ';' is encountered.\r
}\r
\r
// Reset new node properties to obvious fakes\r
}\r
}\r
\r
- if (Error != null) {\r
+ if (Error != null)\r
+ {\r
throw (new IOException("NewickFile: " + Error + "\n"));\r
}\r
\r
root = (SequenceNode) root.right().detach(); // remove the imaginary root.\r
\r
- if (!RootHasDistance) {\r
+ if (!RootHasDistance)\r
+ {\r
root.dist = 0;\r
}\r
}\r
\r
- public SequenceNode getTree() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public SequenceNode getTree()\r
+ {\r
return root;\r
}\r
\r
- public String print() {\r
- synchronized (this) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public String print()\r
+ {\r
+ synchronized (this)\r
+ {\r
StringBuffer tf = new StringBuffer();\r
print(tf, root);\r
\r
}\r
}\r
\r
- public String print(boolean withbootstraps) {\r
- synchronized (this) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param withbootstraps DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public String print(boolean withbootstraps)\r
+ {\r
+ synchronized (this)\r
+ {\r
boolean boots = this.HasBootstrap;\r
this.HasBootstrap = withbootstraps;\r
\r
}\r
}\r
\r
- public String print(boolean withbootstraps, boolean withdists) {\r
- synchronized (this) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param withbootstraps DOCUMENT ME!\r
+ * @param withdists DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public String print(boolean withbootstraps, boolean withdists)\r
+ {\r
+ synchronized (this)\r
+ {\r
boolean dists = this.HasDistances;\r
this.HasDistances = withdists;\r
\r
}\r
}\r
\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param withbootstraps DOCUMENT ME!\r
+ * @param withdists DOCUMENT ME!\r
+ * @param printRootInfo DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
public String print(boolean withbootstraps, boolean withdists,\r
- boolean printRootInfo) {\r
- synchronized (this) {\r
+ boolean printRootInfo)\r
+ {\r
+ synchronized (this)\r
+ {\r
boolean rootinfo = printRootInfo;\r
this.printRootInfo = printRootInfo;\r
\r
}\r
}\r
\r
- char getQuoteChar() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ char getQuoteChar()\r
+ {\r
return QuoteChar;\r
}\r
\r
- char setQuoteChar(char c) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param c DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ char setQuoteChar(char c)\r
+ {\r
char old = QuoteChar;\r
QuoteChar = c;\r
\r
return old;\r
}\r
\r
- private String nodeName(String name) {\r
- if (NodeSafeName[0].search(name)) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param name DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ private String nodeName(String name)\r
+ {\r
+ if (NodeSafeName[0].search(name))\r
+ {\r
return QuoteChar + NodeSafeName[1].replaceAll(name) + QuoteChar;\r
- } else {\r
+ }\r
+ else\r
+ {\r
return NodeSafeName[2].replaceAll(name);\r
}\r
}\r
\r
- private String printNodeField(SequenceNode c) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param c DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ private String printNodeField(SequenceNode c)\r
+ {\r
return ((c.getName() == null) ? "" : nodeName(c.getName())) +\r
((HasBootstrap)\r
? ((c.getBootstrap() > -1) ? (" " + c.getBootstrap()) : "") : "") +\r
((HasDistances) ? (":" + c.dist) : "");\r
}\r
\r
- private String printRootField(SequenceNode root) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param root DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ private String printRootField(SequenceNode root)\r
+ {\r
return (printRootInfo)\r
? (((root.getName() == null) ? "" : nodeName(root.getName())) +\r
((HasBootstrap)\r
}\r
\r
// Non recursive call deals with root node properties\r
- public void print(StringBuffer tf, SequenceNode root) {\r
- if (root != null) {\r
- if (root.isLeaf() && printRootInfo) {\r
+ public void print(StringBuffer tf, SequenceNode root)\r
+ {\r
+ if (root != null)\r
+ {\r
+ if (root.isLeaf() && printRootInfo)\r
+ {\r
tf.append(printRootField(root));\r
- } else {\r
- if (root.isDummy()) {\r
+ }\r
+ else\r
+ {\r
+ if (root.isDummy())\r
+ {\r
_print(tf, (SequenceNode) root.right());\r
_print(tf, (SequenceNode) root.left());\r
- } else {\r
+ }\r
+ else\r
+ {\r
tf.append("(");\r
_print(tf, (SequenceNode) root.right());\r
\r
- if (root.left() != null) {\r
+ if (root.left() != null)\r
+ {\r
tf.append(",");\r
}\r
\r
}\r
\r
// Recursive call for non-root nodes\r
- public void _print(StringBuffer tf, SequenceNode c) {\r
- if (c != null) {\r
- if (c.isLeaf()) {\r
+ public void _print(StringBuffer tf, SequenceNode c)\r
+ {\r
+ if (c != null)\r
+ {\r
+ if (c.isLeaf())\r
+ {\r
tf.append(printNodeField(c));\r
- } else {\r
- if (c.isDummy()) {\r
+ }\r
+ else\r
+ {\r
+ if (c.isDummy())\r
+ {\r
_print(tf, (SequenceNode) c.right());\r
_print(tf, (SequenceNode) c.left());\r
- } else {\r
+ }\r
+ else\r
+ {\r
tf.append("(");\r
_print(tf, (SequenceNode) c.right());\r
\r
- if (c.left() != null) {\r
+ if (c.left() != null)\r
+ {\r
tf.append(",");\r
}\r
\r
}\r
\r
// Test\r
- public static void main(String[] args) {\r
- try {\r
+ public static void main(String[] args)\r
+ {\r
+ try\r
+ {\r
File fn = new File(args[0]);\r
\r
StringBuffer newickfile = new StringBuffer();\r
BufferedReader treefile = new BufferedReader(new FileReader(fn));\r
String l;\r
\r
- while ((l = treefile.readLine()) != null) {\r
+ while ((l = treefile.readLine()) != null)\r
+ {\r
newickfile.append(l);\r
}\r
\r
System.out.println(trf.print(false, false));\r
System.out.println("With bootstraps and with distances.\n");\r
System.out.println(trf.print(true, true));\r
- } catch (java.io.IOException e) {\r
+ }\r
+ catch (java.io.IOException e)\r
+ {\r
System.err.println("Exception\n" + e);\r
e.printStackTrace();\r
}\r
/*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
-*\r
-* This program is free software; you can redistribute it and/or\r
-* modify it under the terms of the GNU General Public License\r
-* as published by the Free Software Foundation; either version 2\r
-* of the License, or (at your option) any later version.\r
-*\r
-* This program is distributed in the hope that it will be useful,\r
-* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-* GNU General Public License for more details.\r
-*\r
-* You should have received a copy of the GNU General Public License\r
-* along with this program; if not, write to the Free Software\r
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
-*/\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
+ */\r
package jalview.io;\r
\r
-import jalview.analysis.*;\r
-\r
-import jalview.datamodel.*;\r
-\r
import java.io.*;\r
-\r
import java.util.*;\r
\r
+import jalview.analysis.*;\r
+import jalview.datamodel.*;\r
+\r
+public class PIRFile\r
+ extends AlignFile\r
+{\r
+ Vector words = new Vector(); //Stores the words in a line after splitting\r
+\r
+ public PIRFile()\r
+ {\r
+ }\r
+\r
+ public PIRFile(String inStr)\r
+ {\r
+ super(inStr);\r
+ }\r
+\r
+ public PIRFile(String inFile, String type)\r
+ throws IOException\r
+ {\r
+ super(inFile, type);\r
+ }\r
+\r
+ public void parse()\r
+ {\r
+ try\r
+ {\r
+ String id;\r
+ String start;\r
+ String end;\r
+ StringBuffer sequence;\r
+ String line = null;\r
+\r
+ while ( (line = nextLine()) != null)\r
+ {\r
+ try\r
+ {\r
+ id = line.substring(line.indexOf(";") + 1, line.indexOf("/"));\r
+ line = line.substring(line.indexOf("/") + 1);\r
+ start = line.substring(0, line.indexOf("-"));\r
+ end = line.substring(line.indexOf("-") + 1);\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ id = "No id";\r
+ start = "0";\r
+ end = "0";\r
+ }\r
\r
-public class PIRFile extends AlignFile {\r
- Vector words = new Vector(); //Stores the words in a line after splitting\r
+ sequence = new StringBuffer();\r
\r
- public PIRFile() {\r
- }\r
+ line = nextLine(); // this is the title line\r
\r
- public PIRFile(String inStr) {\r
- super(inStr);\r
- }\r
+ boolean starFound = false;\r
\r
- public PIRFile(String inFile, String type) throws IOException {\r
- super(inFile, type);\r
- }\r
+ do\r
+ {\r
+ line = nextLine();\r
+ sequence.append(line);\r
\r
- public void parse() {\r
- try {\r
- String id;\r
- String start;\r
- String end;\r
- StringBuffer sequence;\r
- String line = null;\r
-\r
- while ((line = nextLine()) != null) {\r
- try {\r
- id = line.substring(line.indexOf(";") + 1, line.indexOf("/"));\r
- line = line.substring(line.indexOf("/") + 1);\r
- start = line.substring(0, line.indexOf("-"));\r
- end = line.substring(line.indexOf("-") + 1);\r
- } catch (Exception ex) {\r
- id = "No id";\r
- start = "0";\r
- end = "0";\r
- }\r
-\r
- sequence = new StringBuffer();\r
-\r
- line = nextLine(); // this is the title line\r
-\r
- boolean starFound = false;\r
-\r
- do {\r
- line = nextLine();\r
- sequence.append(line);\r
-\r
- if (line.indexOf("*") > -1) {\r
- starFound = true;\r
- }\r
- } while (!starFound);\r
-\r
- sequence.setLength(sequence.length() - 1);\r
-\r
- Sequence newSeq = new Sequence(id, sequence.toString(),\r
- Integer.parseInt(start), Integer.parseInt(end));\r
- seqs.addElement(newSeq);\r
- }\r
- } catch (Exception ex) {\r
- ex.printStackTrace();\r
+ if (line.indexOf("*") > -1)\r
+ {\r
+ starFound = true;\r
+ }\r
}\r
- }\r
+ while (!starFound);\r
\r
- public String print() {\r
- return print(getSeqsAsArray());\r
- }\r
+ sequence.setLength(sequence.length() - 1);\r
\r
- public static String print(SequenceI[] s) {\r
- return print(s, 72, true);\r
+ Sequence newSeq = new Sequence(id, sequence.toString(),\r
+ Integer.parseInt(start),\r
+ Integer.parseInt(end));\r
+ seqs.addElement(newSeq);\r
+ }\r
}\r
-\r
- public static String print(SequenceI[] s, int len) {\r
- return print(s, len, true);\r
+ catch (Exception ex)\r
+ {\r
+ ex.printStackTrace();\r
}\r
-\r
- public static String print(SequenceI[] s, int len, boolean gaps) {\r
- StringBuffer out = new StringBuffer();\r
- int i = 0;\r
-\r
- while ((i < s.length) && (s[i] != null)) {\r
- String seq = "";\r
-\r
- if (gaps) {\r
- seq = s[i].getSequence() + "*";\r
- } else {\r
- seq = AlignSeq.extractGaps(s[i].getSequence(), "-");\r
- seq = AlignSeq.extractGaps(seq, ".");\r
- seq = AlignSeq.extractGaps(seq, " ");\r
- seq = seq + "*";\r
- }\r
-\r
- out.append(">P1;" + s[i].getName() + "/" + s[i].getStart() + "-" +\r
- s[i].getEnd() + "\n");\r
- out.append(" Dummy title\n");\r
-\r
- int nochunks = (seq.length() / len) + 1;\r
-\r
- for (int j = 0; j < nochunks; j++) {\r
- int start = j * len;\r
- int end = start + len;\r
-\r
- if (end < seq.length()) {\r
- out.append(seq.substring(start, end) + "\n");\r
- } else if (start < seq.length()) {\r
- out.append(seq.substring(start) + "\n");\r
- }\r
- }\r
-\r
- i++;\r
+ }\r
+\r
+ public String print()\r
+ {\r
+ return print(getSeqsAsArray());\r
+ }\r
+\r
+ public static String print(SequenceI[] s)\r
+ {\r
+ return print(s, 72, true);\r
+ }\r
+\r
+ public static String print(SequenceI[] s, int len)\r
+ {\r
+ return print(s, len, true);\r
+ }\r
+\r
+ public static String print(SequenceI[] s, int len, boolean gaps)\r
+ {\r
+ StringBuffer out = new StringBuffer();\r
+ int i = 0;\r
+\r
+ while ( (i < s.length) && (s[i] != null))\r
+ {\r
+ String seq = "";\r
+\r
+ if (gaps)\r
+ {\r
+ seq = s[i].getSequence() + "*";\r
+ }\r
+ else\r
+ {\r
+ seq = AlignSeq.extractGaps(s[i].getSequence(), "-");\r
+ seq = AlignSeq.extractGaps(seq, ".");\r
+ seq = AlignSeq.extractGaps(seq, " ");\r
+ seq = seq + "*";\r
+ }\r
+\r
+ out.append(">P1;" + s[i].getName() + "/" + s[i].getStart() + "-" +\r
+ s[i].getEnd() + "\n");\r
+ out.append(" Dummy title\n");\r
+\r
+ int nochunks = (seq.length() / len) + 1;\r
+\r
+ for (int j = 0; j < nochunks; j++)\r
+ {\r
+ int start = j * len;\r
+ int end = start + len;\r
+\r
+ if (end < seq.length())\r
+ {\r
+ out.append(seq.substring(start, end) + "\n");\r
}\r
+ else if (start < seq.length())\r
+ {\r
+ out.append(seq.substring(start) + "\n");\r
+ }\r
+ }\r
\r
- return out.toString();\r
+ i++;\r
}\r
\r
- public static void main(String[] args) {\r
- String inStr = ">P1;LCAT_MOUSE_90.35\nMGLPGSPWQRVLLLLGLLLPPATPFWLLNVLFPPHTTPKAELSNHTRPVILVPGCLGNRLEAKLDKPDVVNW\nMCYRKTEDFFTIWLDFNLFLPLGVDCWIDNTRIVYNHSSGRVSNAPGVQIRVPGFGKTESVEYVDDNKLAGY\n\n>LCAT_PAPAN_95.78\nMGPPGSPWQWVPLLLGLLLPPAAPFWLLNVLFPPHTTPKAELSNHTRPVILVPGCLGNQLEAKLDKPDVVNW\nMCYRKTEDFFTIWLDLNMFLPLGVDCWIDNTRVVYNRSSGLVSNAPGVQIRVPGFGKTYSVEYLDSSKLAGY\nLHTLVQNLVNNGYVRDETVRAAPYDWRLEPGQQEEYYHKLAGLVEEMHAAYGKPVFLIGHSLGCLHLLYFLL\n";\r
- PIRFile fa = new PIRFile(inStr);\r
- }\r
+ return out.toString();\r
+ }\r
+\r
+ public static void main(String[] args)\r
+ {\r
+ String inStr = ">P1;LCAT_MOUSE_90.35\nMGLPGSPWQRVLLLLGLLLPPATPFWLLNVLFPPHTTPKAELSNHTRPVILVPGCLGNRLEAKLDKPDVVNW\nMCYRKTEDFFTIWLDFNLFLPLGVDCWIDNTRIVYNHSSGRVSNAPGVQIRVPGFGKTESVEYVDDNKLAGY\n\n>LCAT_PAPAN_95.78\nMGPPGSPWQWVPLLLGLLLPPAAPFWLLNVLFPPHTTPKAELSNHTRPVILVPGCLGNQLEAKLDKPDVVNW\nMCYRKTEDFFTIWLDLNMFLPLGVDCWIDNTRVVYNRSSGLVSNAPGVQIRVPGFGKTYSVEYLDSSKLAGY\nLHTLVQNLVNNGYVRDETVRAAPYDWRLEPGQQEEYYHKLAGLVEEMHAAYGKPVFLIGHSLGCLHLLYFLL\n";\r
+ PIRFile fa = new PIRFile(inStr);\r
+ }\r
}\r
/*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
-*\r
-* This program is free software; you can redistribute it and/or\r
-* modify it under the terms of the GNU General Public License\r
-* as published by the Free Software Foundation; either version 2\r
-* of the License, or (at your option) any later version.\r
-*\r
-* This program is distributed in the hope that it will be useful,\r
-* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-* GNU General Public License for more details.\r
-*\r
-* You should have received a copy of the GNU General Public License\r
-* along with this program; if not, write to the Free Software\r
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
-*/\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
+ */\r
package jalview.io;\r
\r
-import jalview.datamodel.*;\r
-\r
-import jalview.util.*;\r
-\r
import java.io.*;\r
-\r
import java.util.*;\r
\r
+import jalview.datamodel.*;\r
+import jalview.util.*;\r
\r
-public class PfamFile extends AlignFile {\r
- Vector ids;\r
+public class PfamFile\r
+ extends AlignFile\r
+{\r
+ Vector ids;\r
+\r
+ public PfamFile()\r
+ {\r
+ }\r
+\r
+ public PfamFile(String inStr)\r
+ {\r
+ super(inStr);\r
+ }\r
+\r
+ public PfamFile(String inFile, String type)\r
+ throws IOException\r
+ {\r
+ super(inFile, type);\r
+ }\r
+\r
+ public void initData()\r
+ {\r
+ super.initData();\r
+ ids = new Vector();\r
+ }\r
+\r
+ public void parse()\r
+ throws IOException\r
+ {\r
+ int i = 0;\r
+ String line;\r
+\r
+ Hashtable seqhash = new Hashtable();\r
+ Vector headers = new Vector();\r
+\r
+ while ( (line = nextLine()) != null)\r
+ {\r
+ if (line.indexOf(" ") != 0)\r
+ {\r
+ if (line.indexOf("#") != 0)\r
+ {\r
+ StringTokenizer str = new StringTokenizer(line, " ");\r
+ String id = "";\r
+\r
+ if (str.hasMoreTokens())\r
+ {\r
+ id = str.nextToken();\r
+\r
+ StringBuffer tempseq;\r
+\r
+ if (seqhash.containsKey(id))\r
+ {\r
+ tempseq = (StringBuffer) seqhash.get(id);\r
+ }\r
+ else\r
+ {\r
+ tempseq = new StringBuffer();\r
+ seqhash.put(id, tempseq);\r
+ }\r
\r
- public PfamFile() {\r
- }\r
+ if (! (headers.contains(id)))\r
+ {\r
+ headers.addElement(id);\r
+ }\r
\r
- public PfamFile(String inStr) {\r
- super(inStr);\r
+ tempseq.append(str.nextToken());\r
+ }\r
+ }\r
+ }\r
}\r
\r
- public PfamFile(String inFile, String type) throws IOException {\r
- super(inFile, type);\r
- }\r
+ this.noSeqs = headers.size();\r
\r
- public void initData() {\r
- super.initData();\r
- ids = new Vector();\r
+ if (noSeqs < 1)\r
+ {\r
+ throw new IOException("No sequences found (PFAM input)");\r
}\r
\r
- public void parse() throws IOException {\r
- int i = 0;\r
- String line;\r
-\r
- Hashtable seqhash = new Hashtable();\r
- Vector headers = new Vector();\r
-\r
- while ((line = nextLine()) != null) {\r
- if (line.indexOf(" ") != 0) {\r
- if (line.indexOf("#") != 0) {\r
- StringTokenizer str = new StringTokenizer(line, " ");\r
- String id = "";\r
+ for (i = 0; i < headers.size(); i++)\r
+ {\r
+ if (seqhash.get(headers.elementAt(i)) != null)\r
+ {\r
+ if (maxLength < seqhash.get(headers.elementAt(i)).toString()\r
+ .length())\r
+ {\r
+ maxLength = seqhash.get(headers.elementAt(i)).toString()\r
+ .length();\r
+ }\r
\r
- if (str.hasMoreTokens()) {\r
- id = str.nextToken();\r
+ String head = headers.elementAt(i).toString();\r
+ int start = 1;\r
+ int end = seqhash.get(headers.elementAt(i)).toString().length();\r
\r
- StringBuffer tempseq;\r
+ if (head.indexOf("/") > 0)\r
+ {\r
+ StringTokenizer st = new StringTokenizer(head, "/");\r
\r
- if (seqhash.containsKey(id)) {\r
- tempseq = (StringBuffer) seqhash.get(id);\r
- } else {\r
- tempseq = new StringBuffer();\r
- seqhash.put(id, tempseq);\r
- }\r
+ if (st.countTokens() == 2)\r
+ {\r
+ ids.addElement(st.nextToken());\r
\r
- if (!(headers.contains(id))) {\r
- headers.addElement(id);\r
- }\r
+ String tmp = st.nextToken();\r
+ st = new StringTokenizer(tmp, "-");\r
\r
- tempseq.append(str.nextToken());\r
- }\r
- }\r
+ if (st.countTokens() == 2)\r
+ {\r
+ start = Integer.valueOf(st.nextToken()).intValue();\r
+ end = Integer.valueOf(st.nextToken()).intValue();\r
+ }\r
+ else\r
+ {\r
+ start = -1;\r
+ end = -1;\r
}\r
+ }\r
+ else\r
+ {\r
+ ids.addElement(headers.elementAt(i));\r
+ }\r
+ }\r
+ else\r
+ {\r
+ ids.addElement(headers.elementAt(i));\r
}\r
\r
- this.noSeqs = headers.size();\r
+ Sequence newSeq = null;\r
\r
- if (noSeqs < 1) {\r
- throw new IOException("No sequences found (PFAM input)");\r
+ if ( (start != -1) && (end != -1))\r
+ {\r
+ newSeq = new Sequence(ids.elementAt(i).toString(),\r
+ seqhash.get(headers.elementAt(i).toString())\r
+ .toString(), start, end);\r
+ seqs.addElement(newSeq);\r
+ }\r
+ else\r
+ {\r
+ newSeq = new Sequence(ids.elementAt(i).toString(),\r
+ seqhash.get(headers.elementAt(i).toString())\r
+ .toString(), 1,\r
+ seqhash.get(headers.elementAt(i).toString())\r
+ .toString().length());\r
+ seqs.addElement(newSeq);\r
}\r
\r
- for (i = 0; i < headers.size(); i++) {\r
- if (seqhash.get(headers.elementAt(i)) != null) {\r
- if (maxLength < seqhash.get(headers.elementAt(i)).toString()\r
- .length()) {\r
- maxLength = seqhash.get(headers.elementAt(i)).toString()\r
- .length();\r
- }\r
-\r
- String head = headers.elementAt(i).toString();\r
- int start = 1;\r
- int end = seqhash.get(headers.elementAt(i)).toString().length();\r
-\r
- if (head.indexOf("/") > 0) {\r
- StringTokenizer st = new StringTokenizer(head, "/");\r
-\r
- if (st.countTokens() == 2) {\r
- ids.addElement(st.nextToken());\r
-\r
- String tmp = st.nextToken();\r
- st = new StringTokenizer(tmp, "-");\r
-\r
- if (st.countTokens() == 2) {\r
- start = Integer.valueOf(st.nextToken()).intValue();\r
- end = Integer.valueOf(st.nextToken()).intValue();\r
- } else {\r
- start = -1;\r
- end = -1;\r
- }\r
- } else {\r
- ids.addElement(headers.elementAt(i));\r
- }\r
- } else {\r
- ids.addElement(headers.elementAt(i));\r
- }\r
-\r
- Sequence newSeq = null;\r
-\r
- if ((start != -1) && (end != -1)) {\r
- newSeq = new Sequence(ids.elementAt(i).toString(),\r
- seqhash.get(headers.elementAt(i).toString())\r
- .toString(), start, end);\r
- seqs.addElement(newSeq);\r
- } else {\r
- newSeq = new Sequence(ids.elementAt(i).toString(),\r
- seqhash.get(headers.elementAt(i).toString())\r
- .toString(), 1,\r
- seqhash.get(headers.elementAt(i).toString())\r
- .toString().length());\r
- seqs.addElement(newSeq);\r
- }\r
-\r
- if (!isValidProteinSequence(newSeq.getSequence())) {\r
- throw new IOException(\r
- "Not a valid protein sequence - (PFAM input)");\r
- }\r
- } else {\r
- System.err.println("PFAM File reader: Can't find sequence for " +\r
- headers.elementAt(i));\r
- }\r
+ if (!isValidProteinSequence(newSeq.getSequence()))\r
+ {\r
+ throw new IOException(\r
+ "Not a valid protein sequence - (PFAM input)");\r
}\r
+ }\r
+ else\r
+ {\r
+ System.err.println("PFAM File reader: Can't find sequence for " +\r
+ headers.elementAt(i));\r
+ }\r
}\r
+ }\r
\r
- public static String print(SequenceI[] s) {\r
- StringBuffer out = new StringBuffer("");\r
+ public static String print(SequenceI[] s)\r
+ {\r
+ StringBuffer out = new StringBuffer("");\r
\r
- int max = 0;\r
- int maxid = 0;\r
+ int max = 0;\r
+ int maxid = 0;\r
\r
- int i = 0;\r
+ int i = 0;\r
\r
- while ((i < s.length) && (s[i] != null)) {\r
- String tmp = s[i].getName() + "/" + s[i].getStart() + "-" +\r
- s[i].getEnd();\r
+ while ( (i < s.length) && (s[i] != null))\r
+ {\r
+ String tmp = s[i].getName() + "/" + s[i].getStart() + "-" +\r
+ s[i].getEnd();\r
\r
- if (s[i].getSequence().length() > max) {\r
- max = s[i].getSequence().length();\r
- }\r
+ if (s[i].getSequence().length() > max)\r
+ {\r
+ max = s[i].getSequence().length();\r
+ }\r
\r
- if (tmp.length() > maxid) {\r
- maxid = tmp.length();\r
- }\r
+ if (tmp.length() > maxid)\r
+ {\r
+ maxid = tmp.length();\r
+ }\r
\r
- i++;\r
- }\r
+ i++;\r
+ }\r
\r
- if (maxid < 15) {\r
- maxid = 15;\r
- }\r
+ if (maxid < 15)\r
+ {\r
+ maxid = 15;\r
+ }\r
\r
- int j = 0;\r
+ int j = 0;\r
\r
- while ((j < s.length) && (s[j] != null)) {\r
- out.append(new Format("%-" + maxid + "s").form(s[j].getName() +\r
- "/" + s[j].getStart() + "-" + s[j].getEnd()) + " ");\r
+ while ( (j < s.length) && (s[j] != null))\r
+ {\r
+ out.append(new Format("%-" + maxid + "s").form(s[j].getName() +\r
+ "/" + s[j].getStart() + "-" + s[j].getEnd()) + " ");\r
\r
- out.append(s[j].getSequence() + "\n");\r
- j++;\r
- }\r
+ out.append(s[j].getSequence() + "\n");\r
+ j++;\r
+ }\r
\r
- out.append("\n");\r
+ out.append("\n");\r
\r
- return out.toString();\r
- }\r
+ return out.toString();\r
+ }\r
\r
- public String print() {\r
- return print(getSeqsAsArray());\r
- }\r
+ public String print()\r
+ {\r
+ return print(getSeqsAsArray());\r
+ }\r
}\r
-/*
-* Jalview - A Sequence Alignment Editor and Viewer
-* Copyright (C) 2005 AM Waterhouse, J Procter, 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 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.
-*
-* 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
-*/\r
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
+ */\r
package jalview.io;\r
\r
-\r
-/**
- * <p>Title: </p>
- * PileUpfile
- * <p>Description: </p>
- *
- * Read and write PileUp style MSF Files.
- * This used to be the MSFFile class, and was written according to the EBI's idea
- * of a subset of the MSF alignment format. But, that was updated to reflect current
- * GCG style IO fashion, as found in Emboss (thanks David Martin!)
- *
+/**\r
+ * <p>Title: </p>\r
+ * PileUpfile\r
+ * <p>Description: </p>\r
+ *\r
+ * Read and write PileUp style MSF Files.\r
+ * This used to be the MSFFile class, and was written according to the EBI's idea\r
+ * of a subset of the MSF alignment format. But, that was updated to reflect current\r
+ * GCG style IO fashion, as found in Emboss (thanks David Martin!)\r
+ *\r
**/\r
-import jalview.datamodel.*;\r
-\r
-import jalview.util.*;\r
-\r
import java.io.*;\r
-\r
import java.util.*;\r
\r
+import jalview.datamodel.*;\r
+import jalview.util.*;\r
\r
-public class PileUpfile extends AlignFile {\r
- public PileUpfile() {\r
- }\r
-\r
- public PileUpfile(String inStr) {\r
- super(inStr);\r
- }\r
-\r
- public PileUpfile(String inFile, String type) throws IOException {\r
- super(inFile, type);\r
- }\r
+public class PileUpfile\r
+ extends AlignFile\r
+{\r
+ public PileUpfile()\r
+ {\r
+ }\r
+\r
+ public PileUpfile(String inStr)\r
+ {\r
+ super(inStr);\r
+ }\r
+\r
+ public PileUpfile(String inFile, String type)\r
+ throws IOException\r
+ {\r
+ super(inFile, type);\r
+ }\r
+\r
+ public void parse()\r
+ {\r
+ int i = 0;\r
+ boolean seqFlag = false;\r
+ String key = new String();\r
+ Vector headers = new Vector();\r
+ Hashtable seqhash = new Hashtable();\r
+ String line;\r
+\r
+ try\r
+ {\r
+ while ( (line = nextLine()) != null)\r
+ {\r
+ StringTokenizer str = new StringTokenizer(line);\r
+\r
+ while (str.hasMoreTokens())\r
+ {\r
+ String inStr = str.nextToken();\r
+\r
+ //If line has header information add to the headers vector\r
+ if (inStr.indexOf("Name:") != -1)\r
+ {\r
+ key = str.nextToken();\r
+ headers.addElement(key);\r
+ }\r
+\r
+ //if line has // set SeqFlag to 1 so we know sequences are coming\r
+ if (inStr.indexOf("//") != -1)\r
+ {\r
+ seqFlag = true;\r
+ }\r
+\r
+ //Process lines as sequence lines if seqFlag is set\r
+ if ( (inStr.indexOf("//") == -1) && (seqFlag == true))\r
+ {\r
+ //seqeunce id is the first field\r
+ key = inStr;\r
+\r
+ StringBuffer tempseq;\r
+\r
+ //Get sequence from hash if it exists\r
+ if (seqhash.containsKey(key))\r
+ {\r
+ tempseq = (StringBuffer) seqhash.get(key);\r
+ }\r
+ else\r
+ {\r
+ tempseq = new StringBuffer();\r
+ seqhash.put(key, tempseq);\r
+ }\r
\r
- public void parse() {\r
- int i = 0;\r
- boolean seqFlag = false;\r
- String key = new String();\r
- Vector headers = new Vector();\r
- Hashtable seqhash = new Hashtable();\r
- String line;\r
-\r
- try {\r
- while ((line = nextLine()) != null) {\r
- StringTokenizer str = new StringTokenizer(line);\r
-\r
- while (str.hasMoreTokens()) {\r
- String inStr = str.nextToken();\r
-\r
- //If line has header information add to the headers vector\r
- if (inStr.indexOf("Name:") != -1) {\r
- key = str.nextToken();\r
- headers.addElement(key);\r
- }\r
-\r
- //if line has // set SeqFlag to 1 so we know sequences are coming\r
- if (inStr.indexOf("//") != -1) {\r
- seqFlag = true;\r
- }\r
-\r
- //Process lines as sequence lines if seqFlag is set\r
- if ((inStr.indexOf("//") == -1) && (seqFlag == true)) {\r
- //seqeunce id is the first field\r
- key = inStr;\r
-\r
- StringBuffer tempseq;\r
-\r
- //Get sequence from hash if it exists\r
- if (seqhash.containsKey(key)) {\r
- tempseq = (StringBuffer) seqhash.get(key);\r
- } else {\r
- tempseq = new StringBuffer();\r
- seqhash.put(key, tempseq);\r
- }\r
-\r
- //loop through the rest of the words\r
- while (str.hasMoreTokens()) {\r
- //append the word to the sequence\r
- tempseq.append(str.nextToken());\r
- }\r
- }\r
- }\r
+ //loop through the rest of the words\r
+ while (str.hasMoreTokens())\r
+ {\r
+ //append the word to the sequence\r
+ tempseq.append(str.nextToken());\r
}\r
- } catch (IOException e) {\r
- System.err.println("Exception parsing PileUpfile " + e);\r
- e.printStackTrace();\r
+ }\r
}\r
+ }\r
+ }\r
+ catch (IOException e)\r
+ {\r
+ System.err.println("Exception parsing PileUpfile " + e);\r
+ e.printStackTrace();\r
+ }\r
\r
- this.noSeqs = headers.size();\r
-\r
- //Add sequences to the hash\r
- for (i = 0; i < headers.size(); i++) {\r
- if (seqhash.get(headers.elementAt(i)) != null) {\r
- String head = headers.elementAt(i).toString();\r
- String seq = seqhash.get(head).toString();\r
-\r
- int start = 1;\r
- int end = seq.length();\r
+ this.noSeqs = headers.size();\r
\r
- if (maxLength < head.length()) {\r
- maxLength = head.length();\r
- }\r
+ //Add sequences to the hash\r
+ for (i = 0; i < headers.size(); i++)\r
+ {\r
+ if (seqhash.get(headers.elementAt(i)) != null)\r
+ {\r
+ String head = headers.elementAt(i).toString();\r
+ String seq = seqhash.get(head).toString();\r
\r
- if (head.indexOf("/") > 0) {\r
- StringTokenizer st = new StringTokenizer(head, "/");\r
+ int start = 1;\r
+ int end = seq.length();\r
\r
- if (st.countTokens() == 2) {\r
- head = st.nextToken();\r
+ if (maxLength < head.length())\r
+ {\r
+ maxLength = head.length();\r
+ }\r
\r
- String tmp = st.nextToken();\r
- st = new StringTokenizer(tmp, "-");\r
+ if (head.indexOf("/") > 0)\r
+ {\r
+ StringTokenizer st = new StringTokenizer(head, "/");\r
\r
- if (st.countTokens() == 2) {\r
- start = Integer.valueOf(st.nextToken()).intValue();\r
- end = Integer.valueOf(st.nextToken()).intValue();\r
- }\r
- }\r
- }\r
+ if (st.countTokens() == 2)\r
+ {\r
+ head = st.nextToken();\r
\r
- Sequence newSeq = new Sequence(head, seq, start, end);\r
+ String tmp = st.nextToken();\r
+ st = new StringTokenizer(tmp, "-");\r
\r
- seqs.addElement(newSeq);\r
- } else {\r
- System.err.println(\r
- "PileUpfile Parser: Can't find sequence for " +\r
- headers.elementAt(i));\r
+ if (st.countTokens() == 2)\r
+ {\r
+ start = Integer.valueOf(st.nextToken()).intValue();\r
+ end = Integer.valueOf(st.nextToken()).intValue();\r
}\r
+ }\r
}\r
- }\r
\r
- public static int checkSum(String seq) {\r
- //String chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.*~&@";\r
- int check = 0;\r
-\r
- String index = "--------------------------------------&---*---.-----------------@ABCDEFGHIJKLMNOPQRSTUVWXYZ------ABCDEFGHIJKLMNOPQRSTUVWXYZ----@";\r
- index += "--------------------------------------------------------------------------------------------------------------------------------";\r
-\r
- for (int i = 0; i < seq.length(); i++) {\r
- try {\r
- if (i < seq.length()) {\r
- int pos = index.indexOf(seq.substring(i, i + 1));\r
-\r
- if (!index.substring(pos, pos + 1).equals("_")) {\r
- check += (((i % 57) + 1) * pos);\r
- }\r
- }\r
- } catch (Exception e) {\r
- System.err.println("Exception during MSF Checksum calculation");\r
- e.printStackTrace();\r
- }\r
- }\r
+ Sequence newSeq = new Sequence(head, seq, start, end);\r
\r
- return check % 10000;\r
+ seqs.addElement(newSeq);\r
+ }\r
+ else\r
+ {\r
+ System.err.println(\r
+ "PileUpfile Parser: Can't find sequence for " +\r
+ headers.elementAt(i));\r
+ }\r
+ }\r
+ }\r
+\r
+ public static int checkSum(String seq)\r
+ {\r
+ //String chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.*~&@";\r
+ int check = 0;\r
+\r
+ String index = "--------------------------------------&---*---.-----------------@ABCDEFGHIJKLMNOPQRSTUVWXYZ------ABCDEFGHIJKLMNOPQRSTUVWXYZ----@";\r
+ index += "--------------------------------------------------------------------------------------------------------------------------------";\r
+\r
+ for (int i = 0; i < seq.length(); i++)\r
+ {\r
+ try\r
+ {\r
+ if (i < seq.length())\r
+ {\r
+ int pos = index.indexOf(seq.substring(i, i + 1));\r
+\r
+ if (!index.substring(pos, pos + 1).equals("_"))\r
+ {\r
+ check += ( ( (i % 57) + 1) * pos);\r
+ }\r
+ }\r
+ }\r
+ catch (Exception e)\r
+ {\r
+ System.err.println("Exception during MSF Checksum calculation");\r
+ e.printStackTrace();\r
+ }\r
}\r
\r
- public static String print(SequenceI[] s) {\r
- StringBuffer out = new StringBuffer("PileUp\n\n");\r
+ return check % 10000;\r
+ }\r
\r
- int max = 0;\r
- int maxid = 0;\r
+ public static String print(SequenceI[] s)\r
+ {\r
+ StringBuffer out = new StringBuffer("PileUp\n\n");\r
\r
- int i = 0;\r
- String big = "";\r
+ int max = 0;\r
+ int maxid = 0;\r
\r
- while ((i < s.length) && (s[i] != null)) {\r
- big += s[i].getSequence();\r
- i++;\r
- }\r
+ int i = 0;\r
+ String big = "";\r
\r
- i = 0;\r
+ while ( (i < s.length) && (s[i] != null))\r
+ {\r
+ big += s[i].getSequence();\r
+ i++;\r
+ }\r
\r
- int bigcheck = checkSum(big);\r
+ i = 0;\r
\r
- out.append(" MSF: " + s[0].getSequence().length() +\r
- " Type: P Check: " + bigcheck + " ..\n\n\n");\r
+ int bigcheck = checkSum(big);\r
\r
- while ((i < s.length) && (s[i] != null)) {\r
- String seq = s[i].getSequence();\r
- String name = s[i].getName() + "/" + s[i].getStart() + "-" +\r
- s[i].getEnd();\r
- int check = checkSum(s[i].getSequence());\r
- out.append(" Name: " + name + " oo Len: " +\r
- s[i].getSequence().length() + " Check: " + check +\r
- " Weight: 1.00\n");\r
+ out.append(" MSF: " + s[0].getSequence().length() +\r
+ " Type: P Check: " + bigcheck + " ..\n\n\n");\r
\r
- if (seq.length() > max) {\r
- max = seq.length();\r
- }\r
+ while ( (i < s.length) && (s[i] != null))\r
+ {\r
+ String seq = s[i].getSequence();\r
+ String name = s[i].getName() + "/" + s[i].getStart() + "-" +\r
+ s[i].getEnd();\r
+ int check = checkSum(s[i].getSequence());\r
+ out.append(" Name: " + name + " oo Len: " +\r
+ s[i].getSequence().length() + " Check: " + check +\r
+ " Weight: 1.00\n");\r
\r
- if (name.length() > maxid) {\r
- maxid = name.length();\r
- }\r
+ if (seq.length() > max)\r
+ {\r
+ max = seq.length();\r
+ }\r
\r
- i++;\r
- }\r
+ if (name.length() > maxid)\r
+ {\r
+ maxid = name.length();\r
+ }\r
\r
- if (maxid < 10) {\r
- maxid = 10;\r
- }\r
+ i++;\r
+ }\r
\r
- maxid++;\r
- out.append("\n\n//\n\n");\r
+ if (maxid < 10)\r
+ {\r
+ maxid = 10;\r
+ }\r
\r
- int len = 50;\r
+ maxid++;\r
+ out.append("\n\n//\n\n");\r
\r
- int nochunks = (max / len) + 1;\r
+ int len = 50;\r
\r
- if ((max % len) == 0) {\r
- nochunks--;\r
- }\r
+ int nochunks = (max / len) + 1;\r
\r
- for (i = 0; i < nochunks; i++) {\r
- int j = 0;\r
-\r
- while ((j < s.length) && (s[j] != null)) {\r
- String name = s[j].getName();\r
- out.append(new Format("%-" + maxid + "s").form(name + "/" +\r
- s[j].getStart() + "-" + s[j].getEnd()) + " ");\r
-\r
- for (int k = 0; k < 5; k++) {\r
- int start = (i * 50) + (k * 10);\r
- int end = start + 10;\r
-\r
- if ((end < s[j].getSequence().length()) &&\r
- (start < s[j].getSequence().length())) {\r
- out.append(s[j].getSequence().substring(start, end));\r
-\r
- if (k < 4) {\r
- out.append(" ");\r
- } else {\r
- out.append("\n");\r
- }\r
- } else {\r
- if (start < s[j].getSequence().length()) {\r
- out.append(s[j].getSequence().substring(start));\r
- out.append("\n");\r
- } else {\r
- if (k == 0) {\r
- out.append("\n");\r
- }\r
- }\r
- }\r
- }\r
-\r
- j++;\r
- }\r
+ if ( (max % len) == 0)\r
+ {\r
+ nochunks--;\r
+ }\r
\r
- out.append("\n");\r
+ for (i = 0; i < nochunks; i++)\r
+ {\r
+ int j = 0;\r
+\r
+ while ( (j < s.length) && (s[j] != null))\r
+ {\r
+ String name = s[j].getName();\r
+ out.append(new Format("%-" + maxid + "s").form(name + "/" +\r
+ s[j].getStart() + "-" + s[j].getEnd()) + " ");\r
+\r
+ for (int k = 0; k < 5; k++)\r
+ {\r
+ int start = (i * 50) + (k * 10);\r
+ int end = start + 10;\r
+\r
+ if ( (end < s[j].getSequence().length()) &&\r
+ (start < s[j].getSequence().length()))\r
+ {\r
+ out.append(s[j].getSequence().substring(start, end));\r
+\r
+ if (k < 4)\r
+ {\r
+ out.append(" ");\r
+ }\r
+ else\r
+ {\r
+ out.append("\n");\r
+ }\r
+ }\r
+ else\r
+ {\r
+ if (start < s[j].getSequence().length())\r
+ {\r
+ out.append(s[j].getSequence().substring(start));\r
+ out.append("\n");\r
+ }\r
+ else\r
+ {\r
+ if (k == 0)\r
+ {\r
+ out.append("\n");\r
+ }\r
+ }\r
+ }\r
}\r
\r
- return out.toString();\r
- }\r
+ j++;\r
+ }\r
\r
- public String print() {\r
- return print(getSeqsAsArray());\r
+ out.append("\n");\r
}\r
+\r
+ return out.toString();\r
+ }\r
+\r
+ public String print()\r
+ {\r
+ return print(getSeqsAsArray());\r
+ }\r
}\r
import java.util.*;\r
\r
\r
-public class SequenceFeatureFetcher implements Runnable {\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class SequenceFeatureFetcher implements Runnable\r
+{\r
AlignmentI align;\r
AlignmentPanel ap;\r
ArrayList unknownSequences;\r
CutAndPasteTransfer output = new CutAndPasteTransfer();\r
StringBuffer sbuffer = new StringBuffer();\r
\r
- public SequenceFeatureFetcher(AlignmentI align, AlignmentPanel ap) {\r
+ /**\r
+ * Creates a new SequenceFeatureFetcher object.\r
+ *\r
+ * @param align DOCUMENT ME!\r
+ * @param ap DOCUMENT ME!\r
+ */\r
+ public SequenceFeatureFetcher(AlignmentI align, AlignmentPanel ap)\r
+ {\r
unknownSequences = new ArrayList();\r
this.align = align;\r
this.ap = ap;\r
thread.start();\r
}\r
\r
- public void run() {\r
-\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ public void run()\r
+ {\r
RandomAccessFile out = null;\r
\r
- try {\r
- String cache = System.getProperty("user.home") + "/.jalview.uniprot.xml";\r
+ try\r
+ {\r
+ String cache = System.getProperty("user.home") +\r
+ "/.jalview.uniprot.xml";\r
\r
File test = new File(cache);\r
\r
- if (!test.exists()) {\r
+ if (!test.exists())\r
+ {\r
out = new RandomAccessFile(cache, "rw");\r
out.writeBytes("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");\r
out.writeBytes("<UNIPROT_CACHE>\n");\r
- } else {\r
+ }\r
+ else\r
+ {\r
out = new RandomAccessFile(cache, "rw");\r
\r
// open exisiting cache and remove </UNIPROT_CACHE> from the end\r
long lastLine = 0;\r
String data;\r
\r
- while ((data = out.readLine()) != null) {\r
- if (data.indexOf("</entry>") > -1) {\r
+ while ((data = out.readLine()) != null)\r
+ {\r
+ if (data.indexOf("</entry>") > -1)\r
+ {\r
lastLine = out.getFilePointer();\r
}\r
}\r
int seqIndex = 0;\r
Vector sequences = align.getSequences();\r
\r
- while (seqIndex < sequences.size()) {\r
+ while (seqIndex < sequences.size())\r
+ {\r
ArrayList ids = new ArrayList();\r
\r
for (int i = 0; (seqIndex < sequences.size()) && (i < 50);\r
- seqIndex++, i++) {\r
+ seqIndex++, i++)\r
+ {\r
SequenceI sequence = (SequenceI) sequences.get(seqIndex);\r
ids.add(sequence.getName());\r
}\r
\r
tryLocalCacheFirst(ids, align);\r
\r
- if (ids.size() > 0) {\r
+ if (ids.size() > 0)\r
+ {\r
StringBuffer remainingIds = new StringBuffer("uniprot:");\r
\r
for (int i = 0; i < ids.size(); i++)\r
String[] result = ebi.fetchData(remainingIds.toString(),\r
"xml", null);\r
\r
- if (result != null) {\r
+ if (result != null)\r
+ {\r
ReadUniprotFile(result, out, align);\r
}\r
}\r
}\r
\r
- if (out != null) {\r
+ if (out != null)\r
+ {\r
out.writeBytes("</UNIPROT_CACHE>\n");\r
out.close();\r
}\r
- } catch (Exception ex) {\r
+ }\r
+ catch (Exception ex)\r
+ {\r
ex.printStackTrace();\r
}\r
\r
findMissingIds(align);\r
\r
- if (sbuffer.length() > 0) {\r
+ if (sbuffer.length() > 0)\r
+ {\r
output.setText(\r
"Your sequences have been matched to Uniprot. Some of the ids have been\n" +\r
"altered, most likely the start/end residue will have been updated.\n" +\r
Desktop.addInternalFrame(output, "Sequence names updated ", 600, 300);\r
}\r
\r
- if (unknownSequences.size() > 0) {\r
+ if (unknownSequences.size() > 0)\r
+ {\r
//ignore for now!!!!!!!!!!\r
// WSWUBlastClient blastClient = new WSWUBlastClient(align, unknownSequences);\r
}\r
jalview.gui.PaintRefresher.Refresh(null, align);\r
}\r
\r
- void ReadUniprotFile(String[] result, RandomAccessFile out, AlignmentI align) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param result DOCUMENT ME!\r
+ * @param out DOCUMENT ME!\r
+ * @param align DOCUMENT ME!\r
+ */\r
+ void ReadUniprotFile(String[] result, RandomAccessFile out, AlignmentI align)\r
+ {\r
SequenceI sequence = null;\r
Vector features = null;\r
String type;\r
String end;\r
String pdb = null;\r
\r
- for (int r = 0; r < result.length; r++) {\r
- if ((sequence == null) && (result[r].indexOf("<name>") > -1)) {\r
+ for (int r = 0; r < result.length; r++)\r
+ {\r
+ if ((sequence == null) && (result[r].indexOf("<name>") > -1))\r
+ {\r
long filePointer = 0;\r
\r
- if (out != null) {\r
- try {\r
+ if (out != null)\r
+ {\r
+ try\r
+ {\r
filePointer = out.getFilePointer();\r
out.writeBytes("<entry>\n");\r
- } catch (Exception ex) {\r
+ }\r
+ catch (Exception ex)\r
+ {\r
}\r
}\r
\r
String seqName = parseElement(result[r], "<name>", out);\r
sequence = align.findName(seqName);\r
\r
- if (sequence == null) {\r
+ if (sequence == null)\r
+ {\r
sequence = align.findName(seqName.substring(0,\r
seqName.indexOf('_')));\r
\r
- if (sequence != null) {\r
+ if (sequence != null)\r
+ {\r
sbuffer.append("changing " + sequence.getName() +\r
" to " + seqName + "\n");\r
sequence.setName(seqName);\r
}\r
}\r
\r
- if (sequence == null) {\r
+ if (sequence == null)\r
+ {\r
sbuffer.append("UNIPROT updated suggestion is " +\r
result[r] + "\n");\r
sequence = align.findName(result[r]);\r
\r
// this entry has been suggested by ebi.\r
// doesn't match id in alignment file\r
- try {\r
+ try\r
+ {\r
out.setLength(filePointer);\r
- } catch (Exception ex) {\r
+ }\r
+ catch (Exception ex)\r
+ {\r
}\r
\r
// now skip to next entry\r
pdb = "";\r
}\r
\r
- if (sequence == null) {\r
+ if (sequence == null)\r
+ {\r
continue;\r
}\r
\r
- if (result[r].indexOf("<property type=\"pdb accession\"") > -1) {\r
+ if (result[r].indexOf("<property type=\"pdb accession\"") > -1)\r
+ {\r
pdb = parseValue(result[r], "value=", out);\r
sequence.setPDBId(pdb);\r
}\r
\r
- if (result[r].indexOf("feature type") > -1) {\r
+ if (result[r].indexOf("feature type") > -1)\r
+ {\r
type = parseValue(result[r], "type=", out);\r
description = parseValue(result[r], "description=", null);\r
status = parseValue(result[r], "status=", null);\r
\r
- while (result[r].indexOf("position") == -1) {\r
+ while (result[r].indexOf("position") == -1)\r
+ {\r
r++; //<location>\r
}\r
\r
// r++;\r
- if (result[r].indexOf("begin") > -1) {\r
+ if (result[r].indexOf("begin") > -1)\r
+ {\r
start = parseValue(result[r], "position=", out);\r
end = parseValue(result[++r], "position=", out);\r
- } else {\r
+ }\r
+ else\r
+ {\r
start = parseValue(result[r], "position=", out);\r
end = parseValue(result[r], "position=", null);\r
}\r
int sstart = Integer.parseInt(start);\r
int eend = Integer.parseInt(end);\r
\r
- if (out != null) {\r
- try {\r
+ if (out != null)\r
+ {\r
+ try\r
+ {\r
out.writeBytes("</feature>\n");\r
- } catch (Exception ex) {\r
+ }\r
+ catch (Exception ex)\r
+ {\r
}\r
}\r
\r
features.add(sf);\r
}\r
\r
- if (result[r].indexOf("<sequence") > -1) {\r
+ if (result[r].indexOf("<sequence") > -1)\r
+ {\r
StringBuffer seqString = new StringBuffer();\r
\r
- if (out != null) {\r
- try {\r
+ if (out != null)\r
+ {\r
+ try\r
+ {\r
out.writeBytes(result[r] + "\n");\r
- } catch (Exception ex) {\r
+ }\r
+ catch (Exception ex)\r
+ {\r
}\r
}\r
\r
- while (result[++r].indexOf("</sequence>") == -1) {\r
+ while (result[++r].indexOf("</sequence>") == -1)\r
+ {\r
seqString.append(result[r]);\r
\r
- if (out != null) {\r
- try {\r
+ if (out != null)\r
+ {\r
+ try\r
+ {\r
out.writeBytes(result[r] + "\n");\r
- } catch (Exception ex) {\r
+ }\r
+ catch (Exception ex)\r
+ {\r
}\r
}\r
}\r
\r
- if (out != null) {\r
- try {\r
+ if (out != null)\r
+ {\r
+ try\r
+ {\r
out.writeBytes(result[r] + "\n");\r
- } catch (Exception ex) {\r
+ }\r
+ catch (Exception ex)\r
+ {\r
}\r
}\r
\r
StringBuffer nonGapped = new StringBuffer();\r
\r
- for (int i = 0; i < sequence.getSequence().length(); i++) {\r
- if (!jalview.util.Comparison.isGap(sequence.getCharAt(i))) {\r
+ for (int i = 0; i < sequence.getSequence().length(); i++)\r
+ {\r
+ if (!jalview.util.Comparison.isGap(sequence.getCharAt(i)))\r
+ {\r
nonGapped.append(sequence.getCharAt(i));\r
}\r
}\r
\r
int absStart = seqString.toString().indexOf(nonGapped.toString());\r
\r
- if (absStart == -1) {\r
+ if (absStart == -1)\r
+ {\r
unknownSequences.add(sequence.getName());\r
features = null;\r
sbuffer.append(sequence.getName() +\r
absStart += 1;\r
\r
if ((absStart != sequence.getStart()) ||\r
- (absEnd != sequence.getEnd())) {\r
+ (absEnd != sequence.getEnd()))\r
+ {\r
sbuffer.append("Updated: " + sequence.getName() + " " +\r
sequence.getStart() + "/" + sequence.getEnd() +\r
" to " + absStart + "/" + absEnd + "\n");\r
sequence.setEnd(absEnd);\r
}\r
\r
- if (result[r].indexOf("</entry>") > -1) {\r
- if (features != null) {\r
+ if (result[r].indexOf("</entry>") > -1)\r
+ {\r
+ if (features != null)\r
+ {\r
sequence.setSequenceFeatures(features);\r
}\r
\r
features = null;\r
sequence = null;\r
\r
- if (out != null) {\r
- try {\r
+ if (out != null)\r
+ {\r
+ try\r
+ {\r
out.writeBytes("</entry>\n");\r
- } catch (Exception ex) {\r
+ }\r
+ catch (Exception ex)\r
+ {\r
}\r
}\r
}\r
}\r
}\r
\r
- void findMissingIds(AlignmentI align) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param align DOCUMENT ME!\r
+ */\r
+ void findMissingIds(AlignmentI align)\r
+ {\r
String data;\r
ArrayList cachedIds = new ArrayList();\r
\r
- try {\r
+ try\r
+ {\r
BufferedReader in = new BufferedReader(new FileReader(\r
jalview.bin.Cache.getProperty("UNIPROT_CACHE")));\r
\r
- while ((data = in.readLine()) != null) {\r
- if (data.indexOf("name") > -1) {\r
+ while ((data = in.readLine()) != null)\r
+ {\r
+ if (data.indexOf("name") > -1)\r
+ {\r
String name = parseElement(data, "<name>", null);\r
cachedIds.add(name);\r
}\r
}\r
- } catch (Exception ex) {\r
+ }\r
+ catch (Exception ex)\r
+ {\r
ex.printStackTrace();\r
}\r
\r
for (int i = 0; i < align.getHeight(); i++)\r
- if (!cachedIds.contains(align.getSequenceAt(i).getName())) {\r
+ if (!cachedIds.contains(align.getSequenceAt(i).getName()))\r
+ {\r
unknownSequences.add(align.getSequenceAt(i).getName());\r
}\r
}\r
\r
- void tryLocalCacheFirst(ArrayList ids, AlignmentI align) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param ids DOCUMENT ME!\r
+ * @param align DOCUMENT ME!\r
+ */\r
+ void tryLocalCacheFirst(ArrayList ids, AlignmentI align)\r
+ {\r
ArrayList cacheData = new ArrayList();\r
\r
- try {\r
+ try\r
+ {\r
BufferedReader in = new BufferedReader(new FileReader(\r
jalview.bin.Cache.getProperty("UNIPROT_CACHE")));\r
\r
// make sure we remove the ids from the list to retrieve from EBI\r
String data;\r
\r
- while ((data = in.readLine()) != null) {\r
- if (data.indexOf("name") > -1) {\r
+ while ((data = in.readLine()) != null)\r
+ {\r
+ if (data.indexOf("name") > -1)\r
+ {\r
String name = parseElement(data, "<name>", null);\r
\r
- if (ids.contains(name)) {\r
+ if (ids.contains(name))\r
+ {\r
cacheData.add("<entry>");\r
cacheData.add(data);\r
\r
- while (data.indexOf("</entry>") == -1) {\r
+ while (data.indexOf("</entry>") == -1)\r
+ {\r
data = in.readLine();\r
cacheData.add(data);\r
}\r
}\r
}\r
}\r
- } catch (Exception ex) {\r
+ }\r
+ catch (Exception ex)\r
+ {\r
ex.printStackTrace();\r
}\r
\r
String[] localData = new String[cacheData.size()];\r
cacheData.toArray(localData);\r
\r
- if ((localData != null) && (localData.length > 0)) {\r
+ if ((localData != null) && (localData.length > 0))\r
+ {\r
ReadUniprotFile(localData, null, align);\r
}\r
}\r
\r
- String parseValue(String line, String tag, RandomAccessFile out) {\r
- if (out != null) {\r
- try {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param line DOCUMENT ME!\r
+ * @param tag DOCUMENT ME!\r
+ * @param out DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ String parseValue(String line, String tag, RandomAccessFile out)\r
+ {\r
+ if (out != null)\r
+ {\r
+ try\r
+ {\r
out.writeBytes(line + "\n");\r
- } catch (Exception ex) {\r
+ }\r
+ catch (Exception ex)\r
+ {\r
}\r
}\r
\r
int index = line.indexOf(tag) + tag.length() + 1;\r
\r
- if (index == tag.length()) {\r
+ if (index == tag.length())\r
+ {\r
return "";\r
}\r
\r
return line.substring(index, line.indexOf("\"", index + 1));\r
}\r
\r
- String parseElement(String line, String tag, RandomAccessFile out) {\r
- if (out != null) {\r
- try {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param line DOCUMENT ME!\r
+ * @param tag DOCUMENT ME!\r
+ * @param out DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ String parseElement(String line, String tag, RandomAccessFile out)\r
+ {\r
+ if (out != null)\r
+ {\r
+ try\r
+ {\r
out.writeBytes(line + "\n");\r
- } catch (Exception ex) {\r
+ }\r
+ catch (Exception ex)\r
+ {\r
}\r
}\r
\r
import javax.xml.namespace.QName;\r
\r
\r
-public class WSWUBlastClient {\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class WSWUBlastClient\r
+{\r
CutAndPasteTransfer output = new CutAndPasteTransfer();\r
int jobsRunning = 0;\r
\r
- public WSWUBlastClient(AlignmentI al, ArrayList ids) {\r
+ /**\r
+ * Creates a new WSWUBlastClient object.\r
+ *\r
+ * @param al DOCUMENT ME!\r
+ * @param ids DOCUMENT ME!\r
+ */\r
+ public WSWUBlastClient(AlignmentI al, ArrayList ids)\r
+ {\r
output.setText(\r
"To display sequence features an exact Uniprot id with 100% sequence identity match must be entered." +\r
"\nIn order to display these features, try changing the names of your sequences to the ids suggested below.");\r
Desktop.addInternalFrame(output,\r
"BLASTing for unidentified sequences ", 800, 300);\r
\r
- for (int i = 0; i < ids.size(); i++) {\r
+ for (int i = 0; i < ids.size(); i++)\r
+ {\r
SequenceI sequence = al.findName(ids.get(i).toString());\r
StringBuffer nonGapped = new StringBuffer();\r
\r
- for (int n = 0; n < sequence.getSequence().length(); n++) {\r
- if (!jalview.util.Comparison.isGap(sequence.getCharAt(n))) {\r
+ for (int n = 0; n < sequence.getSequence().length(); n++)\r
+ {\r
+ if (!jalview.util.Comparison.isGap(sequence.getCharAt(n)))\r
+ {\r
nonGapped.append(sequence.getCharAt(n));\r
}\r
}\r
thread.start();\r
}\r
\r
- void parseResult(String id1, String res) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param id1 DOCUMENT ME!\r
+ * @param res DOCUMENT ME!\r
+ */\r
+ void parseResult(String id1, String res)\r
+ {\r
StringTokenizer st = new StringTokenizer(res, "\n");\r
String data;\r
String id2;\r
int maxFound = 90;\r
StringBuffer buffer = new StringBuffer("\n\n" + id1 + " :");\r
\r
- while (st.hasMoreTokens()) {\r
+ while (st.hasMoreTokens())\r
+ {\r
data = st.nextToken();\r
\r
- if (data.indexOf("database=\"uniprot\" id=") > -1) {\r
+ if (data.indexOf("database=\"uniprot\" id=") > -1)\r
+ {\r
int index = data.indexOf("database=\"uniprot\" id=") + 23;\r
id2 = data.substring(index, data.indexOf("\"", index));\r
\r
- while (data.indexOf("</alignment>") == -1) {\r
+ while (data.indexOf("</alignment>") == -1)\r
+ {\r
data = st.nextToken();\r
\r
- if (data.indexOf("<identity>") > -1) {\r
+ if (data.indexOf("<identity>") > -1)\r
+ {\r
int value = Integer.parseInt(data.substring(data.indexOf(\r
"<identity>") + 10,\r
data.indexOf("</identity>")));\r
\r
- if (value >= maxFound) {\r
+ if (value >= maxFound)\r
+ {\r
maxFound = value;\r
buffer.append(" " + id2 + " " + value + "%; ");\r
}\r
output.setText(output.getText() + buffer.toString());\r
}\r
\r
- class ImageTwirler extends Thread {\r
+ class ImageTwirler extends Thread\r
+ {\r
ImageIcon[] imageIcon;\r
int imageIndex = 0;\r
\r
- public ImageTwirler() {\r
+ public ImageTwirler()\r
+ {\r
imageIcon = new ImageIcon[9];\r
\r
- for (int i = 0; i < 9; i++) {\r
+ for (int i = 0; i < 9; i++)\r
+ {\r
java.net.URL url = getClass().getResource("/images/dna" +\r
(i + 1) + ".gif");\r
\r
- if (url != null) {\r
+ if (url != null)\r
+ {\r
imageIcon[i] = new ImageIcon(url);\r
}\r
}\r
}\r
\r
- public void run() {\r
- while (jobsRunning > 0) {\r
- try {\r
+ public void run()\r
+ {\r
+ while (jobsRunning > 0)\r
+ {\r
+ try\r
+ {\r
Thread.sleep(100);\r
imageIndex++;\r
imageIndex %= 9;\r
output.setFrameIcon(imageIcon[imageIndex]);\r
output.setTitle("BLASTing for unidentified sequences - " +\r
jobsRunning + " jobs running.");\r
- } catch (Exception ex) {\r
+ }\r
+ catch (Exception ex)\r
+ {\r
}\r
}\r
}\r
}\r
\r
- class BlastThread extends Thread {\r
+ class BlastThread extends Thread\r
+ {\r
String sequence;\r
String seqid;\r
String jobid;\r
boolean jobComplete = false;\r
\r
- BlastThread(String id, String sequence) {\r
+ BlastThread(String id, String sequence)\r
+ {\r
this.sequence = sequence;\r
seqid = id;\r
}\r
\r
- public void run() {\r
+ public void run()\r
+ {\r
StartJob();\r
\r
- while (!jobComplete) {\r
- try {\r
+ while (!jobComplete)\r
+ {\r
+ try\r
+ {\r
Call call = (Call) new Service().createCall();\r
call.setTargetEndpointAddress(new java.net.URL(\r
"http://www.ebi.ac.uk/cgi-bin/webservices/WSWUBlast"));\r
call.setOperationName(new QName("WSWUBlast", "polljob"));\r
\r
- String result = (String) call.invoke(new Object[] {\r
+ String result = (String) call.invoke(new Object[]\r
+ {\r
jobid, "xml"\r
});\r
\r
if ((result.indexOf("JOB PENDING") == -1) &&\r
- (result.indexOf("JOB RUNNING") == -1)) {\r
+ (result.indexOf("JOB RUNNING") == -1))\r
+ {\r
parseResult(seqid, result);\r
jobComplete = true;\r
jobsRunning--;\r
Thread.sleep(5000);\r
\r
// System.out.println("WSWuBlastClient: I'm alive "+seqid+" "+jobid); // log.debug\r
- } catch (Exception ex) {\r
+ }\r
+ catch (Exception ex)\r
+ {\r
}\r
}\r
}\r
\r
- void StartJob() {\r
+ void StartJob()\r
+ {\r
HashMap params = new HashMap();\r
params.put("database", "uniprot");\r
params.put("sensitivity", "low");\r
\r
byte[] seqbytes = sequence.getBytes();\r
\r
- try {\r
+ try\r
+ {\r
Call call = (Call) new Service().createCall();\r
call.setTargetEndpointAddress(new java.net.URL(\r
"http://www.ebi.ac.uk/cgi-bin/webservices/WSWUBlast"));\r
call.setOperationName(new QName("WSWUBlast", "doWUBlast"));\r
\r
- String result = (String) call.invoke(new Object[] {\r
+ String result = (String) call.invoke(new Object[]\r
+ {\r
params, seqbytes\r
});\r
jobid = result;\r
System.out.println(\r
"http://www.ebi.ac.uk/cgi-bin/webservices/WSWUBlast JobId '" +\r
jobid + "'");\r
- } catch (Exception exp) {\r
+ }\r
+ catch (Exception exp)\r
+ {\r
System.err.println("WSWUBlastClient error:\n" + exp.toString());\r
exp.printStackTrace();\r
}\r
pairwiseAlignmentMenuItem_actionPerformed(e);\r
}\r
});\r
- PCAMenuItem.setLabel("Principal Component Analysis...");\r
+ PCAMenuItem.setLabel("Principal Component Analysis");\r
PCAMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
public void actionPerformed(ActionEvent e) {\r
PCAMenuItem_actionPerformed(e);\r
}\r
});\r
averageDistanceTreeMenuItem.setLabel(\r
- "Average Distance Using % Identity...");\r
+ "Average Distance Using % Identity");\r
averageDistanceTreeMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
public void actionPerformed(ActionEvent e) {\r
averageDistanceTreeMenuItem_actionPerformed(e);\r
}\r
});\r
- neighbourTreeMenuItem.setLabel("Neighbour Joining Using % Identity...");\r
+ neighbourTreeMenuItem.setLabel("Neighbour Joining Using % Identity");\r
neighbourTreeMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
public void actionPerformed(ActionEvent e) {\r
neighbourTreeMenuItem_actionPerformed(e);\r
}\r
});\r
avDistanceTreeBlosumMenuItem.setLabel(\r
- "Average Distance Using BLOSUM62...");\r
+ "Average Distance Using BLOSUM62");\r
avDistanceTreeBlosumMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
public void actionPerformed(ActionEvent e) {\r
avTreeBlosumMenuItem_actionPerformed(e);\r
}\r
});\r
- njTreeBlosumMenuItem.setLabel("Neighbour Joining Using BLOSUM62...");\r
+ njTreeBlosumMenuItem.setLabel("Neighbour Joining Using BLOSUM62");\r
njTreeBlosumMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
public void actionPerformed(ActionEvent e) {\r
njTreeBlosumMenuItem_actionPerformed(e);\r
colourTextMenuItem_actionPerformed(null);\r
}\r
});\r
- overviewMenuItem.setLabel("Overview Window...");\r
+ overviewMenuItem.setLabel("Overview Window");\r
overviewMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
public void actionPerformed(ActionEvent e) {\r
overviewMenuItem_actionPerformed(e);\r
/*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
-*\r
-* This program is free software; you can redistribute it and/or\r
-* modify it under the terms of the GNU General Public License\r
-* as published by the Free Software Foundation; either version 2\r
-* of the License, or (at your option) any later version.\r
-*\r
-* This program is distributed in the hope that it will be useful,\r
-* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-* GNU General Public License for more details.\r
-*\r
-* You should have received a copy of the GNU General Public License\r
-* along with this program; if not, write to the Free Software\r
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
-*/\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
+ */\r
package jalview.jbgui;\r
\r
-import jalview.gui.Preferences;\r
-\r
-import jalview.schemes.ColourSchemeProperty;\r
-\r
import java.awt.*;\r
import java.awt.event.*;\r
-\r
import javax.swing.*;\r
-import javax.swing.event.AncestorEvent;\r
-import javax.swing.event.AncestorListener;\r
-\r
-\r
-public class GAlignFrame extends JInternalFrame {\r
- protected JMenuBar alignFrameMenuBar = new JMenuBar();\r
- protected JMenu fileMenu = new JMenu();\r
- protected JMenuItem closeMenuItem = new JMenuItem();\r
- protected JMenu editMenu = new JMenu();\r
- protected JMenu viewMenu = new JMenu();\r
- protected JMenu colourMenu = new JMenu();\r
- protected JMenu calculateMenu = new JMenu();\r
- protected JMenu webService = new JMenu();\r
- protected JMenuItem selectAllSequenceMenuItem = new JMenuItem();\r
- protected JMenuItem deselectAllSequenceMenuItem = new JMenuItem();\r
- protected JMenuItem invertSequenceMenuItem = new JMenuItem();\r
- protected JMenuItem remove2LeftMenuItem = new JMenuItem();\r
- protected JMenuItem remove2RightMenuItem = new JMenuItem();\r
- protected JMenuItem removeGappedColumnMenuItem = new JMenuItem();\r
- protected JMenuItem removeAllGapsMenuItem = new JMenuItem();\r
- public JCheckBoxMenuItem viewBoxesMenuItem = new JCheckBoxMenuItem();\r
- public JCheckBoxMenuItem viewTextMenuItem = new JCheckBoxMenuItem();\r
- protected JMenuItem sortPairwiseMenuItem = new JMenuItem();\r
- protected JMenuItem sortIDMenuItem = new JMenuItem();\r
- protected JMenuItem sortGroupMenuItem = new JMenuItem();\r
- protected JMenuItem removeRedundancyMenuItem = new JMenuItem();\r
- protected JMenuItem pairwiseAlignmentMenuItem = new JMenuItem();\r
- protected JMenuItem PCAMenuItem = new JMenuItem();\r
- protected JMenuItem averageDistanceTreeMenuItem = new JMenuItem();\r
- protected JMenuItem neighbourTreeMenuItem = new JMenuItem();\r
- protected JMenuItem clustalAlignMenuItem = new JMenuItem();\r
- BorderLayout borderLayout1 = new BorderLayout();\r
- public JLabel statusBar = new JLabel();\r
- protected JMenuItem saveAlignmentMenu = new JMenuItem();\r
- protected JMenu outputTextboxMenu = new JMenu();\r
- protected JRadioButtonMenuItem clustalColour = new JRadioButtonMenuItem();\r
- protected JRadioButtonMenuItem zappoColour = new JRadioButtonMenuItem();\r
- protected JRadioButtonMenuItem taylorColour = new JRadioButtonMenuItem();\r
- protected JRadioButtonMenuItem hydrophobicityColour = new JRadioButtonMenuItem();\r
- protected JRadioButtonMenuItem helixColour = new JRadioButtonMenuItem();\r
- protected JRadioButtonMenuItem strandColour = new JRadioButtonMenuItem();\r
- protected JRadioButtonMenuItem turnColour = new JRadioButtonMenuItem();\r
- protected JRadioButtonMenuItem buriedColour = new JRadioButtonMenuItem();\r
- protected JRadioButtonMenuItem userDefinedColour = new JRadioButtonMenuItem();\r
- protected JRadioButtonMenuItem PIDColour = new JRadioButtonMenuItem();\r
- protected JRadioButtonMenuItem BLOSUM62Colour = new JRadioButtonMenuItem();\r
- JMenuItem njTreeBlosumMenuItem = new JMenuItem();\r
- JMenuItem avDistanceTreeBlosumMenuItem = new JMenuItem();\r
- public JCheckBoxMenuItem annotationPanelMenuItem = new JCheckBoxMenuItem();\r
- public JCheckBoxMenuItem colourTextMenuItem = new JCheckBoxMenuItem();\r
- JMenuItem htmlMenuItem = new JMenuItem();\r
- JMenuItem overviewMenuItem = new JMenuItem();\r
- protected JMenuItem undoMenuItem = new JMenuItem();\r
- protected JMenuItem redoMenuItem = new JMenuItem();\r
- public JCheckBoxMenuItem conservationMenuItem = new JCheckBoxMenuItem();\r
- JRadioButtonMenuItem noColourmenuItem = new JRadioButtonMenuItem();\r
- public JCheckBoxMenuItem wrapMenuItem = new JCheckBoxMenuItem();\r
- JMenuItem printMenuItem = new JMenuItem();\r
- public JCheckBoxMenuItem renderGapsMenuItem = new JCheckBoxMenuItem();\r
- JMenuItem findMenuItem = new JMenuItem();\r
- JMenu searchMenu = new JMenu();\r
- public JCheckBoxMenuItem abovePIDThreshold = new JCheckBoxMenuItem();\r
- public JCheckBoxMenuItem sequenceFeatures = new JCheckBoxMenuItem();\r
- protected JRadioButtonMenuItem nucleotideColour = new JRadioButtonMenuItem();\r
- JMenuItem deleteGroups = new JMenuItem();\r
- JMenuItem delete = new JMenuItem();\r
- JMenuItem copy = new JMenuItem();\r
- JMenuItem cut = new JMenuItem();\r
- JMenu jMenu1 = new JMenu();\r
- JMenuItem pasteNew = new JMenuItem();\r
- JMenuItem pasteThis = new JMenuItem();\r
- public JCheckBoxMenuItem applyToAllGroups = new JCheckBoxMenuItem();\r
- JMenuItem createPNG = new JMenuItem();\r
- protected JMenuItem font = new JMenuItem();\r
- public JCheckBoxMenuItem fullSeqId = new JCheckBoxMenuItem();\r
- JMenuItem epsFile = new JMenuItem();\r
- JMenuItem LoadtreeMenuItem = new JMenuItem();\r
- JMenuItem jnet = new JMenuItem();\r
- public JCheckBoxMenuItem scaleAbove = new JCheckBoxMenuItem();\r
- public JCheckBoxMenuItem scaleLeft = new JCheckBoxMenuItem();\r
- public JCheckBoxMenuItem scaleRight = new JCheckBoxMenuItem();\r
- JMenuItem modifyPID = new JMenuItem();\r
- JMenuItem modifyConservation = new JMenuItem();\r
- protected JMenu sortByTreeMenu = new JMenu();\r
- protected JMenu sort = new JMenu();\r
- JMenu calculate = new JMenu();\r
- JMenuItem msaAlignMenuItem = new JMenuItem();\r
- JMenu jMenu2 = new JMenu();\r
- JMenuItem padGapsMenuitem = new JMenuItem();\r
- JMenuItem ClustalRealign = new JMenuItem();\r
-\r
- public GAlignFrame() {\r
- ButtonGroup colours = new ButtonGroup();\r
- colours.add(noColourmenuItem);\r
- colours.add(clustalColour);\r
- colours.add(zappoColour);\r
- colours.add(taylorColour);\r
- colours.add(hydrophobicityColour);\r
- colours.add(helixColour);\r
- colours.add(strandColour);\r
- colours.add(turnColour);\r
- colours.add(buriedColour);\r
- colours.add(userDefinedColour);\r
- colours.add(PIDColour);\r
- colours.add(BLOSUM62Colour);\r
- colours.add(nucleotideColour);\r
-\r
- noColourmenuItem.setSelected(true);\r
-\r
- String defaultColour = Preferences.defaultColour;\r
-\r
- if (defaultColour != null) {\r
- int index = ColourSchemeProperty.getColourIndexFromName(defaultColour);\r
-\r
- switch (index) {\r
- case ColourSchemeProperty.CLUSTAL:\r
- clustalColour.setSelected(true);\r
-\r
- break;\r
-\r
- case ColourSchemeProperty.BLOSUM:\r
- BLOSUM62Colour.setSelected(true);\r
-\r
- break;\r
-\r
- case ColourSchemeProperty.PID:\r
- PIDColour.setSelected(true);\r
-\r
- break;\r
-\r
- case ColourSchemeProperty.ZAPPO:\r
- zappoColour.setSelected(true);\r
-\r
- break;\r
-\r
- case ColourSchemeProperty.HYDROPHOBIC:\r
- hydrophobicityColour.setSelected(true);\r
-\r
- break;\r
-\r
- case ColourSchemeProperty.HELIX:\r
- helixColour.setSelected(true);\r
-\r
- break;\r
-\r
- case ColourSchemeProperty.STRAND:\r
- strandColour.setSelected(true);\r
-\r
- break;\r
-\r
- case ColourSchemeProperty.TURN:\r
- turnColour.setSelected(true);\r
-\r
- break;\r
-\r
- case ColourSchemeProperty.BURIED:\r
- buriedColour.setSelected(true);\r
-\r
- break;\r
-\r
- case ColourSchemeProperty.NUCLEOTIDE:\r
- nucleotideColour.setSelected(true);\r
-\r
- break;\r
-\r
- case ColourSchemeProperty.USER_DEFINED:\r
- userDefinedColour.setSelected(true);\r
-\r
- break;\r
- }\r
- }\r
-\r
- try {\r
- jbInit();\r
- setJMenuBar(alignFrameMenuBar);\r
-\r
- JMenuItem item;\r
-\r
- // dynamically fill save as menu with available formats\r
- for (int i = 0; i < jalview.io.FormatAdapter.formats.size(); i++) {\r
- item = new JMenuItem((String) jalview.io.FormatAdapter.formats.elementAt(\r
- i));\r
- item.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- outputText_actionPerformed(e);\r
- }\r
- });\r
-\r
- outputTextboxMenu.add(item);\r
- }\r
- } catch (Exception e) {\r
- e.printStackTrace();\r
- }\r
-\r
- }\r
-\r
- private void jbInit() throws Exception {\r
- fileMenu.setMnemonic('F');\r
- fileMenu.setText("File");\r
- saveAlignmentMenu.setMnemonic('L');\r
- saveAlignmentMenu.setText("Save As");\r
- saveAlignmentMenu.addActionListener(new ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- saveAlignmentMenu_actionPerformed(e);\r
- }\r
- });\r
- closeMenuItem.setMnemonic('C');\r
- closeMenuItem.setText("Close");\r
- closeMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- closeMenuItem_actionPerformed(e);\r
- }\r
- });\r
- editMenu.setText("Edit");\r
- viewMenu.setText("View");\r
- colourMenu.setText("Colour");\r
- calculateMenu.setText("Calculate");\r
- webService.setText("Web Service");\r
- selectAllSequenceMenuItem.setText("Select all");\r
- selectAllSequenceMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(\r
- java.awt.event.KeyEvent.VK_A,\r
- Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));\r
- selectAllSequenceMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- selectAllSequenceMenuItem_actionPerformed(e);\r
- }\r
- });\r
- deselectAllSequenceMenuItem.setText("Deselect All");\r
- deselectAllSequenceMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(\r
- java.awt.event.KeyEvent.VK_ESCAPE, 0, false));\r
- deselectAllSequenceMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- deselectAllSequenceMenuItem_actionPerformed(e);\r
- }\r
- });\r
- invertSequenceMenuItem.setText("Invert Selection");\r
- invertSequenceMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- invertSequenceMenuItem_actionPerformed(e);\r
- }\r
- });\r
- remove2LeftMenuItem.setText("Remove Left");\r
- remove2LeftMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- remove2LeftMenuItem_actionPerformed(e);\r
- }\r
- });\r
- remove2RightMenuItem.setText("Remove Right");\r
- remove2RightMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- remove2RightMenuItem_actionPerformed(e);\r
- }\r
- });\r
- removeGappedColumnMenuItem.setText("Remove Empty Columns");\r
- removeGappedColumnMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- removeGappedColumnMenuItem_actionPerformed(e);\r
- }\r
- });\r
- removeAllGapsMenuItem.setText("Remove All Gaps");\r
- removeAllGapsMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- removeAllGapsMenuItem_actionPerformed(e);\r
- }\r
- });\r
- viewBoxesMenuItem.setText("Boxes");\r
- viewBoxesMenuItem.setState(true);\r
- viewBoxesMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- viewBoxesMenuItem_actionPerformed(e);\r
- }\r
- });\r
- viewTextMenuItem.setText("Text");\r
- viewTextMenuItem.setState(true);\r
- viewTextMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- viewTextMenuItem_actionPerformed(e);\r
- }\r
- });\r
- sortPairwiseMenuItem.setText("by Pairwise Identity");\r
- sortPairwiseMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- sortPairwiseMenuItem_actionPerformed(e);\r
- }\r
- });\r
- sortIDMenuItem.setText("by ID");\r
- sortIDMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- sortIDMenuItem_actionPerformed(e);\r
- }\r
- });\r
- sortGroupMenuItem.setText("by Group");\r
- sortGroupMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- sortGroupMenuItem_actionPerformed(e);\r
- }\r
- });\r
- removeRedundancyMenuItem.setText("Remove Redundancy...");\r
- removeRedundancyMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- removeRedundancyMenuItem_actionPerformed(e);\r
- }\r
- });\r
- pairwiseAlignmentMenuItem.setText("Pairwise Alignments...");\r
- pairwiseAlignmentMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- pairwiseAlignmentMenuItem_actionPerformed(e);\r
- }\r
- });\r
- PCAMenuItem.setText("Principal Component Analysis...");\r
- PCAMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- PCAMenuItem_actionPerformed(e);\r
- }\r
- });\r
- averageDistanceTreeMenuItem.setText(\r
- "Average Distance Using % Identity...");\r
- averageDistanceTreeMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- averageDistanceTreeMenuItem_actionPerformed(e);\r
- }\r
- });\r
- neighbourTreeMenuItem.setText("Neighbour Joining Using % Identity...");\r
- neighbourTreeMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- neighbourTreeMenuItem_actionPerformed(e);\r
- }\r
- });\r
- clustalAlignMenuItem.setText("Clustal Alignment...");\r
- clustalAlignMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- clustalAlignMenuItem_actionPerformed(e);\r
- }\r
- });\r
- this.getContentPane().setLayout(borderLayout1);\r
- alignFrameMenuBar.setFont(new java.awt.Font("Verdana", 0, 11));\r
- alignFrameMenuBar.addAncestorListener(new AncestorListener() {\r
- public void ancestorAdded(AncestorEvent event) {\r
- alignFrameMenuBar_ancestorAdded(event);\r
- }\r
-\r
- public void ancestorRemoved(AncestorEvent event) {\r
- }\r
-\r
- public void ancestorMoved(AncestorEvent event) {\r
- }\r
- });\r
- statusBar.setBackground(Color.white);\r
- statusBar.setFont(new java.awt.Font("Verdana", 0, 11));\r
- statusBar.setBorder(BorderFactory.createLineBorder(Color.black));\r
- statusBar.setText("Status bar");\r
- outputTextboxMenu.setMnemonic('T');\r
- outputTextboxMenu.setText("Output to Textbox");\r
- clustalColour.setText("Clustalx");\r
-\r
- clustalColour.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- clustalColour_actionPerformed(e);\r
- }\r
- });\r
- zappoColour.setText("Zappo");\r
- zappoColour.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- zappoColour_actionPerformed(e);\r
- }\r
- });\r
- taylorColour.setText("Taylor");\r
- taylorColour.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- taylorColour_actionPerformed(e);\r
- }\r
- });\r
- hydrophobicityColour.setText("Hydrophobicity");\r
- hydrophobicityColour.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- hydrophobicityColour_actionPerformed(e);\r
- }\r
- });\r
- helixColour.setText("Helix Propensity");\r
- helixColour.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- helixColour_actionPerformed(e);\r
- }\r
- });\r
- strandColour.setText("Strand Propensity");\r
- strandColour.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- strandColour_actionPerformed(e);\r
- }\r
- });\r
- turnColour.setText("Turn Propensity");\r
- turnColour.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- turnColour_actionPerformed(e);\r
- }\r
- });\r
- buriedColour.setText("Buried Index");\r
- buriedColour.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- buriedColour_actionPerformed(e);\r
- }\r
- });\r
- userDefinedColour.setText("User Defined...");\r
- userDefinedColour.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- userDefinedColour_actionPerformed(e);\r
- }\r
- });\r
- PIDColour.setText("Percentage Identity");\r
- PIDColour.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- PIDColour_actionPerformed(e);\r
- }\r
- });\r
- BLOSUM62Colour.setText("BLOSUM62 Score");\r
- BLOSUM62Colour.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- BLOSUM62Colour_actionPerformed(e);\r
- }\r
- });\r
- avDistanceTreeBlosumMenuItem.setText(\r
- "Average Distance Using BLOSUM62...");\r
- avDistanceTreeBlosumMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- avTreeBlosumMenuItem_actionPerformed(e);\r
- }\r
- });\r
- njTreeBlosumMenuItem.setText("Neighbour Joining using BLOSUM62...");\r
- njTreeBlosumMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- njTreeBlosumMenuItem_actionPerformed(e);\r
- }\r
- });\r
- annotationPanelMenuItem.setActionCommand("");\r
- annotationPanelMenuItem.setText("Show Annotations");\r
- annotationPanelMenuItem.setState(jalview.gui.Preferences.showAnnotation);\r
- annotationPanelMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- annotationPanelMenuItem_actionPerformed(e);\r
- }\r
- });\r
- colourTextMenuItem.setText("Colour Text");\r
- colourTextMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- colourTextMenuItem_actionPerformed(e);\r
- }\r
- });\r
- htmlMenuItem.setText("HTML");\r
- htmlMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- htmlMenuItem_actionPerformed(e);\r
- }\r
- });\r
- overviewMenuItem.setText("Overview Window...");\r
- overviewMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- overviewMenuItem_actionPerformed(e);\r
- }\r
- });\r
- undoMenuItem.setEnabled(false);\r
- undoMenuItem.setMnemonic('Z');\r
- undoMenuItem.setText("Undo");\r
- undoMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(\r
- java.awt.event.KeyEvent.VK_Z,\r
- Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));\r
- undoMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- undoMenuItem_actionPerformed(e);\r
- }\r
- });\r
- redoMenuItem.setEnabled(false);\r
- redoMenuItem.setMnemonic('0');\r
- redoMenuItem.setText("Redo");\r
- redoMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- redoMenuItem_actionPerformed(e);\r
- }\r
- });\r
- conservationMenuItem.setText("By Conservation");\r
- conservationMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- conservationMenuItem_actionPerformed(e);\r
- }\r
- });\r
- noColourmenuItem.setText("None");\r
- noColourmenuItem.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- noColourmenuItem_actionPerformed(e);\r
- }\r
- });\r
- wrapMenuItem.setText("Wrap");\r
- wrapMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- wrapMenuItem_actionPerformed(e);\r
- }\r
- });\r
- printMenuItem.setText("Print");\r
- printMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- printMenuItem_actionPerformed(e);\r
- }\r
- });\r
- renderGapsMenuItem.setText("Show Gaps");\r
- renderGapsMenuItem.setState(true);\r
- renderGapsMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- renderGapsMenuItem_actionPerformed(e);\r
- }\r
- });\r
- findMenuItem.setText("Find...");\r
- findMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(\r
- java.awt.event.KeyEvent.VK_F,\r
- Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));\r
- findMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- findMenuItem_actionPerformed(e);\r
- }\r
- });\r
- searchMenu.setText("Search");\r
-\r
- abovePIDThreshold.setText("Above Identity Threshold");\r
- abovePIDThreshold.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- abovePIDThreshold_actionPerformed(e);\r
- }\r
- });\r
- sequenceFeatures.setText("Sequence Features");\r
- sequenceFeatures.addActionListener(new ActionListener() {\r
- public void actionPerformed(ActionEvent actionEvent) {\r
- sequenceFeatures_actionPerformed(actionEvent);\r
- }\r
- });\r
- nucleotideColour.setText("Nucleotide");\r
- nucleotideColour.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- nucleotideColour_actionPerformed(e);\r
- }\r
- });\r
- deleteGroups.setText("Undefine groups");\r
- deleteGroups.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- deleteGroups_actionPerformed(e);\r
- }\r
- });\r
- copy.setText("Copy");\r
- copy.setAccelerator(javax.swing.KeyStroke.getKeyStroke(\r
- java.awt.event.KeyEvent.VK_C,\r
- Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));\r
- copy.setMnemonic(KeyEvent.VK_C);\r
-\r
- copy.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- copy_actionPerformed(e);\r
- }\r
- });\r
- cut.setText("Cut");\r
- cut.setAccelerator(javax.swing.KeyStroke.getKeyStroke(\r
- java.awt.event.KeyEvent.VK_X,\r
- Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));\r
- cut.setMnemonic(KeyEvent.VK_X);\r
- cut.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- cut_actionPerformed(e);\r
- }\r
- });\r
- delete.setText("Delete");\r
- delete.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- delete_actionPerformed(e);\r
- }\r
- });\r
- jMenu1.setMnemonic('V');\r
- jMenu1.setText("Paste");\r
- pasteNew.setText("To New Alignment");\r
- pasteNew.setAccelerator(javax.swing.KeyStroke.getKeyStroke(\r
- java.awt.event.KeyEvent.VK_V,\r
- Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));\r
- pasteNew.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- pasteNew_actionPerformed(e);\r
- }\r
- });\r
- pasteThis.setText("Add To This Alignment");\r
- pasteThis.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- pasteThis_actionPerformed(e);\r
- }\r
- });\r
- applyToAllGroups.setText("Apply Colour To All Groups");\r
- applyToAllGroups.setState(true);\r
- applyToAllGroups.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- applyToAllGroups_actionPerformed(e);\r
- }\r
- });\r
- createPNG.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- createPNG_actionPerformed(e);\r
- }\r
- });\r
- createPNG.setActionCommand("Save As PNG Image");\r
- createPNG.setText("PNG");\r
- font.setText("Font...");\r
- font.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- font_actionPerformed(e);\r
- }\r
- });\r
- fullSeqId.setText("Show Full Sequence ID");\r
- fullSeqId.setState(true);\r
- fullSeqId.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- fullSeqId_actionPerformed(e);\r
- }\r
- });\r
- epsFile.setText("EPS");\r
- epsFile.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- epsFile_actionPerformed(e);\r
- }\r
- });\r
- LoadtreeMenuItem.setActionCommand("Load a tree for this sequence set");\r
- LoadtreeMenuItem.setText("Load Assocated Tree");\r
- LoadtreeMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- LoadtreeMenuItem_actionPerformed(e);\r
- }\r
- });\r
- jnet.setText("JNet...");\r
- jnet.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- jpred_actionPerformed(e);\r
- }\r
- });\r
- scaleAbove.setVisible(false);\r
- scaleAbove.setText("Scale Above");\r
- scaleAbove.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- scaleAbove_actionPerformed(e);\r
- }\r
- });\r
- scaleLeft.setVisible(false);\r
- scaleLeft.setSelected(true);\r
- scaleLeft.setText("Scale Left");\r
- scaleLeft.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- scaleLeft_actionPerformed(e);\r
- }\r
- });\r
- scaleRight.setVisible(false);\r
- scaleRight.setSelected(true);\r
- scaleRight.setText("Scale Right");\r
- scaleRight.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- scaleRight_actionPerformed(e);\r
- }\r
- });\r
- modifyPID.setText("Modify Identity Threshold...");\r
- modifyPID.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- modifyPID_actionPerformed(e);\r
- }\r
- });\r
- modifyConservation.setText("Modify Conservation Threshold...");\r
- modifyConservation.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- modifyConservation_actionPerformed(e);\r
- }\r
- });\r
- sortByTreeMenu.setText("By Tree Order");\r
- sort.setText("Sort");\r
- calculate.setText("Calculate Tree");\r
- msaAlignMenuItem.setText("Muscle Alignment...");\r
- msaAlignMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- msaAlignMenuItem_actionPerformed(e);\r
- }\r
- });\r
- jMenu2.setText("Export");\r
- padGapsMenuitem.setText("Pad Gaps");\r
- padGapsMenuitem.addActionListener(new ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- padGapsMenuitem_actionPerformed(e);\r
- }\r
- });\r
- ClustalRealign.setText("Clustal Realign...");\r
- ClustalRealign.addActionListener(new ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- ClustalRealign_actionPerformed(e);\r
- }\r
- });\r
- alignFrameMenuBar.add(fileMenu);\r
- alignFrameMenuBar.add(editMenu);\r
- alignFrameMenuBar.add(searchMenu);\r
- alignFrameMenuBar.add(viewMenu);\r
- alignFrameMenuBar.add(colourMenu);\r
- alignFrameMenuBar.add(calculateMenu);\r
- fileMenu.add(saveAlignmentMenu);\r
- fileMenu.add(jMenu2);\r
- fileMenu.add(outputTextboxMenu);\r
- fileMenu.add(printMenuItem);\r
- fileMenu.addSeparator();\r
- fileMenu.add(LoadtreeMenuItem);\r
- fileMenu.addSeparator();\r
- fileMenu.add(closeMenuItem);\r
- editMenu.add(undoMenuItem);\r
- editMenu.add(redoMenuItem);\r
- editMenu.add(cut);\r
- editMenu.add(copy);\r
- editMenu.add(jMenu1);\r
- editMenu.add(delete);\r
- editMenu.addSeparator();\r
- editMenu.add(selectAllSequenceMenuItem);\r
- editMenu.add(deselectAllSequenceMenuItem);\r
- editMenu.add(invertSequenceMenuItem);\r
- editMenu.add(deleteGroups);\r
- editMenu.addSeparator();\r
- editMenu.add(remove2LeftMenuItem);\r
- editMenu.add(remove2RightMenuItem);\r
- editMenu.add(removeGappedColumnMenuItem);\r
- editMenu.add(removeAllGapsMenuItem);\r
- editMenu.add(removeRedundancyMenuItem);\r
- editMenu.addSeparator();\r
- editMenu.add(padGapsMenuitem);\r
- searchMenu.add(findMenuItem);\r
- viewMenu.add(font);\r
- viewMenu.addSeparator();\r
- viewMenu.add(wrapMenuItem);\r
- viewMenu.add(fullSeqId);\r
- viewMenu.add(scaleAbove);\r
- viewMenu.add(scaleLeft);\r
- viewMenu.add(scaleRight);\r
- viewMenu.add(viewBoxesMenuItem);\r
- viewMenu.add(viewTextMenuItem);\r
- viewMenu.add(colourTextMenuItem);\r
- viewMenu.add(renderGapsMenuItem);\r
- viewMenu.add(annotationPanelMenuItem);\r
- viewMenu.add(sequenceFeatures);\r
- viewMenu.addSeparator();\r
- viewMenu.add(overviewMenuItem);\r
- colourMenu.add(applyToAllGroups);\r
- colourMenu.addSeparator();\r
- colourMenu.add(noColourmenuItem);\r
- colourMenu.add(clustalColour);\r
- colourMenu.add(BLOSUM62Colour);\r
- colourMenu.add(PIDColour);\r
- colourMenu.add(zappoColour);\r
- colourMenu.add(taylorColour);\r
- colourMenu.add(hydrophobicityColour);\r
- colourMenu.add(helixColour);\r
- colourMenu.add(strandColour);\r
- colourMenu.add(turnColour);\r
- colourMenu.add(buriedColour);\r
- colourMenu.add(nucleotideColour);\r
- colourMenu.add(userDefinedColour);\r
- colourMenu.addSeparator();\r
- colourMenu.add(conservationMenuItem);\r
- colourMenu.add(modifyConservation);\r
- colourMenu.add(abovePIDThreshold);\r
- colourMenu.add(modifyPID);\r
- calculateMenu.add(sort);\r
- calculateMenu.add(calculate);\r
- calculateMenu.addSeparator();\r
- calculateMenu.add(pairwiseAlignmentMenuItem);\r
- calculateMenu.add(PCAMenuItem);\r
- calculateMenu.addSeparator();\r
- calculateMenu.add(webService);\r
- webService.add(clustalAlignMenuItem);\r
- webService.add(msaAlignMenuItem);\r
- webService.add(jnet);\r
- webService.add(ClustalRealign);\r
- this.getContentPane().add(statusBar, BorderLayout.SOUTH);\r
- jMenu1.add(pasteNew);\r
- jMenu1.add(pasteThis);\r
- sort.add(sortIDMenuItem);\r
- sort.add(sortGroupMenuItem);\r
- sort.add(sortPairwiseMenuItem);\r
- calculate.add(averageDistanceTreeMenuItem);\r
- calculate.add(neighbourTreeMenuItem);\r
- calculate.add(avDistanceTreeBlosumMenuItem);\r
- calculate.add(njTreeBlosumMenuItem);\r
- jMenu2.add(htmlMenuItem);\r
- jMenu2.add(epsFile);\r
- jMenu2.add(createPNG);\r
- }\r
-\r
- protected void outputText_actionPerformed(ActionEvent e) {\r
- }\r
-\r
- protected void htmlMenuItem_actionPerformed(ActionEvent e) {\r
- }\r
-\r
- protected void closeMenuItem_actionPerformed(ActionEvent e) {\r
- }\r
-\r
- protected void redoMenuItem_actionPerformed(ActionEvent e) {\r
- }\r
-\r
- protected void undoMenuItem_actionPerformed(ActionEvent e) {\r
- }\r
-\r
- protected void selectAllSequenceMenuItem_actionPerformed(ActionEvent e) {\r
- }\r
-\r
- protected void deselectAllSequenceMenuItem_actionPerformed(ActionEvent e) {\r
- }\r
-\r
- protected void invertSequenceMenuItem_actionPerformed(ActionEvent e) {\r
- }\r
-\r
- protected void remove2LeftMenuItem_actionPerformed(ActionEvent e) {\r
- }\r
-\r
- protected void remove2RightMenuItem_actionPerformed(ActionEvent e) {\r
- }\r
-\r
- protected void removeGappedColumnMenuItem_actionPerformed(ActionEvent e) {\r
- }\r
-\r
- protected void removeAllGapsMenuItem_actionPerformed(ActionEvent e) {\r
- }\r
-\r
- protected void wrapMenuItem_actionPerformed(ActionEvent e) {\r
- }\r
-\r
- protected void viewBoxesMenuItem_actionPerformed(ActionEvent e) {\r
- }\r
-\r
- protected void viewTextMenuItem_actionPerformed(ActionEvent e) {\r
- }\r
-\r
- protected void colourTextMenuItem_actionPerformed(ActionEvent e) {\r
- }\r
-\r
- protected void annotationPanelMenuItem_actionPerformed(ActionEvent e) {\r
- }\r
-\r
- protected void overviewMenuItem_actionPerformed(ActionEvent e) {\r
- }\r
-\r
- protected void sortPairwiseMenuItem_actionPerformed(ActionEvent e) {\r
- }\r
-\r
- protected void sortIDMenuItem_actionPerformed(ActionEvent e) {\r
- }\r
-\r
- protected void sortGroupMenuItem_actionPerformed(ActionEvent e) {\r
- }\r
+import javax.swing.event.*;\r
+\r
+import jalview.gui.*;\r
+import jalview.schemes.*;\r
+\r
+public class GAlignFrame\r
+ extends JInternalFrame\r
+{\r
+ protected JMenuBar alignFrameMenuBar = new JMenuBar();\r
+ protected JMenu fileMenu = new JMenu();\r
+ protected JMenuItem closeMenuItem = new JMenuItem();\r
+ protected JMenu editMenu = new JMenu();\r
+ protected JMenu viewMenu = new JMenu();\r
+ protected JMenu colourMenu = new JMenu();\r
+ protected JMenu calculateMenu = new JMenu();\r
+ protected JMenu webService = new JMenu();\r
+ protected JMenuItem selectAllSequenceMenuItem = new JMenuItem();\r
+ protected JMenuItem deselectAllSequenceMenuItem = new JMenuItem();\r
+ protected JMenuItem invertSequenceMenuItem = new JMenuItem();\r
+ protected JMenuItem remove2LeftMenuItem = new JMenuItem();\r
+ protected JMenuItem remove2RightMenuItem = new JMenuItem();\r
+ protected JMenuItem removeGappedColumnMenuItem = new JMenuItem();\r
+ protected JMenuItem removeAllGapsMenuItem = new JMenuItem();\r
+ public JCheckBoxMenuItem viewBoxesMenuItem = new JCheckBoxMenuItem();\r
+ public JCheckBoxMenuItem viewTextMenuItem = new JCheckBoxMenuItem();\r
+ protected JMenuItem sortPairwiseMenuItem = new JMenuItem();\r
+ protected JMenuItem sortIDMenuItem = new JMenuItem();\r
+ protected JMenuItem sortGroupMenuItem = new JMenuItem();\r
+ protected JMenuItem removeRedundancyMenuItem = new JMenuItem();\r
+ protected JMenuItem pairwiseAlignmentMenuItem = new JMenuItem();\r
+ protected JMenuItem PCAMenuItem = new JMenuItem();\r
+ protected JMenuItem averageDistanceTreeMenuItem = new JMenuItem();\r
+ protected JMenuItem neighbourTreeMenuItem = new JMenuItem();\r
+ protected JMenuItem clustalAlignMenuItem = new JMenuItem();\r
+ BorderLayout borderLayout1 = new BorderLayout();\r
+ public JLabel statusBar = new JLabel();\r
+ protected JMenuItem saveAlignmentMenu = new JMenuItem();\r
+ protected JMenu outputTextboxMenu = new JMenu();\r
+ protected JRadioButtonMenuItem clustalColour = new JRadioButtonMenuItem();\r
+ protected JRadioButtonMenuItem zappoColour = new JRadioButtonMenuItem();\r
+ protected JRadioButtonMenuItem taylorColour = new JRadioButtonMenuItem();\r
+ protected JRadioButtonMenuItem hydrophobicityColour = new\r
+ JRadioButtonMenuItem();\r
+ protected JRadioButtonMenuItem helixColour = new JRadioButtonMenuItem();\r
+ protected JRadioButtonMenuItem strandColour = new JRadioButtonMenuItem();\r
+ protected JRadioButtonMenuItem turnColour = new JRadioButtonMenuItem();\r
+ protected JRadioButtonMenuItem buriedColour = new JRadioButtonMenuItem();\r
+ protected JRadioButtonMenuItem userDefinedColour = new JRadioButtonMenuItem();\r
+ protected JRadioButtonMenuItem PIDColour = new JRadioButtonMenuItem();\r
+ protected JRadioButtonMenuItem BLOSUM62Colour = new JRadioButtonMenuItem();\r
+ JMenuItem njTreeBlosumMenuItem = new JMenuItem();\r
+ JMenuItem avDistanceTreeBlosumMenuItem = new JMenuItem();\r
+ public JCheckBoxMenuItem annotationPanelMenuItem = new JCheckBoxMenuItem();\r
+ public JCheckBoxMenuItem colourTextMenuItem = new JCheckBoxMenuItem();\r
+ JMenuItem htmlMenuItem = new JMenuItem();\r
+ JMenuItem overviewMenuItem = new JMenuItem();\r
+ protected JMenuItem undoMenuItem = new JMenuItem();\r
+ protected JMenuItem redoMenuItem = new JMenuItem();\r
+ public JCheckBoxMenuItem conservationMenuItem = new JCheckBoxMenuItem();\r
+ JRadioButtonMenuItem noColourmenuItem = new JRadioButtonMenuItem();\r
+ public JCheckBoxMenuItem wrapMenuItem = new JCheckBoxMenuItem();\r
+ JMenuItem printMenuItem = new JMenuItem();\r
+ public JCheckBoxMenuItem renderGapsMenuItem = new JCheckBoxMenuItem();\r
+ JMenuItem findMenuItem = new JMenuItem();\r
+ JMenu searchMenu = new JMenu();\r
+ public JCheckBoxMenuItem abovePIDThreshold = new JCheckBoxMenuItem();\r
+ public JCheckBoxMenuItem sequenceFeatures = new JCheckBoxMenuItem();\r
+ protected JRadioButtonMenuItem nucleotideColour = new JRadioButtonMenuItem();\r
+ JMenuItem deleteGroups = new JMenuItem();\r
+ JMenuItem delete = new JMenuItem();\r
+ JMenuItem copy = new JMenuItem();\r
+ JMenuItem cut = new JMenuItem();\r
+ JMenu jMenu1 = new JMenu();\r
+ JMenuItem pasteNew = new JMenuItem();\r
+ JMenuItem pasteThis = new JMenuItem();\r
+ public JCheckBoxMenuItem applyToAllGroups = new JCheckBoxMenuItem();\r
+ JMenuItem createPNG = new JMenuItem();\r
+ protected JMenuItem font = new JMenuItem();\r
+ public JCheckBoxMenuItem fullSeqId = new JCheckBoxMenuItem();\r
+ JMenuItem epsFile = new JMenuItem();\r
+ JMenuItem LoadtreeMenuItem = new JMenuItem();\r
+ JMenuItem jnet = new JMenuItem();\r
+ public JCheckBoxMenuItem scaleAbove = new JCheckBoxMenuItem();\r
+ public JCheckBoxMenuItem scaleLeft = new JCheckBoxMenuItem();\r
+ public JCheckBoxMenuItem scaleRight = new JCheckBoxMenuItem();\r
+ JMenuItem modifyPID = new JMenuItem();\r
+ JMenuItem modifyConservation = new JMenuItem();\r
+ protected JMenu sortByTreeMenu = new JMenu();\r
+ protected JMenu sort = new JMenu();\r
+ JMenu calculate = new JMenu();\r
+ JMenuItem msaAlignMenuItem = new JMenuItem();\r
+ JMenu jMenu2 = new JMenu();\r
+ JMenuItem padGapsMenuitem = new JMenuItem();\r
+ JMenuItem ClustalRealign = new JMenuItem();\r
+\r
+ public GAlignFrame()\r
+ {\r
+ ButtonGroup colours = new ButtonGroup();\r
+ colours.add(noColourmenuItem);\r
+ colours.add(clustalColour);\r
+ colours.add(zappoColour);\r
+ colours.add(taylorColour);\r
+ colours.add(hydrophobicityColour);\r
+ colours.add(helixColour);\r
+ colours.add(strandColour);\r
+ colours.add(turnColour);\r
+ colours.add(buriedColour);\r
+ colours.add(userDefinedColour);\r
+ colours.add(PIDColour);\r
+ colours.add(BLOSUM62Colour);\r
+ colours.add(nucleotideColour);\r
+\r
+ noColourmenuItem.setSelected(true);\r
+\r
+ String defaultColour = Preferences.defaultColour;\r
+\r
+ if (defaultColour != null)\r
+ {\r
+ int index = ColourSchemeProperty.getColourIndexFromName(defaultColour);\r
+\r
+ switch (index)\r
+ {\r
+ case ColourSchemeProperty.CLUSTAL:\r
+ clustalColour.setSelected(true);\r
+\r
+ break;\r
+\r
+ case ColourSchemeProperty.BLOSUM:\r
+ BLOSUM62Colour.setSelected(true);\r
+\r
+ break;\r
+\r
+ case ColourSchemeProperty.PID:\r
+ PIDColour.setSelected(true);\r
+\r
+ break;\r
+\r
+ case ColourSchemeProperty.ZAPPO:\r
+ zappoColour.setSelected(true);\r
+\r
+ break;\r
+\r
+ case ColourSchemeProperty.HYDROPHOBIC:\r
+ hydrophobicityColour.setSelected(true);\r
+\r
+ break;\r
+\r
+ case ColourSchemeProperty.HELIX:\r
+ helixColour.setSelected(true);\r
+\r
+ break;\r
+\r
+ case ColourSchemeProperty.STRAND:\r
+ strandColour.setSelected(true);\r
+\r
+ break;\r
+\r
+ case ColourSchemeProperty.TURN:\r
+ turnColour.setSelected(true);\r
+\r
+ break;\r
+\r
+ case ColourSchemeProperty.BURIED:\r
+ buriedColour.setSelected(true);\r
+\r
+ break;\r
+\r
+ case ColourSchemeProperty.NUCLEOTIDE:\r
+ nucleotideColour.setSelected(true);\r
+\r
+ break;\r
+\r
+ case ColourSchemeProperty.USER_DEFINED:\r
+ userDefinedColour.setSelected(true);\r
+\r
+ break;\r
+ }\r
+ }\r
+\r
+ try\r
+ {\r
+ jbInit();\r
+ setJMenuBar(alignFrameMenuBar);\r
+\r
+ JMenuItem item;\r
+\r
+ // dynamically fill save as menu with available formats\r
+ for (int i = 0; i < jalview.io.FormatAdapter.formats.size(); i++)\r
+ {\r
+ item = new JMenuItem( (String) jalview.io.FormatAdapter.formats.\r
+ elementAt(\r
+ i));\r
+ item.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ outputText_actionPerformed(e);\r
+ }\r
+ });\r
+\r
+ outputTextboxMenu.add(item);\r
+ }\r
+ }\r
+ catch (Exception e)\r
+ {\r
+ e.printStackTrace();\r
+ }\r
+\r
+ }\r
+\r
+ private void jbInit()\r
+ throws Exception\r
+ {\r
+ fileMenu.setMnemonic('F');\r
+ fileMenu.setText("File");\r
+ saveAlignmentMenu.setMnemonic('L');\r
+ saveAlignmentMenu.setText("Save As");\r
+ saveAlignmentMenu.addActionListener(new ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ saveAlignmentMenu_actionPerformed(e);\r
+ }\r
+ });\r
+ closeMenuItem.setMnemonic('C');\r
+ closeMenuItem.setText("Close");\r
+ closeMenuItem.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ closeMenuItem_actionPerformed(e);\r
+ }\r
+ });\r
+ editMenu.setText("Edit");\r
+ viewMenu.setText("View");\r
+ colourMenu.setText("Colour");\r
+ calculateMenu.setText("Calculate");\r
+ webService.setText("Web Service");\r
+ selectAllSequenceMenuItem.setText("Select all");\r
+ selectAllSequenceMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(\r
+ java.awt.event.KeyEvent.VK_A,\r
+ Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));\r
+ selectAllSequenceMenuItem.addActionListener(new java.awt.event.\r
+ ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ selectAllSequenceMenuItem_actionPerformed(e);\r
+ }\r
+ });\r
+ deselectAllSequenceMenuItem.setText("Deselect All");\r
+ deselectAllSequenceMenuItem.setAccelerator(javax.swing.KeyStroke.\r
+ getKeyStroke(\r
+ java.awt.event.KeyEvent.VK_ESCAPE, 0, false));\r
+ deselectAllSequenceMenuItem.addActionListener(new java.awt.event.\r
+ ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ deselectAllSequenceMenuItem_actionPerformed(e);\r
+ }\r
+ });\r
+ invertSequenceMenuItem.setText("Invert Selection");\r
+ invertSequenceMenuItem.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ invertSequenceMenuItem_actionPerformed(e);\r
+ }\r
+ });\r
+ remove2LeftMenuItem.setText("Remove Left");\r
+ remove2LeftMenuItem.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ remove2LeftMenuItem_actionPerformed(e);\r
+ }\r
+ });\r
+ remove2RightMenuItem.setText("Remove Right");\r
+ remove2RightMenuItem.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ remove2RightMenuItem_actionPerformed(e);\r
+ }\r
+ });\r
+ removeGappedColumnMenuItem.setText("Remove Empty Columns");\r
+ removeGappedColumnMenuItem.addActionListener(new java.awt.event.\r
+ ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ removeGappedColumnMenuItem_actionPerformed(e);\r
+ }\r
+ });\r
+ removeAllGapsMenuItem.setText("Remove All Gaps");\r
+ removeAllGapsMenuItem.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ removeAllGapsMenuItem_actionPerformed(e);\r
+ }\r
+ });\r
+ viewBoxesMenuItem.setText("Boxes");\r
+ viewBoxesMenuItem.setState(true);\r
+ viewBoxesMenuItem.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ viewBoxesMenuItem_actionPerformed(e);\r
+ }\r
+ });\r
+ viewTextMenuItem.setText("Text");\r
+ viewTextMenuItem.setState(true);\r
+ viewTextMenuItem.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ viewTextMenuItem_actionPerformed(e);\r
+ }\r
+ });\r
+ sortPairwiseMenuItem.setText("by Pairwise Identity");\r
+ sortPairwiseMenuItem.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ sortPairwiseMenuItem_actionPerformed(e);\r
+ }\r
+ });\r
+ sortIDMenuItem.setText("by ID");\r
+ sortIDMenuItem.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ sortIDMenuItem_actionPerformed(e);\r
+ }\r
+ });\r
+ sortGroupMenuItem.setText("by Group");\r
+ sortGroupMenuItem.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ sortGroupMenuItem_actionPerformed(e);\r
+ }\r
+ });\r
+ removeRedundancyMenuItem.setText("Remove Redundancy...");\r
+ removeRedundancyMenuItem.addActionListener(new java.awt.event.\r
+ ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ removeRedundancyMenuItem_actionPerformed(e);\r
+ }\r
+ });\r
+ pairwiseAlignmentMenuItem.setText("Pairwise Alignments...");\r
+ pairwiseAlignmentMenuItem.addActionListener(new java.awt.event.\r
+ ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ pairwiseAlignmentMenuItem_actionPerformed(e);\r
+ }\r
+ });\r
+ PCAMenuItem.setText("Principal Component Analysis");\r
+ PCAMenuItem.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ PCAMenuItem_actionPerformed(e);\r
+ }\r
+ });\r
+ averageDistanceTreeMenuItem.setText(\r
+ "Average Distance Using % Identity");\r
+ averageDistanceTreeMenuItem.addActionListener(new java.awt.event.\r
+ ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ averageDistanceTreeMenuItem_actionPerformed(e);\r
+ }\r
+ });\r
+ neighbourTreeMenuItem.setText("Neighbour Joining Using % Identity");\r
+ neighbourTreeMenuItem.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ neighbourTreeMenuItem_actionPerformed(e);\r
+ }\r
+ });\r
+ clustalAlignMenuItem.setText("Clustal Alignment");\r
+ clustalAlignMenuItem.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ clustalAlignMenuItem_actionPerformed(e);\r
+ }\r
+ });\r
+ this.getContentPane().setLayout(borderLayout1);\r
+ alignFrameMenuBar.setFont(new java.awt.Font("Verdana", 0, 11));\r
+ alignFrameMenuBar.addAncestorListener(new AncestorListener()\r
+ {\r
+ public void ancestorAdded(AncestorEvent event)\r
+ {\r
+ alignFrameMenuBar_ancestorAdded(event);\r
+ }\r
+\r
+ public void ancestorRemoved(AncestorEvent event)\r
+ {\r
+ }\r
+\r
+ public void ancestorMoved(AncestorEvent event)\r
+ {\r
+ }\r
+ });\r
+ statusBar.setBackground(Color.white);\r
+ statusBar.setFont(new java.awt.Font("Verdana", 0, 11));\r
+ statusBar.setBorder(BorderFactory.createLineBorder(Color.black));\r
+ statusBar.setText("Status bar");\r
+ outputTextboxMenu.setMnemonic('T');\r
+ outputTextboxMenu.setText("Output to Textbox");\r
+ clustalColour.setText("Clustalx");\r
+\r
+ clustalColour.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ clustalColour_actionPerformed(e);\r
+ }\r
+ });\r
+ zappoColour.setText("Zappo");\r
+ zappoColour.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ zappoColour_actionPerformed(e);\r
+ }\r
+ });\r
+ taylorColour.setText("Taylor");\r
+ taylorColour.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ taylorColour_actionPerformed(e);\r
+ }\r
+ });\r
+ hydrophobicityColour.setText("Hydrophobicity");\r
+ hydrophobicityColour.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ hydrophobicityColour_actionPerformed(e);\r
+ }\r
+ });\r
+ helixColour.setText("Helix Propensity");\r
+ helixColour.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ helixColour_actionPerformed(e);\r
+ }\r
+ });\r
+ strandColour.setText("Strand Propensity");\r
+ strandColour.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ strandColour_actionPerformed(e);\r
+ }\r
+ });\r
+ turnColour.setText("Turn Propensity");\r
+ turnColour.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ turnColour_actionPerformed(e);\r
+ }\r
+ });\r
+ buriedColour.setText("Buried Index");\r
+ buriedColour.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ buriedColour_actionPerformed(e);\r
+ }\r
+ });\r
+ userDefinedColour.setText("User Defined...");\r
+ userDefinedColour.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ userDefinedColour_actionPerformed(e);\r
+ }\r
+ });\r
+ PIDColour.setText("Percentage Identity");\r
+ PIDColour.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ PIDColour_actionPerformed(e);\r
+ }\r
+ });\r
+ BLOSUM62Colour.setText("BLOSUM62 Score");\r
+ BLOSUM62Colour.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ BLOSUM62Colour_actionPerformed(e);\r
+ }\r
+ });\r
+ avDistanceTreeBlosumMenuItem.setText(\r
+ "Average Distance Using BLOSUM62");\r
+ avDistanceTreeBlosumMenuItem.addActionListener(new java.awt.event.\r
+ ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ avTreeBlosumMenuItem_actionPerformed(e);\r
+ }\r
+ });\r
+ njTreeBlosumMenuItem.setText("Neighbour Joining using BLOSUM62");\r
+ njTreeBlosumMenuItem.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ njTreeBlosumMenuItem_actionPerformed(e);\r
+ }\r
+ });\r
+ annotationPanelMenuItem.setActionCommand("");\r
+ annotationPanelMenuItem.setText("Show Annotations");\r
+ annotationPanelMenuItem.setState(jalview.gui.Preferences.showAnnotation);\r
+ annotationPanelMenuItem.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ annotationPanelMenuItem_actionPerformed(e);\r
+ }\r
+ });\r
+ colourTextMenuItem.setText("Colour Text");\r
+ colourTextMenuItem.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ colourTextMenuItem_actionPerformed(e);\r
+ }\r
+ });\r
+ htmlMenuItem.setText("HTML");\r
+ htmlMenuItem.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ htmlMenuItem_actionPerformed(e);\r
+ }\r
+ });\r
+ overviewMenuItem.setText("Overview Window");\r
+ overviewMenuItem.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ overviewMenuItem_actionPerformed(e);\r
+ }\r
+ });\r
+ undoMenuItem.setEnabled(false);\r
+ undoMenuItem.setMnemonic('Z');\r
+ undoMenuItem.setText("Undo");\r
+ undoMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(\r
+ java.awt.event.KeyEvent.VK_Z,\r
+ Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));\r
+ undoMenuItem.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ undoMenuItem_actionPerformed(e);\r
+ }\r
+ });\r
+ redoMenuItem.setEnabled(false);\r
+ redoMenuItem.setMnemonic('0');\r
+ redoMenuItem.setText("Redo");\r
+ redoMenuItem.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ redoMenuItem_actionPerformed(e);\r
+ }\r
+ });\r
+ conservationMenuItem.setText("By Conservation");\r
+ conservationMenuItem.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ conservationMenuItem_actionPerformed(e);\r
+ }\r
+ });\r
+ noColourmenuItem.setText("None");\r
+ noColourmenuItem.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ noColourmenuItem_actionPerformed(e);\r
+ }\r
+ });\r
+ wrapMenuItem.setText("Wrap");\r
+ wrapMenuItem.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ wrapMenuItem_actionPerformed(e);\r
+ }\r
+ });\r
+ printMenuItem.setText("Print");\r
+ printMenuItem.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ printMenuItem_actionPerformed(e);\r
+ }\r
+ });\r
+ renderGapsMenuItem.setText("Show Gaps");\r
+ renderGapsMenuItem.setState(true);\r
+ renderGapsMenuItem.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ renderGapsMenuItem_actionPerformed(e);\r
+ }\r
+ });\r
+ findMenuItem.setText("Find...");\r
+ findMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(\r
+ java.awt.event.KeyEvent.VK_F,\r
+ Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));\r
+ findMenuItem.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ findMenuItem_actionPerformed(e);\r
+ }\r
+ });\r
+ searchMenu.setText("Search");\r
+\r
+ abovePIDThreshold.setText("Above Identity Threshold");\r
+ abovePIDThreshold.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ abovePIDThreshold_actionPerformed(e);\r
+ }\r
+ });\r
+ sequenceFeatures.setText("Sequence Features");\r
+ sequenceFeatures.addActionListener(new ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent actionEvent)\r
+ {\r
+ sequenceFeatures_actionPerformed(actionEvent);\r
+ }\r
+ });\r
+ nucleotideColour.setText("Nucleotide");\r
+ nucleotideColour.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ nucleotideColour_actionPerformed(e);\r
+ }\r
+ });\r
+ deleteGroups.setText("Undefine groups");\r
+ deleteGroups.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ deleteGroups_actionPerformed(e);\r
+ }\r
+ });\r
+ copy.setText("Copy");\r
+ copy.setAccelerator(javax.swing.KeyStroke.getKeyStroke(\r
+ java.awt.event.KeyEvent.VK_C,\r
+ Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));\r
+ copy.setMnemonic(KeyEvent.VK_C);\r
+\r
+ copy.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ copy_actionPerformed(e);\r
+ }\r
+ });\r
+ cut.setText("Cut");\r
+ cut.setAccelerator(javax.swing.KeyStroke.getKeyStroke(\r
+ java.awt.event.KeyEvent.VK_X,\r
+ Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));\r
+ cut.setMnemonic(KeyEvent.VK_X);\r
+ cut.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ cut_actionPerformed(e);\r
+ }\r
+ });\r
+ delete.setText("Delete");\r
+ delete.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ delete_actionPerformed(e);\r
+ }\r
+ });\r
+ jMenu1.setMnemonic('V');\r
+ jMenu1.setText("Paste");\r
+ pasteNew.setText("To New Alignment");\r
+ pasteNew.setAccelerator(javax.swing.KeyStroke.getKeyStroke(\r
+ java.awt.event.KeyEvent.VK_V,\r
+ Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));\r
+ pasteNew.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ pasteNew_actionPerformed(e);\r
+ }\r
+ });\r
+ pasteThis.setText("Add To This Alignment");\r
+ pasteThis.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ pasteThis_actionPerformed(e);\r
+ }\r
+ });\r
+ applyToAllGroups.setText("Apply Colour To All Groups");\r
+ applyToAllGroups.setState(true);\r
+ applyToAllGroups.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ applyToAllGroups_actionPerformed(e);\r
+ }\r
+ });\r
+ createPNG.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ createPNG(null);\r
+ }\r
+ });\r
+ createPNG.setActionCommand("Save As PNG Image");\r
+ createPNG.setText("PNG");\r
+ font.setText("Font...");\r
+ font.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ font_actionPerformed(e);\r
+ }\r
+ });\r
+ fullSeqId.setText("Show Full Sequence ID");\r
+ fullSeqId.setState(true);\r
+ fullSeqId.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ fullSeqId_actionPerformed(e);\r
+ }\r
+ });\r
+ epsFile.setText("EPS");\r
+ epsFile.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ createEPS(null);\r
+ }\r
+ });\r
+ LoadtreeMenuItem.setActionCommand("Load a tree for this sequence set");\r
+ LoadtreeMenuItem.setText("Load Assocated Tree");\r
+ LoadtreeMenuItem.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ LoadtreeMenuItem_actionPerformed(e);\r
+ }\r
+ });\r
+ jnet.setText("JNet");\r
+ jnet.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ jpred_actionPerformed(e);\r
+ }\r
+ });\r
+ scaleAbove.setVisible(false);\r
+ scaleAbove.setText("Scale Above");\r
+ scaleAbove.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ scaleAbove_actionPerformed(e);\r
+ }\r
+ });\r
+ scaleLeft.setVisible(false);\r
+ scaleLeft.setSelected(true);\r
+ scaleLeft.setText("Scale Left");\r
+ scaleLeft.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ scaleLeft_actionPerformed(e);\r
+ }\r
+ });\r
+ scaleRight.setVisible(false);\r
+ scaleRight.setSelected(true);\r
+ scaleRight.setText("Scale Right");\r
+ scaleRight.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ scaleRight_actionPerformed(e);\r
+ }\r
+ });\r
+ modifyPID.setText("Modify Identity Threshold...");\r
+ modifyPID.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ modifyPID_actionPerformed(e);\r
+ }\r
+ });\r
+ modifyConservation.setText("Modify Conservation Threshold...");\r
+ modifyConservation.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ modifyConservation_actionPerformed(e);\r
+ }\r
+ });\r
+ sortByTreeMenu.setText("By Tree Order");\r
+ sort.setText("Sort");\r
+ calculate.setText("Calculate Tree");\r
+ msaAlignMenuItem.setText("Muscle Alignment");\r
+ msaAlignMenuItem.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ msaAlignMenuItem_actionPerformed(e);\r
+ }\r
+ });\r
+ jMenu2.setText("Export");\r
+ padGapsMenuitem.setText("Pad Gaps");\r
+ padGapsMenuitem.addActionListener(new ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ padGapsMenuitem_actionPerformed(e);\r
+ }\r
+ });\r
+ ClustalRealign.setText("Clustal Realign");\r
+ ClustalRealign.addActionListener(new ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ ClustalRealign_actionPerformed(e);\r
+ }\r
+ });\r
+ alignFrameMenuBar.add(fileMenu);\r
+ alignFrameMenuBar.add(editMenu);\r
+ alignFrameMenuBar.add(searchMenu);\r
+ alignFrameMenuBar.add(viewMenu);\r
+ alignFrameMenuBar.add(colourMenu);\r
+ alignFrameMenuBar.add(calculateMenu);\r
+ fileMenu.add(saveAlignmentMenu);\r
+ fileMenu.add(jMenu2);\r
+ fileMenu.add(outputTextboxMenu);\r
+ fileMenu.add(printMenuItem);\r
+ fileMenu.addSeparator();\r
+ fileMenu.add(LoadtreeMenuItem);\r
+ fileMenu.addSeparator();\r
+ fileMenu.add(closeMenuItem);\r
+ editMenu.add(undoMenuItem);\r
+ editMenu.add(redoMenuItem);\r
+ editMenu.add(cut);\r
+ editMenu.add(copy);\r
+ editMenu.add(jMenu1);\r
+ editMenu.add(delete);\r
+ editMenu.addSeparator();\r
+ editMenu.add(selectAllSequenceMenuItem);\r
+ editMenu.add(deselectAllSequenceMenuItem);\r
+ editMenu.add(invertSequenceMenuItem);\r
+ editMenu.add(deleteGroups);\r
+ editMenu.addSeparator();\r
+ editMenu.add(remove2LeftMenuItem);\r
+ editMenu.add(remove2RightMenuItem);\r
+ editMenu.add(removeGappedColumnMenuItem);\r
+ editMenu.add(removeAllGapsMenuItem);\r
+ editMenu.add(removeRedundancyMenuItem);\r
+ editMenu.addSeparator();\r
+ editMenu.add(padGapsMenuitem);\r
+ searchMenu.add(findMenuItem);\r
+ viewMenu.add(font);\r
+ viewMenu.addSeparator();\r
+ viewMenu.add(wrapMenuItem);\r
+ viewMenu.add(fullSeqId);\r
+ viewMenu.add(scaleAbove);\r
+ viewMenu.add(scaleLeft);\r
+ viewMenu.add(scaleRight);\r
+ viewMenu.add(viewBoxesMenuItem);\r
+ viewMenu.add(viewTextMenuItem);\r
+ viewMenu.add(colourTextMenuItem);\r
+ viewMenu.add(renderGapsMenuItem);\r
+ viewMenu.add(annotationPanelMenuItem);\r
+ viewMenu.add(sequenceFeatures);\r
+ viewMenu.addSeparator();\r
+ viewMenu.add(overviewMenuItem);\r
+ colourMenu.add(applyToAllGroups);\r
+ colourMenu.addSeparator();\r
+ colourMenu.add(noColourmenuItem);\r
+ colourMenu.add(clustalColour);\r
+ colourMenu.add(BLOSUM62Colour);\r
+ colourMenu.add(PIDColour);\r
+ colourMenu.add(zappoColour);\r
+ colourMenu.add(taylorColour);\r
+ colourMenu.add(hydrophobicityColour);\r
+ colourMenu.add(helixColour);\r
+ colourMenu.add(strandColour);\r
+ colourMenu.add(turnColour);\r
+ colourMenu.add(buriedColour);\r
+ colourMenu.add(nucleotideColour);\r
+ colourMenu.add(userDefinedColour);\r
+ colourMenu.addSeparator();\r
+ colourMenu.add(conservationMenuItem);\r
+ colourMenu.add(modifyConservation);\r
+ colourMenu.add(abovePIDThreshold);\r
+ colourMenu.add(modifyPID);\r
+ calculateMenu.add(sort);\r
+ calculateMenu.add(calculate);\r
+ calculateMenu.addSeparator();\r
+ calculateMenu.add(pairwiseAlignmentMenuItem);\r
+ calculateMenu.add(PCAMenuItem);\r
+ calculateMenu.addSeparator();\r
+ calculateMenu.add(webService);\r
+ webService.add(clustalAlignMenuItem);\r
+ webService.add(msaAlignMenuItem);\r
+ webService.add(jnet);\r
+ webService.add(ClustalRealign);\r
+ this.getContentPane().add(statusBar, BorderLayout.SOUTH);\r
+ jMenu1.add(pasteNew);\r
+ jMenu1.add(pasteThis);\r
+ sort.add(sortIDMenuItem);\r
+ sort.add(sortGroupMenuItem);\r
+ sort.add(sortPairwiseMenuItem);\r
+ calculate.add(averageDistanceTreeMenuItem);\r
+ calculate.add(neighbourTreeMenuItem);\r
+ calculate.add(avDistanceTreeBlosumMenuItem);\r
+ calculate.add(njTreeBlosumMenuItem);\r
+ jMenu2.add(htmlMenuItem);\r
+ jMenu2.add(epsFile);\r
+ jMenu2.add(createPNG);\r
+ }\r
+\r
+ protected void outputText_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
+\r
+ protected void htmlMenuItem_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
+\r
+ protected void closeMenuItem_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
+\r
+ protected void redoMenuItem_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
+\r
+ protected void undoMenuItem_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
+\r
+ protected void selectAllSequenceMenuItem_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
+\r
+ protected void deselectAllSequenceMenuItem_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
+\r
+ protected void invertSequenceMenuItem_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
+\r
+ protected void remove2LeftMenuItem_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
+\r
+ protected void remove2RightMenuItem_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
+\r
+ protected void removeGappedColumnMenuItem_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
+\r
+ protected void removeAllGapsMenuItem_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
+\r
+ protected void wrapMenuItem_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
+\r
+ protected void viewBoxesMenuItem_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
+\r
+ protected void viewTextMenuItem_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
+\r
+ protected void colourTextMenuItem_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
+\r
+ protected void annotationPanelMenuItem_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
+\r
+ protected void overviewMenuItem_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
+\r
+ protected void sortPairwiseMenuItem_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
+\r
+ protected void sortIDMenuItem_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
+\r
+ protected void sortGroupMenuItem_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
+\r
+ protected void removeRedundancyMenuItem_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
+\r
+ protected void pairwiseAlignmentMenuItem_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
+\r
+ protected void PCAMenuItem_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
\r
- protected void removeRedundancyMenuItem_actionPerformed(ActionEvent e) {\r
- }\r
+ protected void averageDistanceTreeMenuItem_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
\r
- protected void pairwiseAlignmentMenuItem_actionPerformed(ActionEvent e) {\r
- }\r
+ protected void neighbourTreeMenuItem_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
\r
- protected void PCAMenuItem_actionPerformed(ActionEvent e) {\r
- }\r
+ protected void njTreeBlosumMenuItem_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
\r
- protected void averageDistanceTreeMenuItem_actionPerformed(ActionEvent e) {\r
- }\r
+ protected void avTreeBlosumMenuItem_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
\r
- protected void neighbourTreeMenuItem_actionPerformed(ActionEvent e) {\r
- }\r
+ protected void clustalAlignMenuItem_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
\r
- protected void njTreeBlosumMenuItem_actionPerformed(ActionEvent e) {\r
- }\r
+ protected void clustalColour_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
\r
- protected void avTreeBlosumMenuItem_actionPerformed(ActionEvent e) {\r
- }\r
+ protected void zappoColour_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
\r
- protected void clustalAlignMenuItem_actionPerformed(ActionEvent e) {\r
- }\r
+ protected void taylorColour_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
\r
- protected void clustalColour_actionPerformed(ActionEvent e) {\r
- }\r
+ protected void hydrophobicityColour_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
\r
- protected void zappoColour_actionPerformed(ActionEvent e) {\r
- }\r
+ protected void helixColour_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
\r
- protected void taylorColour_actionPerformed(ActionEvent e) {\r
- }\r
+ protected void strandColour_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
\r
- protected void hydrophobicityColour_actionPerformed(ActionEvent e) {\r
- }\r
+ protected void turnColour_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
\r
- protected void helixColour_actionPerformed(ActionEvent e) {\r
- }\r
+ protected void buriedColour_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
\r
- protected void strandColour_actionPerformed(ActionEvent e) {\r
- }\r
+ protected void userDefinedColour_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
\r
- protected void turnColour_actionPerformed(ActionEvent e) {\r
- }\r
+ protected void PIDColour_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
\r
- protected void buriedColour_actionPerformed(ActionEvent e) {\r
- }\r
+ protected void BLOSUM62Colour_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
\r
- protected void userDefinedColour_actionPerformed(ActionEvent e) {\r
- }\r
+ protected void noColourmenuItem_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
\r
- protected void PIDColour_actionPerformed(ActionEvent e) {\r
- }\r
+ protected void conservationMenuItem_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
\r
- protected void BLOSUM62Colour_actionPerformed(ActionEvent e) {\r
- }\r
+ protected void printMenuItem_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
\r
- protected void noColourmenuItem_actionPerformed(ActionEvent e) {\r
- }\r
+ protected void renderGapsMenuItem_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
\r
- protected void conservationMenuItem_actionPerformed(ActionEvent e) {\r
- }\r
-\r
- protected void printMenuItem_actionPerformed(ActionEvent e) {\r
- }\r
-\r
- protected void renderGapsMenuItem_actionPerformed(ActionEvent e) {\r
- }\r
-\r
- protected void findMenuItem_actionPerformed(ActionEvent e) {\r
- }\r
+ protected void findMenuItem_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
\r
- protected void abovePIDThreshold_actionPerformed(ActionEvent e) {\r
- }\r
+ protected void abovePIDThreshold_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
\r
- public void sequenceFeatures_actionPerformed(ActionEvent actionEvent) {\r
- }\r
+ public void sequenceFeatures_actionPerformed(ActionEvent actionEvent)\r
+ {\r
+ }\r
\r
- protected void nucleotideColour_actionPerformed(ActionEvent e) {\r
- }\r
+ protected void nucleotideColour_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
\r
- protected void deleteGroups_actionPerformed(ActionEvent e) {\r
- }\r
+ protected void deleteGroups_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
\r
- protected void copy_actionPerformed(ActionEvent e) {\r
- }\r
+ protected void copy_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
\r
- protected void cut_actionPerformed(ActionEvent e) {\r
- }\r
+ protected void cut_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
\r
- protected void delete_actionPerformed(ActionEvent e) {\r
- }\r
+ protected void delete_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
\r
- protected void pasteNew_actionPerformed(ActionEvent e) {\r
- }\r
+ protected void pasteNew_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
\r
- protected void pasteThis_actionPerformed(ActionEvent e) {\r
- }\r
+ protected void pasteThis_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
\r
- protected void applyToAllGroups_actionPerformed(ActionEvent e) {\r
- }\r
+ protected void applyToAllGroups_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
\r
- protected void createPNG_actionPerformed(ActionEvent e) {\r
- }\r
+ public void createPNG(java.io.File f)\r
+ {\r
+ }\r
\r
- protected void font_actionPerformed(ActionEvent e) {\r
- }\r
+ protected void font_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
\r
- protected void fullSeqId_actionPerformed(ActionEvent e) {\r
- }\r
+ protected void fullSeqId_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
\r
- protected void epsFile_actionPerformed(ActionEvent e) {\r
- }\r
+ public void createEPS(java.io.File f)\r
+ {\r
+ }\r
\r
- protected void LoadtreeMenuItem_actionPerformed(ActionEvent e) {\r
- }\r
+ protected void LoadtreeMenuItem_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
\r
- protected void jpred_actionPerformed(ActionEvent e) {\r
- }\r
+ protected void jpred_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
\r
- protected void scaleAbove_actionPerformed(ActionEvent e) {\r
- }\r
+ protected void scaleAbove_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
\r
- protected void scaleLeft_actionPerformed(ActionEvent e) {\r
- }\r
+ protected void scaleLeft_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
\r
- protected void scaleRight_actionPerformed(ActionEvent e) {\r
- }\r
+ protected void scaleRight_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
\r
- protected void modifyPID_actionPerformed(ActionEvent e) {\r
- }\r
+ protected void modifyPID_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
\r
- protected void modifyConservation_actionPerformed(ActionEvent e) {\r
- }\r
+ protected void modifyConservation_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
\r
- protected void preferences_actionPerformed(ActionEvent e) {\r
- }\r
+ protected void preferences_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
\r
- protected void msaAlignMenuItem_actionPerformed(ActionEvent e) {\r
- }\r
+ protected void msaAlignMenuItem_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
\r
- protected void alignFrameMenuBar_ancestorAdded(AncestorEvent event) {\r
- }\r
+ protected void alignFrameMenuBar_ancestorAdded(AncestorEvent event)\r
+ {\r
+ }\r
\r
- protected void saveAlignmentMenu_actionPerformed(ActionEvent e) {\r
- }\r
+ protected void saveAlignmentMenu_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
\r
- protected void padGapsMenuitem_actionPerformed(ActionEvent e) {\r
- }\r
+ protected void padGapsMenuitem_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
\r
- protected void ClustalRealign_actionPerformed(ActionEvent e) {\r
- }\r
+ protected void ClustalRealign_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
}\r
-/*
-* Jalview - A Sequence Alignment Editor and Viewer
-* Copyright (C) 2005 AM Waterhouse, J Procter, 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 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.
-*
-* 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
-*/\r
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
+ */\r
package jalview.jbgui;\r
\r
import java.awt.*;\r
-\r
import javax.swing.*;\r
import javax.swing.border.*;\r
+import java.awt.event.MouseWheelListener;\r
+import java.awt.event.MouseWheelEvent;\r
\r
+public class GAlignmentPanel\r
+ extends JPanel\r
+{\r
+ protected JPanel sequenceHolderPanel = new JPanel();\r
+ protected JScrollBar vscroll = new JScrollBar();\r
+ protected JScrollBar hscroll = new JScrollBar();\r
+ protected JPanel seqPanelHolder = new JPanel();\r
+ BorderLayout borderLayout1 = new BorderLayout();\r
+ BorderLayout borderLayout3 = new BorderLayout();\r
+ protected JPanel scalePanelHolder = new JPanel();\r
+ protected JPanel idPanelHolder = new JPanel();\r
+ BorderLayout borderLayout5 = new BorderLayout();\r
+ protected JPanel idSpaceFillerPanel1 = new JPanel();\r
+ public JPanel annotationSpaceFillerHolder = new JPanel();\r
+ BorderLayout borderLayout6 = new BorderLayout();\r
+ ButtonGroup buttonGroup1 = new ButtonGroup();\r
+ BorderLayout borderLayout7 = new BorderLayout();\r
+ JPanel hscrollHolder = new JPanel();\r
+ BorderLayout borderLayout10 = new BorderLayout();\r
+ protected JPanel hscrollFillerPanel = new JPanel();\r
+ BorderLayout borderLayout11 = new BorderLayout();\r
+ public JScrollPane annotationScroller = new JScrollPane();\r
+ Border border1;\r
+ BorderLayout borderLayout4 = new BorderLayout();\r
\r
-public class GAlignmentPanel extends JPanel {\r
- protected JPanel sequenceHolderPanel = new JPanel();\r
- protected JScrollBar vscroll = new JScrollBar();\r
- protected JScrollBar hscroll = new JScrollBar();\r
- protected JPanel seqPanelHolder = new JPanel();\r
- BorderLayout borderLayout1 = new BorderLayout();\r
- BorderLayout borderLayout3 = new BorderLayout();\r
- protected JPanel scalePanelHolder = new JPanel();\r
- protected JPanel idPanelHolder = new JPanel();\r
- BorderLayout borderLayout5 = new BorderLayout();\r
- protected JPanel idSpaceFillerPanel1 = new JPanel();\r
- public JPanel annotationSpaceFillerHolder = new JPanel();\r
- BorderLayout borderLayout6 = new BorderLayout();\r
- ButtonGroup buttonGroup1 = new ButtonGroup();\r
- BorderLayout borderLayout7 = new BorderLayout();\r
- JPanel hscrollHolder = new JPanel();\r
- BorderLayout borderLayout10 = new BorderLayout();\r
- protected JPanel hscrollFillerPanel = new JPanel();\r
- BorderLayout borderLayout11 = new BorderLayout();\r
- public JScrollPane annotationScroller = new JScrollPane();\r
- Border border1;\r
- BorderLayout borderLayout4 = new BorderLayout();\r
-\r
- public GAlignmentPanel() {\r
- try {\r
- jbInit();\r
- } catch (Exception e) {\r
- e.printStackTrace();\r
- }\r
+ public GAlignmentPanel()\r
+ {\r
+ try\r
+ {\r
+ jbInit();\r
+ }\r
+ catch (Exception e)\r
+ {\r
+ e.printStackTrace();\r
}\r
+ }\r
\r
- private void jbInit() throws Exception {\r
- border1 = BorderFactory.createLineBorder(Color.gray, 1);\r
- idPanelHolder.setBorder(null);\r
- idPanelHolder.setPreferredSize(new Dimension(70, 10));\r
- this.setLayout(borderLayout7);\r
- sequenceHolderPanel.setMaximumSize(new Dimension(2147483647, 2147483647));\r
- sequenceHolderPanel.setMinimumSize(new Dimension(150, 150));\r
- sequenceHolderPanel.setPreferredSize(new Dimension(150, 150));\r
- sequenceHolderPanel.setLayout(borderLayout3);\r
- seqPanelHolder.setLayout(borderLayout1);\r
- scalePanelHolder.setBackground(Color.white);\r
- scalePanelHolder.setMinimumSize(new Dimension(10, 80));\r
- scalePanelHolder.setPreferredSize(new Dimension(10, 30));\r
- scalePanelHolder.setLayout(borderLayout6);\r
- idPanelHolder.setLayout(borderLayout5);\r
- idSpaceFillerPanel1.setBackground(Color.white);\r
- idSpaceFillerPanel1.setPreferredSize(new Dimension(10, 30));\r
- idSpaceFillerPanel1.setLayout(borderLayout11);\r
- annotationSpaceFillerHolder.setBackground(Color.white);\r
- annotationSpaceFillerHolder.setPreferredSize(new Dimension(10, 80));\r
- annotationSpaceFillerHolder.setLayout(borderLayout4);\r
- hscroll.setOrientation(JScrollBar.HORIZONTAL);\r
- hscrollHolder.setLayout(borderLayout10);\r
- hscrollFillerPanel.setBackground(Color.white);\r
- hscrollFillerPanel.setPreferredSize(new Dimension(70, 10));\r
- hscrollHolder.setBackground(Color.white);\r
- annotationScroller.setBorder(null);\r
- annotationScroller.setPreferredSize(new Dimension(10, 80));\r
- this.setPreferredSize(new Dimension(220, 166));\r
- this.setRequestFocusEnabled(true);\r
- sequenceHolderPanel.add(scalePanelHolder, BorderLayout.NORTH);\r
- sequenceHolderPanel.add(seqPanelHolder, BorderLayout.CENTER);\r
- seqPanelHolder.add(vscroll, BorderLayout.EAST);\r
- sequenceHolderPanel.add(annotationScroller, BorderLayout.SOUTH);\r
+ private void jbInit()\r
+ throws Exception\r
+ {\r
+ border1 = BorderFactory.createLineBorder(Color.gray, 1);\r
+ idPanelHolder.setBorder(null);\r
+ idPanelHolder.setPreferredSize(new Dimension(70, 10));\r
+ this.setLayout(borderLayout7);\r
+ sequenceHolderPanel.setMaximumSize(new Dimension(2147483647, 2147483647));\r
+ sequenceHolderPanel.setMinimumSize(new Dimension(150, 150));\r
+ sequenceHolderPanel.setPreferredSize(new Dimension(150, 150));\r
+ sequenceHolderPanel.setLayout(borderLayout3);\r
+ seqPanelHolder.setLayout(borderLayout1);\r
+ scalePanelHolder.setBackground(Color.white);\r
+ scalePanelHolder.setMinimumSize(new Dimension(10, 80));\r
+ scalePanelHolder.setPreferredSize(new Dimension(10, 30));\r
+ scalePanelHolder.setLayout(borderLayout6);\r
+ idPanelHolder.setLayout(borderLayout5);\r
+ idSpaceFillerPanel1.setBackground(Color.white);\r
+ idSpaceFillerPanel1.setPreferredSize(new Dimension(10, 30));\r
+ idSpaceFillerPanel1.setLayout(borderLayout11);\r
+ annotationSpaceFillerHolder.setBackground(Color.white);\r
+ annotationSpaceFillerHolder.setPreferredSize(new Dimension(10, 80));\r
+ annotationSpaceFillerHolder.setLayout(borderLayout4);\r
+ hscroll.setOrientation(JScrollBar.HORIZONTAL);\r
+ hscrollHolder.setLayout(borderLayout10);\r
+ hscrollFillerPanel.setBackground(Color.white);\r
+ hscrollFillerPanel.setPreferredSize(new Dimension(70, 10));\r
+ hscrollHolder.setBackground(Color.white);\r
+ annotationScroller.setBorder(null);\r
+ annotationScroller.setPreferredSize(new Dimension(10, 80));\r
+ this.setPreferredSize(new Dimension(220, 166));\r
+ this.setRequestFocusEnabled(true);\r
+ this.addMouseWheelListener(new MouseWheelListener()\r
+ {\r
+ public void mouseWheelMoved(MouseWheelEvent e)\r
+ {\r
+ this_mouseWheelMoved(e);\r
+ }\r
+ });\r
+ sequenceHolderPanel.add(scalePanelHolder, BorderLayout.NORTH);\r
+ sequenceHolderPanel.add(seqPanelHolder, BorderLayout.CENTER);\r
+ seqPanelHolder.add(vscroll, BorderLayout.EAST);\r
+ sequenceHolderPanel.add(annotationScroller, BorderLayout.SOUTH);\r
\r
- // jPanel3.add(secondaryPanelHolder, BorderLayout.SOUTH);\r
- this.add(idPanelHolder, BorderLayout.WEST);\r
- idPanelHolder.add(idSpaceFillerPanel1, BorderLayout.NORTH);\r
- idPanelHolder.add(annotationSpaceFillerHolder, BorderLayout.SOUTH);\r
- this.add(hscrollHolder, BorderLayout.SOUTH);\r
- hscrollHolder.add(hscroll, BorderLayout.CENTER);\r
- hscrollHolder.add(hscrollFillerPanel, BorderLayout.WEST);\r
- this.add(sequenceHolderPanel, BorderLayout.CENTER);\r
- }\r
+ // jPanel3.add(secondaryPanelHolder, BorderLayout.SOUTH);\r
+ this.add(idPanelHolder, BorderLayout.WEST);\r
+ idPanelHolder.add(idSpaceFillerPanel1, BorderLayout.NORTH);\r
+ idPanelHolder.add(annotationSpaceFillerHolder, BorderLayout.SOUTH);\r
+ this.add(hscrollHolder, BorderLayout.SOUTH);\r
+ hscrollHolder.add(hscroll, BorderLayout.CENTER);\r
+ hscrollHolder.add(hscrollFillerPanel, BorderLayout.WEST);\r
+ this.add(sequenceHolderPanel, BorderLayout.CENTER);\r
+ }\r
+\r
+ public void this_mouseWheelMoved(MouseWheelEvent e)\r
+ {\r
+\r
+ }\r
}\r
import javax.swing.*;\r
\r
\r
-public class GCutAndPasteTransfer extends JInternalFrame {\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class GCutAndPasteTransfer extends JInternalFrame\r
+{\r
protected JTextArea textarea = new JTextArea();\r
protected JScrollPane scrollPane = new JScrollPane();\r
BorderLayout borderLayout1 = new BorderLayout();\r
JButton ok = new JButton();\r
JButton cancel = new JButton();\r
\r
- public GCutAndPasteTransfer() {\r
- try {\r
+ /**\r
+ * Creates a new GCutAndPasteTransfer object.\r
+ */\r
+ public GCutAndPasteTransfer()\r
+ {\r
+ try\r
+ {\r
setJMenuBar(editMenubar);\r
jbInit();\r
- } catch (Exception e) {\r
+ }\r
+ catch (Exception e)\r
+ {\r
e.printStackTrace();\r
}\r
}\r
\r
- private void jbInit() throws Exception {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @throws Exception DOCUMENT ME!\r
+ */\r
+ private void jbInit() throws Exception\r
+ {\r
scrollPane.setBorder(null);\r
ok.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
ok.setText("Accept");\r
- ok.addActionListener(new ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
+ ok.addActionListener(new ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
ok_actionPerformed(e);\r
}\r
});\r
cancel.setText("Cancel");\r
- cancel.addActionListener(new ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
+ cancel.addActionListener(new ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
cancel_actionPerformed(e);\r
}\r
});\r
textarea.setBorder(null);\r
- textarea.addVetoableChangeListener(new VetoableChangeListener() {\r
- public void vetoableChange(PropertyChangeEvent evt) {\r
- try {\r
+ textarea.addVetoableChangeListener(new VetoableChangeListener()\r
+ {\r
+ public void vetoableChange(PropertyChangeEvent evt)\r
+ {\r
+ try\r
+ {\r
textarea_vetoableChange(evt);\r
- } catch (java.beans.PropertyVetoException exception0) {\r
+ }\r
+ catch (java.beans.PropertyVetoException exception0)\r
+ {\r
exception0.printStackTrace();\r
}\r
}\r
});\r
editMenubar.add(editMenu);\r
textarea.setFont(new java.awt.Font("Monospaced", Font.PLAIN, 12));\r
- textarea.addMouseListener(new java.awt.event.MouseAdapter() {\r
- public void mousePressed(MouseEvent e) {\r
+ textarea.addMouseListener(new java.awt.event.MouseAdapter()\r
+ {\r
+ public void mousePressed(MouseEvent e)\r
+ {\r
textarea_mousePressed(e);\r
}\r
});\r
editMenu.setText("Edit");\r
pasteMenu.setText("Paste");\r
- pasteMenu.addActionListener(new ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
+ pasteMenu.addActionListener(new ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
pasteMenu_actionPerformed(e);\r
}\r
});\r
copyItem.setText("Copy");\r
- copyItem.addActionListener(new ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
+ copyItem.addActionListener(new ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
copyItem_actionPerformed(e);\r
}\r
});\r
inputButtonPanel.add(cancel);\r
}\r
\r
- void textarea_mousePressed(MouseEvent e) {\r
- if (textarea.getText().equals("Paste your alignment file here")) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ void textarea_mousePressed(MouseEvent e)\r
+ {\r
+ if (textarea.getText().equals("Paste your alignment file here"))\r
+ {\r
textarea.setText("");\r
}\r
}\r
\r
- public void copyItem_actionPerformed(ActionEvent e) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void copyItem_actionPerformed(ActionEvent e)\r
+ {\r
}\r
\r
- public void pasteMenu_actionPerformed(ActionEvent e) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void pasteMenu_actionPerformed(ActionEvent e)\r
+ {\r
}\r
\r
- public void ok_actionPerformed(ActionEvent e) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void ok_actionPerformed(ActionEvent e)\r
+ {\r
}\r
\r
- public void cancel_actionPerformed(ActionEvent e) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void cancel_actionPerformed(ActionEvent e)\r
+ {\r
}\r
\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param evt DOCUMENT ME!\r
+ *\r
+ * @throws PropertyVetoException DOCUMENT ME!\r
+ */\r
public void textarea_vetoableChange(PropertyChangeEvent evt)\r
- throws PropertyVetoException {\r
+ throws PropertyVetoException\r
+ {\r
}\r
}\r
import javax.swing.*;\r
\r
\r
-public class GDesktop extends JFrame {\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class GDesktop extends JFrame\r
+{\r
protected static JMenu windowMenu = new JMenu();\r
JMenuBar DesktopMenubar = new JMenuBar();\r
JMenu FileMenu = new JMenu();\r
JMenuItem loadState = new JMenuItem();\r
JMenu jMenu1 = new JMenu();\r
\r
- public GDesktop() {\r
- try {\r
+ /**\r
+ * Creates a new GDesktop object.\r
+ */\r
+ public GDesktop()\r
+ {\r
+ try\r
+ {\r
jbInit();\r
this.setJMenuBar(DesktopMenubar);\r
- } catch (Exception e) {\r
+ }\r
+ catch (Exception e)\r
+ {\r
e.printStackTrace();\r
}\r
}\r
\r
- private void jbInit() throws Exception {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @throws Exception DOCUMENT ME!\r
+ */\r
+ private void jbInit() throws Exception\r
+ {\r
FileMenu.setMnemonic('F');\r
FileMenu.setText("File");\r
HelpMenu.setText("Help");\r
inputLocalFileMenuItem.setMnemonic('L');\r
inputLocalFileMenuItem.setText("from File");\r
- inputLocalFileMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
+ inputLocalFileMenuItem.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
inputLocalFileMenuItem_actionPerformed(e);\r
}\r
});\r
inputURLMenuItem.setMnemonic('U');\r
inputURLMenuItem.setText("from URL");\r
- inputURLMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
+ inputURLMenuItem.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
inputURLMenuItem_actionPerformed(e);\r
}\r
});\r
inputTextboxMenuItem.setMnemonic('C');\r
inputTextboxMenuItem.setText("from Textbox");\r
- inputTextboxMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
+ inputTextboxMenuItem.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
inputTextboxMenuItem_actionPerformed(e);\r
}\r
});\r
quit.setMnemonic('Q');\r
quit.setText("Quit");\r
- quit.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
+ quit.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
quit();\r
}\r
});\r
aboutMenuItem.setText("About");\r
- aboutMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
+ aboutMenuItem.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
aboutMenuItem_actionPerformed(e);\r
}\r
});\r
documentationMenuItem.setText("Documentation");\r
- documentationMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
+ documentationMenuItem.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
documentationMenuItem_actionPerformed(e);\r
}\r
});\r
this.getContentPane().setLayout(flowLayout1);\r
windowMenu.setText("Window");\r
preferences.setText("Preferences...");\r
- preferences.addActionListener(new ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
+ preferences.addActionListener(new ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
preferences_actionPerformed(e);\r
}\r
});\r
toolsMenu.setText("Tools");\r
saveState.setMnemonic('S');\r
saveState.setText("Save Project");\r
- saveState.addActionListener(new ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
+ saveState.addActionListener(new ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
saveState_actionPerformed(e);\r
}\r
});\r
loadState.setMnemonic('L');\r
loadState.setText("Load Project");\r
- loadState.addActionListener(new ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
+ loadState.addActionListener(new ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
loadState_actionPerformed(e);\r
}\r
});\r
jMenu1.add(inputTextboxMenuItem);\r
}\r
\r
- protected void inputLocalFileMenuItem_actionPerformed(ActionEvent e) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void inputLocalFileMenuItem_actionPerformed(ActionEvent e)\r
+ {\r
}\r
\r
- protected void inputURLMenuItem_actionPerformed(ActionEvent e) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void inputURLMenuItem_actionPerformed(ActionEvent e)\r
+ {\r
}\r
\r
- protected void inputTextboxMenuItem_actionPerformed(ActionEvent e) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void inputTextboxMenuItem_actionPerformed(ActionEvent e)\r
+ {\r
}\r
\r
- protected void quit() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ protected void quit()\r
+ {\r
}\r
\r
- protected void aboutMenuItem_actionPerformed(ActionEvent e) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void aboutMenuItem_actionPerformed(ActionEvent e)\r
+ {\r
}\r
\r
- protected void documentationMenuItem_actionPerformed(ActionEvent e) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void documentationMenuItem_actionPerformed(ActionEvent e)\r
+ {\r
}\r
\r
- public void SaveState_actionPerformed(ActionEvent e) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void SaveState_actionPerformed(ActionEvent e)\r
+ {\r
}\r
\r
- protected void preferences_actionPerformed(ActionEvent e) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void preferences_actionPerformed(ActionEvent e)\r
+ {\r
}\r
\r
- public void saveState_actionPerformed(ActionEvent e) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void saveState_actionPerformed(ActionEvent e)\r
+ {\r
}\r
\r
- public void loadState_actionPerformed(ActionEvent e) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void loadState_actionPerformed(ActionEvent e)\r
+ {\r
}\r
\r
- public void loadJalviewAlign_actionPerformed(ActionEvent e) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void loadJalviewAlign_actionPerformed(ActionEvent e)\r
+ {\r
}\r
}\r
/*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
-*\r
-* This program is free software; you can redistribute it and/or\r
-* modify it under the terms of the GNU General Public License\r
-* as published by the Free Software Foundation; either version 2\r
-* of the License, or (at your option) any later version.\r
-*\r
-* This program is distributed in the hope that it will be useful,\r
-* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-* GNU General Public License for more details.\r
-*\r
-* You should have received a copy of the GNU General Public License\r
-* along with this program; if not, write to the Free Software\r
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
-*/\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
+ */\r
package jalview.jbgui;\r
\r
import java.awt.*;\r
import java.awt.event.*;\r
-\r
import javax.swing.*;\r
-import javax.swing.event.CaretListener;\r
-import javax.swing.event.CaretEvent;\r
+import javax.swing.event.*;\r
\r
-public class GFinder extends JPanel {\r
- JLabel jLabel1 = new JLabel();\r
+public class GFinder\r
+ extends JPanel\r
+{\r
+ JLabel jLabel1 = new JLabel();\r
protected JButton findAll = new JButton();\r
- protected JButton findNext = new JButton();\r
- JPanel jPanel1 = new JPanel();\r
- GridLayout gridLayout1 = new GridLayout();\r
- protected JButton createNewGroup = new JButton();\r
+ protected JButton findNext = new JButton();\r
+ JPanel jPanel1 = new JPanel();\r
+ GridLayout gridLayout1 = new GridLayout();\r
+ protected JButton createNewGroup = new JButton();\r
JScrollPane jScrollPane1 = new JScrollPane();\r
protected JTextArea textfield = new JTextArea();\r
BorderLayout borderLayout1 = new BorderLayout();\r
BorderLayout borderLayout2 = new BorderLayout();\r
JPanel jPanel5 = new JPanel();\r
JPanel jPanel6 = new JPanel();\r
- public GFinder() {\r
- try {\r
- jbInit();\r
- } catch (Exception e) {\r
- e.printStackTrace();\r
- }\r
+ public GFinder()\r
+ {\r
+ try\r
+ {\r
+ jbInit();\r
}\r
+ catch (Exception e)\r
+ {\r
+ e.printStackTrace();\r
+ }\r
+ }\r
\r
- private void jbInit() throws Exception {\r
- jLabel1.setFont(new java.awt.Font("Verdana", 0, 12));\r
- jLabel1.setText("Find");\r
+ private void jbInit()\r
+ throws Exception\r
+ {\r
+ jLabel1.setFont(new java.awt.Font("Verdana", 0, 12));\r
+ jLabel1.setText("Find");\r
this.setLayout(borderLayout1);\r
findAll.setFont(new java.awt.Font("Verdana", 0, 12));\r
- findAll.setText("Find all");\r
- findAll.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- findAll_actionPerformed(e);\r
- }\r
- });\r
- findNext.setEnabled(false);\r
- findNext.setFont(new java.awt.Font("Verdana", 0, 12));\r
- findNext.setText("Find Next");\r
- findNext.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- findNext_actionPerformed(e);\r
- }\r
- });\r
+ findAll.setText("Find all");\r
+ findAll.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ findAll_actionPerformed(e);\r
+ }\r
+ });\r
+ findNext.setEnabled(false);\r
+ findNext.setFont(new java.awt.Font("Verdana", 0, 12));\r
+ findNext.setText("Find Next");\r
+ findNext.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ findNext_actionPerformed(e);\r
+ }\r
+ });\r
jPanel1.setLayout(gridLayout1);\r
- gridLayout1.setHgap(0);\r
- gridLayout1.setRows(3);\r
- gridLayout1.setVgap(2);\r
- createNewGroup.setEnabled(false);\r
- createNewGroup.setFont(new java.awt.Font("Verdana", 0, 12));\r
- createNewGroup.setToolTipText("");\r
- createNewGroup.setMargin(new Insets(0, 0, 0, 0));\r
- createNewGroup.setText("Create new group");\r
- createNewGroup.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- createNewGroup_actionPerformed(e);\r
- }\r
- });\r
+ gridLayout1.setHgap(0);\r
+ gridLayout1.setRows(3);\r
+ gridLayout1.setVgap(2);\r
+ createNewGroup.setEnabled(false);\r
+ createNewGroup.setFont(new java.awt.Font("Verdana", 0, 12));\r
+ createNewGroup.setToolTipText("");\r
+ createNewGroup.setMargin(new Insets(0, 0, 0, 0));\r
+ createNewGroup.setText("Create new group");\r
+ createNewGroup.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ createNewGroup_actionPerformed(e);\r
+ }\r
+ });\r
textfield.setFont(new java.awt.Font("Verdana", Font.PLAIN, 12));\r
textfield.setText("");\r
textfield.setLineWrap(true);\r
jPanel2.setPreferredSize(new Dimension(10, 1));\r
jPanel3.setPreferredSize(new Dimension(10, 1));\r
jPanel1.add(findNext, null);\r
- jPanel1.add(findAll, null);\r
- jPanel1.add(createNewGroup, null);\r
+ jPanel1.add(findAll, null);\r
+ jPanel1.add(createNewGroup, null);\r
this.add(jLabel1, java.awt.BorderLayout.WEST);\r
this.add(jPanel1, java.awt.BorderLayout.EAST);\r
this.add(jPanel2, java.awt.BorderLayout.SOUTH);\r
jScrollPane1.getViewport().add(textfield);\r
}\r
\r
- protected void findNext_actionPerformed(ActionEvent e) {\r
- }\r
+ protected void findNext_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
\r
- protected void findAll_actionPerformed(ActionEvent e) {\r
- }\r
+ protected void findAll_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
\r
- protected void textfield_actionPerformed(ActionEvent e) {\r
- }\r
+ protected void textfield_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
\r
- void textfield_keyTyped(KeyEvent e) {\r
- findNext.setEnabled(true);\r
- }\r
+ void textfield_keyTyped(KeyEvent e)\r
+ {\r
+ findNext.setEnabled(true);\r
+ }\r
\r
- public void createNewGroup_actionPerformed(ActionEvent e) {\r
- }\r
+ public void createNewGroup_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
\r
public void textfield_caretUpdate(CaretEvent e)\r
{\r
- if (textfield.getText().indexOf("\t")>-1)\r
+ if (textfield.getText().indexOf("\t") > -1)\r
{\r
SwingUtilities.invokeLater(new Runnable()\r
{\r
public void run()\r
{\r
- String text = textfield.getText();\r
- text = text.substring(text.lastIndexOf("\t") + 1).trim();\r
- text = jalview.analysis.AlignSeq.extractGaps(\r
- jalview.util.Comparison.GapChars, text);\r
- textfield.setText(text);\r
+ String text = textfield.getText();\r
+ text = text.substring(text.lastIndexOf("\t") + 1).trim();\r
+ text = jalview.analysis.AlignSeq.extractGaps(\r
+ jalview.util.Comparison.GapChars, text);\r
+ textfield.setText(text);\r
}\r
});\r
}\r
import javax.swing.*;\r
\r
\r
-public class GFontChooser extends JPanel {\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class GFontChooser extends JPanel\r
+{\r
JLabel jLabel1 = new JLabel();\r
protected JComboBox fontSize = new JComboBox();\r
protected JComboBox fontStyle = new JComboBox();\r
FlowLayout flowLayout1 = new FlowLayout();\r
JButton defaultButton = new JButton();\r
\r
- public GFontChooser() {\r
- try {\r
+ /**\r
+ * Creates a new GFontChooser object.\r
+ */\r
+ public GFontChooser()\r
+ {\r
+ try\r
+ {\r
jbInit();\r
- } catch (Exception e) {\r
+ }\r
+ catch (Exception e)\r
+ {\r
e.printStackTrace();\r
}\r
}\r
\r
- private void jbInit() throws Exception {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @throws Exception DOCUMENT ME!\r
+ */\r
+ private void jbInit() throws Exception\r
+ {\r
jLabel1.setFont(new java.awt.Font("Verdana", 0, 11));\r
jLabel1.setHorizontalAlignment(SwingConstants.RIGHT);\r
jLabel1.setText("Font: ");\r
fontSize.setFont(new java.awt.Font("Verdana", 0, 11));\r
fontSize.setOpaque(false);\r
fontSize.setPreferredSize(new Dimension(50, 21));\r
- fontSize.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
+ fontSize.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
fontSize_actionPerformed(e);\r
}\r
});\r
fontStyle.setFont(new java.awt.Font("Verdana", 0, 11));\r
fontStyle.setOpaque(false);\r
fontStyle.setPreferredSize(new Dimension(90, 21));\r
- fontStyle.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
+ fontStyle.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
fontStyle_actionPerformed(e);\r
}\r
});\r
fontName.setMinimumSize(new Dimension(300, 21));\r
fontName.setOpaque(false);\r
fontName.setPreferredSize(new Dimension(180, 21));\r
- fontName.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
+ fontName.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
fontName_actionPerformed(e);\r
}\r
});\r
ok.setFont(new java.awt.Font("Verdana", 0, 11));\r
ok.setText("OK");\r
- ok.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
+ ok.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
ok_actionPerformed(e);\r
}\r
});\r
cancel.setFont(new java.awt.Font("Verdana", 0, 11));\r
cancel.setText("Cancel");\r
- cancel.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
+ cancel.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
cancel_actionPerformed(e);\r
}\r
});\r
flowLayout1.setAlignment(FlowLayout.CENTER);\r
flowLayout1.setVgap(5);\r
defaultButton.setText("Set as Default");\r
- defaultButton.addActionListener(new ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
+ defaultButton.addActionListener(new ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
defaultButton_actionPerformed(e);\r
}\r
});\r
this.add(defaultButton);\r
}\r
\r
- protected void ok_actionPerformed(ActionEvent e) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void ok_actionPerformed(ActionEvent e)\r
+ {\r
}\r
\r
- protected void cancel_actionPerformed(ActionEvent e) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void cancel_actionPerformed(ActionEvent e)\r
+ {\r
}\r
\r
- protected void fontName_actionPerformed(ActionEvent e) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void fontName_actionPerformed(ActionEvent e)\r
+ {\r
}\r
\r
- protected void fontSize_actionPerformed(ActionEvent e) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void fontSize_actionPerformed(ActionEvent e)\r
+ {\r
}\r
\r
- protected void fontStyle_actionPerformed(ActionEvent e) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void fontStyle_actionPerformed(ActionEvent e)\r
+ {\r
}\r
\r
- public void defaultButton_actionPerformed(ActionEvent e) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void defaultButton_actionPerformed(ActionEvent e)\r
+ {\r
}\r
}\r
-/*
-* Jalview - A Sequence Alignment Editor and Viewer
-* Copyright (C) 2005 AM Waterhouse, J Procter, 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 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.
-*
-* 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
-*/\r
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
+ */\r
package jalview.jbgui;\r
\r
import java.awt.*;\r
import java.awt.event.*;\r
-\r
import javax.swing.*;\r
\r
+public class GPCAPanel\r
+ extends JPanel\r
+{\r
+ JPanel jPanel2 = new JPanel();\r
+ JLabel jLabel1 = new JLabel();\r
+ JLabel jLabel2 = new JLabel();\r
+ JLabel jLabel3 = new JLabel();\r
+ protected JComboBox xCombobox = new JComboBox();\r
+ protected JComboBox yCombobox = new JComboBox();\r
+ protected JComboBox zCombobox = new JComboBox();\r
+ FlowLayout flowLayout1 = new FlowLayout();\r
+ BorderLayout borderLayout1 = new BorderLayout();\r
\r
-public class GPCAPanel extends JPanel {\r
- JPanel jPanel2 = new JPanel();\r
- JLabel jLabel1 = new JLabel();\r
- JLabel jLabel2 = new JLabel();\r
- JLabel jLabel3 = new JLabel();\r
- protected JComboBox xCombobox = new JComboBox();\r
- protected JComboBox yCombobox = new JComboBox();\r
- protected JComboBox zCombobox = new JComboBox();\r
- FlowLayout flowLayout1 = new FlowLayout();\r
- BorderLayout borderLayout1 = new BorderLayout();\r
-\r
- public GPCAPanel() {\r
- try {\r
- jbInit();\r
- } catch (Exception e) {\r
- e.printStackTrace();\r
- }\r
-\r
- for (int i = 1; i < 8; i++) {\r
- xCombobox.addItem("dim " + i);\r
- yCombobox.addItem("dim " + i);\r
- zCombobox.addItem("dim " + i);\r
- }\r
+ public GPCAPanel()\r
+ {\r
+ try\r
+ {\r
+ jbInit();\r
}\r
-\r
- private void jbInit() throws Exception {\r
- this.setLayout(borderLayout1);\r
- jPanel2.setLayout(flowLayout1);\r
- jLabel1.setFont(new java.awt.Font("Verdana", 0, 12));\r
- jLabel1.setText("x=");\r
- jLabel2.setFont(new java.awt.Font("Verdana", 0, 12));\r
- jLabel2.setText("y=");\r
- jLabel3.setFont(new java.awt.Font("Verdana", 0, 12));\r
- jLabel3.setText("z=");\r
- jPanel2.setBackground(Color.white);\r
- jPanel2.setBorder(null);\r
- zCombobox.setFont(new java.awt.Font("Verdana", 0, 12));\r
- zCombobox.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- zCombobox_actionPerformed(e);\r
- }\r
- });\r
- yCombobox.setFont(new java.awt.Font("Verdana", 0, 12));\r
- yCombobox.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- yCombobox_actionPerformed(e);\r
- }\r
- });\r
- xCombobox.setFont(new java.awt.Font("Verdana", 0, 12));\r
- xCombobox.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- xCombobox_actionPerformed(e);\r
- }\r
- });\r
- this.add(jPanel2, BorderLayout.SOUTH);\r
- jPanel2.add(jLabel1, null);\r
- jPanel2.add(xCombobox, null);\r
- jPanel2.add(jLabel2, null);\r
- jPanel2.add(yCombobox, null);\r
- jPanel2.add(jLabel3, null);\r
- jPanel2.add(zCombobox, null);\r
+ catch (Exception e)\r
+ {\r
+ e.printStackTrace();\r
}\r
\r
- protected void xCombobox_actionPerformed(ActionEvent e) {\r
+ for (int i = 1; i < 8; i++)\r
+ {\r
+ xCombobox.addItem("dim " + i);\r
+ yCombobox.addItem("dim " + i);\r
+ zCombobox.addItem("dim " + i);\r
}\r
+ }\r
\r
- protected void yCombobox_actionPerformed(ActionEvent e) {\r
- }\r
+ private void jbInit()\r
+ throws Exception\r
+ {\r
+ this.setLayout(borderLayout1);\r
+ jPanel2.setLayout(flowLayout1);\r
+ jLabel1.setFont(new java.awt.Font("Verdana", 0, 12));\r
+ jLabel1.setText("x=");\r
+ jLabel2.setFont(new java.awt.Font("Verdana", 0, 12));\r
+ jLabel2.setText("y=");\r
+ jLabel3.setFont(new java.awt.Font("Verdana", 0, 12));\r
+ jLabel3.setText("z=");\r
+ jPanel2.setBackground(Color.white);\r
+ jPanel2.setBorder(null);\r
+ zCombobox.setFont(new java.awt.Font("Verdana", 0, 12));\r
+ zCombobox.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ zCombobox_actionPerformed(e);\r
+ }\r
+ });\r
+ yCombobox.setFont(new java.awt.Font("Verdana", 0, 12));\r
+ yCombobox.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ yCombobox_actionPerformed(e);\r
+ }\r
+ });\r
+ xCombobox.setFont(new java.awt.Font("Verdana", 0, 12));\r
+ xCombobox.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ xCombobox_actionPerformed(e);\r
+ }\r
+ });\r
+ this.add(jPanel2, BorderLayout.SOUTH);\r
+ jPanel2.add(jLabel1, null);\r
+ jPanel2.add(xCombobox, null);\r
+ jPanel2.add(jLabel2, null);\r
+ jPanel2.add(yCombobox, null);\r
+ jPanel2.add(jLabel3, null);\r
+ jPanel2.add(zCombobox, null);\r
+ }\r
\r
- protected void zCombobox_actionPerformed(ActionEvent e) {\r
- }\r
+ protected void xCombobox_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
+\r
+ protected void yCombobox_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
+\r
+ protected void zCombobox_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
}\r
import javax.swing.*;\r
\r
\r
-public class GPairwiseAlignPanel extends JPanel {\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class GPairwiseAlignPanel extends JPanel\r
+{\r
protected JScrollPane scrollPane = new JScrollPane();\r
protected JTextArea textarea = new JTextArea();\r
protected JButton viewInEditorButton = new JButton();\r
JPanel jPanel1 = new JPanel();\r
BorderLayout borderLayout1 = new BorderLayout();\r
\r
- public GPairwiseAlignPanel() {\r
- try {\r
+ /**\r
+ * Creates a new GPairwiseAlignPanel object.\r
+ */\r
+ public GPairwiseAlignPanel()\r
+ {\r
+ try\r
+ {\r
jbInit();\r
- } catch (Exception e) {\r
+ }\r
+ catch (Exception e)\r
+ {\r
e.printStackTrace();\r
}\r
}\r
\r
- private void jbInit() throws Exception {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @throws Exception DOCUMENT ME!\r
+ */\r
+ private void jbInit() throws Exception\r
+ {\r
this.setLayout(borderLayout1);\r
textarea.setFont(new java.awt.Font("Monospaced", 0, 12));\r
textarea.setText("");\r
textarea.setWrapStyleWord(false);\r
viewInEditorButton.setFont(new java.awt.Font("Verdana", 0, 12));\r
viewInEditorButton.setText("View in alignment editor");\r
- viewInEditorButton.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
+ viewInEditorButton.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
viewInEditorButton_actionPerformed(e);\r
}\r
});\r
jPanel1.add(viewInEditorButton, null);\r
}\r
\r
- protected void viewInEditorButton_actionPerformed(ActionEvent e) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void viewInEditorButton_actionPerformed(ActionEvent e)\r
+ {\r
}\r
}\r
import javax.swing.border.TitledBorder;\r
\r
\r
-public class GPreferences extends JPanel {\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class GPreferences extends JPanel\r
+{\r
JTabbedPane visaulTab = new JTabbedPane();\r
JPanel visual = new JPanel();\r
JButton ok = new JButton();\r
protected JCheckBox startupCheckbox = new JCheckBox();\r
protected JTextField startupFileTextfield = new JTextField();\r
\r
- public GPreferences() {\r
- try {\r
+ /**\r
+ * Creates a new GPreferences object.\r
+ */\r
+ public GPreferences()\r
+ {\r
+ try\r
+ {\r
jbInit();\r
- } catch (Exception ex) {\r
+ }\r
+ catch (Exception ex)\r
+ {\r
ex.printStackTrace();\r
}\r
}\r
\r
- private void jbInit() throws Exception {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @throws Exception DOCUMENT ME!\r
+ */\r
+ private void jbInit() throws Exception\r
+ {\r
this.setLayout(borderLayout1);\r
ok.setText("OK");\r
- ok.addActionListener(new ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
+ ok.addActionListener(new ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
ok_actionPerformed(e);\r
}\r
});\r
cancel.setText("Cancel");\r
- cancel.addActionListener(new ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
+ cancel.addActionListener(new ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
cancel_actionPerformed(e);\r
}\r
});\r
annotations.setSelected(true);\r
annotations.setText("Show Annotations");\r
annotations.setBounds(new Rectangle(10, 53, 128, 23));\r
- annotations.addActionListener(new ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
+ annotations.addActionListener(new ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
annotations_actionPerformed(e);\r
}\r
});\r
gapSymbolCB.setBounds(new Rectangle(121, 140, 67, 21));\r
startupCheckbox.setText("Open file");\r
startupCheckbox.setBounds(new Rectangle(4, 200, 115, 23));\r
- startupCheckbox.addActionListener(new ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
+ startupCheckbox.addActionListener(new ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
jCheckBox1_actionPerformed(e);\r
}\r
});\r
startupCheckbox.setSelected(true);\r
startupFileTextfield.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
startupFileTextfield.setBounds(new Rectangle(122, 202, 309, 20));\r
- startupFileTextfield.addMouseListener(new MouseAdapter() {\r
- public void mouseClicked(MouseEvent e) {\r
- if(e.getClickCount()>1)\r
- startupFileTextfield_mouseClicked();\r
+ startupFileTextfield.addMouseListener(new MouseAdapter()\r
+ {\r
+ public void mouseClicked(MouseEvent e)\r
+ {\r
+ if (e.getClickCount() > 1)\r
+ {\r
+ startupFileTextfield_mouseClicked();\r
+ }\r
}\r
});\r
\r
gapSymbolCB.setRenderer(dlcr);\r
}\r
\r
- public void ok_actionPerformed(ActionEvent e) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void ok_actionPerformed(ActionEvent e)\r
+ {\r
}\r
\r
- public void cancel_actionPerformed(ActionEvent e) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void cancel_actionPerformed(ActionEvent e)\r
+ {\r
}\r
\r
- public void annotations_actionPerformed(ActionEvent e) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void annotations_actionPerformed(ActionEvent e)\r
+ {\r
}\r
\r
- public void jCheckBox1_actionPerformed(ActionEvent e) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void jCheckBox1_actionPerformed(ActionEvent e)\r
+ {\r
}\r
\r
- public void startupFileTextfield_mouseClicked() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ public void startupFileTextfield_mouseClicked()\r
+ {\r
}\r
}\r
import javax.swing.*;\r
\r
\r
-public class GSliderPanel extends JPanel {\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class GSliderPanel extends JPanel\r
+{\r
// this is used for conservation colours, PID colours and redundancy threshold\r
protected JSlider slider = new JSlider();\r
protected JTextField valueField = new JTextField();\r
protected JCheckBox allGroupsCheck = new JCheckBox();\r
BorderLayout borderLayout1 = new BorderLayout();\r
\r
- public GSliderPanel() {\r
- try {\r
+ /**\r
+ * Creates a new GSliderPanel object.\r
+ */\r
+ public GSliderPanel()\r
+ {\r
+ try\r
+ {\r
jbInit();\r
- } catch (Exception e) {\r
+ }\r
+ catch (Exception e)\r
+ {\r
e.printStackTrace();\r
}\r
}\r
\r
- private void jbInit() throws Exception {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @throws Exception DOCUMENT ME!\r
+ */\r
+ private void jbInit() throws Exception\r
+ {\r
this.setLayout(gridLayout1);\r
slider.setMajorTickSpacing(10);\r
slider.setMinorTickSpacing(1);\r
valueField.setPreferredSize(new Dimension(50, 12));\r
valueField.setText("");\r
valueField.setHorizontalAlignment(SwingConstants.CENTER);\r
- valueField.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
+ valueField.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
valueField_actionPerformed(e);\r
}\r
});\r
applyButton.setFont(new java.awt.Font("Verdana", 0, 11));\r
applyButton.setOpaque(false);\r
applyButton.setText("Apply");\r
- applyButton.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
+ applyButton.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
applyButton_actionPerformed(e);\r
}\r
});\r
undoButton.setFont(new java.awt.Font("Verdana", 0, 11));\r
undoButton.setOpaque(false);\r
undoButton.setText("Undo");\r
- undoButton.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
+ undoButton.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
undoButton_actionPerformed(e);\r
}\r
});\r
allGroupsCheck.setFont(new java.awt.Font("Verdana", 0, 11));\r
allGroupsCheck.setOpaque(false);\r
allGroupsCheck.setText("Apply to all Groups");\r
- allGroupsCheck.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
+ allGroupsCheck.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
allGroupsCheck_actionPerformed(e);\r
}\r
});\r
jPanel1.add(allGroupsCheck, BorderLayout.EAST);\r
}\r
\r
- protected void valueField_actionPerformed(ActionEvent e) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void valueField_actionPerformed(ActionEvent e)\r
+ {\r
}\r
\r
- protected void applyButton_actionPerformed(ActionEvent e) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void applyButton_actionPerformed(ActionEvent e)\r
+ {\r
}\r
\r
- protected void undoButton_actionPerformed(ActionEvent e) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void undoButton_actionPerformed(ActionEvent e)\r
+ {\r
}\r
\r
- protected void allGroupsCheck_actionPerformed(ActionEvent e) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void allGroupsCheck_actionPerformed(ActionEvent e)\r
+ {\r
}\r
}\r
/*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
-*\r
-* This program is free software; you can redistribute it and/or\r
-* modify it under the terms of the GNU General Public License\r
-* as published by the Free Software Foundation; either version 2\r
-* of the License, or (at your option) any later version.\r
-*\r
-* This program is distributed in the hope that it will be useful,\r
-* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-* GNU General Public License for more details.\r
-*\r
-* You should have received a copy of the GNU General Public License\r
-* along with this program; if not, write to the Free Software\r
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
-*/\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
+ */\r
package jalview.jbgui;\r
\r
import java.awt.*;\r
import java.awt.event.*;\r
-\r
import javax.swing.*;\r
\r
-\r
-public class GTreePanel extends JInternalFrame {\r
- BorderLayout borderLayout1 = new BorderLayout();\r
- public JScrollPane scrollPane = new JScrollPane();\r
- JMenuBar jMenuBar1 = new JMenuBar();\r
- JMenu jMenu1 = new JMenu();\r
- JMenuItem saveAsNewick = new JMenuItem();\r
- JMenuItem printMenu = new JMenuItem();\r
- JMenu jMenu2 = new JMenu();\r
- public JMenuItem fontSize = new JMenuItem();\r
- public JCheckBoxMenuItem bootstrapMenu = new JCheckBoxMenuItem();\r
- public JCheckBoxMenuItem distanceMenu = new JCheckBoxMenuItem();\r
- public JCheckBoxMenuItem fitToWindow = new JCheckBoxMenuItem();\r
- public JCheckBoxMenuItem placeholdersMenu = new JCheckBoxMenuItem();\r
- JMenuItem pngTree = new JMenuItem();\r
- JMenuItem epsTree = new JMenuItem();\r
- JMenu saveAsMenu = new JMenu();\r
- JMenuItem textbox = new JMenuItem();\r
-\r
- public GTreePanel() {\r
- try {\r
- jbInit();\r
- this.setJMenuBar(jMenuBar1);\r
- } catch (Exception e) {\r
- e.printStackTrace();\r
- }\r
- }\r
-\r
- private void jbInit() throws Exception {\r
- this.getContentPane().setLayout(borderLayout1);\r
- this.setBackground(Color.white);\r
- this.setFont(new java.awt.Font("Verdana", 0, 12));\r
- scrollPane.setOpaque(false);\r
- jMenu1.setText("File");\r
- saveAsNewick.setText("Newick Format");\r
- saveAsNewick.addActionListener(new ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- saveAsNewick_actionPerformed(e);\r
- }\r
- });\r
- printMenu.setText("Print");\r
- printMenu.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- printMenu_actionPerformed(e);\r
- }\r
- });\r
- jMenu2.setText("View");\r
- fontSize.setText("Font Size - 12");\r
- fontSize.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- fontSize_actionPerformed(e);\r
- }\r
- });\r
- bootstrapMenu.setText("Show Bootstrap Values");\r
- bootstrapMenu.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- bootstrapMenu_actionPerformed(e);\r
- }\r
- });\r
- distanceMenu.setText("Show Distances");\r
- distanceMenu.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- distanceMenu_actionPerformed(e);\r
- }\r
- });\r
- fitToWindow.setSelected(true);\r
- fitToWindow.setText("Fit To Window");\r
- fitToWindow.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- fitToWindow_actionPerformed(e);\r
- }\r
- });\r
- epsTree.setText("EPS");\r
- epsTree.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- epsTree_actionPerformed(e);\r
- }\r
- });\r
- pngTree.setText("PNG");\r
- pngTree.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- pngTree_actionPerformed(e);\r
- }\r
- });\r
- saveAsMenu.setText("Save as");\r
- placeholdersMenu.setToolTipText(\r
- "Marks leaves of tree not associated with a sequence");\r
- placeholdersMenu.setText("Mark Unlinked Leaves");\r
- placeholdersMenu.addActionListener(new ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- placeholdersMenu_actionPerformed(e);\r
- }\r
- });\r
- textbox.setText("Output to Textbox...");\r
- textbox.addActionListener(new ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
- textbox_actionPerformed(e);\r
- }\r
- });\r
- this.getContentPane().add(scrollPane, BorderLayout.CENTER);\r
- jMenuBar1.add(jMenu1);\r
- jMenuBar1.add(jMenu2);\r
- jMenu1.add(saveAsMenu);\r
- jMenu1.add(textbox);\r
- jMenu1.add(printMenu);\r
- jMenu2.add(fitToWindow);\r
- jMenu2.add(fontSize);\r
- jMenu2.add(distanceMenu);\r
- jMenu2.add(bootstrapMenu);\r
- jMenu2.add(placeholdersMenu);\r
- saveAsMenu.add(saveAsNewick);\r
- saveAsMenu.add(epsTree);\r
- saveAsMenu.add(pngTree);\r
- }\r
-\r
- public void printMenu_actionPerformed(ActionEvent e) {\r
- }\r
-\r
- public void fontSize_actionPerformed(ActionEvent e) {\r
- }\r
-\r
- public void distanceMenu_actionPerformed(ActionEvent e) {\r
- }\r
-\r
- public void bootstrapMenu_actionPerformed(ActionEvent e) {\r
- }\r
-\r
- public void fitToWindow_actionPerformed(ActionEvent e) {\r
- }\r
-\r
- public void pngTree_actionPerformed(ActionEvent e) {\r
- }\r
-\r
- public void epsTree_actionPerformed(ActionEvent e) {\r
- }\r
-\r
- public void saveAsNewick_actionPerformed(ActionEvent e) {\r
+public class GTreePanel\r
+ extends JInternalFrame\r
+{\r
+ BorderLayout borderLayout1 = new BorderLayout();\r
+ public JScrollPane scrollPane = new JScrollPane();\r
+ JMenuBar jMenuBar1 = new JMenuBar();\r
+ JMenu jMenu1 = new JMenu();\r
+ JMenuItem saveAsNewick = new JMenuItem();\r
+ JMenuItem printMenu = new JMenuItem();\r
+ JMenu jMenu2 = new JMenu();\r
+ public JMenuItem fontSize = new JMenuItem();\r
+ public JCheckBoxMenuItem bootstrapMenu = new JCheckBoxMenuItem();\r
+ public JCheckBoxMenuItem distanceMenu = new JCheckBoxMenuItem();\r
+ public JCheckBoxMenuItem fitToWindow = new JCheckBoxMenuItem();\r
+ public JCheckBoxMenuItem placeholdersMenu = new JCheckBoxMenuItem();\r
+ JMenuItem pngTree = new JMenuItem();\r
+ JMenuItem epsTree = new JMenuItem();\r
+ JMenu saveAsMenu = new JMenu();\r
+ JMenuItem textbox = new JMenuItem();\r
+\r
+ public GTreePanel()\r
+ {\r
+ try\r
+ {\r
+ jbInit();\r
+ this.setJMenuBar(jMenuBar1);\r
}\r
-\r
- public void placeholdersMenu_actionPerformed(ActionEvent e) {\r
- }\r
-\r
- public void textbox_actionPerformed(ActionEvent e) {\r
+ catch (Exception e)\r
+ {\r
+ e.printStackTrace();\r
}\r
+ }\r
+\r
+ private void jbInit()\r
+ throws Exception\r
+ {\r
+ this.getContentPane().setLayout(borderLayout1);\r
+ this.setBackground(Color.white);\r
+ this.setFont(new java.awt.Font("Verdana", 0, 12));\r
+ scrollPane.setOpaque(false);\r
+ jMenu1.setText("File");\r
+ saveAsNewick.setText("Newick Format");\r
+ saveAsNewick.addActionListener(new ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ saveAsNewick_actionPerformed(e);\r
+ }\r
+ });\r
+ printMenu.setText("Print");\r
+ printMenu.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ printMenu_actionPerformed(e);\r
+ }\r
+ });\r
+ jMenu2.setText("View");\r
+ fontSize.setText("Font Size - 12");\r
+ fontSize.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ fontSize_actionPerformed(e);\r
+ }\r
+ });\r
+ bootstrapMenu.setText("Show Bootstrap Values");\r
+ bootstrapMenu.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ bootstrapMenu_actionPerformed(e);\r
+ }\r
+ });\r
+ distanceMenu.setText("Show Distances");\r
+ distanceMenu.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ distanceMenu_actionPerformed(e);\r
+ }\r
+ });\r
+ fitToWindow.setSelected(true);\r
+ fitToWindow.setText("Fit To Window");\r
+ fitToWindow.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ fitToWindow_actionPerformed(e);\r
+ }\r
+ });\r
+ epsTree.setText("EPS");\r
+ epsTree.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ epsTree_actionPerformed(e);\r
+ }\r
+ });\r
+ pngTree.setText("PNG");\r
+ pngTree.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ pngTree_actionPerformed(e);\r
+ }\r
+ });\r
+ saveAsMenu.setText("Save as");\r
+ placeholdersMenu.setToolTipText(\r
+ "Marks leaves of tree not associated with a sequence");\r
+ placeholdersMenu.setText("Mark Unlinked Leaves");\r
+ placeholdersMenu.addActionListener(new ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ placeholdersMenu_actionPerformed(e);\r
+ }\r
+ });\r
+ textbox.setText("Output to Textbox...");\r
+ textbox.addActionListener(new ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ textbox_actionPerformed(e);\r
+ }\r
+ });\r
+ this.getContentPane().add(scrollPane, BorderLayout.CENTER);\r
+ jMenuBar1.add(jMenu1);\r
+ jMenuBar1.add(jMenu2);\r
+ jMenu1.add(saveAsMenu);\r
+ jMenu1.add(textbox);\r
+ jMenu1.add(printMenu);\r
+ jMenu2.add(fitToWindow);\r
+ jMenu2.add(fontSize);\r
+ jMenu2.add(distanceMenu);\r
+ jMenu2.add(bootstrapMenu);\r
+ jMenu2.add(placeholdersMenu);\r
+ saveAsMenu.add(saveAsNewick);\r
+ saveAsMenu.add(epsTree);\r
+ saveAsMenu.add(pngTree);\r
+ }\r
+\r
+ public void printMenu_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
+\r
+ public void fontSize_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
+\r
+ public void distanceMenu_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
+\r
+ public void bootstrapMenu_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
+\r
+ public void fitToWindow_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
+\r
+ public void pngTree_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
+\r
+ public void epsTree_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
+\r
+ public void saveAsNewick_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
+\r
+ public void placeholdersMenu_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
+\r
+ public void textbox_actionPerformed(ActionEvent e)\r
+ {\r
+ }\r
}\r
import javax.swing.*;\r
\r
\r
-public class GUserDefinedColours extends JPanel {\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class GUserDefinedColours extends JPanel\r
+{\r
protected JColorChooser colorChooser = new JColorChooser();\r
protected JPanel buttonPanel = new JPanel();\r
protected GridLayout gridLayout = new GridLayout();\r
protected JButton cancelButton = new JButton();\r
FlowLayout flowLayout1 = new FlowLayout();\r
\r
- public GUserDefinedColours() {\r
- try {\r
+ /**\r
+ * Creates a new GUserDefinedColours object.\r
+ */\r
+ public GUserDefinedColours()\r
+ {\r
+ try\r
+ {\r
jbInit();\r
- } catch (Exception e) {\r
+ }\r
+ catch (Exception e)\r
+ {\r
e.printStackTrace();\r
}\r
}\r
\r
- private void jbInit() throws Exception {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @throws Exception DOCUMENT ME!\r
+ */\r
+ private void jbInit() throws Exception\r
+ {\r
this.setLayout(flowLayout1);\r
buttonPanel.setLayout(gridLayout);\r
gridLayout.setColumns(6);\r
gridLayout.setRows(4);\r
okButton.setFont(new java.awt.Font("Verdana", 0, 11));\r
okButton.setText("OK");\r
- okButton.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
+ okButton.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
okButton_actionPerformed(e);\r
}\r
});\r
applyButton.setFont(new java.awt.Font("Verdana", 0, 11));\r
applyButton.setText("Apply");\r
- applyButton.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
+ applyButton.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
applyButton_actionPerformed(e);\r
}\r
});\r
loadbutton.setFont(new java.awt.Font("Verdana", 0, 11));\r
loadbutton.setText("Load scheme");\r
- loadbutton.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
+ loadbutton.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
loadbutton_actionPerformed(e);\r
}\r
});\r
savebutton.setFont(new java.awt.Font("Verdana", 0, 11));\r
savebutton.setText("Save scheme");\r
- savebutton.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
+ savebutton.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
savebutton_actionPerformed(e);\r
}\r
});\r
cancelButton.setFont(new java.awt.Font("Verdana", 0, 11));\r
cancelButton.setText("Cancel");\r
- cancelButton.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
+ cancelButton.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
cancelButton_actionPerformed(e);\r
}\r
});\r
jPanel2.add(cancelButton, null);\r
}\r
\r
- protected void okButton_actionPerformed(ActionEvent e) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void okButton_actionPerformed(ActionEvent e)\r
+ {\r
}\r
\r
- protected void applyButton_actionPerformed(ActionEvent e) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void applyButton_actionPerformed(ActionEvent e)\r
+ {\r
}\r
\r
- protected void loadbutton_actionPerformed(ActionEvent e) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void loadbutton_actionPerformed(ActionEvent e)\r
+ {\r
}\r
\r
- protected void savebutton_actionPerformed(ActionEvent e) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void savebutton_actionPerformed(ActionEvent e)\r
+ {\r
}\r
\r
- protected void cancelButton_actionPerformed(ActionEvent e) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void cancelButton_actionPerformed(ActionEvent e)\r
+ {\r
}\r
}\r
import javax.swing.*;\r
\r
\r
-public class GWebserviceInfo extends JPanel {\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class GWebserviceInfo extends JPanel\r
+{\r
protected JTextArea infoText = new JTextArea();\r
JScrollPane jScrollPane1 = new JScrollPane();\r
JScrollPane jScrollPane2 = new JScrollPane();\r
protected JButton cancel = new JButton();\r
GridBagLayout gridBagLayout1 = new GridBagLayout();\r
\r
- public GWebserviceInfo() {\r
- try {\r
+ /**\r
+ * Creates a new GWebserviceInfo object.\r
+ */\r
+ public GWebserviceInfo()\r
+ {\r
+ try\r
+ {\r
jbInit();\r
- } catch (Exception e) {\r
+ }\r
+ catch (Exception e)\r
+ {\r
e.printStackTrace();\r
}\r
}\r
\r
- private void jbInit() throws Exception {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @throws Exception DOCUMENT ME!\r
+ */\r
+ private void jbInit() throws Exception\r
+ {\r
infoText.setFont(new java.awt.Font("Verdana", 0, 10));\r
infoText.setBorder(null);\r
infoText.setEditable(false);\r
jScrollPane1.setPreferredSize(new Dimension(400, 70));\r
cancel.setFont(new java.awt.Font("Verdana", 0, 11));\r
cancel.setText("Cancel");\r
- cancel.addActionListener(new java.awt.event.ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
+ cancel.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
cancel_actionPerformed(e);\r
}\r
});\r
new Insets(24, 5, 21, 5), 0, 0));\r
}\r
\r
- protected void cancel_actionPerformed(ActionEvent e) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ protected void cancel_actionPerformed(ActionEvent e)\r
+ {\r
}\r
}\r
import java.io.*;\r
\r
\r
-public class Matrix {\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class Matrix\r
+{\r
/**\r
* SMJSPUBLIC\r
*/\r
public double[][] value;\r
+\r
+ /** DOCUMENT ME!! */\r
public int rows;\r
+\r
+ /** DOCUMENT ME!! */\r
public int cols;\r
+\r
+ /** DOCUMENT ME!! */\r
public double[] d; // Diagonal\r
+\r
+ /** DOCUMENT ME!! */\r
public double[] e; // off diagonal\r
\r
- public Matrix(double[][] value, int rows, int cols) {\r
+ /**\r
+ * Creates a new Matrix object.\r
+ *\r
+ * @param value DOCUMENT ME!\r
+ * @param rows DOCUMENT ME!\r
+ * @param cols DOCUMENT ME!\r
+ */\r
+ public Matrix(double[][] value, int rows, int cols)\r
+ {\r
this.rows = rows;\r
this.cols = cols;\r
this.value = value;\r
}\r
\r
- public Matrix transpose() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public Matrix transpose()\r
+ {\r
double[][] out = new double[cols][rows];\r
\r
- for (int i = 0; i < cols; i++) {\r
- for (int j = 0; j < rows; j++) {\r
+ for (int i = 0; i < cols; i++)\r
+ {\r
+ for (int j = 0; j < rows; j++)\r
+ {\r
out[i][j] = value[j][i];\r
}\r
}\r
return new Matrix(out, cols, rows);\r
}\r
\r
- public void print(PrintStream ps) {\r
- for (int i = 0; i < rows; i++) {\r
- for (int j = 0; j < cols; j++) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param ps DOCUMENT ME!\r
+ */\r
+ public void print(PrintStream ps)\r
+ {\r
+ for (int i = 0; i < rows; i++)\r
+ {\r
+ for (int j = 0; j < cols; j++)\r
+ {\r
Format.print(ps, "%8.2f", value[i][j]);\r
}\r
\r
}\r
}\r
\r
- public Matrix preMultiply(Matrix in) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param in DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public Matrix preMultiply(Matrix in)\r
+ {\r
double[][] tmp = new double[in.rows][this.cols];\r
\r
- for (int i = 0; i < in.rows; i++) {\r
- for (int j = 0; j < this.cols; j++) {\r
+ for (int i = 0; i < in.rows; i++)\r
+ {\r
+ for (int j = 0; j < this.cols; j++)\r
+ {\r
tmp[i][j] = 0.0;\r
\r
- for (int k = 0; k < in.cols; k++) {\r
+ for (int k = 0; k < in.cols; k++)\r
+ {\r
tmp[i][j] += (in.value[i][k] * this.value[k][j]);\r
}\r
}\r
return new Matrix(tmp, in.rows, this.cols);\r
}\r
\r
- public double[] vectorPostMultiply(double[] in) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param in DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public double[] vectorPostMultiply(double[] in)\r
+ {\r
double[] out = new double[in.length];\r
\r
- for (int i = 0; i < in.length; i++) {\r
+ for (int i = 0; i < in.length; i++)\r
+ {\r
out[i] = 0.0;\r
\r
- for (int k = 0; k < in.length; k++) {\r
+ for (int k = 0; k < in.length; k++)\r
+ {\r
out[i] += (value[i][k] * in[k]);\r
}\r
}\r
return out;\r
}\r
\r
- public Matrix postMultiply(Matrix in) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param in DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public Matrix postMultiply(Matrix in)\r
+ {\r
double[][] out = new double[this.rows][in.cols];\r
\r
- for (int i = 0; i < this.rows; i++) {\r
- for (int j = 0; j < in.cols; j++) {\r
+ for (int i = 0; i < this.rows; i++)\r
+ {\r
+ for (int j = 0; j < in.cols; j++)\r
+ {\r
out[i][j] = 0.0;\r
\r
- for (int k = 0; k < rows; k++) {\r
+ for (int k = 0; k < rows; k++)\r
+ {\r
out[i][j] = out[i][j] + (value[i][k] * in.value[k][j]);\r
}\r
}\r
return new Matrix(out, this.cols, in.rows);\r
}\r
\r
- public Matrix copy() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public Matrix copy()\r
+ {\r
double[][] newmat = new double[rows][cols];\r
\r
- for (int i = 0; i < rows; i++) {\r
- for (int j = 0; j < cols; j++) {\r
+ for (int i = 0; i < rows; i++)\r
+ {\r
+ for (int j = 0; j < cols; j++)\r
+ {\r
newmat[i][j] = value[i][j];\r
}\r
}\r
return new Matrix(newmat, rows, cols);\r
}\r
\r
- public void tred() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ public void tred()\r
+ {\r
int n = rows;\r
int l;\r
int k;\r
this.d = new double[rows];\r
this.e = new double[rows];\r
\r
- for (i = n; i >= 2; i--) {\r
+ for (i = n; i >= 2; i--)\r
+ {\r
l = i - 1;\r
h = 0.0;\r
scale = 0.0;\r
\r
- if (l > 1) {\r
- for (k = 1; k <= l; k++) {\r
+ if (l > 1)\r
+ {\r
+ for (k = 1; k <= l; k++)\r
+ {\r
scale += Math.abs(value[i - 1][k - 1]);\r
}\r
\r
- if (scale == 0.0) {\r
+ if (scale == 0.0)\r
+ {\r
e[i - 1] = value[i - 1][l - 1];\r
- } else {\r
- for (k = 1; k <= l; k++) {\r
+ }\r
+ else\r
+ {\r
+ for (k = 1; k <= l; k++)\r
+ {\r
value[i - 1][k - 1] /= scale;\r
h += (value[i - 1][k - 1] * value[i - 1][k - 1]);\r
}\r
\r
f = value[i - 1][l - 1];\r
\r
- if (f > 0) {\r
+ if (f > 0)\r
+ {\r
g = -1.0 * Math.sqrt(h);\r
- } else {\r
+ }\r
+ else\r
+ {\r
g = Math.sqrt(h);\r
}\r
\r
value[i - 1][l - 1] = f - g;\r
f = 0.0;\r
\r
- for (j = 1; j <= l; j++) {\r
+ for (j = 1; j <= l; j++)\r
+ {\r
value[j - 1][i - 1] = value[i - 1][j - 1] / h;\r
g = 0.0;\r
\r
- for (k = 1; k <= j; k++) {\r
+ for (k = 1; k <= j; k++)\r
+ {\r
g += (value[j - 1][k - 1] * value[i - 1][k - 1]);\r
}\r
\r
- for (k = j + 1; k <= l; k++) {\r
+ for (k = j + 1; k <= l; k++)\r
+ {\r
g += (value[k - 1][j - 1] * value[i - 1][k - 1]);\r
}\r
\r
\r
hh = f / (h + h);\r
\r
- for (j = 1; j <= l; j++) {\r
+ for (j = 1; j <= l; j++)\r
+ {\r
f = value[i - 1][j - 1];\r
g = e[j - 1] - (hh * f);\r
e[j - 1] = g;\r
\r
- for (k = 1; k <= j; k++) {\r
+ for (k = 1; k <= j; k++)\r
+ {\r
value[j - 1][k - 1] -= ((f * e[k - 1]) +\r
(g * value[i - 1][k - 1]));\r
}\r
}\r
}\r
- } else {\r
+ }\r
+ else\r
+ {\r
e[i - 1] = value[i - 1][l - 1];\r
}\r
\r
d[0] = 0.0;\r
e[0] = 0.0;\r
\r
- for (i = 1; i <= n; i++) {\r
+ for (i = 1; i <= n; i++)\r
+ {\r
l = i - 1;\r
\r
- if (d[i - 1] != 0.0) {\r
- for (j = 1; j <= l; j++) {\r
+ if (d[i - 1] != 0.0)\r
+ {\r
+ for (j = 1; j <= l; j++)\r
+ {\r
g = 0.0;\r
\r
- for (k = 1; k <= l; k++) {\r
+ for (k = 1; k <= l; k++)\r
+ {\r
g += (value[i - 1][k - 1] * value[k - 1][j - 1]);\r
}\r
\r
- for (k = 1; k <= l; k++) {\r
+ for (k = 1; k <= l; k++)\r
+ {\r
value[k - 1][j - 1] -= (g * value[k - 1][i - 1]);\r
}\r
}\r
d[i - 1] = value[i - 1][i - 1];\r
value[i - 1][i - 1] = 1.0;\r
\r
- for (j = 1; j <= l; j++) {\r
+ for (j = 1; j <= l; j++)\r
+ {\r
value[j - 1][i - 1] = 0.0;\r
value[i - 1][j - 1] = 0.0;\r
}\r
}\r
}\r
\r
- public void tqli() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ public void tqli()\r
+ {\r
int n = rows;\r
\r
int m;\r
double c;\r
double b;\r
\r
- for (i = 2; i <= n; i++) {\r
+ for (i = 2; i <= n; i++)\r
+ {\r
e[i - 2] = e[i - 1];\r
}\r
\r
e[n - 1] = 0.0;\r
\r
- for (l = 1; l <= n; l++) {\r
+ for (l = 1; l <= n; l++)\r
+ {\r
iter = 0;\r
\r
- do {\r
- for (m = l; m <= (n - 1); m++) {\r
+ do\r
+ {\r
+ for (m = l; m <= (n - 1); m++)\r
+ {\r
dd = Math.abs(d[m - 1]) + Math.abs(d[m]);\r
\r
- if ((Math.abs(e[m - 1]) + dd) == dd) {\r
+ if ((Math.abs(e[m - 1]) + dd) == dd)\r
+ {\r
break;\r
}\r
}\r
\r
- if (m != l) {\r
+ if (m != l)\r
+ {\r
iter++;\r
\r
- if (iter == 30) {\r
+ if (iter == 30)\r
+ {\r
System.err.print("Too many iterations in tqli");\r
System.exit(0); // JBPNote - should this really be here ???\r
- } else {\r
+ }\r
+ else\r
+ {\r
// System.out.println("Iteration " + iter);\r
}\r
\r
s = c;\r
p = 0.0;\r
\r
- for (i = m - 1; i >= l; i--) {\r
+ for (i = m - 1; i >= l; i--)\r
+ {\r
f = s * e[i - 1];\r
b = c * e[i - 1];\r
\r
- if (Math.abs(f) >= Math.abs(g)) {\r
+ if (Math.abs(f) >= Math.abs(g))\r
+ {\r
c = g / f;\r
r = Math.sqrt((c * c) + 1.0);\r
e[i] = f * r;\r
s = 1.0 / r;\r
c *= s;\r
- } else {\r
+ }\r
+ else\r
+ {\r
s = f / g;\r
r = Math.sqrt((s * s) + 1.0);\r
e[i] = g * r;\r
d[i] = g + p;\r
g = (c * r) - b;\r
\r
- for (k = 1; k <= n; k++) {\r
+ for (k = 1; k <= n; k++)\r
+ {\r
f = value[k - 1][i];\r
value[k - 1][i] = (s * value[k - 1][i - 1]) +\r
(c * f);\r
e[l - 1] = g;\r
e[m - 1] = 0.0;\r
}\r
- } while (m != l);\r
+ }\r
+ while (m != l);\r
}\r
}\r
\r
- public void tred2() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ public void tred2()\r
+ {\r
int n = rows;\r
int l;\r
int k;\r
this.d = new double[rows];\r
this.e = new double[rows];\r
\r
- for (i = n - 1; i >= 1; i--) {\r
+ for (i = n - 1; i >= 1; i--)\r
+ {\r
l = i - 1;\r
h = 0.0;\r
scale = 0.0;\r
\r
- if (l > 0) {\r
- for (k = 0; k < l; k++) {\r
+ if (l > 0)\r
+ {\r
+ for (k = 0; k < l; k++)\r
+ {\r
scale += Math.abs(value[i][k]);\r
}\r
\r
- if (scale == 0.0) {\r
+ if (scale == 0.0)\r
+ {\r
e[i] = value[i][l];\r
- } else {\r
- for (k = 0; k < l; k++) {\r
+ }\r
+ else\r
+ {\r
+ for (k = 0; k < l; k++)\r
+ {\r
value[i][k] /= scale;\r
h += (value[i][k] * value[i][k]);\r
}\r
\r
f = value[i][l];\r
\r
- if (f > 0) {\r
+ if (f > 0)\r
+ {\r
g = -1.0 * Math.sqrt(h);\r
- } else {\r
+ }\r
+ else\r
+ {\r
g = Math.sqrt(h);\r
}\r
\r
value[i][l] = f - g;\r
f = 0.0;\r
\r
- for (j = 0; j < l; j++) {\r
+ for (j = 0; j < l; j++)\r
+ {\r
value[j][i] = value[i][j] / h;\r
g = 0.0;\r
\r
- for (k = 0; k < j; k++) {\r
+ for (k = 0; k < j; k++)\r
+ {\r
g += (value[j][k] * value[i][k]);\r
}\r
\r
- for (k = j; k < l; k++) {\r
+ for (k = j; k < l; k++)\r
+ {\r
g += (value[k][j] * value[i][k]);\r
}\r
\r
\r
hh = f / (h + h);\r
\r
- for (j = 0; j < l; j++) {\r
+ for (j = 0; j < l; j++)\r
+ {\r
f = value[i][j];\r
g = e[j] - (hh * f);\r
e[j] = g;\r
\r
- for (k = 0; k < j; k++) {\r
+ for (k = 0; k < j; k++)\r
+ {\r
value[j][k] -= ((f * e[k]) + (g * value[i][k]));\r
}\r
}\r
}\r
- } else {\r
+ }\r
+ else\r
+ {\r
e[i] = value[i][l];\r
}\r
\r
d[0] = 0.0;\r
e[0] = 0.0;\r
\r
- for (i = 0; i < n; i++) {\r
+ for (i = 0; i < n; i++)\r
+ {\r
l = i - 1;\r
\r
- if (d[i] != 0.0) {\r
- for (j = 0; j < l; j++) {\r
+ if (d[i] != 0.0)\r
+ {\r
+ for (j = 0; j < l; j++)\r
+ {\r
g = 0.0;\r
\r
- for (k = 0; k < l; k++) {\r
+ for (k = 0; k < l; k++)\r
+ {\r
g += (value[i][k] * value[k][j]);\r
}\r
\r
- for (k = 0; k < l; k++) {\r
+ for (k = 0; k < l; k++)\r
+ {\r
value[k][j] -= (g * value[k][i]);\r
}\r
}\r
d[i] = value[i][i];\r
value[i][i] = 1.0;\r
\r
- for (j = 0; j < l; j++) {\r
+ for (j = 0; j < l; j++)\r
+ {\r
value[j][i] = 0.0;\r
value[i][j] = 0.0;\r
}\r
}\r
}\r
\r
- public void tqli2() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ public void tqli2()\r
+ {\r
int n = rows;\r
\r
int m;\r
double c;\r
double b;\r
\r
- for (i = 2; i <= n; i++) {\r
+ for (i = 2; i <= n; i++)\r
+ {\r
e[i - 2] = e[i - 1];\r
}\r
\r
e[n - 1] = 0.0;\r
\r
- for (l = 1; l <= n; l++) {\r
+ for (l = 1; l <= n; l++)\r
+ {\r
iter = 0;\r
\r
- do {\r
- for (m = l; m <= (n - 1); m++) {\r
+ do\r
+ {\r
+ for (m = l; m <= (n - 1); m++)\r
+ {\r
dd = Math.abs(d[m - 1]) + Math.abs(d[m]);\r
\r
- if ((Math.abs(e[m - 1]) + dd) == dd) {\r
+ if ((Math.abs(e[m - 1]) + dd) == dd)\r
+ {\r
break;\r
}\r
}\r
\r
- if (m != l) {\r
+ if (m != l)\r
+ {\r
iter++;\r
\r
- if (iter == 30) {\r
+ if (iter == 30)\r
+ {\r
System.err.print("Too many iterations in tqli");\r
System.exit(0); // JBPNote - same as above - not a graceful exit!\r
- } else {\r
+ }\r
+ else\r
+ {\r
// System.out.println("Iteration " + iter);\r
}\r
\r
s = c;\r
p = 0.0;\r
\r
- for (i = m - 1; i >= l; i--) {\r
+ for (i = m - 1; i >= l; i--)\r
+ {\r
f = s * e[i - 1];\r
b = c * e[i - 1];\r
\r
- if (Math.abs(f) >= Math.abs(g)) {\r
+ if (Math.abs(f) >= Math.abs(g))\r
+ {\r
c = g / f;\r
r = Math.sqrt((c * c) + 1.0);\r
e[i] = f * r;\r
s = 1.0 / r;\r
c *= s;\r
- } else {\r
+ }\r
+ else\r
+ {\r
s = f / g;\r
r = Math.sqrt((s * s) + 1.0);\r
e[i] = g * r;\r
d[i] = g + p;\r
g = (c * r) - b;\r
\r
- for (k = 1; k <= n; k++) {\r
+ for (k = 1; k <= n; k++)\r
+ {\r
f = value[k - 1][i];\r
value[k - 1][i] = (s * value[k - 1][i - 1]) +\r
(c * f);\r
e[l - 1] = g;\r
e[m - 1] = 0.0;\r
}\r
- } while (m != l);\r
+ }\r
+ while (m != l);\r
}\r
}\r
\r
- public double sign(double a, double b) {\r
- if (b < 0) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param a DOCUMENT ME!\r
+ * @param b DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public double sign(double a, double b)\r
+ {\r
+ if (b < 0)\r
+ {\r
return -Math.abs(a);\r
- } else {\r
+ }\r
+ else\r
+ {\r
return Math.abs(a);\r
}\r
}\r
\r
- public double[] getColumn(int n) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param n DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public double[] getColumn(int n)\r
+ {\r
double[] out = new double[rows];\r
\r
- for (int i = 0; i < rows; i++) {\r
+ for (int i = 0; i < rows; i++)\r
+ {\r
out[i] = value[i][n];\r
}\r
\r
return out;\r
}\r
\r
- public void printD(PrintStream ps) {\r
- for (int j = 0; j < rows; j++) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param ps DOCUMENT ME!\r
+ */\r
+ public void printD(PrintStream ps)\r
+ {\r
+ for (int j = 0; j < rows; j++)\r
+ {\r
Format.print(ps, "%15.4e", d[j]);\r
}\r
}\r
\r
- public void printE(PrintStream ps) {\r
- for (int j = 0; j < rows; j++) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param ps DOCUMENT ME!\r
+ */\r
+ public void printE(PrintStream ps)\r
+ {\r
+ for (int j = 0; j < rows; j++)\r
+ {\r
Format.print(ps, "%15.4e", e[j]);\r
}\r
}\r
\r
- public static void main(String[] args) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param args DOCUMENT ME!\r
+ */\r
+ public static void main(String[] args)\r
+ {\r
int n = Integer.parseInt(args[0]);\r
double[][] in = new double[n][n];\r
\r
- for (int i = 0; i < n; i++) {\r
- for (int j = 0; j < n; j++) {\r
+ for (int i = 0; i < n; i++)\r
+ {\r
+ for (int j = 0; j < n; j++)\r
+ {\r
in[i][j] = (double) Math.random();\r
}\r
}\r
*/\r
package jalview.math;\r
\r
-public class RotatableMatrix {\r
+\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class RotatableMatrix\r
+{\r
float[][] matrix;\r
float[] temp;\r
float[][] rot;\r
\r
- public RotatableMatrix(int rows, int cols) {\r
+ /**\r
+ * Creates a new RotatableMatrix object.\r
+ *\r
+ * @param rows DOCUMENT ME!\r
+ * @param cols DOCUMENT ME!\r
+ */\r
+ public RotatableMatrix(int rows, int cols)\r
+ {\r
matrix = new float[rows][cols];\r
\r
temp = new float[3];\r
rot = new float[3][3];\r
}\r
\r
- public void addElement(int i, int j, float value) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param i DOCUMENT ME!\r
+ * @param j DOCUMENT ME!\r
+ * @param value DOCUMENT ME!\r
+ */\r
+ public void addElement(int i, int j, float value)\r
+ {\r
matrix[i][j] = value;\r
}\r
\r
- public void print() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ public void print()\r
+ {\r
System.out.println(matrix[0][0] + " " + matrix[0][1] + " " +\r
matrix[0][2]);\r
\r
matrix[2][2]);\r
}\r
\r
- public void rotate(float degrees, char axis) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param degrees DOCUMENT ME!\r
+ * @param axis DOCUMENT ME!\r
+ */\r
+ public void rotate(float degrees, char axis)\r
+ {\r
float costheta = (float) Math.cos((degrees * Math.PI) / (float) 180.0);\r
\r
float sintheta = (float) Math.sin((degrees * Math.PI) / (float) 180.0);\r
\r
- if (axis == 'z') {\r
+ if (axis == 'z')\r
+ {\r
rot[0][0] = (float) costheta;\r
\r
rot[0][1] = (float) -sintheta;\r
preMultiply(rot);\r
}\r
\r
- if (axis == 'x') {\r
+ if (axis == 'x')\r
+ {\r
rot[0][0] = (float) 1.0;\r
\r
rot[0][1] = (float) 0.0;\r
preMultiply(rot);\r
}\r
\r
- if (axis == 'y') {\r
+ if (axis == 'y')\r
+ {\r
rot[0][0] = (float) costheta;\r
\r
rot[0][1] = (float) 0.0;\r
}\r
}\r
\r
- public float[] vectorMultiply(float[] vect) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param vect DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public float[] vectorMultiply(float[] vect)\r
+ {\r
temp[0] = vect[0];\r
\r
temp[1] = vect[1];\r
\r
temp[2] = vect[2];\r
\r
- for (int i = 0; i < 3; i++) {\r
+ for (int i = 0; i < 3; i++)\r
+ {\r
temp[i] = (matrix[i][0] * vect[0]) + (matrix[i][1] * vect[1]) +\r
(matrix[i][2] * vect[2]);\r
}\r
return vect;\r
}\r
\r
- public void preMultiply(float[][] mat) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param mat DOCUMENT ME!\r
+ */\r
+ public void preMultiply(float[][] mat)\r
+ {\r
float[][] tmp = new float[3][3];\r
\r
- for (int i = 0; i < 3; i++) {\r
- for (int j = 0; j < 3; j++) {\r
+ for (int i = 0; i < 3; i++)\r
+ {\r
+ for (int j = 0; j < 3; j++)\r
+ {\r
tmp[i][j] = (mat[i][0] * matrix[0][j]) +\r
(mat[i][1] * matrix[1][j]) + (mat[i][2] * matrix[2][j]);\r
}\r
}\r
\r
- for (int i = 0; i < 3; i++) {\r
- for (int j = 0; j < 3; j++) {\r
+ for (int i = 0; i < 3; i++)\r
+ {\r
+ for (int j = 0; j < 3; j++)\r
+ {\r
matrix[i][j] = tmp[i][j];\r
}\r
}\r
}\r
\r
- public void postMultiply(float[][] mat) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param mat DOCUMENT ME!\r
+ */\r
+ public void postMultiply(float[][] mat)\r
+ {\r
float[][] tmp = new float[3][3];\r
\r
- for (int i = 0; i < 3; i++) {\r
- for (int j = 0; j < 3; j++) {\r
+ for (int i = 0; i < 3; i++)\r
+ {\r
+ for (int j = 0; j < 3; j++)\r
+ {\r
tmp[i][j] = (matrix[i][0] * mat[0][j]) +\r
(matrix[i][1] * mat[1][j]) + (matrix[i][2] * mat[2][j]);\r
}\r
}\r
\r
- for (int i = 0; i < 3; i++) {\r
- for (int j = 0; j < 3; j++) {\r
+ for (int i = 0; i < 3; i++)\r
+ {\r
+ for (int j = 0; j < 3; j++)\r
+ {\r
matrix[i][j] = tmp[i][j];\r
}\r
}\r
}\r
\r
- public static void main(String[] args) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param args DOCUMENT ME!\r
+ */\r
+ public static void main(String[] args)\r
+ {\r
RotatableMatrix m = new RotatableMatrix(3, 3);\r
\r
m.addElement(0, 0, 1);\r
System.out.println(vect[0] + " " + vect[1] + " " + vect[2]);\r
}\r
\r
- public void setIdentity() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ public void setIdentity()\r
+ {\r
matrix[0][0] = (float) 1.0;\r
\r
matrix[1][1] = (float) 1.0;\r
/*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
-*\r
-* This program is free software; you can redistribute it and/or\r
-* modify it under the terms of the GNU General Public License\r
-* as published by the Free Software Foundation; either version 2\r
-* of the License, or (at your option) any later version.\r
-*\r
-* This program is distributed in the hope that it will be useful,\r
-* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-* GNU General Public License for more details.\r
-*\r
-* You should have received a copy of the GNU General Public License\r
-* along with this program; if not, write to the Free Software\r
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
-*/\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
+ */\r
package jalview.schemes;\r
\r
-import java.awt.*;\r
-\r
import java.util.*;\r
\r
+import java.awt.*;\r
\r
-public class Blosum62ColourScheme extends ResidueColourScheme {\r
- public Blosum62ColourScheme() {\r
- super();\r
+public class Blosum62ColourScheme\r
+ extends ResidueColourScheme\r
+{\r
+ public Blosum62ColourScheme()\r
+ {\r
+ super();\r
+ }\r
+\r
+ public Color findColour(String s, int j)\r
+ {\r
+ if ( (threshold != 0) && !aboveThreshold(s, j))\r
+ {\r
+ return Color.white;\r
}\r
\r
- public Color findColour(String s, int j) {\r
- if ((threshold != 0) && !aboveThreshold(s, j)) {\r
- return Color.white;\r
+ Hashtable hash = (Hashtable) consensus.elementAt(j);\r
+\r
+ if (!jalview.util.Comparison.isGap( (s.charAt(0))))\r
+ {\r
+ String max = (String) hash.get("maxResidue");\r
+\r
+ if (max.indexOf(s) > -1)\r
+ {\r
+ return new Color(154, 154, 255);\r
+ }\r
+ else\r
+ {\r
+ int c = 0;\r
+ int max_aa = 0;\r
+ int n = max.length();\r
+\r
+ do\r
+ {\r
+ c += ResidueProperties.getBLOSUM62(max.substring(max_aa,\r
+ max_aa + 1), s);\r
}\r
+ while (++max_aa < n);\r
\r
- Hashtable hash = (Hashtable) consensus.elementAt(j);\r
-\r
- if (!jalview.util.Comparison.isGap((s.charAt(0)))) {\r
- String max = (String) hash.get("maxResidue");\r
-\r
- if (max.indexOf(s) > -1) {\r
- return new Color(154, 154, 255);\r
- } else {\r
- int c = 0;\r
- int max_aa = 0;\r
- int n = max.length();\r
-\r
- do {\r
- c += ResidueProperties.getBLOSUM62(max.substring(max_aa,\r
- max_aa + 1), s);\r
- } while (++max_aa < n);\r
-\r
- if (c > 0) {\r
- return new Color(204, 204, 255);\r
- } else {\r
- return Color.white;\r
- }\r
- }\r
- } else {\r
- return Color.white;\r
+ if (c > 0)\r
+ {\r
+ return new Color(204, 204, 255);\r
}\r
+ else\r
+ {\r
+ return Color.white;\r
+ }\r
+ }\r
+ }\r
+ else\r
+ {\r
+ return Color.white;\r
}\r
+ }\r
}\r
import java.awt.*;\r
\r
\r
-public class BuriedColourScheme extends ScoreColourScheme {\r
- public BuriedColourScheme() {\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class BuriedColourScheme extends ScoreColourScheme\r
+{\r
+ /**\r
+ * Creates a new BuriedColourScheme object.\r
+ */\r
+ public BuriedColourScheme()\r
+ {\r
super(ResidueProperties.buried, ResidueProperties.buriedmin,\r
ResidueProperties.buriedmax);\r
}\r
\r
- public Color makeColour(float c) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param c DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public Color makeColour(float c)\r
+ {\r
return new Color(0, (float) (1.0 - c), c);\r
}\r
}\r
/*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
-*\r
-* This program is free software; you can redistribute it and/or\r
-* modify it under the terms of the GNU General Public License\r
-* as published by the Free Software Foundation; either version 2\r
-* of the License, or (at your option) any later version.\r
-*\r
-* This program is distributed in the hope that it will be useful,\r
-* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-* GNU General Public License for more details.\r
-*\r
-* You should have received a copy of the GNU General Public License\r
-* along with this program; if not, write to the Free Software\r
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
-*/\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
+ */\r
package jalview.schemes;\r
\r
-import jalview.datamodel.*;\r
-\r
-import java.awt.*;\r
-\r
import java.util.*;\r
\r
+import java.awt.*;\r
\r
-public class ClustalxColourScheme extends ResidueColourScheme {\r
- public static Hashtable colhash = new Hashtable();\r
- Hashtable[] cons;\r
- int[][] cons2;\r
- ConsensusColour[] colours;\r
- ConsensusColour[] ResidueColour;\r
- int size;\r
- Consensus[] conses = new Consensus[32];\r
- Vector colourTable = new Vector();\r
+import jalview.datamodel.*;\r
\r
+public class ClustalxColourScheme\r
+ extends ResidueColourScheme\r
+{\r
+ public static Hashtable colhash = new Hashtable();\r
+ Hashtable[] cons;\r
+ int[][] cons2;\r
+ ConsensusColour[] colours;\r
+ ConsensusColour[] ResidueColour;\r
+ int size;\r
+ Consensus[] conses = new Consensus[32];\r
+ Vector colourTable = new Vector();\r
+\r
+ {\r
+ colhash.put("RED", new Color( (float) 0.9, (float) 0.2, (float) 0.1));\r
+ colhash.put("BLUE", new Color( (float) 0.5, (float) 0.7, (float) 0.9));\r
+ colhash.put("GREEN", new Color( (float) 0.1, (float) 0.8, (float) 0.1));\r
+ colhash.put("ORANGE", new Color( (float) 0.9, (float) 0.6, (float) 0.3));\r
+ colhash.put("CYAN", new Color( (float) 0.1, (float) 0.7, (float) 0.7));\r
+ colhash.put("PINK", new Color( (float) 0.9, (float) 0.5, (float) 0.5));\r
+ colhash.put("MAGENTA", new Color( (float) 0.8, (float) 0.3, (float) 0.8));\r
+ colhash.put("YELLOW", new Color( (float) 0.8, (float) 0.8, (float) 0.0));\r
+ }\r
+\r
+ public ClustalxColourScheme(Vector seqs, int maxWidth)\r
+ {\r
+ resetClustalX(seqs, maxWidth);\r
+ }\r
+\r
+ public void resetClustalX(Vector seqs, int maxWidth)\r
+ {\r
+ cons2 = new int[maxWidth][24];\r
+\r
+ int start = 0;\r
+\r
+ // Initialize the array\r
+ for (int j = 0; j < 24; j++)\r
{\r
- colhash.put("RED", new Color((float) 0.9, (float) 0.2, (float) 0.1));\r
- colhash.put("BLUE", new Color((float) 0.5, (float) 0.7, (float) 0.9));\r
- colhash.put("GREEN", new Color((float) 0.1, (float) 0.8, (float) 0.1));\r
- colhash.put("ORANGE", new Color((float) 0.9, (float) 0.6, (float) 0.3));\r
- colhash.put("CYAN", new Color((float) 0.1, (float) 0.7, (float) 0.7));\r
- colhash.put("PINK", new Color((float) 0.9, (float) 0.5, (float) 0.5));\r
- colhash.put("MAGENTA", new Color((float) 0.8, (float) 0.3, (float) 0.8));\r
- colhash.put("YELLOW", new Color((float) 0.8, (float) 0.8, (float) 0.0));\r
- }\r
-\r
- public ClustalxColourScheme(Vector seqs, int maxWidth) {\r
- resetClustalX(seqs, maxWidth);\r
+ for (int i = 0; i < maxWidth; i++)\r
+ {\r
+ cons2[i][j] = 0;\r
+ }\r
}\r
\r
- public void resetClustalX(Vector seqs, int maxWidth) {\r
- cons2 = new int[maxWidth][24];\r
+ int res;\r
+ int i;\r
+ int j = 0;\r
+ String seq;\r
\r
- int start = 0;\r
-\r
- // Initialize the array\r
- for (int j = 0; j < 24; j++)\r
- for (int i = 0; i < maxWidth; i++)\r
- cons2[i][j] = 0;\r
-\r
- int res;\r
- int i;\r
- int j = 0;\r
- String seq;\r
-\r
- while (j < seqs.size()) {\r
- seq = ((SequenceI) seqs.elementAt(j)).getSequence();\r
-\r
- int end_j = seq.length() - 1;\r
-\r
- for (i = start; i <= end_j; i++) {\r
- if ((seq.length() - 1) < i) {\r
- res = 23;\r
- } else {\r
- res = ((Integer) ResidueProperties.aaHash.get(seq.charAt(i) +\r
- "")).intValue();\r
- }\r
+ while (j < seqs.size())\r
+ {\r
+ seq = ( (SequenceI) seqs.elementAt(j)).getSequence();\r
\r
- cons2[i][res]++;\r
- }\r
+ int end_j = seq.length() - 1;\r
\r
- j++;\r
+ for (i = start; i <= end_j; i++)\r
+ {\r
+ if ( (seq.length() - 1) < i)\r
+ {\r
+ res = 23;\r
+ }\r
+ else\r
+ {\r
+ res = ( (Integer) ResidueProperties.aaHash.get(seq.charAt(i) +\r
+ "")).intValue();\r
}\r
\r
- this.size = seqs.size();\r
- makeColours();\r
- }\r
+ cons2[i][res]++;\r
+ }\r
\r
- public void makeColours() {\r
- conses[0] = new Consensus("WLVIMAFCYHP", 60);\r
- conses[1] = new Consensus("WLVIMAFCYHP", 80);\r
- conses[2] = new Consensus("ED", 50);\r
- conses[3] = new Consensus("KR", 60);\r
- conses[4] = new Consensus("G", 50);\r
- conses[5] = new Consensus("N", 50);\r
- conses[6] = new Consensus("QE", 50);\r
- conses[7] = new Consensus("P", 50);\r
- conses[8] = new Consensus("TS", 50);\r
-\r
- conses[26] = new Consensus("A", 85);\r
- conses[27] = new Consensus("C", 85);\r
- conses[10] = new Consensus("E", 85);\r
- conses[11] = new Consensus("F", 85);\r
- conses[12] = new Consensus("G", 85);\r
- conses[13] = new Consensus("H", 85);\r
- conses[14] = new Consensus("I", 85);\r
- conses[15] = new Consensus("L", 85);\r
- conses[16] = new Consensus("M", 85);\r
- conses[17] = new Consensus("N", 85);\r
- conses[18] = new Consensus("P", 85);\r
- conses[19] = new Consensus("Q", 85);\r
- conses[20] = new Consensus("R", 85);\r
- conses[21] = new Consensus("S", 85);\r
- conses[22] = new Consensus("T", 85);\r
- conses[23] = new Consensus("V", 85);\r
- conses[24] = new Consensus("W", 85);\r
- conses[25] = new Consensus("Y", 85);\r
- conses[28] = new Consensus("K", 85);\r
- conses[29] = new Consensus("D", 85);\r
-\r
- conses[30] = new Consensus("G", 0);\r
- conses[31] = new Consensus("P", 0);\r
-\r
- // We now construct the colours\r
- colours = new ConsensusColour[11];\r
-\r
- Consensus[] tmp8 = new Consensus[1];\r
- tmp8[0] = conses[30]; //G\r
- colours[7] = new ConsensusColour((Color) colhash.get("ORANGE"), tmp8);\r
-\r
- Consensus[] tmp9 = new Consensus[1];\r
- tmp9[0] = conses[31]; //P\r
- colours[8] = new ConsensusColour((Color) colhash.get("YELLOW"), tmp9);\r
-\r
- Consensus[] tmp10 = new Consensus[1];\r
- tmp10[0] = conses[27]; //C\r
- colours[9] = new ConsensusColour((Color) colhash.get("PINK"), tmp8);\r
-\r
- Consensus[] tmp1 = new Consensus[14];\r
- tmp1[0] = conses[0]; //%\r
- tmp1[1] = conses[1]; //#\r
- tmp1[2] = conses[26]; //A\r
- tmp1[3] = conses[27]; //C\r
- tmp1[4] = conses[11]; //F\r
- tmp1[5] = conses[13]; //H\r
- tmp1[6] = conses[14]; //I\r
- tmp1[7] = conses[15]; //L\r
- tmp1[8] = conses[16]; //M\r
- tmp1[9] = conses[23]; //V\r
- tmp1[10] = conses[24]; //W\r
- tmp1[11] = conses[25]; //Y\r
- tmp1[12] = conses[18]; //P\r
- tmp1[13] = conses[19]; //p\r
- colours[0] = new ConsensusColour((Color) colhash.get("BLUE"), tmp1);\r
-\r
- colours[10] = new ConsensusColour((Color) colhash.get("CYAN"), tmp1);\r
-\r
- Consensus[] tmp2 = new Consensus[5];\r
- tmp2[0] = conses[8]; //t\r
- tmp2[1] = conses[21]; //S\r
- tmp2[2] = conses[22]; //T\r
- tmp2[3] = conses[0]; //%\r
- tmp2[4] = conses[1]; //#\r
- colours[1] = new ConsensusColour((Color) colhash.get("GREEN"), tmp2);\r
-\r
- Consensus[] tmp3 = new Consensus[3];\r
-\r
- tmp3[0] = conses[17]; //N\r
- tmp3[1] = conses[29]; //D\r
- tmp3[2] = conses[5]; //n\r
- colours[2] = new ConsensusColour((Color) colhash.get("GREEN"), tmp3);\r
-\r
- Consensus[] tmp4 = new Consensus[6];\r
- tmp4[0] = conses[6]; // q = QE\r
- tmp4[1] = conses[19]; //Q\r
- tmp4[2] = conses[22]; //E\r
- tmp4[3] = conses[3]; //+\r
- tmp4[4] = conses[28]; //K\r
- tmp4[5] = conses[20]; //R\r
- colours[3] = new ConsensusColour((Color) colhash.get("GREEN"), tmp4);\r
-\r
- Consensus[] tmp5 = new Consensus[4];\r
- tmp5[0] = conses[3]; //+\r
- tmp5[1] = conses[28]; //K\r
- tmp5[2] = conses[20]; //R\r
- tmp5[3] = conses[19]; //Q\r
- colours[4] = new ConsensusColour((Color) colhash.get("RED"), tmp5);\r
-\r
- Consensus[] tmp6 = new Consensus[5];\r
- tmp6[0] = conses[3]; //-\r
- tmp6[1] = conses[29]; //D\r
- tmp6[2] = conses[10]; //E\r
- tmp6[3] = conses[6]; //q\r
- tmp6[4] = conses[19]; //Q\r
- colours[5] = new ConsensusColour((Color) colhash.get("MAGENTA"), tmp6);\r
-\r
- Consensus[] tmp7 = new Consensus[5];\r
- tmp7[0] = conses[3]; //-\r
- tmp7[1] = conses[29]; //D\r
- tmp7[2] = conses[10]; //E\r
- tmp7[3] = conses[17]; //N\r
- tmp7[4] = conses[2]; //DE\r
- colours[6] = new ConsensusColour((Color) colhash.get("MAGENTA"), tmp7);\r
-\r
- // Now attach the ConsensusColours to the residue letters\r
- ResidueColour = new ConsensusColour[20];\r
- ResidueColour[0] = colours[0]; // A\r
- ResidueColour[1] = colours[4]; // R\r
- ResidueColour[2] = colours[2]; // N\r
- ResidueColour[3] = colours[6]; // D\r
- ResidueColour[4] = colours[0]; // C\r
- ResidueColour[5] = colours[3]; // Q\r
- ResidueColour[6] = colours[5]; // E\r
- ResidueColour[7] = colours[7]; // G\r
- ResidueColour[8] = colours[10]; // H\r
- ResidueColour[9] = colours[0]; // I\r
- ResidueColour[10] = colours[0]; // L\r
- ResidueColour[11] = colours[4]; // K\r
- ResidueColour[12] = colours[0]; // M\r
- ResidueColour[13] = colours[0]; // F\r
- ResidueColour[14] = colours[8]; // P\r
- ResidueColour[15] = colours[1]; // S\r
- ResidueColour[16] = colours[1]; // T\r
- ResidueColour[17] = colours[0]; // W\r
- ResidueColour[18] = colours[10]; // Y\r
- ResidueColour[19] = colours[0]; // V\r
+ j++;\r
}\r
\r
- public Color findColour(String s) {\r
- return Color.pink;\r
+ this.size = seqs.size();\r
+ makeColours();\r
+ }\r
+\r
+ public void makeColours()\r
+ {\r
+ conses[0] = new Consensus("WLVIMAFCYHP", 60);\r
+ conses[1] = new Consensus("WLVIMAFCYHP", 80);\r
+ conses[2] = new Consensus("ED", 50);\r
+ conses[3] = new Consensus("KR", 60);\r
+ conses[4] = new Consensus("G", 50);\r
+ conses[5] = new Consensus("N", 50);\r
+ conses[6] = new Consensus("QE", 50);\r
+ conses[7] = new Consensus("P", 50);\r
+ conses[8] = new Consensus("TS", 50);\r
+\r
+ conses[26] = new Consensus("A", 85);\r
+ conses[27] = new Consensus("C", 85);\r
+ conses[10] = new Consensus("E", 85);\r
+ conses[11] = new Consensus("F", 85);\r
+ conses[12] = new Consensus("G", 85);\r
+ conses[13] = new Consensus("H", 85);\r
+ conses[14] = new Consensus("I", 85);\r
+ conses[15] = new Consensus("L", 85);\r
+ conses[16] = new Consensus("M", 85);\r
+ conses[17] = new Consensus("N", 85);\r
+ conses[18] = new Consensus("P", 85);\r
+ conses[19] = new Consensus("Q", 85);\r
+ conses[20] = new Consensus("R", 85);\r
+ conses[21] = new Consensus("S", 85);\r
+ conses[22] = new Consensus("T", 85);\r
+ conses[23] = new Consensus("V", 85);\r
+ conses[24] = new Consensus("W", 85);\r
+ conses[25] = new Consensus("Y", 85);\r
+ conses[28] = new Consensus("K", 85);\r
+ conses[29] = new Consensus("D", 85);\r
+\r
+ conses[30] = new Consensus("G", 0);\r
+ conses[31] = new Consensus("P", 0);\r
+\r
+ // We now construct the colours\r
+ colours = new ConsensusColour[11];\r
+\r
+ Consensus[] tmp8 = new Consensus[1];\r
+ tmp8[0] = conses[30]; //G\r
+ colours[7] = new ConsensusColour( (Color) colhash.get("ORANGE"), tmp8);\r
+\r
+ Consensus[] tmp9 = new Consensus[1];\r
+ tmp9[0] = conses[31]; //P\r
+ colours[8] = new ConsensusColour( (Color) colhash.get("YELLOW"), tmp9);\r
+\r
+ Consensus[] tmp10 = new Consensus[1];\r
+ tmp10[0] = conses[27]; //C\r
+ colours[9] = new ConsensusColour( (Color) colhash.get("PINK"), tmp8);\r
+\r
+ Consensus[] tmp1 = new Consensus[14];\r
+ tmp1[0] = conses[0]; //%\r
+ tmp1[1] = conses[1]; //#\r
+ tmp1[2] = conses[26]; //A\r
+ tmp1[3] = conses[27]; //C\r
+ tmp1[4] = conses[11]; //F\r
+ tmp1[5] = conses[13]; //H\r
+ tmp1[6] = conses[14]; //I\r
+ tmp1[7] = conses[15]; //L\r
+ tmp1[8] = conses[16]; //M\r
+ tmp1[9] = conses[23]; //V\r
+ tmp1[10] = conses[24]; //W\r
+ tmp1[11] = conses[25]; //Y\r
+ tmp1[12] = conses[18]; //P\r
+ tmp1[13] = conses[19]; //p\r
+ colours[0] = new ConsensusColour( (Color) colhash.get("BLUE"), tmp1);\r
+\r
+ colours[10] = new ConsensusColour( (Color) colhash.get("CYAN"), tmp1);\r
+\r
+ Consensus[] tmp2 = new Consensus[5];\r
+ tmp2[0] = conses[8]; //t\r
+ tmp2[1] = conses[21]; //S\r
+ tmp2[2] = conses[22]; //T\r
+ tmp2[3] = conses[0]; //%\r
+ tmp2[4] = conses[1]; //#\r
+ colours[1] = new ConsensusColour( (Color) colhash.get("GREEN"), tmp2);\r
+\r
+ Consensus[] tmp3 = new Consensus[3];\r
+\r
+ tmp3[0] = conses[17]; //N\r
+ tmp3[1] = conses[29]; //D\r
+ tmp3[2] = conses[5]; //n\r
+ colours[2] = new ConsensusColour( (Color) colhash.get("GREEN"), tmp3);\r
+\r
+ Consensus[] tmp4 = new Consensus[6];\r
+ tmp4[0] = conses[6]; // q = QE\r
+ tmp4[1] = conses[19]; //Q\r
+ tmp4[2] = conses[22]; //E\r
+ tmp4[3] = conses[3]; //+\r
+ tmp4[4] = conses[28]; //K\r
+ tmp4[5] = conses[20]; //R\r
+ colours[3] = new ConsensusColour( (Color) colhash.get("GREEN"), tmp4);\r
+\r
+ Consensus[] tmp5 = new Consensus[4];\r
+ tmp5[0] = conses[3]; //+\r
+ tmp5[1] = conses[28]; //K\r
+ tmp5[2] = conses[20]; //R\r
+ tmp5[3] = conses[19]; //Q\r
+ colours[4] = new ConsensusColour( (Color) colhash.get("RED"), tmp5);\r
+\r
+ Consensus[] tmp6 = new Consensus[5];\r
+ tmp6[0] = conses[3]; //-\r
+ tmp6[1] = conses[29]; //D\r
+ tmp6[2] = conses[10]; //E\r
+ tmp6[3] = conses[6]; //q\r
+ tmp6[4] = conses[19]; //Q\r
+ colours[5] = new ConsensusColour( (Color) colhash.get("MAGENTA"), tmp6);\r
+\r
+ Consensus[] tmp7 = new Consensus[5];\r
+ tmp7[0] = conses[3]; //-\r
+ tmp7[1] = conses[29]; //D\r
+ tmp7[2] = conses[10]; //E\r
+ tmp7[3] = conses[17]; //N\r
+ tmp7[4] = conses[2]; //DE\r
+ colours[6] = new ConsensusColour( (Color) colhash.get("MAGENTA"), tmp7);\r
+\r
+ // Now attach the ConsensusColours to the residue letters\r
+ ResidueColour = new ConsensusColour[20];\r
+ ResidueColour[0] = colours[0]; // A\r
+ ResidueColour[1] = colours[4]; // R\r
+ ResidueColour[2] = colours[2]; // N\r
+ ResidueColour[3] = colours[6]; // D\r
+ ResidueColour[4] = colours[0]; // C\r
+ ResidueColour[5] = colours[3]; // Q\r
+ ResidueColour[6] = colours[5]; // E\r
+ ResidueColour[7] = colours[7]; // G\r
+ ResidueColour[8] = colours[10]; // H\r
+ ResidueColour[9] = colours[0]; // I\r
+ ResidueColour[10] = colours[0]; // L\r
+ ResidueColour[11] = colours[4]; // K\r
+ ResidueColour[12] = colours[0]; // M\r
+ ResidueColour[13] = colours[0]; // F\r
+ ResidueColour[14] = colours[8]; // P\r
+ ResidueColour[15] = colours[1]; // S\r
+ ResidueColour[16] = colours[1]; // T\r
+ ResidueColour[17] = colours[0]; // W\r
+ ResidueColour[18] = colours[10]; // Y\r
+ ResidueColour[19] = colours[0]; // V\r
+ }\r
+\r
+ public Color findColour(String s)\r
+ {\r
+ return Color.pink;\r
+ }\r
+\r
+ public Color findColour(String s, int j)\r
+ {\r
+ if ( (threshold != 0) && !aboveThreshold(s, j))\r
+ {\r
+ return Color.white;\r
}\r
\r
- public Color findColour(String s, int j) {\r
- if ((threshold != 0) && !aboveThreshold(s, j)) {\r
- return Color.white;\r
- }\r
-\r
- int i = ((Integer) ResidueProperties.aaHash.get(s)).intValue();\r
+ int i = ( (Integer) ResidueProperties.aaHash.get(s)).intValue();\r
\r
- Color c = Color.white;\r
+ Color c = Color.white;\r
\r
- if (i > 19) {\r
- return c;\r
- }\r
-\r
- for (int k = 0; k < ResidueColour[i].conses.length; k++)\r
- if (ResidueColour[i].conses[k].isConserved(cons2, j, size)) {\r
- c = ResidueColour[i].c;\r
- }\r
+ if (i > 19)\r
+ {\r
+ return c;\r
+ }\r
\r
- if (i == 4) {\r
- if (conses[27].isConserved(cons2, j, size)) {\r
- c = (Color) colhash.get("PINK");\r
- }\r
- }\r
+ for (int k = 0; k < ResidueColour[i].conses.length; k++)\r
+ {\r
+ if (ResidueColour[i].conses[k].isConserved(cons2, j, size))\r
+ {\r
+ c = ResidueColour[i].c;\r
+ }\r
+ }\r
\r
- return c;\r
+ if (i == 4)\r
+ {\r
+ if (conses[27].isConserved(cons2, j, size))\r
+ {\r
+ c = (Color) colhash.get("PINK");\r
+ }\r
}\r
-}\r
\r
+ return c;\r
+ }\r
+}\r
\r
-class ConsensusColour {\r
- Consensus[] conses;\r
- Color c;\r
+class ConsensusColour\r
+{\r
+ Consensus[] conses;\r
+ Color c;\r
\r
- public ConsensusColour(Color c, Consensus[] conses) {\r
- this.conses = conses;\r
+ public ConsensusColour(Color c, Consensus[] conses)\r
+ {\r
+ this.conses = conses;\r
\r
- // this.list = list;\r
- this.c = c;\r
- }\r
+ // this.list = list;\r
+ this.c = c;\r
+ }\r
}\r
/*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
-*\r
-* This program is free software; you can redistribute it and/or\r
-* modify it under the terms of the GNU General Public License\r
-* as published by the Free Software Foundation; either version 2\r
-* of the License, or (at your option) any later version.\r
-*\r
-* This program is distributed in the hope that it will be useful,\r
-* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-* GNU General Public License for more details.\r
-*\r
-* You should have received a copy of the GNU General Public License\r
-* along with this program; if not, write to the Free Software\r
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
-*/\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
+ */\r
package jalview.schemes;\r
\r
-import java.awt.*;\r
-\r
import java.util.*;\r
\r
+import java.awt.*;\r
\r
-public interface ColourSchemeI {\r
- public Color findColour(String aa);\r
+public interface ColourSchemeI\r
+{\r
+ public Color findColour(String aa);\r
\r
- public Color findColour(String s, int j);\r
+ public Color findColour(String s, int j);\r
\r
- public void setConsensus(Vector v);\r
+ public void setConsensus(Vector v);\r
}\r
*/\r
package jalview.schemes;\r
\r
-public class ColourSchemeProperty {\r
+import java.awt.*;\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class ColourSchemeProperty\r
+{\r
+ /** DOCUMENT ME!! */\r
public static final int CLUSTAL = 0;\r
+\r
+ /** DOCUMENT ME!! */\r
public static final int BLOSUM = 1;\r
+\r
+ /** DOCUMENT ME!! */\r
public static final int PID = 2;\r
+\r
+ /** DOCUMENT ME!! */\r
public static final int ZAPPO = 3;\r
+\r
+ /** DOCUMENT ME!! */\r
public static final int HYDROPHOBIC = 4;\r
+\r
+ /** DOCUMENT ME!! */\r
public static final int HELIX = 5;\r
+\r
+ /** DOCUMENT ME!! */\r
public static final int STRAND = 6;\r
+\r
+ /** DOCUMENT ME!! */\r
public static final int TURN = 7;\r
+\r
+ /** DOCUMENT ME!! */\r
public static final int BURIED = 8;\r
+\r
+ /** DOCUMENT ME!! */\r
public static final int NUCLEOTIDE = 9;\r
+\r
+ /** DOCUMENT ME!! */\r
public static final int USER_DEFINED = 10;\r
+\r
+ /** DOCUMENT ME!! */\r
public static final int NONE = 11;\r
\r
- public static int getColourIndexFromName(String name) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param name DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public static int getColourIndexFromName(String name)\r
+ {\r
int ret = 11;\r
\r
- if (name.equalsIgnoreCase("Clustal")) {\r
+ if (name.equalsIgnoreCase("Clustal"))\r
+ {\r
ret = CLUSTAL;\r
- } else if (name.equalsIgnoreCase("Blosum62")) {\r
+ }\r
+ else if (name.equalsIgnoreCase("Blosum62"))\r
+ {\r
ret = BLOSUM;\r
- } else if (name.equalsIgnoreCase("% Identity")) {\r
+ }\r
+ else if (name.equalsIgnoreCase("% Identity"))\r
+ {\r
ret = PID;\r
- } else if (name.equalsIgnoreCase("Zappo")) {\r
+ }\r
+ else if (name.equalsIgnoreCase("Zappo"))\r
+ {\r
ret = ZAPPO;\r
- } else if (name.equalsIgnoreCase("Hydrophobic")) {\r
+ }\r
+ else if (name.equalsIgnoreCase("Hydrophobic"))\r
+ {\r
ret = HYDROPHOBIC;\r
- } else if (name.equalsIgnoreCase("Helix Propensity")) {\r
+ }\r
+ else if (name.equalsIgnoreCase("Helix Propensity"))\r
+ {\r
ret = HELIX;\r
- } else if (name.equalsIgnoreCase("Strand Propensity")) {\r
+ }\r
+ else if (name.equalsIgnoreCase("Strand Propensity"))\r
+ {\r
ret = STRAND;\r
- } else if (name.equalsIgnoreCase("Turn Propensity")) {\r
+ }\r
+ else if (name.equalsIgnoreCase("Turn Propensity"))\r
+ {\r
ret = TURN;\r
- } else if (name.equalsIgnoreCase("Buried Index")) {\r
+ }\r
+ else if (name.equalsIgnoreCase("Buried Index"))\r
+ {\r
ret = BURIED;\r
- } else if (name.equalsIgnoreCase("Nucleotide")) {\r
+ }\r
+ else if (name.equalsIgnoreCase("Nucleotide"))\r
+ {\r
ret = NUCLEOTIDE;\r
- } else if (name.equalsIgnoreCase("User Defined")) {\r
+ }\r
+ else if (name.equalsIgnoreCase("User Defined"))\r
+ {\r
ret = USER_DEFINED;\r
}\r
\r
return ret;\r
}\r
\r
- public static String getColourName(ColourSchemeI cs) {\r
- if (cs instanceof ConservationColourScheme) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param cs DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public static String getColourName(ColourSchemeI cs)\r
+ {\r
+ if (cs instanceof ConservationColourScheme)\r
+ {\r
cs = ((ConservationColourScheme) cs).cs;\r
}\r
\r
int index = 11;\r
\r
- if (cs instanceof ClustalxColourScheme) {\r
+ if (cs instanceof ClustalxColourScheme)\r
+ {\r
index = CLUSTAL;\r
- } else if (cs instanceof Blosum62ColourScheme) {\r
+ }\r
+ else if (cs instanceof Blosum62ColourScheme)\r
+ {\r
index = BLOSUM;\r
- } else if (cs instanceof PIDColourScheme) {\r
+ }\r
+ else if (cs instanceof PIDColourScheme)\r
+ {\r
index = PID;\r
- } else if (cs instanceof ZappoColourScheme) {\r
+ }\r
+ else if (cs instanceof ZappoColourScheme)\r
+ {\r
index = ZAPPO;\r
- } else if (cs instanceof HydrophobicColourScheme) {\r
+ }\r
+ else if (cs instanceof HydrophobicColourScheme)\r
+ {\r
index = HYDROPHOBIC;\r
- } else if (cs instanceof HelixColourScheme) {\r
+ }\r
+ else if (cs instanceof HelixColourScheme)\r
+ {\r
index = HELIX;\r
- } else if (cs instanceof StrandColourScheme) {\r
+ }\r
+ else if (cs instanceof StrandColourScheme)\r
+ {\r
index = STRAND;\r
- } else if (cs instanceof TurnColourScheme) {\r
+ }\r
+ else if (cs instanceof TurnColourScheme)\r
+ {\r
index = TURN;\r
- } else if (cs instanceof BuriedColourScheme) {\r
+ }\r
+ else if (cs instanceof BuriedColourScheme)\r
+ {\r
index = BURIED;\r
- } else if (cs instanceof NucleotideColourScheme) {\r
+ }\r
+ else if (cs instanceof NucleotideColourScheme)\r
+ {\r
index = NUCLEOTIDE;\r
- } else if (cs instanceof UserColourScheme) {\r
+ }\r
+ else if (cs instanceof UserColourScheme)\r
+ {\r
index = USER_DEFINED;\r
}\r
\r
return getColourName(index);\r
}\r
\r
- public static String getColourName(int index) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param index DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public static String getColourName(int index)\r
+ {\r
String ret = null;\r
\r
- switch (index) {\r
+ switch (index)\r
+ {\r
case CLUSTAL:\r
ret = "Clustal";\r
\r
return ret;\r
}\r
\r
- public static ColourSchemeI getColour(jalview.datamodel.AlignmentI al, String name)\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param al DOCUMENT ME!\r
+ * @param name DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public static ColourSchemeI getColour(jalview.datamodel.AlignmentI al,\r
+ String name)\r
{\r
- return getColour(al.getSequences(), al.getWidth(), name);\r
+ return getColour(al.getSequences(), al.getWidth(), name);\r
}\r
\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param seqs DOCUMENT ME!\r
+ * @param width DOCUMENT ME!\r
+ * @param name DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
public static ColourSchemeI getColour(java.util.Vector seqs, int width,\r
- String name) {\r
+ String name)\r
+ {\r
return getColour(seqs, width, getColourIndexFromName(name));\r
}\r
\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param seqs DOCUMENT ME!\r
+ * @param width DOCUMENT ME!\r
+ * @param index DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
public static ColourSchemeI getColour(java.util.Vector seqs, int width,\r
- int index) {\r
+ int index)\r
+ {\r
ColourSchemeI cs = null;\r
\r
- switch (index) {\r
+ switch (index)\r
+ {\r
case CLUSTAL:\r
cs = new ClustalxColourScheme(seqs, width);\r
\r
break;\r
\r
case USER_DEFINED:\r
- cs = new UserColourScheme(null);\r
+ cs = new UserColourScheme(new Color[0]);\r
\r
break;\r
\r
\r
return cs;\r
}\r
+\r
+ public static Color getAWTColorFromName(String name)\r
+ {\r
+ Color col = null;\r
+ name = name.toLowerCase();\r
+ if(name.equals("black"))\r
+ col = Color.black;\r
+ else if(name.equals("blue"))\r
+ col = Color.blue;\r
+ else if(name.equals("cyan"))\r
+ col = Color.cyan;\r
+ else if(name.equals("darkGray"))\r
+ col = Color.darkGray;\r
+ else if(name.equals("gray"))\r
+ col = Color.gray;\r
+ else if(name.equals("green"))\r
+ col = Color.green;\r
+ else if(name.equals("lightGray"))\r
+ col = Color.lightGray;\r
+ else if(name.equals("magenta"))\r
+ col = Color.magenta;\r
+ else if(name.equals("orange"))\r
+ col = Color.orange;\r
+ else if(name.equals("pink"))\r
+ col = Color.pink;\r
+ else if(name.equals("red"))\r
+ col = Color.red;\r
+ else if(name.equals("white"))\r
+ col = Color.white;\r
+ else if(name.equals("yellow"))\r
+ col = Color.yellow;\r
+\r
+ return col;\r
+ }\r
}\r
/*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
-*\r
-* This program is free software; you can redistribute it and/or\r
-* modify it under the terms of the GNU General Public License\r
-* as published by the Free Software Foundation; either version 2\r
-* of the License, or (at your option) any later version.\r
-*\r
-* This program is distributed in the hope that it will be useful,\r
-* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-* GNU General Public License for more details.\r
-*\r
-* You should have received a copy of the GNU General Public License\r
-* along with this program; if not, write to the Free Software\r
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
-*/\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
+ */\r
package jalview.schemes;\r
\r
-\r
////////////////////////////////////////////\r
// This does nothing at all at the moment!!!!!!!!!!\r
// AW 15th Dec 2004\r
/////////////////////////////////////////\r
-public class Consensus {\r
- int[] mask;\r
- double threshold;\r
- String maskstr;\r
-\r
- public Consensus(String mask, double threshold) {\r
- // this.id = id;\r
- // this.mask = mask;\r
- this.maskstr = mask;\r
- setMask(mask);\r
- this.threshold = threshold;\r
- }\r
+public class Consensus\r
+{\r
+ int[] mask;\r
+ double threshold;\r
+ String maskstr;\r
\r
- public void setMask(String s) {\r
- this.mask = setNums(s);\r
+ public Consensus(String mask, double threshold)\r
+ {\r
+ // this.id = id;\r
+ // this.mask = mask;\r
+ this.maskstr = mask;\r
+ setMask(mask);\r
+ this.threshold = threshold;\r
+ }\r
\r
- // for (int i=0; i < mask.length; i++) {\r
- // System.out.println(mask[i] + " " + ResidueProperties.aa[mask[i]]);\r
- // }\r
- }\r
+ public void setMask(String s)\r
+ {\r
+ this.mask = setNums(s);\r
\r
- public boolean isConserved(int[][] cons2, int col, int size) {\r
- int tot = 0;\r
+ // for (int i=0; i < mask.length; i++) {\r
+ // System.out.println(mask[i] + " " + ResidueProperties.aa[mask[i]]);\r
+ // }\r
+ }\r
\r
- for (int i = 0; i < mask.length; i++)\r
- tot += cons2[col][mask[i]];\r
+ public boolean isConserved(int[][] cons2, int col, int size)\r
+ {\r
+ int tot = 0;\r
\r
- if ((double) tot > ((threshold * size) / 100)) {\r
- return true;\r
- }\r
+ for (int i = 0; i < mask.length; i++)\r
+ {\r
+ tot += cons2[col][mask[i]];\r
+ }\r
\r
- return false;\r
+ if ( (double) tot > ( (threshold * size) / 100))\r
+ {\r
+ return true;\r
}\r
\r
- int[] setNums(String s) {\r
- int[] out = new int[s.length()];\r
- int i = 0;\r
+ return false;\r
+ }\r
\r
- while (i < s.length()) {\r
- out[i] = ((Integer) ResidueProperties.aaHash.get(s.substring(i,\r
- i + 1))).intValue();\r
- i++;\r
- }\r
+ int[] setNums(String s)\r
+ {\r
+ int[] out = new int[s.length()];\r
+ int i = 0;\r
\r
- return out;\r
+ while (i < s.length())\r
+ {\r
+ out[i] = ( (Integer) ResidueProperties.aaHash.get(s.substring(i,\r
+ i + 1))).intValue();\r
+ i++;\r
}\r
+\r
+ return out;\r
+ }\r
}\r
import java.util.Vector;\r
\r
\r
-public class ConservationColourScheme extends ResidueColourScheme {\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class ConservationColourScheme extends ResidueColourScheme\r
+{\r
+ /** DOCUMENT ME!! */\r
public Conservation conserve;\r
+\r
+ /** DOCUMENT ME!! */\r
public ColourSchemeI cs;\r
+\r
+ /** DOCUMENT ME!! */\r
public int inc = 30;\r
\r
- public ConservationColourScheme(Conservation cons, ColourSchemeI oldcs) {\r
+ /**\r
+ * Creates a new ConservationColourScheme object.\r
+ *\r
+ * @param cons DOCUMENT ME!\r
+ * @param oldcs DOCUMENT ME!\r
+ */\r
+ public ConservationColourScheme(Conservation cons, ColourSchemeI oldcs)\r
+ {\r
super();\r
conserve = cons;\r
cs = oldcs;\r
}\r
\r
- public void setConsensus(Vector consensus) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param consensus DOCUMENT ME!\r
+ */\r
+ public void setConsensus(Vector consensus)\r
+ {\r
this.consensus = consensus;\r
\r
- if (cs != null) {\r
+ if (cs != null)\r
+ {\r
cs.setConsensus(consensus);\r
}\r
}\r
\r
- public Color findColour(String s, int i) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param s DOCUMENT ME!\r
+ * @param i DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public Color findColour(String s, int i)\r
+ {\r
Color c = Color.white;\r
\r
- if (cs == null) {\r
+ if (cs == null)\r
+ {\r
return c;\r
}\r
\r
char ch = conserve.getConsSequence().getSequence().charAt(i);\r
\r
- if ((ch == '*') || (ch == '+')) {\r
+ if ((ch == '*') || (ch == '+'))\r
+ {\r
c = cs.findColour(s, i);\r
- } else {\r
+ }\r
+ else\r
+ {\r
int tmp = 10;\r
int t = 0;\r
\r
- if (!jalview.util.Comparison.isGap(ch)) {\r
+ if (!jalview.util.Comparison.isGap(ch))\r
+ {\r
t = Integer.parseInt(ch + "");\r
}\r
\r
c = cs.findColour(s, i);\r
\r
- while (tmp >= t) {\r
+ while (tmp >= t)\r
+ {\r
c = lighter(c, inc);\r
tmp--;\r
}\r
return c;\r
}\r
\r
- public Color lighter(Color c, int inc) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param c DOCUMENT ME!\r
+ * @param inc DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public Color lighter(Color c, int inc)\r
+ {\r
int red = c.getRed();\r
int blue = c.getBlue();\r
int green = c.getGreen();\r
\r
- if (red < (255 - inc)) {\r
+ if (red < (255 - inc))\r
+ {\r
red = red + inc;\r
- } else {\r
+ }\r
+ else\r
+ {\r
red = 255;\r
}\r
\r
- if (blue < (255 - inc)) {\r
+ if (blue < (255 - inc))\r
+ {\r
blue = blue + inc;\r
- } else {\r
+ }\r
+ else\r
+ {\r
blue = 255;\r
}\r
\r
- if (green < (255 - inc)) {\r
+ if (green < (255 - inc))\r
+ {\r
green = green + inc;\r
- } else {\r
+ }\r
+ else\r
+ {\r
green = 255;\r
}\r
\r
/*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
-*\r
-* This program is free software; you can redistribute it and/or\r
-* modify it under the terms of the GNU General Public License\r
-* as published by the Free Software Foundation; either version 2\r
-* of the License, or (at your option) any later version.\r
-*\r
-* This program is distributed in the hope that it will be useful,\r
-* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-* GNU General Public License for more details.\r
-*\r
-* You should have received a copy of the GNU General Public License\r
-* along with this program; if not, write to the Free Software\r
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
-*/\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
+ */\r
package jalview.schemes;\r
\r
import java.awt.*;\r
\r
+public class HelixColourScheme\r
+ extends ScoreColourScheme\r
+{\r
+ public HelixColourScheme()\r
+ {\r
+ super(ResidueProperties.helix, ResidueProperties.helixmin,\r
+ ResidueProperties.helixmax);\r
+ }\r
\r
-public class HelixColourScheme extends ScoreColourScheme {\r
- public HelixColourScheme() {\r
- super(ResidueProperties.helix, ResidueProperties.helixmin,\r
- ResidueProperties.helixmax);\r
- }\r
-\r
- public Color makeColour(float c) {\r
- return new Color(c, (float) 1.0 - c, c);\r
- }\r
+ public Color makeColour(float c)\r
+ {\r
+ return new Color(c, (float) 1.0 - c, c);\r
+ }\r
}\r
import java.awt.*;\r
\r
\r
-public class HydrophobicColourScheme extends ScoreColourScheme {\r
- public HydrophobicColourScheme() {\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class HydrophobicColourScheme extends ScoreColourScheme\r
+{\r
+ /**\r
+ * Creates a new HydrophobicColourScheme object.\r
+ */\r
+ public HydrophobicColourScheme()\r
+ {\r
super(ResidueProperties.hyd, ResidueProperties.hydmin,\r
ResidueProperties.hydmax);\r
}\r
\r
- public Color makeColour(float c) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param c DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public Color makeColour(float c)\r
+ {\r
return new Color(c, (float) 0.0, (float) 1.0 - c);\r
}\r
}\r
import java.awt.*;\r
\r
\r
-public class NucleotideColourScheme extends ResidueColourScheme {\r
- public NucleotideColourScheme() {\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class NucleotideColourScheme extends ResidueColourScheme\r
+{\r
+ /**\r
+ * Creates a new NucleotideColourScheme object.\r
+ */\r
+ public NucleotideColourScheme()\r
+ {\r
super(ResidueProperties.nucleotide, 0);\r
}\r
\r
- public Color findColour(String n) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param n DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public Color findColour(String n)\r
+ {\r
// System.out.println("called"); log.debug\r
return colors[((Integer) (ResidueProperties.nucleotideHash.get(n))).intValue()];\r
}\r
\r
- public Color findColour(String n, int j) {\r
- if ((threshold == 0) || aboveThreshold(n, j)) {\r
- try {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param n DOCUMENT ME!\r
+ * @param j DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public Color findColour(String n, int j)\r
+ {\r
+ if ((threshold == 0) || aboveThreshold(n, j))\r
+ {\r
+ try\r
+ {\r
return colors[((Integer) (ResidueProperties.nucleotideHash.get(n))).intValue()];\r
- } catch (Exception ex) {\r
+ }\r
+ catch (Exception ex)\r
+ {\r
return Color.white;\r
}\r
- } else {\r
+ }\r
+ else\r
+ {\r
return Color.white;\r
}\r
}\r
/*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
-*\r
-* This program is free software; you can redistribute it and/or\r
-* modify it under the terms of the GNU General Public License\r
-* as published by the Free Software Foundation; either version 2\r
-* of the License, or (at your option) any later version.\r
-*\r
-* This program is distributed in the hope that it will be useful,\r
-* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-* GNU General Public License for more details.\r
-*\r
-* You should have received a copy of the GNU General Public License\r
-* along with this program; if not, write to the Free Software\r
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
-*/\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
+ */\r
package jalview.schemes;\r
\r
-import jalview.datamodel.*;\r
+import java.util.*;\r
\r
import java.awt.*;\r
\r
-import java.util.*;\r
+import jalview.datamodel.*;\r
\r
+public class PIDColourScheme\r
+ extends ResidueColourScheme\r
+{\r
+ public Color[] pidColours;\r
+ public float[] thresholds;\r
+ SequenceGroup group;\r
\r
-public class PIDColourScheme extends ResidueColourScheme {\r
- public Color[] pidColours;\r
- public float[] thresholds;\r
- SequenceGroup group;\r
+ public PIDColourScheme()\r
+ {\r
+ this.pidColours = ResidueProperties.pidColours;\r
+ this.thresholds = ResidueProperties.pidThresholds;\r
+ }\r
\r
- public PIDColourScheme() {\r
- this.pidColours = ResidueProperties.pidColours;\r
- this.thresholds = ResidueProperties.pidThresholds;\r
+ public Color findColour(String s, int j)\r
+ {\r
+ if ( (threshold != 0) && !aboveThreshold(s, j))\r
+ {\r
+ return Color.white;\r
}\r
\r
- public Color findColour(String s, int j) {\r
- if ((threshold != 0) && !aboveThreshold(s, j)) {\r
- return Color.white;\r
- }\r
-\r
- Color c = Color.white;\r
- Hashtable hash = (Hashtable) consensus.elementAt(j);\r
+ Color c = Color.white;\r
+ Hashtable hash = (Hashtable) consensus.elementAt(j);\r
\r
- double sc = 0;\r
+ double sc = 0;\r
\r
- if ((Integer.parseInt(hash.get("maxCount").toString()) != -1) &&\r
- hash.contains(s)) {\r
- sc = (((Integer) hash.get(s)).intValue() * 100.0) / ((Integer) hash.get(\r
- "size")).intValue();\r
+ if ( (Integer.parseInt(hash.get("maxCount").toString()) != -1) &&\r
+ hash.contains(s))\r
+ {\r
+ sc = ( ( (Integer) hash.get(s)).intValue() * 100.0) /\r
+ ( (Integer) hash.get(\r
+ "size")).intValue();\r
\r
- // MC Should be isGap\r
- if (!jalview.util.Comparison.isGap((s.charAt(0)))) {\r
- for (int i = 0; i < thresholds.length; i++) {\r
- if (sc > thresholds[i]) {\r
- c = pidColours[i];\r
+ // MC Should be isGap\r
+ if (!jalview.util.Comparison.isGap( (s.charAt(0))))\r
+ {\r
+ for (int i = 0; i < thresholds.length; i++)\r
+ {\r
+ if (sc > thresholds[i])\r
+ {\r
+ c = pidColours[i];\r
\r
- break;\r
- }\r
- }\r
- }\r
+ break;\r
+ }\r
}\r
-\r
- return c;\r
+ }\r
}\r
+\r
+ return c;\r
+ }\r
}\r
import java.util.*;\r
\r
\r
-public class ResidueColourScheme implements ColourSchemeI {\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class ResidueColourScheme implements ColourSchemeI\r
+{\r
Color[] colors;\r
int threshold = 0;\r
+\r
+ /** DOCUMENT ME!! */\r
public Vector consensus;\r
\r
- public ResidueColourScheme(Color[] colors, int threshold) {\r
+ /**\r
+ * Creates a new ResidueColourScheme object.\r
+ *\r
+ * @param colors DOCUMENT ME!\r
+ * @param threshold DOCUMENT ME!\r
+ */\r
+ public ResidueColourScheme(Color[] colors, int threshold)\r
+ {\r
this.colors = colors;\r
this.threshold = threshold;\r
}\r
\r
- public ResidueColourScheme() {\r
+ /**\r
+ * Creates a new ResidueColourScheme object.\r
+ */\r
+ public ResidueColourScheme()\r
+ {\r
}\r
\r
- public void setConsensus(Vector consensus) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param consensus DOCUMENT ME!\r
+ */\r
+ public void setConsensus(Vector consensus)\r
+ {\r
this.consensus = consensus;\r
}\r
\r
- public Color findColour(String aa) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param aa DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public Color findColour(String aa)\r
+ {\r
return colors[((Integer) (ResidueProperties.aaHash.get(aa))).intValue()];\r
}\r
\r
- public Color findColour(String s, int j) {\r
- if ((threshold == 0) || aboveThreshold(s, j)) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param s DOCUMENT ME!\r
+ * @param j DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public Color findColour(String s, int j)\r
+ {\r
+ if ((threshold == 0) || aboveThreshold(s, j))\r
+ {\r
return colors[((Integer) (ResidueProperties.aaHash.get(s))).intValue()];\r
- } else {\r
+ }\r
+ else\r
+ {\r
return Color.white;\r
}\r
}\r
\r
- public int getThreshold() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public int getThreshold()\r
+ {\r
return threshold;\r
}\r
\r
- public void setThreshold(int ct) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param ct DOCUMENT ME!\r
+ */\r
+ public void setThreshold(int ct)\r
+ {\r
threshold = ct;\r
}\r
\r
- public boolean aboveThreshold(String s, int j) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param s DOCUMENT ME!\r
+ * @param j DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public boolean aboveThreshold(String s, int j)\r
+ {\r
Hashtable hash = (Hashtable) consensus.elementAt(j);\r
\r
if ((((Integer) hash.get("maxCount")).intValue() != -1) &&\r
- hash.contains(s)) {\r
+ hash.contains(s))\r
+ {\r
//// resCount//////////////////// ///////////////seq count////////////\r
double sc = (((Integer) hash.get(s)).intValue() * 100.0) / ((Integer) hash.get(\r
"size")).intValue();\r
\r
- if (sc >= threshold) {\r
+ if (sc >= threshold)\r
+ {\r
return true;\r
}\r
}\r
/*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
-*\r
-* This program is free software; you can redistribute it and/or\r
-* modify it under the terms of the GNU General Public License\r
-* as published by the Free Software Foundation; either version 2\r
-* of the License, or (at your option) any later version.\r
-*\r
-* This program is distributed in the hope that it will be useful,\r
-* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-* GNU General Public License for more details.\r
-*\r
-* You should have received a copy of the GNU General Public License\r
-* along with this program; if not, write to the Free Software\r
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
-*/\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
+ */\r
package jalview.schemes;\r
\r
-import java.awt.Color;\r
-\r
import java.util.*;\r
\r
-\r
-public class ResidueProperties {\r
- //Stores residue codes/names and colours and other things\r
- public static Hashtable aaHash = new Hashtable(); // stores the number value of the aa\r
- public static Hashtable aa3Hash = new Hashtable();\r
- public static Hashtable aa2Triplet = new Hashtable();\r
- public static Hashtable nucleotideHash = new Hashtable();\r
-\r
- static {\r
- aaHash.put("A", new Integer(0));\r
- aaHash.put("R", new Integer(1));\r
- aaHash.put("N", new Integer(2));\r
- aaHash.put("D", new Integer(3));\r
- aaHash.put("C", new Integer(4));\r
- aaHash.put("Q", new Integer(5));\r
- aaHash.put("E", new Integer(6));\r
- aaHash.put("G", new Integer(7));\r
- aaHash.put("H", new Integer(8));\r
- aaHash.put("I", new Integer(9));\r
- aaHash.put("L", new Integer(10));\r
- aaHash.put("K", new Integer(11));\r
- aaHash.put("M", new Integer(12));\r
- aaHash.put("F", new Integer(13));\r
- aaHash.put("P", new Integer(14));\r
- aaHash.put("S", new Integer(15));\r
- aaHash.put("T", new Integer(16));\r
- aaHash.put("W", new Integer(17));\r
- aaHash.put("Y", new Integer(18));\r
- aaHash.put("V", new Integer(19));\r
- aaHash.put("B", new Integer(20));\r
- aaHash.put("Z", new Integer(21));\r
- aaHash.put("X", new Integer(22));\r
- aaHash.put("a", new Integer(0));\r
- aaHash.put("r", new Integer(1));\r
- aaHash.put("n", new Integer(2));\r
- aaHash.put("d", new Integer(3));\r
- aaHash.put("c", new Integer(4));\r
- aaHash.put("q", new Integer(5));\r
- aaHash.put("e", new Integer(6));\r
- aaHash.put("g", new Integer(7));\r
- aaHash.put("h", new Integer(8));\r
- aaHash.put("i", new Integer(9));\r
- aaHash.put("l", new Integer(10));\r
- aaHash.put("k", new Integer(11));\r
- aaHash.put("m", new Integer(12));\r
- aaHash.put("f", new Integer(13));\r
- aaHash.put("p", new Integer(14));\r
- aaHash.put("s", new Integer(15));\r
- aaHash.put("t", new Integer(16));\r
- aaHash.put("w", new Integer(17));\r
- aaHash.put("y", new Integer(18));\r
- aaHash.put("v", new Integer(19));\r
- aaHash.put("b", new Integer(20));\r
- aaHash.put("z", new Integer(21));\r
- aaHash.put("x", new Integer(22));\r
- aaHash.put("-", new Integer(23));\r
- aaHash.put("*", new Integer(23));\r
- aaHash.put(".", new Integer(23));\r
- aaHash.put(" ", new Integer(23));\r
- }\r
-\r
- static {\r
- nucleotideHash.put("A", new Integer(0));\r
- nucleotideHash.put("C", new Integer(1));\r
- nucleotideHash.put("G", new Integer(2));\r
- nucleotideHash.put("T", new Integer(3));\r
- nucleotideHash.put("U", new Integer(4));\r
- }\r
-\r
- // These numbers should correspond to the indices in the Color hashes\r
- public static Hashtable aaSpecialsHash = new Hashtable();\r
-\r
- static {\r
- aaSpecialsHash.put("-", new Integer(23));\r
- aaSpecialsHash.put("*", new Integer(24));\r
- aaSpecialsHash.put(".", new Integer(25));\r
- aaSpecialsHash.put(" ", new Integer(26));\r
- }\r
-\r
- static {\r
- aa3Hash.put("ALA", new Integer(0));\r
- aa3Hash.put("ARG", new Integer(1));\r
- aa3Hash.put("ASN", new Integer(2));\r
- aa3Hash.put("ASP", new Integer(3)); //D\r
- aa3Hash.put("CYS", new Integer(4));\r
- aa3Hash.put("GLN", new Integer(5)); //Q\r
- aa3Hash.put("GLU", new Integer(6)); // E\r
- aa3Hash.put("GLY", new Integer(7));\r
- aa3Hash.put("HIS", new Integer(8));\r
- aa3Hash.put("ILE", new Integer(9));\r
- aa3Hash.put("LEU", new Integer(10));\r
- aa3Hash.put("LYS", new Integer(11));\r
- aa3Hash.put("MET", new Integer(12));\r
- aa3Hash.put("PHE", new Integer(13));\r
- aa3Hash.put("PRO", new Integer(14));\r
- aa3Hash.put("SER", new Integer(15));\r
- aa3Hash.put("THR", new Integer(16));\r
- aa3Hash.put("TRP", new Integer(17));\r
- aa3Hash.put("TYR", new Integer(18));\r
- aa3Hash.put("VAL", new Integer(19));\r
- aa3Hash.put("B", new Integer(20));\r
- aa3Hash.put("Z", new Integer(21));\r
- aa3Hash.put("X", new Integer(22));\r
- aa3Hash.put("-", new Integer(23));\r
- aa3Hash.put("*", new Integer(23));\r
- aa3Hash.put(".", new Integer(23));\r
- aa3Hash.put(" ", new Integer(23));\r
- }\r
-\r
- static {\r
- aa2Triplet.put("A", "ALA");\r
- aa2Triplet.put("R", "ARG");\r
- aa2Triplet.put("N", "ASN");\r
- aa2Triplet.put("D", "ASP");\r
- aa2Triplet.put("C", "CYS");\r
- aa2Triplet.put("Q", "GLN");\r
- aa2Triplet.put("E", "GLU");\r
- aa2Triplet.put("G", "GLY");\r
- aa2Triplet.put("H", "HIS");\r
- aa2Triplet.put("I", "ILE");\r
- aa2Triplet.put("L", "LEU");\r
- aa2Triplet.put("K", "LYS");\r
- aa2Triplet.put("M", "MET");\r
- aa2Triplet.put("F", "PHE");\r
- aa2Triplet.put("P", "PRO");\r
- aa2Triplet.put("S", "SER");\r
- aa2Triplet.put("T", "THR");\r
- aa2Triplet.put("W", "TRP");\r
- aa2Triplet.put("Y", "TYR");\r
- aa2Triplet.put("V", "VAL");\r
- }\r
-\r
- public static String[] aa = {\r
- "A", "R", "N", "D", "C", "Q", "E", "G", "H", "I", "L", "K", "M", "F",\r
- "P", "S", "T", "W", "Y", "V", "B", "Z", "X", "_", "*", ".", " "\r
- };\r
- public static Color midBlue = new Color(100, 100, 255);\r
- public static Vector scaleColours = new Vector();\r
-\r
- static {\r
- scaleColours.addElement(new Color(114, 0, 147));\r
- scaleColours.addElement(new Color(156, 0, 98));\r
- scaleColours.addElement(new Color(190, 0, 0));\r
- scaleColours.addElement(Color.red);\r
- scaleColours.addElement(new Color(255, 125, 0));\r
- scaleColours.addElement(Color.orange);\r
- scaleColours.addElement(new Color(255, 194, 85));\r
- scaleColours.addElement(Color.yellow);\r
- scaleColours.addElement(new Color(255, 255, 181));\r
- scaleColours.addElement(Color.white);\r
- }\r
-\r
- public static Color[] taylor = {\r
- new Color(204, 255, 0), // A Greenish-yellowy-yellow\r
- new Color(0, 0, 255), // R Blueish-bluey-blue\r
- new Color(204, 0, 255), // N Blueish-reddy-blue\r
- new Color(255, 0, 0), // D Reddish-reddy-red\r
- new Color(255, 255, 0), // C Yellowish-yellowy-yellow\r
- new Color(255, 0, 204), // Q Reddish-bluey-red\r
- new Color(255, 0, 102), // E Blueish-reddy-red\r
- new Color(255, 153, 0), // G Yellowy-reddy-yellow\r
- new Color(0, 102, 255), // H Greenish-bluey-blue\r
- new Color(102, 255, 0), // I Greenish-yellowy-green\r
- new Color(51, 255, 0), // L Yellowish-greeny-green\r
- new Color(102, 0, 255), // K Reddish-bluey-blue\r
- new Color(0, 255, 0), // M Greenish-greeny-green\r
- new Color(0, 255, 102), // F Blueish-greeny-green\r
- new Color(255, 204, 0), // P Reddish-yellowy-yellow\r
- new Color(255, 51, 0), // S Yellowish-reddy-red\r
- new Color(255, 102, 0), // T Reddish-yellowy-red\r
- new Color(0, 204, 255), // W Blueish-greeny-green\r
- new Color(0, 255, 204), // Y Greenish-bluey-green\r
- new Color(153, 255, 0), // V Yellowish-greeny-yellow\r
- Color.white, // B\r
- Color.white, // Z\r
- Color.white, // X\r
- Color.white, // -\r
- Color.white, // *\r
- Color.white // .\r
- };\r
- public static Color[] nucleotide = {\r
- new Color(100, 247, 63), // A\r
- new Color(255, 179, 64), // C\r
- new Color(235, 65, 60), // G\r
- new Color(60, 136, 238), // T\r
- new Color(60, 136, 238) // U\r
- };\r
- public static Color[] color = {\r
- Color.pink, // A\r
- midBlue, // R\r
- Color.green, // N\r
- Color.red, // D\r
- Color.yellow, // C\r
- Color.green, // Q\r
- Color.red, // E\r
- Color.magenta, // G\r
- Color.red, // H\r
- Color.pink, // I\r
- Color.pink, // L\r
- midBlue, // K\r
- Color.pink, // M\r
- Color.orange, // F\r
- Color.magenta, // P\r
- Color.green, // S\r
- Color.green, // T\r
- Color.orange, // W\r
- Color.orange, // Y\r
- Color.pink, // V\r
- Color.white, // B\r
- Color.white, // Z\r
- Color.white, // X\r
- Color.white, // -\r
- Color.white, // *\r
- Color.white, // .\r
- Color.white // ' '\r
- };\r
-\r
- // Dunno where I got these numbers from\r
- public static double[] hyd2 = {\r
- 0.62, //A\r
- 0.29, //R\r
- -0.90, //N\r
- -0.74, //D\r
- 1.19, //C\r
- 0.48, //Q\r
- -0.40, //E\r
- 1.38, //G\r
- -1.50, //H\r
- 1.06, //I\r
- 0.64, //L\r
- -0.78, //K\r
- 0.12, //M\r
- -0.85, //F\r
- -2.53, //P\r
- -0.18, //S\r
- -0.05, //T\r
- 1.08, //W\r
- 0.81, //Y\r
- 0.0, //V\r
- 0.26, //B\r
- 0.0, //Z\r
- 0.0 //X\r
- };\r
- public static double[] helix = {\r
- 1.42, 0.98, 0.67, 1.01, 0.70, 1.11, 1.51, 0.57, 1.00, 1.08, 1.21, 1.16,\r
- 1.45, 1.13, 0.57, 0.77, 0.83, 1.08, 0.69, 1.06, 0.84, 1.31, 1.00, 0.0\r
- };\r
- public static double helixmin = 0.57;\r
- public static double helixmax = 1.51;\r
- public static double[] strand = {\r
- 0.83, 0.93, 0.89, 0.54, 1.19, 1.10, 0.37, 0.75, 0.87, 1.60, 1.30, 0.74,\r
- 1.05, 1.38, 0.55, 0.75, 1.19, 1.37, 1.47, 1.70, 0.72, 0.74, 1.0, 0.0\r
- };\r
- public static double strandmin = 0.37;\r
- public static double strandmax = 1.7;\r
- public static double[] turn = {\r
- 0.66, 0.95, 1.56, 1.46, 1.19, 0.98, 0.74, 1.56, 0.95, 0.47, 0.59, 1.01,\r
- 0.60, 0.60, 1.52, 1.43, 0.96, 0.96, 1.14, 0.50, 1.51, 0.86, 1.00, 0, 0\r
- };\r
- public static double turnmin = 0.47;\r
- public static double turnmax = 1.56;\r
- public static double[] buried = {\r
- 1.7, 0.1, 0.4, 0.4, 4.6, 0.3, 0.3, 1.8, 0.8, 3.1, 2.4, 0.05, 1.9, 2.2,\r
- 0.6, 0.8, 0.7, 1.6, 0.5, 2.9, 0.4, 0.3, 1.358, 0.00\r
- };\r
- public static double buriedmin = 0.05;\r
- public static double buriedmax = 4.6;\r
-\r
- // This is hydropathy index\r
- // Kyte, J., and Doolittle, R.F., J. Mol. Biol.\r
- // 1157, 105-132, 1982\r
- public static double[] hyd = {\r
- 1.8, -4.5, -3.5, -3.5, 2.5, -3.5, -3.5, -0.4, -3.2, 4.5, 3.8, -3.9, 1.9,\r
- 2.8, -1.6, -0.8, -0.7, -0.9, -1.3, 4.2, -3.5, -3.5, -0.49, 0.0\r
- };\r
- public static final double hydmax = 4.5;\r
- public static final double hydmin = -3.9;\r
-\r
- //public static final double hydmax = 1.38;\r
- //public static final double hydmin = -2.53;\r
- static final int[][] BLOSUM62 = {\r
- {\r
- 4, -1, -2, -2, 0, -1, -1, 0, -2, -1, -1, -1, -1, -2, -1, 1, 0, -3,\r
- -2, 0, -2, -1, 0, -4\r
- },\r
- {\r
- -1, 5, 0, -2, -3, 1, 0, -2, 0, -3, -2, 2, -1, -3, -2, -1, -1, -3, -2,\r
- -3, -1, 0, -1, -4\r
- },\r
- {\r
- -2, 0, 6, 1, -3, 0, 0, 0, 1, -3, -3, 0, -2, -3, -2, 1, 0, -4, -2, -3,\r
- 3, 0, -1, -4\r
- },\r
- {\r
- -2, -2, 1, 6, -3, 0, 2, -1, -1, -3, -4, -1, -3, -3, -1, 0, -1, -4,\r
- -3, -3, 4, 1, -1, -4\r
- },\r
- {\r
- 0, 3, -3, -3, 9, -3, -4, -3, -3, -1, -1, -3, -1, -2, -3, -1, -1, -2,\r
- -2, -1, -3, -3, -2, -4\r
- },\r
- {\r
- -1, 1, 0, 0, -3, 5, 2, -2, 0, -3, -2, 1, 0, -3, -1, 0, -1, -2, -1,\r
- -2, 0, 3, -1, -4\r
- },\r
- {\r
- -1, 0, 0, 2, -4, 2, 5, -2, 0, -3, -3, 1, -2, -3, -1, 0, -1, -3, -2,\r
- -2, 1, 4, -1, -4\r
- },\r
- {\r
- 0, -2, 0, -1, -3, -2, -2, 6, -2, -4, -4, -2, -3, -3, -2, 0, -2, -2,\r
- -3, -3, -1, -2, -1, -4\r
- },\r
- {\r
- -2, 0, 1, -1, -3, 0, 0, -2, 8, -3, -3, -1, -2, -1, -2, -1, -2, -2, 2,\r
- -3, 0, 0, -1, -4\r
- },\r
- {\r
- -1, -3, -3, -3, -1, -3, -3, -4, -3, 4, 2, -3, 1, 0, -3, -2, -1, -3,\r
- -1, 3, -3, -3, -1, -4\r
- },\r
- {\r
- -1, -2, -3, -4, -1, -2, -3, -4, -3, 2, 4, -2, 2, 0, -3, -2, -1, -2,\r
- -1, 1, -4, -3, -1, -4\r
- },\r
- {\r
- -1, 2, 0, -1, -3, 1, 1, -2, -1, -3, -2, 5, -1, -3, -1, 0, -1, -3, -2,\r
- -2, 0, 1, -1, -4\r
- },\r
- {\r
- -1, -1, -2, -3, -1, 0, -2, -3, -2, 1, 2, -1, 5, 0, -2, -1, -1, -1,\r
- -1, 1, -3, -1, -1, -4\r
- },\r
- {\r
- -2, -3, -3, -3, -2, -3, -3, -3, -1, 0, 0, -3, 0, 6, -4, -2, -2, 1, 3,\r
- -1, -3, -3, -1, -4\r
- },\r
- {\r
- -1, -2, -2, -1, -3, -1, -1, -2, -2, -3, -3, -1, -2, -4, 7, -1, -1,\r
- -4, -3, -2, -2, -1, -2, -4\r
- },\r
- {\r
- 1, -1, 1, 0, -1, 0, 0, 0, -1, -2, -2, 0, -1, -2, -1, 4, 1, -3, -2,\r
- -2, 0, 0, 0, -4\r
- },\r
- {\r
- 0, -1, 0, -1, -1, -1, -1, -2, -2, -1, -1, -1, -1, -2, -1, 1, 5, -2,\r
- -2, 0, -1, -1, 0, -4\r
- },\r
- {\r
- -3, -3, -4, -4, -2, -2, -3, -2, -2, -3, -2, -3, -1, 1, -4, -3, -2,\r
- 11, 2, -3, -4, -3, -2, -4\r
- },\r
- {\r
- -2, -2, -2, -3, -2, -1, -2, -3, 2, -1, -1, -2, -1, 3, -3, -2, -2, 2,\r
- 7, -1, -3, -2, -1, -4\r
- },\r
- {\r
- 0, -3, -3, -3, -1, -2, -2, -3, -3, 3, 1, -2, 1, -1, -2, -2, 0, -3,\r
- -1, 4, -3, -2, -1, -4\r
- },\r
- {\r
- -2, -1, 3, 4, -3, 0, 1, -1, 0, -3, -4, 0, -3, -3, -2, 0, -1, -4, -3,\r
- -3, 4, 1, -1, -4\r
- },\r
- {\r
- -1, 0, 0, 1, -3, 3, 4, -2, 0, -3, -3, 1, -1, -3, -1, 0, -1, -3, -2,\r
- -2, 1, 4, -1, -4\r
- },\r
- {\r
- 0, -1, -1, -1, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, 0, 0, -2,\r
- -1, -1, -1, -1, -1, -4\r
- },\r
- {\r
- -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4,\r
- -4, -4, -4, -4, -4, -4, 1\r
- },\r
- };\r
- static final int[][] PAM250 = {\r
- {\r
- 2, -2, 0, 0, -2, 0, 0, 1, -1, -1, -2, -1, -1, -3, 1, 1, 1, -6, -3, 0,\r
- 0, 0, 0, -8\r
- },\r
- {\r
- -2, 6, 0, -1, -4, 1, -1, -3, 2, -2, -3, 3, 0, -4, 0, 0, -1, 2, -4,\r
- -2, -1, 0, -1, -8\r
- },\r
- {\r
- 0, 0, 2, 2, -4, 1, 1, 0, 2, -2, -3, 1, -2, -3, 0, 1, 0, -4, -2, -2,\r
- 2, 1, 0, -8\r
- },\r
- {\r
- 0, -1, 2, 4, -5, 2, 3, 1, 1, -2, -4, 0, -3, -6, -1, 0, 0, -7, -4, -2,\r
- 3, 3, -1, -8\r
- },\r
- {\r
- -2, -4, -4, -5, 12, -5, -5, -3, -3, -2, -6, -5, -5, -4, -3, 0, -2,\r
- -8, 0, -2, -4, -5, -3, -8\r
- },\r
- {\r
- 0, 1, 1, 2, -5, 4, 2, -1, 3, -2, -2, 1, -1, -5, 0, -1, -1, -5, -4,\r
- -2, 1, 3, -1, -8\r
- },\r
- {\r
- 0, -1, 1, 3, -5, 2, 4, 0, 1, -2, -3, 0, -2, -5, -1, 0, 0, -7, -4, -2,\r
- 3, 3, -1, -8\r
- },\r
- {\r
- 1, -3, 0, 1, -3, -1, 0, 5, -2, -3, -4, -2, -3, -5, 0, 1, 0, -7, -5,\r
- -1, 0, 0, -1, -8\r
- },\r
- {\r
- -1, 2, 2, 1, -3, 3, 1, -2, 6, -2, -2, 0, -2, -2, 0, -1, -1, -3, 0,\r
- -2, 1, 2, -1, -8\r
- },\r
- {\r
- -1, -2, -2, -2, -2, -2, -2, -3, -2, 5, 2, -2, 2, 1, -2, -1, 0, -5,\r
- -1, 4, -2, -2, -1, -8\r
- },\r
- {\r
- -2, -3, -3, -4, -6, -2, -3, -4, -2, 2, 6, -3, 4, 2, -3, -3, -2, -2,\r
- -1, 2, -3, -3, -1, -8\r
- },\r
- {\r
- -1, 3, 1, 0, -5, 1, 0, -2, 0, -2, -3, 5, 0, -5, -1, 0, 0, -3, -4, -2,\r
- 1, 0, -1, -8\r
- },\r
- {\r
- -1, 0, -2, -3, -5, -1, -2, -3, -2, 2, 4, 0, 6, 0, -2, -2, -1, -4, -2,\r
- 2, -2, -2, -1, -8\r
- },\r
- {\r
- -3, -4, -3, -6, -4, -5, -5, -5, -2, 1, 2, -5, 0, 9, -5, -3, -3, 0, 7,\r
- -1, -4, -5, -2, -8\r
- },\r
- {\r
- 1, 0, 0, -1, -3, 0, -1, 0, 0, -2, -3, -1, -2, -5, 6, 1, 0, -6, -5,\r
- -1, -1, 0, -1, -8\r
- },\r
- {\r
- 1, 0, 1, 0, 0, -1, 0, 1, -1, -1, -3, 0, -2, -3, 1, 2, 1, -2, -3, -1,\r
- 0, 0, 0, -8\r
- },\r
- {\r
- 1, -1, 0, 0, -2, -1, 0, 0, -1, 0, -2, 0, -1, -3, 0, 1, 3, -5, -3, 0,\r
- 0, -1, 0, -8\r
- },\r
- {\r
- -6, 2, -4, -7, -8, -5, -7, -7, -3, -5, -2, -3, -4, 0, -6, -2, -5, 17,\r
- 0, -6, -5, -6, -4, -8\r
- },\r
- {\r
- -3, -4, -2, -4, 0, -4, -4, -5, 0, -1, -1, -4, -2, 7, -5, -3, -3, 0,\r
- 10, -2, -3, -4, -2, -8\r
- },\r
- {\r
- 0, -2, -2, -2, -2, -2, -2, -1, -2, 4, 2, -2, 2, -1, -1, -1, 0, -6,\r
- -2, 4, -2, -2, -1, -8\r
- },\r
- {\r
- 0, -1, 2, 3, -4, 1, 3, 0, 1, -2, -3, 1, -2, -4, -1, 0, 0, -5, -3, -2,\r
- 3, 2, -1, -8\r
- },\r
- {\r
- 0, 0, 1, 3, -5, 3, 3, 0, 2, -2, -3, 0, -2, -5, 0, 0, -1, -6, -4, -2,\r
- 2, 3, -1, -8\r
- },\r
- {\r
- 0, -1, 0, -1, -3, -1, -1, -1, -1, -1, -1, -1, -1, -2, -1, 0, 0, -4,\r
- -2, -1, -1, -1, -1, -8\r
- },\r
- {\r
- -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8,\r
- -8, -8, -8, -8, -8, -8, 1\r
- },\r
- };\r
- public static Hashtable ssHash = new Hashtable(); // stores the number value of the aa\r
-\r
- static {\r
- ssHash.put("H", Color.magenta);\r
- ssHash.put("E", Color.yellow);\r
- ssHash.put("-", Color.white);\r
- ssHash.put(".", Color.white);\r
- ssHash.put("S", Color.cyan);\r
- ssHash.put("T", Color.blue);\r
- ssHash.put("G", Color.pink);\r
- ssHash.put("I", Color.pink);\r
- ssHash.put("B", Color.yellow);\r
- }\r
-\r
- static final int[][] DNA = {\r
- { 5, -4, -4, -4, 1 }, // C\r
- { -4, 5, -4, -4, 1 }, // T\r
- { -4, -4, 5, -4, 1 }, // A\r
- { -4, -4, -4, 5, 1 }, // G\r
- { 1, 1, 1, 1, 1 }, // -\r
- };\r
- public static Color[] pidColours = {\r
- midBlue, new Color(153, 153, 255), \r
- // Color.lightGray,\r
- new Color(204, 204, 255),\r
- };\r
- public static float[] pidThresholds = { 80, 60, 40, };\r
- public static Hashtable codonHash = new Hashtable();\r
- public static Vector Lys = new Vector();\r
- public static Vector Asn = new Vector();\r
- public static Vector Gln = new Vector();\r
- public static Vector His = new Vector();\r
- public static Vector Glu = new Vector();\r
- public static Vector Asp = new Vector();\r
- public static Vector Tyr = new Vector();\r
- public static Vector Thr = new Vector();\r
- public static Vector Pro = new Vector();\r
- public static Vector Ala = new Vector();\r
- public static Vector Ser = new Vector();\r
- public static Vector Arg = new Vector();\r
- public static Vector Gly = new Vector();\r
- public static Vector Trp = new Vector();\r
- public static Vector Cys = new Vector();\r
- public static Vector Ile = new Vector();\r
- public static Vector Met = new Vector();\r
- public static Vector Leu = new Vector();\r
- public static Vector Val = new Vector();\r
- public static Vector Phe = new Vector();\r
- public static Vector STOP = new Vector();\r
-\r
- static {\r
- codonHash.put("K", Lys);\r
- codonHash.put("N", Asn);\r
- codonHash.put("Q", Gln);\r
- codonHash.put("H", His);\r
- codonHash.put("E", Glu);\r
- codonHash.put("D", Asp);\r
- codonHash.put("Y", Tyr);\r
- codonHash.put("T", Thr);\r
- codonHash.put("P", Pro);\r
- codonHash.put("A", Ala);\r
- codonHash.put("S", Ser);\r
- codonHash.put("R", Arg);\r
- codonHash.put("G", Gly);\r
- codonHash.put("W", Trp);\r
- codonHash.put("C", Cys);\r
- codonHash.put("I", Ile);\r
- codonHash.put("M", Met);\r
- codonHash.put("L", Leu);\r
- codonHash.put("V", Val);\r
- codonHash.put("F", Phe);\r
- codonHash.put("STOP", STOP);\r
+import java.awt.*;\r
+\r
+public class ResidueProperties\r
+{\r
+ //Stores residue codes/names and colours and other things\r
+ public static Hashtable aaHash = new Hashtable(); // stores the number value of the aa\r
+ public static Hashtable aa3Hash = new Hashtable();\r
+ public static Hashtable aa2Triplet = new Hashtable();\r
+ public static Hashtable nucleotideHash = new Hashtable();\r
+\r
+ static\r
+ {\r
+ aaHash.put("A", new Integer(0));\r
+ aaHash.put("R", new Integer(1));\r
+ aaHash.put("N", new Integer(2));\r
+ aaHash.put("D", new Integer(3));\r
+ aaHash.put("C", new Integer(4));\r
+ aaHash.put("Q", new Integer(5));\r
+ aaHash.put("E", new Integer(6));\r
+ aaHash.put("G", new Integer(7));\r
+ aaHash.put("H", new Integer(8));\r
+ aaHash.put("I", new Integer(9));\r
+ aaHash.put("L", new Integer(10));\r
+ aaHash.put("K", new Integer(11));\r
+ aaHash.put("M", new Integer(12));\r
+ aaHash.put("F", new Integer(13));\r
+ aaHash.put("P", new Integer(14));\r
+ aaHash.put("S", new Integer(15));\r
+ aaHash.put("T", new Integer(16));\r
+ aaHash.put("W", new Integer(17));\r
+ aaHash.put("Y", new Integer(18));\r
+ aaHash.put("V", new Integer(19));\r
+ aaHash.put("B", new Integer(20));\r
+ aaHash.put("Z", new Integer(21));\r
+ aaHash.put("X", new Integer(22));\r
+ aaHash.put("a", new Integer(0));\r
+ aaHash.put("r", new Integer(1));\r
+ aaHash.put("n", new Integer(2));\r
+ aaHash.put("d", new Integer(3));\r
+ aaHash.put("c", new Integer(4));\r
+ aaHash.put("q", new Integer(5));\r
+ aaHash.put("e", new Integer(6));\r
+ aaHash.put("g", new Integer(7));\r
+ aaHash.put("h", new Integer(8));\r
+ aaHash.put("i", new Integer(9));\r
+ aaHash.put("l", new Integer(10));\r
+ aaHash.put("k", new Integer(11));\r
+ aaHash.put("m", new Integer(12));\r
+ aaHash.put("f", new Integer(13));\r
+ aaHash.put("p", new Integer(14));\r
+ aaHash.put("s", new Integer(15));\r
+ aaHash.put("t", new Integer(16));\r
+ aaHash.put("w", new Integer(17));\r
+ aaHash.put("y", new Integer(18));\r
+ aaHash.put("v", new Integer(19));\r
+ aaHash.put("b", new Integer(20));\r
+ aaHash.put("z", new Integer(21));\r
+ aaHash.put("x", new Integer(22));\r
+ aaHash.put("-", new Integer(23));\r
+ aaHash.put("*", new Integer(23));\r
+ aaHash.put(".", new Integer(23));\r
+ aaHash.put(" ", new Integer(23));\r
+ }\r
+\r
+ static\r
+ {\r
+ nucleotideHash.put("A", new Integer(0));\r
+ nucleotideHash.put("C", new Integer(1));\r
+ nucleotideHash.put("G", new Integer(2));\r
+ nucleotideHash.put("T", new Integer(3));\r
+ nucleotideHash.put("U", new Integer(4));\r
+ }\r
+\r
+ // These numbers should correspond to the indices in the Color hashes\r
+ public static Hashtable aaSpecialsHash = new Hashtable();\r
+\r
+ static\r
+ {\r
+ aaSpecialsHash.put("-", new Integer(23));\r
+ aaSpecialsHash.put("*", new Integer(24));\r
+ aaSpecialsHash.put(".", new Integer(25));\r
+ aaSpecialsHash.put(" ", new Integer(26));\r
+ }\r
+\r
+ static\r
+ {\r
+ aa3Hash.put("ALA", new Integer(0));\r
+ aa3Hash.put("ARG", new Integer(1));\r
+ aa3Hash.put("ASN", new Integer(2));\r
+ aa3Hash.put("ASP", new Integer(3)); //D\r
+ aa3Hash.put("CYS", new Integer(4));\r
+ aa3Hash.put("GLN", new Integer(5)); //Q\r
+ aa3Hash.put("GLU", new Integer(6)); // E\r
+ aa3Hash.put("GLY", new Integer(7));\r
+ aa3Hash.put("HIS", new Integer(8));\r
+ aa3Hash.put("ILE", new Integer(9));\r
+ aa3Hash.put("LEU", new Integer(10));\r
+ aa3Hash.put("LYS", new Integer(11));\r
+ aa3Hash.put("MET", new Integer(12));\r
+ aa3Hash.put("PHE", new Integer(13));\r
+ aa3Hash.put("PRO", new Integer(14));\r
+ aa3Hash.put("SER", new Integer(15));\r
+ aa3Hash.put("THR", new Integer(16));\r
+ aa3Hash.put("TRP", new Integer(17));\r
+ aa3Hash.put("TYR", new Integer(18));\r
+ aa3Hash.put("VAL", new Integer(19));\r
+ aa3Hash.put("B", new Integer(20));\r
+ aa3Hash.put("Z", new Integer(21));\r
+ aa3Hash.put("X", new Integer(22));\r
+ aa3Hash.put("-", new Integer(23));\r
+ aa3Hash.put("*", new Integer(23));\r
+ aa3Hash.put(".", new Integer(23));\r
+ aa3Hash.put(" ", new Integer(23));\r
+ }\r
+\r
+ static\r
+ {\r
+ aa2Triplet.put("A", "ALA");\r
+ aa2Triplet.put("R", "ARG");\r
+ aa2Triplet.put("N", "ASN");\r
+ aa2Triplet.put("D", "ASP");\r
+ aa2Triplet.put("C", "CYS");\r
+ aa2Triplet.put("Q", "GLN");\r
+ aa2Triplet.put("E", "GLU");\r
+ aa2Triplet.put("G", "GLY");\r
+ aa2Triplet.put("H", "HIS");\r
+ aa2Triplet.put("I", "ILE");\r
+ aa2Triplet.put("L", "LEU");\r
+ aa2Triplet.put("K", "LYS");\r
+ aa2Triplet.put("M", "MET");\r
+ aa2Triplet.put("F", "PHE");\r
+ aa2Triplet.put("P", "PRO");\r
+ aa2Triplet.put("S", "SER");\r
+ aa2Triplet.put("T", "THR");\r
+ aa2Triplet.put("W", "TRP");\r
+ aa2Triplet.put("Y", "TYR");\r
+ aa2Triplet.put("V", "VAL");\r
+ }\r
+\r
+ public static String[] aa =\r
+ {\r
+ "A", "R", "N", "D", "C", "Q", "E", "G", "H", "I", "L", "K", "M", "F",\r
+ "P", "S", "T", "W", "Y", "V", "B", "Z", "X", "_", "*", ".", " "\r
+ };\r
+ public static Color midBlue = new Color(100, 100, 255);\r
+ public static Vector scaleColours = new Vector();\r
+\r
+ static\r
+ {\r
+ scaleColours.addElement(new Color(114, 0, 147));\r
+ scaleColours.addElement(new Color(156, 0, 98));\r
+ scaleColours.addElement(new Color(190, 0, 0));\r
+ scaleColours.addElement(Color.red);\r
+ scaleColours.addElement(new Color(255, 125, 0));\r
+ scaleColours.addElement(Color.orange);\r
+ scaleColours.addElement(new Color(255, 194, 85));\r
+ scaleColours.addElement(Color.yellow);\r
+ scaleColours.addElement(new Color(255, 255, 181));\r
+ scaleColours.addElement(Color.white);\r
+ }\r
+\r
+ public static Color[] taylor =\r
+ {\r
+ new Color(204, 255, 0), // A Greenish-yellowy-yellow\r
+ new Color(0, 0, 255), // R Blueish-bluey-blue\r
+ new Color(204, 0, 255), // N Blueish-reddy-blue\r
+ new Color(255, 0, 0), // D Reddish-reddy-red\r
+ new Color(255, 255, 0), // C Yellowish-yellowy-yellow\r
+ new Color(255, 0, 204), // Q Reddish-bluey-red\r
+ new Color(255, 0, 102), // E Blueish-reddy-red\r
+ new Color(255, 153, 0), // G Yellowy-reddy-yellow\r
+ new Color(0, 102, 255), // H Greenish-bluey-blue\r
+ new Color(102, 255, 0), // I Greenish-yellowy-green\r
+ new Color(51, 255, 0), // L Yellowish-greeny-green\r
+ new Color(102, 0, 255), // K Reddish-bluey-blue\r
+ new Color(0, 255, 0), // M Greenish-greeny-green\r
+ new Color(0, 255, 102), // F Blueish-greeny-green\r
+ new Color(255, 204, 0), // P Reddish-yellowy-yellow\r
+ new Color(255, 51, 0), // S Yellowish-reddy-red\r
+ new Color(255, 102, 0), // T Reddish-yellowy-red\r
+ new Color(0, 204, 255), // W Blueish-greeny-green\r
+ new Color(0, 255, 204), // Y Greenish-bluey-green\r
+ new Color(153, 255, 0), // V Yellowish-greeny-yellow\r
+ Color.white, // B\r
+ Color.white, // Z\r
+ Color.white, // X\r
+ Color.white, // -\r
+ Color.white, // *\r
+ Color.white // .\r
+ };\r
+ public static Color[] nucleotide =\r
+ {\r
+ new Color(100, 247, 63), // A\r
+ new Color(255, 179, 64), // C\r
+ new Color(235, 65, 60), // G\r
+ new Color(60, 136, 238), // T\r
+ new Color(60, 136, 238) // U\r
+ };\r
+ public static Color[] color =\r
+ {\r
+ Color.pink, // A\r
+ midBlue, // R\r
+ Color.green, // N\r
+ Color.red, // D\r
+ Color.yellow, // C\r
+ Color.green, // Q\r
+ Color.red, // E\r
+ Color.magenta, // G\r
+ Color.red, // H\r
+ Color.pink, // I\r
+ Color.pink, // L\r
+ midBlue, // K\r
+ Color.pink, // M\r
+ Color.orange, // F\r
+ Color.magenta, // P\r
+ Color.green, // S\r
+ Color.green, // T\r
+ Color.orange, // W\r
+ Color.orange, // Y\r
+ Color.pink, // V\r
+ Color.white, // B\r
+ Color.white, // Z\r
+ Color.white, // X\r
+ Color.white, // -\r
+ Color.white, // *\r
+ Color.white, // .\r
+ Color.white // ' '\r
+ };\r
+\r
+ // Dunno where I got these numbers from\r
+ public static double[] hyd2 =\r
+ {\r
+ 0.62, //A\r
+ 0.29, //R\r
+ -0.90, //N\r
+ -0.74, //D\r
+ 1.19, //C\r
+ 0.48, //Q\r
+ -0.40, //E\r
+ 1.38, //G\r
+ -1.50, //H\r
+ 1.06, //I\r
+ 0.64, //L\r
+ -0.78, //K\r
+ 0.12, //M\r
+ -0.85, //F\r
+ -2.53, //P\r
+ -0.18, //S\r
+ -0.05, //T\r
+ 1.08, //W\r
+ 0.81, //Y\r
+ 0.0, //V\r
+ 0.26, //B\r
+ 0.0, //Z\r
+ 0.0 //X\r
+ };\r
+ public static double[] helix =\r
+ {\r
+ 1.42, 0.98, 0.67, 1.01, 0.70, 1.11, 1.51, 0.57, 1.00, 1.08, 1.21, 1.16,\r
+ 1.45, 1.13, 0.57, 0.77, 0.83, 1.08, 0.69, 1.06, 0.84, 1.31, 1.00, 0.0\r
+ };\r
+ public static double helixmin = 0.57;\r
+ public static double helixmax = 1.51;\r
+ public static double[] strand =\r
+ {\r
+ 0.83, 0.93, 0.89, 0.54, 1.19, 1.10, 0.37, 0.75, 0.87, 1.60, 1.30, 0.74,\r
+ 1.05, 1.38, 0.55, 0.75, 1.19, 1.37, 1.47, 1.70, 0.72, 0.74, 1.0, 0.0\r
+ };\r
+ public static double strandmin = 0.37;\r
+ public static double strandmax = 1.7;\r
+ public static double[] turn =\r
+ {\r
+ 0.66, 0.95, 1.56, 1.46, 1.19, 0.98, 0.74, 1.56, 0.95, 0.47, 0.59, 1.01,\r
+ 0.60, 0.60, 1.52, 1.43, 0.96, 0.96, 1.14, 0.50, 1.51, 0.86, 1.00, 0, 0\r
+ };\r
+ public static double turnmin = 0.47;\r
+ public static double turnmax = 1.56;\r
+ public static double[] buried =\r
+ {\r
+ 1.7, 0.1, 0.4, 0.4, 4.6, 0.3, 0.3, 1.8, 0.8, 3.1, 2.4, 0.05, 1.9, 2.2,\r
+ 0.6, 0.8, 0.7, 1.6, 0.5, 2.9, 0.4, 0.3, 1.358, 0.00\r
+ };\r
+ public static double buriedmin = 0.05;\r
+ public static double buriedmax = 4.6;\r
+\r
+ // This is hydropathy index\r
+ // Kyte, J., and Doolittle, R.F., J. Mol. Biol.\r
+ // 1157, 105-132, 1982\r
+ public static double[] hyd =\r
+ {\r
+ 1.8, -4.5, -3.5, -3.5, 2.5, -3.5, -3.5, -0.4, -3.2, 4.5, 3.8, -3.9, 1.9,\r
+ 2.8, -1.6, -0.8, -0.7, -0.9, -1.3, 4.2, -3.5, -3.5, -0.49, 0.0\r
+ };\r
+ public static final double hydmax = 4.5;\r
+ public static final double hydmin = -3.9;\r
+\r
+ //public static final double hydmax = 1.38;\r
+ //public static final double hydmin = -2.53;\r
+ static final int[][] BLOSUM62 =\r
+ {\r
+ {\r
+ 4, -1, -2, -2, 0, -1, -1, 0, -2, -1, -1, -1, -1, -2, -1, 1, 0, -3,\r
+ -2, 0, -2, -1, 0, -4\r
+ },\r
+ {\r
+ -1, 5, 0, -2, -3, 1, 0, -2, 0, -3, -2, 2, -1, -3, -2, -1, -1, -3, -2,\r
+ -3, -1, 0, -1, -4\r
+ },\r
+ {\r
+ -2, 0, 6, 1, -3, 0, 0, 0, 1, -3, -3, 0, -2, -3, -2, 1, 0, -4, -2, -3,\r
+ 3, 0, -1, -4\r
+ },\r
+ {\r
+ -2, -2, 1, 6, -3, 0, 2, -1, -1, -3, -4, -1, -3, -3, -1, 0, -1, -4,\r
+ -3, -3, 4, 1, -1, -4\r
+ },\r
+ {\r
+ 0, 3, -3, -3, 9, -3, -4, -3, -3, -1, -1, -3, -1, -2, -3, -1, -1, -2,\r
+ -2, -1, -3, -3, -2, -4\r
+ },\r
+ {\r
+ -1, 1, 0, 0, -3, 5, 2, -2, 0, -3, -2, 1, 0, -3, -1, 0, -1, -2, -1,\r
+ -2, 0, 3, -1, -4\r
+ },\r
+ {\r
+ -1, 0, 0, 2, -4, 2, 5, -2, 0, -3, -3, 1, -2, -3, -1, 0, -1, -3, -2,\r
+ -2, 1, 4, -1, -4\r
+ },\r
+ {\r
+ 0, -2, 0, -1, -3, -2, -2, 6, -2, -4, -4, -2, -3, -3, -2, 0, -2, -2,\r
+ -3, -3, -1, -2, -1, -4\r
+ },\r
+ {\r
+ -2, 0, 1, -1, -3, 0, 0, -2, 8, -3, -3, -1, -2, -1, -2, -1, -2, -2, 2,\r
+ -3, 0, 0, -1, -4\r
+ },\r
+ {\r
+ -1, -3, -3, -3, -1, -3, -3, -4, -3, 4, 2, -3, 1, 0, -3, -2, -1, -3,\r
+ -1, 3, -3, -3, -1, -4\r
+ },\r
+ {\r
+ -1, -2, -3, -4, -1, -2, -3, -4, -3, 2, 4, -2, 2, 0, -3, -2, -1, -2,\r
+ -1, 1, -4, -3, -1, -4\r
+ },\r
+ {\r
+ -1, 2, 0, -1, -3, 1, 1, -2, -1, -3, -2, 5, -1, -3, -1, 0, -1, -3, -2,\r
+ -2, 0, 1, -1, -4\r
+ },\r
+ {\r
+ -1, -1, -2, -3, -1, 0, -2, -3, -2, 1, 2, -1, 5, 0, -2, -1, -1, -1,\r
+ -1, 1, -3, -1, -1, -4\r
+ },\r
+ {\r
+ -2, -3, -3, -3, -2, -3, -3, -3, -1, 0, 0, -3, 0, 6, -4, -2, -2, 1, 3,\r
+ -1, -3, -3, -1, -4\r
+ },\r
+ {\r
+ -1, -2, -2, -1, -3, -1, -1, -2, -2, -3, -3, -1, -2, -4, 7, -1, -1,\r
+ -4, -3, -2, -2, -1, -2, -4\r
+ },\r
+ {\r
+ 1, -1, 1, 0, -1, 0, 0, 0, -1, -2, -2, 0, -1, -2, -1, 4, 1, -3, -2,\r
+ -2, 0, 0, 0, -4\r
+ },\r
+ {\r
+ 0, -1, 0, -1, -1, -1, -1, -2, -2, -1, -1, -1, -1, -2, -1, 1, 5, -2,\r
+ -2, 0, -1, -1, 0, -4\r
+ },\r
+ {\r
+ -3, -3, -4, -4, -2, -2, -3, -2, -2, -3, -2, -3, -1, 1, -4, -3, -2,\r
+ 11, 2, -3, -4, -3, -2, -4\r
+ },\r
+ {\r
+ -2, -2, -2, -3, -2, -1, -2, -3, 2, -1, -1, -2, -1, 3, -3, -2, -2, 2,\r
+ 7, -1, -3, -2, -1, -4\r
+ },\r
+ {\r
+ 0, -3, -3, -3, -1, -2, -2, -3, -3, 3, 1, -2, 1, -1, -2, -2, 0, -3,\r
+ -1, 4, -3, -2, -1, -4\r
+ },\r
+ {\r
+ -2, -1, 3, 4, -3, 0, 1, -1, 0, -3, -4, 0, -3, -3, -2, 0, -1, -4, -3,\r
+ -3, 4, 1, -1, -4\r
+ },\r
+ {\r
+ -1, 0, 0, 1, -3, 3, 4, -2, 0, -3, -3, 1, -1, -3, -1, 0, -1, -3, -2,\r
+ -2, 1, 4, -1, -4\r
+ },\r
+ {\r
+ 0, -1, -1, -1, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, 0, 0, -2,\r
+ -1, -1, -1, -1, -1, -4\r
+ },\r
+ {\r
+ -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4,\r
+ -4, -4, -4, -4, -4, -4, 1\r
+ },\r
+ };\r
+ static final int[][] PAM250 =\r
+ {\r
+ {\r
+ 2, -2, 0, 0, -2, 0, 0, 1, -1, -1, -2, -1, -1, -3, 1, 1, 1, -6, -3, 0,\r
+ 0, 0, 0, -8\r
+ },\r
+ {\r
+ -2, 6, 0, -1, -4, 1, -1, -3, 2, -2, -3, 3, 0, -4, 0, 0, -1, 2, -4,\r
+ -2, -1, 0, -1, -8\r
+ },\r
+ {\r
+ 0, 0, 2, 2, -4, 1, 1, 0, 2, -2, -3, 1, -2, -3, 0, 1, 0, -4, -2, -2,\r
+ 2, 1, 0, -8\r
+ },\r
+ {\r
+ 0, -1, 2, 4, -5, 2, 3, 1, 1, -2, -4, 0, -3, -6, -1, 0, 0, -7, -4, -2,\r
+ 3, 3, -1, -8\r
+ },\r
+ {\r
+ -2, -4, -4, -5, 12, -5, -5, -3, -3, -2, -6, -5, -5, -4, -3, 0, -2,\r
+ -8, 0, -2, -4, -5, -3, -8\r
+ },\r
+ {\r
+ 0, 1, 1, 2, -5, 4, 2, -1, 3, -2, -2, 1, -1, -5, 0, -1, -1, -5, -4,\r
+ -2, 1, 3, -1, -8\r
+ },\r
+ {\r
+ 0, -1, 1, 3, -5, 2, 4, 0, 1, -2, -3, 0, -2, -5, -1, 0, 0, -7, -4, -2,\r
+ 3, 3, -1, -8\r
+ },\r
+ {\r
+ 1, -3, 0, 1, -3, -1, 0, 5, -2, -3, -4, -2, -3, -5, 0, 1, 0, -7, -5,\r
+ -1, 0, 0, -1, -8\r
+ },\r
+ {\r
+ -1, 2, 2, 1, -3, 3, 1, -2, 6, -2, -2, 0, -2, -2, 0, -1, -1, -3, 0,\r
+ -2, 1, 2, -1, -8\r
+ },\r
+ {\r
+ -1, -2, -2, -2, -2, -2, -2, -3, -2, 5, 2, -2, 2, 1, -2, -1, 0, -5,\r
+ -1, 4, -2, -2, -1, -8\r
+ },\r
+ {\r
+ -2, -3, -3, -4, -6, -2, -3, -4, -2, 2, 6, -3, 4, 2, -3, -3, -2, -2,\r
+ -1, 2, -3, -3, -1, -8\r
+ },\r
+ {\r
+ -1, 3, 1, 0, -5, 1, 0, -2, 0, -2, -3, 5, 0, -5, -1, 0, 0, -3, -4, -2,\r
+ 1, 0, -1, -8\r
+ },\r
+ {\r
+ -1, 0, -2, -3, -5, -1, -2, -3, -2, 2, 4, 0, 6, 0, -2, -2, -1, -4, -2,\r
+ 2, -2, -2, -1, -8\r
+ },\r
+ {\r
+ -3, -4, -3, -6, -4, -5, -5, -5, -2, 1, 2, -5, 0, 9, -5, -3, -3, 0, 7,\r
+ -1, -4, -5, -2, -8\r
+ },\r
+ {\r
+ 1, 0, 0, -1, -3, 0, -1, 0, 0, -2, -3, -1, -2, -5, 6, 1, 0, -6, -5,\r
+ -1, -1, 0, -1, -8\r
+ },\r
+ {\r
+ 1, 0, 1, 0, 0, -1, 0, 1, -1, -1, -3, 0, -2, -3, 1, 2, 1, -2, -3, -1,\r
+ 0, 0, 0, -8\r
+ },\r
+ {\r
+ 1, -1, 0, 0, -2, -1, 0, 0, -1, 0, -2, 0, -1, -3, 0, 1, 3, -5, -3, 0,\r
+ 0, -1, 0, -8\r
+ },\r
+ {\r
+ -6, 2, -4, -7, -8, -5, -7, -7, -3, -5, -2, -3, -4, 0, -6, -2, -5, 17,\r
+ 0, -6, -5, -6, -4, -8\r
+ },\r
+ {\r
+ -3, -4, -2, -4, 0, -4, -4, -5, 0, -1, -1, -4, -2, 7, -5, -3, -3, 0,\r
+ 10, -2, -3, -4, -2, -8\r
+ },\r
+ {\r
+ 0, -2, -2, -2, -2, -2, -2, -1, -2, 4, 2, -2, 2, -1, -1, -1, 0, -6,\r
+ -2, 4, -2, -2, -1, -8\r
+ },\r
+ {\r
+ 0, -1, 2, 3, -4, 1, 3, 0, 1, -2, -3, 1, -2, -4, -1, 0, 0, -5, -3, -2,\r
+ 3, 2, -1, -8\r
+ },\r
+ {\r
+ 0, 0, 1, 3, -5, 3, 3, 0, 2, -2, -3, 0, -2, -5, 0, 0, -1, -6, -4, -2,\r
+ 2, 3, -1, -8\r
+ },\r
+ {\r
+ 0, -1, 0, -1, -3, -1, -1, -1, -1, -1, -1, -1, -1, -2, -1, 0, 0, -4,\r
+ -2, -1, -1, -1, -1, -8\r
+ },\r
+ {\r
+ -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8,\r
+ -8, -8, -8, -8, -8, -8, 1\r
+ },\r
+ };\r
+ public static Hashtable ssHash = new Hashtable(); // stores the number value of the aa\r
+\r
+ static\r
+ {\r
+ ssHash.put("H", Color.magenta);\r
+ ssHash.put("E", Color.yellow);\r
+ ssHash.put("-", Color.white);\r
+ ssHash.put(".", Color.white);\r
+ ssHash.put("S", Color.cyan);\r
+ ssHash.put("T", Color.blue);\r
+ ssHash.put("G", Color.pink);\r
+ ssHash.put("I", Color.pink);\r
+ ssHash.put("B", Color.yellow);\r
+ }\r
+\r
+ static final int[][] DNA =\r
+ {\r
+ {\r
+ 5, -4, -4, -4, 1}, // C\r
+ {\r
+ -4, 5, -4, -4, 1}, // T\r
+ {\r
+ -4, -4, 5, -4, 1}, // A\r
+ {\r
+ -4, -4, -4, 5, 1}, // G\r
+ {\r
+ 1, 1, 1, 1, 1}, // -\r
+ };\r
+ public static Color[] pidColours =\r
+ {\r
+ midBlue, new Color(153, 153, 255),\r
+ // Color.lightGray,\r
+ new Color(204, 204, 255),\r
+ };\r
+ public static float[] pidThresholds =\r
+ {\r
+ 80, 60, 40, };\r
+ public static Hashtable codonHash = new Hashtable();\r
+ public static Vector Lys = new Vector();\r
+ public static Vector Asn = new Vector();\r
+ public static Vector Gln = new Vector();\r
+ public static Vector His = new Vector();\r
+ public static Vector Glu = new Vector();\r
+ public static Vector Asp = new Vector();\r
+ public static Vector Tyr = new Vector();\r
+ public static Vector Thr = new Vector();\r
+ public static Vector Pro = new Vector();\r
+ public static Vector Ala = new Vector();\r
+ public static Vector Ser = new Vector();\r
+ public static Vector Arg = new Vector();\r
+ public static Vector Gly = new Vector();\r
+ public static Vector Trp = new Vector();\r
+ public static Vector Cys = new Vector();\r
+ public static Vector Ile = new Vector();\r
+ public static Vector Met = new Vector();\r
+ public static Vector Leu = new Vector();\r
+ public static Vector Val = new Vector();\r
+ public static Vector Phe = new Vector();\r
+ public static Vector STOP = new Vector();\r
+\r
+ static\r
+ {\r
+ codonHash.put("K", Lys);\r
+ codonHash.put("N", Asn);\r
+ codonHash.put("Q", Gln);\r
+ codonHash.put("H", His);\r
+ codonHash.put("E", Glu);\r
+ codonHash.put("D", Asp);\r
+ codonHash.put("Y", Tyr);\r
+ codonHash.put("T", Thr);\r
+ codonHash.put("P", Pro);\r
+ codonHash.put("A", Ala);\r
+ codonHash.put("S", Ser);\r
+ codonHash.put("R", Arg);\r
+ codonHash.put("G", Gly);\r
+ codonHash.put("W", Trp);\r
+ codonHash.put("C", Cys);\r
+ codonHash.put("I", Ile);\r
+ codonHash.put("M", Met);\r
+ codonHash.put("L", Leu);\r
+ codonHash.put("V", Val);\r
+ codonHash.put("F", Phe);\r
+ codonHash.put("STOP", STOP);\r
+ }\r
+\r
+ public static Hashtable codonHash2 = new Hashtable();\r
+\r
+ static\r
+ {\r
+ codonHash2.put("AAA", "K");\r
+ codonHash2.put("AAG", "K");\r
+ codonHash2.put("AAC", "N");\r
+ codonHash2.put("AAT", "N");\r
+\r
+ codonHash2.put("CAA", "E");\r
+ codonHash2.put("CAG", "E");\r
+ codonHash2.put("CAC", "H");\r
+ codonHash2.put("CAT", "H");\r
+\r
+ codonHash2.put("GAA", "Q");\r
+ codonHash2.put("GAG", "Q");\r
+ codonHash2.put("GAC", "D");\r
+ codonHash2.put("GAT", "D");\r
+\r
+ codonHash2.put("TAC", "Y");\r
+ codonHash2.put("TAT", "Y");\r
+\r
+ codonHash2.put("ACA", "T");\r
+ codonHash2.put("AAG", "T");\r
+ codonHash2.put("ACC", "T");\r
+ codonHash2.put("ACT", "T");\r
+\r
+ codonHash2.put("CCA", "P");\r
+ codonHash2.put("CCG", "P");\r
+ codonHash2.put("CCC", "P");\r
+ codonHash2.put("CCT", "P");\r
+\r
+ codonHash2.put("GCA", "A");\r
+ codonHash2.put("GCG", "A");\r
+ codonHash2.put("GCC", "A");\r
+ codonHash2.put("GCT", "A");\r
+\r
+ codonHash2.put("TCA", "S");\r
+ codonHash2.put("TCG", "S");\r
+ codonHash2.put("TCC", "S");\r
+ codonHash2.put("TCT", "S");\r
+ codonHash2.put("AGC", "S");\r
+ codonHash2.put("AGT", "S");\r
+\r
+ codonHash2.put("AGA", "R");\r
+ codonHash2.put("AGG", "R");\r
+ codonHash2.put("CGA", "R");\r
+ codonHash2.put("CGG", "R");\r
+ codonHash2.put("CGC", "R");\r
+ codonHash2.put("CGT", "R");\r
+\r
+ codonHash2.put("GGA", "G");\r
+ codonHash2.put("GGG", "G");\r
+ codonHash2.put("GGC", "G");\r
+ codonHash2.put("GGT", "G");\r
+\r
+ codonHash2.put("TGA", "*");\r
+ codonHash2.put("TAA", "*");\r
+ codonHash2.put("TAG", "*");\r
+\r
+ codonHash2.put("TGG", "W");\r
+\r
+ codonHash2.put("TGC", "C");\r
+ codonHash2.put("TGT", "C");\r
+\r
+ codonHash2.put("ATA", "I");\r
+ codonHash2.put("ATC", "I");\r
+ codonHash2.put("ATT", "I");\r
+\r
+ codonHash2.put("ATG", "M");\r
+\r
+ codonHash2.put("CTA", "L");\r
+ codonHash2.put("CTG", "L");\r
+ codonHash2.put("CTC", "L");\r
+ codonHash2.put("CTT", "L");\r
+ codonHash2.put("TTA", "L");\r
+ codonHash2.put("TTG", "L");\r
+\r
+ codonHash2.put("GTA", "V");\r
+ codonHash2.put("GTG", "V");\r
+ codonHash2.put("GTC", "V");\r
+ codonHash2.put("GTT", "V");\r
+\r
+ codonHash2.put("TTC", "F");\r
+ codonHash2.put("TTT", "F");\r
+ }\r
+\r
+ static\r
+ {\r
+ Lys.addElement("AAA");\r
+ Lys.addElement("AAG");\r
+ Asn.addElement("AAC");\r
+ Asn.addElement("AAT");\r
+\r
+ Gln.addElement("CAA");\r
+ Gln.addElement("CAG");\r
+ His.addElement("CAC");\r
+ His.addElement("CAT");\r
+\r
+ Glu.addElement("GAA");\r
+ Glu.addElement("GAG");\r
+ Asp.addElement("GAC");\r
+ Asp.addElement("GAT");\r
+\r
+ Tyr.addElement("TAC");\r
+ Tyr.addElement("TAT");\r
+\r
+ Thr.addElement("ACA");\r
+ Thr.addElement("ACG");\r
+ Thr.addElement("ACC");\r
+ Thr.addElement("ACT");\r
+\r
+ Pro.addElement("CCA");\r
+ Pro.addElement("CCG");\r
+ Pro.addElement("CCC");\r
+ Pro.addElement("CCT");\r
+\r
+ Ala.addElement("GCA");\r
+ Ala.addElement("GCG");\r
+ Ala.addElement("GCC");\r
+ Ala.addElement("GCT");\r
+\r
+ Ser.addElement("TCA");\r
+ Ser.addElement("TCG");\r
+ Ser.addElement("TCC");\r
+ Ser.addElement("TCT");\r
+ Ser.addElement("AGC");\r
+ Ser.addElement("AGT");\r
+\r
+ Arg.addElement("AGA");\r
+ Arg.addElement("AGG");\r
+ Arg.addElement("CGA");\r
+ Arg.addElement("CGG");\r
+ Arg.addElement("CGC");\r
+ Arg.addElement("CGT");\r
+\r
+ Gly.addElement("GGA");\r
+ Gly.addElement("GGG");\r
+ Gly.addElement("GGC");\r
+ Gly.addElement("GGT");\r
+\r
+ STOP.addElement("TGA");\r
+ STOP.addElement("TAA");\r
+ STOP.addElement("TAG");\r
+\r
+ Trp.addElement("TGG");\r
+\r
+ Cys.addElement("TGC");\r
+ Cys.addElement("TGT");\r
+\r
+ Ile.addElement("ATA");\r
+ Ile.addElement("ATC");\r
+ Ile.addElement("ATT");\r
+\r
+ Met.addElement("ATG");\r
+\r
+ Leu.addElement("CTA");\r
+ Leu.addElement("CTG");\r
+ Leu.addElement("CTC");\r
+ Leu.addElement("CTT");\r
+ Leu.addElement("TTA");\r
+ Leu.addElement("TTG");\r
+\r
+ Val.addElement("GTA");\r
+ Val.addElement("GTG");\r
+ Val.addElement("GTC");\r
+ Val.addElement("GTT");\r
+\r
+ Phe.addElement("TTC");\r
+ Phe.addElement("TTT");\r
+ }\r
+\r
+ public static Color[][] groupColors =\r
+ {\r
+ {\r
+ Color.red, Color.red.brighter(), Color.red.brighter().brighter()},\r
+ {\r
+ Color.orange, Color.orange.brighter(),\r
+ Color.orange.brighter().brighter()\r
+ },\r
+ {\r
+ Color.green, Color.green.brighter(), Color.green.brighter().brighter()},\r
+ {\r
+ Color.blue, Color.blue.brighter(), Color.blue.brighter().brighter()},\r
+ {\r
+ Color.magenta, Color.magenta.brighter(),\r
+ Color.magenta.brighter().brighter()\r
+ },\r
+ {\r
+ Color.cyan, Color.cyan.brighter(), Color.cyan.brighter().brighter()},\r
+ {\r
+ Color.pink, Color.pink.brighter(), Color.pink.brighter().brighter()},\r
+ };\r
+\r
+ //Stores residue codes/names and colours and other things\r
+ public static Hashtable propHash = new Hashtable();\r
+ public static Hashtable hydrophobic = new Hashtable();\r
+ public static Hashtable polar = new Hashtable();\r
+ public static Hashtable small = new Hashtable();\r
+ public static Hashtable positive = new Hashtable();\r
+ public static Hashtable negative = new Hashtable();\r
+ public static Hashtable charged = new Hashtable();\r
+ public static Hashtable aromatic = new Hashtable();\r
+ public static Hashtable aliphatic = new Hashtable();\r
+ public static Hashtable tiny = new Hashtable();\r
+ public static Hashtable proline = new Hashtable();\r
+\r
+ static\r
+ {\r
+ hydrophobic.put("I", new Integer(1));\r
+ hydrophobic.put("L", new Integer(1));\r
+ hydrophobic.put("V", new Integer(1));\r
+ hydrophobic.put("C", new Integer(1));\r
+ hydrophobic.put("A", new Integer(1));\r
+ hydrophobic.put("G", new Integer(1));\r
+ hydrophobic.put("M", new Integer(1));\r
+ hydrophobic.put("F", new Integer(1));\r
+ hydrophobic.put("Y", new Integer(1));\r
+ hydrophobic.put("W", new Integer(1));\r
+ hydrophobic.put("H", new Integer(1));\r
+ hydrophobic.put("K", new Integer(1));\r
+ hydrophobic.put("X", new Integer(1));\r
+ hydrophobic.put("-", new Integer(1));\r
+ hydrophobic.put("*", new Integer(1));\r
+ hydrophobic.put("R", new Integer(0));\r
+ hydrophobic.put("E", new Integer(0));\r
+ hydrophobic.put("Q", new Integer(0));\r
+ hydrophobic.put("D", new Integer(0));\r
+ hydrophobic.put("N", new Integer(0));\r
+ hydrophobic.put("S", new Integer(0));\r
+ hydrophobic.put("T", new Integer(0));\r
+ hydrophobic.put("P", new Integer(0));\r
+ }\r
+\r
+ static\r
+ {\r
+ polar.put("Y", new Integer(1));\r
+ polar.put("W", new Integer(1));\r
+ polar.put("H", new Integer(1));\r
+ polar.put("K", new Integer(1));\r
+ polar.put("R", new Integer(1));\r
+ polar.put("E", new Integer(1));\r
+ polar.put("Q", new Integer(1));\r
+ polar.put("D", new Integer(1));\r
+ polar.put("N", new Integer(1));\r
+ polar.put("S", new Integer(1));\r
+ polar.put("T", new Integer(1));\r
+ polar.put("X", new Integer(1));\r
+ polar.put("-", new Integer(1));\r
+ polar.put("*", new Integer(1));\r
+ polar.put("I", new Integer(0));\r
+ polar.put("L", new Integer(0));\r
+ polar.put("V", new Integer(0));\r
+ polar.put("C", new Integer(0));\r
+ polar.put("A", new Integer(0));\r
+ polar.put("G", new Integer(0));\r
+ polar.put("M", new Integer(0));\r
+ polar.put("F", new Integer(0));\r
+ polar.put("P", new Integer(0));\r
+ }\r
+\r
+ static\r
+ {\r
+ small.put("I", new Integer(0));\r
+ small.put("L", new Integer(0));\r
+ small.put("V", new Integer(1));\r
+ small.put("C", new Integer(1));\r
+ small.put("A", new Integer(1));\r
+ small.put("G", new Integer(1));\r
+ small.put("M", new Integer(0));\r
+ small.put("F", new Integer(0));\r
+ small.put("Y", new Integer(0));\r
+ small.put("W", new Integer(0));\r
+ small.put("H", new Integer(0));\r
+ small.put("K", new Integer(0));\r
+ small.put("R", new Integer(0));\r
+ small.put("E", new Integer(0));\r
+ small.put("Q", new Integer(0));\r
+ small.put("D", new Integer(1));\r
+ small.put("N", new Integer(1));\r
+ small.put("S", new Integer(1));\r
+ small.put("T", new Integer(1));\r
+ small.put("P", new Integer(1));\r
+ small.put("-", new Integer(1));\r
+ small.put("*", new Integer(1));\r
+ }\r
+\r
+ static\r
+ {\r
+ positive.put("I", new Integer(0));\r
+ positive.put("L", new Integer(0));\r
+ positive.put("V", new Integer(0));\r
+ positive.put("C", new Integer(0));\r
+ positive.put("A", new Integer(0));\r
+ positive.put("G", new Integer(0));\r
+ positive.put("M", new Integer(0));\r
+ positive.put("F", new Integer(0));\r
+ positive.put("Y", new Integer(0));\r
+ positive.put("W", new Integer(0));\r
+ positive.put("H", new Integer(1));\r
+ positive.put("K", new Integer(1));\r
+ positive.put("R", new Integer(1));\r
+ positive.put("E", new Integer(0));\r
+ positive.put("Q", new Integer(0));\r
+ positive.put("D", new Integer(0));\r
+ positive.put("N", new Integer(0));\r
+ positive.put("S", new Integer(0));\r
+ positive.put("T", new Integer(0));\r
+ positive.put("P", new Integer(0));\r
+ positive.put("-", new Integer(1));\r
+ positive.put("*", new Integer(1));\r
+ }\r
+\r
+ static\r
+ {\r
+ negative.put("I", new Integer(0));\r
+ negative.put("L", new Integer(0));\r
+ negative.put("V", new Integer(0));\r
+ negative.put("C", new Integer(0));\r
+ negative.put("A", new Integer(0));\r
+ negative.put("G", new Integer(0));\r
+ negative.put("M", new Integer(0));\r
+ negative.put("F", new Integer(0));\r
+ negative.put("Y", new Integer(0));\r
+ negative.put("W", new Integer(0));\r
+ negative.put("H", new Integer(0));\r
+ negative.put("K", new Integer(0));\r
+ negative.put("R", new Integer(0));\r
+ negative.put("E", new Integer(1));\r
+ negative.put("Q", new Integer(0));\r
+ negative.put("D", new Integer(1));\r
+ negative.put("N", new Integer(0));\r
+ negative.put("S", new Integer(0));\r
+ negative.put("T", new Integer(0));\r
+ negative.put("P", new Integer(0));\r
+ negative.put("-", new Integer(1));\r
+ negative.put("*", new Integer(1));\r
+ }\r
+\r
+ static\r
+ {\r
+ charged.put("I", new Integer(0));\r
+ charged.put("L", new Integer(0));\r
+ charged.put("V", new Integer(0));\r
+ charged.put("C", new Integer(0));\r
+ charged.put("A", new Integer(0));\r
+ charged.put("G", new Integer(0));\r
+ charged.put("M", new Integer(0));\r
+ charged.put("F", new Integer(0));\r
+ charged.put("Y", new Integer(0));\r
+ charged.put("W", new Integer(0));\r
+ charged.put("H", new Integer(1));\r
+ charged.put("K", new Integer(1));\r
+ charged.put("R", new Integer(1));\r
+ charged.put("E", new Integer(1));\r
+ charged.put("Q", new Integer(0));\r
+ charged.put("D", new Integer(1));\r
+ charged.put("N", new Integer(1));\r
+ charged.put("S", new Integer(0));\r
+ charged.put("T", new Integer(0));\r
+ charged.put("P", new Integer(0));\r
+ charged.put("-", new Integer(1));\r
+ charged.put("*", new Integer(1));\r
+ }\r
+\r
+ static\r
+ {\r
+ aromatic.put("I", new Integer(0));\r
+ aromatic.put("L", new Integer(0));\r
+ aromatic.put("V", new Integer(0));\r
+ aromatic.put("C", new Integer(0));\r
+ aromatic.put("A", new Integer(0));\r
+ aromatic.put("G", new Integer(0));\r
+ aromatic.put("M", new Integer(0));\r
+ aromatic.put("F", new Integer(1));\r
+ aromatic.put("Y", new Integer(1));\r
+ aromatic.put("W", new Integer(1));\r
+ aromatic.put("H", new Integer(1));\r
+ aromatic.put("K", new Integer(0));\r
+ aromatic.put("R", new Integer(0));\r
+ aromatic.put("E", new Integer(0));\r
+ aromatic.put("Q", new Integer(0));\r
+ aromatic.put("D", new Integer(0));\r
+ aromatic.put("N", new Integer(0));\r
+ aromatic.put("S", new Integer(0));\r
+ aromatic.put("T", new Integer(0));\r
+ aromatic.put("P", new Integer(0));\r
+ aromatic.put("-", new Integer(1));\r
+ aromatic.put("*", new Integer(1));\r
+ }\r
+\r
+ static\r
+ {\r
+ aliphatic.put("I", new Integer(1));\r
+ aliphatic.put("L", new Integer(1));\r
+ aliphatic.put("V", new Integer(1));\r
+ aliphatic.put("C", new Integer(0));\r
+ aliphatic.put("A", new Integer(0));\r
+ aliphatic.put("G", new Integer(0));\r
+ aliphatic.put("M", new Integer(0));\r
+ aliphatic.put("F", new Integer(0));\r
+ aliphatic.put("Y", new Integer(0));\r
+ aliphatic.put("W", new Integer(0));\r
+ aliphatic.put("H", new Integer(0));\r
+ aliphatic.put("K", new Integer(0));\r
+ aliphatic.put("R", new Integer(0));\r
+ aliphatic.put("E", new Integer(0));\r
+ aliphatic.put("Q", new Integer(0));\r
+ aliphatic.put("D", new Integer(0));\r
+ aliphatic.put("N", new Integer(0));\r
+ aliphatic.put("S", new Integer(0));\r
+ aliphatic.put("T", new Integer(0));\r
+ aliphatic.put("P", new Integer(0));\r
+ aliphatic.put("-", new Integer(1));\r
+ aliphatic.put("*", new Integer(1));\r
+ }\r
+\r
+ static\r
+ {\r
+ tiny.put("I", new Integer(0));\r
+ tiny.put("L", new Integer(0));\r
+ tiny.put("V", new Integer(0));\r
+ tiny.put("C", new Integer(0));\r
+ tiny.put("A", new Integer(1));\r
+ tiny.put("G", new Integer(1));\r
+ tiny.put("M", new Integer(0));\r
+ tiny.put("F", new Integer(0));\r
+ tiny.put("Y", new Integer(0));\r
+ tiny.put("W", new Integer(0));\r
+ tiny.put("H", new Integer(0));\r
+ tiny.put("K", new Integer(0));\r
+ tiny.put("R", new Integer(0));\r
+ tiny.put("E", new Integer(0));\r
+ tiny.put("Q", new Integer(0));\r
+ tiny.put("D", new Integer(0));\r
+ tiny.put("N", new Integer(0));\r
+ tiny.put("S", new Integer(1));\r
+ tiny.put("T", new Integer(0));\r
+ tiny.put("P", new Integer(0));\r
+ tiny.put("-", new Integer(1));\r
+ tiny.put("*", new Integer(1));\r
+ }\r
+\r
+ static\r
+ {\r
+ proline.put("I", new Integer(0));\r
+ proline.put("L", new Integer(0));\r
+ proline.put("V", new Integer(0));\r
+ proline.put("C", new Integer(0));\r
+ proline.put("A", new Integer(0));\r
+ proline.put("G", new Integer(0));\r
+ proline.put("M", new Integer(0));\r
+ proline.put("F", new Integer(0));\r
+ proline.put("Y", new Integer(0));\r
+ proline.put("W", new Integer(0));\r
+ proline.put("H", new Integer(0));\r
+ proline.put("K", new Integer(0));\r
+ proline.put("R", new Integer(0));\r
+ proline.put("E", new Integer(0));\r
+ proline.put("Q", new Integer(0));\r
+ proline.put("D", new Integer(0));\r
+ proline.put("N", new Integer(0));\r
+ proline.put("S", new Integer(0));\r
+ proline.put("T", new Integer(0));\r
+ proline.put("P", new Integer(1));\r
+ proline.put("-", new Integer(1));\r
+ proline.put("*", new Integer(1));\r
+ }\r
+\r
+ static\r
+ {\r
+ propHash.put("hydrophobic", hydrophobic);\r
+ propHash.put("small", small);\r
+ propHash.put("positive", positive);\r
+ propHash.put("negative", negative);\r
+ propHash.put("charged", charged);\r
+ propHash.put("aromatic", aromatic);\r
+ propHash.put("aliphatic", aliphatic);\r
+ propHash.put("tiny", tiny);\r
+ propHash.put("proline", proline);\r
+ propHash.put("polar", polar);\r
+ }\r
+\r
+ public static Hashtable chainColours = new Hashtable();\r
+\r
+ static\r
+ {\r
+ chainColours.put("A", Color.red);\r
+ chainColours.put("B", Color.orange);\r
+ chainColours.put("C", Color.yellow);\r
+ chainColours.put("D", Color.green);\r
+ chainColours.put("E", Color.cyan);\r
+ chainColours.put("F", Color.blue);\r
+ chainColours.put("G", Color.magenta);\r
+ chainColours.put("H", Color.pink);\r
+ }\r
+\r
+ private ResidueProperties()\r
+ {\r
+ }\r
+\r
+ public static double getHydmax()\r
+ {\r
+ return hydmax;\r
+ }\r
+\r
+ public static double getHydmin()\r
+ {\r
+ return hydmin;\r
+ }\r
+\r
+ public static double[] getHyd()\r
+ {\r
+ return hyd;\r
+ }\r
+\r
+ public static Hashtable getAAHash()\r
+ {\r
+ return aaHash;\r
+ }\r
+\r
+ public static Hashtable getAA3Hash()\r
+ {\r
+ return aa3Hash;\r
+ }\r
+\r
+ public static int[][] getDNA()\r
+ {\r
+ return ResidueProperties.DNA;\r
+ }\r
+\r
+ public static int[][] getBLOSUM62()\r
+ {\r
+ return ResidueProperties.BLOSUM62;\r
+ }\r
+\r
+ public static int getPAM250(String A1, String A2)\r
+ {\r
+ Integer pog1 = (Integer) aaHash.get(A1);\r
+ Integer pog2 = (Integer) aaHash.get(A2);\r
+ int pog = ResidueProperties.PAM250[pog1.intValue()][pog2.intValue()];\r
+\r
+ return pog;\r
+ }\r
+\r
+ public static int getBLOSUM62(String A1, String A2)\r
+ {\r
+ int pog = 0;\r
+\r
+ try\r
+ {\r
+ Integer pog1 = (Integer) aaHash.get(A1);\r
+ Integer pog2 = (Integer) aaHash.get(A2);\r
+ pog = ResidueProperties.BLOSUM62[pog1.intValue()][pog2.intValue()];\r
}\r
-\r
- public static Hashtable codonHash2 = new Hashtable();\r
-\r
- static {\r
- codonHash2.put("AAA", "K");\r
- codonHash2.put("AAG", "K");\r
- codonHash2.put("AAC", "N");\r
- codonHash2.put("AAT", "N");\r
-\r
- codonHash2.put("CAA", "E");\r
- codonHash2.put("CAG", "E");\r
- codonHash2.put("CAC", "H");\r
- codonHash2.put("CAT", "H");\r
-\r
- codonHash2.put("GAA", "Q");\r
- codonHash2.put("GAG", "Q");\r
- codonHash2.put("GAC", "D");\r
- codonHash2.put("GAT", "D");\r
-\r
- codonHash2.put("TAC", "Y");\r
- codonHash2.put("TAT", "Y");\r
-\r
- codonHash2.put("ACA", "T");\r
- codonHash2.put("AAG", "T");\r
- codonHash2.put("ACC", "T");\r
- codonHash2.put("ACT", "T");\r
-\r
- codonHash2.put("CCA", "P");\r
- codonHash2.put("CCG", "P");\r
- codonHash2.put("CCC", "P");\r
- codonHash2.put("CCT", "P");\r
-\r
- codonHash2.put("GCA", "A");\r
- codonHash2.put("GCG", "A");\r
- codonHash2.put("GCC", "A");\r
- codonHash2.put("GCT", "A");\r
-\r
- codonHash2.put("TCA", "S");\r
- codonHash2.put("TCG", "S");\r
- codonHash2.put("TCC", "S");\r
- codonHash2.put("TCT", "S");\r
- codonHash2.put("AGC", "S");\r
- codonHash2.put("AGT", "S");\r
-\r
- codonHash2.put("AGA", "R");\r
- codonHash2.put("AGG", "R");\r
- codonHash2.put("CGA", "R");\r
- codonHash2.put("CGG", "R");\r
- codonHash2.put("CGC", "R");\r
- codonHash2.put("CGT", "R");\r
-\r
- codonHash2.put("GGA", "G");\r
- codonHash2.put("GGG", "G");\r
- codonHash2.put("GGC", "G");\r
- codonHash2.put("GGT", "G");\r
-\r
- codonHash2.put("TGA", "*");\r
- codonHash2.put("TAA", "*");\r
- codonHash2.put("TAG", "*");\r
-\r
- codonHash2.put("TGG", "W");\r
-\r
- codonHash2.put("TGC", "C");\r
- codonHash2.put("TGT", "C");\r
-\r
- codonHash2.put("ATA", "I");\r
- codonHash2.put("ATC", "I");\r
- codonHash2.put("ATT", "I");\r
-\r
- codonHash2.put("ATG", "M");\r
-\r
- codonHash2.put("CTA", "L");\r
- codonHash2.put("CTG", "L");\r
- codonHash2.put("CTC", "L");\r
- codonHash2.put("CTT", "L");\r
- codonHash2.put("TTA", "L");\r
- codonHash2.put("TTG", "L");\r
-\r
- codonHash2.put("GTA", "V");\r
- codonHash2.put("GTG", "V");\r
- codonHash2.put("GTC", "V");\r
- codonHash2.put("GTT", "V");\r
-\r
- codonHash2.put("TTC", "F");\r
- codonHash2.put("TTT", "F");\r
+ catch (Exception e)\r
+ {\r
+ //System.out.println("Unknown residue in " + A1 + " " + A2);\r
}\r
\r
- static {\r
- Lys.addElement("AAA");\r
- Lys.addElement("AAG");\r
- Asn.addElement("AAC");\r
- Asn.addElement("AAT");\r
-\r
- Gln.addElement("CAA");\r
- Gln.addElement("CAG");\r
- His.addElement("CAC");\r
- His.addElement("CAT");\r
-\r
- Glu.addElement("GAA");\r
- Glu.addElement("GAG");\r
- Asp.addElement("GAC");\r
- Asp.addElement("GAT");\r
-\r
- Tyr.addElement("TAC");\r
- Tyr.addElement("TAT");\r
-\r
- Thr.addElement("ACA");\r
- Thr.addElement("ACG");\r
- Thr.addElement("ACC");\r
- Thr.addElement("ACT");\r
-\r
- Pro.addElement("CCA");\r
- Pro.addElement("CCG");\r
- Pro.addElement("CCC");\r
- Pro.addElement("CCT");\r
-\r
- Ala.addElement("GCA");\r
- Ala.addElement("GCG");\r
- Ala.addElement("GCC");\r
- Ala.addElement("GCT");\r
-\r
- Ser.addElement("TCA");\r
- Ser.addElement("TCG");\r
- Ser.addElement("TCC");\r
- Ser.addElement("TCT");\r
- Ser.addElement("AGC");\r
- Ser.addElement("AGT");\r
-\r
- Arg.addElement("AGA");\r
- Arg.addElement("AGG");\r
- Arg.addElement("CGA");\r
- Arg.addElement("CGG");\r
- Arg.addElement("CGC");\r
- Arg.addElement("CGT");\r
-\r
- Gly.addElement("GGA");\r
- Gly.addElement("GGG");\r
- Gly.addElement("GGC");\r
- Gly.addElement("GGT");\r
-\r
- STOP.addElement("TGA");\r
- STOP.addElement("TAA");\r
- STOP.addElement("TAG");\r
-\r
- Trp.addElement("TGG");\r
-\r
- Cys.addElement("TGC");\r
- Cys.addElement("TGT");\r
-\r
- Ile.addElement("ATA");\r
- Ile.addElement("ATC");\r
- Ile.addElement("ATT");\r
-\r
- Met.addElement("ATG");\r
-\r
- Leu.addElement("CTA");\r
- Leu.addElement("CTG");\r
- Leu.addElement("CTC");\r
- Leu.addElement("CTT");\r
- Leu.addElement("TTA");\r
- Leu.addElement("TTG");\r
-\r
- Val.addElement("GTA");\r
- Val.addElement("GTG");\r
- Val.addElement("GTC");\r
- Val.addElement("GTT");\r
-\r
- Phe.addElement("TTC");\r
- Phe.addElement("TTT");\r
- }\r
+ return pog;\r
+ }\r
\r
- public static Color[][] groupColors = {\r
- { Color.red, Color.red.brighter(), Color.red.brighter().brighter() },\r
- {\r
- Color.orange, Color.orange.brighter(),\r
- Color.orange.brighter().brighter()\r
- },\r
- { Color.green, Color.green.brighter(), Color.green.brighter().brighter() },\r
- { Color.blue, Color.blue.brighter(), Color.blue.brighter().brighter() },\r
- {\r
- Color.magenta, Color.magenta.brighter(),\r
- Color.magenta.brighter().brighter()\r
- },\r
- { Color.cyan, Color.cyan.brighter(), Color.cyan.brighter().brighter() },\r
- { Color.pink, Color.pink.brighter(), Color.pink.brighter().brighter() },\r
- };\r
-\r
- //Stores residue codes/names and colours and other things\r
- public static Hashtable propHash = new Hashtable();\r
- public static Hashtable hydrophobic = new Hashtable();\r
- public static Hashtable polar = new Hashtable();\r
- public static Hashtable small = new Hashtable();\r
- public static Hashtable positive = new Hashtable();\r
- public static Hashtable negative = new Hashtable();\r
- public static Hashtable charged = new Hashtable();\r
- public static Hashtable aromatic = new Hashtable();\r
- public static Hashtable aliphatic = new Hashtable();\r
- public static Hashtable tiny = new Hashtable();\r
- public static Hashtable proline = new Hashtable();\r
-\r
- static {\r
- hydrophobic.put("I", new Integer(1));\r
- hydrophobic.put("L", new Integer(1));\r
- hydrophobic.put("V", new Integer(1));\r
- hydrophobic.put("C", new Integer(1));\r
- hydrophobic.put("A", new Integer(1));\r
- hydrophobic.put("G", new Integer(1));\r
- hydrophobic.put("M", new Integer(1));\r
- hydrophobic.put("F", new Integer(1));\r
- hydrophobic.put("Y", new Integer(1));\r
- hydrophobic.put("W", new Integer(1));\r
- hydrophobic.put("H", new Integer(1));\r
- hydrophobic.put("K", new Integer(1));\r
- hydrophobic.put("X", new Integer(1));\r
- hydrophobic.put("-", new Integer(1));\r
- hydrophobic.put("*", new Integer(1));\r
- hydrophobic.put("R", new Integer(0));\r
- hydrophobic.put("E", new Integer(0));\r
- hydrophobic.put("Q", new Integer(0));\r
- hydrophobic.put("D", new Integer(0));\r
- hydrophobic.put("N", new Integer(0));\r
- hydrophobic.put("S", new Integer(0));\r
- hydrophobic.put("T", new Integer(0));\r
- hydrophobic.put("P", new Integer(0));\r
+ public static Vector getCodons(String res)\r
+ {\r
+ if (codonHash.containsKey(res))\r
+ {\r
+ return (Vector) codonHash.get(res);\r
}\r
\r
- static {\r
- polar.put("Y", new Integer(1));\r
- polar.put("W", new Integer(1));\r
- polar.put("H", new Integer(1));\r
- polar.put("K", new Integer(1));\r
- polar.put("R", new Integer(1));\r
- polar.put("E", new Integer(1));\r
- polar.put("Q", new Integer(1));\r
- polar.put("D", new Integer(1));\r
- polar.put("N", new Integer(1));\r
- polar.put("S", new Integer(1));\r
- polar.put("T", new Integer(1));\r
- polar.put("X", new Integer(1));\r
- polar.put("-", new Integer(1));\r
- polar.put("*", new Integer(1));\r
- polar.put("I", new Integer(0));\r
- polar.put("L", new Integer(0));\r
- polar.put("V", new Integer(0));\r
- polar.put("C", new Integer(0));\r
- polar.put("A", new Integer(0));\r
- polar.put("G", new Integer(0));\r
- polar.put("M", new Integer(0));\r
- polar.put("F", new Integer(0));\r
- polar.put("P", new Integer(0));\r
- }\r
+ return null;\r
+ }\r
\r
- static {\r
- small.put("I", new Integer(0));\r
- small.put("L", new Integer(0));\r
- small.put("V", new Integer(1));\r
- small.put("C", new Integer(1));\r
- small.put("A", new Integer(1));\r
- small.put("G", new Integer(1));\r
- small.put("M", new Integer(0));\r
- small.put("F", new Integer(0));\r
- small.put("Y", new Integer(0));\r
- small.put("W", new Integer(0));\r
- small.put("H", new Integer(0));\r
- small.put("K", new Integer(0));\r
- small.put("R", new Integer(0));\r
- small.put("E", new Integer(0));\r
- small.put("Q", new Integer(0));\r
- small.put("D", new Integer(1));\r
- small.put("N", new Integer(1));\r
- small.put("S", new Integer(1));\r
- small.put("T", new Integer(1));\r
- small.put("P", new Integer(1));\r
- small.put("-", new Integer(1));\r
- small.put("*", new Integer(1));\r
- }\r
+ public static String codonTranslate(String codon)\r
+ {\r
+ Enumeration e = codonHash.keys();\r
\r
- static {\r
- positive.put("I", new Integer(0));\r
- positive.put("L", new Integer(0));\r
- positive.put("V", new Integer(0));\r
- positive.put("C", new Integer(0));\r
- positive.put("A", new Integer(0));\r
- positive.put("G", new Integer(0));\r
- positive.put("M", new Integer(0));\r
- positive.put("F", new Integer(0));\r
- positive.put("Y", new Integer(0));\r
- positive.put("W", new Integer(0));\r
- positive.put("H", new Integer(1));\r
- positive.put("K", new Integer(1));\r
- positive.put("R", new Integer(1));\r
- positive.put("E", new Integer(0));\r
- positive.put("Q", new Integer(0));\r
- positive.put("D", new Integer(0));\r
- positive.put("N", new Integer(0));\r
- positive.put("S", new Integer(0));\r
- positive.put("T", new Integer(0));\r
- positive.put("P", new Integer(0));\r
- positive.put("-", new Integer(1));\r
- positive.put("*", new Integer(1));\r
- }\r
+ while (e.hasMoreElements())\r
+ {\r
+ String key = (String) e.nextElement();\r
+ Vector tmp = (Vector) codonHash.get(key);\r
\r
- static {\r
- negative.put("I", new Integer(0));\r
- negative.put("L", new Integer(0));\r
- negative.put("V", new Integer(0));\r
- negative.put("C", new Integer(0));\r
- negative.put("A", new Integer(0));\r
- negative.put("G", new Integer(0));\r
- negative.put("M", new Integer(0));\r
- negative.put("F", new Integer(0));\r
- negative.put("Y", new Integer(0));\r
- negative.put("W", new Integer(0));\r
- negative.put("H", new Integer(0));\r
- negative.put("K", new Integer(0));\r
- negative.put("R", new Integer(0));\r
- negative.put("E", new Integer(1));\r
- negative.put("Q", new Integer(0));\r
- negative.put("D", new Integer(1));\r
- negative.put("N", new Integer(0));\r
- negative.put("S", new Integer(0));\r
- negative.put("T", new Integer(0));\r
- negative.put("P", new Integer(0));\r
- negative.put("-", new Integer(1));\r
- negative.put("*", new Integer(1));\r
+ if (tmp.contains(codon))\r
+ {\r
+ return key;\r
+ }\r
}\r
\r
- static {\r
- charged.put("I", new Integer(0));\r
- charged.put("L", new Integer(0));\r
- charged.put("V", new Integer(0));\r
- charged.put("C", new Integer(0));\r
- charged.put("A", new Integer(0));\r
- charged.put("G", new Integer(0));\r
- charged.put("M", new Integer(0));\r
- charged.put("F", new Integer(0));\r
- charged.put("Y", new Integer(0));\r
- charged.put("W", new Integer(0));\r
- charged.put("H", new Integer(1));\r
- charged.put("K", new Integer(1));\r
- charged.put("R", new Integer(1));\r
- charged.put("E", new Integer(1));\r
- charged.put("Q", new Integer(0));\r
- charged.put("D", new Integer(1));\r
- charged.put("N", new Integer(1));\r
- charged.put("S", new Integer(0));\r
- charged.put("T", new Integer(0));\r
- charged.put("P", new Integer(0));\r
- charged.put("-", new Integer(1));\r
- charged.put("*", new Integer(1));\r
- }\r
-\r
- static {\r
- aromatic.put("I", new Integer(0));\r
- aromatic.put("L", new Integer(0));\r
- aromatic.put("V", new Integer(0));\r
- aromatic.put("C", new Integer(0));\r
- aromatic.put("A", new Integer(0));\r
- aromatic.put("G", new Integer(0));\r
- aromatic.put("M", new Integer(0));\r
- aromatic.put("F", new Integer(1));\r
- aromatic.put("Y", new Integer(1));\r
- aromatic.put("W", new Integer(1));\r
- aromatic.put("H", new Integer(1));\r
- aromatic.put("K", new Integer(0));\r
- aromatic.put("R", new Integer(0));\r
- aromatic.put("E", new Integer(0));\r
- aromatic.put("Q", new Integer(0));\r
- aromatic.put("D", new Integer(0));\r
- aromatic.put("N", new Integer(0));\r
- aromatic.put("S", new Integer(0));\r
- aromatic.put("T", new Integer(0));\r
- aromatic.put("P", new Integer(0));\r
- aromatic.put("-", new Integer(1));\r
- aromatic.put("*", new Integer(1));\r
- }\r
+ return null;\r
+ }\r
\r
- static {\r
- aliphatic.put("I", new Integer(1));\r
- aliphatic.put("L", new Integer(1));\r
- aliphatic.put("V", new Integer(1));\r
- aliphatic.put("C", new Integer(0));\r
- aliphatic.put("A", new Integer(0));\r
- aliphatic.put("G", new Integer(0));\r
- aliphatic.put("M", new Integer(0));\r
- aliphatic.put("F", new Integer(0));\r
- aliphatic.put("Y", new Integer(0));\r
- aliphatic.put("W", new Integer(0));\r
- aliphatic.put("H", new Integer(0));\r
- aliphatic.put("K", new Integer(0));\r
- aliphatic.put("R", new Integer(0));\r
- aliphatic.put("E", new Integer(0));\r
- aliphatic.put("Q", new Integer(0));\r
- aliphatic.put("D", new Integer(0));\r
- aliphatic.put("N", new Integer(0));\r
- aliphatic.put("S", new Integer(0));\r
- aliphatic.put("T", new Integer(0));\r
- aliphatic.put("P", new Integer(0));\r
- aliphatic.put("-", new Integer(1));\r
- aliphatic.put("*", new Integer(1));\r
- }\r
-\r
- static {\r
- tiny.put("I", new Integer(0));\r
- tiny.put("L", new Integer(0));\r
- tiny.put("V", new Integer(0));\r
- tiny.put("C", new Integer(0));\r
- tiny.put("A", new Integer(1));\r
- tiny.put("G", new Integer(1));\r
- tiny.put("M", new Integer(0));\r
- tiny.put("F", new Integer(0));\r
- tiny.put("Y", new Integer(0));\r
- tiny.put("W", new Integer(0));\r
- tiny.put("H", new Integer(0));\r
- tiny.put("K", new Integer(0));\r
- tiny.put("R", new Integer(0));\r
- tiny.put("E", new Integer(0));\r
- tiny.put("Q", new Integer(0));\r
- tiny.put("D", new Integer(0));\r
- tiny.put("N", new Integer(0));\r
- tiny.put("S", new Integer(1));\r
- tiny.put("T", new Integer(0));\r
- tiny.put("P", new Integer(0));\r
- tiny.put("-", new Integer(1));\r
- tiny.put("*", new Integer(1));\r
- }\r
-\r
- static {\r
- proline.put("I", new Integer(0));\r
- proline.put("L", new Integer(0));\r
- proline.put("V", new Integer(0));\r
- proline.put("C", new Integer(0));\r
- proline.put("A", new Integer(0));\r
- proline.put("G", new Integer(0));\r
- proline.put("M", new Integer(0));\r
- proline.put("F", new Integer(0));\r
- proline.put("Y", new Integer(0));\r
- proline.put("W", new Integer(0));\r
- proline.put("H", new Integer(0));\r
- proline.put("K", new Integer(0));\r
- proline.put("R", new Integer(0));\r
- proline.put("E", new Integer(0));\r
- proline.put("Q", new Integer(0));\r
- proline.put("D", new Integer(0));\r
- proline.put("N", new Integer(0));\r
- proline.put("S", new Integer(0));\r
- proline.put("T", new Integer(0));\r
- proline.put("P", new Integer(1));\r
- proline.put("-", new Integer(1));\r
- proline.put("*", new Integer(1));\r
- }\r
-\r
- static {\r
- propHash.put("hydrophobic", hydrophobic);\r
- propHash.put("small", small);\r
- propHash.put("positive", positive);\r
- propHash.put("negative", negative);\r
- propHash.put("charged", charged);\r
- propHash.put("aromatic", aromatic);\r
- propHash.put("aliphatic", aliphatic);\r
- propHash.put("tiny", tiny);\r
- propHash.put("proline", proline);\r
- propHash.put("polar", polar);\r
- }\r
-\r
- public static Hashtable chainColours = new Hashtable();\r
-\r
- static {\r
- chainColours.put("A", Color.red);\r
- chainColours.put("B", Color.orange);\r
- chainColours.put("C", Color.yellow);\r
- chainColours.put("D", Color.green);\r
- chainColours.put("E", Color.cyan);\r
- chainColours.put("F", Color.blue);\r
- chainColours.put("G", Color.magenta);\r
- chainColours.put("H", Color.pink);\r
- }\r
-\r
- private ResidueProperties() {\r
- }\r
-\r
- public static double getHydmax() {\r
- return hydmax;\r
- }\r
-\r
- public static double getHydmin() {\r
- return hydmin;\r
- }\r
-\r
- public static double[] getHyd() {\r
- return hyd;\r
- }\r
-\r
- public static Hashtable getAAHash() {\r
- return aaHash;\r
- }\r
-\r
- public static Hashtable getAA3Hash() {\r
- return aa3Hash;\r
- }\r
-\r
- public static int[][] getDNA() {\r
- return ResidueProperties.DNA;\r
- }\r
-\r
- public static int[][] getBLOSUM62() {\r
- return ResidueProperties.BLOSUM62;\r
- }\r
-\r
- public static int getPAM250(String A1, String A2) {\r
- Integer pog1 = (Integer) aaHash.get(A1);\r
- Integer pog2 = (Integer) aaHash.get(A2);\r
- int pog = ResidueProperties.PAM250[pog1.intValue()][pog2.intValue()];\r
-\r
- return pog;\r
- }\r
-\r
- public static int getBLOSUM62(String A1, String A2) {\r
- int pog = 0;\r
-\r
- try {\r
- Integer pog1 = (Integer) aaHash.get(A1);\r
- Integer pog2 = (Integer) aaHash.get(A2);\r
- pog = ResidueProperties.BLOSUM62[pog1.intValue()][pog2.intValue()];\r
- } catch (Exception e) {\r
- //System.out.println("Unknown residue in " + A1 + " " + A2);\r
- }\r
-\r
- return pog;\r
- }\r
-\r
- public static Vector getCodons(String res) {\r
- if (codonHash.containsKey(res)) {\r
- return (Vector) codonHash.get(res);\r
- }\r
-\r
- return null;\r
- }\r
-\r
- public static String codonTranslate(String codon) {\r
- Enumeration e = codonHash.keys();\r
-\r
- while (e.hasMoreElements()) {\r
- String key = (String) e.nextElement();\r
- Vector tmp = (Vector) codonHash.get(key);\r
-\r
- if (tmp.contains(codon)) {\r
- return key;\r
- }\r
- }\r
-\r
- return null;\r
- }\r
-\r
- public static Hashtable getChainColours() {\r
- return chainColours;\r
- }\r
+ public static Hashtable getChainColours()\r
+ {\r
+ return chainColours;\r
+ }\r
}\r
import java.awt.*;\r
\r
\r
-public class ScoreColourScheme extends ResidueColourScheme {\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class ScoreColourScheme extends ResidueColourScheme\r
+{\r
+ /** DOCUMENT ME!! */\r
public double min;\r
+\r
+ /** DOCUMENT ME!! */\r
public double max;\r
+\r
+ /** DOCUMENT ME!! */\r
public double[] scores;\r
\r
- public ScoreColourScheme(double[] scores, double min, double max) {\r
+ /**\r
+ * Creates a new ScoreColourScheme object.\r
+ *\r
+ * @param scores DOCUMENT ME!\r
+ * @param min DOCUMENT ME!\r
+ * @param max DOCUMENT ME!\r
+ */\r
+ public ScoreColourScheme(double[] scores, double min, double max)\r
+ {\r
super();\r
\r
this.scores = scores;\r
this.max = max;\r
}\r
\r
- public Color findColour(String s, int j) {\r
- if (threshold > 0) {\r
- if (!aboveThreshold(s, j)) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param s DOCUMENT ME!\r
+ * @param j DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public Color findColour(String s, int j)\r
+ {\r
+ if (threshold > 0)\r
+ {\r
+ if (!aboveThreshold(s, j))\r
+ {\r
return Color.white;\r
}\r
}\r
float red = (float) (scores[((Integer) ResidueProperties.aaHash.get(s)).intValue()] -\r
(float) min) / (float) (max - min);\r
\r
- if (red > 1.0f) {\r
+ if (red > 1.0f)\r
+ {\r
red = 1.0f;\r
}\r
\r
- if (red < 0.0f) {\r
+ if (red < 0.0f)\r
+ {\r
red = 0.0f;\r
}\r
\r
char c = s.charAt(0);\r
\r
- if (jalview.util.Comparison.isGap((c))) {\r
+ if (jalview.util.Comparison.isGap((c)))\r
+ {\r
return Color.white;\r
}\r
\r
return makeColour(red);\r
}\r
\r
- public Color makeColour(float c) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param c DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public Color makeColour(float c)\r
+ {\r
return new Color(c, (float) 0.0, (float) 1.0 - c);\r
}\r
}\r
import java.awt.*;\r
\r
\r
-public class StrandColourScheme extends ScoreColourScheme {\r
- public StrandColourScheme() {\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class StrandColourScheme extends ScoreColourScheme\r
+{\r
+ /**\r
+ * Creates a new StrandColourScheme object.\r
+ */\r
+ public StrandColourScheme()\r
+ {\r
super(ResidueProperties.strand, ResidueProperties.strandmin,\r
ResidueProperties.strandmax);\r
}\r
\r
- public Color makeColour(float c) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param c DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public Color makeColour(float c)\r
+ {\r
return new Color(c, c, (float) 1.0 - c);\r
}\r
}\r
/*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
-*\r
-* This program is free software; you can redistribute it and/or\r
-* modify it under the terms of the GNU General Public License\r
-* as published by the Free Software Foundation; either version 2\r
-* of the License, or (at your option) any later version.\r
-*\r
-* This program is distributed in the hope that it will be useful,\r
-* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-* GNU General Public License for more details.\r
-*\r
-* You should have received a copy of the GNU General Public License\r
-* along with this program; if not, write to the Free Software\r
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
-*/\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
+ */\r
package jalview.schemes;\r
\r
-public class TaylorColourScheme extends ResidueColourScheme {\r
- public TaylorColourScheme() {\r
- super(ResidueProperties.taylor, 0);\r
- }\r
+public class TaylorColourScheme\r
+ extends ResidueColourScheme\r
+{\r
+ public TaylorColourScheme()\r
+ {\r
+ super(ResidueProperties.taylor, 0);\r
+ }\r
}\r
import java.awt.*;\r
\r
\r
-public class TurnColourScheme extends ScoreColourScheme {\r
- public TurnColourScheme() {\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class TurnColourScheme extends ScoreColourScheme\r
+{\r
+ /**\r
+ * Creates a new TurnColourScheme object.\r
+ */\r
+ public TurnColourScheme()\r
+ {\r
super(ResidueProperties.turn, ResidueProperties.turnmin,\r
ResidueProperties.turnmax);\r
}\r
\r
- public Color makeColour(float c) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param c DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public Color makeColour(float c)\r
+ {\r
return new Color(c, 1 - c, 1 - c);\r
}\r
}\r
/*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
-*\r
-* This program is free software; you can redistribute it and/or\r
-* modify it under the terms of the GNU General Public License\r
-* as published by the Free Software Foundation; either version 2\r
-* of the License, or (at your option) any later version.\r
-*\r
-* This program is distributed in the hope that it will be useful,\r
-* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-* GNU General Public License for more details.\r
-*\r
-* You should have received a copy of the GNU General Public License\r
-* along with this program; if not, write to the Free Software\r
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
-*/\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
+ */\r
package jalview.schemes;\r
\r
import java.awt.*;\r
\r
-\r
-public class UserColourScheme extends ResidueColourScheme {\r
- public UserColourScheme(Color[] newColors) {\r
- colors = newColors;\r
+public class UserColourScheme\r
+ extends ResidueColourScheme\r
+{\r
+ public UserColourScheme(String colour)\r
+ {\r
+ Color col = null;\r
+ try{\r
+ int value = Integer.parseInt(colour, 16);\r
+ col = new Color(value);\r
}\r
+ catch(NumberFormatException ex){}\r
+\r
+ if(col==null)\r
+ col = ColourSchemeProperty.getAWTColorFromName(colour);\r
\r
- public Color[] getColours() {\r
- return colors;\r
+ if(col==null)\r
+ {\r
+ System.out.println("Unknown colour!! "+colour);\r
}\r
+\r
+ colors = new Color[24];\r
+ for(int i=0; i<24; i++)\r
+ colors[i] = col;\r
+ }\r
+\r
+ public UserColourScheme(Color[] newColors)\r
+ {\r
+ colors = newColors;\r
+ }\r
+\r
+ public Color[] getColours()\r
+ {\r
+ return colors;\r
+ }\r
}\r
*/\r
package jalview.schemes;\r
\r
-public class ZappoColourScheme extends ResidueColourScheme {\r
- public ZappoColourScheme() {\r
+\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class ZappoColourScheme extends ResidueColourScheme\r
+{\r
+ /**\r
+ * Creates a new ZappoColourScheme object.\r
+ */\r
+ public ZappoColourScheme()\r
+ {\r
super(ResidueProperties.color, 0);\r
}\r
}\r
-/*
-* Jalview - A Sequence Alignment Editor and Viewer
-* Copyright (C) 2005 AM Waterhouse, J Procter, 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 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.
-*
-* 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
-*/\r
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
+ */\r
package jalview.util;\r
\r
-import java.io.File;\r
-import java.io.IOException;\r
-\r
-import java.lang.reflect.Constructor;\r
-import java.lang.reflect.Field;\r
-import java.lang.reflect.InvocationTargetException;\r
-import java.lang.reflect.Method;\r
-\r
-\r
-/**
- * BrowserLauncher is a class that provides one static method, openURL, which opens the default
- * web browser for the current user of the system to the given URL. It may support other
- * protocols depending on the system -- mailto, ftp, etc. -- but that has not been rigorously
- * tested and is not guaranteed to work.
- * <p>
- * Yes, this is platform-specific code, and yes, it may rely on classes on certain platforms
- * that are not part of the standard JDK. What we're trying to do, though, is to take something
- * that's frequently desirable but inherently platform-specific -- opening a default browser --
- * and allow programmers (you, for example) to do so without worrying about dropping into native
- * code or doing anything else similarly evil.
- * <p>
- * Anyway, this code is completely in Java and will run on all JDK 1.1-compliant systems without
- * modification or a need for additional libraries. All classes that are required on certain
- * platforms to allow this to run are dynamically loaded at runtime via reflection and, if not
- * found, will not cause this to do anything other than returning an error when opening the
- * browser.
- * <p>
- * There are certain system requirements for this class, as it's running through Runtime.exec(),
- * which is Java's way of making a native system call. Currently, this requires that a Macintosh
- * have a Finder which supports the GURL event, which is true for Mac OS 8.0 and 8.1 systems that
- * have the Internet Scripting AppleScript dictionary installed in the Scripting Additions folder
- * in the Extensions folder (which is installed by default as far as I know under Mac OS 8.0 and
- * 8.1), and for all Mac OS 8.5 and later systems. On Windows, it only runs under Win32 systems
- * (Windows 95, 98, and NT 4.0, as well as later versions of all). On other systems, this drops
- * back from the inherently platform-sensitive concept of a default browser and simply attempts
- * to launch Netscape via a shell command.
- * <p>
- * This code is Copyright 1999-2001 by Eric Albert (ejalbert\@cs.stanford.edu) and may be
- * redistributed or modified in any form without restrictions as long as the portion of this
- * comment from this paragraph through the end of the comment is not removed. The author
- * requests that he be notified of any application, applet, or other binary that makes use of
- * this code, but that's more out of curiosity than anything and is not required. This software
- * includes no warranty. The author is not repsonsible for any loss of data or functionality
- * or any adverse or unexpected effects of using this software.
- * <p>
- * Credits:
- * <br>Steven Spencer, JavaWorld magazine (<a href="http://www.javaworld.com/javaworld/javatips/jw-javatip66.html">Java Tip 66</a>)
- * <br>Thanks also to Ron B. Yeh, Eric Shapiro, Ben Engber, Paul Teitlebaum, Andrea Cantatore,
- * Larry Barowski, Trevor Bedzek, Frank Miedrich, and Ron Rabakukk
- *
- * @author Eric Albert (<a href="mailto:ejalbert@cs.stanford.edu">ejalbert@cs.stanford.edu</a>)
- * @version 1.4b1 (Released June 20, 2001)
- */\r
-public class BrowserLauncher {\r
- /**
- * The Java virtual machine that we are running on. Actually, in most cases we only care
- * about the operating system, but some operating systems require us to switch on the VM. */\r
- private static int jvm;\r
-\r
- /** The browser for the system */\r
- private static Object browser;\r
-\r
- /**
- * Caches whether any classes, methods, and fields that are not part of the JDK and need to
- * be dynamically loaded at runtime loaded successfully.
- * <p>
- * Note that if this is <code>false</code>, <code>openURL()</code> will always return an
- * IOException.
+import java.io.*;\r
+import java.lang.reflect.*;\r
+\r
+/**\r
+ * BrowserLauncher is a class that provides one static method, openURL, which opens the default\r
+ * web browser for the current user of the system to the given URL. It may support other\r
+ * protocols depending on the system -- mailto, ftp, etc. -- but that has not been rigorously\r
+ * tested and is not guaranteed to work.\r
+ * <p>\r
+ * Yes, this is platform-specific code, and yes, it may rely on classes on certain platforms\r
+ * that are not part of the standard JDK. What we're trying to do, though, is to take something\r
+ * that's frequently desirable but inherently platform-specific -- opening a default browser --\r
+ * and allow programmers (you, for example) to do so without worrying about dropping into native\r
+ * code or doing anything else similarly evil.\r
+ * <p>\r
+ * Anyway, this code is completely in Java and will run on all JDK 1.1-compliant systems without\r
+ * modification or a need for additional libraries. All classes that are required on certain\r
+ * platforms to allow this to run are dynamically loaded at runtime via reflection and, if not\r
+ * found, will not cause this to do anything other than returning an error when opening the\r
+ * browser.\r
+ * <p>\r
+ * There are certain system requirements for this class, as it's running through Runtime.exec(),\r
+ * which is Java's way of making a native system call. Currently, this requires that a Macintosh\r
+ * have a Finder which supports the GURL event, which is true for Mac OS 8.0 and 8.1 systems that\r
+ * have the Internet Scripting AppleScript dictionary installed in the Scripting Additions folder\r
+ * in the Extensions folder (which is installed by default as far as I know under Mac OS 8.0 and\r
+ * 8.1), and for all Mac OS 8.5 and later systems. On Windows, it only runs under Win32 systems\r
+ * (Windows 95, 98, and NT 4.0, as well as later versions of all). On other systems, this drops\r
+ * back from the inherently platform-sensitive concept of a default browser and simply attempts\r
+ * to launch Netscape via a shell command.\r
+ * <p>\r
+ * This code is Copyright 1999-2001 by Eric Albert (ejalbert\@cs.stanford.edu) and may be\r
+ * redistributed or modified in any form without restrictions as long as the portion of this\r
+ * comment from this paragraph through the end of the comment is not removed. The author\r
+ * requests that he be notified of any application, applet, or other binary that makes use of\r
+ * this code, but that's more out of curiosity than anything and is not required. This software\r
+ * includes no warranty. The author is not repsonsible for any loss of data or functionality\r
+ * or any adverse or unexpected effects of using this software.\r
+ * <p>\r
+ * Credits:\r
+ * <br>Steven Spencer, JavaWorld magazine (<a href="http://www.javaworld.com/javaworld/javatips/jw-javatip66.html">Java Tip 66</a>)\r
+ * <br>Thanks also to Ron B. Yeh, Eric Shapiro, Ben Engber, Paul Teitlebaum, Andrea Cantatore,\r
+ * Larry Barowski, Trevor Bedzek, Frank Miedrich, and Ron Rabakukk\r
+ *\r
+ * @author Eric Albert (<a href="mailto:ejalbert@cs.stanford.edu">ejalbert@cs.stanford.edu</a>)\r
+ * @version 1.4b1 (Released June 20, 2001)\r
*/\r
- private static boolean loadedWithoutErrors;\r
+public class BrowserLauncher\r
+{\r
+ /**\r
+ * The Java virtual machine that we are running on. Actually, in most cases we only care\r
+ * about the operating system, but some operating systems require us to switch on the VM. */\r
+ private static int jvm;\r
\r
- /** The com.apple.mrj.MRJFileUtils class */\r
- private static Class mrjFileUtilsClass;\r
+ /** The browser for the system */\r
+ private static Object browser;\r
\r
- /** The com.apple.mrj.MRJOSType class */\r
- private static Class mrjOSTypeClass;\r
+ /**\r
+ * Caches whether any classes, methods, and fields that are not part of the JDK and need to\r
+ * be dynamically loaded at runtime loaded successfully.\r
+ * <p>\r
+ * Note that if this is <code>false</code>, <code>openURL()</code> will always return an\r
+ * IOException.\r
+ */\r
+ private static boolean loadedWithoutErrors;\r
\r
- /** The com.apple.MacOS.AEDesc class */\r
- private static Class aeDescClass;\r
+ /** The com.apple.mrj.MRJFileUtils class */\r
+ private static Class mrjFileUtilsClass;\r
\r
- /** The <init>(int) method of com.apple.MacOS.AETarget */\r
- private static Constructor aeTargetConstructor;\r
+ /** The com.apple.mrj.MRJOSType class */\r
+ private static Class mrjOSTypeClass;\r
\r
- /** The <init>(int, int, int) method of com.apple.MacOS.AppleEvent */\r
- private static Constructor appleEventConstructor;\r
+ /** The com.apple.MacOS.AEDesc class */\r
+ private static Class aeDescClass;\r
\r
- /** The <init>(String) method of com.apple.MacOS.AEDesc */\r
- private static Constructor aeDescConstructor;\r
+ /** The <init>(int) method of com.apple.MacOS.AETarget */\r
+ private static Constructor aeTargetConstructor;\r
\r
- /** The findFolder method of com.apple.mrj.MRJFileUtils */\r
- private static Method findFolder;\r
+ /** The <init>(int, int, int) method of com.apple.MacOS.AppleEvent */\r
+ private static Constructor appleEventConstructor;\r
\r
- /** The getFileCreator method of com.apple.mrj.MRJFileUtils */\r
- private static Method getFileCreator;\r
+ /** The <init>(String) method of com.apple.MacOS.AEDesc */\r
+ private static Constructor aeDescConstructor;\r
\r
- /** The getFileType method of com.apple.mrj.MRJFileUtils */\r
- private static Method getFileType;\r
+ /** The findFolder method of com.apple.mrj.MRJFileUtils */\r
+ private static Method findFolder;\r
\r
- /** The openURL method of com.apple.mrj.MRJFileUtils */\r
- private static Method openURL;\r
+ /** The getFileCreator method of com.apple.mrj.MRJFileUtils */\r
+ private static Method getFileCreator;\r
\r
- /** The makeOSType method of com.apple.MacOS.OSUtils */\r
- private static Method makeOSType;\r
+ /** The getFileType method of com.apple.mrj.MRJFileUtils */\r
+ private static Method getFileType;\r
\r
- /** The putParameter method of com.apple.MacOS.AppleEvent */\r
- private static Method putParameter;\r
+ /** The openURL method of com.apple.mrj.MRJFileUtils */\r
+ private static Method openURL;\r
\r
- /** The sendNoReply method of com.apple.MacOS.AppleEvent */\r
- private static Method sendNoReply;\r
+ /** The makeOSType method of com.apple.MacOS.OSUtils */\r
+ private static Method makeOSType;\r
\r
- /** Actually an MRJOSType pointing to the System Folder on a Macintosh */\r
- private static Object kSystemFolderType;\r
+ /** The putParameter method of com.apple.MacOS.AppleEvent */\r
+ private static Method putParameter;\r
\r
- /** The keyDirectObject AppleEvent parameter type */\r
- private static Integer keyDirectObject;\r
+ /** The sendNoReply method of com.apple.MacOS.AppleEvent */\r
+ private static Method sendNoReply;\r
\r
- /** The kAutoGenerateReturnID AppleEvent code */\r
- private static Integer kAutoGenerateReturnID;\r
+ /** Actually an MRJOSType pointing to the System Folder on a Macintosh */\r
+ private static Object kSystemFolderType;\r
\r
- /** The kAnyTransactionID AppleEvent code */\r
- private static Integer kAnyTransactionID;\r
+ /** The keyDirectObject AppleEvent parameter type */\r
+ private static Integer keyDirectObject;\r
\r
- /** The linkage object required for JDirect 3 on Mac OS X. */\r
- private static Object linkage;\r
+ /** The kAutoGenerateReturnID AppleEvent code */\r
+ private static Integer kAutoGenerateReturnID;\r
\r
- /** The framework to reference on Mac OS X */\r
- private static final String JDirect_MacOSX = "/System/Library/Frameworks/Carbon.framework/Frameworks/HIToolbox.framework/HIToolbox";\r
+ /** The kAnyTransactionID AppleEvent code */\r
+ private static Integer kAnyTransactionID;\r
\r
- /** JVM constant for MRJ 2.0 */\r
- private static final int MRJ_2_0 = 0;\r
+ /** The linkage object required for JDirect 3 on Mac OS X. */\r
+ private static Object linkage;\r
\r
- /** JVM constant for MRJ 2.1 or later */\r
- private static final int MRJ_2_1 = 1;\r
+ /** The framework to reference on Mac OS X */\r
+ private static final String JDirect_MacOSX = "/System/Library/Frameworks/Carbon.framework/Frameworks/HIToolbox.framework/HIToolbox";\r
\r
- /** JVM constant for Java on Mac OS X 10.0 (MRJ 3.0) */\r
- private static final int MRJ_3_0 = 3;\r
+ /** JVM constant for MRJ 2.0 */\r
+ private static final int MRJ_2_0 = 0;\r
\r
- /** JVM constant for MRJ 3.1 */\r
- private static final int MRJ_3_1 = 4;\r
+ /** JVM constant for MRJ 2.1 or later */\r
+ private static final int MRJ_2_1 = 1;\r
\r
- /** JVM constant for any Windows NT JVM */\r
- private static final int WINDOWS_NT = 5;\r
+ /** JVM constant for Java on Mac OS X 10.0 (MRJ 3.0) */\r
+ private static final int MRJ_3_0 = 3;\r
\r
- /** JVM constant for any Windows 9x JVM */\r
- private static final int WINDOWS_9x = 6;\r
+ /** JVM constant for MRJ 3.1 */\r
+ private static final int MRJ_3_1 = 4;\r
\r
- /** JVM constant for any other platform */\r
- private static final int OTHER = -1;\r
+ /** JVM constant for any Windows NT JVM */\r
+ private static final int WINDOWS_NT = 5;\r
\r
- /**
- * The file type of the Finder on a Macintosh. Hardcoding "Finder" would keep non-U.S. English
- * systems from working properly.
- */\r
- private static final String FINDER_TYPE = "FNDR";\r
+ /** JVM constant for any Windows 9x JVM */\r
+ private static final int WINDOWS_9x = 6;\r
\r
- /**
- * The creator code of the Finder on a Macintosh, which is needed to send AppleEvents to the
- * application.
- */\r
- private static final String FINDER_CREATOR = "MACS";\r
+ /** JVM constant for any other platform */\r
+ private static final int OTHER = -1;\r
\r
- /** The name for the AppleEvent type corresponding to a GetURL event. */\r
- private static final String GURL_EVENT = "GURL";\r
+ /**\r
+ * The file type of the Finder on a Macintosh. Hardcoding "Finder" would keep non-U.S. English\r
+ * systems from working properly.\r
+ */\r
+ private static final String FINDER_TYPE = "FNDR";\r
\r
- /**
- * The first parameter that needs to be passed into Runtime.exec() to open the default web
- * browser on Windows.
- */\r
- private static final String FIRST_WINDOWS_PARAMETER = "/c";\r
+ /**\r
+ * The creator code of the Finder on a Macintosh, which is needed to send AppleEvents to the\r
+ * application.\r
+ */\r
+ private static final String FINDER_CREATOR = "MACS";\r
\r
- /** The second parameter for Runtime.exec() on Windows. */\r
- private static final String SECOND_WINDOWS_PARAMETER = "start";\r
+ /** The name for the AppleEvent type corresponding to a GetURL event. */\r
+ private static final String GURL_EVENT = "GURL";\r
\r
- /**
- * The third parameter for Runtime.exec() on Windows. This is a "title"
- * parameter that the command line expects. Setting this parameter allows
- * URLs containing spaces to work.
- */\r
- private static final String THIRD_WINDOWS_PARAMETER = "\"\"";\r
+ /**\r
+ * The first parameter that needs to be passed into Runtime.exec() to open the default web\r
+ * browser on Windows.\r
+ */\r
+ private static final String FIRST_WINDOWS_PARAMETER = "/c";\r
\r
- /**
- * The shell parameters for Netscape that opens a given URL in an already-open copy of Netscape
- * on many command-line systems.
- */\r
- private static final String NETSCAPE_REMOTE_PARAMETER = "-remote";\r
- private static final String NETSCAPE_OPEN_PARAMETER_START = "openURL(";\r
- private static final String NETSCAPE_OPEN_NEW_WINDOW = ", new-window";\r
- private static final String NETSCAPE_OPEN_PARAMETER_END = ")";\r
+ /** The second parameter for Runtime.exec() on Windows. */\r
+ private static final String SECOND_WINDOWS_PARAMETER = "start";\r
\r
- /**
- * The message from any exception thrown throughout the initialization process.
- */\r
- private static String errorMessage;\r
+ /**\r
+ * The third parameter for Runtime.exec() on Windows. This is a "title"\r
+ * parameter that the command line expects. Setting this parameter allows\r
+ * URLs containing spaces to work.\r
+ */\r
+ private static final String THIRD_WINDOWS_PARAMETER = "\"\"";\r
\r
- /**
- * An initialization block that determines the operating system and loads the necessary
- * runtime data.
- */\r
- static {\r
- loadedWithoutErrors = true;\r
-\r
- String osName = System.getProperty("os.name");\r
-\r
- if (osName.startsWith("Mac OS")) {\r
- String mrjVersion = System.getProperty("mrj.version");\r
- String majorMRJVersion = mrjVersion.substring(0, 3);\r
-\r
- try {\r
- double version = Double.valueOf(majorMRJVersion).doubleValue();\r
-\r
- if (version == 2) {\r
- jvm = MRJ_2_0;\r
- } else if ((version >= 2.1) && (version < 3)) {\r
- // Assume that all 2.x versions of MRJ work the same. MRJ 2.1 actually\r
- // works via Runtime.exec() and 2.2 supports that but has an openURL() method\r
- // as well that we currently ignore.\r
- jvm = MRJ_2_1;\r
- } else if (version == 3.0) {\r
- jvm = MRJ_3_0;\r
- } else if (version >= 3.1) {\r
- // Assume that all 3.1 and later versions of MRJ work the same.\r
- jvm = MRJ_3_1;\r
- } else {\r
- loadedWithoutErrors = false;\r
- errorMessage = "Unsupported MRJ version: " + version;\r
- }\r
- } catch (NumberFormatException nfe) {\r
- loadedWithoutErrors = false;\r
- errorMessage = "Invalid MRJ version: " + mrjVersion;\r
- }\r
- } else if (osName.startsWith("Windows")) {\r
- if (osName.indexOf("9") != -1) {\r
- jvm = WINDOWS_9x;\r
- } else {\r
- jvm = WINDOWS_NT;\r
- }\r
- } else {\r
- jvm = OTHER;\r
- }\r
+ /**\r
+ * The shell parameters for Netscape that opens a given URL in an already-open copy of Netscape\r
+ * on many command-line systems.\r
+ */\r
+ private static final String NETSCAPE_REMOTE_PARAMETER = "-remote";\r
+ private static final String NETSCAPE_OPEN_PARAMETER_START = "openURL(";\r
+ private static final String NETSCAPE_OPEN_NEW_WINDOW = ", new-window";\r
+ private static final String NETSCAPE_OPEN_PARAMETER_END = ")";\r
+\r
+ /**\r
+ * The message from any exception thrown throughout the initialization process.\r
+ */\r
+ private static String errorMessage;\r
\r
- if (loadedWithoutErrors) { // if we haven't hit any errors yet\r
- loadedWithoutErrors = loadClasses();\r
+ /**\r
+ * An initialization block that determines the operating system and loads the necessary\r
+ * runtime data.\r
+ */\r
+ static\r
+ {\r
+ loadedWithoutErrors = true;\r
+\r
+ String osName = System.getProperty("os.name");\r
+\r
+ if (osName.startsWith("Mac OS"))\r
+ {\r
+ String mrjVersion = System.getProperty("mrj.version");\r
+ String majorMRJVersion = mrjVersion.substring(0, 3);\r
+\r
+ try\r
+ {\r
+ double version = Double.valueOf(majorMRJVersion).doubleValue();\r
+\r
+ if (version == 2)\r
+ {\r
+ jvm = MRJ_2_0;\r
+ }\r
+ else if ( (version >= 2.1) && (version < 3))\r
+ {\r
+ // Assume that all 2.x versions of MRJ work the same. MRJ 2.1 actually\r
+ // works via Runtime.exec() and 2.2 supports that but has an openURL() method\r
+ // as well that we currently ignore.\r
+ jvm = MRJ_2_1;\r
+ }\r
+ else if (version == 3.0)\r
+ {\r
+ jvm = MRJ_3_0;\r
}\r
+ else if (version >= 3.1)\r
+ {\r
+ // Assume that all 3.1 and later versions of MRJ work the same.\r
+ jvm = MRJ_3_1;\r
+ }\r
+ else\r
+ {\r
+ loadedWithoutErrors = false;\r
+ errorMessage = "Unsupported MRJ version: " + version;\r
+ }\r
+ }\r
+ catch (NumberFormatException nfe)\r
+ {\r
+ loadedWithoutErrors = false;\r
+ errorMessage = "Invalid MRJ version: " + mrjVersion;\r
+ }\r
+ }\r
+ else if (osName.startsWith("Windows"))\r
+ {\r
+ if (osName.indexOf("9") != -1)\r
+ {\r
+ jvm = WINDOWS_9x;\r
+ }\r
+ else\r
+ {\r
+ jvm = WINDOWS_NT;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ jvm = OTHER;\r
}\r
\r
- /**
- * This class should be never be instantiated; this just ensures so.
- */\r
- private BrowserLauncher() {\r
+ if (loadedWithoutErrors)\r
+ { // if we haven't hit any errors yet\r
+ loadedWithoutErrors = loadClasses();\r
}\r
+ }\r
+\r
+ /**\r
+ * This class should be never be instantiated; this just ensures so.\r
+ */\r
+ private BrowserLauncher()\r
+ {\r
+ }\r
+\r
+ /**\r
+ * Called by a static initializer to load any classes, fields, and methods required at runtime\r
+ * to locate the user's web browser.\r
+ * @return <code>true</code> if all intialization succeeded\r
+ * <code>false</code> if any portion of the initialization failed\r
+ */\r
+ private static boolean loadClasses()\r
+ {\r
+ switch (jvm)\r
+ {\r
+ case MRJ_2_0:\r
+\r
+ try\r
+ {\r
+ Class aeTargetClass = Class.forName("com.apple.MacOS.AETarget");\r
+ Class osUtilsClass = Class.forName("com.apple.MacOS.OSUtils");\r
+ Class appleEventClass = Class.forName(\r
+ "com.apple.MacOS.AppleEvent");\r
+ Class aeClass = Class.forName("com.apple.MacOS.ae");\r
+ aeDescClass = Class.forName("com.apple.MacOS.AEDesc");\r
+\r
+ aeTargetConstructor = aeTargetClass.getDeclaredConstructor(new Class[]\r
+ {\r
+ int.class\r
+ });\r
+ appleEventConstructor = appleEventClass.getDeclaredConstructor(new\r
+ Class[]\r
+ {\r
+ int.class, int.class, aeTargetClass, int.class,\r
+ int.class\r
+ });\r
+ aeDescConstructor = aeDescClass.getDeclaredConstructor(new Class[]\r
+ {\r
+ String.class\r
+ });\r
+\r
+ makeOSType = osUtilsClass.getDeclaredMethod("makeOSType",\r
+ new Class[]\r
+ {String.class});\r
+ putParameter = appleEventClass.getDeclaredMethod("putParameter",\r
+ new Class[]\r
+ {int.class, aeDescClass});\r
+ sendNoReply = appleEventClass.getDeclaredMethod("sendNoReply",\r
+ new Class[]\r
+ {});\r
+\r
+ Field keyDirectObjectField = aeClass.getDeclaredField(\r
+ "keyDirectObject");\r
+ keyDirectObject = (Integer) keyDirectObjectField.get(null);\r
+\r
+ Field autoGenerateReturnIDField = appleEventClass.getDeclaredField(\r
+ "kAutoGenerateReturnID");\r
+ kAutoGenerateReturnID = (Integer) autoGenerateReturnIDField.get(null);\r
+\r
+ Field anyTransactionIDField = appleEventClass.getDeclaredField(\r
+ "kAnyTransactionID");\r
+ kAnyTransactionID = (Integer) anyTransactionIDField.get(null);\r
+ }\r
+ catch (ClassNotFoundException cnfe)\r
+ {\r
+ errorMessage = cnfe.getMessage();\r
\r
- /**
- * Called by a static initializer to load any classes, fields, and methods required at runtime
- * to locate the user's web browser.
- * @return <code>true</code> if all intialization succeeded
- * <code>false</code> if any portion of the initialization failed
- */\r
- private static boolean loadClasses() {\r
- switch (jvm) {\r
- case MRJ_2_0:\r
-\r
- try {\r
- Class aeTargetClass = Class.forName("com.apple.MacOS.AETarget");\r
- Class osUtilsClass = Class.forName("com.apple.MacOS.OSUtils");\r
- Class appleEventClass = Class.forName(\r
- "com.apple.MacOS.AppleEvent");\r
- Class aeClass = Class.forName("com.apple.MacOS.ae");\r
- aeDescClass = Class.forName("com.apple.MacOS.AEDesc");\r
-\r
- aeTargetConstructor = aeTargetClass.getDeclaredConstructor(new Class[] {\r
- int.class\r
- });\r
- appleEventConstructor = appleEventClass.getDeclaredConstructor(new Class[] {\r
- int.class, int.class, aeTargetClass, int.class,\r
- int.class\r
- });\r
- aeDescConstructor = aeDescClass.getDeclaredConstructor(new Class[] {\r
- String.class\r
- });\r
-\r
- makeOSType = osUtilsClass.getDeclaredMethod("makeOSType",\r
- new Class[] { String.class });\r
- putParameter = appleEventClass.getDeclaredMethod("putParameter",\r
- new Class[] { int.class, aeDescClass });\r
- sendNoReply = appleEventClass.getDeclaredMethod("sendNoReply",\r
- new Class[] { });\r
-\r
- Field keyDirectObjectField = aeClass.getDeclaredField(\r
- "keyDirectObject");\r
- keyDirectObject = (Integer) keyDirectObjectField.get(null);\r
-\r
- Field autoGenerateReturnIDField = appleEventClass.getDeclaredField(\r
- "kAutoGenerateReturnID");\r
- kAutoGenerateReturnID = (Integer) autoGenerateReturnIDField.get(null);\r
-\r
- Field anyTransactionIDField = appleEventClass.getDeclaredField(\r
- "kAnyTransactionID");\r
- kAnyTransactionID = (Integer) anyTransactionIDField.get(null);\r
- } catch (ClassNotFoundException cnfe) {\r
- errorMessage = cnfe.getMessage();\r
-\r
- return false;\r
- } catch (NoSuchMethodException nsme) {\r
- errorMessage = nsme.getMessage();\r
-\r
- return false;\r
- } catch (NoSuchFieldException nsfe) {\r
- errorMessage = nsfe.getMessage();\r
-\r
- return false;\r
- } catch (IllegalAccessException iae) {\r
- errorMessage = iae.getMessage();\r
-\r
- return false;\r
- }\r
+ return false;\r
+ }\r
+ catch (NoSuchMethodException nsme)\r
+ {\r
+ errorMessage = nsme.getMessage();\r
\r
- break;\r
+ return false;\r
+ }\r
+ catch (NoSuchFieldException nsfe)\r
+ {\r
+ errorMessage = nsfe.getMessage();\r
\r
- case MRJ_2_1:\r
+ return false;\r
+ }\r
+ catch (IllegalAccessException iae)\r
+ {\r
+ errorMessage = iae.getMessage();\r
\r
- try {\r
- mrjFileUtilsClass = Class.forName("com.apple.mrj.MRJFileUtils");\r
- mrjOSTypeClass = Class.forName("com.apple.mrj.MRJOSType");\r
-\r
- Field systemFolderField = mrjFileUtilsClass.getDeclaredField(\r
- "kSystemFolderType");\r
- kSystemFolderType = systemFolderField.get(null);\r
- findFolder = mrjFileUtilsClass.getDeclaredMethod("findFolder",\r
- new Class[] { mrjOSTypeClass });\r
- getFileCreator = mrjFileUtilsClass.getDeclaredMethod("getFileCreator",\r
- new Class[] { File.class });\r
- getFileType = mrjFileUtilsClass.getDeclaredMethod("getFileType",\r
- new Class[] { File.class });\r
- } catch (ClassNotFoundException cnfe) {\r
- errorMessage = cnfe.getMessage();\r
-\r
- return false;\r
- } catch (NoSuchFieldException nsfe) {\r
- errorMessage = nsfe.getMessage();\r
-\r
- return false;\r
- } catch (NoSuchMethodException nsme) {\r
- errorMessage = nsme.getMessage();\r
-\r
- return false;\r
- } catch (SecurityException se) {\r
- errorMessage = se.getMessage();\r
-\r
- return false;\r
- } catch (IllegalAccessException iae) {\r
- errorMessage = iae.getMessage();\r
-\r
- return false;\r
- }\r
+ return false;\r
+ }\r
\r
- break;\r
+ break\r
+ ;\r
+\r
+ case MRJ_2_1:\r
+\r
+ try\r
+ {\r
+ mrjFileUtilsClass = Class.forName("com.apple.mrj.MRJFileUtils");\r
+ mrjOSTypeClass = Class.forName("com.apple.mrj.MRJOSType");\r
+\r
+ Field systemFolderField = mrjFileUtilsClass.getDeclaredField(\r
+ "kSystemFolderType");\r
+ kSystemFolderType = systemFolderField.get(null);\r
+ findFolder = mrjFileUtilsClass.getDeclaredMethod("findFolder",\r
+ new Class[]\r
+ {mrjOSTypeClass});\r
+ getFileCreator = mrjFileUtilsClass.getDeclaredMethod("getFileCreator",\r
+ new Class[]\r
+ {File.class});\r
+ getFileType = mrjFileUtilsClass.getDeclaredMethod("getFileType",\r
+ new Class[]\r
+ {File.class});\r
+ }\r
+ catch (ClassNotFoundException cnfe)\r
+ {\r
+ errorMessage = cnfe.getMessage();\r
\r
- case MRJ_3_0:\r
+ return false;\r
+ }\r
+ catch (NoSuchFieldException nsfe)\r
+ {\r
+ errorMessage = nsfe.getMessage();\r
\r
- try {\r
- Class linker = Class.forName("com.apple.mrj.jdirect.Linker");\r
- Constructor constructor = linker.getConstructor(new Class[] {\r
- Class.class\r
- });\r
- linkage = constructor.newInstance(new Object[] {\r
- BrowserLauncher.class\r
- });\r
- } catch (ClassNotFoundException cnfe) {\r
- errorMessage = cnfe.getMessage();\r
+ return false;\r
+ }\r
+ catch (NoSuchMethodException nsme)\r
+ {\r
+ errorMessage = nsme.getMessage();\r
\r
- return false;\r
- } catch (NoSuchMethodException nsme) {\r
- errorMessage = nsme.getMessage();\r
+ return false;\r
+ }\r
+ catch (SecurityException se)\r
+ {\r
+ errorMessage = se.getMessage();\r
\r
- return false;\r
- } catch (InvocationTargetException ite) {\r
- errorMessage = ite.getMessage();\r
+ return false;\r
+ }\r
+ catch (IllegalAccessException iae)\r
+ {\r
+ errorMessage = iae.getMessage();\r
\r
- return false;\r
- } catch (InstantiationException ie) {\r
- errorMessage = ie.getMessage();\r
+ return false;\r
+ }\r
\r
- return false;\r
- } catch (IllegalAccessException iae) {\r
- errorMessage = iae.getMessage();\r
+ break\r
+ ;\r
+\r
+ case MRJ_3_0:\r
+\r
+ try\r
+ {\r
+ Class linker = Class.forName("com.apple.mrj.jdirect.Linker");\r
+ Constructor constructor = linker.getConstructor(new Class[]\r
+ {\r
+ Class.class\r
+ });\r
+ linkage = constructor.newInstance(new Object[]\r
+ {\r
+ BrowserLauncher.class\r
+ });\r
+ }\r
+ catch (ClassNotFoundException cnfe)\r
+ {\r
+ errorMessage = cnfe.getMessage();\r
\r
- return false;\r
- }\r
+ return false;\r
+ }\r
+ catch (NoSuchMethodException nsme)\r
+ {\r
+ errorMessage = nsme.getMessage();\r
\r
- break;\r
+ return false;\r
+ }\r
+ catch (InvocationTargetException ite)\r
+ {\r
+ errorMessage = ite.getMessage();\r
\r
- case MRJ_3_1:\r
+ return false;\r
+ }\r
+ catch (InstantiationException ie)\r
+ {\r
+ errorMessage = ie.getMessage();\r
\r
- try {\r
- mrjFileUtilsClass = Class.forName("com.apple.mrj.MRJFileUtils");\r
- openURL = mrjFileUtilsClass.getDeclaredMethod("openURL",\r
- new Class[] { String.class });\r
- } catch (ClassNotFoundException cnfe) {\r
- errorMessage = cnfe.getMessage();\r
+ return false;\r
+ }\r
+ catch (IllegalAccessException iae)\r
+ {\r
+ errorMessage = iae.getMessage();\r
\r
- return false;\r
- } catch (NoSuchMethodException nsme) {\r
- errorMessage = nsme.getMessage();\r
+ return false;\r
+ }\r
\r
- return false;\r
- }\r
+ break\r
+ ;\r
\r
- break;\r
+ case MRJ_3_1:\r
\r
- default:\r
- break;\r
+ try\r
+ {\r
+ mrjFileUtilsClass = Class.forName("com.apple.mrj.MRJFileUtils");\r
+ openURL = mrjFileUtilsClass.getDeclaredMethod("openURL",\r
+ new Class[]\r
+ {String.class});\r
}\r
+ catch (ClassNotFoundException cnfe)\r
+ {\r
+ errorMessage = cnfe.getMessage();\r
\r
- return true;\r
- }\r
+ return false;\r
+ }\r
+ catch (NoSuchMethodException nsme)\r
+ {\r
+ errorMessage = nsme.getMessage();\r
\r
- /**
- * Attempts to locate the default web browser on the local system. Caches results so it
- * only locates the browser once for each use of this class per JVM instance.
- * @return The browser for the system. Note that this may not be what you would consider
- * to be a standard web browser; instead, it's the application that gets called to
- * open the default web browser. In some cases, this will be a non-String object
- * that provides the means of calling the default browser.
- */\r
- private static Object locateBrowser() {\r
- if (browser != null) {\r
- return browser;\r
+ return false;\r
}\r
\r
- switch (jvm) {\r
- case MRJ_2_0:\r
-\r
- try {\r
- Integer finderCreatorCode = (Integer) makeOSType.invoke(null,\r
- new Object[] { FINDER_CREATOR });\r
- Object aeTarget = aeTargetConstructor.newInstance(new Object[] {\r
- finderCreatorCode\r
- });\r
- Integer gurlType = (Integer) makeOSType.invoke(null,\r
- new Object[] { GURL_EVENT });\r
- Object appleEvent = appleEventConstructor.newInstance(new Object[] {\r
- gurlType, gurlType, aeTarget, kAutoGenerateReturnID,\r
- kAnyTransactionID\r
- });\r
-\r
- // Don't set browser = appleEvent because then the next time we call\r
- // locateBrowser(), we'll get the same AppleEvent, to which we'll already have\r
- // added the relevant parameter. Instead, regenerate the AppleEvent every time.\r
- // There's probably a way to do this better; if any has any ideas, please let\r
- // me know.\r
- return appleEvent;\r
- } catch (IllegalAccessException iae) {\r
- browser = null;\r
- errorMessage = iae.getMessage();\r
-\r
- return browser;\r
- } catch (InstantiationException ie) {\r
- browser = null;\r
- errorMessage = ie.getMessage();\r
-\r
- return browser;\r
- } catch (InvocationTargetException ite) {\r
- browser = null;\r
- errorMessage = ite.getMessage();\r
-\r
- return browser;\r
- }\r
+ break\r
+ ;\r
\r
- case MRJ_2_1:\r
+ default:\r
+ break;\r
+ }\r
\r
- File systemFolder;\r
+ return true;\r
+ }\r
+\r
+ /**\r
+ * Attempts to locate the default web browser on the local system. Caches results so it\r
+ * only locates the browser once for each use of this class per JVM instance.\r
+ * @return The browser for the system. Note that this may not be what you would consider\r
+ * to be a standard web browser; instead, it's the application that gets called to\r
+ * open the default web browser. In some cases, this will be a non-String object\r
+ * that provides the means of calling the default browser.\r
+ */\r
+ private static Object locateBrowser()\r
+ {\r
+ if (browser != null)\r
+ {\r
+ return browser;\r
+ }\r
\r
- try {\r
- systemFolder = (File) findFolder.invoke(null,\r
- new Object[] { kSystemFolderType });\r
- } catch (IllegalArgumentException iare) {\r
- browser = null;\r
- errorMessage = iare.getMessage();\r
+ switch (jvm)\r
+ {\r
+ case MRJ_2_0:\r
+\r
+ try\r
+ {\r
+ Integer finderCreatorCode = (Integer) makeOSType.invoke(null,\r
+ new Object[]\r
+ {FINDER_CREATOR});\r
+ Object aeTarget = aeTargetConstructor.newInstance(new Object[]\r
+ {\r
+ finderCreatorCode\r
+ });\r
+ Integer gurlType = (Integer) makeOSType.invoke(null,\r
+ new Object[]\r
+ {GURL_EVENT});\r
+ Object appleEvent = appleEventConstructor.newInstance(new Object[]\r
+ {\r
+ gurlType, gurlType, aeTarget, kAutoGenerateReturnID,\r
+ kAnyTransactionID\r
+ });\r
+\r
+ // Don't set browser = appleEvent because then the next time we call\r
+ // locateBrowser(), we'll get the same AppleEvent, to which we'll already have\r
+ // added the relevant parameter. Instead, regenerate the AppleEvent every time.\r
+ // There's probably a way to do this better; if any has any ideas, please let\r
+ // me know.\r
+ return appleEvent;\r
+ }\r
+ catch (IllegalAccessException iae)\r
+ {\r
+ browser = null;\r
+ errorMessage = iae.getMessage();\r
\r
- return browser;\r
- } catch (IllegalAccessException iae) {\r
- browser = null;\r
- errorMessage = iae.getMessage();\r
+ return browser;\r
+ }\r
+ catch (InstantiationException ie)\r
+ {\r
+ browser = null;\r
+ errorMessage = ie.getMessage();\r
\r
- return browser;\r
- } catch (InvocationTargetException ite) {\r
- browser = null;\r
- errorMessage = ite.getTargetException().getClass() + ": " +\r
- ite.getTargetException().getMessage();\r
+ return browser;\r
+ }\r
+ catch (InvocationTargetException ite)\r
+ {\r
+ browser = null;\r
+ errorMessage = ite.getMessage();\r
\r
- return browser;\r
- }\r
+ return browser;\r
+ }\r
\r
- String[] systemFolderFiles = systemFolder.list();\r
-\r
- // Avoid a FilenameFilter because that can't be stopped mid-list\r
- for (int i = 0; i < systemFolderFiles.length; i++) {\r
- try {\r
- File file = new File(systemFolder, systemFolderFiles[i]);\r
-\r
- if (!file.isFile()) {\r
- continue;\r
- }\r
-\r
- // We're looking for a file with a creator code of 'MACS' and\r
- // a type of 'FNDR'. Only requiring the type results in non-Finder\r
- // applications being picked up on certain Mac OS 9 systems,\r
- // especially German ones, and sending a GURL event to those\r
- // applications results in a logout under Multiple Users.\r
- Object fileType = getFileType.invoke(null,\r
- new Object[] { file });\r
-\r
- if (FINDER_TYPE.equals(fileType.toString())) {\r
- Object fileCreator = getFileCreator.invoke(null,\r
- new Object[] { file });\r
-\r
- if (FINDER_CREATOR.equals(fileCreator.toString())) {\r
- browser = file.toString(); // Actually the Finder, but that's OK\r
-\r
- return browser;\r
- }\r
- }\r
- } catch (IllegalArgumentException iare) {\r
- browser = browser;\r
- errorMessage = iare.getMessage();\r
-\r
- return null;\r
- } catch (IllegalAccessException iae) {\r
- browser = null;\r
- errorMessage = iae.getMessage();\r
-\r
- return browser;\r
- } catch (InvocationTargetException ite) {\r
- browser = null;\r
- errorMessage = ite.getTargetException().getClass() + ": " +\r
- ite.getTargetException().getMessage();\r
-\r
- return browser;\r
- }\r
- }\r
+ case MRJ_2_1:\r
\r
+ File systemFolder;\r
+\r
+ try\r
+ {\r
+ systemFolder = (File) findFolder.invoke(null,\r
+ new Object[]\r
+ {kSystemFolderType});\r
+ }\r
+ catch (IllegalArgumentException iare)\r
+ {\r
browser = null;\r
+ errorMessage = iare.getMessage();\r
\r
- break;\r
+ return browser;\r
+ }\r
+ catch (IllegalAccessException iae)\r
+ {\r
+ browser = null;\r
+ errorMessage = iae.getMessage();\r
\r
- case MRJ_3_0:\r
- case MRJ_3_1:\r
- browser = ""; // Return something non-null\r
+ return browser;\r
+ }\r
+ catch (InvocationTargetException ite)\r
+ {\r
+ browser = null;\r
+ errorMessage = ite.getTargetException().getClass() + ": " +\r
+ ite.getTargetException().getMessage();\r
\r
- break;\r
+ return browser;\r
+ }\r
+\r
+ String[] systemFolderFiles = systemFolder.list();\r
+\r
+ // Avoid a FilenameFilter because that can't be stopped mid-list\r
+ for (int i = 0; i < systemFolderFiles.length; i++)\r
+ {\r
+ try\r
+ {\r
+ File file = new File(systemFolder, systemFolderFiles[i]);\r
+\r
+ if (!file.isFile())\r
+ {\r
+ continue;\r
+ }\r
+\r
+ // We're looking for a file with a creator code of 'MACS' and\r
+ // a type of 'FNDR'. Only requiring the type results in non-Finder\r
+ // applications being picked up on certain Mac OS 9 systems,\r
+ // especially German ones, and sending a GURL event to those\r
+ // applications results in a logout under Multiple Users.\r
+ Object fileType = getFileType.invoke(null,\r
+ new Object[]\r
+ {file});\r
+\r
+ if (FINDER_TYPE.equals(fileType.toString()))\r
+ {\r
+ Object fileCreator = getFileCreator.invoke(null,\r
+ new Object[]\r
+ {file});\r
+\r
+ if (FINDER_CREATOR.equals(fileCreator.toString()))\r
+ {\r
+ browser = file.toString(); // Actually the Finder, but that's OK\r
+\r
+ return browser;\r
+ }\r
+ }\r
+ }\r
+ catch (IllegalArgumentException iare)\r
+ {\r
+ browser = browser;\r
+ errorMessage = iare.getMessage();\r
\r
- case WINDOWS_NT:\r
- browser = "cmd.exe";\r
+ return null;\r
+ }\r
+ catch (IllegalAccessException iae)\r
+ {\r
+ browser = null;\r
+ errorMessage = iae.getMessage();\r
\r
- break;\r
+ return browser;\r
+ }\r
+ catch (InvocationTargetException ite)\r
+ {\r
+ browser = null;\r
+ errorMessage = ite.getTargetException().getClass() + ": " +\r
+ ite.getTargetException().getMessage();\r
\r
- case WINDOWS_9x:\r
- browser = "command.com";\r
+ return browser;\r
+ }\r
+ }\r
\r
- break;\r
+ browser = null;\r
\r
- case OTHER:default:\r
- browser = jalview.bin.Cache.applicationProperties.getProperty(\r
- "jalview.browser");\r
+ break;\r
\r
- if (browser == null) {\r
- // hope firefox exists :-/\r
- browser = "firefox";\r
- }\r
+ case MRJ_3_0:\r
+ case MRJ_3_1:\r
+ browser = ""; // Return something non-null\r
\r
- break;\r
- }\r
+ break;\r
\r
- return browser;\r
- }\r
+ case WINDOWS_NT:\r
+ browser = "cmd.exe";\r
\r
- /**
- * Attempts to open the default web browser to the given URL.
- * @param url The URL to open
- * @throws IOException If the web browser could not be located or does not run
- */\r
- public static void openURL(String url) throws IOException {\r
- if (!loadedWithoutErrors) {\r
- throw new IOException("Exception in finding browser: " +\r
- errorMessage);\r
- }\r
-\r
- Object browser = locateBrowser();\r
-\r
- if (browser == null) {\r
- throw new IOException("Unable to locate browser: " + errorMessage);\r
- }\r
-\r
- switch (jvm) {\r
- case MRJ_2_0:\r
-\r
- Object aeDesc = null;\r
-\r
- try {\r
- aeDesc = aeDescConstructor.newInstance(new Object[] { url });\r
- putParameter.invoke(browser,\r
- new Object[] { keyDirectObject, aeDesc });\r
- sendNoReply.invoke(browser, new Object[] { });\r
- } catch (InvocationTargetException ite) {\r
- throw new IOException(\r
- "InvocationTargetException while creating AEDesc: " +\r
- ite.getMessage());\r
- } catch (IllegalAccessException iae) {\r
- throw new IOException(\r
- "IllegalAccessException while building AppleEvent: " +\r
- iae.getMessage());\r
- } catch (InstantiationException ie) {\r
- throw new IOException(\r
- "InstantiationException while creating AEDesc: " +\r
- ie.getMessage());\r
- } finally {\r
- aeDesc = null; // Encourage it to get disposed if it was created\r
- browser = null; // Ditto\r
- }\r
+ break;\r
\r
- break;\r
+ case WINDOWS_9x:\r
+ browser = "command.com";\r
\r
- case MRJ_2_1:\r
- Runtime.getRuntime().exec(new String[] { (String) browser, url });\r
+ break;\r
\r
- break;\r
+ case OTHER:\r
+ default:\r
+ browser = jalview.bin.Cache.applicationProperties.getProperty(\r
+ "jalview.browser");\r
\r
- case MRJ_3_0:\r
+ if (browser == null)\r
+ {\r
+ // hope firefox exists :-/\r
+ browser = "firefox";\r
+ }\r
\r
- int[] instance = new int[1];\r
- int result = ICStart(instance, 0);\r
+ break;\r
+ }\r
\r
- if (result == 0) {\r
- int[] selectionStart = new int[] { 0 };\r
- byte[] urlBytes = url.getBytes();\r
- int[] selectionEnd = new int[] { urlBytes.length };\r
- result = ICLaunchURL(instance[0], new byte[] { 0 }, urlBytes,\r
- urlBytes.length, selectionStart, selectionEnd);\r
+ return browser;\r
+ }\r
+\r
+ /**\r
+ * Attempts to open the default web browser to the given URL.\r
+ * @param url The URL to open\r
+ * @throws IOException If the web browser could not be located or does not run\r
+ */\r
+ public static void openURL(String url)\r
+ throws IOException\r
+ {\r
+ if (!loadedWithoutErrors)\r
+ {\r
+ throw new IOException("Exception in finding browser: " +\r
+ errorMessage);\r
+ }\r
\r
- if (result == 0) {\r
- // Ignore the return value; the URL was launched successfully\r
- // regardless of what happens here.\r
- ICStop(instance);\r
- } else {\r
- throw new IOException("Unable to launch URL: " + result);\r
- }\r
- } else {\r
- throw new IOException(\r
- "Unable to create an Internet Config instance: " + result);\r
- }\r
+ Object browser = locateBrowser();\r
\r
- break;\r
+ if (browser == null)\r
+ {\r
+ throw new IOException("Unable to locate browser: " + errorMessage);\r
+ }\r
\r
- case MRJ_3_1:\r
+ switch (jvm)\r
+ {\r
+ case MRJ_2_0:\r
+\r
+ Object aeDesc = null;\r
+\r
+ try\r
+ {\r
+ aeDesc = aeDescConstructor.newInstance(new Object[]\r
+ {url});\r
+ putParameter.invoke(browser,\r
+ new Object[]\r
+ {keyDirectObject, aeDesc});\r
+ sendNoReply.invoke(browser, new Object[]\r
+ {});\r
+ }\r
+ catch (InvocationTargetException ite)\r
+ {\r
+ throw new IOException(\r
+ "InvocationTargetException while creating AEDesc: " +\r
+ ite.getMessage());\r
+ }\r
+ catch (IllegalAccessException iae)\r
+ {\r
+ throw new IOException(\r
+ "IllegalAccessException while building AppleEvent: " +\r
+ iae.getMessage());\r
+ }\r
+ catch (InstantiationException ie)\r
+ {\r
+ throw new IOException(\r
+ "InstantiationException while creating AEDesc: " +\r
+ ie.getMessage());\r
+ }\r
+ finally\r
+ {\r
+ aeDesc = null; // Encourage it to get disposed if it was created\r
+ browser = null; // Ditto\r
+ }\r
\r
- try {\r
- openURL.invoke(null, new Object[] { url });\r
- } catch (InvocationTargetException ite) {\r
- throw new IOException(\r
- "InvocationTargetException while calling openURL: " +\r
- ite.getMessage());\r
- } catch (IllegalAccessException iae) {\r
- throw new IOException(\r
- "IllegalAccessException while calling openURL: " +\r
- iae.getMessage());\r
- }\r
+ break;\r
+\r
+ case MRJ_2_1:\r
+ Runtime.getRuntime().exec(new String[]\r
+ { (String) browser, url});\r
+\r
+ break;\r
+\r
+ case MRJ_3_0:\r
+\r
+ int[] instance = new int[1];\r
+ int result = ICStart(instance, 0);\r
+\r
+ if (result == 0)\r
+ {\r
+ int[] selectionStart = new int[]\r
+ {\r
+ 0};\r
+ byte[] urlBytes = url.getBytes();\r
+ int[] selectionEnd = new int[]\r
+ {\r
+ urlBytes.length};\r
+ result = ICLaunchURL(instance[0], new byte[]\r
+ {0}, urlBytes,\r
+ urlBytes.length, selectionStart, selectionEnd);\r
+\r
+ if (result == 0)\r
+ {\r
+ // Ignore the return value; the URL was launched successfully\r
+ // regardless of what happens here.\r
+ ICStop(instance);\r
+ }\r
+ else\r
+ {\r
+ throw new IOException("Unable to launch URL: " + result);\r
+ }\r
+ }\r
+ else\r
+ {\r
+ throw new IOException(\r
+ "Unable to create an Internet Config instance: " + result);\r
+ }\r
\r
- break;\r
-\r
- case WINDOWS_NT:\r
- case WINDOWS_9x:\r
-\r
- // Add quotes around the URL to allow ampersands and other special\r
- // characters to work.\r
- Process process = Runtime.getRuntime().exec(new String[] {\r
- (String) browser, FIRST_WINDOWS_PARAMETER,\r
- SECOND_WINDOWS_PARAMETER, THIRD_WINDOWS_PARAMETER,\r
- '"' + url + '"'\r
- });\r
-\r
- // This avoids a memory leak on some versions of Java on Windows.\r
- // That's hinted at in <http://developer.java.sun.com/developer/qow/archive/68/>.\r
- try {\r
- process.waitFor();\r
- process.exitValue();\r
- } catch (InterruptedException ie) {\r
- throw new IOException(\r
- "InterruptedException while launching browser: " +\r
- ie.getMessage());\r
- }\r
+ break;\r
\r
- break;\r
+ case MRJ_3_1:\r
\r
- case OTHER:\r
+ try\r
+ {\r
+ openURL.invoke(null, new Object[]\r
+ {url});\r
+ }\r
+ catch (InvocationTargetException ite)\r
+ {\r
+ throw new IOException(\r
+ "InvocationTargetException while calling openURL: " +\r
+ ite.getMessage());\r
+ }\r
+ catch (IllegalAccessException iae)\r
+ {\r
+ throw new IOException(\r
+ "IllegalAccessException while calling openURL: " +\r
+ iae.getMessage());\r
+ }\r
\r
- // Assume that we're on Unix and that Netscape (actually Firefox) is installed\r
- // First, attempt to open the URL in a currently running session of Netscape\r
- // JBPNote log debug\r
+ break\r
+ ;\r
+\r
+ case WINDOWS_NT:\r
+ case WINDOWS_9x:\r
+\r
+ // Add quotes around the URL to allow ampersands and other special\r
+ // characters to work.\r
+ Process process = Runtime.getRuntime().exec(new String[]\r
+ {\r
+ (String) browser, FIRST_WINDOWS_PARAMETER,\r
+ SECOND_WINDOWS_PARAMETER, THIRD_WINDOWS_PARAMETER,\r
+ '"' + url + '"'\r
+ });\r
+\r
+ // This avoids a memory leak on some versions of Java on Windows.\r
+ // That's hinted at in <http://developer.java.sun.com/developer/qow/archive/68/>.\r
+ try\r
+ {\r
+ process.waitFor();\r
+ process.exitValue();\r
+ }\r
+ catch (InterruptedException ie)\r
+ {\r
+ throw new IOException(\r
+ "InterruptedException while launching browser: " +\r
+ ie.getMessage());\r
+ }\r
\r
- /* System.out.println("Executing : "+browser+" "+
- NETSCAPE_REMOTE_PARAMETER+" "+
- NETSCAPE_OPEN_PARAMETER_START +
- url +
- NETSCAPE_OPEN_NEW_WINDOW +
- NETSCAPE_OPEN_PARAMETER_END);
- */\r
- process = Runtime.getRuntime().exec(new String[] {\r
- (String) browser, NETSCAPE_REMOTE_PARAMETER,\r
- \r
- NETSCAPE_OPEN_PARAMETER_START + url +\r
- NETSCAPE_OPEN_NEW_WINDOW + NETSCAPE_OPEN_PARAMETER_END\r
- });\r
-\r
- try {\r
- int exitCode = process.waitFor();\r
-\r
- if (exitCode != 0) { // if Netscape was not open\r
- Runtime.getRuntime().exec(new String[] { (String) browser, url });\r
- }\r
- } catch (InterruptedException ie) {\r
- throw new IOException(\r
- "InterruptedException while launching browser: " +\r
- ie.getMessage());\r
- }\r
+ break\r
+ ;\r
+\r
+ case OTHER:\r
+\r
+ // Assume that we're on Unix and that Netscape (actually Firefox) is installed\r
+ // First, attempt to open the URL in a currently running session of Netscape\r
+ // JBPNote log debug\r
+\r
+ /* System.out.println("Executing : "+browser+" "+\r
+ NETSCAPE_REMOTE_PARAMETER+" "+\r
+ NETSCAPE_OPEN_PARAMETER_START +\r
+ url +\r
+ NETSCAPE_OPEN_NEW_WINDOW +\r
+ NETSCAPE_OPEN_PARAMETER_END);\r
+ */\r
+ process = Runtime.getRuntime().exec(new String[]\r
+ {\r
+ (String) browser,\r
+ NETSCAPE_REMOTE_PARAMETER,\r
+\r
+ NETSCAPE_OPEN_PARAMETER_START + url +\r
+ NETSCAPE_OPEN_NEW_WINDOW +\r
+ NETSCAPE_OPEN_PARAMETER_END\r
+ });\r
+\r
+ try\r
+ {\r
+ int exitCode = process.waitFor();\r
+\r
+ if (exitCode != 0)\r
+ { // if Netscape was not open\r
+ Runtime.getRuntime().exec(new String[]\r
+ { (String) browser, url});\r
+ }\r
+ }\r
+ catch (InterruptedException ie)\r
+ {\r
+ throw new IOException(\r
+ "InterruptedException while launching browser: " +\r
+ ie.getMessage());\r
+ }\r
\r
- break;\r
+ break\r
+ ;\r
\r
- default:\r
+ default:\r
\r
- // This should never occur, but if it does, we'll try the simplest thing possible\r
- Runtime.getRuntime().exec(new String[] { (String) browser, url });\r
+ // This should never occur, but if it does, we'll try the simplest thing possible\r
+ Runtime.getRuntime().exec(new String[]\r
+ { (String) browser, url});\r
\r
- break;\r
- }\r
+ break;\r
}\r
+ }\r
\r
- /**
- * Methods required for Mac OS X. The presence of native methods does not cause
- * any problems on other platforms.
- */\r
- private native static int ICStart(int[] instance, int signature);\r
+ /**\r
+ * Methods required for Mac OS X. The presence of native methods does not cause\r
+ * any problems on other platforms.\r
+ */\r
+ private native static int ICStart(int[] instance, int signature);\r
\r
- private native static int ICStop(int[] instance);\r
+ private native static int ICStop(int[] instance);\r
\r
- private native static int ICLaunchURL(int instance, byte[] hint,\r
- byte[] data, int len, int[] selectionStart, int[] selectionEnd);\r
+ private native static int ICLaunchURL(int instance, byte[] hint,\r
+ byte[] data, int len,\r
+ int[] selectionStart,\r
+ int[] selectionEnd);\r
}\r
import jalview.datamodel.*;\r
\r
\r
-public class Comparison {\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class Comparison\r
+{\r
+ /** DOCUMENT ME!! */\r
public static String GapChars = " .-";\r
\r
- public static float compare(SequenceI ii, SequenceI jj) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param ii DOCUMENT ME!\r
+ * @param jj DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public static float compare(SequenceI ii, SequenceI jj)\r
+ {\r
return Comparison.compare(ii, jj, 0, ii.getLength() - 1);\r
}\r
\r
* @param end int\r
* @return float\r
*/\r
- public static float compare(SequenceI ii, SequenceI jj, int start, int end) {\r
+ public static float compare(SequenceI ii, SequenceI jj, int start, int end)\r
+ {\r
String si = ii.getSequence();\r
String sj = jj.getSequence();\r
\r
int ilen = si.length() - 1;\r
int jlen = sj.length() - 1;\r
\r
- while (jalview.util.Comparison.isGap(si.charAt(start + ilen))) {\r
+ while (jalview.util.Comparison.isGap(si.charAt(start + ilen)))\r
+ {\r
ilen--;\r
}\r
\r
- while (jalview.util.Comparison.isGap(sj.charAt(start + jlen))) {\r
+ while (jalview.util.Comparison.isGap(sj.charAt(start + jlen)))\r
+ {\r
jlen--;\r
}\r
\r
int match = 0;\r
float pid = -1;\r
\r
- if (ilen > jlen) {\r
- for (int j = 0; j < jlen; j++) {\r
+ if (ilen > jlen)\r
+ {\r
+ for (int j = 0; j < jlen; j++)\r
+ {\r
if (si.substring(start + j, start + j + 1).equals(sj.substring(start +\r
- j, start + j + 1))) {\r
+ j, start + j + 1)))\r
+ {\r
match++;\r
}\r
\r
}\r
\r
pid = (float) match / (float) ilen * 100;\r
- } else {\r
- for (int j = 0; j < jlen; j++) {\r
+ }\r
+ else\r
+ {\r
+ for (int j = 0; j < jlen; j++)\r
+ {\r
if (si.substring(start + j, start + j + 1).equals(sj.substring(start +\r
- j, start + j + 1))) {\r
+ j, start + j + 1)))\r
+ {\r
match++;\r
}\r
\r
* @param s2 SequenceI\r
* @return float\r
*/\r
- public static float PID(SequenceI s1, SequenceI s2) {\r
+ public static float PID(SequenceI s1, SequenceI s2)\r
+ {\r
int len;\r
\r
- if (s1.getSequence().length() > s2.getSequence().length()) {\r
+ if (s1.getSequence().length() > s2.getSequence().length())\r
+ {\r
len = s1.getSequence().length();\r
- } else {\r
+ }\r
+ else\r
+ {\r
len = s2.getSequence().length();\r
}\r
\r
int bad = 0;\r
\r
- for (int i = 0; i < len; i++) {\r
+ for (int i = 0; i < len; i++)\r
+ {\r
char chr1;\r
char chr2;\r
\r
- if (i < s1.getSequence().length()) {\r
+ if (i < s1.getSequence().length())\r
+ {\r
chr1 = s1.getSequence().charAt(i);\r
- } else {\r
+ }\r
+ else\r
+ {\r
chr1 = '.';\r
}\r
\r
- if (i < s2.getSequence().length()) {\r
+ if (i < s2.getSequence().length())\r
+ {\r
chr2 = s2.getSequence().charAt(i);\r
- } else {\r
+ }\r
+ else\r
+ {\r
chr2 = '.';\r
}\r
\r
if (!(jalview.util.Comparison.isGap(chr1)) &&\r
- !(jalview.util.Comparison.isGap(chr2))) {\r
- if (chr1 != chr2) {\r
+ !(jalview.util.Comparison.isGap(chr2)))\r
+ {\r
+ if (chr1 != chr2)\r
+ {\r
bad++;\r
}\r
}\r
}\r
\r
// Another pid with region specification\r
- public static float PID(SequenceI s1, SequenceI s2, int start, int end) {\r
+ public static float PID(SequenceI s1, SequenceI s2, int start, int end)\r
+ {\r
int len;\r
\r
- if (s1.getSequence().length() > s2.getSequence().length()) {\r
+ if (s1.getSequence().length() > s2.getSequence().length())\r
+ {\r
len = s1.getSequence().length();\r
- } else {\r
+ }\r
+ else\r
+ {\r
len = s2.getSequence().length();\r
}\r
\r
- if (end < len) {\r
+ if (end < len)\r
+ {\r
len = end;\r
}\r
\r
- if (len < start) {\r
+ if (len < start)\r
+ {\r
start = len - 1; // we just use a single residue for the difference\r
}\r
\r
int bad = 0;\r
\r
- for (int i = start; i < len; i++) {\r
+ for (int i = start; i < len; i++)\r
+ {\r
char chr1;\r
char chr2;\r
\r
- if (i < s1.getSequence().length()) {\r
+ if (i < s1.getSequence().length())\r
+ {\r
chr1 = s1.getSequence().charAt(i);\r
- } else {\r
+ }\r
+ else\r
+ {\r
chr1 = '.';\r
}\r
\r
- if (i < s2.getSequence().length()) {\r
+ if (i < s2.getSequence().length())\r
+ {\r
chr2 = s2.getSequence().charAt(i);\r
- } else {\r
+ }\r
+ else\r
+ {\r
chr2 = '.';\r
}\r
\r
if (!(jalview.util.Comparison.isGap(chr1)) &&\r
- !(jalview.util.Comparison.isGap(chr2))) {\r
- if (chr1 != chr2) {\r
+ !(jalview.util.Comparison.isGap(chr2)))\r
+ {\r
+ if (chr1 != chr2)\r
+ {\r
bad++;\r
}\r
}\r
return ((float) 100 * (len - bad)) / len;\r
}\r
\r
- public static boolean isGap(char c) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param c DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public static boolean isGap(char c)\r
+ {\r
return ((c != '.') && (c != '-') && (c != ' ')) ? false : true;\r
}\r
}\r
import java.io.*;\r
\r
\r
-public class Format {\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class Format\r
+{\r
private int width;\r
private int precision;\r
private String pre;\r
private boolean left_align;\r
private char fmt; // one of cdeEfgGiosxXos\r
\r
- public Format(String s) {\r
+ /**\r
+ * Creates a new Format object.\r
+ *\r
+ * @param s DOCUMENT ME!\r
+ */\r
+ public Format(String s)\r
+ {\r
width = 0;\r
precision = -1;\r
pre = "";\r
// 4 = format, 5 = end\r
int i = 0;\r
\r
- while (parse_state == 0) {\r
- if (i >= length) {\r
+ while (parse_state == 0)\r
+ {\r
+ if (i >= length)\r
+ {\r
parse_state = 5;\r
- } else if (s.charAt(i) == '%') {\r
- if (i < (length - 1)) {\r
- if (s.charAt(i + 1) == '%') {\r
+ }\r
+ else if (s.charAt(i) == '%')\r
+ {\r
+ if (i < (length - 1))\r
+ {\r
+ if (s.charAt(i + 1) == '%')\r
+ {\r
pre = pre + '%';\r
i++;\r
- } else {\r
+ }\r
+ else\r
+ {\r
parse_state = 1;\r
}\r
- } else {\r
+ }\r
+ else\r
+ {\r
throw new java.lang.IllegalArgumentException();\r
}\r
- } else {\r
+ }\r
+ else\r
+ {\r
pre = pre + s.charAt(i);\r
}\r
\r
i++;\r
}\r
\r
- while (parse_state == 1) {\r
- if (i >= length) {\r
+ while (parse_state == 1)\r
+ {\r
+ if (i >= length)\r
+ {\r
parse_state = 5;\r
- } else if (s.charAt(i) == ' ') {\r
+ }\r
+ else if (s.charAt(i) == ' ')\r
+ {\r
show_space = true;\r
- } else if (s.charAt(i) == '-') {\r
+ }\r
+ else if (s.charAt(i) == '-')\r
+ {\r
left_align = true;\r
- } else if (s.charAt(i) == '+') {\r
+ }\r
+ else if (s.charAt(i) == '+')\r
+ {\r
show_plus = true;\r
- } else if (s.charAt(i) == '0') {\r
+ }\r
+ else if (s.charAt(i) == '0')\r
+ {\r
leading_zeroes = true;\r
- } else if (s.charAt(i) == '#') {\r
+ }\r
+ else if (s.charAt(i) == '#')\r
+ {\r
alternate = true;\r
- } else {\r
+ }\r
+ else\r
+ {\r
parse_state = 2;\r
i--;\r
}\r
i++;\r
}\r
\r
- while (parse_state == 2) {\r
- if (i >= length) {\r
+ while (parse_state == 2)\r
+ {\r
+ if (i >= length)\r
+ {\r
parse_state = 5;\r
- } else if (('0' <= s.charAt(i)) && (s.charAt(i) <= '9')) {\r
+ }\r
+ else if (('0' <= s.charAt(i)) && (s.charAt(i) <= '9'))\r
+ {\r
width = ((width * 10) + s.charAt(i)) - '0';\r
i++;\r
- } else if (s.charAt(i) == '.') {\r
+ }\r
+ else if (s.charAt(i) == '.')\r
+ {\r
parse_state = 3;\r
precision = 0;\r
i++;\r
- } else {\r
+ }\r
+ else\r
+ {\r
parse_state = 4;\r
}\r
}\r
\r
- while (parse_state == 3) {\r
- if (i >= length) {\r
+ while (parse_state == 3)\r
+ {\r
+ if (i >= length)\r
+ {\r
parse_state = 5;\r
- } else if (('0' <= s.charAt(i)) && (s.charAt(i) <= '9')) {\r
+ }\r
+ else if (('0' <= s.charAt(i)) && (s.charAt(i) <= '9'))\r
+ {\r
precision = ((precision * 10) + s.charAt(i)) - '0';\r
i++;\r
- } else {\r
+ }\r
+ else\r
+ {\r
parse_state = 4;\r
}\r
}\r
\r
- if (parse_state == 4) {\r
- if (i >= length) {\r
+ if (parse_state == 4)\r
+ {\r
+ if (i >= length)\r
+ {\r
parse_state = 5;\r
- } else {\r
+ }\r
+ else\r
+ {\r
fmt = s.charAt(i);\r
}\r
\r
i++;\r
}\r
\r
- if (i < length) {\r
+ if (i < length)\r
+ {\r
post = s.substring(i, length);\r
}\r
}\r
* @exception IllegalArgumentException if bad format\r
*\r
*/\r
- public static String getHexString(java.awt.Color color) {\r
+ public static String getHexString(java.awt.Color color)\r
+ {\r
String r;\r
String g;\r
String b;\r
r = Integer.toHexString(color.getRed());\r
\r
- if (r.length() < 2) {\r
+ if (r.length() < 2)\r
+ {\r
r = "0" + r;\r
}\r
\r
g = Integer.toHexString(color.getGreen());\r
\r
- if (g.length() < 2) {\r
+ if (g.length() < 2)\r
+ {\r
g = "0" + g;\r
}\r
\r
b = Integer.toHexString(color.getBlue());\r
\r
- if (b.length() < 2) {\r
+ if (b.length() < 2)\r
+ {\r
b = "0" + b;\r
}\r
\r
* @param fmt the format string\r
* @param x the double to print\r
*/\r
- public static void print(java.io.PrintStream s, String fmt, double x) {\r
+ public static void print(java.io.PrintStream s, String fmt, double x)\r
+ {\r
s.print(new Format(fmt).form(x));\r
}\r
\r
* @param fmt the format string\r
* @param x the long to print\r
*/\r
- public static void print(java.io.PrintStream s, String fmt, long x) {\r
+ public static void print(java.io.PrintStream s, String fmt, long x)\r
+ {\r
s.print(new Format(fmt).form(x));\r
}\r
\r
* @param fmt the format string\r
* @param x the character to\r
*/\r
- public static void print(java.io.PrintStream s, String fmt, char x) {\r
+ public static void print(java.io.PrintStream s, String fmt, char x)\r
+ {\r
s.print(new Format(fmt).form(x));\r
}\r
\r
* @param s a PrintStream, fmt the format string\r
* @param x a string that represents the digits to print\r
*/\r
- public static void print(java.io.PrintStream s, String fmt, String x) {\r
+ public static void print(java.io.PrintStream s, String fmt, String x)\r
+ {\r
s.print(new Format(fmt).form(x));\r
}\r
\r
* @param s a string\r
* @return the numeric value of the prefix of s representing a base 10 integer\r
*/\r
- public static int atoi(String s) {\r
+ public static int atoi(String s)\r
+ {\r
return (int) atol(s);\r
}\r
\r
* @param s a string\r
* @return the numeric value of the prefix of s representing a base 10 integer\r
*/\r
- public static long atol(String s) {\r
+ public static long atol(String s)\r
+ {\r
int i = 0;\r
\r
while ((i < s.length()) && Character.isWhitespace(s.charAt(i)))\r
i++;\r
\r
- if ((i < s.length()) && (s.charAt(i) == '0')) {\r
+ if ((i < s.length()) && (s.charAt(i) == '0'))\r
+ {\r
if (((i + 1) < s.length()) &&\r
- ((s.charAt(i + 1) == 'x') || (s.charAt(i + 1) == 'X'))) {\r
+ ((s.charAt(i + 1) == 'x') || (s.charAt(i + 1) == 'X')))\r
+ {\r
return parseLong(s.substring(i + 2), 16);\r
- } else {\r
+ }\r
+ else\r
+ {\r
return parseLong(s, 8);\r
}\r
- } else {\r
+ }\r
+ else\r
+ {\r
return parseLong(s, 10);\r
}\r
}\r
\r
- private static long parseLong(String s, int base) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param s DOCUMENT ME!\r
+ * @param base DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ private static long parseLong(String s, int base)\r
+ {\r
int i = 0;\r
int sign = 1;\r
long r = 0;\r
while ((i < s.length()) && Character.isWhitespace(s.charAt(i)))\r
i++;\r
\r
- if ((i < s.length()) && (s.charAt(i) == '-')) {\r
+ if ((i < s.length()) && (s.charAt(i) == '-'))\r
+ {\r
sign = -1;\r
i++;\r
- } else if ((i < s.length()) && (s.charAt(i) == '+')) {\r
+ }\r
+ else if ((i < s.length()) && (s.charAt(i) == '+'))\r
+ {\r
i++;\r
}\r
\r
- while (i < s.length()) {\r
+ while (i < s.length())\r
+ {\r
char ch = s.charAt(i);\r
\r
- if (('0' <= ch) && (ch < ('0' + base))) {\r
+ if (('0' <= ch) && (ch < ('0' + base)))\r
+ {\r
r = ((r * base) + ch) - '0';\r
- } else if (('A' <= ch) && (ch < (('A' + base) - 10))) {\r
+ }\r
+ else if (('A' <= ch) && (ch < (('A' + base) - 10)))\r
+ {\r
r = ((r * base) + ch) - 'A' + 10;\r
- } else if (('a' <= ch) && (ch < (('a' + base) - 10))) {\r
+ }\r
+ else if (('a' <= ch) && (ch < (('a' + base) - 10)))\r
+ {\r
r = ((r * base) + ch) - 'a' + 10;\r
- } else {\r
+ }\r
+ else\r
+ {\r
return r * sign;\r
}\r
\r
* Converts a string of digits to an double\r
* @param s a string\r
*/\r
- public static double atof(String s) {\r
+ public static double atof(String s)\r
+ {\r
int i = 0;\r
int sign = 1;\r
double r = 0; // integer part\r
while ((i < s.length()) && Character.isWhitespace(s.charAt(i)))\r
i++;\r
\r
- if ((i < s.length()) && (s.charAt(i) == '-')) {\r
+ if ((i < s.length()) && (s.charAt(i) == '-'))\r
+ {\r
sign = -1;\r
i++;\r
- } else if ((i < s.length()) && (s.charAt(i) == '+')) {\r
+ }\r
+ else if ((i < s.length()) && (s.charAt(i) == '+'))\r
+ {\r
i++;\r
}\r
\r
- while (i < s.length()) {\r
+ while (i < s.length())\r
+ {\r
char ch = s.charAt(i);\r
\r
- if (('0' <= ch) && (ch <= '9')) {\r
- if (state == 0) {\r
+ if (('0' <= ch) && (ch <= '9'))\r
+ {\r
+ if (state == 0)\r
+ {\r
r = ((r * 10) + ch) - '0';\r
- } else if (state == 1) {\r
+ }\r
+ else if (state == 1)\r
+ {\r
p = p / 10;\r
r = r + (p * (ch - '0'));\r
}\r
- } else if (ch == '.') {\r
- if (state == 0) {\r
+ }\r
+ else if (ch == '.')\r
+ {\r
+ if (state == 0)\r
+ {\r
state = 1;\r
- } else {\r
+ }\r
+ else\r
+ {\r
return sign * r;\r
}\r
- } else if ((ch == 'e') || (ch == 'E')) {\r
+ }\r
+ else if ((ch == 'e') || (ch == 'E'))\r
+ {\r
long e = (int) parseLong(s.substring(i + 1), 10);\r
\r
return sign * r * Math.pow(10, e);\r
- } else {\r
+ }\r
+ else\r
+ {\r
return sign * r;\r
}\r
\r
* @return the formatted string\r
* @exception IllegalArgumentException if bad argument\r
*/\r
- public String form(double x) {\r
+ public String form(double x)\r
+ {\r
String r;\r
\r
- if (precision < 0) {\r
+ if (precision < 0)\r
+ {\r
precision = 6;\r
}\r
\r
int s = 1;\r
\r
- if (x < 0) {\r
+ if (x < 0)\r
+ {\r
x = -x;\r
s = -1;\r
}\r
\r
- if (fmt == 'f') {\r
+ if (fmt == 'f')\r
+ {\r
r = fixed_format(x);\r
- } else if ((fmt == 'e') || (fmt == 'E') || (fmt == 'g') ||\r
- (fmt == 'G')) {\r
+ }\r
+ else if ((fmt == 'e') || (fmt == 'E') || (fmt == 'g') || (fmt == 'G'))\r
+ {\r
r = exp_format(x);\r
- } else {\r
+ }\r
+ else\r
+ {\r
throw new java.lang.IllegalArgumentException();\r
}\r
\r
* @param x the number to format\r
* @return the formatted string\r
*/\r
- public String form(long x) {\r
+ public String form(long x)\r
+ {\r
String r;\r
int s = 0;\r
\r
- if ((fmt == 'd') || (fmt == 'i')) {\r
- if (x < 0) {\r
+ if ((fmt == 'd') || (fmt == 'i'))\r
+ {\r
+ if (x < 0)\r
+ {\r
r = ("" + x).substring(1);\r
s = -1;\r
- } else {\r
+ }\r
+ else\r
+ {\r
r = "" + x;\r
s = 1;\r
}\r
- } else if (fmt == 'o') {\r
+ }\r
+ else if (fmt == 'o')\r
+ {\r
r = convert(x, 3, 7, "01234567");\r
- } else if (fmt == 'x') {\r
+ }\r
+ else if (fmt == 'x')\r
+ {\r
r = convert(x, 4, 15, "0123456789abcdef");\r
- } else if (fmt == 'X') {\r
+ }\r
+ else if (fmt == 'X')\r
+ {\r
r = convert(x, 4, 15, "0123456789ABCDEF");\r
- } else {\r
+ }\r
+ else\r
+ {\r
throw new java.lang.IllegalArgumentException();\r
}\r
\r
* @param x the value to format\r
* @return the formatted string\r
*/\r
- public String form(char c) {\r
- if (fmt != 'c') {\r
+ public String form(char c)\r
+ {\r
+ if (fmt != 'c')\r
+ {\r
throw new java.lang.IllegalArgumentException();\r
}\r
\r
* @param x the value to format\r
* @return the formatted string\r
*/\r
- public String form(String s) {\r
- if (fmt != 's') {\r
+ public String form(String s)\r
+ {\r
+ if (fmt != 's')\r
+ {\r
throw new java.lang.IllegalArgumentException();\r
}\r
\r
- if (precision >= 0) {\r
+ if (precision >= 0)\r
+ {\r
s = s.substring(0, precision);\r
}\r
\r
/**\r
* a test stub for the format class\r
*/\r
- public static void main(String[] a) {\r
+ public static void main(String[] a)\r
+ {\r
double x = 1.23456789012;\r
double y = 123;\r
double z = 1.2345e30;\r
Format.print(System.out, "|%6.0f|\n", 9.999);\r
}\r
\r
- private static String repeat(char c, int n) {\r
- if (n <= 0) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param c DOCUMENT ME!\r
+ * @param n DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ private static String repeat(char c, int n)\r
+ {\r
+ if (n <= 0)\r
+ {\r
return "";\r
}\r
\r
return s.toString();\r
}\r
\r
- private static String convert(long x, int n, int m, String d) {\r
- if (x == 0) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param x DOCUMENT ME!\r
+ * @param n DOCUMENT ME!\r
+ * @param m DOCUMENT ME!\r
+ * @param d DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ private static String convert(long x, int n, int m, String d)\r
+ {\r
+ if (x == 0)\r
+ {\r
return "0";\r
}\r
\r
String r = "";\r
\r
- while (x != 0) {\r
+ while (x != 0)\r
+ {\r
r = d.charAt((int) (x & m)) + r;\r
x = x >>> n;\r
}\r
return r;\r
}\r
\r
- private String pad(String r) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param r DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ private String pad(String r)\r
+ {\r
String p = repeat(' ', width - r.length());\r
\r
- if (left_align) {\r
+ if (left_align)\r
+ {\r
return pre + r + p + post;\r
- } else {\r
+ }\r
+ else\r
+ {\r
return pre + p + r + post;\r
}\r
}\r
\r
- private String sign(int s, String r) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param s DOCUMENT ME!\r
+ * @param r DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ private String sign(int s, String r)\r
+ {\r
String p = "";\r
\r
- if (s < 0) {\r
+ if (s < 0)\r
+ {\r
p = "-";\r
- } else if (s > 0) {\r
- if (show_plus) {\r
+ }\r
+ else if (s > 0)\r
+ {\r
+ if (show_plus)\r
+ {\r
p = "+";\r
- } else if (show_space) {\r
+ }\r
+ else if (show_space)\r
+ {\r
p = " ";\r
}\r
- } else {\r
+ }\r
+ else\r
+ {\r
if ((fmt == 'o') && alternate && (r.length() > 0) &&\r
- (r.charAt(0) != '0')) {\r
+ (r.charAt(0) != '0'))\r
+ {\r
p = "0";\r
- } else if ((fmt == 'x') && alternate) {\r
+ }\r
+ else if ((fmt == 'x') && alternate)\r
+ {\r
p = "0x";\r
- } else if ((fmt == 'X') && alternate) {\r
+ }\r
+ else if ((fmt == 'X') && alternate)\r
+ {\r
p = "0X";\r
}\r
}\r
\r
int w = 0;\r
\r
- if (leading_zeroes) {\r
+ if (leading_zeroes)\r
+ {\r
w = width;\r
- } else if (((fmt == 'd') || (fmt == 'i') || (fmt == 'x') ||\r
- (fmt == 'X') || (fmt == 'o')) && (precision > 0)) {\r
+ }\r
+ else if (((fmt == 'd') || (fmt == 'i') || (fmt == 'x') || (fmt == 'X') ||\r
+ (fmt == 'o')) && (precision > 0))\r
+ {\r
w = precision;\r
}\r
\r
return p + repeat('0', w - p.length() - r.length()) + r;\r
}\r
\r
- private String fixed_format(double d) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param d DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ private String fixed_format(double d)\r
+ {\r
boolean removeTrailing = ((fmt == 'G') || (fmt == 'g')) && !alternate;\r
\r
// remove trailing zeroes and decimal point\r
- if (d > 0x7FFFFFFFFFFFFFFFL) {\r
+ if (d > 0x7FFFFFFFFFFFFFFFL)\r
+ {\r
return exp_format(d);\r
}\r
\r
- if (precision == 0) {\r
+ if (precision == 0)\r
+ {\r
return (long) (d + 0.5) + (removeTrailing ? "" : ".");\r
}\r
\r
long whole = (long) d;\r
double fr = d - whole; // fractional part\r
\r
- if ((fr >= 1) || (fr < 0)) {\r
+ if ((fr >= 1) || (fr < 0))\r
+ {\r
return exp_format(d);\r
}\r
\r
String leading_zeroes = "";\r
\r
for (int i = 1; (i <= precision) && (factor <= 0x7FFFFFFFFFFFFFFFL);\r
- i++) {\r
+ i++)\r
+ {\r
factor *= 10;\r
leading_zeroes = leading_zeroes + "0";\r
}\r
\r
long l = (long) ((factor * fr) + 0.5);\r
\r
- if (l >= factor) {\r
+ if (l >= factor)\r
+ {\r
l = 0;\r
whole++;\r
}\r
- // CSH 10-25-97\r
\r
+ // CSH 10-25-97\r
String z = leading_zeroes + l;\r
z = "." + z.substring(z.length() - precision, z.length());\r
\r
- if (removeTrailing) {\r
+ if (removeTrailing)\r
+ {\r
int t = z.length() - 1;\r
\r
while ((t >= 0) && (z.charAt(t) == '0'))\r
t--;\r
\r
- if ((t >= 0) && (z.charAt(t) == '.')) {\r
+ if ((t >= 0) && (z.charAt(t) == '.'))\r
+ {\r
t--;\r
}\r
\r
return whole + z;\r
}\r
\r
- private String exp_format(double d) {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param d DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ private String exp_format(double d)\r
+ {\r
String f = "";\r
int e = 0;\r
double dd = d;\r
double factor = 1;\r
\r
- if (d != 0) {\r
- while (dd > 10) {\r
+ if (d != 0)\r
+ {\r
+ while (dd > 10)\r
+ {\r
e++;\r
factor /= 10;\r
dd = dd / 10;\r
}\r
\r
- while (dd < 1) {\r
+ while (dd < 1)\r
+ {\r
e--;\r
factor *= 10;\r
dd = dd * 10;\r
}\r
}\r
\r
- if (((fmt == 'g') || (fmt == 'G')) && (e >= -4) && (e < precision)) {\r
+ if (((fmt == 'g') || (fmt == 'G')) && (e >= -4) && (e < precision))\r
+ {\r
return fixed_format(d);\r
}\r
\r
d = d * factor;\r
f = f + fixed_format(d);\r
\r
- if ((fmt == 'e') || (fmt == 'g')) {\r
+ if ((fmt == 'e') || (fmt == 'g'))\r
+ {\r
f = f + "e";\r
- } else {\r
+ }\r
+ else\r
+ {\r
f = f + "E";\r
}\r
\r
String p = "000";\r
\r
- if (e >= 0) {\r
+ if (e >= 0)\r
+ {\r
f = f + "+";\r
p = p + e;\r
- } else {\r
+ }\r
+ else\r
+ {\r
f = f + "-";\r
p = p + (-e);\r
}\r
/*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
-*\r
-* This program is free software; you can redistribute it and/or\r
-* modify it under the terms of the GNU General Public License\r
-* as published by the Free Software Foundation; either version 2\r
-* of the License, or (at your option) any later version.\r
-*\r
-* This program is distributed in the hope that it will be useful,\r
-* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-* GNU General Public License for more details.\r
-*\r
-* You should have received a copy of the GNU General Public License\r
-* along with this program; if not, write to the Free Software\r
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
-*/\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
+ */\r
package jalview.util;\r
\r
-public class QuickSort {\r
- public static void sort(float[] arr, Object[] s) {\r
- sort(arr, 0, arr.length - 1, s);\r
+public class QuickSort\r
+{\r
+ public static void sort(float[] arr, Object[] s)\r
+ {\r
+ sort(arr, 0, arr.length - 1, s);\r
+ }\r
+\r
+ public static void sort(String[] arr, Object[] s)\r
+ {\r
+ stringSort(arr, 0, arr.length - 1, s);\r
+ }\r
+\r
+ public static void stringSort(String[] arr, int p, int r, Object[] s)\r
+ {\r
+ int q;\r
+\r
+ if (p < r)\r
+ {\r
+ q = stringPartition(arr, p, r, s);\r
+ stringSort(arr, p, q, s);\r
+ stringSort(arr, q + 1, r, s);\r
}\r
+ }\r
\r
- public static void sort(String[] arr, Object[] s) {\r
- stringSort(arr, 0, arr.length - 1, s);\r
- }\r
-\r
- public static void stringSort(String[] arr, int p, int r, Object[] s) {\r
- int q;\r
+ public static void sort(float[] arr, int p, int r, Object[] s)\r
+ {\r
+ int q;\r
\r
- if (p < r) {\r
- q = stringPartition(arr, p, r, s);\r
- stringSort(arr, p, q, s);\r
- stringSort(arr, q + 1, r, s);\r
- }\r
+ if (p < r)\r
+ {\r
+ q = partition(arr, p, r, s);\r
+ sort(arr, p, q, s);\r
+ sort(arr, q + 1, r, s);\r
}\r
-\r
- public static void sort(float[] arr, int p, int r, Object[] s) {\r
- int q;\r
-\r
- if (p < r) {\r
- q = partition(arr, p, r, s);\r
- sort(arr, p, q, s);\r
- sort(arr, q + 1, r, s);\r
- }\r
+ }\r
+\r
+ private static int partition(float[] arr, int p, int r, Object[] s)\r
+ {\r
+ float x = arr[p];\r
+ int i = p - 1;\r
+ int j = r + 1;\r
+\r
+ while (true)\r
+ {\r
+ do\r
+ {\r
+ j = j - 1;\r
+ }\r
+ while (arr[j] > x);\r
+\r
+ do\r
+ {\r
+ i = i + 1;\r
+ }\r
+ while (arr[i] < x);\r
+\r
+ if (i < j)\r
+ {\r
+ float tmp = arr[i];\r
+ arr[i] = arr[j];\r
+ arr[j] = tmp;\r
+\r
+ Object tmp2 = s[i];\r
+ s[i] = s[j];\r
+ s[j] = tmp2;\r
+ }\r
+ else\r
+ {\r
+ return j;\r
+ }\r
}\r
-\r
- private static int partition(float[] arr, int p, int r, Object[] s) {\r
- float x = arr[p];\r
- int i = p - 1;\r
- int j = r + 1;\r
-\r
- while (true) {\r
- do {\r
- j = j - 1;\r
- } while (arr[j] > x);\r
-\r
- do {\r
- i = i + 1;\r
- } while (arr[i] < x);\r
-\r
- if (i < j) {\r
- float tmp = arr[i];\r
- arr[i] = arr[j];\r
- arr[j] = tmp;\r
-\r
- Object tmp2 = s[i];\r
- s[i] = s[j];\r
- s[j] = tmp2;\r
- } else {\r
- return j;\r
- }\r
- }\r
- }\r
-\r
- private static int stringPartition(String[] arr, int p, int r, Object[] s) {\r
- String x = arr[p];\r
- int i = p - 1;\r
- int j = r + 1;\r
-\r
- while (true) {\r
- do {\r
- j = j - 1;\r
- } while (arr[j].compareTo(x) < 0);\r
-\r
- do {\r
- i = i + 1;\r
- } while (arr[i].compareTo(x) > 0);\r
-\r
- if (i < j) {\r
- String tmp = arr[i];\r
- arr[i] = arr[j];\r
- arr[j] = tmp;\r
-\r
- Object tmp2 = s[i];\r
- s[i] = s[j];\r
- s[j] = tmp2;\r
- } else {\r
- return j;\r
- }\r
- }\r
+ }\r
+\r
+ private static int stringPartition(String[] arr, int p, int r, Object[] s)\r
+ {\r
+ String x = arr[p];\r
+ int i = p - 1;\r
+ int j = r + 1;\r
+\r
+ while (true)\r
+ {\r
+ do\r
+ {\r
+ j = j - 1;\r
+ }\r
+ while (arr[j].compareTo(x) < 0);\r
+\r
+ do\r
+ {\r
+ i = i + 1;\r
+ }\r
+ while (arr[i].compareTo(x) > 0);\r
+\r
+ if (i < j)\r
+ {\r
+ String tmp = arr[i];\r
+ arr[i] = arr[j];\r
+ arr[j] = tmp;\r
+\r
+ Object tmp2 = s[i];\r
+ s[i] = s[j];\r
+ s[j] = tmp2;\r
+ }\r
+ else\r
+ {\r
+ return j;\r
+ }\r
}\r
+ }\r
}\r
/*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
-*\r
-* This program is free software; you can redistribute it and/or\r
-* modify it under the terms of the GNU General Public License\r
-* as published by the Free Software Foundation; either version 2\r
-* of the License, or (at your option) any later version.\r
-*\r
-* This program is distributed in the hope that it will be useful,\r
-* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-* GNU General Public License for more details.\r
-*\r
-* You should have received a copy of the GNU General Public License\r
-* along with this program; if not, write to the Free Software\r
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
-*/\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
+ */\r
package jalview.ws;\r
\r
-import ext.vamsas.*;\r
+import java.util.*;\r
\r
-import jalview.analysis.AlignSeq;\r
+import javax.swing.*;\r
\r
+import ext.vamsas.*;\r
+import jalview.analysis.*;\r
import jalview.datamodel.*;\r
-\r
import jalview.gui.*;\r
\r
-import org.apache.axis.client.*;\r
+public class JPredClient\r
+ extends WSClient\r
+{\r
+ ext.vamsas.JPredWS server;\r
+ String altitle = "";\r
+ java.util.Hashtable SequenceInfo = null;\r
\r
-import java.awt.*;\r
+ public JPredClient(String title, SequenceI[] msf)\r
+ {\r
+ wsInfo = setWebService();\r
\r
-import java.util.*;\r
+ SequenceI seq = msf[0];\r
+ altitle = "JNet prediction on " + seq.getName() +\r
+ " using alignment from " + title;\r
\r
-import javax.swing.*;\r
-\r
-import javax.xml.namespace.QName;\r
+ wsInfo.setProgressText("Job details for MSA based prediction (" +\r
+ title + ") on sequence :\n>" + seq.getName() + "\n" +\r
+ AlignSeq.extractGaps("-. ", seq.getSequence()) +\r
+ "\n");\r
\r
+ SequenceInfo = jalview.analysis.SeqsetUtils.SeqCharacterHash(seq);\r
\r
-public class JPredClient extends WSClient {\r
- ext.vamsas.JPredWS server;\r
- String altitle = "";\r
- java.util.Hashtable SequenceInfo = null;\r
+ if (!locateWebService())\r
+ {\r
+ return;\r
+ }\r
\r
- public JPredClient(String title, SequenceI[] msf) {\r
- wsInfo = setWebService();\r
+ JPredThread jthread = new JPredThread(msf);\r
+ jthread.start();\r
+ }\r
+\r
+ public JPredClient(String title, SequenceI seq)\r
+ {\r
+ wsInfo = setWebService();\r
+ wsInfo.setProgressText("Job details for prediction on sequence :\n>" +\r
+ seq.getName() + "\n" +\r
+ AlignSeq.extractGaps("-. ", seq.getSequence()) +\r
+ "\n");\r
+ altitle = "JNet prediction for sequence " + seq.getName() + " from " +\r
+ title;\r
+\r
+ SequenceInfo = jalview.analysis.SeqsetUtils.SeqCharacterHash(seq);\r
+\r
+ if (!locateWebService())\r
+ {\r
+ return;\r
+ }\r
\r
- SequenceI seq = msf[0];\r
- altitle = "JNet prediction on " + seq.getName() +\r
- " using alignment from " + title;\r
+ JPredThread jthread = new JPredThread(seq);\r
+ jthread.start();\r
+ }\r
+\r
+ private WebserviceInfo setWebService()\r
+ {\r
+ WebServiceName = "JNetWS";\r
+ WebServiceJobTitle = "JNet secondary structure prediction";\r
+ WebServiceReference =\r
+ "\"Cuff J. A and Barton G.J (1999) Application of enhanced " +\r
+ "multiple sequence alignment profiles to improve protein secondary structure prediction, " +\r
+ "Proteins 40:502-511\".";\r
+ WsURL = "http://www.compbio.dundee.ac.uk/JalviewWS/services/jpred";\r
+\r
+ WebserviceInfo wsInfo = new WebserviceInfo(WebServiceJobTitle,\r
+ WebServiceReference);\r
+\r
+ return wsInfo;\r
+ }\r
+\r
+ private boolean locateWebService()\r
+ {\r
+ JPredWSServiceLocator loc = new JPredWSServiceLocator(); // Default\r
+\r
+ try\r
+ {\r
+ this.server = loc.getjpred(new java.net.URL(WsURL)); // JBPNote will be set from properties\r
+ ( (JpredSoapBindingStub)this.server).setTimeout(60000); // one minute stub\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ JOptionPane.showMessageDialog(Desktop.desktop,\r
+ "The Secondary Structure Prediction Service named " +\r
+ WebServiceName + " at " + WsURL +\r
+ " couldn't be located.",\r
+ "Internal Jalview Error",\r
+ JOptionPane.WARNING_MESSAGE);\r
+ wsInfo.setProgressText("Serious! " + WebServiceName +\r
+ " Service location failed\nfor URL :" + WsURL +\r
+ "\n" +\r
+ ex.getMessage());\r
+ wsInfo.setStatus(wsInfo.STATE_STOPPED_SERVERERROR);\r
+\r
+ return false;\r
+ }\r
\r
- wsInfo.setProgressText("Job details for MSA based prediction (" +\r
- title + ") on sequence :\n>" + seq.getName() + "\n" +\r
- AlignSeq.extractGaps("-. ", seq.getSequence()) + "\n");\r
+ return true;\r
+ }\r
+\r
+ class JPredThread\r
+ extends Thread\r
+ {\r
+ String OutputHeader;\r
+ ext.vamsas.JpredResult result;\r
+ ext.vamsas.Sequence sequence;\r
+ ext.vamsas.Msfalignment msa;\r
+ String jobId;\r
+ boolean jobComplete = false;\r
+ int allowedServerExceptions = 3; // thread dies if too many exceptions.\r
+\r
+ JPredThread(SequenceI seq)\r
+ {\r
+ OutputHeader = wsInfo.getProgressText();\r
+ this.sequence = new ext.vamsas.Sequence();\r
+ this.sequence.setId(seq.getName());\r
+ this.sequence.setSeq(AlignSeq.extractGaps("-. ", seq.getSequence()));\r
+ }\r
\r
- SequenceInfo = jalview.analysis.SeqsetUtils.SeqCharacterHash(seq);\r
+ JPredThread(SequenceI[] msf)\r
+ {\r
+ OutputHeader = wsInfo.getProgressText();\r
+ this.sequence = new ext.vamsas.Sequence();\r
+ this.sequence.setId(msf[0].getName());\r
+ this.sequence.setSeq(AlignSeq.extractGaps("-. ",\r
+ msf[0].getSequence()));\r
+\r
+ jalview.io.PileUpfile mwrite = new jalview.io.PileUpfile();\r
+ this.msa = new ext.vamsas.Msfalignment();\r
+ msa.setMsf(mwrite.print(msf));\r
+ }\r
\r
- if (!locateWebService()) {\r
- return;\r
+ public void run()\r
+ {\r
+ StartJob();\r
+\r
+ while (!jobComplete && (allowedServerExceptions > 0))\r
+ {\r
+ try\r
+ {\r
+ if ( (result = server.getresult(jobId)) == null)\r
+ {\r
+ throw (new Exception(\r
+ "Timed out when communicating with server\nTry again later.\n"));\r
+ }\r
+\r
+ if (result.isRunning())\r
+ {\r
+ wsInfo.setStatus(WebserviceInfo.STATE_RUNNING);\r
+ }\r
+ else if (result.isQueued())\r
+ {\r
+ wsInfo.setStatus(WebserviceInfo.STATE_QUEUING);\r
+ }\r
+\r
+ if (result.isFinished())\r
+ {\r
+ parseResult();\r
+ jobComplete = true;\r
+ jobsRunning--;\r
+ }\r
+ else\r
+ {\r
+ wsInfo.setProgressText(OutputHeader + "\n" +\r
+ result.getStatus());\r
+\r
+ if (! (result.isJobFailed() || result.isServerError()))\r
+ {\r
+ try\r
+ {\r
+ Thread.sleep(5000);\r
+ }\r
+ catch (InterruptedException ex1)\r
+ {\r
+ }\r
+\r
+ // System.out.println("I'm alive "+seqid+" "+jobid);\r
+ }\r
+ else\r
+ {\r
+ wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR);\r
+ }\r
+ }\r
}\r
-\r
- JPredThread jthread = new JPredThread(msf);\r
- jthread.start();\r
+ catch (Exception ex)\r
+ {\r
+ allowedServerExceptions--;\r
+ wsInfo.appendProgressText("\nJPredWS Server exception!\n" +\r
+ ex.getMessage());\r
+\r
+ try\r
+ {\r
+ if (allowedServerExceptions > 0)\r
+ {\r
+ Thread.sleep(5000);\r
+ }\r
+ }\r
+ catch (InterruptedException ex1)\r
+ {\r
+ }\r
+ }\r
+ }\r
+\r
+ if (! (result.isJobFailed() || result.isServerError()))\r
+ {\r
+ wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_OK);\r
+ }\r
+ else\r
+ {\r
+ wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR);\r
+ }\r
}\r
\r
- public JPredClient(String title, SequenceI seq) {\r
- wsInfo = setWebService();\r
- wsInfo.setProgressText("Job details for prediction on sequence :\n>" +\r
- seq.getName() + "\n" +\r
- AlignSeq.extractGaps("-. ", seq.getSequence()) + "\n");\r
- altitle = "JNet prediction for sequence " + seq.getName() + " from " +\r
- title;\r
-\r
- SequenceInfo = jalview.analysis.SeqsetUtils.SeqCharacterHash(seq);\r
-\r
- if (!locateWebService()) {\r
- return;\r
+ void StartJob()\r
+ {\r
+ try\r
+ {\r
+ if (msa != null)\r
+ {\r
+ jobId = server.predictOnMsa(msa);\r
+ }\r
+ else\r
+ {\r
+ jobId = server.predict(sequence);\r
}\r
\r
- JPredThread jthread = new JPredThread(seq);\r
- jthread.start();\r
+ if (jobId != null)\r
+ {\r
+ if (jobId.startsWith("Broken"))\r
+ {\r
+ throw new Exception("Submission " + jobId);\r
+ }\r
+ else\r
+ {\r
+ System.out.println(WsURL + " Job Id '" + jobId + "'");\r
+ }\r
+ }\r
+ else\r
+ {\r
+ throw new Exception("Server timed out - try again later\n");\r
+ }\r
+ }\r
+ catch (Exception e)\r
+ {\r
+ wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_SERVERERROR);\r
+ allowedServerExceptions = 0;\r
+ jobComplete = false;\r
+\r
+ wsInfo.appendProgressText("Failed to submit the prediction.\n"\r
+ +\r
+ "It is most likely that there is a problem with the server.\n"\r
+ + "Just close the window\n");\r
+ System.err.println(\r
+ "JPredWS Client: Failed to submit the prediction (Probably a server error - see below)\n" +\r
+ e.toString() + "\n");\r
+\r
+ // e.printStackTrace(); TODO: JBPNote DEBUG\r
+ }\r
}\r
\r
- private WebserviceInfo setWebService() {\r
- WebServiceName = "JNetWS";\r
- WebServiceJobTitle = "JNet secondary structure prediction";\r
- WebServiceReference = "\"Cuff J. A and Barton G.J (1999) Application of enhanced " +\r
- "multiple sequence alignment profiles to improve protein secondary structure prediction, " +\r
- "Proteins 40:502-511\".";\r
- WsURL = "http://www.compbio.dundee.ac.uk/JalviewWS/services/jpred";\r
-\r
- WebserviceInfo wsInfo = new WebserviceInfo(WebServiceJobTitle,\r
- WebServiceReference);\r
-\r
- return wsInfo;\r
+ private void addFloatAnnotations(Alignment al, int[] gapmap,\r
+ Vector values, String Symname,\r
+ String Visname, float min,\r
+ float max, int winLength)\r
+ {\r
+ Annotation[] annotations = new Annotation[al.getWidth()];\r
+\r
+ for (int j = 0; j < values.size(); j++)\r
+ {\r
+ float value = Float.parseFloat(values.get(j).toString());\r
+ annotations[gapmap[j]] = new Annotation("", value + "", ' ',\r
+ value);\r
+ }\r
+\r
+ al.addAnnotation(new AlignmentAnnotation(Symname, Visname,\r
+ annotations, min, max, winLength));\r
}\r
\r
- private boolean locateWebService() {\r
- JPredWSServiceLocator loc = new JPredWSServiceLocator(); // Default\r
-\r
- try {\r
- this.server = loc.getjpred(new java.net.URL(WsURL)); // JBPNote will be set from properties\r
- ((JpredSoapBindingStub) this.server).setTimeout(60000); // one minute stub\r
- } catch (Exception ex) {\r
- JOptionPane.showMessageDialog(Desktop.desktop,\r
- "The Secondary Structure Prediction Service named " +\r
- WebServiceName + " at " + WsURL + " couldn't be located.",\r
- "Internal Jalview Error", JOptionPane.WARNING_MESSAGE);\r
- wsInfo.setProgressText("Serious! " + WebServiceName +\r
- " Service location failed\nfor URL :" + WsURL + "\n" +\r
- ex.getMessage());\r
- wsInfo.setStatus(wsInfo.STATE_STOPPED_SERVERERROR);\r
-\r
- return false;\r
+ void parseResult()\r
+ {\r
+ // OutputHeader = output.getText();\r
+ if (result.isFailed())\r
+ {\r
+ OutputHeader += "Job failed.\n";\r
+ }\r
+\r
+ if (result.getStatus() != null)\r
+ {\r
+ OutputHeader += ("\n" + result.getStatus());\r
+ }\r
+\r
+ if (result.getPredfile() != null)\r
+ {\r
+ OutputHeader += ("\n" + result.getPredfile());\r
+\r
+ // JBPNote The returned files from a webservice could be hidden behind icons in the monitor window that, when clicked, pop up their corresponding data\r
+ }\r
+\r
+ if (result.getAligfile() != null)\r
+ {\r
+ OutputHeader += ("\n" + result.getAligfile());\r
+ }\r
+\r
+ wsInfo.setProgressText(OutputHeader);\r
+\r
+ try\r
+ {\r
+ // JPredFile prediction = new JPredFile("C:/JalviewX/files/jpred.txt", "File");\r
+ jalview.io.JPredFile prediction = new jalview.io.JPredFile(result.\r
+ getPredfile(),\r
+ "Paste");\r
+ SequenceI[] preds = prediction.getSeqsAsArray();\r
+ Alignment al;\r
+ int FirstSeq; // the position of the query sequence in Alignment al\r
+ boolean noMsa = true; // set if no MSA has been returned by JPred\r
+\r
+ if ( (this.msa != null) && (result.getAligfile() != null))\r
+ {\r
+ // we ignore the returned alignment if we only predicted on a single sequence\r
+ String format = jalview.io.IdentifyFile.Identify(result.getAligfile(),\r
+ "Paste");\r
+\r
+ if (jalview.io.FormatAdapter.formats.contains(format))\r
+ {\r
+ al = new Alignment(jalview.io.FormatAdapter.readFile(\r
+ result.getAligfile(), "Paste", format));\r
+ noMsa = false;\r
+ FirstSeq = 0;\r
+ }\r
+ else\r
+ {\r
+ throw (new Exception(\r
+ "Unknown format 'format' for file : \n" +\r
+ result.getAligfile()));\r
+ }\r
}\r
-\r
- return true;\r
- }\r
-\r
- class JPredThread extends Thread {\r
- String OutputHeader;\r
- ext.vamsas.JpredResult result;\r
- ext.vamsas.Sequence sequence;\r
- ext.vamsas.Msfalignment msa;\r
- String jobId;\r
- boolean jobComplete = false;\r
- int allowedServerExceptions = 3; // thread dies if too many exceptions.\r
-\r
- JPredThread(SequenceI seq) {\r
- OutputHeader = wsInfo.getProgressText();\r
- this.sequence = new ext.vamsas.Sequence();\r
- this.sequence.setId(seq.getName());\r
- this.sequence.setSeq(AlignSeq.extractGaps("-. ", seq.getSequence()));\r
+ else\r
+ {\r
+ al = new Alignment(preds);\r
+ FirstSeq = prediction.getQuerySeqPosition();\r
}\r
\r
- JPredThread(SequenceI[] msf) {\r
- OutputHeader = wsInfo.getProgressText();\r
- this.sequence = new ext.vamsas.Sequence();\r
- this.sequence.setId(msf[0].getName());\r
- this.sequence.setSeq(AlignSeq.extractGaps("-. ",\r
- msf[0].getSequence()));\r
+ if (!jalview.analysis.SeqsetUtils.SeqCharacterUnhash(\r
+ al.getSequenceAt(FirstSeq), SequenceInfo))\r
+ {\r
+ throw (new Exception(\r
+ "Couldn't recover sequence properties for JNet Query sequence!"));\r
+ }\r
\r
- jalview.io.PileUpfile mwrite = new jalview.io.PileUpfile();\r
- this.msa = new ext.vamsas.Msfalignment();\r
- msa.setMsf(mwrite.print(msf));\r
+ AlignmentAnnotation annot;\r
+ Annotation[] annotations = null;\r
+ int i = 0;\r
+ int width = preds[0].getSequence().length();\r
+\r
+ int[] gapmap = al.getSequenceAt(FirstSeq).gapMap();\r
+\r
+ if (gapmap.length != width)\r
+ {\r
+ throw (new Exception(\r
+ "Jnet Client Error\nNumber of residues in supposed query sequence :\n" +\r
+ al.getSequenceAt(FirstSeq).getName() + "\n" +\r
+ al.getSequenceAt(FirstSeq).getSequence() +\r
+ "\nDiffer from number of prediction sites in \n" +\r
+ result.getPredfile() + "\n"));\r
}\r
\r
- public void run() {\r
- StartJob();\r
-\r
- while (!jobComplete && (allowedServerExceptions > 0)) {\r
- try {\r
- if ((result = server.getresult(jobId)) == null) {\r
- throw (new Exception(\r
- "Timed out when communicating with server\nTry again later.\n"));\r
- }\r
-\r
- if (result.isRunning()) {\r
- wsInfo.setStatus(WebserviceInfo.STATE_RUNNING);\r
- } else if (result.isQueued()) {\r
- wsInfo.setStatus(WebserviceInfo.STATE_QUEUING);\r
- }\r
-\r
- if (result.isFinished()) {\r
- parseResult();\r
- jobComplete = true;\r
- jobsRunning--;\r
- } else {\r
- wsInfo.setProgressText(OutputHeader + "\n" +\r
- result.getStatus());\r
-\r
- if (!(result.isJobFailed() || result.isServerError())) {\r
- try {\r
- Thread.sleep(5000);\r
- } catch (InterruptedException ex1) {\r
- }\r
-\r
- // System.out.println("I'm alive "+seqid+" "+jobid);\r
- } else {\r
- wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR);\r
- }\r
- }\r
- } catch (Exception ex) {\r
- allowedServerExceptions--;\r
- wsInfo.appendProgressText("\nJPredWS Server exception!\n" +\r
- ex.getMessage());\r
-\r
- try {\r
- if (allowedServerExceptions > 0) {\r
- Thread.sleep(5000);\r
- }\r
- } catch (InterruptedException ex1) {\r
- }\r
- }\r
+ // JBPNote Should also rename the query sequence sometime...\r
+ i = 0;\r
+\r
+ while (i < preds.length)\r
+ {\r
+ String id = preds[i].getName().toUpperCase();\r
+\r
+ if (id.startsWith("LUPAS") || id.startsWith("JNET") ||\r
+ id.startsWith("JPRED"))\r
+ {\r
+ annotations = new Annotation[al.getWidth()];\r
+\r
+ if (id.equals("JNETPRED") || id.equals("JNETPSSM") ||\r
+ id.equals("JNETFREQ") || id.equals("JNETHMM") ||\r
+ id.equals("JNETALIGN") || id.equals("JPRED"))\r
+ {\r
+ for (int j = 0; j < width; j++)\r
+ {\r
+ annotations[gapmap[j]] = new Annotation("", "",\r
+ preds[i].getCharAt(j), 0);\r
+ }\r
}\r
-\r
- if (!(result.isJobFailed() || result.isServerError())) {\r
- wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_OK);\r
- } else {\r
- wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR);\r
+ else if (id.equals("JNETCONF"))\r
+ {\r
+ for (int j = 0; j < width; j++)\r
+ {\r
+ float value = Float.parseFloat(preds[i].getCharAt(\r
+ j) + "");\r
+ annotations[gapmap[j]] = new Annotation(preds[i].getCharAt(\r
+ j) + "", "", preds[i].getCharAt(j),\r
+ value);\r
+ }\r
+ }\r
+ else\r
+ {\r
+ for (int j = 0; j < width; j++)\r
+ {\r
+ annotations[gapmap[j]] = new Annotation(preds[i].getCharAt(\r
+ j) + "", "", ' ', 0);\r
+ }\r
}\r
- }\r
\r
- void StartJob() {\r
- try {\r
- if (msa != null) {\r
- jobId = server.predictOnMsa(msa);\r
- } else {\r
- jobId = server.predict(sequence);\r
- }\r
-\r
- if (jobId != null) {\r
- if (jobId.startsWith("Broken")) {\r
- throw new Exception("Submission " + jobId);\r
- } else {\r
- System.out.println(WsURL + " Job Id '" + jobId + "'");\r
- }\r
- } else {\r
- throw new Exception("Server timed out - try again later\n");\r
- }\r
- } catch (Exception e) {\r
- wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_SERVERERROR);\r
- allowedServerExceptions = 0;\r
- jobComplete = false;\r
-\r
- wsInfo.appendProgressText("Failed to submit the prediction.\n"\r
- +"It is most likely that there is a problem with the server.\n"\r
- +"Just close the window\n");\r
- System.err.println(\r
- "JPredWS Client: Failed to submit the prediction (Probably a server error - see below)\n" +\r
- e.toString() + "\n");\r
-\r
- // e.printStackTrace(); TODO: JBPNote DEBUG\r
+ if (id.equals("JNETCONF"))\r
+ {\r
+ annot = new AlignmentAnnotation(preds[i].getName(),\r
+ "JNet Output", annotations, 0f,\r
+ 10f, 1);\r
+ }\r
+ else\r
+ {\r
+ annot = new AlignmentAnnotation(preds[i].getName(),\r
+ "JNet Output", annotations);\r
}\r
- }\r
\r
- private void addFloatAnnotations(Alignment al, int[] gapmap,\r
- Vector values, String Symname, String Visname, float min,\r
- float max, int winLength) {\r
- Annotation[] annotations = new Annotation[al.getWidth()];\r
+ al.addAnnotation(annot);\r
\r
- for (int j = 0; j < values.size(); j++) {\r
- float value = Float.parseFloat(values.get(j).toString());\r
- annotations[gapmap[j]] = new Annotation("", value + "", ' ',\r
- value);\r
+ if (noMsa)\r
+ {\r
+ al.deleteSequence(preds[i]);\r
}\r
+ }\r
\r
- al.addAnnotation(new AlignmentAnnotation(Symname, Visname,\r
- annotations, min, max, winLength));\r
+ i++;\r
}\r
\r
- void parseResult() {\r
- // OutputHeader = output.getText();\r
- if (result.isFailed()) {\r
- OutputHeader += "Job failed.\n";\r
- }\r
-\r
- if (result.getStatus() != null) {\r
- OutputHeader += ("\n" + result.getStatus());\r
- }\r
+ Hashtable scores = prediction.getScores();\r
\r
- if (result.getPredfile() != null) {\r
- OutputHeader += ("\n" + result.getPredfile());\r
+ /* addFloatAnnotations(al, gapmap, (Vector)scores.get("JNETPROPH"),\r
+ "JnetpropH", "Jnet Helix Propensity", 0f,1f,1);\r
\r
- // JBPNote The returned files from a webservice could be hidden behind icons in the monitor window that, when clicked, pop up their corresponding data\r
- }\r
+ addFloatAnnotations(al, gapmap, (Vector)scores.get("JNETPROPB"),\r
+ "JnetpropB", "Jnet Beta Sheet Propensity", 0f,1f,1);\r
\r
- if (result.getAligfile() != null) {\r
- OutputHeader += ("\n" + result.getAligfile());\r
- }\r
+ addFloatAnnotations(al, gapmap, (Vector)scores.get("JNETPROPC"),\r
+ "JnetpropC", "Jnet Coil Propensity", 0f,1f,1);\r
+ */\r
+ AlignFrame af = new AlignFrame(al);\r
\r
- wsInfo.setProgressText(OutputHeader);\r
-\r
- try {\r
- // JPredFile prediction = new JPredFile("C:/JalviewX/files/jpred.txt", "File");\r
- jalview.io.JPredFile prediction = new jalview.io.JPredFile(result.getPredfile(),\r
- "Paste");\r
- SequenceI[] preds = prediction.getSeqsAsArray();\r
- Alignment al;\r
- int FirstSeq; // the position of the query sequence in Alignment al\r
- boolean noMsa = true; // set if no MSA has been returned by JPred\r
-\r
- if ((this.msa != null) && (result.getAligfile() != null)) {\r
- // we ignore the returned alignment if we only predicted on a single sequence\r
- String format = jalview.io.IdentifyFile.Identify(result.getAligfile(),\r
- "Paste");\r
-\r
- if (jalview.io.FormatAdapter.formats.contains(format)) {\r
- al = new Alignment(jalview.io.FormatAdapter.readFile(\r
- result.getAligfile(), "Paste", format));\r
- noMsa = false;\r
- FirstSeq = 0;\r
- } else {\r
- throw (new Exception(\r
- "Unknown format 'format' for file : \n" +\r
- result.getAligfile()));\r
- }\r
- } else {\r
- al = new Alignment(preds);\r
- FirstSeq = prediction.getQuerySeqPosition();\r
- }\r
-\r
- if (!jalview.analysis.SeqsetUtils.SeqCharacterUnhash(\r
- al.getSequenceAt(FirstSeq), SequenceInfo)) {\r
- throw (new Exception(\r
- "Couldn't recover sequence properties for JNet Query sequence!"));\r
- }\r
-\r
- AlignmentAnnotation annot;\r
- Annotation[] annotations = null;\r
- int i = 0;\r
- int width = preds[0].getSequence().length();\r
-\r
- int[] gapmap = al.getSequenceAt(FirstSeq).gapMap();\r
-\r
- if (gapmap.length != width) {\r
- throw (new Exception(\r
- "Jnet Client Error\nNumber of residues in supposed query sequence :\n" +\r
- al.getSequenceAt(FirstSeq).getName() + "\n" +\r
- al.getSequenceAt(FirstSeq).getSequence() +\r
- "\nDiffer from number of prediction sites in \n" +\r
- result.getPredfile() + "\n"));\r
- }\r
-\r
- // JBPNote Should also rename the query sequence sometime...\r
- i = 0;\r
-\r
- while (i < preds.length) {\r
- String id = preds[i].getName().toUpperCase();\r
-\r
- if (id.startsWith("LUPAS") || id.startsWith("JNET") ||\r
- id.startsWith("JPRED")) {\r
- annotations = new Annotation[al.getWidth()];\r
-\r
- if (id.equals("JNETPRED") || id.equals("JNETPSSM") ||\r
- id.equals("JNETFREQ") || id.equals("JNETHMM") ||\r
- id.equals("JNETALIGN") || id.equals("JPRED")) {\r
- for (int j = 0; j < width; j++) {\r
- annotations[gapmap[j]] = new Annotation("", "",\r
- preds[i].getCharAt(j), 0);\r
- }\r
- } else if (id.equals("JNETCONF")) {\r
- for (int j = 0; j < width; j++) {\r
- float value = Float.parseFloat(preds[i].getCharAt(\r
- j) + "");\r
- annotations[gapmap[j]] = new Annotation(preds[i].getCharAt(\r
- j) + "", "", preds[i].getCharAt(j),\r
- value);\r
- }\r
- } else {\r
- for (int j = 0; j < width; j++) {\r
- annotations[gapmap[j]] = new Annotation(preds[i].getCharAt(\r
- j) + "", "", ' ', 0);\r
- }\r
- }\r
-\r
- if (id.equals("JNETCONF")) {\r
- annot = new AlignmentAnnotation(preds[i].getName(),\r
- "JNet Output", annotations, 0f, 10f, 1);\r
- }\r
- else {\r
- annot = new AlignmentAnnotation(preds[i].getName(),\r
- "JNet Output", annotations);\r
- }\r
-\r
- al.addAnnotation(annot);\r
-\r
- if (noMsa) {\r
- al.deleteSequence(preds[i]);\r
- }\r
- }\r
-\r
- i++;\r
- }\r
-\r
- Hashtable scores = prediction.getScores();\r
-\r
- /* addFloatAnnotations(al, gapmap, (Vector)scores.get("JNETPROPH"),\r
- "JnetpropH", "Jnet Helix Propensity", 0f,1f,1);\r
-\r
- addFloatAnnotations(al, gapmap, (Vector)scores.get("JNETPROPB"),\r
- "JnetpropB", "Jnet Beta Sheet Propensity", 0f,1f,1);\r
-\r
- addFloatAnnotations(al, gapmap, (Vector)scores.get("JNETPROPC"),\r
- "JnetpropC", "Jnet Coil Propensity", 0f,1f,1);\r
- */\r
- AlignFrame af = new AlignFrame(al);\r
-\r
- Desktop.addInternalFrame(af, altitle,\r
- AlignFrame.NEW_WINDOW_WIDTH, AlignFrame.NEW_WINDOW_HEIGHT);\r
- } catch (Exception ex) {\r
- ex.printStackTrace();\r
- }\r
- }\r
+ Desktop.addInternalFrame(af, altitle,\r
+ AlignFrame.NEW_WINDOW_WIDTH,\r
+ AlignFrame.NEW_WINDOW_HEIGHT);\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ ex.printStackTrace();\r
+ }\r
}\r
+ }\r
}\r
\r
import jalview.gui.*;\r
\r
-import org.apache.axis.client.*;\r
-\r
-import vamsas.objects.*;\r
-\r
-import java.awt.*;\r
-\r
import java.util.*;\r
\r
import javax.swing.*;\r
\r
-import javax.xml.namespace.QName;\r
\r
-\r
-public class MsaWSClient extends WSClient {\r
- /**\r
- * server is a WSDL2Java generated stub for an archetypal MsaWSI service.\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
*/\r
+public class MsaWSClient extends WSClient\r
+{\r
+ /**\r
+ * server is a WSDL2Java generated stub for an archetypal MsaWSI service.\r
+ */\r
ext.vamsas.MuscleWS server;\r
\r
+ /**\r
+ * Creates a new MsaWSClient object.\r
+ *\r
+ * @param MsaWSName DOCUMENT ME!\r
+ * @param altitle DOCUMENT ME!\r
+ * @param msa DOCUMENT ME!\r
+ * @param submitGaps DOCUMENT ME!\r
+ * @param preserveOrder DOCUMENT ME!\r
+ */\r
public MsaWSClient(String MsaWSName, String altitle, SequenceI[] msa,\r
- boolean submitGaps, boolean preserveOrder) {\r
- if (setWebService(MsaWSName) == false) {\r
+ boolean submitGaps, boolean preserveOrder)\r
+ {\r
+ if (setWebService(MsaWSName) == false)\r
+ {\r
JOptionPane.showMessageDialog(Desktop.desktop,\r
"The Multiple Sequence Alignment Service named " + MsaWSName +\r
" is unknown", "Internal Jalview Error",\r
wsInfo = new jalview.gui.WebserviceInfo(WebServiceJobTitle,\r
WebServiceReference);\r
\r
- if (!locateWebService()) {\r
+ if (!locateWebService())\r
+ {\r
return;\r
}\r
\r
}\r
\r
// JBPNote Nasty object-global state setting methods shouldn't be allowed\r
- private boolean setWebService(String MsaWSName) {\r
- if (MsaWServices.info.containsKey(MsaWSName)) {\r
+ private boolean setWebService(String MsaWSName)\r
+ {\r
+ if (MsaWServices.info.containsKey(MsaWSName))\r
+ {\r
WebServiceName = MsaWSName;\r
\r
String[] wsinfo = (String[]) MsaWServices.info.get(MsaWSName);\r
WebServiceReference = wsinfo[2];\r
\r
return true;\r
- } else {\r
+ }\r
+ else\r
+ {\r
return false;\r
}\r
}\r
\r
- private boolean locateWebService() {\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ private boolean locateWebService()\r
+ {\r
// TODO: MuscleWS transmuted to generic MsaWS client\r
MuscleWSServiceLocator loc = new MuscleWSServiceLocator(); // Default\r
\r
- try {\r
+ try\r
+ {\r
this.server = (MuscleWS) loc.getMuscleWS(new java.net.URL(WsURL));\r
((MuscleWSSoapBindingStub) this.server).setTimeout(60000); // One minute timeout\r
- } catch (Exception ex) {\r
+ }\r
+ catch (Exception ex)\r
+ {\r
wsInfo.setProgressText("Serious! " + WebServiceName +\r
" Service location failed\nfor URL :" + WsURL + "\n" +\r
ex.getMessage());\r
return true;\r
}\r
\r
- protected class MsaWSThread extends Thread implements WSClientI {\r
+ protected class MsaWSThread extends Thread implements WSClientI\r
+ {\r
String ServiceName = WebServiceName;\r
String OutputHeader;\r
vamsas.objects.simple.MsaResult result = null;\r
boolean jobComplete = false;\r
\r
MsaWSThread(String title, SequenceI[] msa, boolean subgaps,\r
- boolean presorder) {\r
+ boolean presorder)\r
+ {\r
alTitle = title;\r
submitGaps = subgaps;\r
preserveOrder = presorder;\r
\r
vamsas.objects.simple.Sequence[] seqarray = new vamsas.objects.simple.Sequence[msa.length];\r
\r
- for (int i = 0; i < msa.length; i++) {\r
+ for (int i = 0; i < msa.length; i++)\r
+ {\r
String newname = jalview.analysis.SeqsetUtils.unique_name(i);\r
\r
// uniquify as we go\r
this.seqs.setSeqs(seqarray);\r
}\r
\r
- public boolean isCancellable() {\r
+ public boolean isCancellable()\r
+ {\r
return true;\r
}\r
\r
- public void cancelJob() {\r
- if ((jobId != null) && !jobId.equals("") && !jobComplete) {\r
+ public void cancelJob()\r
+ {\r
+ if ((jobId != null) && !jobId.equals("") && !jobComplete)\r
+ {\r
String cancelledMessage = "";\r
\r
- try {\r
+ try\r
+ {\r
vamsas.objects.simple.WsJobId cancelledJob = server.cancel(jobId);\r
\r
- if (cancelledJob.getStatus() == 2) {\r
+ if (cancelledJob.getStatus() == 2)\r
+ {\r
// CANCELLED_JOB\r
cancelledMessage = "Job cancelled.";\r
wsInfo.setStatus(WebserviceInfo.STATE_CANCELLED_OK);\r
jobComplete = true;\r
jobsRunning--;\r
result = null;\r
- } else if (cancelledJob.getStatus() == 3) {\r
+ }\r
+ else if (cancelledJob.getStatus() == 3)\r
+ {\r
// VALID UNSTOPPABLE JOB\r
cancelledMessage += "Server cannot cancel this job. just close the window.\n";\r
}\r
\r
- if (cancelledJob.getJobId() != null) {\r
+ if (cancelledJob.getJobId() != null)\r
+ {\r
cancelledMessage += ("[" + cancelledJob.getJobId() +\r
"]");\r
}\r
\r
cancelledMessage += "\n";\r
- } catch (Exception exc) {\r
+ }\r
+ catch (Exception exc)\r
+ {\r
cancelledMessage += ("\nProblems cancelling the job : Exception received...\n" +\r
exc + "\n");\r
exc.printStackTrace();\r
}\r
\r
wsInfo.setProgressText(OutputHeader + cancelledMessage + "\n");\r
- } else {\r
- if (!jobComplete) {\r
+ }\r
+ else\r
+ {\r
+ if (!jobComplete)\r
+ {\r
wsInfo.setProgressText(OutputHeader +\r
"Server cannot cancel this job because it has not been submitted properly. just close the window.\n");\r
}\r
}\r
}\r
\r
- public void run() {\r
+ public void run()\r
+ {\r
StartJob();\r
\r
- while (!jobComplete && (allowedServerExceptions > 0)) {\r
- try {\r
- if ((result = server.getResult(jobId)) == null) {\r
+ while (!jobComplete && (allowedServerExceptions > 0))\r
+ {\r
+ try\r
+ {\r
+ if ((result = server.getResult(jobId)) == null)\r
+ {\r
throw (new Exception(\r
"Timed out when communicating with server\nTry again later.\n"));\r
}\r
\r
- if (result.isRunning()) {\r
+ if (result.isRunning())\r
+ {\r
wsInfo.setStatus(WebserviceInfo.STATE_RUNNING);\r
- } else if (result.isQueued()) {\r
+ }\r
+ else if (result.isQueued())\r
+ {\r
wsInfo.setStatus(WebserviceInfo.STATE_QUEUING);\r
}\r
\r
- if (result.isFinished()) {\r
+ if (result.isFinished())\r
+ {\r
parseResult();\r
jobComplete = true;\r
jobsRunning--;\r
- } else {\r
- if (result.getStatus() != null) {\r
+ }\r
+ else\r
+ {\r
+ if (result.getStatus() != null)\r
+ {\r
wsInfo.setProgressText(OutputHeader + "\n" +\r
result.getStatus());\r
}\r
\r
- if (!(result.isJobFailed() || result.isServerError())) {\r
+ if (!(result.isJobFailed() || result.isServerError()))\r
+ {\r
Thread.sleep(5000);\r
\r
// System.out.println("I'm alive "+seqid+" "+jobid);\r
- } else {\r
+ }\r
+ else\r
+ {\r
break;\r
}\r
}\r
- } catch (Exception ex) {\r
+ }\r
+ catch (Exception ex)\r
+ {\r
allowedServerExceptions--;\r
wsInfo.appendProgressText("\n" + ServiceName +\r
" Server exception!\n" + ex.getMessage());\r
ex.getMessage());\r
\r
// ex.printStackTrace(); JBPNote Debug\r
- try {\r
- if (allowedServerExceptions > 0) {\r
+ try\r
+ {\r
+ if (allowedServerExceptions > 0)\r
+ {\r
Thread.sleep(5000);\r
}\r
- } catch (InterruptedException ex1) {\r
+ }\r
+ catch (InterruptedException ex1)\r
+ {\r
}\r
}\r
}\r
\r
- if (allowedServerExceptions == 0) {\r
+ if (allowedServerExceptions == 0)\r
+ {\r
wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_SERVERERROR);\r
- } else {\r
+ }\r
+ else\r
+ {\r
if (!((result != null) &&\r
- (result.isJobFailed() || result.isServerError()))) {\r
+ (result.isJobFailed() || result.isServerError())))\r
+ {\r
wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_OK);\r
- } else {\r
- if (result.isFailed()) {\r
+ }\r
+ else\r
+ {\r
+ if (result.isFailed())\r
+ {\r
wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR);\r
}\r
\r
- if (result.isServerError()) {\r
+ if (result.isServerError())\r
+ {\r
wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_SERVERERROR);\r
}\r
}\r
}\r
}\r
\r
- void StartJob() {\r
- try {\r
+ void StartJob()\r
+ {\r
+ try\r
+ {\r
vamsas.objects.simple.WsJobId jobsubmit = server.align(seqs);\r
\r
- if ((jobsubmit != null) && (jobsubmit.getStatus() == 1)) {\r
+ if ((jobsubmit != null) && (jobsubmit.getStatus() == 1))\r
+ {\r
jobId = jobsubmit.getJobId();\r
System.out.println(WsURL + " Job Id '" + jobId + "'");\r
- } else {\r
- if (jobsubmit == null) {\r
+ }\r
+ else\r
+ {\r
+ if (jobsubmit == null)\r
+ {\r
throw new Exception("Server at " + WsURL +\r
" returned null object, it probably cannot be contacted. Try again later ?");\r
}\r
\r
throw new Exception(jobsubmit.getJobId());\r
}\r
- } catch (Exception e) {\r
+ }\r
+ catch (Exception e)\r
+ {\r
// TODO: JBPNote catch timeout or other fault types explicitly\r
// For unexpected errors\r
System.err.println(WebServiceName +\r
- "Client: Failed to submit the sequences for alignment (probably a server side problem)\n"\r
- + "When contacting Server:"+WsURL + "\n" + e.toString() + "\n");\r
+ "Client: Failed to submit the sequences for alignment (probably a server side problem)\n" +\r
+ "When contacting Server:" + WsURL + "\n" + e.toString() +\r
+ "\n");\r
this.allowedServerExceptions = 0;\r
wsInfo.setStatus(wsInfo.STATE_STOPPED_SERVERERROR);\r
- wsInfo.appendProgressText("Failed to submit sequences for alignment.\n"\r
- + "It is most likely that there is a problem with the server.\n"\r
- + "Just close the window\n");\r
+ wsInfo.appendProgressText(\r
+ "Failed to submit sequences for alignment.\n" +\r
+ "It is most likely that there is a problem with the server.\n" +\r
+ "Just close the window\n");\r
\r
// e.printStackTrace(); // TODO: JBPNote DEBUG\r
}\r
\r
private void addFloatAnnotations(Alignment al, int[] gapmap,\r
Vector values, String Symname, String Visname, float min,\r
- float max, int winLength) {\r
+ float max, int winLength)\r
+ {\r
Annotation[] annotations = new Annotation[al.getWidth()];\r
\r
- for (int j = 0; j < values.size(); j++) {\r
+ for (int j = 0; j < values.size(); j++)\r
+ {\r
float value = Float.parseFloat(values.get(j).toString());\r
annotations[gapmap[j]] = new Annotation("", value + "", ' ',\r
value);\r
}\r
\r
private jalview.datamodel.Sequence[] getVamsasAlignment(\r
- vamsas.objects.simple.Alignment valign) {\r
+ vamsas.objects.simple.Alignment valign)\r
+ {\r
vamsas.objects.simple.Sequence[] seqs = valign.getSeqs().getSeqs();\r
jalview.datamodel.Sequence[] msa = new jalview.datamodel.Sequence[seqs.length];\r
\r
return msa;\r
}\r
\r
- void parseResult() {\r
+ void parseResult()\r
+ {\r
SequenceI[] seqs = null;\r
\r
- try {\r
+ try\r
+ {\r
// OutputHeader = output.getText();\r
- if (result.isFailed()) {\r
+ if (result.isFailed())\r
+ {\r
OutputHeader += "Job failed.\n";\r
}\r
\r
- if (result.getStatus() != null) {\r
+ if (result.getStatus() != null)\r
+ {\r
OutputHeader += ("\n" + result.getStatus());\r
}\r
\r
- if (result.getMsa() != null) {\r
+ if (result.getMsa() != null)\r
+ {\r
OutputHeader += "\nAlignment Object Method Notes\n";\r
\r
String[] lines = result.getMsa().getMethod();\r
\r
wsInfo.setProgressText(OutputHeader);\r
\r
- if (seqs != null) {\r
+ if (seqs != null)\r
+ {\r
AlignmentOrder msaorder = new AlignmentOrder(seqs);\r
\r
- if (preserveOrder) {\r
+ if (preserveOrder)\r
+ {\r
jalview.analysis.AlignmentSorter.recoverOrder(seqs);\r
}\r
\r
AlignFrame.NEW_WINDOW_WIDTH,\r
AlignFrame.NEW_WINDOW_HEIGHT);\r
}\r
- } catch (Exception ex) {\r
+ }\r
+ catch (Exception ex)\r
+ {\r
ex.printStackTrace();\r
}\r
}\r
/**\r
* TODO: MsaWServices will be set from properties and be dynamically discovered.\r
*/\r
-public class MsaWServices {\r
+public class MsaWServices\r
+{\r
+ /** DOCUMENT ME!! */\r
public static Hashtable info;\r
\r
- static {\r
+ static\r
+ {\r
info = new Hashtable();\r
info.put("ClustalWS",\r
- new String[] {\r
+ new String[]\r
+ {\r
"http://www.compbio.dundee.ac.uk/JalviewWS/services/ClustalWS",\r
"ClustalW Alignment job",\r
-\r
+ \r
"\"Thompson, J.D., Higgins, D.G. and Gibson, T.J. (1994) CLUSTAL W: improving the sensitivity of progressive multiple" +\r
" sequence alignment through sequence weighting, position specific gap penalties and weight matrix choice." +\r
" Nucleic Acids Research, 22 4673-4680"\r
});\r
info.put("MuscleWS",\r
- new String[] {\r
+ new String[]\r
+ {\r
"http://www.compbio.dundee.ac.uk/JalviewWS/services/MuscleWS",\r
"Muscle Alignment job",\r
-\r
+ \r
"Edgar, Robert C. (2004), MUSCLE: multiple sequence alignment " +\r
"with high accuracy and high throughput, Nucleic Acids Research 32(5), 1792-97."\r
});\r
/*
-* Jalview - A Sequence Alignment Editor and Viewer
-* Copyright (C) 2005 AM Waterhouse, J Procter, 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 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.
-*
-* 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
-*/\r
-package jalview.ws;\r
-\r
-import jalview.gui.WebserviceInfo;\r
-\r
-\r
-public class WSClient {\r
- /**
+ * Jalview - A Sequence Alignment Editor and Viewer
+ * Copyright (C) 2005 AM Waterhouse, J Procter, 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 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.
+ *
+ * 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
+ */
+package jalview.ws;
-* MsaWSClient
-*
-* @param msa SequenceI[]
-*/\r
- protected String WebServiceName;\r
- protected String WebServiceJobTitle;\r
- protected String WebServiceReference;\r
- protected String WsURL;\r
- protected WebserviceInfo wsInfo;\r
- int jobsRunning = 0;\r
-\r
- public WSClient() {\r
- }\r
-}\r
+import jalview.gui.*;
+
+public class WSClient
+{
+ /**
+ * MsaWSClient
+ *
+ * @param msa SequenceI[]
+ */
+ protected String WebServiceName;
+ protected String WebServiceJobTitle;
+ protected String WebServiceReference;
+ protected String WsURL;
+ protected WebserviceInfo wsInfo;
+ int jobsRunning = 0;
+
+ public WSClient()
+ {
+ }
+}
/*
-* Jalview - A Sequence Alignment Editor and Viewer
-* Copyright (C) 2005 AM Waterhouse, J Procter, 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 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.
-*
-* 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
-*/\r
-package jalview.ws;\r
-\r
-public interface WSClientI {\r
- boolean isCancellable();\r
-\r
- void cancelJob();\r
-}\r
+ * Jalview - A Sequence Alignment Editor and Viewer
+ * Copyright (C) 2005 AM Waterhouse, J Procter, 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 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.
+ *
+ * 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
+ */
+package jalview.ws;
+
+public interface WSClientI
+{
+ boolean isCancellable();
+
+ void cancelJob();
+}