/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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 MCview;\r
-\r
-import java.awt.*;\r
-\r
-public class Bond\r
-{\r
- float[] start;\r
- float[] end;\r
- Color startCol = Color.lightGray;\r
- Color endCol = Color.lightGray;\r
- public Atom at1;\r
- public Atom at2;\r
-\r
- public Bond(float[] start, float[] end, Atom at1, Atom at2)\r
- {\r
- this.start = start;\r
- this.end = end;\r
- this.startCol = at1.color;\r
- this.endCol = at2.color;\r
- this.at1 = at1;\r
- this.at2 = at2;\r
- }\r
-\r
- /* public Bond(Bond bond) {\r
- this.start = new float[3];\r
-\r
- this.start[0] = bond.start[0];\r
- this.start[1] = bond.start[1];\r
- this.start[2] = bond.start[2];\r
-\r
- this.end = new float[3];\r
-\r
- this.end[0] = bond.end[0];\r
- this.end[1] = bond.end[1];\r
- this.end[2] = bond.end[2];\r
-\r
- this.startCol = bond.startCol;\r
- this.endCol = bond.endCol;\r
- }\r
-\r
- public float length() {\r
- float len = ((end[0] - start[0]) * (end[0] - start[0])) +\r
- ((end[1] - start[1]) * (end[1] - start[1])) +\r
- ((end[2] - start[2]) * (end[2] - start[2]));\r
-\r
- len = (float) (Math.sqrt(len));\r
-\r
- return len;\r
- }*/\r
-\r
- public void translate(float x, float y, float z)\r
- {\r
- start[0] = (start[0] + x);\r
- end[0] = (end[0] + x);\r
-\r
- start[1] = (start[1] + y);\r
- end[1] = (end[1] + y);\r
-\r
- start[2] = (start[2] + z);\r
- end[2] = (end[2] + z);\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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 MCview;
+
+import java.awt.*;
+
+public class Bond
+{
+ float[] start;
+ float[] end;
+ Color startCol = Color.lightGray;
+ Color endCol = Color.lightGray;
+ public Atom at1;
+ public Atom at2;
+
+ public Bond(float[] start, float[] end, Atom at1, Atom at2)
+ {
+ this.start = start;
+ this.end = end;
+ this.startCol = at1.color;
+ this.endCol = at2.color;
+ this.at1 = at1;
+ this.at2 = at2;
+ }
+
+ /* public Bond(Bond bond) {
+ this.start = new float[3];
+
+ this.start[0] = bond.start[0];
+ this.start[1] = bond.start[1];
+ this.start[2] = bond.start[2];
+
+ this.end = new float[3];
+
+ this.end[0] = bond.end[0];
+ this.end[1] = bond.end[1];
+ this.end[2] = bond.end[2];
+
+ this.startCol = bond.startCol;
+ this.endCol = bond.endCol;
+ }
+
+ public float length() {
+ float len = ((end[0] - start[0]) * (end[0] - start[0])) +
+ ((end[1] - start[1]) * (end[1] - start[1])) +
+ ((end[2] - start[2]) * (end[2] - start[2]));
+
+ len = (float) (Math.sqrt(len));
+
+ return len;
+ }*/
+
+ public void translate(float x, float y, float z)
+ {
+ start[0] = (start[0] + x);
+ end[0] = (end[0] + x);
+
+ start[1] = (start[1] + y);
+ end[1] = (end[1] + y);
+
+ start[2] = (start[2] + z);
+ end[2] = (end[2] + z);
+ }
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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 MCview;\r
-\r
-public class MCMatrix\r
-{\r
- float[][] matrix;\r
- float[][] tmp;\r
- float mycos;\r
- float mysin;\r
- float myconst = (float) (Math.PI / 180);\r
-\r
- public MCMatrix(int rows, int cols)\r
- {\r
- matrix = new float[rows][cols];\r
- tmp = new float[rows][cols];\r
- }\r
-\r
- public void addElement(int i, int j, float value)\r
- {\r
- matrix[i][j] = value;\r
- }\r
-\r
- public void rotatex(float degrees)\r
- {\r
- mycos = (float) (Math.cos(degrees * myconst));\r
- mysin = (float) (Math.sin(degrees * myconst));\r
-\r
- tmp[0][0] = 1;\r
- tmp[0][1] = 0;\r
- tmp[0][2] = 0;\r
- tmp[1][0] = 0;\r
- tmp[1][1] = mycos;\r
- tmp[1][2] = mysin;\r
- tmp[2][0] = 0;\r
- tmp[2][1] = -mysin;\r
- tmp[2][2] = mycos;\r
- preMultiply(tmp);\r
- }\r
-\r
- public void rotatez(float degrees)\r
- {\r
- mycos = (float) (Math.cos(degrees * myconst));\r
- mysin = (float) (Math.sin(degrees * myconst));\r
-\r
- tmp[0][0] = mycos;\r
- tmp[0][1] = -mysin;\r
- tmp[0][2] = 0;\r
- tmp[1][0] = mysin;\r
- tmp[1][1] = mycos;\r
- tmp[1][2] = 0;\r
- tmp[2][0] = 0;\r
- tmp[2][1] = 0;\r
- tmp[2][2] = 1;\r
-\r
- preMultiply(tmp);\r
- }\r
-\r
- public void rotatey(float degrees)\r
- {\r
- mycos = (float) (Math.cos(degrees * myconst));\r
- mysin = (float) (Math.sin(degrees * myconst));\r
-\r
- tmp[0][0] = mycos;\r
- tmp[0][1] = 0;\r
- tmp[0][2] = -mysin;\r
- tmp[1][0] = 0;\r
- tmp[1][1] = 1;\r
- tmp[1][2] = 0;\r
- tmp[2][0] = mysin;\r
- tmp[2][1] = 0;\r
- tmp[2][2] = mycos;\r
-\r
- preMultiply(tmp);\r
- }\r
-\r
- public float[] vectorMultiply(float[] vect)\r
- {\r
- float[] temp = new float[3];\r
-\r
- temp[0] = vect[0];\r
- temp[1] = vect[1];\r
- temp[2] = vect[2];\r
-\r
- for (int i = 0; i < 3; i++)\r
- {\r
- temp[i] = ( (float) matrix[i][0] * vect[0]) +\r
- ( (float) matrix[i][1] * vect[1]) +\r
- ( (float) matrix[i][2] * vect[2]);\r
- }\r
-\r
- vect[0] = temp[0];\r
- vect[1] = temp[1];\r
- vect[2] = temp[2];\r
-\r
- return vect;\r
- }\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
- {\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
- {\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
- float[][] tmp = new float[3][3];\r
-\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
- {\r
- for (int j = 0; j < 3; j++)\r
- {\r
- matrix[i][j] = tmp[i][j];\r
- }\r
- }\r
- }\r
-\r
- public void setIdentity()\r
- {\r
- matrix[0][0] = 1;\r
- matrix[1][1] = 1;\r
- matrix[2][2] = 1;\r
- matrix[0][1] = 0;\r
- matrix[0][2] = 0;\r
- matrix[1][0] = 0;\r
- matrix[1][2] = 0;\r
- matrix[2][0] = 0;\r
- matrix[2][1] = 0;\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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 MCview;
+
+public class MCMatrix
+{
+ float[][] matrix;
+ float[][] tmp;
+ float mycos;
+ float mysin;
+ float myconst = (float) (Math.PI / 180);
+
+ public MCMatrix(int rows, int cols)
+ {
+ matrix = new float[rows][cols];
+ tmp = new float[rows][cols];
+ }
+
+ public void addElement(int i, int j, float value)
+ {
+ matrix[i][j] = value;
+ }
+
+ public void rotatex(float degrees)
+ {
+ mycos = (float) (Math.cos(degrees * myconst));
+ mysin = (float) (Math.sin(degrees * myconst));
+
+ tmp[0][0] = 1;
+ tmp[0][1] = 0;
+ tmp[0][2] = 0;
+ tmp[1][0] = 0;
+ tmp[1][1] = mycos;
+ tmp[1][2] = mysin;
+ tmp[2][0] = 0;
+ tmp[2][1] = -mysin;
+ tmp[2][2] = mycos;
+ preMultiply(tmp);
+ }
+
+ public void rotatez(float degrees)
+ {
+ mycos = (float) (Math.cos(degrees * myconst));
+ mysin = (float) (Math.sin(degrees * myconst));
+
+ tmp[0][0] = mycos;
+ tmp[0][1] = -mysin;
+ tmp[0][2] = 0;
+ tmp[1][0] = mysin;
+ tmp[1][1] = mycos;
+ tmp[1][2] = 0;
+ tmp[2][0] = 0;
+ tmp[2][1] = 0;
+ tmp[2][2] = 1;
+
+ preMultiply(tmp);
+ }
+
+ public void rotatey(float degrees)
+ {
+ mycos = (float) (Math.cos(degrees * myconst));
+ mysin = (float) (Math.sin(degrees * myconst));
+
+ tmp[0][0] = mycos;
+ tmp[0][1] = 0;
+ tmp[0][2] = -mysin;
+ tmp[1][0] = 0;
+ tmp[1][1] = 1;
+ tmp[1][2] = 0;
+ tmp[2][0] = mysin;
+ tmp[2][1] = 0;
+ tmp[2][2] = mycos;
+
+ preMultiply(tmp);
+ }
+
+ public float[] vectorMultiply(float[] vect)
+ {
+ float[] temp = new float[3];
+
+ temp[0] = vect[0];
+ temp[1] = vect[1];
+ temp[2] = vect[2];
+
+ for (int i = 0; i < 3; i++)
+ {
+ temp[i] = ( (float) matrix[i][0] * vect[0]) +
+ ( (float) matrix[i][1] * vect[1]) +
+ ( (float) matrix[i][2] * vect[2]);
+ }
+
+ vect[0] = temp[0];
+ vect[1] = temp[1];
+ vect[2] = temp[2];
+
+ return vect;
+ }
+
+ public void preMultiply(float[][] mat)
+ {
+ float[][] tmp = new float[3][3];
+
+ for (int i = 0; i < 3; i++)
+ {
+ for (int j = 0; j < 3; j++)
+ {
+ tmp[i][j] = (mat[i][0] * matrix[0][j]) +
+ (mat[i][1] * matrix[1][j]) + (mat[i][2] * matrix[2][j]);
+ }
+ }
+
+ for (int i = 0; i < 3; i++)
+ {
+ for (int j = 0; j < 3; j++)
+ {
+ matrix[i][j] = tmp[i][j];
+ }
+ }
+ }
+
+ public void postMultiply(float[][] mat)
+ {
+ float[][] tmp = new float[3][3];
+
+ for (int i = 0; i < 3; i++)
+ {
+ for (int j = 0; j < 3; j++)
+ {
+ tmp[i][j] = (matrix[i][0] * mat[0][j]) +
+ (matrix[i][1] * mat[1][j]) + (matrix[i][2] * mat[2][j]);
+ }
+ }
+
+ for (int i = 0; i < 3; i++)
+ {
+ for (int j = 0; j < 3; j++)
+ {
+ matrix[i][j] = tmp[i][j];
+ }
+ }
+ }
+
+ public void setIdentity()
+ {
+ matrix[0][0] = 1;
+ matrix[1][1] = 1;
+ matrix[2][2] = 1;
+ matrix[0][1] = 0;
+ matrix[0][2] = 0;
+ matrix[1][0] = 0;
+ matrix[1][2] = 0;
+ matrix[2][0] = 0;
+ matrix[2][1] = 0;
+ }
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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 MCview;\r
-\r
-import java.util.*;\r
-\r
-public class Residue\r
-{\r
- Vector atoms = new Vector();\r
- int number;\r
- int count;\r
- int seqnumber;\r
-\r
- public Residue(Vector atoms, int number, int count)\r
- {\r
- this.atoms = atoms;\r
- this.number = number;\r
- this.count = count;\r
- }\r
-\r
- public Atom findAtom(String name)\r
- {\r
- for (int i = 0; i < atoms.size(); i++)\r
- {\r
- if ( ( (Atom) atoms.elementAt(i)).name.equals(name))\r
- {\r
- return (Atom) atoms.elementAt(i);\r
- }\r
- }\r
-\r
- return null;\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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 MCview;
+
+import java.util.*;
+
+public class Residue
+{
+ Vector atoms = new Vector();
+ int number;
+ int count;
+ int seqnumber;
+
+ public Residue(Vector atoms, int number, int count)
+ {
+ this.atoms = atoms;
+ this.number = number;
+ this.count = count;
+ }
+
+ public Atom findAtom(String name)
+ {
+ for (int i = 0; i < atoms.size(); i++)
+ {
+ if ( ( (Atom) atoms.elementAt(i)).name.equals(name))
+ {
+ return (Atom) atoms.elementAt(i);
+ }
+ }
+
+ return null;
+ }
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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 MCview;\r
-\r
-import java.util.*;\r
-\r
-public class Zsort\r
-{\r
- public void Zsort(Vector bonds)\r
- {\r
- sort(bonds, 0, bonds.size() - 1);\r
- }\r
-\r
- public void sort(Vector bonds, int p, int r)\r
- {\r
- int q;\r
-\r
- if (p < r)\r
- {\r
- q = partition(bonds, p, r);\r
- sort(bonds, p, q);\r
- sort(bonds, q + 1, r);\r
- }\r
- }\r
-\r
- private int partition(Vector bonds, int p, int r)\r
- {\r
- float x = ( (Bond) bonds.elementAt(p)).start[2];\r
- int i = p - 1;\r
- int j = r + 1;\r
- Bond tmp;\r
- while (true)\r
- {\r
- do\r
- {\r
- j--;\r
- }\r
- while ( (j >= 0) && ( ( (Bond) bonds.elementAt(j)).start[2] > x));\r
-\r
- do\r
- {\r
- i++;\r
- }\r
- while ( (i < bonds.size()) &&\r
- ( ( (Bond) bonds.elementAt(i)).start[2] < x));\r
-\r
- if (i < j)\r
- {\r
- tmp = (Bond) bonds.elementAt(i);\r
- bonds.setElementAt(bonds.elementAt(j), i);\r
- bonds.setElementAt(tmp, j);\r
- }\r
- else\r
- {\r
- return j;\r
- }\r
- }\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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 MCview;
+
+import java.util.*;
+
+public class Zsort
+{
+ public void Zsort(Vector bonds)
+ {
+ sort(bonds, 0, bonds.size() - 1);
+ }
+
+ public void sort(Vector bonds, int p, int r)
+ {
+ int q;
+
+ if (p < r)
+ {
+ q = partition(bonds, p, r);
+ sort(bonds, p, q);
+ sort(bonds, q + 1, r);
+ }
+ }
+
+ private int partition(Vector bonds, int p, int r)
+ {
+ float x = ( (Bond) bonds.elementAt(p)).start[2];
+ int i = p - 1;
+ int j = r + 1;
+ Bond tmp;
+ while (true)
+ {
+ do
+ {
+ j--;
+ }
+ while ( (j >= 0) && ( ( (Bond) bonds.elementAt(j)).start[2] > x));
+
+ do
+ {
+ i++;
+ }
+ while ( (i < bonds.size()) &&
+ ( ( (Bond) bonds.elementAt(i)).start[2] < x));
+
+ if (i < j)
+ {
+ tmp = (Bond) bonds.elementAt(i);
+ bonds.setElementAt(bonds.elementAt(j), i);
+ bonds.setElementAt(tmp, j);
+ }
+ else
+ {
+ return j;
+ }
+ }
+ }
+}
-/**
- * IRegistry.java
- *
- * This file was auto-generated from WSDL
- * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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 ext.vamsas;
public interface IRegistry
-/**
- * IRegistryService.java
- *
- * This file was auto-generated from WSDL
- * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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 ext.vamsas;
public interface IRegistryService
-/**
- * IRegistryServiceLocator.java
- *
- * This file was auto-generated from WSDL
- * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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 ext.vamsas;
public class IRegistryServiceLocator
-/**
- * Jpred.java
- *
- * This file was auto-generated from WSDL
- * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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 ext.vamsas;
public interface Jpred
-/**
- * JpredService.java
- *
- * This file was auto-generated from WSDL
- * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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 ext.vamsas;
public interface JpredService
-/**
- * JpredServiceLocator.java
- *
- * This file was auto-generated from WSDL
- * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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 ext.vamsas;
public class JpredServiceLocator
-/**
- * JpredSoapBindingStub.java
- *
- * This file was auto-generated from WSDL
- * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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 ext.vamsas;
public class JpredSoapBindingStub
-/**\r
- * MuscleWS.java\r
- *\r
- * This file was auto-generated from WSDL\r
- * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.\r
- */\r
-\r
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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 ext.vamsas;\r
-\r
-public interface MuscleWS\r
- extends java.rmi.Remote\r
-{\r
- public vamsas.objects.simple.WsJobId align(\r
- vamsas.objects.simple.SequenceSet seqSet)\r
- throws java.rmi.RemoteException;\r
-\r
- public vamsas.objects.simple.Alignment getalign(java.lang.String job_id)\r
- throws java.rmi.RemoteException;\r
-\r
- public vamsas.objects.simple.MsaResult getResult(java.lang.String job_id)\r
- throws java.rmi.RemoteException;\r
-\r
- public vamsas.objects.simple.WsJobId cancel(java.lang.String jobId)\r
- throws java.rmi.RemoteException;\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
+ */
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer
+ * Copyright (C) 2007 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 ext.vamsas;
+
+public interface MuscleWS
+ extends java.rmi.Remote
+{
+ public vamsas.objects.simple.WsJobId align(
+ vamsas.objects.simple.SequenceSet seqSet)
+ throws java.rmi.RemoteException;
+
+ public vamsas.objects.simple.Alignment getalign(java.lang.String job_id)
+ throws java.rmi.RemoteException;
+
+ public vamsas.objects.simple.MsaResult getResult(java.lang.String job_id)
+ throws java.rmi.RemoteException;
+
+ public vamsas.objects.simple.WsJobId cancel(java.lang.String jobId)
+ throws java.rmi.RemoteException;
+}
-/**\r
- * MuscleWSService.java\r
- *\r
- * This file was auto-generated from WSDL\r
- * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.\r
- */\r
-\r
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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 ext.vamsas;\r
-\r
-public interface MuscleWSService\r
- extends javax.xml.rpc.Service\r
-{\r
- public java.lang.String getMuscleWSAddress();\r
-\r
- public ext.vamsas.MuscleWS getMuscleWS()\r
- throws javax.xml.rpc.ServiceException;\r
-\r
- public ext.vamsas.MuscleWS getMuscleWS(java.net.URL portAddress)\r
- throws javax.xml.rpc.ServiceException;\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
+ */
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer
+ * Copyright (C) 2007 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 ext.vamsas;
+
+public interface MuscleWSService
+ extends javax.xml.rpc.Service
+{
+ public java.lang.String getMuscleWSAddress();
+
+ public ext.vamsas.MuscleWS getMuscleWS()
+ throws javax.xml.rpc.ServiceException;
+
+ public ext.vamsas.MuscleWS getMuscleWS(java.net.URL portAddress)
+ throws javax.xml.rpc.ServiceException;
+}
-/**\r
- * MuscleWSServiceLocator.java\r
- *\r
- * This file was auto-generated from WSDL\r
- * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.\r
- */\r
-\r
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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 ext.vamsas;\r
-\r
-public class MuscleWSServiceLocator\r
- extends org.apache.axis.client.Service implements ext.vamsas.\r
- MuscleWSService\r
-{\r
- // Use to get a proxy class for MuscleWS\r
- private java.lang.String MuscleWS_address =\r
- "http://anaplog.compbio.dundee.ac.uk:8080/axis/services/MuscleWS";\r
-\r
- // The WSDD service name defaults to the port name.\r
- private java.lang.String MuscleWSWSDDServiceName = "MuscleWS";\r
- private java.util.HashSet ports = null;\r
-\r
- public MuscleWSServiceLocator()\r
- {\r
- }\r
-\r
- public MuscleWSServiceLocator(org.apache.axis.EngineConfiguration config)\r
- {\r
- super(config);\r
- }\r
-\r
- public java.lang.String getMuscleWSAddress()\r
- {\r
- return MuscleWS_address;\r
- }\r
-\r
- public java.lang.String getMuscleWSWSDDServiceName()\r
- {\r
- return MuscleWSWSDDServiceName;\r
- }\r
-\r
- public void setMuscleWSWSDDServiceName(java.lang.String name)\r
- {\r
- MuscleWSWSDDServiceName = name;\r
- }\r
-\r
- public ext.vamsas.MuscleWS getMuscleWS()\r
- throws javax.xml.rpc.ServiceException\r
- {\r
- java.net.URL endpoint;\r
-\r
- try\r
- {\r
- endpoint = new java.net.URL(MuscleWS_address);\r
- }\r
- catch (java.net.MalformedURLException e)\r
- {\r
- throw new javax.xml.rpc.ServiceException(e);\r
- }\r
-\r
- return getMuscleWS(endpoint);\r
- }\r
-\r
- public ext.vamsas.MuscleWS getMuscleWS(java.net.URL portAddress)\r
- throws javax.xml.rpc.ServiceException\r
- {\r
- try\r
- {\r
- ext.vamsas.MuscleWSSoapBindingStub _stub = new ext.vamsas.\r
- MuscleWSSoapBindingStub(portAddress,\r
- this);\r
- _stub.setPortName(getMuscleWSWSDDServiceName());\r
-\r
- return _stub;\r
- }\r
- catch (org.apache.axis.AxisFault e)\r
- {\r
- return null;\r
- }\r
- }\r
-\r
- public void setMuscleWSEndpointAddress(java.lang.String address)\r
- {\r
- MuscleWS_address = address;\r
- }\r
-\r
- /**\r
- * For the given interface, get the stub implementation.\r
- * If this service has no port for the given interface,\r
- * then ServiceException is thrown.\r
- */\r
- public java.rmi.Remote getPort(Class serviceEndpointInterface)\r
- throws javax.xml.rpc.ServiceException\r
- {\r
- try\r
- {\r
- if (ext.vamsas.MuscleWS.class.isAssignableFrom(\r
- serviceEndpointInterface))\r
- {\r
- ext.vamsas.MuscleWSSoapBindingStub _stub = new ext.vamsas.\r
- MuscleWSSoapBindingStub(new java.net.URL(\r
- MuscleWS_address), this);\r
- _stub.setPortName(getMuscleWSWSDDServiceName());\r
-\r
- return _stub;\r
- }\r
- }\r
- catch (java.lang.Throwable t)\r
- {\r
- throw new javax.xml.rpc.ServiceException(t);\r
- }\r
-\r
- throw new javax.xml.rpc.ServiceException(\r
- "There is no stub implementation for the interface: " +\r
- ( (serviceEndpointInterface == null) ? "null"\r
- : serviceEndpointInterface.getName()));\r
- }\r
-\r
- /**\r
- * For the given interface, get the stub implementation.\r
- * If this service has no port for the given interface,\r
- * then ServiceException is thrown.\r
- */\r
- public java.rmi.Remote getPort(javax.xml.namespace.QName portName,\r
- Class serviceEndpointInterface)\r
- throws javax.xml.rpc.ServiceException\r
- {\r
- if (portName == null)\r
- {\r
- return getPort(serviceEndpointInterface);\r
- }\r
-\r
- java.lang.String inputPortName = portName.getLocalPart();\r
-\r
- if ("MuscleWS".equals(inputPortName))\r
- {\r
- return getMuscleWS();\r
- }\r
- else\r
- {\r
- java.rmi.Remote _stub = getPort(serviceEndpointInterface);\r
- ( (org.apache.axis.client.Stub) _stub).setPortName(portName);\r
-\r
- return _stub;\r
- }\r
- }\r
-\r
- public javax.xml.namespace.QName getServiceName()\r
- {\r
- return new javax.xml.namespace.QName("vamsas", "MuscleWSService");\r
- }\r
-\r
- public java.util.Iterator getPorts()\r
- {\r
- if (ports == null)\r
- {\r
- ports = new java.util.HashSet();\r
- ports.add(new javax.xml.namespace.QName("vamsas", "MuscleWS"));\r
- }\r
-\r
- return ports.iterator();\r
- }\r
-\r
- /**\r
- * Set the endpoint address for the specified port name.\r
- */\r
- public void setEndpointAddress(java.lang.String portName,\r
- java.lang.String address)\r
- throws javax.xml.rpc.ServiceException\r
- {\r
- if ("MuscleWS".equals(portName))\r
- {\r
- setMuscleWSEndpointAddress(address);\r
- }\r
- else\r
- { // Unknown Port Name\r
- throw new javax.xml.rpc.ServiceException(\r
- " Cannot set Endpoint Address for Unknown Port" + portName);\r
- }\r
- }\r
-\r
- /**\r
- * Set the endpoint address for the specified port name.\r
- */\r
- public void setEndpointAddress(javax.xml.namespace.QName portName,\r
- java.lang.String address)\r
- throws javax.xml.rpc.ServiceException\r
- {\r
- setEndpointAddress(portName.getLocalPart(), address);\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
+ */
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer
+ * Copyright (C) 2007 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 ext.vamsas;
+
+public class MuscleWSServiceLocator
+ extends org.apache.axis.client.Service implements ext.vamsas.
+ MuscleWSService
+{
+ // Use to get a proxy class for MuscleWS
+ private java.lang.String MuscleWS_address =
+ "http://anaplog.compbio.dundee.ac.uk:8080/axis/services/MuscleWS";
+
+ // The WSDD service name defaults to the port name.
+ private java.lang.String MuscleWSWSDDServiceName = "MuscleWS";
+ private java.util.HashSet ports = null;
+
+ public MuscleWSServiceLocator()
+ {
+ }
+
+ public MuscleWSServiceLocator(org.apache.axis.EngineConfiguration config)
+ {
+ super(config);
+ }
+
+ public java.lang.String getMuscleWSAddress()
+ {
+ return MuscleWS_address;
+ }
+
+ public java.lang.String getMuscleWSWSDDServiceName()
+ {
+ return MuscleWSWSDDServiceName;
+ }
+
+ public void setMuscleWSWSDDServiceName(java.lang.String name)
+ {
+ MuscleWSWSDDServiceName = name;
+ }
+
+ public ext.vamsas.MuscleWS getMuscleWS()
+ throws javax.xml.rpc.ServiceException
+ {
+ java.net.URL endpoint;
+
+ try
+ {
+ endpoint = new java.net.URL(MuscleWS_address);
+ }
+ catch (java.net.MalformedURLException e)
+ {
+ throw new javax.xml.rpc.ServiceException(e);
+ }
+
+ return getMuscleWS(endpoint);
+ }
+
+ public ext.vamsas.MuscleWS getMuscleWS(java.net.URL portAddress)
+ throws javax.xml.rpc.ServiceException
+ {
+ try
+ {
+ ext.vamsas.MuscleWSSoapBindingStub _stub = new ext.vamsas.
+ MuscleWSSoapBindingStub(portAddress,
+ this);
+ _stub.setPortName(getMuscleWSWSDDServiceName());
+
+ return _stub;
+ }
+ catch (org.apache.axis.AxisFault e)
+ {
+ return null;
+ }
+ }
+
+ public void setMuscleWSEndpointAddress(java.lang.String address)
+ {
+ MuscleWS_address = address;
+ }
+
+ /**
+ * For the given interface, get the stub implementation.
+ * If this service has no port for the given interface,
+ * then ServiceException is thrown.
+ */
+ public java.rmi.Remote getPort(Class serviceEndpointInterface)
+ throws javax.xml.rpc.ServiceException
+ {
+ try
+ {
+ if (ext.vamsas.MuscleWS.class.isAssignableFrom(
+ serviceEndpointInterface))
+ {
+ ext.vamsas.MuscleWSSoapBindingStub _stub = new ext.vamsas.
+ MuscleWSSoapBindingStub(new java.net.URL(
+ MuscleWS_address), this);
+ _stub.setPortName(getMuscleWSWSDDServiceName());
+
+ return _stub;
+ }
+ }
+ catch (java.lang.Throwable t)
+ {
+ throw new javax.xml.rpc.ServiceException(t);
+ }
+
+ throw new javax.xml.rpc.ServiceException(
+ "There is no stub implementation for the interface: " +
+ ( (serviceEndpointInterface == null) ? "null"
+ : serviceEndpointInterface.getName()));
+ }
+
+ /**
+ * For the given interface, get the stub implementation.
+ * If this service has no port for the given interface,
+ * then ServiceException is thrown.
+ */
+ public java.rmi.Remote getPort(javax.xml.namespace.QName portName,
+ Class serviceEndpointInterface)
+ throws javax.xml.rpc.ServiceException
+ {
+ if (portName == null)
+ {
+ return getPort(serviceEndpointInterface);
+ }
+
+ java.lang.String inputPortName = portName.getLocalPart();
+
+ if ("MuscleWS".equals(inputPortName))
+ {
+ return getMuscleWS();
+ }
+ else
+ {
+ java.rmi.Remote _stub = getPort(serviceEndpointInterface);
+ ( (org.apache.axis.client.Stub) _stub).setPortName(portName);
+
+ return _stub;
+ }
+ }
+
+ public javax.xml.namespace.QName getServiceName()
+ {
+ return new javax.xml.namespace.QName("vamsas", "MuscleWSService");
+ }
+
+ public java.util.Iterator getPorts()
+ {
+ if (ports == null)
+ {
+ ports = new java.util.HashSet();
+ ports.add(new javax.xml.namespace.QName("vamsas", "MuscleWS"));
+ }
+
+ return ports.iterator();
+ }
+
+ /**
+ * Set the endpoint address for the specified port name.
+ */
+ public void setEndpointAddress(java.lang.String portName,
+ java.lang.String address)
+ throws javax.xml.rpc.ServiceException
+ {
+ if ("MuscleWS".equals(portName))
+ {
+ setMuscleWSEndpointAddress(address);
+ }
+ else
+ { // Unknown Port Name
+ throw new javax.xml.rpc.ServiceException(
+ " Cannot set Endpoint Address for Unknown Port" + portName);
+ }
+ }
+
+ /**
+ * Set the endpoint address for the specified port name.
+ */
+ public void setEndpointAddress(javax.xml.namespace.QName portName,
+ java.lang.String address)
+ throws javax.xml.rpc.ServiceException
+ {
+ setEndpointAddress(portName.getLocalPart(), address);
+ }
+}
-/**\r
- * MuscleWSSoapBindingStub.java\r
- *\r
- * This file was auto-generated from WSDL\r
- * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.\r
- */\r
-\r
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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 ext.vamsas;\r
-\r
-public class MuscleWSSoapBindingStub\r
- extends org.apache.axis.client.Stub implements ext.vamsas.MuscleWS\r
-{\r
- static org.apache.axis.description.OperationDesc[] _operations;\r
-\r
- static\r
- {\r
- _operations = new org.apache.axis.description.OperationDesc[4];\r
- _initOperationDesc1();\r
- }\r
-\r
- private java.util.Vector cachedSerClasses = new java.util.Vector();\r
- private java.util.Vector cachedSerQNames = new java.util.Vector();\r
- private java.util.Vector cachedSerFactories = new java.util.Vector();\r
- private java.util.Vector cachedDeserFactories = new java.util.Vector();\r
-\r
- public MuscleWSSoapBindingStub()\r
- throws org.apache.axis.AxisFault\r
- {\r
- this(null);\r
- }\r
-\r
- public MuscleWSSoapBindingStub(java.net.URL endpointURL,\r
- javax.xml.rpc.Service service)\r
- throws org.apache.axis.AxisFault\r
- {\r
- this(service);\r
- super.cachedEndpoint = endpointURL;\r
- }\r
-\r
- public MuscleWSSoapBindingStub(javax.xml.rpc.Service service)\r
- throws org.apache.axis.AxisFault\r
- {\r
- if (service == null)\r
- {\r
- super.service = new org.apache.axis.client.Service();\r
- }\r
- else\r
- {\r
- super.service = service;\r
- }\r
-\r
- java.lang.Class cls;\r
- javax.xml.namespace.QName qName;\r
- java.lang.Class beansf = org.apache.axis.encoding.ser.BeanSerializerFactory.class;\r
- java.lang.Class beandf = org.apache.axis.encoding.ser.\r
- BeanDeserializerFactory.class;\r
- //java.lang.Class enumsf = org.apache.axis.encoding.ser.EnumSerializerFactory.class;\r
- //java.lang.Class enumdf = org.apache.axis.encoding.ser.EnumDeserializerFactory.class;\r
- java.lang.Class arraysf = org.apache.axis.encoding.ser.\r
- ArraySerializerFactory.class;\r
- java.lang.Class arraydf = org.apache.axis.encoding.ser.\r
- ArrayDeserializerFactory.class;\r
- //java.lang.Class simplesf = org.apache.axis.encoding.ser.SimpleSerializerFactory.class;\r
- // java.lang.Class simpledf = org.apache.axis.encoding.ser.SimpleDeserializerFactory.class;\r
- //java.lang.Class simplelistsf = org.apache.axis.encoding.ser.SimpleListSerializerFactory.class;\r
- //java.lang.Class simplelistdf = org.apache.axis.encoding.ser.SimpleListDeserializerFactory.class;\r
- qName = new javax.xml.namespace.QName("simple.objects.vamsas",\r
- "Sequence");\r
- cachedSerQNames.add(qName);\r
- cls = vamsas.objects.simple.Sequence.class;\r
- cachedSerClasses.add(cls);\r
- cachedSerFactories.add(beansf);\r
- cachedDeserFactories.add(beandf);\r
-\r
- qName = new javax.xml.namespace.QName("vamsas", "ArrayOf_tns1_Sequence");\r
- cachedSerQNames.add(qName);\r
- cls = vamsas.objects.simple.Sequence[].class;\r
- cachedSerClasses.add(cls);\r
- cachedSerFactories.add(arraysf);\r
- cachedDeserFactories.add(arraydf);\r
-\r
- qName = new javax.xml.namespace.QName("simple.objects.vamsas",\r
- "MsaResult");\r
- cachedSerQNames.add(qName);\r
- cls = vamsas.objects.simple.MsaResult.class;\r
- cachedSerClasses.add(cls);\r
- cachedSerFactories.add(beansf);\r
- cachedDeserFactories.add(beandf);\r
-\r
- qName = new javax.xml.namespace.QName("simple.objects.vamsas",\r
- "SequenceSet");\r
- cachedSerQNames.add(qName);\r
- cls = vamsas.objects.simple.SequenceSet.class;\r
- cachedSerClasses.add(cls);\r
- cachedSerFactories.add(beansf);\r
- cachedDeserFactories.add(beandf);\r
-\r
- qName = new javax.xml.namespace.QName("http://simple.objects.vamsas",\r
- "Object");\r
- cachedSerQNames.add(qName);\r
- cls = vamsas.objects.simple.Object.class;\r
- cachedSerClasses.add(cls);\r
- cachedSerFactories.add(beansf);\r
- cachedDeserFactories.add(beandf);\r
-\r
- qName = new javax.xml.namespace.QName("simple.objects.vamsas",\r
- "Alignment");\r
- cachedSerQNames.add(qName);\r
- cls = vamsas.objects.simple.Alignment.class;\r
- cachedSerClasses.add(cls);\r
- cachedSerFactories.add(beansf);\r
- cachedDeserFactories.add(beandf);\r
-\r
- qName = new javax.xml.namespace.QName("simple.objects.vamsas", "WsJobId");\r
- cachedSerQNames.add(qName);\r
- cls = vamsas.objects.simple.WsJobId.class;\r
- cachedSerClasses.add(cls);\r
- cachedSerFactories.add(beansf);\r
- cachedDeserFactories.add(beandf);\r
-\r
- qName = new javax.xml.namespace.QName("vamsas", "ArrayOf_xsd_string");\r
- cachedSerQNames.add(qName);\r
- cls = java.lang.String[].class;\r
- cachedSerClasses.add(cls);\r
- cachedSerFactories.add(arraysf);\r
- cachedDeserFactories.add(arraydf);\r
-\r
- qName = new javax.xml.namespace.QName("simple.objects.vamsas", "Result");\r
- cachedSerQNames.add(qName);\r
- cls = vamsas.objects.simple.Result.class;\r
- cachedSerClasses.add(cls);\r
- cachedSerFactories.add(beansf);\r
- cachedDeserFactories.add(beandf);\r
- }\r
-\r
- private static void _initOperationDesc1()\r
- {\r
- org.apache.axis.description.OperationDesc oper;\r
- oper = new org.apache.axis.description.OperationDesc();\r
- oper.setName("align");\r
- oper.addParameter(new javax.xml.namespace.QName("", "seqSet"),\r
- new javax.xml.namespace.QName("simple.objects.vamsas",\r
- "SequenceSet"),\r
- vamsas.objects.simple.SequenceSet.class,\r
- org.apache.axis.description.ParameterDesc.IN, false, false);\r
- oper.setReturnType(new javax.xml.namespace.QName(\r
- "simple.objects.vamsas", "WsJobId"));\r
- oper.setReturnClass(vamsas.objects.simple.WsJobId.class);\r
- oper.setReturnQName(new javax.xml.namespace.QName("", "alignReturn"));\r
- oper.setStyle(org.apache.axis.constants.Style.RPC);\r
- oper.setUse(org.apache.axis.constants.Use.ENCODED);\r
- _operations[0] = oper;\r
-\r
- oper = new org.apache.axis.description.OperationDesc();\r
- oper.setName("getalign");\r
- oper.addParameter(new javax.xml.namespace.QName("", "job_id"),\r
- new javax.xml.namespace.QName(\r
- "http://www.w3.org/2001/XMLSchema",\r
- "string"), java.lang.String.class,\r
- org.apache.axis.description.ParameterDesc.IN, false, false);\r
- oper.setReturnType(new javax.xml.namespace.QName(\r
- "simple.objects.vamsas", "Alignment"));\r
- oper.setReturnClass(vamsas.objects.simple.Alignment.class);\r
- oper.setReturnQName(new javax.xml.namespace.QName("", "getalignReturn"));\r
- oper.setStyle(org.apache.axis.constants.Style.RPC);\r
- oper.setUse(org.apache.axis.constants.Use.ENCODED);\r
- _operations[1] = oper;\r
-\r
- oper = new org.apache.axis.description.OperationDesc();\r
- oper.setName("getResult");\r
- oper.addParameter(new javax.xml.namespace.QName("", "job_id"),\r
- new javax.xml.namespace.QName(\r
- "http://www.w3.org/2001/XMLSchema",\r
- "string"), java.lang.String.class,\r
- org.apache.axis.description.ParameterDesc.IN, false, false);\r
- oper.setReturnType(new javax.xml.namespace.QName(\r
- "simple.objects.vamsas", "MsaResult"));\r
- oper.setReturnClass(vamsas.objects.simple.MsaResult.class);\r
- oper.setReturnQName(new javax.xml.namespace.QName("", "getResultReturn"));\r
- oper.setStyle(org.apache.axis.constants.Style.RPC);\r
- oper.setUse(org.apache.axis.constants.Use.ENCODED);\r
- _operations[2] = oper;\r
-\r
- oper = new org.apache.axis.description.OperationDesc();\r
- oper.setName("cancel");\r
- oper.addParameter(new javax.xml.namespace.QName("", "jobId"),\r
- new javax.xml.namespace.QName(\r
- "http://www.w3.org/2001/XMLSchema",\r
- "string"), java.lang.String.class,\r
- org.apache.axis.description.ParameterDesc.IN, false, false);\r
- oper.setReturnType(new javax.xml.namespace.QName(\r
- "simple.objects.vamsas", "WsJobId"));\r
- oper.setReturnClass(vamsas.objects.simple.WsJobId.class);\r
- oper.setReturnQName(new javax.xml.namespace.QName("", "cancelReturn"));\r
- oper.setStyle(org.apache.axis.constants.Style.RPC);\r
- oper.setUse(org.apache.axis.constants.Use.ENCODED);\r
- _operations[3] = oper;\r
- }\r
-\r
- protected org.apache.axis.client.Call createCall()\r
- throws java.rmi.RemoteException\r
- {\r
- try\r
- {\r
- org.apache.axis.client.Call _call = (org.apache.axis.client.Call)super.\r
- service.createCall();\r
-\r
- if (super.maintainSessionSet)\r
- {\r
- _call.setMaintainSession(super.maintainSession);\r
- }\r
-\r
- if (super.cachedUsername != null)\r
- {\r
- _call.setUsername(super.cachedUsername);\r
- }\r
-\r
- if (super.cachedPassword != null)\r
- {\r
- _call.setPassword(super.cachedPassword);\r
- }\r
-\r
- if (super.cachedEndpoint != null)\r
- {\r
- _call.setTargetEndpointAddress(super.cachedEndpoint);\r
- }\r
-\r
- if (super.cachedTimeout != null)\r
- {\r
- _call.setTimeout(super.cachedTimeout);\r
- }\r
-\r
- if (super.cachedPortName != null)\r
- {\r
- _call.setPortName(super.cachedPortName);\r
- }\r
-\r
- java.util.Enumeration keys = super.cachedProperties.keys();\r
-\r
- while (keys.hasMoreElements())\r
- {\r
- java.lang.String key = (java.lang.String) keys.nextElement();\r
- _call.setProperty(key, super.cachedProperties.get(key));\r
- }\r
-\r
- // All the type mapping information is registered\r
- // when the first call is made.\r
- // The type mapping information is actually registered in\r
- // the TypeMappingRegistry of the service, which\r
- // is the reason why registration is only needed for the first call.\r
- synchronized (this)\r
- {\r
- if (firstCall())\r
- {\r
- // must set encoding style before registering serializers\r
- _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.\r
- SOAP11_CONSTANTS);\r
- _call.setEncodingStyle(org.apache.axis.Constants.URI_SOAP11_ENC);\r
-\r
- for (int i = 0; i < cachedSerFactories.size(); ++i)\r
- {\r
- java.lang.Class cls = (java.lang.Class) cachedSerClasses.get(i);\r
- javax.xml.namespace.QName qName = (javax.xml.namespace.QName)\r
- cachedSerQNames.get(i);\r
- java.lang.Class sf = (java.lang.Class) cachedSerFactories.get(i);\r
- java.lang.Class df = (java.lang.Class) cachedDeserFactories.get(i);\r
- _call.registerTypeMapping(cls, qName, sf, df, false);\r
- }\r
- }\r
- }\r
-\r
- return _call;\r
- }\r
- catch (java.lang.Throwable _t)\r
- {\r
- throw new org.apache.axis.AxisFault(\r
- "Failure trying to get the Call object",\r
- _t);\r
- }\r
- }\r
-\r
- public vamsas.objects.simple.WsJobId align(\r
- vamsas.objects.simple.SequenceSet seqSet)\r
- throws java.rmi.RemoteException\r
- {\r
- if (super.cachedEndpoint == null)\r
- {\r
- throw new org.apache.axis.NoEndPointException();\r
- }\r
-\r
- org.apache.axis.client.Call _call = createCall();\r
- _call.setOperation(_operations[0]);\r
- _call.setUseSOAPAction(true);\r
- _call.setSOAPActionURI("");\r
- _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);\r
- _call.setOperationName(new javax.xml.namespace.QName("vamsas", "align"));\r
-\r
- setRequestHeaders(_call);\r
- setAttachments(_call);\r
-\r
- java.lang.Object _resp = _call.invoke(new java.lang.Object[]\r
- {seqSet});\r
-\r
- if (_resp instanceof java.rmi.RemoteException)\r
- {\r
- throw (java.rmi.RemoteException) _resp;\r
- }\r
- else\r
- {\r
- extractAttachments(_call);\r
-\r
- try\r
- {\r
- return (vamsas.objects.simple.WsJobId) _resp;\r
- }\r
- catch (java.lang.Exception _exception)\r
- {\r
- return (vamsas.objects.simple.WsJobId) org.apache.axis.utils.JavaUtils.\r
- convert(_resp,\r
- vamsas.objects.simple.WsJobId.class);\r
- }\r
- }\r
- }\r
-\r
- public vamsas.objects.simple.Alignment getalign(java.lang.String job_id)\r
- throws java.rmi.RemoteException\r
- {\r
- if (super.cachedEndpoint == null)\r
- {\r
- throw new org.apache.axis.NoEndPointException();\r
- }\r
-\r
- org.apache.axis.client.Call _call = createCall();\r
- _call.setOperation(_operations[1]);\r
- _call.setUseSOAPAction(true);\r
- _call.setSOAPActionURI("");\r
- _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);\r
- _call.setOperationName(new javax.xml.namespace.QName("vamsas",\r
- "getalign"));\r
-\r
- setRequestHeaders(_call);\r
- setAttachments(_call);\r
-\r
- java.lang.Object _resp = _call.invoke(new java.lang.Object[]\r
- {job_id});\r
-\r
- if (_resp instanceof java.rmi.RemoteException)\r
- {\r
- throw (java.rmi.RemoteException) _resp;\r
- }\r
- else\r
- {\r
- extractAttachments(_call);\r
-\r
- try\r
- {\r
- return (vamsas.objects.simple.Alignment) _resp;\r
- }\r
- catch (java.lang.Exception _exception)\r
- {\r
- return (vamsas.objects.simple.Alignment) org.apache.axis.utils.\r
- JavaUtils.convert(_resp,\r
- vamsas.objects.simple.Alignment.class);\r
- }\r
- }\r
- }\r
-\r
- public vamsas.objects.simple.MsaResult getResult(java.lang.String job_id)\r
- throws java.rmi.RemoteException\r
- {\r
- if (super.cachedEndpoint == null)\r
- {\r
- throw new org.apache.axis.NoEndPointException();\r
- }\r
-\r
- org.apache.axis.client.Call _call = createCall();\r
- _call.setOperation(_operations[2]);\r
- _call.setUseSOAPAction(true);\r
- _call.setSOAPActionURI("");\r
- _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);\r
- _call.setOperationName(new javax.xml.namespace.QName("vamsas",\r
- "getResult"));\r
-\r
- setRequestHeaders(_call);\r
- setAttachments(_call);\r
-\r
- java.lang.Object _resp = _call.invoke(new java.lang.Object[]\r
- {job_id});\r
-\r
- if (_resp instanceof java.rmi.RemoteException)\r
- {\r
- throw (java.rmi.RemoteException) _resp;\r
- }\r
- else\r
- {\r
- extractAttachments(_call);\r
-\r
- try\r
- {\r
- return (vamsas.objects.simple.MsaResult) _resp;\r
- }\r
- catch (java.lang.Exception _exception)\r
- {\r
- return (vamsas.objects.simple.MsaResult) org.apache.axis.utils.\r
- JavaUtils.convert(_resp,\r
- vamsas.objects.simple.MsaResult.class);\r
- }\r
- }\r
- }\r
-\r
- public vamsas.objects.simple.WsJobId cancel(java.lang.String jobId)\r
- throws java.rmi.RemoteException\r
- {\r
- if (super.cachedEndpoint == null)\r
- {\r
- throw new org.apache.axis.NoEndPointException();\r
- }\r
-\r
- org.apache.axis.client.Call _call = createCall();\r
- _call.setOperation(_operations[3]);\r
- _call.setUseSOAPAction(true);\r
- _call.setSOAPActionURI("");\r
- _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);\r
- _call.setOperationName(new javax.xml.namespace.QName("vamsas", "cancel"));\r
-\r
- setRequestHeaders(_call);\r
- setAttachments(_call);\r
-\r
- java.lang.Object _resp = _call.invoke(new java.lang.Object[]\r
- {jobId});\r
-\r
- if (_resp instanceof java.rmi.RemoteException)\r
- {\r
- throw (java.rmi.RemoteException) _resp;\r
- }\r
- else\r
- {\r
- extractAttachments(_call);\r
-\r
- try\r
- {\r
- return (vamsas.objects.simple.WsJobId) _resp;\r
- }\r
- catch (java.lang.Exception _exception)\r
- {\r
- return (vamsas.objects.simple.WsJobId) org.apache.axis.utils.JavaUtils.\r
- convert(_resp,\r
- vamsas.objects.simple.WsJobId.class);\r
- }\r
- }\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
+ */
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer
+ * Copyright (C) 2007 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 ext.vamsas;
+
+public class MuscleWSSoapBindingStub
+ extends org.apache.axis.client.Stub implements ext.vamsas.MuscleWS
+{
+ static org.apache.axis.description.OperationDesc[] _operations;
+
+ static
+ {
+ _operations = new org.apache.axis.description.OperationDesc[4];
+ _initOperationDesc1();
+ }
+
+ private java.util.Vector cachedSerClasses = new java.util.Vector();
+ private java.util.Vector cachedSerQNames = new java.util.Vector();
+ private java.util.Vector cachedSerFactories = new java.util.Vector();
+ private java.util.Vector cachedDeserFactories = new java.util.Vector();
+
+ public MuscleWSSoapBindingStub()
+ throws org.apache.axis.AxisFault
+ {
+ this(null);
+ }
+
+ public MuscleWSSoapBindingStub(java.net.URL endpointURL,
+ javax.xml.rpc.Service service)
+ throws org.apache.axis.AxisFault
+ {
+ this(service);
+ super.cachedEndpoint = endpointURL;
+ }
+
+ public MuscleWSSoapBindingStub(javax.xml.rpc.Service service)
+ throws org.apache.axis.AxisFault
+ {
+ if (service == null)
+ {
+ super.service = new org.apache.axis.client.Service();
+ }
+ else
+ {
+ super.service = service;
+ }
+
+ java.lang.Class cls;
+ javax.xml.namespace.QName qName;
+ java.lang.Class beansf = org.apache.axis.encoding.ser.BeanSerializerFactory.class;
+ java.lang.Class beandf = org.apache.axis.encoding.ser.
+ BeanDeserializerFactory.class;
+ //java.lang.Class enumsf = org.apache.axis.encoding.ser.EnumSerializerFactory.class;
+ //java.lang.Class enumdf = org.apache.axis.encoding.ser.EnumDeserializerFactory.class;
+ java.lang.Class arraysf = org.apache.axis.encoding.ser.
+ ArraySerializerFactory.class;
+ java.lang.Class arraydf = org.apache.axis.encoding.ser.
+ ArrayDeserializerFactory.class;
+ //java.lang.Class simplesf = org.apache.axis.encoding.ser.SimpleSerializerFactory.class;
+ // java.lang.Class simpledf = org.apache.axis.encoding.ser.SimpleDeserializerFactory.class;
+ //java.lang.Class simplelistsf = org.apache.axis.encoding.ser.SimpleListSerializerFactory.class;
+ //java.lang.Class simplelistdf = org.apache.axis.encoding.ser.SimpleListDeserializerFactory.class;
+ qName = new javax.xml.namespace.QName("simple.objects.vamsas",
+ "Sequence");
+ cachedSerQNames.add(qName);
+ cls = vamsas.objects.simple.Sequence.class;
+ cachedSerClasses.add(cls);
+ cachedSerFactories.add(beansf);
+ cachedDeserFactories.add(beandf);
+
+ qName = new javax.xml.namespace.QName("vamsas", "ArrayOf_tns1_Sequence");
+ cachedSerQNames.add(qName);
+ cls = vamsas.objects.simple.Sequence[].class;
+ cachedSerClasses.add(cls);
+ cachedSerFactories.add(arraysf);
+ cachedDeserFactories.add(arraydf);
+
+ qName = new javax.xml.namespace.QName("simple.objects.vamsas",
+ "MsaResult");
+ cachedSerQNames.add(qName);
+ cls = vamsas.objects.simple.MsaResult.class;
+ cachedSerClasses.add(cls);
+ cachedSerFactories.add(beansf);
+ cachedDeserFactories.add(beandf);
+
+ qName = new javax.xml.namespace.QName("simple.objects.vamsas",
+ "SequenceSet");
+ cachedSerQNames.add(qName);
+ cls = vamsas.objects.simple.SequenceSet.class;
+ cachedSerClasses.add(cls);
+ cachedSerFactories.add(beansf);
+ cachedDeserFactories.add(beandf);
+
+ qName = new javax.xml.namespace.QName("http://simple.objects.vamsas",
+ "Object");
+ cachedSerQNames.add(qName);
+ cls = vamsas.objects.simple.Object.class;
+ cachedSerClasses.add(cls);
+ cachedSerFactories.add(beansf);
+ cachedDeserFactories.add(beandf);
+
+ qName = new javax.xml.namespace.QName("simple.objects.vamsas",
+ "Alignment");
+ cachedSerQNames.add(qName);
+ cls = vamsas.objects.simple.Alignment.class;
+ cachedSerClasses.add(cls);
+ cachedSerFactories.add(beansf);
+ cachedDeserFactories.add(beandf);
+
+ qName = new javax.xml.namespace.QName("simple.objects.vamsas", "WsJobId");
+ cachedSerQNames.add(qName);
+ cls = vamsas.objects.simple.WsJobId.class;
+ cachedSerClasses.add(cls);
+ cachedSerFactories.add(beansf);
+ cachedDeserFactories.add(beandf);
+
+ qName = new javax.xml.namespace.QName("vamsas", "ArrayOf_xsd_string");
+ cachedSerQNames.add(qName);
+ cls = java.lang.String[].class;
+ cachedSerClasses.add(cls);
+ cachedSerFactories.add(arraysf);
+ cachedDeserFactories.add(arraydf);
+
+ qName = new javax.xml.namespace.QName("simple.objects.vamsas", "Result");
+ cachedSerQNames.add(qName);
+ cls = vamsas.objects.simple.Result.class;
+ cachedSerClasses.add(cls);
+ cachedSerFactories.add(beansf);
+ cachedDeserFactories.add(beandf);
+ }
+
+ private static void _initOperationDesc1()
+ {
+ org.apache.axis.description.OperationDesc oper;
+ oper = new org.apache.axis.description.OperationDesc();
+ oper.setName("align");
+ oper.addParameter(new javax.xml.namespace.QName("", "seqSet"),
+ new javax.xml.namespace.QName("simple.objects.vamsas",
+ "SequenceSet"),
+ vamsas.objects.simple.SequenceSet.class,
+ org.apache.axis.description.ParameterDesc.IN, false, false);
+ oper.setReturnType(new javax.xml.namespace.QName(
+ "simple.objects.vamsas", "WsJobId"));
+ oper.setReturnClass(vamsas.objects.simple.WsJobId.class);
+ oper.setReturnQName(new javax.xml.namespace.QName("", "alignReturn"));
+ oper.setStyle(org.apache.axis.constants.Style.RPC);
+ oper.setUse(org.apache.axis.constants.Use.ENCODED);
+ _operations[0] = oper;
+
+ oper = new org.apache.axis.description.OperationDesc();
+ oper.setName("getalign");
+ oper.addParameter(new javax.xml.namespace.QName("", "job_id"),
+ new javax.xml.namespace.QName(
+ "http://www.w3.org/2001/XMLSchema",
+ "string"), java.lang.String.class,
+ org.apache.axis.description.ParameterDesc.IN, false, false);
+ oper.setReturnType(new javax.xml.namespace.QName(
+ "simple.objects.vamsas", "Alignment"));
+ oper.setReturnClass(vamsas.objects.simple.Alignment.class);
+ oper.setReturnQName(new javax.xml.namespace.QName("", "getalignReturn"));
+ oper.setStyle(org.apache.axis.constants.Style.RPC);
+ oper.setUse(org.apache.axis.constants.Use.ENCODED);
+ _operations[1] = oper;
+
+ oper = new org.apache.axis.description.OperationDesc();
+ oper.setName("getResult");
+ oper.addParameter(new javax.xml.namespace.QName("", "job_id"),
+ new javax.xml.namespace.QName(
+ "http://www.w3.org/2001/XMLSchema",
+ "string"), java.lang.String.class,
+ org.apache.axis.description.ParameterDesc.IN, false, false);
+ oper.setReturnType(new javax.xml.namespace.QName(
+ "simple.objects.vamsas", "MsaResult"));
+ oper.setReturnClass(vamsas.objects.simple.MsaResult.class);
+ oper.setReturnQName(new javax.xml.namespace.QName("", "getResultReturn"));
+ oper.setStyle(org.apache.axis.constants.Style.RPC);
+ oper.setUse(org.apache.axis.constants.Use.ENCODED);
+ _operations[2] = oper;
+
+ oper = new org.apache.axis.description.OperationDesc();
+ oper.setName("cancel");
+ oper.addParameter(new javax.xml.namespace.QName("", "jobId"),
+ new javax.xml.namespace.QName(
+ "http://www.w3.org/2001/XMLSchema",
+ "string"), java.lang.String.class,
+ org.apache.axis.description.ParameterDesc.IN, false, false);
+ oper.setReturnType(new javax.xml.namespace.QName(
+ "simple.objects.vamsas", "WsJobId"));
+ oper.setReturnClass(vamsas.objects.simple.WsJobId.class);
+ oper.setReturnQName(new javax.xml.namespace.QName("", "cancelReturn"));
+ oper.setStyle(org.apache.axis.constants.Style.RPC);
+ oper.setUse(org.apache.axis.constants.Use.ENCODED);
+ _operations[3] = oper;
+ }
+
+ protected org.apache.axis.client.Call createCall()
+ throws java.rmi.RemoteException
+ {
+ try
+ {
+ org.apache.axis.client.Call _call = (org.apache.axis.client.Call)super.
+ service.createCall();
+
+ if (super.maintainSessionSet)
+ {
+ _call.setMaintainSession(super.maintainSession);
+ }
+
+ if (super.cachedUsername != null)
+ {
+ _call.setUsername(super.cachedUsername);
+ }
+
+ if (super.cachedPassword != null)
+ {
+ _call.setPassword(super.cachedPassword);
+ }
+
+ if (super.cachedEndpoint != null)
+ {
+ _call.setTargetEndpointAddress(super.cachedEndpoint);
+ }
+
+ if (super.cachedTimeout != null)
+ {
+ _call.setTimeout(super.cachedTimeout);
+ }
+
+ if (super.cachedPortName != null)
+ {
+ _call.setPortName(super.cachedPortName);
+ }
+
+ java.util.Enumeration keys = super.cachedProperties.keys();
+
+ while (keys.hasMoreElements())
+ {
+ java.lang.String key = (java.lang.String) keys.nextElement();
+ _call.setProperty(key, super.cachedProperties.get(key));
+ }
+
+ // All the type mapping information is registered
+ // when the first call is made.
+ // The type mapping information is actually registered in
+ // the TypeMappingRegistry of the service, which
+ // is the reason why registration is only needed for the first call.
+ synchronized (this)
+ {
+ if (firstCall())
+ {
+ // must set encoding style before registering serializers
+ _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.
+ SOAP11_CONSTANTS);
+ _call.setEncodingStyle(org.apache.axis.Constants.URI_SOAP11_ENC);
+
+ for (int i = 0; i < cachedSerFactories.size(); ++i)
+ {
+ java.lang.Class cls = (java.lang.Class) cachedSerClasses.get(i);
+ javax.xml.namespace.QName qName = (javax.xml.namespace.QName)
+ cachedSerQNames.get(i);
+ java.lang.Class sf = (java.lang.Class) cachedSerFactories.get(i);
+ java.lang.Class df = (java.lang.Class) cachedDeserFactories.get(i);
+ _call.registerTypeMapping(cls, qName, sf, df, false);
+ }
+ }
+ }
+
+ return _call;
+ }
+ catch (java.lang.Throwable _t)
+ {
+ throw new org.apache.axis.AxisFault(
+ "Failure trying to get the Call object",
+ _t);
+ }
+ }
+
+ public vamsas.objects.simple.WsJobId align(
+ vamsas.objects.simple.SequenceSet seqSet)
+ throws java.rmi.RemoteException
+ {
+ if (super.cachedEndpoint == null)
+ {
+ throw new org.apache.axis.NoEndPointException();
+ }
+
+ org.apache.axis.client.Call _call = createCall();
+ _call.setOperation(_operations[0]);
+ _call.setUseSOAPAction(true);
+ _call.setSOAPActionURI("");
+ _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
+ _call.setOperationName(new javax.xml.namespace.QName("vamsas", "align"));
+
+ setRequestHeaders(_call);
+ setAttachments(_call);
+
+ java.lang.Object _resp = _call.invoke(new java.lang.Object[]
+ {seqSet});
+
+ if (_resp instanceof java.rmi.RemoteException)
+ {
+ throw (java.rmi.RemoteException) _resp;
+ }
+ else
+ {
+ extractAttachments(_call);
+
+ try
+ {
+ return (vamsas.objects.simple.WsJobId) _resp;
+ }
+ catch (java.lang.Exception _exception)
+ {
+ return (vamsas.objects.simple.WsJobId) org.apache.axis.utils.JavaUtils.
+ convert(_resp,
+ vamsas.objects.simple.WsJobId.class);
+ }
+ }
+ }
+
+ public vamsas.objects.simple.Alignment getalign(java.lang.String job_id)
+ throws java.rmi.RemoteException
+ {
+ if (super.cachedEndpoint == null)
+ {
+ throw new org.apache.axis.NoEndPointException();
+ }
+
+ org.apache.axis.client.Call _call = createCall();
+ _call.setOperation(_operations[1]);
+ _call.setUseSOAPAction(true);
+ _call.setSOAPActionURI("");
+ _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
+ _call.setOperationName(new javax.xml.namespace.QName("vamsas",
+ "getalign"));
+
+ setRequestHeaders(_call);
+ setAttachments(_call);
+
+ java.lang.Object _resp = _call.invoke(new java.lang.Object[]
+ {job_id});
+
+ if (_resp instanceof java.rmi.RemoteException)
+ {
+ throw (java.rmi.RemoteException) _resp;
+ }
+ else
+ {
+ extractAttachments(_call);
+
+ try
+ {
+ return (vamsas.objects.simple.Alignment) _resp;
+ }
+ catch (java.lang.Exception _exception)
+ {
+ return (vamsas.objects.simple.Alignment) org.apache.axis.utils.
+ JavaUtils.convert(_resp,
+ vamsas.objects.simple.Alignment.class);
+ }
+ }
+ }
+
+ public vamsas.objects.simple.MsaResult getResult(java.lang.String job_id)
+ throws java.rmi.RemoteException
+ {
+ if (super.cachedEndpoint == null)
+ {
+ throw new org.apache.axis.NoEndPointException();
+ }
+
+ org.apache.axis.client.Call _call = createCall();
+ _call.setOperation(_operations[2]);
+ _call.setUseSOAPAction(true);
+ _call.setSOAPActionURI("");
+ _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
+ _call.setOperationName(new javax.xml.namespace.QName("vamsas",
+ "getResult"));
+
+ setRequestHeaders(_call);
+ setAttachments(_call);
+
+ java.lang.Object _resp = _call.invoke(new java.lang.Object[]
+ {job_id});
+
+ if (_resp instanceof java.rmi.RemoteException)
+ {
+ throw (java.rmi.RemoteException) _resp;
+ }
+ else
+ {
+ extractAttachments(_call);
+
+ try
+ {
+ return (vamsas.objects.simple.MsaResult) _resp;
+ }
+ catch (java.lang.Exception _exception)
+ {
+ return (vamsas.objects.simple.MsaResult) org.apache.axis.utils.
+ JavaUtils.convert(_resp,
+ vamsas.objects.simple.MsaResult.class);
+ }
+ }
+ }
+
+ public vamsas.objects.simple.WsJobId cancel(java.lang.String jobId)
+ throws java.rmi.RemoteException
+ {
+ if (super.cachedEndpoint == null)
+ {
+ throw new org.apache.axis.NoEndPointException();
+ }
+
+ org.apache.axis.client.Call _call = createCall();
+ _call.setOperation(_operations[3]);
+ _call.setUseSOAPAction(true);
+ _call.setSOAPActionURI("");
+ _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
+ _call.setOperationName(new javax.xml.namespace.QName("vamsas", "cancel"));
+
+ setRequestHeaders(_call);
+ setAttachments(_call);
+
+ java.lang.Object _resp = _call.invoke(new java.lang.Object[]
+ {jobId});
+
+ if (_resp instanceof java.rmi.RemoteException)
+ {
+ throw (java.rmi.RemoteException) _resp;
+ }
+ else
+ {
+ extractAttachments(_call);
+
+ try
+ {
+ return (vamsas.objects.simple.WsJobId) _resp;
+ }
+ catch (java.lang.Exception _exception)
+ {
+ return (vamsas.objects.simple.WsJobId) org.apache.axis.utils.JavaUtils.
+ convert(_resp,
+ vamsas.objects.simple.WsJobId.class);
+ }
+ }
+ }
+}
-/**
- * RegistryServiceSoapBindingStub.java
- *
- * This file was auto-generated from WSDL
- * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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 ext.vamsas;
public class RegistryServiceSoapBindingStub
-/**\r
- * ScanPSService.java\r
- *\r
- * This file was auto-generated from WSDL\r
- * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.\r
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package ext.vamsas;\r
\r
public interface SeqSearchI extends java.rmi.Remote {\r
-/**\r
- * ScanPSServiceServiceLocator.java\r
- *\r
- * This file was auto-generated from WSDL\r
- * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.\r
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package ext.vamsas;\r
\r
public class SeqSearchServiceLocator extends org.apache.axis.client.Service implements ext.vamsas.SeqSearchServiceService {\r
-/**\r
- * ScanPSServiceService.java\r
- *\r
- * This file was auto-generated from WSDL\r
- * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.\r
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package ext.vamsas;\r
\r
public interface SeqSearchServiceService extends javax.xml.rpc.Service {\r
-/**\r
- * ScanPSServiceSoapBindingStub.java\r
- *\r
- * This file was auto-generated from WSDL\r
- * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.\r
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package ext.vamsas;\r
\r
public class SeqSearchServiceSoapBindingStub extends org.apache.axis.client.Stub implements ext.vamsas.SeqSearchI {\r
static {\r
_operations = new org.apache.axis.description.OperationDesc[5];\r
_initOperationDesc1();\r
- }
+ }\r
\r
private static void _initOperationDesc1(){\r
org.apache.axis.description.OperationDesc oper;\r
-/**
- * ServiceHandle.java
- *
- * This file was auto-generated from WSDL
- * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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 ext.vamsas;
public class ServiceHandle
-/**
- * ServiceHandles.java
- *
- * This file was auto-generated from WSDL
- * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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 ext.vamsas;
public class ServiceHandles
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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 java.util.*;\r
-\r
-import jalview.datamodel.*;\r
-\r
-/**\r
- * Takes in a vector or array of sequences and column start and column end\r
- * and returns a new Hashtable[] of size maxSeqLength, if Hashtable not supplied.\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
- //No need to store 1000s of strings which are not\r
- //visible to the user.\r
- public static final String MAXCOUNT = "C";\r
- public static final String MAXRESIDUE = "R";\r
- public static final String PID_GAPS = "G";\r
- public static final String PID_NOGAPS = "N";\r
-\r
- public static final Hashtable[] calculate(Vector sequences, int start,\r
- int end)\r
- {\r
- SequenceI[] seqs = new SequenceI[sequences.size()];\r
- int width = 0;\r
- for (int i = 0; i < sequences.size(); i++)\r
- {\r
- seqs[i] = (SequenceI) sequences.elementAt(i);\r
- if (seqs[i].getLength() > width)\r
- {\r
- width = seqs[i].getLength();\r
- }\r
- }\r
-\r
- Hashtable[] reply = new Hashtable[width];\r
-\r
- if (end >= width)\r
- {\r
- end = width;\r
- }\r
-\r
- calculate(seqs, start, end, reply);\r
-\r
- return reply;\r
- }\r
-\r
- public static final void calculate(SequenceI[] sequences,\r
- int start, int end,\r
- Hashtable[] result)\r
- {\r
- Hashtable residueHash;\r
- int maxCount, nongap, i, j, v, jSize = sequences.length;\r
- String maxResidue;\r
- char c;\r
- float percentage;\r
-\r
- int[] values = new int[255];\r
-\r
- char[] seq;\r
-\r
- for (i = start; i < end; i++)\r
- {\r
- residueHash = new Hashtable();\r
- maxCount = 0;\r
- maxResidue = "";\r
- nongap = 0;\r
- values = new int[255];\r
-\r
- for (j = 0; j < jSize; j++)\r
- {\r
- seq = sequences[j].getSequence();\r
- if (seq.length > i)\r
- {\r
- c = seq[i];\r
-\r
- if (c == '.' || c == ' ')\r
- {\r
- c = '-';\r
- }\r
-\r
- if (c == '-')\r
- {\r
- values['-']++;\r
- continue;\r
- }\r
- else if ('a' <= c && c <= 'z')\r
- {\r
- c -= 32; //('a' - 'A');\r
- }\r
-\r
- nongap++;\r
- values[c]++;\r
-\r
- }\r
- else\r
- {\r
- values['-']++;\r
- }\r
- }\r
-\r
- for (v = 'A'; v < 'Z'; v++)\r
- {\r
- if (values[v] < 2 || values[v] < maxCount)\r
- {\r
- continue;\r
- }\r
-\r
- if (values[v] > maxCount)\r
- {\r
- maxResidue = String.valueOf( (char) v);\r
- }\r
- else if (values[v] == maxCount)\r
- {\r
- maxResidue += String.valueOf( (char) v);\r
- }\r
- maxCount = values[v];\r
- }\r
-\r
- if (maxResidue.length() == 0)\r
- {\r
- maxResidue = "-";\r
- }\r
-\r
- residueHash.put(MAXCOUNT, new Integer(maxCount));\r
- residueHash.put(MAXRESIDUE, maxResidue);\r
-\r
- percentage = ( (float) maxCount * 100) / (float) jSize;\r
- residueHash.put(PID_GAPS, new Float(percentage));\r
-\r
- percentage = ( (float) maxCount * 100) / (float) nongap;\r
- residueHash.put(PID_NOGAPS, new Float(percentage));\r
- result[i] = residueHash;\r
- }\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.analysis;
+
+import java.util.*;
+
+import jalview.datamodel.*;
+
+/**
+ * Takes in a vector or array of sequences and column start and column end
+ * and returns a new Hashtable[] of size maxSeqLength, if Hashtable not supplied.
+ * This class is used extensively in calculating alignment colourschemes
+ * that depend on the amount of conservation in each alignment column.
+ * @author $author$
+ * @version $Revision$
+ */
+public class AAFrequency
+{
+ //No need to store 1000s of strings which are not
+ //visible to the user.
+ public static final String MAXCOUNT = "C";
+ public static final String MAXRESIDUE = "R";
+ public static final String PID_GAPS = "G";
+ public static final String PID_NOGAPS = "N";
+
+ public static final Hashtable[] calculate(Vector sequences, int start,
+ int end)
+ {
+ SequenceI[] seqs = new SequenceI[sequences.size()];
+ int width = 0;
+ for (int i = 0; i < sequences.size(); i++)
+ {
+ seqs[i] = (SequenceI) sequences.elementAt(i);
+ if (seqs[i].getLength() > width)
+ {
+ width = seqs[i].getLength();
+ }
+ }
+
+ Hashtable[] reply = new Hashtable[width];
+
+ if (end >= width)
+ {
+ end = width;
+ }
+
+ calculate(seqs, start, end, reply);
+
+ return reply;
+ }
+
+ public static final void calculate(SequenceI[] sequences,
+ int start, int end,
+ Hashtable[] result)
+ {
+ Hashtable residueHash;
+ int maxCount, nongap, i, j, v, jSize = sequences.length;
+ String maxResidue;
+ char c;
+ float percentage;
+
+ int[] values = new int[255];
+
+ char[] seq;
+
+ for (i = start; i < end; i++)
+ {
+ residueHash = new Hashtable();
+ maxCount = 0;
+ maxResidue = "";
+ nongap = 0;
+ values = new int[255];
+
+ for (j = 0; j < jSize; j++)
+ {
+ seq = sequences[j].getSequence();
+ if (seq.length > i)
+ {
+ c = seq[i];
+
+ if (c == '.' || c == ' ')
+ {
+ c = '-';
+ }
+
+ if (c == '-')
+ {
+ values['-']++;
+ continue;
+ }
+ else if ('a' <= c && c <= 'z')
+ {
+ c -= 32; //('a' - 'A');
+ }
+
+ nongap++;
+ values[c]++;
+
+ }
+ else
+ {
+ values['-']++;
+ }
+ }
+
+ for (v = 'A'; v < 'Z'; v++)
+ {
+ if (values[v] < 2 || values[v] < maxCount)
+ {
+ continue;
+ }
+
+ if (values[v] > maxCount)
+ {
+ maxResidue = String.valueOf( (char) v);
+ }
+ else if (values[v] == maxCount)
+ {
+ maxResidue += String.valueOf( (char) v);
+ }
+ maxCount = values[v];
+ }
+
+ if (maxResidue.length() == 0)
+ {
+ maxResidue = "-";
+ }
+
+ residueHash.put(MAXCOUNT, new Integer(maxCount));
+ residueHash.put(MAXRESIDUE, maxResidue);
+
+ percentage = ( (float) maxCount * 100) / (float) jSize;
+ residueHash.put(PID_GAPS, new Float(percentage));
+
+ percentage = ( (float) maxCount * 100) / (float) nongap;
+ residueHash.put(PID_NOGAPS, new Float(percentage));
+ result[i] = residueHash;
+ }
+ }
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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 java.util.Enumeration;\r
* System.out.println("Prod "+p+": "+prod[p].getDisplayId(true)); } }\r
* } }\r
*/\r
-}
\ No newline at end of file
+}\r
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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 java.util.Enumeration;\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.analysis;
import java.util.*;
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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 java.io.*;\r
-\r
-import jalview.datamodel.*;\r
-import jalview.math.*;\r
-\r
-/**\r
- * Performs Principal Component Analysis on given sequences\r
- *\r
- * @author $author$\r
- * @version $Revision$\r
- */\r
-public class PCA\r
- implements Runnable\r
-{\r
- Matrix m;\r
- Matrix symm;\r
- Matrix m2;\r
- double[] eigenvalue;\r
- Matrix eigenvector;\r
- StringBuffer details = new StringBuffer();\r
-\r
- /**\r
- * Creates a new PCA object.\r
- *\r
- * @param s Set of sequences to perform PCA on\r
- */\r
- public PCA(String[] s)\r
- {\r
-\r
- BinarySequence[] bs = new BinarySequence[s.length];\r
- int ii = 0;\r
-\r
- while ( (ii < s.length) && (s[ii] != null))\r
- {\r
- bs[ii] = new BinarySequence(s[ii]);\r
- bs[ii].encode();\r
- ii++;\r
- }\r
-\r
- BinarySequence[] bs2 = new BinarySequence[s.length];\r
- ii = 0;\r
-\r
- while ( (ii < s.length) && (s[ii] != null))\r
- {\r
- bs2[ii] = new BinarySequence(s[ii]);\r
- bs2[ii].blosumEncode();\r
- ii++;\r
- }\r
-\r
- //System.out.println("Created binary encoding");\r
- //printMemory(rt);\r
- int count = 0;\r
-\r
- while ( (count < bs.length) && (bs[count] != null))\r
- {\r
- count++;\r
- }\r
-\r
- double[][] seqmat = new double[count][bs[0].getDBinary().length];\r
- double[][] seqmat2 = new double[count][bs2[0].getDBinary().length];\r
- int i = 0;\r
-\r
- while (i < count)\r
- {\r
- seqmat[i] = bs[i].getDBinary();\r
- seqmat2[i] = bs2[i].getDBinary();\r
- i++;\r
- }\r
-\r
- //System.out.println("Created array");\r
- //printMemory(rt);\r
- // System.out.println(" --- Original matrix ---- ");\r
- m = new Matrix(seqmat, count, bs[0].getDBinary().length);\r
- m2 = new Matrix(seqmat2, count, bs2[0].getDBinary().length);\r
-\r
- }\r
-\r
- /**\r
- * Returns the matrix used in PCA calculation\r
- *\r
- * @return java.math.Matrix object\r
- */\r
-\r
- public Matrix getM()\r
- {\r
- return m;\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
- /**\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
- {\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
- }\r
-\r
- return out;\r
- }\r
-\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
- {\r
- out[i] = component(i, n);\r
- }\r
-\r
- return out;\r
- }\r
-\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
- {\r
- out += (symm.value[row][i] * eigenvector.value[i][n]);\r
- }\r
-\r
- return out / eigenvector.d[n];\r
- }\r
-\r
- public String getDetails()\r
- {\r
- return details.toString();\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- */\r
- public void run()\r
- {\r
- Matrix mt = m.transpose();\r
-\r
- details.append(" --- OrigT * Orig ---- \n");\r
- eigenvector = mt.preMultiply(m2);\r
-\r
- PrintStream ps = new PrintStream(System.out)\r
- {\r
- public void print(String x)\r
- {\r
- details.append(x);\r
- }\r
-\r
- public void println()\r
- {\r
- details.append("\n");\r
- }\r
- };\r
-\r
- eigenvector.print(ps);\r
-\r
- symm = eigenvector.copy();\r
-\r
- eigenvector.tred();\r
-\r
- details.append(" ---Tridiag transform matrix ---\n");\r
- details.append(" --- D vector ---\n");\r
- eigenvector.printD(ps);\r
- ps.println();\r
- details.append("--- E vector ---\n");\r
- eigenvector.printE(ps);\r
- ps.println();\r
-\r
- // Now produce the diagonalization matrix\r
- eigenvector.tqli();\r
-\r
- details.append(" --- New diagonalization matrix ---\n");\r
- details.append(" --- Eigenvalues ---\n");\r
- eigenvector.printD(ps);\r
- ps.println();\r
- // taps.println();\r
- // taps.println("Transformed sequences = ");\r
- // Matrix trans = m.preMultiply(eigenvector);\r
- // trans.print(System.out);\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.analysis;
+
+import java.io.*;
+
+import jalview.datamodel.*;
+import jalview.math.*;
+
+/**
+ * Performs Principal Component Analysis on given sequences
+ *
+ * @author $author$
+ * @version $Revision$
+ */
+public class PCA
+ implements Runnable
+{
+ Matrix m;
+ Matrix symm;
+ Matrix m2;
+ double[] eigenvalue;
+ Matrix eigenvector;
+ StringBuffer details = new StringBuffer();
+
+ /**
+ * Creates a new PCA object.
+ *
+ * @param s Set of sequences to perform PCA on
+ */
+ public PCA(String[] s)
+ {
+
+ BinarySequence[] bs = new BinarySequence[s.length];
+ int ii = 0;
+
+ while ( (ii < s.length) && (s[ii] != null))
+ {
+ bs[ii] = new BinarySequence(s[ii]);
+ bs[ii].encode();
+ ii++;
+ }
+
+ BinarySequence[] bs2 = new BinarySequence[s.length];
+ ii = 0;
+
+ while ( (ii < s.length) && (s[ii] != null))
+ {
+ bs2[ii] = new BinarySequence(s[ii]);
+ bs2[ii].blosumEncode();
+ ii++;
+ }
+
+ //System.out.println("Created binary encoding");
+ //printMemory(rt);
+ int count = 0;
+
+ while ( (count < bs.length) && (bs[count] != null))
+ {
+ count++;
+ }
+
+ double[][] seqmat = new double[count][bs[0].getDBinary().length];
+ double[][] seqmat2 = new double[count][bs2[0].getDBinary().length];
+ int i = 0;
+
+ while (i < count)
+ {
+ seqmat[i] = bs[i].getDBinary();
+ seqmat2[i] = bs2[i].getDBinary();
+ i++;
+ }
+
+ //System.out.println("Created array");
+ //printMemory(rt);
+ // System.out.println(" --- Original matrix ---- ");
+ m = new Matrix(seqmat, count, bs[0].getDBinary().length);
+ m2 = new Matrix(seqmat2, count, bs2[0].getDBinary().length);
+
+ }
+
+ /**
+ * Returns the matrix used in PCA calculation
+ *
+ * @return java.math.Matrix object
+ */
+
+ public Matrix getM()
+ {
+ return m;
+ }
+
+ /**
+ * Returns Eigenvalue
+ *
+ * @param i Index of diagonal within matrix
+ *
+ * @return Returns value of diagonal from matrix
+ */
+ public double getEigenvalue(int i)
+ {
+ return eigenvector.d[i];
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param l DOCUMENT ME!
+ * @param n DOCUMENT ME!
+ * @param mm DOCUMENT ME!
+ * @param factor DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public float[][] getComponents(int l, int n, int mm, float factor)
+ {
+ float[][] out = new float[m.rows][3];
+
+ for (int i = 0; i < m.rows; i++)
+ {
+ out[i][0] = (float) component(i, l) * factor;
+ out[i][1] = (float) component(i, n) * factor;
+ out[i][2] = (float) component(i, mm) * factor;
+ }
+
+ return out;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param n DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public double[] component(int n)
+ {
+ // n = index of eigenvector
+ double[] out = new double[m.rows];
+
+ for (int i = 0; i < m.rows; i++)
+ {
+ out[i] = component(i, n);
+ }
+
+ return out;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param row DOCUMENT ME!
+ * @param n DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ double component(int row, int n)
+ {
+ double out = 0.0;
+
+ for (int i = 0; i < symm.cols; i++)
+ {
+ out += (symm.value[row][i] * eigenvector.value[i][n]);
+ }
+
+ return out / eigenvector.d[n];
+ }
+
+ public String getDetails()
+ {
+ return details.toString();
+ }
+
+ /**
+ * DOCUMENT ME!
+ */
+ public void run()
+ {
+ Matrix mt = m.transpose();
+
+ details.append(" --- OrigT * Orig ---- \n");
+ eigenvector = mt.preMultiply(m2);
+
+ PrintStream ps = new PrintStream(System.out)
+ {
+ public void print(String x)
+ {
+ details.append(x);
+ }
+
+ public void println()
+ {
+ details.append("\n");
+ }
+ };
+
+ eigenvector.print(ps);
+
+ symm = eigenvector.copy();
+
+ eigenvector.tred();
+
+ details.append(" ---Tridiag transform matrix ---\n");
+ details.append(" --- D vector ---\n");
+ eigenvector.printD(ps);
+ ps.println();
+ details.append("--- E vector ---\n");
+ eigenvector.printE(ps);
+ ps.println();
+
+ // Now produce the diagonalization matrix
+ eigenvector.tqli();
+
+ details.append(" --- New diagonalization matrix ---\n");
+ details.append(" --- Eigenvalues ---\n");
+ eigenvector.printD(ps);
+ ps.println();
+ // taps.println();
+ // taps.println("Transformed sequences = ");
+ // Matrix trans = m.preMultiply(eigenvector);
+ // trans.print(System.out);
+ }
+}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.analysis;
import com.stevesoft.pat.Regex;
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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 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\r
- * string containment (on word boundaries) rather than equivalence. It also\r
- * attempts to resolve ties where no exact match is available by picking the\r
- * the id closest to the query.\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
-{\r
- private Hashtable names;\r
-\r
- public SequenceIdMatcher(SequenceI[] seqs)\r
- {\r
- names = new Hashtable();\r
- for (int i = 0; i < seqs.length; i++)\r
- {\r
- names.put(new SeqIdName(seqs[i].getName()), seqs[i]);\r
- }\r
- }\r
-\r
- /**\r
- * returns the closest SequenceI in matches to SeqIdName and returns all the matches\r
- * to the names hash.\r
- * @param candName SeqIdName\r
- * @param matches Vector of SequenceI objects\r
- * @return SequenceI closest SequenceI to SeqIdName\r
- */\r
- private SequenceI pickbestMatch(SeqIdName candName, Vector matches)\r
- {\r
- SequenceI match = null;\r
- if (candName == null || matches == null || matches.size() == 0)\r
- {\r
- return null;\r
- }\r
- match = (SequenceI) matches.elementAt(0);\r
- matches.removeElementAt(0);\r
- names.put(new SeqIdName(match.getName()), match);\r
- int matchlen = match.getName().length();\r
- int namlen = candName.id.length();\r
- while (matches.size() > 0)\r
- {\r
- // look through for a better one.\r
- SequenceI cand = (SequenceI) matches.elementAt(0);\r
- names.put(new SeqIdName(cand.getName()), cand);\r
- int candlen = cand.getName().length();\r
- // keep the one with an id 'closer' to the given seqnam string\r
- if (Math.abs(matchlen - namlen) > Math.abs(candlen - namlen) &&\r
- candlen > matchlen)\r
- {\r
- match = cand;\r
- matchlen = candlen;\r
- }\r
- }\r
- return match;\r
- }\r
-\r
- /**\r
- * get SequenceI with closest SequenceI.getName() to seq.getName()\r
- * @param seq SequenceI\r
- * @return SequenceI\r
- */\r
- SequenceI findIdMatch(SequenceI seq)\r
- {\r
- SeqIdName nam = new SeqIdName(seq.getName());\r
- return findIdMatch(nam);\r
- }\r
-\r
- SequenceI findIdMatch(String seqnam)\r
- {\r
- SeqIdName nam = new SeqIdName(seqnam);\r
- return findIdMatch(nam);\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 = null;\r
- int i = 0;\r
- SeqIdName nam;\r
-\r
- if (seqs.length > 0)\r
- {\r
- namedseqs = new SequenceI[seqs.length];\r
- do\r
- {\r
- nam = new SeqIdName(seqs[i].getName());\r
-\r
- if (names.containsKey(nam))\r
- {\r
- namedseqs[i] = findIdMatch(nam);\r
- }\r
- else\r
- {\r
- namedseqs[i] = null;\r
- }\r
- }\r
- while (++i < seqs.length);\r
- }\r
-\r
- return namedseqs;\r
- }\r
-\r
- /**\r
- * core findIdMatch search method\r
- * @param nam SeqIdName\r
- * @return SequenceI\r
- */\r
- private SequenceI findIdMatch(jalview.analysis.SequenceIdMatcher.SeqIdName\r
- nam)\r
- {\r
- Vector matches = new Vector();\r
- while (names.containsKey(nam))\r
- {\r
- matches.addElement(names.remove(nam));\r
- }\r
- return pickbestMatch(nam, matches);\r
- }\r
-\r
- private class SeqIdName\r
- {\r
- String id;\r
-\r
- SeqIdName(String s)\r
- {\r
- if (s != null)\r
- {\r
- id = new String(s);\r
- }\r
- else\r
- {\r
- id = "";\r
- }\r
- }\r
-\r
- public int hashCode()\r
- {\r
- return ( (id.length() >= 4) ? id.substring(0, 4).hashCode() : id.hashCode());\r
- }\r
-\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
- return false;\r
- }\r
-\r
- /**\r
- * Characters that define the end of a unique sequence ID at\r
- * the beginning of an arbitrary ID string\r
- * JBPNote: This is a heuristic that will fail for arbritrarily extended sequence id's\r
- * (like portions of an aligned set of repeats from one sequence)\r
- */\r
- private String WORD_SEP = "~. |#\\/<>!\"£$%^*)}[@',?_";\r
-\r
- /**\r
- * matches if one ID properly contains another at a whitespace boundary.\r
- * TODO: (JBPNote) These are not efficient. should use char[] for speed\r
- * todo: (JBPNote) Set separator characters appropriately\r
- * @param s SeqIdName\r
- * @return boolean\r
- */\r
- public boolean equals(SeqIdName s)\r
- {\r
- if (id.length() > s.id.length())\r
- {\r
- return id.startsWith(s.id) ?\r
- (WORD_SEP.indexOf(id.charAt(s.id.length())) > -1)\r
- : false;\r
- }\r
- else\r
- {\r
- return s.id.startsWith(id) ?\r
- (s.id.equals(id) ? true :\r
- (WORD_SEP.indexOf(s.id.charAt(id.length())) > -1))\r
- : false;\r
- }\r
- }\r
-\r
- public boolean equals(String s)\r
- {\r
- if (id.length() > s.length())\r
- {\r
- return id.startsWith(s) ?\r
- (WORD_SEP.indexOf(id.charAt(s.length())) > -1)\r
- : false;\r
- }\r
- else\r
- {\r
- return s.startsWith(id) ?\r
- (s.equals(id) ? true :\r
- (WORD_SEP.indexOf(s.charAt(id.length())) > -1))\r
- : false;\r
- }\r
- }\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.analysis;
+
+import java.util.*;
+
+import jalview.datamodel.*;
+
+/**
+ * <p>Title: </p>
+ * SequenceIdMatcher
+ * <p>Description: </p>
+ * Routine which does approximate Sequence Id resolution by name using
+ * string containment (on word boundaries) rather than equivalence. It also
+ * attempts to resolve ties where no exact match is available by picking the
+ * the id closest to the query.
+ * <p>Copyright: Copyright (c) 2004</p>
+ *
+ * <p>Company: Dundee University</p>
+ *
+ * @author not attributable
+ * @version 1.0
+ */
+public class SequenceIdMatcher
+{
+ private Hashtable names;
+
+ public SequenceIdMatcher(SequenceI[] seqs)
+ {
+ names = new Hashtable();
+ for (int i = 0; i < seqs.length; i++)
+ {
+ names.put(new SeqIdName(seqs[i].getName()), seqs[i]);
+ }
+ }
+
+ /**
+ * returns the closest SequenceI in matches to SeqIdName and returns all the matches
+ * to the names hash.
+ * @param candName SeqIdName
+ * @param matches Vector of SequenceI objects
+ * @return SequenceI closest SequenceI to SeqIdName
+ */
+ private SequenceI pickbestMatch(SeqIdName candName, Vector matches)
+ {
+ SequenceI match = null;
+ if (candName == null || matches == null || matches.size() == 0)
+ {
+ return null;
+ }
+ match = (SequenceI) matches.elementAt(0);
+ matches.removeElementAt(0);
+ names.put(new SeqIdName(match.getName()), match);
+ int matchlen = match.getName().length();
+ int namlen = candName.id.length();
+ while (matches.size() > 0)
+ {
+ // look through for a better one.
+ SequenceI cand = (SequenceI) matches.elementAt(0);
+ names.put(new SeqIdName(cand.getName()), cand);
+ int candlen = cand.getName().length();
+ // keep the one with an id 'closer' to the given seqnam string
+ if (Math.abs(matchlen - namlen) > Math.abs(candlen - namlen) &&
+ candlen > matchlen)
+ {
+ match = cand;
+ matchlen = candlen;
+ }
+ }
+ return match;
+ }
+
+ /**
+ * get SequenceI with closest SequenceI.getName() to seq.getName()
+ * @param seq SequenceI
+ * @return SequenceI
+ */
+ SequenceI findIdMatch(SequenceI seq)
+ {
+ SeqIdName nam = new SeqIdName(seq.getName());
+ return findIdMatch(nam);
+ }
+
+ SequenceI findIdMatch(String seqnam)
+ {
+ SeqIdName nam = new SeqIdName(seqnam);
+ return findIdMatch(nam);
+ }
+
+ /**
+ * 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[]
+ */
+ SequenceI[] findIdMatch(SequenceI[] seqs)
+ {
+ SequenceI[] namedseqs = null;
+ int i = 0;
+ SeqIdName nam;
+
+ if (seqs.length > 0)
+ {
+ namedseqs = new SequenceI[seqs.length];
+ do
+ {
+ nam = new SeqIdName(seqs[i].getName());
+
+ if (names.containsKey(nam))
+ {
+ namedseqs[i] = findIdMatch(nam);
+ }
+ else
+ {
+ namedseqs[i] = null;
+ }
+ }
+ while (++i < seqs.length);
+ }
+
+ return namedseqs;
+ }
+
+ /**
+ * core findIdMatch search method
+ * @param nam SeqIdName
+ * @return SequenceI
+ */
+ private SequenceI findIdMatch(jalview.analysis.SequenceIdMatcher.SeqIdName
+ nam)
+ {
+ Vector matches = new Vector();
+ while (names.containsKey(nam))
+ {
+ matches.addElement(names.remove(nam));
+ }
+ return pickbestMatch(nam, matches);
+ }
+
+ private class SeqIdName
+ {
+ String id;
+
+ SeqIdName(String s)
+ {
+ if (s != null)
+ {
+ id = new String(s);
+ }
+ else
+ {
+ id = "";
+ }
+ }
+
+ public int hashCode()
+ {
+ return ( (id.length() >= 4) ? id.substring(0, 4).hashCode() : id.hashCode());
+ }
+
+ public boolean equals(Object s)
+ {
+ if (s instanceof SeqIdName)
+ {
+ return this.equals( (SeqIdName) s);
+ }
+ else
+ {
+ if (s instanceof String)
+ {
+ return this.equals( (String) s);
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Characters that define the end of a unique sequence ID at
+ * the beginning of an arbitrary ID string
+ * JBPNote: This is a heuristic that will fail for arbritrarily extended sequence id's
+ * (like portions of an aligned set of repeats from one sequence)
+ */
+ private String WORD_SEP = "~. |#\\/<>!\"£$%^*)}[@',?_";
+
+ /**
+ * matches if one ID properly contains another at a whitespace boundary.
+ * TODO: (JBPNote) These are not efficient. should use char[] for speed
+ * todo: (JBPNote) Set separator characters appropriately
+ * @param s SeqIdName
+ * @return boolean
+ */
+ public boolean equals(SeqIdName s)
+ {
+ if (id.length() > s.id.length())
+ {
+ return id.startsWith(s.id) ?
+ (WORD_SEP.indexOf(id.charAt(s.id.length())) > -1)
+ : false;
+ }
+ else
+ {
+ return s.id.startsWith(id) ?
+ (s.id.equals(id) ? true :
+ (WORD_SEP.indexOf(s.id.charAt(id.length())) > -1))
+ : false;
+ }
+ }
+
+ public boolean equals(String s)
+ {
+ if (id.length() > s.length())
+ {
+ return id.startsWith(s) ?
+ (WORD_SEP.indexOf(id.charAt(s.length())) > -1)
+ : false;
+ }
+ else
+ {
+ return s.startsWith(id) ?
+ (s.equals(id) ? true :
+ (WORD_SEP.indexOf(s.charAt(id.length())) > -1))
+ : false;
+ }
+ }
+ }
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.appletgui;
import java.util.*;
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.appletgui;
import java.io.*;
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.appletgui;
import java.util.*;
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.appletgui;
import java.awt.*;
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.appletgui;
import java.util.*;
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.appletgui;
import java.util.*;
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.appletgui;
import java.util.*;
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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
-package jalview.appletgui;\r
-\r
-import java.awt.*;\r
-import java.awt.event.*;\r
-\r
-import jalview.datamodel.*;\r
-import jalview.io.*;\r
-\r
-public class CutAndPasteTransfer\r
- extends Panel implements ActionListener, MouseListener\r
-{\r
- boolean pdbImport = false;\r
- boolean treeImport = false;\r
- boolean annotationImport = false;\r
- Sequence seq;\r
- AlignFrame alignFrame;\r
-\r
- public CutAndPasteTransfer(boolean forImport, AlignFrame alignFrame)\r
- {\r
- try\r
- {\r
- jbInit();\r
- }\r
- catch (Exception e)\r
- {\r
- e.printStackTrace();\r
- }\r
-\r
- this.alignFrame = alignFrame;\r
-\r
- if (!forImport)\r
- {\r
- buttonPanel.setVisible(false);\r
- }\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 setPDBImport(Sequence seq)\r
- {\r
- this.seq = seq;\r
- accept.setLabel("Accept");\r
- addSequences.setVisible(false);\r
- pdbImport = true;\r
- }\r
-\r
- public void setTreeImport()\r
- {\r
- treeImport = true;\r
- accept.setLabel("Accept");\r
- addSequences.setVisible(false);\r
- }\r
-\r
- public void setAnnotationImport()\r
- {\r
- annotationImport = true;\r
- accept.setLabel("Accept");\r
- addSequences.setVisible(false);\r
- }\r
-\r
- public void actionPerformed(ActionEvent evt)\r
- {\r
- if (evt.getSource() == accept)\r
- {\r
- ok(true);\r
- }\r
- else if (evt.getSource() == addSequences)\r
- {\r
- ok(false);\r
- }\r
- else if (evt.getSource() == cancel)\r
- {\r
- cancel();\r
- }\r
- }\r
-\r
- protected void ok(boolean newWindow)\r
- {\r
- String text = getText();\r
- int length = text.length();\r
- textarea.append("\n");\r
- if (textarea.getText().length() == length)\r
- {\r
- String warning =\r
- "\n\n#################################################\n"\r
- + "WARNING!! THIS IS THE MAXIMUM SIZE OF TEXTAREA!!\n"\r
- + "\nCAN'T INPUT FULL ALIGNMENT"\r
- + "\n\nYOU MUST DELETE THIS WARNING TO CONTINUE"\r
- + "\n\nMAKE SURE LAST SEQUENCE PASTED IS COMPLETE"\r
- + "\n#################################################\n";\r
- textarea.setText(text.substring(0, text.length() - warning.length())\r
- + warning);\r
-\r
- textarea.setCaretPosition(text.length());\r
- }\r
-\r
- if (pdbImport)\r
- {\r
- PDBEntry pdb = new PDBEntry();\r
- pdb.setFile(text);\r
-\r
- if ( alignFrame.alignPanel.av.applet.jmolAvailable )\r
- new jalview.appletgui.AppletJmol(pdb,\r
- new Sequence[]{seq},\r
- null,\r
- alignFrame.alignPanel,\r
- AppletFormatAdapter.PASTE);\r
- else\r
-\r
- new MCview.AppletPDBViewer(pdb,\r
- new Sequence[]{seq},\r
- null,\r
- alignFrame.alignPanel,\r
- AppletFormatAdapter.PASTE);\r
-\r
- }\r
- else if (treeImport)\r
- {\r
- try\r
- {\r
- jalview.io.NewickFile fin = new jalview.io.NewickFile(textarea.getText(),\r
- "Paste");\r
-\r
- fin.parse();\r
- if (fin.getTree() != null)\r
- {\r
- alignFrame.loadTree(fin, "Pasted tree file");\r
- }\r
-\r
- }\r
- catch (Exception ex)\r
- {\r
- textarea.setText("Could not parse Newick file!\n" + ex);\r
- return;\r
- }\r
- }\r
- else if (annotationImport)\r
- {\r
- if (new AnnotationFile().readAnnotationFile(\r
- alignFrame.viewport.alignment, textarea.getText(),\r
- jalview.io.AppletFormatAdapter.PASTE))\r
- {\r
- alignFrame.alignPanel.fontChanged();\r
- alignFrame.alignPanel.setScrollValues(0, 0);\r
-\r
- }\r
- else\r
- {\r
- alignFrame.parseFeaturesFile(textarea.getText(),\r
- jalview.io.AppletFormatAdapter.PASTE);\r
- }\r
- }\r
- else if (alignFrame != null)\r
- {\r
- Alignment al = null;\r
-\r
- String format = new IdentifyFile().Identify(text,\r
- AppletFormatAdapter.PASTE);\r
- try\r
- {\r
- al = new AppletFormatAdapter().readFile(text, AppletFormatAdapter.PASTE,\r
- format);\r
- }\r
- catch (java.io.IOException ex)\r
- {\r
- ex.printStackTrace();\r
- }\r
-\r
- if (al != null)\r
- {\r
- if (newWindow)\r
- {\r
- AlignFrame af = new AlignFrame(al, alignFrame.viewport.applet,\r
- "Cut & Paste input - " + format,\r
- false);\r
- af.statusBar.setText("Successfully pasted alignment file");\r
- }\r
- else\r
- {\r
- alignFrame.addSequences(al.getSequencesArray());\r
- }\r
- }\r
- }\r
-\r
- if (this.getParent() instanceof Frame)\r
- {\r
- ( (Frame)this.getParent()).setVisible(false);\r
- }\r
- else\r
- {\r
- ( (Dialog)this.getParent()).setVisible(false);\r
- }\r
- }\r
-\r
- protected void cancel()\r
- {\r
- textarea.setText("");\r
- if (this.getParent() instanceof Frame)\r
- {\r
- ( (Frame)this.getParent()).setVisible(false);\r
- }\r
- else\r
- {\r
- ( (Dialog)this.getParent()).setVisible(false);\r
- }\r
- }\r
-\r
- protected TextArea textarea = new TextArea();\r
- Button accept = new Button("New Window");\r
- Button addSequences = new Button("Add to Current Alignment");\r
- Button cancel = new Button("Close");\r
-\r
- protected Panel buttonPanel = new Panel();\r
- BorderLayout borderLayout1 = new BorderLayout();\r
-\r
- private void jbInit()\r
- throws Exception\r
- {\r
- textarea.setFont(new java.awt.Font("Monospaced", Font.PLAIN, 10));\r
- textarea.setText("Paste your alignment file here");\r
- textarea.addMouseListener(this);\r
- this.setLayout(borderLayout1);\r
- accept.addActionListener(this);\r
- addSequences.addActionListener(this);\r
- cancel.addActionListener(this);\r
- this.add(buttonPanel, BorderLayout.SOUTH);\r
- buttonPanel.add(accept, null);\r
- buttonPanel.add(addSequences);\r
- buttonPanel.add(cancel, null);\r
- this.add(textarea, java.awt.BorderLayout.CENTER);\r
- }\r
-\r
- public void mousePressed(MouseEvent evt)\r
- {\r
- if (textarea.getText().startsWith("Paste your"))\r
- {\r
- textarea.setText("");\r
- }\r
- }\r
-\r
- public void mouseReleased(MouseEvent evt)\r
- {}\r
-\r
- public void mouseClicked(MouseEvent evt)\r
- {}\r
-\r
- public void mouseEntered(MouseEvent evt)\r
- {}\r
-\r
- public void mouseExited(MouseEvent evt)\r
- {}\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.appletgui;
+
+import java.awt.*;
+import java.awt.event.*;
+
+import jalview.datamodel.*;
+import jalview.io.*;
+
+public class CutAndPasteTransfer
+ extends Panel implements ActionListener, MouseListener
+{
+ boolean pdbImport = false;
+ boolean treeImport = false;
+ boolean annotationImport = false;
+ Sequence seq;
+ AlignFrame alignFrame;
+
+ public CutAndPasteTransfer(boolean forImport, AlignFrame alignFrame)
+ {
+ try
+ {
+ jbInit();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+
+ this.alignFrame = alignFrame;
+
+ if (!forImport)
+ {
+ buttonPanel.setVisible(false);
+ }
+ }
+
+ public String getText()
+ {
+ return textarea.getText();
+ }
+
+ public void setText(String text)
+ {
+ textarea.setText(text);
+ }
+
+ public void setPDBImport(Sequence seq)
+ {
+ this.seq = seq;
+ accept.setLabel("Accept");
+ addSequences.setVisible(false);
+ pdbImport = true;
+ }
+
+ public void setTreeImport()
+ {
+ treeImport = true;
+ accept.setLabel("Accept");
+ addSequences.setVisible(false);
+ }
+
+ public void setAnnotationImport()
+ {
+ annotationImport = true;
+ accept.setLabel("Accept");
+ addSequences.setVisible(false);
+ }
+
+ public void actionPerformed(ActionEvent evt)
+ {
+ if (evt.getSource() == accept)
+ {
+ ok(true);
+ }
+ else if (evt.getSource() == addSequences)
+ {
+ ok(false);
+ }
+ else if (evt.getSource() == cancel)
+ {
+ cancel();
+ }
+ }
+
+ protected void ok(boolean newWindow)
+ {
+ String text = getText();
+ int length = text.length();
+ textarea.append("\n");
+ if (textarea.getText().length() == length)
+ {
+ String warning =
+ "\n\n#################################################\n"
+ + "WARNING!! THIS IS THE MAXIMUM SIZE OF TEXTAREA!!\n"
+ + "\nCAN'T INPUT FULL ALIGNMENT"
+ + "\n\nYOU MUST DELETE THIS WARNING TO CONTINUE"
+ + "\n\nMAKE SURE LAST SEQUENCE PASTED IS COMPLETE"
+ + "\n#################################################\n";
+ textarea.setText(text.substring(0, text.length() - warning.length())
+ + warning);
+
+ textarea.setCaretPosition(text.length());
+ }
+
+ if (pdbImport)
+ {
+ PDBEntry pdb = new PDBEntry();
+ pdb.setFile(text);
+
+ if ( alignFrame.alignPanel.av.applet.jmolAvailable )
+ new jalview.appletgui.AppletJmol(pdb,
+ new Sequence[]{seq},
+ null,
+ alignFrame.alignPanel,
+ AppletFormatAdapter.PASTE);
+ else
+
+ new MCview.AppletPDBViewer(pdb,
+ new Sequence[]{seq},
+ null,
+ alignFrame.alignPanel,
+ AppletFormatAdapter.PASTE);
+
+ }
+ else if (treeImport)
+ {
+ try
+ {
+ jalview.io.NewickFile fin = new jalview.io.NewickFile(textarea.getText(),
+ "Paste");
+
+ fin.parse();
+ if (fin.getTree() != null)
+ {
+ alignFrame.loadTree(fin, "Pasted tree file");
+ }
+
+ }
+ catch (Exception ex)
+ {
+ textarea.setText("Could not parse Newick file!\n" + ex);
+ return;
+ }
+ }
+ else if (annotationImport)
+ {
+ if (new AnnotationFile().readAnnotationFile(
+ alignFrame.viewport.alignment, textarea.getText(),
+ jalview.io.AppletFormatAdapter.PASTE))
+ {
+ alignFrame.alignPanel.fontChanged();
+ alignFrame.alignPanel.setScrollValues(0, 0);
+
+ }
+ else
+ {
+ alignFrame.parseFeaturesFile(textarea.getText(),
+ jalview.io.AppletFormatAdapter.PASTE);
+ }
+ }
+ else if (alignFrame != null)
+ {
+ Alignment al = null;
+
+ String format = new IdentifyFile().Identify(text,
+ AppletFormatAdapter.PASTE);
+ try
+ {
+ al = new AppletFormatAdapter().readFile(text, AppletFormatAdapter.PASTE,
+ format);
+ }
+ catch (java.io.IOException ex)
+ {
+ ex.printStackTrace();
+ }
+
+ if (al != null)
+ {
+ if (newWindow)
+ {
+ AlignFrame af = new AlignFrame(al, alignFrame.viewport.applet,
+ "Cut & Paste input - " + format,
+ false);
+ af.statusBar.setText("Successfully pasted alignment file");
+ }
+ else
+ {
+ alignFrame.addSequences(al.getSequencesArray());
+ }
+ }
+ }
+
+ if (this.getParent() instanceof Frame)
+ {
+ ( (Frame)this.getParent()).setVisible(false);
+ }
+ else
+ {
+ ( (Dialog)this.getParent()).setVisible(false);
+ }
+ }
+
+ protected void cancel()
+ {
+ textarea.setText("");
+ if (this.getParent() instanceof Frame)
+ {
+ ( (Frame)this.getParent()).setVisible(false);
+ }
+ else
+ {
+ ( (Dialog)this.getParent()).setVisible(false);
+ }
+ }
+
+ protected TextArea textarea = new TextArea();
+ Button accept = new Button("New Window");
+ Button addSequences = new Button("Add to Current Alignment");
+ Button cancel = new Button("Close");
+
+ protected Panel buttonPanel = new Panel();
+ BorderLayout borderLayout1 = new BorderLayout();
+
+ private void jbInit()
+ throws Exception
+ {
+ textarea.setFont(new java.awt.Font("Monospaced", Font.PLAIN, 10));
+ textarea.setText("Paste your alignment file here");
+ textarea.addMouseListener(this);
+ this.setLayout(borderLayout1);
+ accept.addActionListener(this);
+ addSequences.addActionListener(this);
+ cancel.addActionListener(this);
+ this.add(buttonPanel, BorderLayout.SOUTH);
+ buttonPanel.add(accept, null);
+ buttonPanel.add(addSequences);
+ buttonPanel.add(cancel, null);
+ this.add(textarea, java.awt.BorderLayout.CENTER);
+ }
+
+ public void mousePressed(MouseEvent evt)
+ {
+ if (textarea.getText().startsWith("Paste your"))
+ {
+ textarea.setText("");
+ }
+ }
+
+ public void mouseReleased(MouseEvent evt)
+ {}
+
+ public void mouseClicked(MouseEvent evt)
+ {}
+
+ public void mouseEntered(MouseEvent evt)
+ {}
+
+ public void mouseExited(MouseEvent evt)
+ {}
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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
-package jalview.appletgui;\r
-\r
-import java.awt.*;\r
-\r
-\r
-public class EditNameDialog extends JVDialog\r
-{\r
- TextField id, description;\r
-\r
- public String getName()\r
- {\r
- return id.getText();\r
- }\r
-\r
- public String getDescription()\r
- {\r
- if (description.getText().length() < 1)\r
- {\r
- return null;\r
- }\r
- else\r
- {\r
- return description.getText();\r
- }\r
- }\r
-\r
- public EditNameDialog(String name,\r
- String desc,\r
- String label1,\r
- String label2,\r
- Frame owner,\r
- String title,\r
- int width, int height, boolean display)\r
- {\r
- super(owner, title, true, width, height);\r
-\r
- Font mono = new Font("Monospaced", Font.PLAIN, 12);\r
- Panel panel = new Panel(new BorderLayout());\r
- Panel panel2 = new Panel(new BorderLayout());\r
-\r
- id = new TextField(name, 40);\r
- id.setFont(mono);\r
- Label label = new Label(label1);\r
- label.setFont(mono);\r
-\r
- panel2.add(label, BorderLayout.WEST);\r
- panel2.add(id, BorderLayout.CENTER);\r
- panel.add(panel2, BorderLayout.NORTH);\r
-\r
-\r
- if(label2!=null)\r
- {\r
- panel2 = new Panel(new BorderLayout());\r
- description = new TextField(desc, 40);\r
- description.setFont(mono);\r
- label = new Label(label2);\r
- label.setFont(mono);\r
- panel2.add(label, BorderLayout.WEST);\r
- panel2.add(description, BorderLayout.CENTER);\r
- panel.add(panel2, BorderLayout.CENTER);\r
- }\r
- setMainPanel(panel);\r
- setVisible(display);\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.appletgui;
+
+import java.awt.*;
+
+
+public class EditNameDialog extends JVDialog
+{
+ TextField id, description;
+
+ public String getName()
+ {
+ return id.getText();
+ }
+
+ public String getDescription()
+ {
+ if (description.getText().length() < 1)
+ {
+ return null;
+ }
+ else
+ {
+ return description.getText();
+ }
+ }
+
+ public EditNameDialog(String name,
+ String desc,
+ String label1,
+ String label2,
+ Frame owner,
+ String title,
+ int width, int height, boolean display)
+ {
+ super(owner, title, true, width, height);
+
+ Font mono = new Font("Monospaced", Font.PLAIN, 12);
+ Panel panel = new Panel(new BorderLayout());
+ Panel panel2 = new Panel(new BorderLayout());
+
+ id = new TextField(name, 40);
+ id.setFont(mono);
+ Label label = new Label(label1);
+ label.setFont(mono);
+
+ panel2.add(label, BorderLayout.WEST);
+ panel2.add(id, BorderLayout.CENTER);
+ panel.add(panel2, BorderLayout.NORTH);
+
+
+ if(label2!=null)
+ {
+ panel2 = new Panel(new BorderLayout());
+ description = new TextField(desc, 40);
+ description.setFont(mono);
+ label = new Label(label2);
+ label.setFont(mono);
+ panel2.add(label, BorderLayout.WEST);
+ panel2.add(description, BorderLayout.CENTER);
+ panel.add(panel2, BorderLayout.CENTER);
+ }
+ setMainPanel(panel);
+ setVisible(display);
+ }
+}
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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.appletgui;\r
\r
import java.awt.BorderLayout;\r
embeddedMenu=null;\r
super.finalize();\r
}\r
-}
\ No newline at end of file
+}\r
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.appletgui;
import java.util.*;
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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
-package jalview.appletgui;\r
-\r
-import java.awt.*;\r
-import java.awt.event.*;\r
-\r
-public class FontChooser\r
- extends Panel implements ActionListener, ItemListener\r
-{\r
- AlignmentPanel ap;\r
- TreePanel tp;\r
- Font oldFont;\r
- boolean init = true;\r
- Frame frame;\r
-\r
- public FontChooser(TreePanel tp)\r
- {\r
- try\r
- {\r
- jbInit();\r
- }\r
- catch (Exception e)\r
- {\r
- e.printStackTrace();\r
- }\r
-\r
- this.tp = tp;\r
- oldFont = tp.getTreeFont();\r
- init();\r
- }\r
-\r
- public FontChooser(AlignmentPanel ap)\r
- {\r
- try\r
- {\r
- jbInit();\r
- }\r
- catch (Exception e)\r
- {\r
- e.printStackTrace();\r
- }\r
-\r
- this.ap = ap;\r
- oldFont = ap.av.getFont();\r
- init();\r
- }\r
-\r
- void init()\r
- {\r
- String fonts[] = Toolkit.getDefaultToolkit().getFontList();\r
- for (int i = 0; i < fonts.length; i++)\r
- {\r
- fontName.addItem(fonts[i]);\r
- }\r
-\r
- for (int i = 1; i < 31; i++)\r
- {\r
- fontSize.addItem(i + "");\r
- }\r
-\r
- fontStyle.addItem("plain");\r
- fontStyle.addItem("bold");\r
- fontStyle.addItem("italic");\r
-\r
- fontName.select(oldFont.getName());\r
- fontSize.select(oldFont.getSize() + "");\r
- fontStyle.select(oldFont.getStyle());\r
-\r
- Frame frame = new Frame();\r
- this.frame = frame;\r
- frame.add(this);\r
- jalview.bin.JalviewLite.addFrame(frame, "Change Font", 440, 115);\r
-\r
- init = false;\r
- }\r
-\r
- public void actionPerformed(ActionEvent evt)\r
- {\r
- if (evt.getSource() == ok)\r
- {\r
- ok_actionPerformed();\r
- }\r
- else if (evt.getSource() == cancel)\r
- {\r
- cancel_actionPerformed();\r
- }\r
- }\r
-\r
- public void itemStateChanged(ItemEvent evt)\r
- {\r
- if (evt.getSource() == fontName)\r
- {\r
- fontName_actionPerformed();\r
- }\r
- else if (evt.getSource() == fontSize)\r
- {\r
- fontSize_actionPerformed();\r
- }\r
- else if (evt.getSource() == fontStyle)\r
- {\r
- fontStyle_actionPerformed();\r
- }\r
- }\r
-\r
- protected void ok_actionPerformed()\r
- {\r
- frame.setVisible(false);\r
- if (ap != null)\r
- {\r
- if (ap.getOverviewPanel() != null)\r
- {\r
- ap.getOverviewPanel().updateOverviewImage();\r
- }\r
- }\r
-\r
- }\r
-\r
- protected void cancel_actionPerformed()\r
- {\r
- if (ap != null)\r
- {\r
- ap.av.setFont(oldFont);\r
- ap.paintAlignment(true);\r
- }\r
- else if (tp != null)\r
- {\r
- tp.setTreeFont(oldFont);\r
- tp.treeCanvas.repaint();\r
- }\r
-\r
- fontName.select(oldFont.getName());\r
- fontSize.select(oldFont.getSize() + "");\r
- fontStyle.select(oldFont.getStyle());\r
-\r
- frame.setVisible(false);\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
- );\r
- if (ap != null)\r
- {\r
- ap.av.setFont(newFont);\r
- ap.fontChanged();\r
- }\r
- else if (tp != null)\r
- {\r
- tp.setTreeFont(newFont);\r
- }\r
- }\r
-\r
- protected void fontName_actionPerformed()\r
- {\r
- if (init)\r
- {\r
- return;\r
- }\r
- changeFont();\r
- }\r
-\r
- protected void fontSize_actionPerformed()\r
- {\r
- if (init)\r
- {\r
- return;\r
- }\r
- changeFont();\r
- }\r
-\r
- protected void fontStyle_actionPerformed()\r
- {\r
- if (init)\r
- {\r
- return;\r
- }\r
- changeFont();\r
- }\r
-\r
- Label label1 = new Label();\r
- protected Choice fontSize = new Choice();\r
- protected Choice fontStyle = new Choice();\r
- Label label2 = new Label();\r
- Label label3 = new Label();\r
- protected Choice fontName = new Choice();\r
- Button ok = new Button();\r
- Button cancel = new Button();\r
- Panel panel1 = new Panel();\r
- Panel panel2 = new Panel();\r
- Panel panel3 = new Panel();\r
- BorderLayout borderLayout1 = new BorderLayout();\r
- BorderLayout borderLayout2 = new BorderLayout();\r
- BorderLayout borderLayout3 = new BorderLayout();\r
- Panel panel4 = new Panel();\r
- Panel panel5 = new Panel();\r
- BorderLayout borderLayout4 = new BorderLayout();\r
-\r
- private void jbInit()\r
- throws Exception\r
- {\r
- label1.setFont(new java.awt.Font("Verdana", 0, 11));\r
- label1.setAlignment(Label.RIGHT);\r
- label1.setText("Font: ");\r
- this.setLayout(borderLayout4);\r
- fontSize.setFont(new java.awt.Font("Verdana", 0, 11));\r
- fontSize.addItemListener(this);\r
- fontStyle.setFont(new java.awt.Font("Verdana", 0, 11));\r
- fontStyle.addItemListener(this);\r
- label2.setAlignment(Label.RIGHT);\r
- label2.setFont(new java.awt.Font("Verdana", 0, 11));\r
- label2.setText("Size: ");\r
- label3.setAlignment(Label.RIGHT);\r
- label3.setFont(new java.awt.Font("Verdana", 0, 11));\r
- label3.setText("Style: ");\r
- fontName.setFont(new java.awt.Font("Verdana", 0, 11));\r
- fontName.addItemListener(this);\r
- ok.setFont(new java.awt.Font("Verdana", 0, 11));\r
- ok.setLabel("OK");\r
- ok.addActionListener(this);\r
- cancel.setFont(new java.awt.Font("Verdana", 0, 11));\r
- cancel.setLabel("Cancel");\r
- cancel.addActionListener(this);\r
- this.setBackground(Color.white);\r
- panel1.setLayout(borderLayout1);\r
- panel2.setLayout(borderLayout3);\r
- panel3.setLayout(borderLayout2);\r
- panel5.setBackground(Color.white);\r
- panel4.setBackground(Color.white);\r
- panel1.setBackground(Color.white);\r
- panel2.setBackground(Color.white);\r
- panel3.setBackground(Color.white);\r
- panel1.add(label1, BorderLayout.WEST);\r
- panel1.add(fontName, BorderLayout.CENTER);\r
- panel5.add(panel1, null);\r
- panel5.add(panel3, null);\r
- panel5.add(panel2, null);\r
- panel2.add(label3, BorderLayout.WEST);\r
- panel2.add(fontStyle, BorderLayout.CENTER);\r
- panel3.add(label2, BorderLayout.WEST);\r
- panel3.add(fontSize, BorderLayout.CENTER);\r
- this.add(panel4, BorderLayout.SOUTH);\r
- panel4.add(ok, null);\r
- panel4.add(cancel, null);\r
- this.add(panel5, BorderLayout.CENTER);\r
- }\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.appletgui;
+
+import java.awt.*;
+import java.awt.event.*;
+
+public class FontChooser
+ extends Panel implements ActionListener, ItemListener
+{
+ AlignmentPanel ap;
+ TreePanel tp;
+ Font oldFont;
+ boolean init = true;
+ Frame frame;
+
+ public FontChooser(TreePanel tp)
+ {
+ try
+ {
+ jbInit();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+
+ this.tp = tp;
+ oldFont = tp.getTreeFont();
+ init();
+ }
+
+ public FontChooser(AlignmentPanel ap)
+ {
+ try
+ {
+ jbInit();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+
+ this.ap = ap;
+ oldFont = ap.av.getFont();
+ init();
+ }
+
+ void init()
+ {
+ String fonts[] = Toolkit.getDefaultToolkit().getFontList();
+ for (int i = 0; i < fonts.length; i++)
+ {
+ fontName.addItem(fonts[i]);
+ }
+
+ for (int i = 1; i < 31; i++)
+ {
+ fontSize.addItem(i + "");
+ }
+
+ fontStyle.addItem("plain");
+ fontStyle.addItem("bold");
+ fontStyle.addItem("italic");
+
+ fontName.select(oldFont.getName());
+ fontSize.select(oldFont.getSize() + "");
+ fontStyle.select(oldFont.getStyle());
+
+ Frame frame = new Frame();
+ this.frame = frame;
+ frame.add(this);
+ jalview.bin.JalviewLite.addFrame(frame, "Change Font", 440, 115);
+
+ init = false;
+ }
+
+ public void actionPerformed(ActionEvent evt)
+ {
+ if (evt.getSource() == ok)
+ {
+ ok_actionPerformed();
+ }
+ else if (evt.getSource() == cancel)
+ {
+ cancel_actionPerformed();
+ }
+ }
+
+ public void itemStateChanged(ItemEvent evt)
+ {
+ if (evt.getSource() == fontName)
+ {
+ fontName_actionPerformed();
+ }
+ else if (evt.getSource() == fontSize)
+ {
+ fontSize_actionPerformed();
+ }
+ else if (evt.getSource() == fontStyle)
+ {
+ fontStyle_actionPerformed();
+ }
+ }
+
+ protected void ok_actionPerformed()
+ {
+ frame.setVisible(false);
+ if (ap != null)
+ {
+ if (ap.getOverviewPanel() != null)
+ {
+ ap.getOverviewPanel().updateOverviewImage();
+ }
+ }
+
+ }
+
+ protected void cancel_actionPerformed()
+ {
+ if (ap != null)
+ {
+ ap.av.setFont(oldFont);
+ ap.paintAlignment(true);
+ }
+ else if (tp != null)
+ {
+ tp.setTreeFont(oldFont);
+ tp.treeCanvas.repaint();
+ }
+
+ fontName.select(oldFont.getName());
+ fontSize.select(oldFont.getSize() + "");
+ fontStyle.select(oldFont.getStyle());
+
+ frame.setVisible(false);
+ }
+
+ void changeFont()
+ {
+ Font newFont = new Font(fontName.getSelectedItem().toString(),
+ fontStyle.getSelectedIndex(),
+ Integer.parseInt(fontSize.getSelectedItem().
+ toString())
+ );
+ if (ap != null)
+ {
+ ap.av.setFont(newFont);
+ ap.fontChanged();
+ }
+ else if (tp != null)
+ {
+ tp.setTreeFont(newFont);
+ }
+ }
+
+ protected void fontName_actionPerformed()
+ {
+ if (init)
+ {
+ return;
+ }
+ changeFont();
+ }
+
+ protected void fontSize_actionPerformed()
+ {
+ if (init)
+ {
+ return;
+ }
+ changeFont();
+ }
+
+ protected void fontStyle_actionPerformed()
+ {
+ if (init)
+ {
+ return;
+ }
+ changeFont();
+ }
+
+ Label label1 = new Label();
+ protected Choice fontSize = new Choice();
+ protected Choice fontStyle = new Choice();
+ Label label2 = new Label();
+ Label label3 = new Label();
+ protected Choice fontName = new Choice();
+ Button ok = new Button();
+ Button cancel = new Button();
+ Panel panel1 = new Panel();
+ Panel panel2 = new Panel();
+ Panel panel3 = new Panel();
+ BorderLayout borderLayout1 = new BorderLayout();
+ BorderLayout borderLayout2 = new BorderLayout();
+ BorderLayout borderLayout3 = new BorderLayout();
+ Panel panel4 = new Panel();
+ Panel panel5 = new Panel();
+ BorderLayout borderLayout4 = new BorderLayout();
+
+ private void jbInit()
+ throws Exception
+ {
+ label1.setFont(new java.awt.Font("Verdana", 0, 11));
+ label1.setAlignment(Label.RIGHT);
+ label1.setText("Font: ");
+ this.setLayout(borderLayout4);
+ fontSize.setFont(new java.awt.Font("Verdana", 0, 11));
+ fontSize.addItemListener(this);
+ fontStyle.setFont(new java.awt.Font("Verdana", 0, 11));
+ fontStyle.addItemListener(this);
+ label2.setAlignment(Label.RIGHT);
+ label2.setFont(new java.awt.Font("Verdana", 0, 11));
+ label2.setText("Size: ");
+ label3.setAlignment(Label.RIGHT);
+ label3.setFont(new java.awt.Font("Verdana", 0, 11));
+ label3.setText("Style: ");
+ fontName.setFont(new java.awt.Font("Verdana", 0, 11));
+ fontName.addItemListener(this);
+ ok.setFont(new java.awt.Font("Verdana", 0, 11));
+ ok.setLabel("OK");
+ ok.addActionListener(this);
+ cancel.setFont(new java.awt.Font("Verdana", 0, 11));
+ cancel.setLabel("Cancel");
+ cancel.addActionListener(this);
+ this.setBackground(Color.white);
+ panel1.setLayout(borderLayout1);
+ panel2.setLayout(borderLayout3);
+ panel3.setLayout(borderLayout2);
+ panel5.setBackground(Color.white);
+ panel4.setBackground(Color.white);
+ panel1.setBackground(Color.white);
+ panel2.setBackground(Color.white);
+ panel3.setBackground(Color.white);
+ panel1.add(label1, BorderLayout.WEST);
+ panel1.add(fontName, BorderLayout.CENTER);
+ panel5.add(panel1, null);
+ panel5.add(panel3, null);
+ panel5.add(panel2, null);
+ panel2.add(label3, BorderLayout.WEST);
+ panel2.add(fontStyle, BorderLayout.CENTER);
+ panel3.add(label2, BorderLayout.WEST);
+ panel3.add(fontSize, BorderLayout.CENTER);
+ this.add(panel4, BorderLayout.SOUTH);
+ panel4.add(ok, null);
+ panel4.add(cancel, null);
+ this.add(panel5, BorderLayout.CENTER);
+ }
+
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.appletgui;
import java.awt.*;
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.appletgui;
import java.awt.*;
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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
-package jalview.appletgui;\r
-\r
-import java.awt.*;\r
-import java.awt.event.*;\r
-\r
-public class IdwidthAdjuster\r
- extends Panel implements MouseListener, MouseMotionListener\r
-{\r
- boolean active = false;\r
- int oldX = 0;\r
- Image image;\r
- AlignmentPanel ap;\r
-\r
- public IdwidthAdjuster(AlignmentPanel ap)\r
- {\r
- setLayout(null);\r
- this.ap = ap;\r
- java.net.URL url = getClass().getResource("/images/idwidth.gif");\r
- if (url != null)\r
- {\r
- image = java.awt.Toolkit.getDefaultToolkit().getImage(url);\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
- Dimension d = ap.idPanel.idCanvas.getSize();\r
- int dif = evt.getX() - oldX;\r
-\r
- if (d.width + dif > 20 || dif > 0)\r
- {\r
- ap.setIdWidth(d.width + dif, d.height);\r
- this.setSize(d.width + dif, getSize().height);\r
- }\r
-\r
- oldX = evt.getX();\r
- }\r
-\r
- public void mouseMoved(MouseEvent evt)\r
- {}\r
-\r
- public void mouseClicked(MouseEvent evt)\r
- {}\r
-\r
- public void paint(Graphics g)\r
- {\r
- g.setColor(Color.white);\r
- g.fillRect(0, 0, getSize().width, getSize().height);\r
- if (active)\r
- {\r
- if (image != null)\r
- {\r
- g.drawImage(image, getSize().width - 20, 2, this);\r
- }\r
- }\r
- }\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.appletgui;
+
+import java.awt.*;
+import java.awt.event.*;
+
+public class IdwidthAdjuster
+ extends Panel implements MouseListener, MouseMotionListener
+{
+ boolean active = false;
+ int oldX = 0;
+ Image image;
+ AlignmentPanel ap;
+
+ public IdwidthAdjuster(AlignmentPanel ap)
+ {
+ setLayout(null);
+ this.ap = ap;
+ java.net.URL url = getClass().getResource("/images/idwidth.gif");
+ if (url != null)
+ {
+ image = java.awt.Toolkit.getDefaultToolkit().getImage(url);
+ }
+
+ addMouseListener(this);
+ addMouseMotionListener(this);
+ }
+
+ public void mousePressed(MouseEvent evt)
+ {
+ oldX = evt.getX();
+ }
+
+ public void mouseReleased(MouseEvent evt)
+ {
+ active = false;
+ repaint();
+ }
+
+ public void mouseEntered(MouseEvent evt)
+ {
+ active = true;
+ repaint();
+ }
+
+ public void mouseExited(MouseEvent evt)
+ {
+ active = false;
+ repaint();
+ }
+
+ public void mouseDragged(MouseEvent evt)
+ {
+ active = true;
+ Dimension d = ap.idPanel.idCanvas.getSize();
+ int dif = evt.getX() - oldX;
+
+ if (d.width + dif > 20 || dif > 0)
+ {
+ ap.setIdWidth(d.width + dif, d.height);
+ this.setSize(d.width + dif, getSize().height);
+ }
+
+ oldX = evt.getX();
+ }
+
+ public void mouseMoved(MouseEvent evt)
+ {}
+
+ public void mouseClicked(MouseEvent evt)
+ {}
+
+ public void paint(Graphics g)
+ {
+ g.setColor(Color.white);
+ g.fillRect(0, 0, getSize().width, getSize().height);
+ if (active)
+ {
+ if (image != null)
+ {
+ g.drawImage(image, getSize().width - 20, 2, this);
+ }
+ }
+ }
+
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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
-package jalview.appletgui;\r
-\r
-import java.awt.*;\r
-import java.awt.event.*;\r
-\r
-public class JVDialog extends Dialog implements ActionListener\r
-{\r
- AlignmentPanel ap;\r
- Panel buttonPanel;\r
- Button ok = new Button("Accept");\r
- Button cancel = new Button("Cancel");\r
- boolean accept = false;\r
- Frame owner;\r
-\r
- public JVDialog(Frame owner,\r
- String title,\r
- boolean modal,\r
- int width, int height)\r
- {\r
- super(owner, title, modal);\r
- this.owner = owner;\r
-\r
- height += owner.getInsets().top + getInsets().bottom;\r
-\r
- setBounds(owner.getBounds().x\r
- + (owner.getSize().width - width) / 2,\r
- owner.getBounds().y\r
- + (owner.getSize().height - height) / 2,\r
- width, height);\r
- }\r
-\r
- void setMainPanel(Panel panel)\r
- {\r
- add(panel, BorderLayout.NORTH);\r
-\r
- buttonPanel = new Panel(new FlowLayout());\r
-\r
- buttonPanel.add(ok);\r
- buttonPanel.add(cancel);\r
- ok.addActionListener(this);\r
- cancel.addActionListener(this);\r
-\r
- add(buttonPanel, BorderLayout.SOUTH);\r
-\r
- pack();\r
-\r
- }\r
-\r
- public void actionPerformed(ActionEvent evt)\r
- {\r
- if (evt.getSource() == ok)\r
- {\r
- accept = true;\r
- }\r
-\r
- setVisible(false);\r
- }\r
-\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.appletgui;
+
+import java.awt.*;
+import java.awt.event.*;
+
+public class JVDialog extends Dialog implements ActionListener
+{
+ AlignmentPanel ap;
+ Panel buttonPanel;
+ Button ok = new Button("Accept");
+ Button cancel = new Button("Cancel");
+ boolean accept = false;
+ Frame owner;
+
+ public JVDialog(Frame owner,
+ String title,
+ boolean modal,
+ int width, int height)
+ {
+ super(owner, title, modal);
+ this.owner = owner;
+
+ height += owner.getInsets().top + getInsets().bottom;
+
+ setBounds(owner.getBounds().x
+ + (owner.getSize().width - width) / 2,
+ owner.getBounds().y
+ + (owner.getSize().height - height) / 2,
+ width, height);
+ }
+
+ void setMainPanel(Panel panel)
+ {
+ add(panel, BorderLayout.NORTH);
+
+ buttonPanel = new Panel(new FlowLayout());
+
+ buttonPanel.add(ok);
+ buttonPanel.add(cancel);
+ ok.addActionListener(this);
+ cancel.addActionListener(this);
+
+ add(buttonPanel, BorderLayout.SOUTH);
+
+ pack();
+
+ }
+
+ public void actionPerformed(ActionEvent evt)
+ {
+ if (evt.getSource() == ok)
+ {
+ accept = true;
+ }
+
+ setVisible(false);
+ }
+
+
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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
-package jalview.appletgui;\r
-\r
-import java.awt.*;\r
-import java.awt.event.*;\r
-\r
-public class OverviewPanel\r
- extends Panel implements Runnable, MouseMotionListener, MouseListener\r
-{\r
- Image miniMe;\r
- Image offscreen;\r
- AlignViewport av;\r
- AlignmentPanel ap;\r
- float scalew = 1f;\r
- float scaleh = 1f;\r
-\r
- public int width, sequencesHeight;\r
- int graphHeight = 20;\r
- int boxX = -1, boxY = -1, boxWidth = -1, boxHeight = -1;\r
-\r
- boolean resizing = false;\r
-\r
- // Can set different properties in this seqCanvas than\r
- // main visible SeqCanvas\r
- SequenceRenderer sr;\r
- FeatureRenderer fr;\r
-\r
- Frame nullFrame;\r
-\r
- public OverviewPanel(AlignmentPanel ap)\r
- {\r
- this.av = ap.av;\r
- this.ap = ap;\r
- setLayout(null);\r
- nullFrame = new Frame();\r
- nullFrame.addNotify();\r
-\r
- sr = new SequenceRenderer(av);\r
- sr.graphics = nullFrame.getGraphics();\r
- sr.renderGaps = false;\r
- sr.forOverview = true;\r
- fr = new FeatureRenderer(av);\r
- fr.overview = true;\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.hconsensus == null)\r
- {\r
- graphHeight = 0;\r
- }\r
-\r
- if (av.alignment.getWidth() > av.alignment.getHeight())\r
- {\r
- // wider\r
- width = 400;\r
- sequencesHeight = (int) (400f / initialScale);\r
- if (sequencesHeight < 40)\r
- {\r
- sequencesHeight = 40;\r
- }\r
- }\r
- else\r
- {\r
- // taller\r
- width = (int) (400f * initialScale);\r
- sequencesHeight = 300;\r
- if (width < 120)\r
- {\r
- width = 120;\r
- }\r
- }\r
-\r
- setSize(new Dimension(width, sequencesHeight + graphHeight));\r
- addComponentListener(new ComponentAdapter()\r
- {\r
-\r
- public void componentResized(ComponentEvent evt)\r
- {\r
- if (getSize().width != width ||\r
- getSize().height != sequencesHeight + graphHeight)\r
- {\r
- updateOverviewImage();\r
- }\r
- }\r
- });\r
-\r
- addMouseMotionListener(this);\r
-\r
- addMouseListener(this);\r
-\r
- updateOverviewImage();\r
-\r
- }\r
-\r
- public void mouseEntered(MouseEvent evt)\r
- {}\r
-\r
- public void mouseExited(MouseEvent evt)\r
- {}\r
-\r
- public void mouseClicked(MouseEvent evt)\r
- {}\r
-\r
- public void mouseMoved(MouseEvent evt)\r
- {}\r
-\r
- public void mousePressed(MouseEvent evt)\r
- {\r
- boxX = evt.getX();\r
- boxY = evt.getY();\r
- checkValid();\r
- }\r
-\r
- public void mouseReleased(MouseEvent evt)\r
- {\r
- boxX = evt.getX();\r
- boxY = evt.getY();\r
- checkValid();\r
- }\r
-\r
- public void mouseDragged(MouseEvent evt)\r
- {\r
- boxX = evt.getX();\r
- boxY = evt.getY();\r
- checkValid();\r
- }\r
-\r
- void checkValid()\r
- {\r
- if (boxY < 0)\r
- {\r
- boxY = 0;\r
- }\r
-\r
- if (boxY > (sequencesHeight - boxHeight))\r
- {\r
- boxY = sequencesHeight - boxHeight + 1;\r
- }\r
-\r
- if (boxX < 0)\r
- {\r
- boxX = 0;\r
- }\r
-\r
- if (boxX > (width - boxWidth))\r
- {\r
- if (av.hasHiddenColumns)\r
- {\r
- //Try smallest possible box\r
- boxWidth = (int) ( (av.endRes - av.startRes + 1) *\r
- av.getCharWidth() * scalew);\r
- }\r
- boxX = width - boxWidth;\r
- }\r
-\r
- int col = (int) (boxX / scalew / av.getCharWidth());\r
- int row = (int) (boxY / scaleh / av.getCharHeight());\r
-\r
- if (av.hasHiddenColumns)\r
- {\r
- if (!av.getColumnSelection().isVisible(col))\r
- {\r
- return;\r
- }\r
-\r
- col = av.getColumnSelection().findColumnPosition(col);\r
- }\r
-\r
- if (av.hasHiddenRows)\r
- {\r
- row = av.alignment.getHiddenSequences().findIndexWithoutHiddenSeqs(row);\r
- }\r
-\r
- ap.setScrollValues(col, row);\r
- ap.paintAlignment(false);\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- */\r
- public void updateOverviewImage()\r
- {\r
- if (resizing)\r
- {\r
- resizeAgain = true;\r
- return;\r
- }\r
-\r
- if (av.showSequenceFeatures)\r
- {\r
- fr.featureGroups = ap.seqPanel.seqCanvas.getFeatureRenderer().\r
- featureGroups;\r
- fr.featureColours = ap.seqPanel.seqCanvas.getFeatureRenderer().\r
- featureColours;\r
- }\r
-\r
- resizing = true;\r
-\r
- if ( (getSize().width > 0) && (getSize().height > 0))\r
- {\r
- width = getSize().width;\r
- sequencesHeight = getSize().height - graphHeight;\r
- }\r
- setSize(new Dimension(width, sequencesHeight + graphHeight));\r
-\r
- Thread thread = new Thread(this);\r
- thread.start();\r
- repaint();\r
- }\r
-\r
- // This is set true if the user resizes whilst\r
- // the overview is being calculated\r
- boolean resizeAgain = false;\r
-\r
- public void run()\r
- {\r
- miniMe = null;\r
- int alwidth = av.alignment.getWidth();\r
- int alheight = av.alignment.getHeight();\r
-\r
- if (av.showSequenceFeatures)\r
- {\r
- fr.transferSettings(ap.seqPanel.seqCanvas.getFeatureRenderer());\r
- }\r
-\r
- if (getSize().width > 0 && getSize().height > 0)\r
- {\r
- width = getSize().width;\r
- sequencesHeight = getSize().height - graphHeight;\r
- }\r
-\r
- setSize(new Dimension(width, sequencesHeight + graphHeight));\r
-\r
- int fullsizeWidth = alwidth * av.getCharWidth();\r
- int fullsizeHeight = alheight * av.getCharHeight();\r
-\r
- scalew = (float) width / (float) fullsizeWidth;\r
- scaleh = (float) sequencesHeight / (float) fullsizeHeight;\r
-\r
- miniMe = nullFrame.createImage(width, sequencesHeight + graphHeight);\r
- offscreen = nullFrame.createImage(width, sequencesHeight + graphHeight);\r
-\r
- Graphics mg = miniMe.getGraphics();\r
- float sampleCol = (float) alwidth / (float) width;\r
- float sampleRow = (float) alheight / (float) sequencesHeight;\r
-\r
- int lastcol = 0, lastrow = 0;\r
- int xstart = 0, ystart = 0;\r
- Color color = Color.yellow;\r
- int row, col, sameRow = 0, sameCol = 0;\r
- jalview.datamodel.SequenceI seq;\r
- boolean hiddenRow = false;\r
- for (row = 0; row <= sequencesHeight; row++)\r
- {\r
- if ( (int) (row * sampleRow) == lastrow)\r
- {\r
- sameRow++;\r
- continue;\r
- }\r
-\r
- hiddenRow = false;\r
- if (av.hasHiddenRows)\r
- {\r
- seq = av.alignment.getHiddenSequences().getHiddenSequence(lastrow);\r
- if (seq == null)\r
- {\r
- int index =\r
- av.alignment.getHiddenSequences().findIndexWithoutHiddenSeqs(\r
- lastrow);\r
-\r
- seq = av.alignment.getSequenceAt(index);\r
- }\r
- else\r
- {\r
- hiddenRow = true;\r
- }\r
- }\r
- else\r
- {\r
- seq = av.alignment.getSequenceAt(lastrow);\r
- }\r
-\r
- for (col = 0; col < width; col++)\r
- {\r
- if ( (int) (col * sampleCol) == lastcol &&\r
- (int) (row * sampleRow) == lastrow)\r
- {\r
- sameCol++;\r
- continue;\r
- }\r
-\r
- lastcol = (int) (col * sampleCol);\r
-\r
- if (seq.getLength() > lastcol)\r
- {\r
- color = sr.getResidueBoxColour(\r
- seq, lastcol);\r
-\r
- if (av.showSequenceFeatures)\r
- {\r
- color = fr.findFeatureColour(color, seq, lastcol);\r
- }\r
- }\r
- else\r
- {\r
- color = Color.white; //White\r
- }\r
-\r
- if (hiddenRow ||\r
- (av.hasHiddenColumns && !av.getColumnSelection().isVisible(lastcol)))\r
- {\r
- color = color.darker().darker();\r
- }\r
-\r
- mg.setColor(color);\r
- if (sameCol == 1 && sameRow == 1)\r
- {\r
- mg.drawLine(xstart, ystart, xstart, ystart);\r
- }\r
- else\r
- {\r
- mg.fillRect(xstart, ystart, sameCol, sameRow);\r
- }\r
-\r
- xstart = col;\r
- sameCol = 1;\r
- }\r
- lastrow = (int) (row * sampleRow);\r
- ystart = row;\r
- sameRow = 1;\r
- }\r
-\r
- if (av.conservation != null)\r
- {\r
- for (col = 0; col < width; col++)\r
- {\r
- lastcol = (int) (col * sampleCol);\r
- {\r
- mg.translate(col, sequencesHeight);\r
- ap.annotationPanel.drawGraph(mg, av.conservation,\r
- (int) (sampleCol) + 1,\r
- graphHeight,\r
- (int) (col * sampleCol),\r
- (int) (col * sampleCol) + 1);\r
- mg.translate( -col, -sequencesHeight);\r
- }\r
- }\r
- }\r
- System.gc();\r
-\r
- resizing = false;\r
-\r
- setBoxPosition();\r
-\r
- if (resizeAgain)\r
- {\r
- resizeAgain = false;\r
- updateOverviewImage();\r
- }\r
- }\r
-\r
- public void setBoxPosition()\r
- {\r
- int fullsizeWidth = av.alignment.getWidth() * av.getCharWidth();\r
- int fullsizeHeight = (av.alignment.getHeight()\r
- + av.alignment.getHiddenSequences().getSize()) *\r
- av.getCharHeight();\r
-\r
- int startRes = av.getStartRes();\r
- int endRes = av.getEndRes();\r
-\r
- if (av.hasHiddenColumns)\r
- {\r
- startRes = av.getColumnSelection().adjustForHiddenColumns(startRes);\r
- endRes = av.getColumnSelection().adjustForHiddenColumns(endRes);\r
- }\r
-\r
- int startSeq = av.startSeq;\r
- int endSeq = av.endSeq;\r
-\r
- if (av.hasHiddenRows)\r
- {\r
- startSeq =\r
- av.alignment.getHiddenSequences().adjustForHiddenSeqs(startSeq);\r
-\r
- endSeq =\r
- av.alignment.getHiddenSequences().adjustForHiddenSeqs(endSeq);\r
-\r
- }\r
-\r
- scalew = (float) width / (float) fullsizeWidth;\r
- scaleh = (float) sequencesHeight / (float) fullsizeHeight;\r
-\r
- boxX = (int) (startRes * av.getCharWidth() * scalew);\r
- boxY = (int) (startSeq * av.getCharHeight() * scaleh);\r
-\r
- if (av.hasHiddenColumns)\r
- {\r
- boxWidth = (int) ( (endRes - startRes + 1) * av.getCharWidth() * scalew);\r
- }\r
- else\r
- {\r
- boxWidth = (int) ( (endRes - startRes + 1) * av.getCharWidth() * scalew);\r
- }\r
-\r
- boxHeight = (int) ( (endSeq - startSeq) * av.getCharHeight() * scaleh);\r
-\r
- repaint();\r
- }\r
-\r
- public void update(Graphics g)\r
- {\r
- paint(g);\r
- }\r
-\r
- public void paint(Graphics g)\r
- {\r
- Graphics og = offscreen.getGraphics();\r
- if (miniMe != null)\r
- {\r
- og.drawImage(miniMe, 0, 0, this);\r
- og.setColor(Color.red);\r
- og.drawRect(boxX, boxY, boxWidth, boxHeight);\r
- og.drawRect(boxX + 1, boxY + 1, boxWidth - 2, boxHeight - 2);\r
- g.drawImage(offscreen, 0, 0, this);\r
- }\r
- }\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.appletgui;
+
+import java.awt.*;
+import java.awt.event.*;
+
+public class OverviewPanel
+ extends Panel implements Runnable, MouseMotionListener, MouseListener
+{
+ Image miniMe;
+ Image offscreen;
+ AlignViewport av;
+ AlignmentPanel ap;
+ float scalew = 1f;
+ float scaleh = 1f;
+
+ public int width, sequencesHeight;
+ int graphHeight = 20;
+ int boxX = -1, boxY = -1, boxWidth = -1, boxHeight = -1;
+
+ boolean resizing = false;
+
+ // Can set different properties in this seqCanvas than
+ // main visible SeqCanvas
+ SequenceRenderer sr;
+ FeatureRenderer fr;
+
+ Frame nullFrame;
+
+ public OverviewPanel(AlignmentPanel ap)
+ {
+ this.av = ap.av;
+ this.ap = ap;
+ setLayout(null);
+ nullFrame = new Frame();
+ nullFrame.addNotify();
+
+ sr = new SequenceRenderer(av);
+ sr.graphics = nullFrame.getGraphics();
+ sr.renderGaps = false;
+ sr.forOverview = true;
+ fr = new FeatureRenderer(av);
+ fr.overview = true;
+
+ // scale the initial size of overviewpanel to shape of alignment
+ float initialScale = (float) av.alignment.getWidth() /
+ (float) av.alignment.getHeight();
+
+ if (av.hconsensus == null)
+ {
+ graphHeight = 0;
+ }
+
+ if (av.alignment.getWidth() > av.alignment.getHeight())
+ {
+ // wider
+ width = 400;
+ sequencesHeight = (int) (400f / initialScale);
+ if (sequencesHeight < 40)
+ {
+ sequencesHeight = 40;
+ }
+ }
+ else
+ {
+ // taller
+ width = (int) (400f * initialScale);
+ sequencesHeight = 300;
+ if (width < 120)
+ {
+ width = 120;
+ }
+ }
+
+ setSize(new Dimension(width, sequencesHeight + graphHeight));
+ addComponentListener(new ComponentAdapter()
+ {
+
+ public void componentResized(ComponentEvent evt)
+ {
+ if (getSize().width != width ||
+ getSize().height != sequencesHeight + graphHeight)
+ {
+ updateOverviewImage();
+ }
+ }
+ });
+
+ addMouseMotionListener(this);
+
+ addMouseListener(this);
+
+ updateOverviewImage();
+
+ }
+
+ public void mouseEntered(MouseEvent evt)
+ {}
+
+ public void mouseExited(MouseEvent evt)
+ {}
+
+ public void mouseClicked(MouseEvent evt)
+ {}
+
+ public void mouseMoved(MouseEvent evt)
+ {}
+
+ public void mousePressed(MouseEvent evt)
+ {
+ boxX = evt.getX();
+ boxY = evt.getY();
+ checkValid();
+ }
+
+ public void mouseReleased(MouseEvent evt)
+ {
+ boxX = evt.getX();
+ boxY = evt.getY();
+ checkValid();
+ }
+
+ public void mouseDragged(MouseEvent evt)
+ {
+ boxX = evt.getX();
+ boxY = evt.getY();
+ checkValid();
+ }
+
+ void checkValid()
+ {
+ if (boxY < 0)
+ {
+ boxY = 0;
+ }
+
+ if (boxY > (sequencesHeight - boxHeight))
+ {
+ boxY = sequencesHeight - boxHeight + 1;
+ }
+
+ if (boxX < 0)
+ {
+ boxX = 0;
+ }
+
+ if (boxX > (width - boxWidth))
+ {
+ if (av.hasHiddenColumns)
+ {
+ //Try smallest possible box
+ boxWidth = (int) ( (av.endRes - av.startRes + 1) *
+ av.getCharWidth() * scalew);
+ }
+ boxX = width - boxWidth;
+ }
+
+ int col = (int) (boxX / scalew / av.getCharWidth());
+ int row = (int) (boxY / scaleh / av.getCharHeight());
+
+ if (av.hasHiddenColumns)
+ {
+ if (!av.getColumnSelection().isVisible(col))
+ {
+ return;
+ }
+
+ col = av.getColumnSelection().findColumnPosition(col);
+ }
+
+ if (av.hasHiddenRows)
+ {
+ row = av.alignment.getHiddenSequences().findIndexWithoutHiddenSeqs(row);
+ }
+
+ ap.setScrollValues(col, row);
+ ap.paintAlignment(false);
+ }
+
+ /**
+ * DOCUMENT ME!
+ */
+ public void updateOverviewImage()
+ {
+ if (resizing)
+ {
+ resizeAgain = true;
+ return;
+ }
+
+ if (av.showSequenceFeatures)
+ {
+ fr.featureGroups = ap.seqPanel.seqCanvas.getFeatureRenderer().
+ featureGroups;
+ fr.featureColours = ap.seqPanel.seqCanvas.getFeatureRenderer().
+ featureColours;
+ }
+
+ resizing = true;
+
+ if ( (getSize().width > 0) && (getSize().height > 0))
+ {
+ width = getSize().width;
+ sequencesHeight = getSize().height - graphHeight;
+ }
+ setSize(new Dimension(width, sequencesHeight + graphHeight));
+
+ Thread thread = new Thread(this);
+ thread.start();
+ repaint();
+ }
+
+ // This is set true if the user resizes whilst
+ // the overview is being calculated
+ boolean resizeAgain = false;
+
+ public void run()
+ {
+ miniMe = null;
+ int alwidth = av.alignment.getWidth();
+ int alheight = av.alignment.getHeight();
+
+ if (av.showSequenceFeatures)
+ {
+ fr.transferSettings(ap.seqPanel.seqCanvas.getFeatureRenderer());
+ }
+
+ if (getSize().width > 0 && getSize().height > 0)
+ {
+ width = getSize().width;
+ sequencesHeight = getSize().height - graphHeight;
+ }
+
+ setSize(new Dimension(width, sequencesHeight + graphHeight));
+
+ int fullsizeWidth = alwidth * av.getCharWidth();
+ int fullsizeHeight = alheight * av.getCharHeight();
+
+ scalew = (float) width / (float) fullsizeWidth;
+ scaleh = (float) sequencesHeight / (float) fullsizeHeight;
+
+ miniMe = nullFrame.createImage(width, sequencesHeight + graphHeight);
+ offscreen = nullFrame.createImage(width, sequencesHeight + graphHeight);
+
+ Graphics mg = miniMe.getGraphics();
+ float sampleCol = (float) alwidth / (float) width;
+ float sampleRow = (float) alheight / (float) sequencesHeight;
+
+ int lastcol = 0, lastrow = 0;
+ int xstart = 0, ystart = 0;
+ Color color = Color.yellow;
+ int row, col, sameRow = 0, sameCol = 0;
+ jalview.datamodel.SequenceI seq;
+ boolean hiddenRow = false;
+ for (row = 0; row <= sequencesHeight; row++)
+ {
+ if ( (int) (row * sampleRow) == lastrow)
+ {
+ sameRow++;
+ continue;
+ }
+
+ hiddenRow = false;
+ if (av.hasHiddenRows)
+ {
+ seq = av.alignment.getHiddenSequences().getHiddenSequence(lastrow);
+ if (seq == null)
+ {
+ int index =
+ av.alignment.getHiddenSequences().findIndexWithoutHiddenSeqs(
+ lastrow);
+
+ seq = av.alignment.getSequenceAt(index);
+ }
+ else
+ {
+ hiddenRow = true;
+ }
+ }
+ else
+ {
+ seq = av.alignment.getSequenceAt(lastrow);
+ }
+
+ for (col = 0; col < width; col++)
+ {
+ if ( (int) (col * sampleCol) == lastcol &&
+ (int) (row * sampleRow) == lastrow)
+ {
+ sameCol++;
+ continue;
+ }
+
+ lastcol = (int) (col * sampleCol);
+
+ if (seq.getLength() > lastcol)
+ {
+ color = sr.getResidueBoxColour(
+ seq, lastcol);
+
+ if (av.showSequenceFeatures)
+ {
+ color = fr.findFeatureColour(color, seq, lastcol);
+ }
+ }
+ else
+ {
+ color = Color.white; //White
+ }
+
+ if (hiddenRow ||
+ (av.hasHiddenColumns && !av.getColumnSelection().isVisible(lastcol)))
+ {
+ color = color.darker().darker();
+ }
+
+ mg.setColor(color);
+ if (sameCol == 1 && sameRow == 1)
+ {
+ mg.drawLine(xstart, ystart, xstart, ystart);
+ }
+ else
+ {
+ mg.fillRect(xstart, ystart, sameCol, sameRow);
+ }
+
+ xstart = col;
+ sameCol = 1;
+ }
+ lastrow = (int) (row * sampleRow);
+ ystart = row;
+ sameRow = 1;
+ }
+
+ if (av.conservation != null)
+ {
+ for (col = 0; col < width; col++)
+ {
+ lastcol = (int) (col * sampleCol);
+ {
+ mg.translate(col, sequencesHeight);
+ ap.annotationPanel.drawGraph(mg, av.conservation,
+ (int) (sampleCol) + 1,
+ graphHeight,
+ (int) (col * sampleCol),
+ (int) (col * sampleCol) + 1);
+ mg.translate( -col, -sequencesHeight);
+ }
+ }
+ }
+ System.gc();
+
+ resizing = false;
+
+ setBoxPosition();
+
+ if (resizeAgain)
+ {
+ resizeAgain = false;
+ updateOverviewImage();
+ }
+ }
+
+ public void setBoxPosition()
+ {
+ int fullsizeWidth = av.alignment.getWidth() * av.getCharWidth();
+ int fullsizeHeight = (av.alignment.getHeight()
+ + av.alignment.getHiddenSequences().getSize()) *
+ av.getCharHeight();
+
+ int startRes = av.getStartRes();
+ int endRes = av.getEndRes();
+
+ if (av.hasHiddenColumns)
+ {
+ startRes = av.getColumnSelection().adjustForHiddenColumns(startRes);
+ endRes = av.getColumnSelection().adjustForHiddenColumns(endRes);
+ }
+
+ int startSeq = av.startSeq;
+ int endSeq = av.endSeq;
+
+ if (av.hasHiddenRows)
+ {
+ startSeq =
+ av.alignment.getHiddenSequences().adjustForHiddenSeqs(startSeq);
+
+ endSeq =
+ av.alignment.getHiddenSequences().adjustForHiddenSeqs(endSeq);
+
+ }
+
+ scalew = (float) width / (float) fullsizeWidth;
+ scaleh = (float) sequencesHeight / (float) fullsizeHeight;
+
+ boxX = (int) (startRes * av.getCharWidth() * scalew);
+ boxY = (int) (startSeq * av.getCharHeight() * scaleh);
+
+ if (av.hasHiddenColumns)
+ {
+ boxWidth = (int) ( (endRes - startRes + 1) * av.getCharWidth() * scalew);
+ }
+ else
+ {
+ boxWidth = (int) ( (endRes - startRes + 1) * av.getCharWidth() * scalew);
+ }
+
+ boxHeight = (int) ( (endSeq - startSeq) * av.getCharHeight() * scaleh);
+
+ repaint();
+ }
+
+ public void update(Graphics g)
+ {
+ paint(g);
+ }
+
+ public void paint(Graphics g)
+ {
+ Graphics og = offscreen.getGraphics();
+ if (miniMe != null)
+ {
+ og.drawImage(miniMe, 0, 0, this);
+ og.setColor(Color.red);
+ og.drawRect(boxX, boxY, boxWidth, boxHeight);
+ og.drawRect(boxX + 1, boxY + 1, boxWidth - 2, boxHeight - 2);
+ g.drawImage(offscreen, 0, 0, this);
+ }
+ }
+
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.appletgui;
import java.util.*;
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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.appletgui;\r
-\r
-import java.util.*;\r
-\r
-import java.awt.*;\r
-\r
-import jalview.datamodel.*;\r
-\r
-/**\r
- * DOCUMENT ME!\r
- *\r
- * @author $author$\r
- * @version $Revision$\r
- */\r
-public class PaintRefresher\r
-{\r
- static Hashtable components;\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param comp DOCUMENT ME!\r
- * @param al DOCUMENT ME!\r
- */\r
- public static void Register(Component comp, String seqSetId)\r
- {\r
- if (components == null)\r
- {\r
- components = new Hashtable();\r
- }\r
-\r
- if (components.containsKey(seqSetId))\r
- {\r
- Vector comps = (Vector) components.get(seqSetId);\r
- if (!comps.contains(comp))\r
- {\r
- comps.addElement(comp);\r
- }\r
- }\r
- else\r
- {\r
- Vector vcoms = new Vector();\r
- vcoms.addElement(comp);\r
- components.put(seqSetId, vcoms);\r
- }\r
- }\r
-\r
- public static void RemoveComponent(Component comp)\r
- {\r
- if (components == null)\r
- {\r
- return;\r
- }\r
-\r
- Enumeration en = components.keys();\r
- while (en.hasMoreElements())\r
- {\r
- String id = en.nextElement().toString();\r
- Vector comps = (Vector) components.get(id);\r
- comps.removeElement(comp);\r
- if (comps.size() == 0)\r
- {\r
- components.remove(id);\r
- }\r
- }\r
- }\r
-\r
- public static void Refresh(Component source, String id)\r
- {\r
- Refresh(source, id, false, false);\r
- }\r
-\r
- public static void Refresh(Component source,\r
- String id,\r
- boolean alignmentChanged,\r
- boolean validateSequences)\r
- {\r
- if (components == null)\r
- {\r
- return;\r
- }\r
-\r
- Component comp;\r
- Vector comps = (Vector) components.get(id);\r
-\r
- if (comps == null)\r
- {\r
- return;\r
- }\r
-\r
- Enumeration e = comps.elements();\r
- while (e.hasMoreElements())\r
- {\r
- comp = (Component) e.nextElement();\r
-\r
- if (comp == source)\r
- {\r
- continue;\r
- }\r
-\r
- if (!comp.isValid())\r
- {\r
- comps.removeElement(comp);\r
- }\r
- else if (validateSequences\r
- && comp instanceof AlignmentPanel\r
- && source instanceof AlignmentPanel)\r
- {\r
- validateSequences( ( (AlignmentPanel) source).av.alignment,\r
- ( (AlignmentPanel) comp).av.alignment);\r
- }\r
-\r
- if (comp instanceof AlignmentPanel && alignmentChanged)\r
- {\r
- ( (AlignmentPanel) comp).alignmentChanged();\r
- }\r
-\r
- comp.repaint();\r
- }\r
- }\r
-\r
- static void validateSequences(AlignmentI source, AlignmentI comp)\r
- {\r
- SequenceI[] a1;\r
- if (source.getHiddenSequences().getSize() > 0)\r
- {\r
- a1 = source.getHiddenSequences().getFullAlignment().getSequencesArray();\r
- }\r
- else\r
- {\r
- a1 = source.getSequencesArray();\r
- }\r
-\r
- SequenceI[] a2;\r
- if (comp.getHiddenSequences().getSize() > 0)\r
- {\r
- a2 = comp.getHiddenSequences().getFullAlignment().getSequencesArray();\r
- }\r
- else\r
- {\r
- a2 = comp.getSequencesArray();\r
- }\r
-\r
- int i, iSize = a1.length, j, jSize = a2.length;\r
-\r
- if (iSize == jSize)\r
- {\r
- return;\r
- }\r
-\r
- boolean exists = false;\r
- for (i = 0; i < iSize; i++)\r
- {\r
- exists = false;\r
-\r
- for (j = 0; j < jSize; j++)\r
- {\r
- if (a2[j] == a1[i])\r
- {\r
- exists = true;\r
- break;\r
- }\r
- }\r
-\r
- if (!exists)\r
- {\r
- if (i < comp.getHeight())\r
- {\r
- comp.getSequences().insertElementAt(a1[i], i);\r
- }\r
- else\r
- {\r
- comp.addSequence(a1[i]);\r
- }\r
-\r
- if (comp.getHiddenSequences().getSize() > 0)\r
- {\r
- a2 = comp.getHiddenSequences().getFullAlignment().getSequencesArray();\r
- }\r
- else\r
- {\r
- a2 = comp.getSequencesArray();\r
- }\r
-\r
- jSize = a2.length;\r
- }\r
- }\r
-\r
- iSize = a1.length;\r
- jSize = a2.length;\r
-\r
- for (j = 0; j < jSize; j++)\r
- {\r
- exists = false;\r
- for (i = 0; i < iSize; i++)\r
- {\r
- if (a2[j] == a1[i])\r
- {\r
- exists = true;\r
- break;\r
- }\r
- }\r
-\r
- if (!exists)\r
- {\r
- comp.deleteSequence(a2[j]);\r
- }\r
- }\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.appletgui;
+
+import java.util.*;
+
+import java.awt.*;
+
+import jalview.datamodel.*;
+
+/**
+ * DOCUMENT ME!
+ *
+ * @author $author$
+ * @version $Revision$
+ */
+public class PaintRefresher
+{
+ static Hashtable components;
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param comp DOCUMENT ME!
+ * @param al DOCUMENT ME!
+ */
+ public static void Register(Component comp, String seqSetId)
+ {
+ if (components == null)
+ {
+ components = new Hashtable();
+ }
+
+ if (components.containsKey(seqSetId))
+ {
+ Vector comps = (Vector) components.get(seqSetId);
+ if (!comps.contains(comp))
+ {
+ comps.addElement(comp);
+ }
+ }
+ else
+ {
+ Vector vcoms = new Vector();
+ vcoms.addElement(comp);
+ components.put(seqSetId, vcoms);
+ }
+ }
+
+ public static void RemoveComponent(Component comp)
+ {
+ if (components == null)
+ {
+ return;
+ }
+
+ Enumeration en = components.keys();
+ while (en.hasMoreElements())
+ {
+ String id = en.nextElement().toString();
+ Vector comps = (Vector) components.get(id);
+ comps.removeElement(comp);
+ if (comps.size() == 0)
+ {
+ components.remove(id);
+ }
+ }
+ }
+
+ public static void Refresh(Component source, String id)
+ {
+ Refresh(source, id, false, false);
+ }
+
+ public static void Refresh(Component source,
+ String id,
+ boolean alignmentChanged,
+ boolean validateSequences)
+ {
+ if (components == null)
+ {
+ return;
+ }
+
+ Component comp;
+ Vector comps = (Vector) components.get(id);
+
+ if (comps == null)
+ {
+ return;
+ }
+
+ Enumeration e = comps.elements();
+ while (e.hasMoreElements())
+ {
+ comp = (Component) e.nextElement();
+
+ if (comp == source)
+ {
+ continue;
+ }
+
+ if (!comp.isValid())
+ {
+ comps.removeElement(comp);
+ }
+ else if (validateSequences
+ && comp instanceof AlignmentPanel
+ && source instanceof AlignmentPanel)
+ {
+ validateSequences( ( (AlignmentPanel) source).av.alignment,
+ ( (AlignmentPanel) comp).av.alignment);
+ }
+
+ if (comp instanceof AlignmentPanel && alignmentChanged)
+ {
+ ( (AlignmentPanel) comp).alignmentChanged();
+ }
+
+ comp.repaint();
+ }
+ }
+
+ static void validateSequences(AlignmentI source, AlignmentI comp)
+ {
+ SequenceI[] a1;
+ if (source.getHiddenSequences().getSize() > 0)
+ {
+ a1 = source.getHiddenSequences().getFullAlignment().getSequencesArray();
+ }
+ else
+ {
+ a1 = source.getSequencesArray();
+ }
+
+ SequenceI[] a2;
+ if (comp.getHiddenSequences().getSize() > 0)
+ {
+ a2 = comp.getHiddenSequences().getFullAlignment().getSequencesArray();
+ }
+ else
+ {
+ a2 = comp.getSequencesArray();
+ }
+
+ int i, iSize = a1.length, j, jSize = a2.length;
+
+ if (iSize == jSize)
+ {
+ return;
+ }
+
+ boolean exists = false;
+ for (i = 0; i < iSize; i++)
+ {
+ exists = false;
+
+ for (j = 0; j < jSize; j++)
+ {
+ if (a2[j] == a1[i])
+ {
+ exists = true;
+ break;
+ }
+ }
+
+ if (!exists)
+ {
+ if (i < comp.getHeight())
+ {
+ comp.getSequences().insertElementAt(a1[i], i);
+ }
+ else
+ {
+ comp.addSequence(a1[i]);
+ }
+
+ if (comp.getHiddenSequences().getSize() > 0)
+ {
+ a2 = comp.getHiddenSequences().getFullAlignment().getSequencesArray();
+ }
+ else
+ {
+ a2 = comp.getSequencesArray();
+ }
+
+ jSize = a2.length;
+ }
+ }
+
+ iSize = a1.length;
+ jSize = a2.length;
+
+ for (j = 0; j < jSize; j++)
+ {
+ exists = false;
+ for (i = 0; i < iSize; i++)
+ {
+ if (a2[j] == a1[i])
+ {
+ exists = true;
+ break;
+ }
+ }
+
+ if (!exists)
+ {
+ comp.deleteSequence(a2[j]);
+ }
+ }
+ }
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.appletgui;
import java.util.*;
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.appletgui;
import java.util.*;
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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
-package jalview.appletgui;\r
-\r
-import java.util.*;\r
-\r
-import java.awt.*;\r
-import java.awt.event.*;\r
-\r
-import jalview.datamodel.*;\r
-import jalview.math.*;\r
-import jalview.util.*;\r
-\r
-public class RotatableCanvas\r
- extends Panel implements MouseListener,\r
- MouseMotionListener,\r
- KeyListener\r
-{\r
- RotatableMatrix idmat = new RotatableMatrix(3, 3);\r
- RotatableMatrix objmat = new RotatableMatrix(3, 3);\r
- RotatableMatrix rotmat = new RotatableMatrix(3, 3);\r
- String tooltip;\r
- int toolx, tooly;\r
-\r
- //RubberbandRectangle rubberband;\r
-\r
- boolean drawAxes = true;\r
-\r
- int omx = 0;\r
- int mx = 0;\r
- int omy = 0;\r
- int my = 0;\r
-\r
- Image img;\r
- Graphics ig;\r
-\r
- Dimension prefsize;\r
-\r
- float centre[] = new float[3];\r
- float width[] = new float[3];\r
-\r
- float max[] = new float[3];\r
- float min[] = new float[3];\r
-\r
- float maxwidth;\r
- float scale;\r
-\r
- int npoint;\r
-\r
- Vector points;\r
- float[][] orig;\r
- float[][] axes;\r
-\r
- int startx;\r
- int starty;\r
-\r
- int lastx;\r
- int lasty;\r
-\r
- int rectx1;\r
- int recty1;\r
- int rectx2;\r
- int recty2;\r
-\r
- float scalefactor = 1;\r
-\r
- AlignViewport av;\r
- boolean showLabels = false;\r
-\r
- public RotatableCanvas(AlignViewport av)\r
- {\r
- this.av = av;\r
- }\r
-\r
- public void showLabels(boolean b)\r
- {\r
- showLabels = b;\r
- repaint();\r
- }\r
-\r
- public void setPoints(Vector points, int npoint)\r
- {\r
- this.points = points;\r
- this.npoint = npoint;\r
- PaintRefresher.Register(this, av.getSequenceSetId());\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
- for (int j = 0; j < 3; j++)\r
- {\r
- orig[i][j] = sp.coord[j];\r
- }\r
- }\r
- //Initialize the matrices to identity\r
-\r
- for (int i = 0; i < 3; i++)\r
- {\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
- axes = new float[3][3];\r
- initAxes();\r
-\r
- findCentre();\r
- findWidth();\r
-\r
- scale = findScale();\r
-\r
- // System.out.println("Scale factor = " + scale);\r
-\r
- addMouseListener(this);\r
- addKeyListener(this);\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
-\r
- public void initAxes()\r
- {\r
- for (int i = 0; i < 3; i++)\r
- {\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
- 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
-\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
- if (sp.coord[i] >= max[i])\r
- {\r
- max[i] = sp.coord[i];\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
-\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
- maxwidth = width[0];\r
-\r
- if (width[1] > width[0])\r
- {\r
- maxwidth = width[1];\r
- }\r
- if (width[2] > width[1])\r
- {\r
- maxwidth = width[2];\r
- }\r
-\r
- //System.out.println("Maxwidth = " + maxwidth);\r
- }\r
-\r
- public float findScale()\r
- {\r
- int dim, width, height;\r
- if (getSize().width != 0)\r
- {\r
- width = getSize().width;\r
- height = getSize().height;\r
- }\r
- else\r
- {\r
- width = prefsize.width;\r
- height = prefsize.height;\r
- }\r
-\r
- if (width < height)\r
- {\r
- dim = width;\r
- }\r
- else\r
- {\r
- dim = height;\r
- }\r
-\r
- return (float) (dim * scalefactor / (2 * maxwidth));\r
- }\r
-\r
- public void findCentre()\r
- {\r
- //Find centre coordinate\r
- findWidth();\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
-\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
-\r
- public Dimension getPreferredSize()\r
- {\r
- if (prefsize != null)\r
- {\r
- return prefsize;\r
- }\r
- else\r
- {\r
- return new Dimension(400, 400);\r
- }\r
- }\r
-\r
- public Dimension getMinimumSize()\r
- {\r
- return getPreferredSize();\r
- }\r
-\r
- public void update(Graphics g)\r
- {\r
- paint(g);\r
- }\r
-\r
- public void paint(Graphics g)\r
- {\r
- if (points == null)\r
- {\r
- g.setFont(new Font("Verdana", Font.PLAIN, 18));\r
- g.drawString("Calculating PCA....", 20, getSize().height / 2);\r
- }\r
- else\r
- {\r
-\r
- //Only create the image at the beginning -\r
- if ( (img == null) || (prefsize.width != getSize().width) ||\r
- (prefsize.height != getSize().height))\r
- {\r
- prefsize.width = getSize().width;\r
- prefsize.height = getSize().height;\r
-\r
- scale = findScale();\r
-\r
- // System.out.println("New scale = " + scale);\r
- img = createImage(getSize().width, getSize().height);\r
- ig = img.getGraphics();\r
-\r
- }\r
-\r
- drawBackground(ig, Color.black);\r
- drawScene(ig);\r
- if (drawAxes == true)\r
- {\r
- drawAxes(ig);\r
- }\r
-\r
- if (tooltip != null)\r
- {\r
- ig.setColor(Color.red);\r
- ig.drawString(tooltip, toolx, tooly);\r
- }\r
-\r
- g.drawImage(img, 0, 0, this);\r
- }\r
- }\r
-\r
- public void drawAxes(Graphics g)\r
- {\r
-\r
- g.setColor(Color.yellow);\r
- for (int i = 0; i < 3; i++)\r
- {\r
- g.drawLine(getSize().width / 2, getSize().height / 2,\r
- (int) (axes[i][0] * scale * max[0] + getSize().width / 2),\r
- (int) (axes[i][1] * scale * max[1] + getSize().height / 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
- public void drawScene(Graphics g)\r
- {\r
- //boolean darker = false;\r
-\r
- int halfwidth = getSize().width / 2;\r
- int halfheight = getSize().height / 2;\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) + halfwidth;\r
- int y = (int) ( (float) (sp.coord[1] - centre[1]) * scale) + halfheight;\r
- float z = sp.coord[1] - centre[2];\r
-\r
- if (av.getSequenceColour(sp.sequence) == Color.black)\r
- {\r
- g.setColor(Color.white);\r
- }\r
- else\r
- {\r
- g.setColor(av.getSequenceColour(sp.sequence));\r
- }\r
-\r
- if (av.getSelectionGroup() != null)\r
- {\r
- if (av.getSelectionGroup().getSequences(null).contains( ( (\r
- SequencePoint) points.\r
- elementAt(i)).sequence))\r
- {\r
- g.setColor(Color.gray);\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
- if (showLabels)\r
- {\r
- g.setColor(Color.red);\r
- g.drawString( ( (SequencePoint) points.elementAt(i)).sequence.\r
- getName(),\r
- x - 3, y - 4);\r
- }\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
- public void keyReleased(KeyEvent evt)\r
- {}\r
-\r
- public void keyPressed(KeyEvent evt)\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
- if (rectx2 != -1 && recty2 != -1)\r
- {\r
- rectSelect(rectx1, recty1, rectx2, recty2);\r
-\r
- }\r
- }\r
- repaint();\r
- }\r
-\r
- public void printPoints()\r
- {\r
- for (int i = 0; i < npoint; i++)\r
- {\r
- SequencePoint sp = (SequencePoint) points.elementAt(i);\r
- Format.print(System.out, "%5d ", i);\r
- for (int j = 0; j < 3; j++)\r
- {\r
- Format.print(System.out, "%13.3f ", sp.coord[j]);\r
- }\r
- System.out.println();\r
- }\r
- }\r
-\r
- public void mouseClicked(MouseEvent evt)\r
- {}\r
-\r
- public void mouseEntered(MouseEvent evt)\r
- {}\r
-\r
- public void mouseExited(MouseEvent evt)\r
- {}\r
-\r
- public void mouseReleased(MouseEvent evt)\r
- {}\r
-\r
- public void mousePressed(MouseEvent evt)\r
- {\r
- int x = evt.getX();\r
- int y = evt.getY();\r
-\r
- mx = x;\r
- my = y;\r
-\r
- omx = mx;\r
- omy = my;\r
-\r
- startx = x;\r
- starty = y;\r
-\r
- rectx1 = x;\r
- recty1 = y;\r
-\r
- rectx2 = -1;\r
- recty2 = -1;\r
-\r
- SequenceI found = findPoint(x, y);\r
-\r
- if (found != null)\r
- {\r
- if (av.getSelectionGroup() != null)\r
- {\r
- av.getSelectionGroup().addOrRemove(found, true);\r
- av.getSelectionGroup().setEndRes(av.alignment.getWidth() - 1);\r
- PaintRefresher.Refresh(this, av.getSequenceSetId());\r
- }\r
- else\r
- {\r
- av.setSelectionGroup(new SequenceGroup());\r
- av.getSelectionGroup().addOrRemove(found, true);\r
- av.getSelectionGroup().setEndRes(av.alignment.getWidth() - 1);\r
-\r
- }\r
- }\r
- repaint();\r
- }\r
-\r
- public void mouseMoved(MouseEvent evt)\r
- {\r
- SequenceI found = findPoint(evt.getX(), evt.getY());\r
- if (found == null)\r
- {\r
- tooltip = null;\r
- }\r
- else\r
- {\r
- tooltip = found.getName();\r
- toolx = evt.getX();\r
- tooly = evt.getY();\r
- }\r
- repaint();\r
- }\r
-\r
- public void mouseDragged(MouseEvent evt)\r
- {\r
- mx = evt.getX();\r
- my = evt.getY();\r
-\r
- rotmat.setIdentity();\r
-\r
- rotmat.rotate( (float) (my - omy), 'x');\r
- rotmat.rotate( (float) (mx - omx), 'y');\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
-\r
- //Now apply the rotation matrix\r
- sp.coord = rotmat.vectorMultiply(sp.coord);\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
- for (int i = 0; i < 3; i++)\r
- {\r
- axes[i] = rotmat.vectorMultiply(axes[i]);\r
- }\r
- omx = mx;\r
- omy = my;\r
-\r
- paint(this.getGraphics());\r
- }\r
-\r
- public void rectSelect(int x1, int y1, int x2, int y2)\r
- {\r
- //boolean changedSel = false;\r
- for (int i = 0; i < npoint; i++)\r
- {\r
- SequencePoint sp = (SequencePoint) points.elementAt(i);\r
- int tmp1 = (int) ( (sp.coord[0] - centre[0]) * scale +\r
- (float) getSize().width / 2.0);\r
- int tmp2 = (int) ( (sp.coord[1] - centre[1]) * scale +\r
- (float) getSize().height / 2.0);\r
-\r
- if (tmp1 > x1 && tmp1 < x2 && tmp2 > y1 && tmp2 < y2)\r
- {\r
- if (av != null)\r
- {\r
- if (!av.getSelectionGroup().getSequences(null).contains(sp.sequence))\r
- {\r
- av.getSelectionGroup().addSequence(sp.sequence, true);\r
- }\r
- }\r
- }\r
- }\r
- }\r
-\r
- public SequenceI findPoint(int x, int y)\r
- {\r
-\r
- int halfwidth = getSize().width / 2;\r
- int halfheight = getSize().height / 2;\r
-\r
- int found = -1;\r
-\r
- for (int i = 0; i < npoint; i++)\r
- {\r
-\r
- SequencePoint sp = (SequencePoint) points.elementAt(i);\r
- int px = (int) ( (float) (sp.coord[0] - centre[0]) * scale) + halfwidth;\r
- int py = (int) ( (float) (sp.coord[1] - centre[1]) * scale) + halfheight;\r
-\r
- if (Math.abs(px - x) < 3 && Math.abs(py - y) < 3)\r
- {\r
- found = i;\r
- }\r
- }\r
- if (found != -1)\r
- {\r
- return ( (SequencePoint) points.elementAt(found)).sequence;\r
- }\r
- else\r
- {\r
- return null;\r
- }\r
- }\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.appletgui;
+
+import java.util.*;
+
+import java.awt.*;
+import java.awt.event.*;
+
+import jalview.datamodel.*;
+import jalview.math.*;
+import jalview.util.*;
+
+public class RotatableCanvas
+ extends Panel implements MouseListener,
+ MouseMotionListener,
+ KeyListener
+{
+ RotatableMatrix idmat = new RotatableMatrix(3, 3);
+ RotatableMatrix objmat = new RotatableMatrix(3, 3);
+ RotatableMatrix rotmat = new RotatableMatrix(3, 3);
+ String tooltip;
+ int toolx, tooly;
+
+ //RubberbandRectangle rubberband;
+
+ boolean drawAxes = true;
+
+ int omx = 0;
+ int mx = 0;
+ int omy = 0;
+ int my = 0;
+
+ Image img;
+ Graphics ig;
+
+ Dimension prefsize;
+
+ float centre[] = new float[3];
+ float width[] = new float[3];
+
+ float max[] = new float[3];
+ float min[] = new float[3];
+
+ float maxwidth;
+ float scale;
+
+ int npoint;
+
+ Vector points;
+ float[][] orig;
+ float[][] axes;
+
+ int startx;
+ int starty;
+
+ int lastx;
+ int lasty;
+
+ int rectx1;
+ int recty1;
+ int rectx2;
+ int recty2;
+
+ float scalefactor = 1;
+
+ AlignViewport av;
+ boolean showLabels = false;
+
+ public RotatableCanvas(AlignViewport av)
+ {
+ this.av = av;
+ }
+
+ public void showLabels(boolean b)
+ {
+ showLabels = b;
+ repaint();
+ }
+
+ public void setPoints(Vector points, int npoint)
+ {
+ this.points = points;
+ this.npoint = npoint;
+ PaintRefresher.Register(this, av.getSequenceSetId());
+
+ prefsize = getPreferredSize();
+ orig = new float[npoint][3];
+
+ for (int i = 0; i < npoint; i++)
+ {
+ SequencePoint sp = (SequencePoint) points.elementAt(i);
+ for (int j = 0; j < 3; j++)
+ {
+ orig[i][j] = sp.coord[j];
+ }
+ }
+ //Initialize the matrices to identity
+
+ for (int i = 0; i < 3; i++)
+ {
+ for (int j = 0; j < 3; j++)
+ {
+ if (i != j)
+ {
+ idmat.addElement(i, j, 0);
+ objmat.addElement(i, j, 0);
+ rotmat.addElement(i, j, 0);
+ }
+ else
+ {
+ idmat.addElement(i, j, 0);
+ objmat.addElement(i, j, 0);
+ rotmat.addElement(i, j, 0);
+ }
+ }
+ }
+
+ axes = new float[3][3];
+ initAxes();
+
+ findCentre();
+ findWidth();
+
+ scale = findScale();
+
+ // System.out.println("Scale factor = " + scale);
+
+ addMouseListener(this);
+ addKeyListener(this);
+ // if (getParent() != null) {
+ // getParent().addKeyListener(this);
+ //}
+ addMouseMotionListener(this);
+
+ // Add rubberband
+ // rubberband = new RubberbandRectangle(this);
+ // rubberband.setActive(true);
+ // rubberband.addListener(this);
+ }
+
+ /* public boolean handleSequenceSelectionEvent(SequenceSelectionEvent evt) {
+ redrawneeded = true;
+ repaint();
+ return true;
+ }
+
+ public void removeNotify() {
+ controller.removeListener(this);
+ super.removeNotify();
+ }*/
+
+ public void initAxes()
+ {
+ for (int i = 0; i < 3; i++)
+ {
+ for (int j = 0; j < 3; j++)
+ {
+ if (i != j)
+ {
+ axes[i][j] = 0;
+ }
+ else
+ {
+ axes[i][j] = 1;
+ }
+ }
+ }
+ }
+
+ public void findWidth()
+ {
+ max = new float[3];
+ min = new float[3];
+
+ max[0] = (float) - 1e30;
+ max[1] = (float) - 1e30;
+ max[2] = (float) - 1e30;
+
+ min[0] = (float) 1e30;
+ min[1] = (float) 1e30;
+ min[2] = (float) 1e30;
+
+ for (int i = 0; i < 3; i++)
+ {
+ for (int j = 0; j < npoint; j++)
+ {
+ SequencePoint sp = (SequencePoint) points.elementAt(j);
+ if (sp.coord[i] >= max[i])
+ {
+ max[i] = sp.coord[i];
+ }
+ if (sp.coord[i] <= min[i])
+ {
+ min[i] = sp.coord[i];
+ }
+ }
+ }
+
+ // System.out.println("xmax " + max[0] + " min " + min[0]);
+ //System.out.println("ymax " + max[1] + " min " + min[1]);
+ //System.out.println("zmax " + max[2] + " min " + min[2]);
+
+ width[0] = Math.abs(max[0] - min[0]);
+ width[1] = Math.abs(max[1] - min[1]);
+ width[2] = Math.abs(max[2] - min[2]);
+
+ maxwidth = width[0];
+
+ if (width[1] > width[0])
+ {
+ maxwidth = width[1];
+ }
+ if (width[2] > width[1])
+ {
+ maxwidth = width[2];
+ }
+
+ //System.out.println("Maxwidth = " + maxwidth);
+ }
+
+ public float findScale()
+ {
+ int dim, width, height;
+ if (getSize().width != 0)
+ {
+ width = getSize().width;
+ height = getSize().height;
+ }
+ else
+ {
+ width = prefsize.width;
+ height = prefsize.height;
+ }
+
+ if (width < height)
+ {
+ dim = width;
+ }
+ else
+ {
+ dim = height;
+ }
+
+ return (float) (dim * scalefactor / (2 * maxwidth));
+ }
+
+ public void findCentre()
+ {
+ //Find centre coordinate
+ findWidth();
+
+ centre[0] = (max[0] + min[0]) / 2;
+ centre[1] = (max[1] + min[1]) / 2;
+ centre[2] = (max[2] + min[2]) / 2;
+
+ // System.out.println("Centre x " + centre[0]);
+ //System.out.println("Centre y " + centre[1]);
+ //System.out.println("Centre z " + centre[2]);
+ }
+
+ public Dimension getPreferredSize()
+ {
+ if (prefsize != null)
+ {
+ return prefsize;
+ }
+ else
+ {
+ return new Dimension(400, 400);
+ }
+ }
+
+ public Dimension getMinimumSize()
+ {
+ return getPreferredSize();
+ }
+
+ public void update(Graphics g)
+ {
+ paint(g);
+ }
+
+ public void paint(Graphics g)
+ {
+ if (points == null)
+ {
+ g.setFont(new Font("Verdana", Font.PLAIN, 18));
+ g.drawString("Calculating PCA....", 20, getSize().height / 2);
+ }
+ else
+ {
+
+ //Only create the image at the beginning -
+ if ( (img == null) || (prefsize.width != getSize().width) ||
+ (prefsize.height != getSize().height))
+ {
+ prefsize.width = getSize().width;
+ prefsize.height = getSize().height;
+
+ scale = findScale();
+
+ // System.out.println("New scale = " + scale);
+ img = createImage(getSize().width, getSize().height);
+ ig = img.getGraphics();
+
+ }
+
+ drawBackground(ig, Color.black);
+ drawScene(ig);
+ if (drawAxes == true)
+ {
+ drawAxes(ig);
+ }
+
+ if (tooltip != null)
+ {
+ ig.setColor(Color.red);
+ ig.drawString(tooltip, toolx, tooly);
+ }
+
+ g.drawImage(img, 0, 0, this);
+ }
+ }
+
+ public void drawAxes(Graphics g)
+ {
+
+ g.setColor(Color.yellow);
+ for (int i = 0; i < 3; i++)
+ {
+ g.drawLine(getSize().width / 2, getSize().height / 2,
+ (int) (axes[i][0] * scale * max[0] + getSize().width / 2),
+ (int) (axes[i][1] * scale * max[1] + getSize().height / 2));
+ }
+ }
+
+ public void drawBackground(Graphics g, Color col)
+ {
+ g.setColor(col);
+ g.fillRect(0, 0, prefsize.width, prefsize.height);
+ }
+
+ public void drawScene(Graphics g)
+ {
+ //boolean darker = false;
+
+ int halfwidth = getSize().width / 2;
+ int halfheight = getSize().height / 2;
+
+ for (int i = 0; i < npoint; i++)
+ {
+ SequencePoint sp = (SequencePoint) points.elementAt(i);
+ int x = (int) ( (float) (sp.coord[0] - centre[0]) * scale) + halfwidth;
+ int y = (int) ( (float) (sp.coord[1] - centre[1]) * scale) + halfheight;
+ float z = sp.coord[1] - centre[2];
+
+ if (av.getSequenceColour(sp.sequence) == Color.black)
+ {
+ g.setColor(Color.white);
+ }
+ else
+ {
+ g.setColor(av.getSequenceColour(sp.sequence));
+ }
+
+ if (av.getSelectionGroup() != null)
+ {
+ if (av.getSelectionGroup().getSequences(null).contains( ( (
+ SequencePoint) points.
+ elementAt(i)).sequence))
+ {
+ g.setColor(Color.gray);
+ }
+ }
+ if (z < 0)
+ {
+ g.setColor(g.getColor().darker());
+ }
+
+ g.fillRect(x - 3, y - 3, 6, 6);
+ if (showLabels)
+ {
+ g.setColor(Color.red);
+ g.drawString( ( (SequencePoint) points.elementAt(i)).sequence.
+ getName(),
+ x - 3, y - 4);
+ }
+ }
+ }
+
+ public Dimension minimumsize()
+ {
+ return prefsize;
+ }
+
+ public Dimension preferredsize()
+ {
+ return prefsize;
+ }
+
+ public void keyTyped(KeyEvent evt)
+ {}
+
+ public void keyReleased(KeyEvent evt)
+ {}
+
+ public void keyPressed(KeyEvent evt)
+ {
+ if (evt.getKeyCode() == KeyEvent.VK_UP)
+ {
+ scalefactor = (float) (scalefactor * 1.1);
+ scale = findScale();
+ }
+ else if (evt.getKeyCode() == KeyEvent.VK_DOWN)
+ {
+ scalefactor = (float) (scalefactor * 0.9);
+ scale = findScale();
+ }
+ else if (evt.getKeyChar() == 's')
+ {
+ System.err.println("DEBUG: Rectangle selection"); // log.debug
+ if (rectx2 != -1 && recty2 != -1)
+ {
+ rectSelect(rectx1, recty1, rectx2, recty2);
+
+ }
+ }
+ repaint();
+ }
+
+ public void printPoints()
+ {
+ for (int i = 0; i < npoint; i++)
+ {
+ SequencePoint sp = (SequencePoint) points.elementAt(i);
+ Format.print(System.out, "%5d ", i);
+ for (int j = 0; j < 3; j++)
+ {
+ Format.print(System.out, "%13.3f ", sp.coord[j]);
+ }
+ System.out.println();
+ }
+ }
+
+ public void mouseClicked(MouseEvent evt)
+ {}
+
+ public void mouseEntered(MouseEvent evt)
+ {}
+
+ public void mouseExited(MouseEvent evt)
+ {}
+
+ public void mouseReleased(MouseEvent evt)
+ {}
+
+ public void mousePressed(MouseEvent evt)
+ {
+ int x = evt.getX();
+ int y = evt.getY();
+
+ mx = x;
+ my = y;
+
+ omx = mx;
+ omy = my;
+
+ startx = x;
+ starty = y;
+
+ rectx1 = x;
+ recty1 = y;
+
+ rectx2 = -1;
+ recty2 = -1;
+
+ SequenceI found = findPoint(x, y);
+
+ if (found != null)
+ {
+ if (av.getSelectionGroup() != null)
+ {
+ av.getSelectionGroup().addOrRemove(found, true);
+ av.getSelectionGroup().setEndRes(av.alignment.getWidth() - 1);
+ PaintRefresher.Refresh(this, av.getSequenceSetId());
+ }
+ else
+ {
+ av.setSelectionGroup(new SequenceGroup());
+ av.getSelectionGroup().addOrRemove(found, true);
+ av.getSelectionGroup().setEndRes(av.alignment.getWidth() - 1);
+
+ }
+ }
+ repaint();
+ }
+
+ public void mouseMoved(MouseEvent evt)
+ {
+ SequenceI found = findPoint(evt.getX(), evt.getY());
+ if (found == null)
+ {
+ tooltip = null;
+ }
+ else
+ {
+ tooltip = found.getName();
+ toolx = evt.getX();
+ tooly = evt.getY();
+ }
+ repaint();
+ }
+
+ public void mouseDragged(MouseEvent evt)
+ {
+ mx = evt.getX();
+ my = evt.getY();
+
+ rotmat.setIdentity();
+
+ rotmat.rotate( (float) (my - omy), 'x');
+ rotmat.rotate( (float) (mx - omx), 'y');
+
+ for (int i = 0; i < npoint; i++)
+ {
+ SequencePoint sp = (SequencePoint) points.elementAt(i);
+ sp.coord[0] -= centre[0];
+ sp.coord[1] -= centre[1];
+ sp.coord[2] -= centre[2];
+
+ //Now apply the rotation matrix
+ sp.coord = rotmat.vectorMultiply(sp.coord);
+
+ //Now translate back again
+ sp.coord[0] += centre[0];
+ sp.coord[1] += centre[1];
+ sp.coord[2] += centre[2];
+ }
+
+ for (int i = 0; i < 3; i++)
+ {
+ axes[i] = rotmat.vectorMultiply(axes[i]);
+ }
+ omx = mx;
+ omy = my;
+
+ paint(this.getGraphics());
+ }
+
+ public void rectSelect(int x1, int y1, int x2, int y2)
+ {
+ //boolean changedSel = false;
+ for (int i = 0; i < npoint; i++)
+ {
+ SequencePoint sp = (SequencePoint) points.elementAt(i);
+ int tmp1 = (int) ( (sp.coord[0] - centre[0]) * scale +
+ (float) getSize().width / 2.0);
+ int tmp2 = (int) ( (sp.coord[1] - centre[1]) * scale +
+ (float) getSize().height / 2.0);
+
+ if (tmp1 > x1 && tmp1 < x2 && tmp2 > y1 && tmp2 < y2)
+ {
+ if (av != null)
+ {
+ if (!av.getSelectionGroup().getSequences(null).contains(sp.sequence))
+ {
+ av.getSelectionGroup().addSequence(sp.sequence, true);
+ }
+ }
+ }
+ }
+ }
+
+ public SequenceI findPoint(int x, int y)
+ {
+
+ int halfwidth = getSize().width / 2;
+ int halfheight = getSize().height / 2;
+
+ int found = -1;
+
+ for (int i = 0; i < npoint; i++)
+ {
+
+ SequencePoint sp = (SequencePoint) points.elementAt(i);
+ int px = (int) ( (float) (sp.coord[0] - centre[0]) * scale) + halfwidth;
+ int py = (int) ( (float) (sp.coord[1] - centre[1]) * scale) + halfheight;
+
+ if (Math.abs(px - x) < 3 && Math.abs(py - y) < 3)
+ {
+ found = i;
+ }
+ }
+ if (found != -1)
+ {
+ return ( (SequencePoint) points.elementAt(found)).sequence;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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
-package jalview.appletgui;\r
-\r
-import java.awt.*;\r
-import java.awt.event.*;\r
-\r
-import jalview.datamodel.*;\r
-\r
-public class ScalePanel\r
- extends Panel implements MouseMotionListener, MouseListener\r
-{\r
-\r
- protected int offy = 4;\r
- public int width;\r
-\r
- protected AlignViewport av;\r
- AlignmentPanel ap;\r
-\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
- boolean mouseDragging = false;\r
- int[] reveal;\r
-\r
- public ScalePanel(AlignViewport av, AlignmentPanel ap)\r
- {\r
- setLayout(null);\r
- this.av = av;\r
- this.ap = ap;\r
-\r
- addMouseListener(this);\r
- addMouseMotionListener(this);\r
-\r
- }\r
-\r
- public void mousePressed(MouseEvent evt)\r
- {\r
- int x = (evt.getX() / av.getCharWidth()) + av.getStartRes();\r
- final int res;\r
-\r
- if (av.hasHiddenColumns)\r
- {\r
- res = av.getColumnSelection().adjustForHiddenColumns(x);\r
- }\r
- else\r
- {\r
- res = x;\r
- }\r
-\r
- min = res;\r
- max = res;\r
- if ( (evt.getModifiers() & InputEvent.BUTTON3_MASK)\r
- == InputEvent.BUTTON3_MASK)\r
- {\r
- PopupMenu pop = new PopupMenu();\r
- if (reveal != null)\r
- {\r
- MenuItem item = new MenuItem("Reveal");\r
- item.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- av.showColumn(reveal[0]);\r
- reveal = null;\r
- ap.paintAlignment(true);\r
- if (ap.overviewPanel != null)\r
- {\r
- ap.overviewPanel.updateOverviewImage();\r
- }\r
- }\r
- });\r
- pop.add(item);\r
-\r
- if (av.getColumnSelection().getHiddenColumns().size() > 1)\r
- {\r
- item = new MenuItem("Reveal All");\r
- item.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- av.showAllHiddenColumns();\r
- reveal = null;\r
- ap.paintAlignment(true);\r
- if (ap.overviewPanel != null)\r
- {\r
- ap.overviewPanel.updateOverviewImage();\r
- }\r
- }\r
- });\r
- pop.add(item);\r
- }\r
- this.add(pop);\r
- pop.show(this, evt.getX(), evt.getY());\r
- }\r
- else if (av.getColumnSelection().contains(res))\r
- {\r
- MenuItem item = new MenuItem("Hide Columns");\r
- item.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- av.hideColumns(res, res);\r
- if (av.getSelectionGroup() != null\r
- &&\r
- av.getSelectionGroup().getSize() == av.alignment.getHeight())\r
- {\r
- av.setSelectionGroup(null);\r
- }\r
-\r
- ap.paintAlignment(true);\r
- if (ap.overviewPanel != null)\r
- {\r
- ap.overviewPanel.updateOverviewImage();\r
- }\r
- }\r
- });\r
- pop.add(item);\r
- this.add(pop);\r
- pop.show(this, evt.getX(), evt.getY());\r
- }\r
- }\r
- else // LEFT MOUSE TO SELECT\r
- {\r
- if (!evt.isControlDown() && !evt.isShiftDown())\r
- {\r
- av.getColumnSelection().clear();\r
- }\r
-\r
- av.getColumnSelection().addElement(res);\r
- SequenceGroup sg = new SequenceGroup();\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
- av.setSelectionGroup(sg);\r
-\r
- if (evt.isShiftDown())\r
- {\r
- int min = Math.min(av.getColumnSelection().getMin(), res);\r
- int max = Math.max(av.getColumnSelection().getMax(), res);\r
- for (int i = min; i < max; i++)\r
- {\r
- av.getColumnSelection().addElement(i);\r
- }\r
- sg.setStartRes(min);\r
- sg.setEndRes(max);\r
- }\r
- }\r
-\r
- ap.paintAlignment(true);\r
- }\r
-\r
- public void mouseReleased(MouseEvent evt)\r
- {\r
- mouseDragging = false;\r
-\r
- int res = (evt.getX() / av.getCharWidth()) + av.getStartRes();\r
-\r
- if (res > av.alignment.getWidth())\r
- {\r
- res = av.alignment.getWidth() - 1;\r
- }\r
-\r
- if (av.hasHiddenColumns)\r
- {\r
- res = av.getColumnSelection().adjustForHiddenColumns(res);\r
- }\r
-\r
- if (!stretchingGroup)\r
- {\r
- ap.paintAlignment(false);\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.paintAlignment(false);\r
- }\r
-\r
- public void mouseDragged(MouseEvent evt)\r
- {\r
- mouseDragging = true;\r
-\r
- int res = (evt.getX() / av.getCharWidth()) + av.getStartRes();\r
- if (res < 0)\r
- {\r
- res = 0;\r
- }\r
-\r
- if (av.hasHiddenColumns)\r
- {\r
- res = av.getColumnSelection().adjustForHiddenColumns(res);\r
- }\r
-\r
- if (res > av.alignment.getWidth())\r
- {\r
- res = av.alignment.getWidth() - 1;\r
- }\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
- if (res < sg.getStartRes())\r
- {\r
- sg.setStartRes(res);\r
- }\r
-\r
- int col;\r
- for (int i = min; i <= max; i++)\r
- {\r
- col = av.getColumnSelection().adjustForHiddenColumns(i);\r
-\r
- if ( (col < sg.getStartRes()) || (col > sg.getEndRes()))\r
- {\r
- av.getColumnSelection().removeElement(col);\r
- }\r
- else\r
- {\r
- av.getColumnSelection().addElement(col);\r
- }\r
- }\r
-\r
- ap.paintAlignment(false);\r
- }\r
- }\r
-\r
- public void mouseEntered(MouseEvent evt)\r
- {\r
- if (mouseDragging)\r
- {\r
- ap.seqPanel.scrollCanvas(null);\r
- }\r
- }\r
-\r
- public void mouseExited(MouseEvent evt)\r
- {\r
- if (mouseDragging)\r
- {\r
- ap.seqPanel.scrollCanvas(evt);\r
- }\r
- }\r
-\r
- public void mouseClicked(MouseEvent evt)\r
- {\r
-\r
- }\r
-\r
- public void mouseMoved(MouseEvent evt)\r
- {\r
- if (!av.hasHiddenColumns)\r
- {\r
- return;\r
- }\r
-\r
- int res = (evt.getX() / av.getCharWidth()) + av.getStartRes();\r
-\r
- res = av.getColumnSelection().adjustForHiddenColumns(res);\r
-\r
- reveal = null;\r
- for (int i = 0; i < av.getColumnSelection().getHiddenColumns().size(); i++)\r
- {\r
- int[] region = (int[]) av.getColumnSelection().getHiddenColumns().\r
- elementAt(i);\r
- if (res + 1 == region[0] || res - 1 == region[1])\r
- {\r
- reveal = region;\r
- break;\r
- }\r
- }\r
-\r
- repaint();\r
- }\r
-\r
- public void update(Graphics g)\r
- {\r
- paint(g);\r
- }\r
-\r
- public void paint(Graphics g)\r
- {\r
- drawScale(g, av.getStartRes(), av.getEndRes(), getSize().width,\r
- getSize().height);\r
- }\r
-\r
-// scalewidth will normally be screenwidth,\r
- public void drawScale(Graphics gg, int startx, int endx, int width,\r
- int height)\r
- {\r
- gg.setFont(av.getFont());\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
- if (av.hasHiddenColumns)\r
- {\r
- sel = av.getColumnSelection().findColumnPosition(sel);\r
- }\r
-\r
- if ( (sel >= startx) && (sel <= endx))\r
- {\r
- gg.fillRect( (sel - startx) * av.charWidth, 0, av.charWidth,\r
- getSize().height);\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
- String string;\r
- int maxX = 0;\r
-\r
- for (int i = scalestartx; i < endx; i += 5)\r
- {\r
- if ( (i % 10) == 0)\r
- {\r
- string = String.valueOf(av.getColumnSelection().adjustForHiddenColumns(\r
- i));\r
- if ( (i - startx - 1) * av.charWidth > maxX)\r
- {\r
- gg.drawString(string,\r
- (i - startx - 1) * av.charWidth, y);\r
- maxX = (i - startx + 1) * av.charWidth + fm.stringWidth(string);\r
- }\r
-\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)),\r
- y + (fm.getDescent() * 2));\r
-\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
- if (av.hasHiddenColumns)\r
- {\r
- gg.setColor(Color.blue);\r
- int res;\r
- if (av.getShowHiddenMarkers())\r
- {\r
- for (int i = 0; i < av.getColumnSelection().getHiddenColumns().size();\r
- i++)\r
- {\r
-\r
- res = av.getColumnSelection().findHiddenRegionPosition(i) -\r
- startx;\r
-\r
- if (res < 0 || res > endx - scalestartx)\r
- {\r
- continue;\r
- }\r
-\r
- gg.fillPolygon(new int[]\r
- {res * av.charWidth - av.charHeight / 4,\r
- res * av.charWidth + av.charHeight / 4,\r
- res * av.charWidth},\r
- new int[]\r
- {\r
- y - av.charHeight / 2, y - av.charHeight / 2,\r
- y + 8\r
- }, 3);\r
-\r
- }\r
- }\r
-\r
- if (reveal != null && reveal[0] > startx && reveal[0] < endx)\r
- {\r
- gg.drawString("Reveal Columns", reveal[0] * av.charWidth, 0);\r
- }\r
- }\r
-\r
- }\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.appletgui;
+
+import java.awt.*;
+import java.awt.event.*;
+
+import jalview.datamodel.*;
+
+public class ScalePanel
+ extends Panel implements MouseMotionListener, MouseListener
+{
+
+ protected int offy = 4;
+ public int width;
+
+ protected AlignViewport av;
+ AlignmentPanel ap;
+
+ boolean stretchingGroup = false;
+ int min; //used by mouseDragged to see if user
+ int max; //used by mouseDragged to see if user
+ boolean mouseDragging = false;
+ int[] reveal;
+
+ public ScalePanel(AlignViewport av, AlignmentPanel ap)
+ {
+ setLayout(null);
+ this.av = av;
+ this.ap = ap;
+
+ addMouseListener(this);
+ addMouseMotionListener(this);
+
+ }
+
+ public void mousePressed(MouseEvent evt)
+ {
+ int x = (evt.getX() / av.getCharWidth()) + av.getStartRes();
+ final int res;
+
+ if (av.hasHiddenColumns)
+ {
+ res = av.getColumnSelection().adjustForHiddenColumns(x);
+ }
+ else
+ {
+ res = x;
+ }
+
+ min = res;
+ max = res;
+ if ( (evt.getModifiers() & InputEvent.BUTTON3_MASK)
+ == InputEvent.BUTTON3_MASK)
+ {
+ PopupMenu pop = new PopupMenu();
+ if (reveal != null)
+ {
+ MenuItem item = new MenuItem("Reveal");
+ item.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ av.showColumn(reveal[0]);
+ reveal = null;
+ ap.paintAlignment(true);
+ if (ap.overviewPanel != null)
+ {
+ ap.overviewPanel.updateOverviewImage();
+ }
+ }
+ });
+ pop.add(item);
+
+ if (av.getColumnSelection().getHiddenColumns().size() > 1)
+ {
+ item = new MenuItem("Reveal All");
+ item.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ av.showAllHiddenColumns();
+ reveal = null;
+ ap.paintAlignment(true);
+ if (ap.overviewPanel != null)
+ {
+ ap.overviewPanel.updateOverviewImage();
+ }
+ }
+ });
+ pop.add(item);
+ }
+ this.add(pop);
+ pop.show(this, evt.getX(), evt.getY());
+ }
+ else if (av.getColumnSelection().contains(res))
+ {
+ MenuItem item = new MenuItem("Hide Columns");
+ item.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ av.hideColumns(res, res);
+ if (av.getSelectionGroup() != null
+ &&
+ av.getSelectionGroup().getSize() == av.alignment.getHeight())
+ {
+ av.setSelectionGroup(null);
+ }
+
+ ap.paintAlignment(true);
+ if (ap.overviewPanel != null)
+ {
+ ap.overviewPanel.updateOverviewImage();
+ }
+ }
+ });
+ pop.add(item);
+ this.add(pop);
+ pop.show(this, evt.getX(), evt.getY());
+ }
+ }
+ else // LEFT MOUSE TO SELECT
+ {
+ if (!evt.isControlDown() && !evt.isShiftDown())
+ {
+ av.getColumnSelection().clear();
+ }
+
+ av.getColumnSelection().addElement(res);
+ SequenceGroup sg = new SequenceGroup();
+ for (int i = 0; i < av.alignment.getSequences().size(); i++)
+ {
+ sg.addSequence(av.alignment.getSequenceAt(i), false);
+ }
+
+ sg.setStartRes(res);
+ sg.setEndRes(res);
+ av.setSelectionGroup(sg);
+
+ if (evt.isShiftDown())
+ {
+ int min = Math.min(av.getColumnSelection().getMin(), res);
+ int max = Math.max(av.getColumnSelection().getMax(), res);
+ for (int i = min; i < max; i++)
+ {
+ av.getColumnSelection().addElement(i);
+ }
+ sg.setStartRes(min);
+ sg.setEndRes(max);
+ }
+ }
+
+ ap.paintAlignment(true);
+ }
+
+ public void mouseReleased(MouseEvent evt)
+ {
+ mouseDragging = false;
+
+ int res = (evt.getX() / av.getCharWidth()) + av.getStartRes();
+
+ if (res > av.alignment.getWidth())
+ {
+ res = av.alignment.getWidth() - 1;
+ }
+
+ if (av.hasHiddenColumns)
+ {
+ res = av.getColumnSelection().adjustForHiddenColumns(res);
+ }
+
+ if (!stretchingGroup)
+ {
+ ap.paintAlignment(false);
+
+ return;
+ }
+
+ SequenceGroup sg = av.getSelectionGroup();
+
+ if (res > sg.getStartRes())
+ {
+ sg.setEndRes(res);
+ }
+ else if (res < sg.getStartRes())
+ {
+ sg.setStartRes(res);
+ }
+
+ stretchingGroup = false;
+ ap.paintAlignment(false);
+ }
+
+ public void mouseDragged(MouseEvent evt)
+ {
+ mouseDragging = true;
+
+ int res = (evt.getX() / av.getCharWidth()) + av.getStartRes();
+ if (res < 0)
+ {
+ res = 0;
+ }
+
+ if (av.hasHiddenColumns)
+ {
+ res = av.getColumnSelection().adjustForHiddenColumns(res);
+ }
+
+ if (res > av.alignment.getWidth())
+ {
+ res = av.alignment.getWidth() - 1;
+ }
+
+ if (res < min)
+ {
+ min = res;
+ }
+
+ if (res > max)
+ {
+ max = res;
+ }
+
+ SequenceGroup sg = av.getSelectionGroup();
+
+ if (sg != null)
+ {
+ stretchingGroup = true;
+
+ if (!av.getColumnSelection().contains(res))
+ {
+ av.getColumnSelection().addElement(res);
+ }
+
+ if (res > sg.getStartRes())
+ {
+ sg.setEndRes(res);
+ }
+ if (res < sg.getStartRes())
+ {
+ sg.setStartRes(res);
+ }
+
+ int col;
+ for (int i = min; i <= max; i++)
+ {
+ col = av.getColumnSelection().adjustForHiddenColumns(i);
+
+ if ( (col < sg.getStartRes()) || (col > sg.getEndRes()))
+ {
+ av.getColumnSelection().removeElement(col);
+ }
+ else
+ {
+ av.getColumnSelection().addElement(col);
+ }
+ }
+
+ ap.paintAlignment(false);
+ }
+ }
+
+ public void mouseEntered(MouseEvent evt)
+ {
+ if (mouseDragging)
+ {
+ ap.seqPanel.scrollCanvas(null);
+ }
+ }
+
+ public void mouseExited(MouseEvent evt)
+ {
+ if (mouseDragging)
+ {
+ ap.seqPanel.scrollCanvas(evt);
+ }
+ }
+
+ public void mouseClicked(MouseEvent evt)
+ {
+
+ }
+
+ public void mouseMoved(MouseEvent evt)
+ {
+ if (!av.hasHiddenColumns)
+ {
+ return;
+ }
+
+ int res = (evt.getX() / av.getCharWidth()) + av.getStartRes();
+
+ res = av.getColumnSelection().adjustForHiddenColumns(res);
+
+ reveal = null;
+ for (int i = 0; i < av.getColumnSelection().getHiddenColumns().size(); i++)
+ {
+ int[] region = (int[]) av.getColumnSelection().getHiddenColumns().
+ elementAt(i);
+ if (res + 1 == region[0] || res - 1 == region[1])
+ {
+ reveal = region;
+ break;
+ }
+ }
+
+ repaint();
+ }
+
+ public void update(Graphics g)
+ {
+ paint(g);
+ }
+
+ public void paint(Graphics g)
+ {
+ drawScale(g, av.getStartRes(), av.getEndRes(), getSize().width,
+ getSize().height);
+ }
+
+// scalewidth will normally be screenwidth,
+ public void drawScale(Graphics gg, int startx, int endx, int width,
+ int height)
+ {
+ gg.setFont(av.getFont());
+
+ //Fill in the background
+ gg.setColor(Color.white);
+ gg.fillRect(0, 0, width, height);
+ gg.setColor(Color.black);
+
+ //Fill the selected columns
+ ColumnSelection cs = av.getColumnSelection();
+ gg.setColor(new Color(220, 0, 0));
+
+ for (int i = 0; i < cs.size(); i++)
+ {
+ int sel = cs.columnAt(i);
+ if (av.hasHiddenColumns)
+ {
+ sel = av.getColumnSelection().findColumnPosition(sel);
+ }
+
+ if ( (sel >= startx) && (sel <= endx))
+ {
+ gg.fillRect( (sel - startx) * av.charWidth, 0, av.charWidth,
+ getSize().height);
+ }
+ }
+
+ // Draw the scale numbers
+ gg.setColor(Color.black);
+
+ int scalestartx = (startx / 10) * 10;
+
+ FontMetrics fm = gg.getFontMetrics(av.getFont());
+ int y = av.charHeight - fm.getDescent();
+
+ if ( (scalestartx % 10) == 0)
+ {
+ scalestartx += 5;
+ }
+
+ String string;
+ int maxX = 0;
+
+ for (int i = scalestartx; i < endx; i += 5)
+ {
+ if ( (i % 10) == 0)
+ {
+ string = String.valueOf(av.getColumnSelection().adjustForHiddenColumns(
+ i));
+ if ( (i - startx - 1) * av.charWidth > maxX)
+ {
+ gg.drawString(string,
+ (i - startx - 1) * av.charWidth, y);
+ maxX = (i - startx + 1) * av.charWidth + fm.stringWidth(string);
+ }
+
+ gg.drawLine( (int) ( ( (i - startx - 1) * av.charWidth) +
+ (av.charWidth / 2)), y + 2,
+ (int) ( ( (i - startx - 1) * av.charWidth) +
+ (av.charWidth / 2)),
+ y + (fm.getDescent() * 2));
+
+ }
+ else
+ {
+ gg.drawLine( (int) ( ( (i - startx - 1) * av.charWidth) +
+ (av.charWidth / 2)), y + fm.getDescent(),
+ (int) ( ( (i - startx - 1) * av.charWidth) +
+ (av.charWidth / 2)), y + (fm.getDescent() * 2));
+ }
+ }
+
+ if (av.hasHiddenColumns)
+ {
+ gg.setColor(Color.blue);
+ int res;
+ if (av.getShowHiddenMarkers())
+ {
+ for (int i = 0; i < av.getColumnSelection().getHiddenColumns().size();
+ i++)
+ {
+
+ res = av.getColumnSelection().findHiddenRegionPosition(i) -
+ startx;
+
+ if (res < 0 || res > endx - scalestartx)
+ {
+ continue;
+ }
+
+ gg.fillPolygon(new int[]
+ {res * av.charWidth - av.charHeight / 4,
+ res * av.charWidth + av.charHeight / 4,
+ res * av.charWidth},
+ new int[]
+ {
+ y - av.charHeight / 2, y - av.charHeight / 2,
+ y + 8
+ }, 3);
+
+ }
+ }
+
+ if (reveal != null && reveal[0] > startx && reveal[0] < endx)
+ {
+ gg.drawString("Reveal Columns", reveal[0] * av.charWidth, 0);
+ }
+ }
+
+ }
+
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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
-package jalview.appletgui;\r
-\r
-import java.awt.*;\r
-\r
-import jalview.datamodel.*;\r
-\r
-public class SeqCanvas\r
- extends Panel\r
-{\r
- FeatureRenderer fr;\r
- SequenceRenderer sr;\r
- Image img;\r
- Graphics gg;\r
- int imgWidth;\r
- int imgHeight;\r
-\r
- AlignViewport av;\r
-\r
- SearchResults searchResults = null;\r
-\r
- boolean fastPaint = false;\r
-\r
- int cursorX = 0;\r
- int cursorY = 0;\r
-\r
- public SeqCanvas(AlignViewport av)\r
- {\r
- this.av = av;\r
- fr = new FeatureRenderer(av);\r
- sr = new SequenceRenderer(av);\r
- PaintRefresher.Register(this, av.getSequenceSetId());\r
- }\r
-\r
- public AlignViewport getViewport()\r
- {\r
- return av;\r
- }\r
-\r
- public FeatureRenderer getFeatureRenderer()\r
- {\r
- return fr;\r
- }\r
-\r
- public SequenceRenderer getSequenceRenderer()\r
- {\r
- return sr;\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
- {\r
- int value = i;\r
- if (av.hasHiddenColumns)\r
- {\r
- value = av.getColumnSelection().adjustForHiddenColumns(value);\r
- }\r
-\r
- g.drawString(String.valueOf(value), (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
- void drawWestScale(Graphics g, int startx, int endx, int ypos)\r
- {\r
- FontMetrics fm = getFontMetrics(av.getFont());\r
- ypos += av.charHeight;\r
- if (av.hasHiddenColumns)\r
- {\r
- startx = av.getColumnSelection().adjustForHiddenColumns(startx);\r
- endx = av.getColumnSelection().adjustForHiddenColumns(endx);\r
- }\r
-\r
- int maxwidth = av.alignment.getWidth();\r
- if (av.hasHiddenColumns)\r
- {\r
- maxwidth = av.getColumnSelection().findColumnPosition(maxwidth) - 1;\r
- }\r
-\r
- // WEST SCALE\r
- for (int i = 0; i < av.alignment.getHeight(); i++)\r
- {\r
- SequenceI seq = av.alignment.getSequenceAt(i);\r
- int index = startx;\r
- int value = -1;\r
-\r
- while (index < endx)\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
-\r
- break;\r
- }\r
-\r
- if (value != -1)\r
- {\r
- int x = LABEL_WEST - fm.stringWidth(String.valueOf(value)) -\r
- av.charWidth / 2;\r
- g.drawString(value + "", x,\r
- (ypos + (i * av.charHeight)) - (av.charHeight / 5));\r
- }\r
- }\r
- }\r
-\r
- void drawEastScale(Graphics g, int startx, int endx, int ypos)\r
- {\r
- ypos += av.charHeight;\r
-\r
- if (av.hasHiddenColumns)\r
- {\r
- endx = av.getColumnSelection().adjustForHiddenColumns(endx);\r
- }\r
-\r
- SequenceI seq;\r
- // EAST SCALE\r
- for (int i = 0; i < av.alignment.getHeight(); i++)\r
- {\r
- seq = av.alignment.getSequenceAt(i);\r
- int index = endx;\r
- int value = -1;\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 = seq.findPosition(index);\r
-\r
- break;\r
- }\r
-\r
- if (value != -1)\r
- {\r
- g.drawString(String.valueOf(value), 0,\r
- (ypos + (i * av.charHeight)) - (av.charHeight / 5));\r
- }\r
- }\r
- }\r
-\r
- int lastsr = 0;\r
- void fastPaint(int horizontal, int vertical)\r
- {\r
- if (fastPaint || gg == null)\r
- {\r
- return;\r
- }\r
-\r
- // Its possible on certain browsers that the call to fastpaint\r
- // is faster than it can paint, so this check here catches\r
- // this possibility\r
- if (lastsr + horizontal != av.startRes)\r
- {\r
- horizontal = av.startRes - lastsr;\r
- }\r
-\r
- lastsr = av.startRes;\r
-\r
- fastPaint = true;\r
- gg.copyArea(horizontal * av.charWidth,\r
- vertical * av.charHeight,\r
- imgWidth - horizontal * av.charWidth,\r
- imgHeight - vertical * av.charHeight,\r
- -horizontal * av.charWidth,\r
- -vertical * av.charHeight);\r
-\r
- int sr = av.startRes, er = av.endRes, ss = av.startSeq, es = av.endSeq,\r
- transX = 0, 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
-\r
- else if (vertical > 0) // scroll down\r
- {\r
- ss = es - vertical;\r
- if (ss < av.startSeq) // ie scrolling too fast, more than a page at a time\r
- {\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 (es > av.endSeq)\r
- {\r
- es = av.endSeq;\r
- }\r
- }\r
-\r
- gg.translate(transX, transY);\r
-\r
- drawPanel(gg, sr, er, ss, es, 0);\r
- gg.translate( -transX, -transY);\r
-\r
- repaint();\r
-\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
- public void update(Graphics g)\r
- {\r
- paint(g);\r
- }\r
-\r
- public void paint(Graphics g)\r
- {\r
-\r
- if (img != null && (fastPaint\r
- || (getSize().width != g.getClipBounds().width)\r
- || (getSize().height != g.getClipBounds().height)))\r
- {\r
- g.drawImage(img, 0, 0, this);\r
- fastPaint = false;\r
- return;\r
- }\r
-\r
- if (fastPaint)\r
- {\r
- g.drawImage(img, 0, 0, this);\r
- fastPaint = false;\r
- return;\r
- }\r
-\r
- // this draws the whole of the alignment\r
- imgWidth = this.getSize().width;\r
- imgHeight = this.getSize().height;\r
-\r
- imgWidth -= imgWidth % av.charWidth;\r
- imgHeight -= imgHeight % av.charHeight;\r
-\r
- if (imgWidth < 1 || imgHeight < 1)\r
- {\r
- return;\r
- }\r
-\r
- if (img == null || imgWidth != img.getWidth(this) ||\r
- imgHeight != img.getHeight(this))\r
- {\r
- img = createImage(imgWidth, imgHeight);\r
- gg = img.getGraphics();\r
- gg.setFont(av.getFont());\r
- }\r
-\r
- gg.setColor(Color.white);\r
- gg.fillRect(0, 0, imgWidth, imgHeight);\r
-\r
- if (av.getWrapAlignment())\r
- {\r
- drawWrappedPanel(gg, imgWidth, imgHeight, av.startRes);\r
- }\r
- else\r
- {\r
- drawPanel(gg, av.startRes, av.endRes, av.startSeq, av.endSeq, 0);\r
- }\r
-\r
- g.drawImage(img, 0, 0, this);\r
-\r
- }\r
-\r
- int LABEL_WEST, LABEL_EAST;\r
- public int getWrappedCanvasWidth(int cwidth)\r
- {\r
- cwidth -= cwidth % av.charWidth;\r
-\r
- FontMetrics fm = getFontMetrics(av.getFont());\r
-\r
- LABEL_EAST = 0;\r
- LABEL_WEST = 0;\r
-\r
- if (av.scaleRightWrapped)\r
- {\r
- LABEL_EAST = fm.stringWidth(getMask());\r
- }\r
-\r
- if (av.scaleLeftWrapped)\r
- {\r
- LABEL_WEST = fm.stringWidth(getMask());\r
- }\r
-\r
- return (cwidth - LABEL_EAST - LABEL_WEST) / av.charWidth;\r
- }\r
-\r
- /**\r
- * Generates a string of zeroes.\r
- * @return String\r
- */\r
- String getMask()\r
- {\r
- String mask = "0";\r
- int maxWidth = 0;\r
- int tmp;\r
- for (int i = 0; i < av.alignment.getHeight(); i++)\r
- {\r
- tmp = av.alignment.getSequenceAt(i).getEnd();\r
- if (tmp > maxWidth)\r
- {\r
- maxWidth = tmp;\r
- }\r
- }\r
-\r
- for (int i = maxWidth; i > 0; i /= 10)\r
- {\r
- mask += "0";\r
- }\r
- return mask;\r
- }\r
-\r
- public void drawWrappedPanel(Graphics g, int canvasWidth, int canvasHeight,\r
- int startRes)\r
- {\r
- AlignmentI al = av.getAlignment();\r
-\r
- FontMetrics fm = getFontMetrics(av.getFont());\r
-\r
- if (av.scaleRightWrapped)\r
- {\r
- LABEL_EAST = fm.stringWidth(getMask());\r
- }\r
-\r
- if (av.scaleLeftWrapped)\r
- {\r
- LABEL_WEST = fm.stringWidth(getMask());\r
- }\r
-\r
- int hgap = av.charHeight;\r
- if (av.scaleAboveWrapped)\r
- {\r
- hgap += av.charHeight;\r
- }\r
-\r
- int cWidth = (canvasWidth - LABEL_EAST - LABEL_WEST) / av.charWidth;\r
- int cHeight = av.getAlignment().getHeight() * av.charHeight;\r
-\r
- av.setWrappedWidth(cWidth);\r
-\r
- av.endRes = av.startRes + cWidth;\r
-\r
- int endx;\r
- int ypos = hgap;\r
-\r
- int maxwidth = av.alignment.getWidth() - 1;\r
-\r
- if (av.hasHiddenColumns)\r
- {\r
- maxwidth = av.getColumnSelection().findColumnPosition(maxwidth) - 1;\r
- }\r
-\r
- while ( (ypos <= canvasHeight) && (startRes < maxwidth))\r
- {\r
- endx = startRes + cWidth - 1;\r
-\r
- if (endx > maxwidth)\r
- {\r
- endx = maxwidth;\r
- }\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, 0);\r
- drawEastScale(g, startRes, endx, ypos);\r
- g.translate( - (canvasWidth - LABEL_EAST), 0);\r
- }\r
-\r
- g.translate(LABEL_WEST, 0);\r
-\r
- if (av.scaleAboveWrapped)\r
- {\r
- drawNorthScale(g, startRes, endx, ypos);\r
- }\r
- if (av.hasHiddenColumns && av.showHiddenMarkers)\r
- {\r
- g.setColor(Color.blue);\r
- int res;\r
- for (int i = 0; i < av.getColumnSelection().getHiddenColumns().size();\r
- i++)\r
- {\r
- res = av.getColumnSelection().findHiddenRegionPosition(i) -\r
- startRes;\r
-\r
- if (res < 0 || res > endx - startRes)\r
- {\r
- continue;\r
- }\r
-\r
- gg.fillPolygon(new int[]\r
- {res * av.charWidth - av.charHeight / 4,\r
- res * av.charWidth + av.charHeight / 4,\r
- res * av.charWidth},\r
- new int[]\r
- {\r
- ypos - (av.charHeight / 2),\r
- ypos - (av.charHeight / 2),\r
- ypos - (av.charHeight / 2) + 8\r
- }, 3);\r
-\r
- }\r
- }\r
-\r
- if (g.getClip() == null)\r
- {\r
- g.setClip(0, 0, cWidth * av.charWidth, canvasHeight);\r
- }\r
-\r
- drawPanel(g, startRes, endx, 0, al.getHeight(), ypos);\r
- g.setClip(null);\r
-\r
- if (av.showAnnotation)\r
- {\r
- g.translate(0, cHeight + ypos + 4);\r
- if (annotations == null)\r
- {\r
- annotations = new AnnotationPanel(av);\r
- }\r
-\r
- annotations.drawComponent(g, startRes, endx + 1);\r
- g.translate(0, -cHeight - ypos - 4);\r
- }\r
- g.translate( -LABEL_WEST, 0);\r
-\r
- ypos += cHeight + getAnnotationHeight() + hgap;\r
-\r
- startRes += cWidth;\r
- }\r
-\r
- }\r
-\r
- AnnotationPanel annotations;\r
- int getAnnotationHeight()\r
- {\r
- if (!av.showAnnotation)\r
- {\r
- return 0;\r
- }\r
-\r
- if (annotations == null)\r
- {\r
- annotations = new AnnotationPanel(av);\r
- }\r
-\r
- return annotations.adjustPanelHeight();\r
- }\r
-\r
- void drawPanel(Graphics g1, int startRes, int endRes,\r
- int startSeq, int endSeq, int offset)\r
- {\r
- if (!av.hasHiddenColumns)\r
- {\r
- draw(g1, startRes, endRes, startSeq, endSeq, offset);\r
- }\r
- else\r
- {\r
- java.util.Vector regions = av.getColumnSelection().getHiddenColumns();\r
-\r
- int screenY = 0;\r
- int blockStart = startRes;\r
- int blockEnd = endRes;\r
-\r
- for (int i = 0; i < regions.size(); i++)\r
- {\r
- int[] region = (int[]) regions.elementAt(i);\r
- int hideStart = region[0];\r
- int hideEnd = region[1];\r
-\r
- if (hideStart <= blockStart)\r
- {\r
- blockStart += (hideEnd - hideStart) + 1;\r
- continue;\r
- }\r
-\r
- blockEnd = hideStart - 1;\r
-\r
- g1.translate(screenY * av.charWidth, 0);\r
-\r
- draw(g1, blockStart, blockEnd, startSeq, endSeq, offset);\r
-\r
- if (av.getShowHiddenMarkers())\r
- {\r
- g1.setColor(Color.blue);\r
- g1.drawLine( (blockEnd - blockStart + 1) * av.charWidth - 1,\r
- 0 + offset,\r
- (blockEnd - blockStart + 1) * av.charWidth - 1,\r
- (endSeq - startSeq) * av.charHeight + offset);\r
- }\r
-\r
- g1.translate( -screenY * av.charWidth, 0);\r
- screenY += blockEnd - blockStart + 1;\r
- blockStart = hideEnd + 1;\r
- }\r
-\r
- if (screenY <= (endRes - startRes))\r
- {\r
- blockEnd = blockStart + (endRes - startRes) - screenY;\r
- g1.translate(screenY * av.charWidth, 0);\r
- draw(g1, blockStart, blockEnd, startSeq, endSeq, offset);\r
-\r
- g1.translate( -screenY * av.charWidth, 0);\r
- }\r
- }\r
-\r
- }\r
-\r
- //int startRes, int endRes, int startSeq, int endSeq, int x, int y,\r
- // int x1, int x2, int y1, int y2, int startx, int starty,\r
- void draw(Graphics g,\r
- int startRes, int endRes,\r
- int startSeq, int endSeq,\r
- int offset)\r
- {\r
- g.setFont(av.getFont());\r
- sr.prepare(g, av.renderGaps);\r
-\r
- SequenceI nextSeq;\r
-\r
- /// First draw the sequences\r
- /////////////////////////////\r
- for (int i = startSeq; i < endSeq; i++)\r
- {\r
- nextSeq = av.alignment.getSequenceAt(i);\r
-\r
- if (nextSeq == null)\r
- {\r
- continue;\r
- }\r
-\r
- sr.drawSequence(nextSeq, av.alignment.findAllGroups(nextSeq),\r
- startRes, endRes,\r
- offset + ( (i - startSeq) * av.charHeight));\r
-\r
- if (av.showSequenceFeatures)\r
- {\r
- fr.drawSequence(g, nextSeq, startRes, endRes,\r
- offset + ( (i - startSeq) * av.charHeight));\r
- }\r
-\r
- /// Highlight search Results once all sequences have been drawn\r
- //////////////////////////////////////////////////////////\r
- if (searchResults != null)\r
- {\r
- int[] visibleResults = searchResults.getResults(nextSeq, startRes,\r
- endRes);\r
- if (visibleResults != null)\r
- {\r
- for (int r = 0; r < visibleResults.length; r += 2)\r
- {\r
- sr.drawHighlightedText(nextSeq, visibleResults[r],\r
- visibleResults[r + 1],\r
- (visibleResults[r] - startRes) *\r
- av.charWidth,\r
- offset + ( (i - startSeq) * av.charHeight));\r
- }\r
- }\r
- }\r
-\r
- if (av.cursorMode && cursorY == i\r
- && cursorX >= startRes && cursorX <= endRes)\r
- {\r
- sr.drawCursor(nextSeq, cursorX, (cursorX - startRes) * av.charWidth,\r
- offset + ( (i - startSeq) * av.charHeight));\r
- }\r
- }\r
-\r
- if (av.getSelectionGroup() != null || av.alignment.getGroups().size() > 0)\r
- {\r
- drawGroupsBoundaries(g, startRes, endRes, startSeq, endSeq, offset);\r
- }\r
-\r
- }\r
-\r
- void drawGroupsBoundaries(Graphics g,\r
- int startRes, int endRes,\r
- int startSeq, int endSeq,\r
- int offset)\r
- {\r
- //\r
- /////////////////////////////////////\r
- // Now outline any areas if necessary\r
- /////////////////////////////////////\r
- SequenceGroup group = av.getSelectionGroup();\r
-\r
- int sx = -1;\r
- int sy = -1;\r
- int ex = -1;\r
- int groupIndex = -1;\r
-\r
- if ( (group == null) && (av.alignment.getGroups().size() > 0))\r
- {\r
- group = (SequenceGroup) av.alignment.getGroups().elementAt(0);\r
- groupIndex = 0;\r
- }\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
- int alHeight = av.alignment.getHeight() - 1;\r
-\r
- for (i = startSeq; i < endSeq; i++)\r
- {\r
- sx = (group.getStartRes() - startRes) * av.charWidth;\r
- sy = offset + ( (i - startSeq) * av.charHeight);\r
- ex = ( ( (group.getEndRes() + 1) - group.getStartRes()) *\r
- av.charWidth) -\r
- 1;\r
-\r
- if (sx + ex < 0 || sx > imgWidth)\r
- {\r
- continue;\r
- }\r
-\r
- if ( (sx <= (endRes - startRes) * av.charWidth) &&\r
- group.getSequences(null).\r
- contains(av.alignment.getSequenceAt(i)))\r
- {\r
- if ( (bottom == -1) &&\r
- (i >= alHeight ||\r
- !group.getSequences(null).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.getSequences(null).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.setColor(Color.red);\r
- }\r
- else\r
- {\r
- g.setColor(group.getOutlineColour());\r
- }\r
- }\r
- }\r
- else\r
- {\r
- if (inGroup)\r
- {\r
- if (sx >= 0 && sx < imgWidth)\r
- {\r
- g.drawLine(sx, oldY, sx, sy);\r
- }\r
-\r
- if (sx + ex < imgWidth)\r
- {\r
- g.drawLine(sx + ex, oldY, sx + ex, sy);\r
- }\r
-\r
- if (sx < 0)\r
- {\r
- ex += sx;\r
- sx = 0;\r
- }\r
-\r
- if (sx + ex > imgWidth)\r
- {\r
- ex = imgWidth;\r
- }\r
-\r
- else if (sx + ex >= (endRes - startRes + 1) * av.charWidth)\r
- {\r
- ex = (endRes - startRes + 1) * av.charWidth;\r
- }\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
- if (inGroup)\r
- {\r
- sy = offset + ( (i - startSeq) * av.charHeight);\r
- if (sx >= 0 && sx < imgWidth)\r
- {\r
- g.drawLine(sx, oldY, sx, sy);\r
- }\r
-\r
- if (sx + ex < imgWidth)\r
- {\r
- g.drawLine(sx + ex, oldY, sx + ex, sy);\r
- }\r
-\r
- if (sx < 0)\r
- {\r
- ex += sx;\r
- sx = 0;\r
- }\r
-\r
- if (sx + ex > imgWidth)\r
- {\r
- ex = imgWidth;\r
- }\r
- else if (sx + ex >= (endRes - startRes + 1) * av.charWidth)\r
- {\r
- ex = (endRes - startRes + 1) * av.charWidth;\r
- }\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
- inGroup = false;\r
- }\r
-\r
- groupIndex++;\r
-\r
- if (groupIndex >= av.alignment.getGroups().size())\r
- {\r
- break;\r
- }\r
-\r
- group = (SequenceGroup) av.alignment.getGroups().elementAt(groupIndex);\r
- }\r
- while (groupIndex < av.alignment.getGroups().size());\r
-\r
- }\r
- }\r
-\r
- public void highlightSearchResults(SearchResults results)\r
- {\r
- searchResults = results;\r
-\r
- repaint();\r
- }\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.appletgui;
+
+import java.awt.*;
+
+import jalview.datamodel.*;
+
+public class SeqCanvas
+ extends Panel
+{
+ FeatureRenderer fr;
+ SequenceRenderer sr;
+ Image img;
+ Graphics gg;
+ int imgWidth;
+ int imgHeight;
+
+ AlignViewport av;
+
+ SearchResults searchResults = null;
+
+ boolean fastPaint = false;
+
+ int cursorX = 0;
+ int cursorY = 0;
+
+ public SeqCanvas(AlignViewport av)
+ {
+ this.av = av;
+ fr = new FeatureRenderer(av);
+ sr = new SequenceRenderer(av);
+ PaintRefresher.Register(this, av.getSequenceSetId());
+ }
+
+ public AlignViewport getViewport()
+ {
+ return av;
+ }
+
+ public FeatureRenderer getFeatureRenderer()
+ {
+ return fr;
+ }
+
+ public SequenceRenderer getSequenceRenderer()
+ {
+ return sr;
+ }
+
+ void drawNorthScale(Graphics g, int startx, int endx, int ypos)
+ {
+ int scalestartx = startx - startx % 10 + 10;
+
+ g.setColor(Color.black);
+
+ // NORTH SCALE
+ for (int i = scalestartx; i < endx; i += 10)
+ {
+ int value = i;
+ if (av.hasHiddenColumns)
+ {
+ value = av.getColumnSelection().adjustForHiddenColumns(value);
+ }
+
+ g.drawString(String.valueOf(value), (i - startx - 1) * av.charWidth,
+ ypos - (av.charHeight / 2));
+
+ g.drawLine( ( (i - startx - 1) * av.charWidth) + (av.charWidth / 2),
+ (ypos + 2) - (av.charHeight / 2),
+ ( (i - startx - 1) * av.charWidth) + (av.charWidth / 2), ypos -
+ 2);
+ }
+ }
+
+ void drawWestScale(Graphics g, int startx, int endx, int ypos)
+ {
+ FontMetrics fm = getFontMetrics(av.getFont());
+ ypos += av.charHeight;
+ if (av.hasHiddenColumns)
+ {
+ startx = av.getColumnSelection().adjustForHiddenColumns(startx);
+ endx = av.getColumnSelection().adjustForHiddenColumns(endx);
+ }
+
+ int maxwidth = av.alignment.getWidth();
+ if (av.hasHiddenColumns)
+ {
+ maxwidth = av.getColumnSelection().findColumnPosition(maxwidth) - 1;
+ }
+
+ // WEST SCALE
+ for (int i = 0; i < av.alignment.getHeight(); i++)
+ {
+ SequenceI seq = av.alignment.getSequenceAt(i);
+ int index = startx;
+ int value = -1;
+
+ while (index < endx)
+ {
+ if (jalview.util.Comparison.isGap(seq.getCharAt(index)))
+ {
+ index++;
+
+ continue;
+ }
+
+ value = av.alignment.getSequenceAt(i).findPosition(index);
+
+ break;
+ }
+
+ if (value != -1)
+ {
+ int x = LABEL_WEST - fm.stringWidth(String.valueOf(value)) -
+ av.charWidth / 2;
+ g.drawString(value + "", x,
+ (ypos + (i * av.charHeight)) - (av.charHeight / 5));
+ }
+ }
+ }
+
+ void drawEastScale(Graphics g, int startx, int endx, int ypos)
+ {
+ ypos += av.charHeight;
+
+ if (av.hasHiddenColumns)
+ {
+ endx = av.getColumnSelection().adjustForHiddenColumns(endx);
+ }
+
+ SequenceI seq;
+ // EAST SCALE
+ for (int i = 0; i < av.alignment.getHeight(); i++)
+ {
+ seq = av.alignment.getSequenceAt(i);
+ int index = endx;
+ int value = -1;
+
+ while (index > startx)
+ {
+ if (jalview.util.Comparison.isGap(seq.getCharAt(index)))
+ {
+ index--;
+
+ continue;
+ }
+
+ value = seq.findPosition(index);
+
+ break;
+ }
+
+ if (value != -1)
+ {
+ g.drawString(String.valueOf(value), 0,
+ (ypos + (i * av.charHeight)) - (av.charHeight / 5));
+ }
+ }
+ }
+
+ int lastsr = 0;
+ void fastPaint(int horizontal, int vertical)
+ {
+ if (fastPaint || gg == null)
+ {
+ return;
+ }
+
+ // Its possible on certain browsers that the call to fastpaint
+ // is faster than it can paint, so this check here catches
+ // this possibility
+ if (lastsr + horizontal != av.startRes)
+ {
+ horizontal = av.startRes - lastsr;
+ }
+
+ lastsr = av.startRes;
+
+ fastPaint = true;
+ gg.copyArea(horizontal * av.charWidth,
+ vertical * av.charHeight,
+ imgWidth - horizontal * av.charWidth,
+ imgHeight - vertical * av.charHeight,
+ -horizontal * av.charWidth,
+ -vertical * av.charHeight);
+
+ int sr = av.startRes, er = av.endRes, ss = av.startSeq, es = av.endSeq,
+ transX = 0, transY = 0;
+
+ if (horizontal > 0) // scrollbar pulled right, image to the left
+ {
+ transX = (er - sr - horizontal) * av.charWidth;
+ sr = er - horizontal;
+ }
+ else if (horizontal < 0)
+ {
+ er = sr - horizontal;
+ }
+
+ else if (vertical > 0) // scroll down
+ {
+ ss = es - vertical;
+ if (ss < av.startSeq) // ie scrolling too fast, more than a page at a time
+ {
+ ss = av.startSeq;
+ }
+ else
+ {
+ transY = imgHeight - vertical * av.charHeight;
+ }
+ }
+ else if (vertical < 0)
+ {
+ es = ss - vertical;
+ if (es > av.endSeq)
+ {
+ es = av.endSeq;
+ }
+ }
+
+ gg.translate(transX, transY);
+
+ drawPanel(gg, sr, er, ss, es, 0);
+ gg.translate( -transX, -transY);
+
+ repaint();
+
+ }
+
+ /**
+ * Definitions of startx and endx (hopefully):
+ * SMJS This is what I'm working towards!
+ * startx is the first residue (starting at 0) to display.
+ * endx is the last residue to display (starting at 0).
+ * starty is the first sequence to display (starting at 0).
+ * endy is the last sequence to display (starting at 0).
+ * NOTE 1: The av limits are set in setFont in this class and
+ * in the adjustment listener in SeqPanel when the scrollbars move.
+ */
+ public void update(Graphics g)
+ {
+ paint(g);
+ }
+
+ public void paint(Graphics g)
+ {
+
+ if (img != null && (fastPaint
+ || (getSize().width != g.getClipBounds().width)
+ || (getSize().height != g.getClipBounds().height)))
+ {
+ g.drawImage(img, 0, 0, this);
+ fastPaint = false;
+ return;
+ }
+
+ if (fastPaint)
+ {
+ g.drawImage(img, 0, 0, this);
+ fastPaint = false;
+ return;
+ }
+
+ // this draws the whole of the alignment
+ imgWidth = this.getSize().width;
+ imgHeight = this.getSize().height;
+
+ imgWidth -= imgWidth % av.charWidth;
+ imgHeight -= imgHeight % av.charHeight;
+
+ if (imgWidth < 1 || imgHeight < 1)
+ {
+ return;
+ }
+
+ if (img == null || imgWidth != img.getWidth(this) ||
+ imgHeight != img.getHeight(this))
+ {
+ img = createImage(imgWidth, imgHeight);
+ gg = img.getGraphics();
+ gg.setFont(av.getFont());
+ }
+
+ gg.setColor(Color.white);
+ gg.fillRect(0, 0, imgWidth, imgHeight);
+
+ if (av.getWrapAlignment())
+ {
+ drawWrappedPanel(gg, imgWidth, imgHeight, av.startRes);
+ }
+ else
+ {
+ drawPanel(gg, av.startRes, av.endRes, av.startSeq, av.endSeq, 0);
+ }
+
+ g.drawImage(img, 0, 0, this);
+
+ }
+
+ int LABEL_WEST, LABEL_EAST;
+ public int getWrappedCanvasWidth(int cwidth)
+ {
+ cwidth -= cwidth % av.charWidth;
+
+ FontMetrics fm = getFontMetrics(av.getFont());
+
+ LABEL_EAST = 0;
+ LABEL_WEST = 0;
+
+ if (av.scaleRightWrapped)
+ {
+ LABEL_EAST = fm.stringWidth(getMask());
+ }
+
+ if (av.scaleLeftWrapped)
+ {
+ LABEL_WEST = fm.stringWidth(getMask());
+ }
+
+ return (cwidth - LABEL_EAST - LABEL_WEST) / av.charWidth;
+ }
+
+ /**
+ * Generates a string of zeroes.
+ * @return String
+ */
+ String getMask()
+ {
+ String mask = "0";
+ int maxWidth = 0;
+ int tmp;
+ for (int i = 0; i < av.alignment.getHeight(); i++)
+ {
+ tmp = av.alignment.getSequenceAt(i).getEnd();
+ if (tmp > maxWidth)
+ {
+ maxWidth = tmp;
+ }
+ }
+
+ for (int i = maxWidth; i > 0; i /= 10)
+ {
+ mask += "0";
+ }
+ return mask;
+ }
+
+ public void drawWrappedPanel(Graphics g, int canvasWidth, int canvasHeight,
+ int startRes)
+ {
+ AlignmentI al = av.getAlignment();
+
+ FontMetrics fm = getFontMetrics(av.getFont());
+
+ if (av.scaleRightWrapped)
+ {
+ LABEL_EAST = fm.stringWidth(getMask());
+ }
+
+ if (av.scaleLeftWrapped)
+ {
+ LABEL_WEST = fm.stringWidth(getMask());
+ }
+
+ int hgap = av.charHeight;
+ if (av.scaleAboveWrapped)
+ {
+ hgap += av.charHeight;
+ }
+
+ int cWidth = (canvasWidth - LABEL_EAST - LABEL_WEST) / av.charWidth;
+ int cHeight = av.getAlignment().getHeight() * av.charHeight;
+
+ av.setWrappedWidth(cWidth);
+
+ av.endRes = av.startRes + cWidth;
+
+ int endx;
+ int ypos = hgap;
+
+ int maxwidth = av.alignment.getWidth() - 1;
+
+ if (av.hasHiddenColumns)
+ {
+ maxwidth = av.getColumnSelection().findColumnPosition(maxwidth) - 1;
+ }
+
+ while ( (ypos <= canvasHeight) && (startRes < maxwidth))
+ {
+ endx = startRes + cWidth - 1;
+
+ if (endx > maxwidth)
+ {
+ endx = maxwidth;
+ }
+
+ g.setColor(Color.black);
+
+ if (av.scaleLeftWrapped)
+ {
+ drawWestScale(g, startRes, endx, ypos);
+ }
+
+ if (av.scaleRightWrapped)
+ {
+ g.translate(canvasWidth - LABEL_EAST, 0);
+ drawEastScale(g, startRes, endx, ypos);
+ g.translate( - (canvasWidth - LABEL_EAST), 0);
+ }
+
+ g.translate(LABEL_WEST, 0);
+
+ if (av.scaleAboveWrapped)
+ {
+ drawNorthScale(g, startRes, endx, ypos);
+ }
+ if (av.hasHiddenColumns && av.showHiddenMarkers)
+ {
+ g.setColor(Color.blue);
+ int res;
+ for (int i = 0; i < av.getColumnSelection().getHiddenColumns().size();
+ i++)
+ {
+ res = av.getColumnSelection().findHiddenRegionPosition(i) -
+ startRes;
+
+ if (res < 0 || res > endx - startRes)
+ {
+ continue;
+ }
+
+ gg.fillPolygon(new int[]
+ {res * av.charWidth - av.charHeight / 4,
+ res * av.charWidth + av.charHeight / 4,
+ res * av.charWidth},
+ new int[]
+ {
+ ypos - (av.charHeight / 2),
+ ypos - (av.charHeight / 2),
+ ypos - (av.charHeight / 2) + 8
+ }, 3);
+
+ }
+ }
+
+ if (g.getClip() == null)
+ {
+ g.setClip(0, 0, cWidth * av.charWidth, canvasHeight);
+ }
+
+ drawPanel(g, startRes, endx, 0, al.getHeight(), ypos);
+ g.setClip(null);
+
+ if (av.showAnnotation)
+ {
+ g.translate(0, cHeight + ypos + 4);
+ if (annotations == null)
+ {
+ annotations = new AnnotationPanel(av);
+ }
+
+ annotations.drawComponent(g, startRes, endx + 1);
+ g.translate(0, -cHeight - ypos - 4);
+ }
+ g.translate( -LABEL_WEST, 0);
+
+ ypos += cHeight + getAnnotationHeight() + hgap;
+
+ startRes += cWidth;
+ }
+
+ }
+
+ AnnotationPanel annotations;
+ int getAnnotationHeight()
+ {
+ if (!av.showAnnotation)
+ {
+ return 0;
+ }
+
+ if (annotations == null)
+ {
+ annotations = new AnnotationPanel(av);
+ }
+
+ return annotations.adjustPanelHeight();
+ }
+
+ void drawPanel(Graphics g1, int startRes, int endRes,
+ int startSeq, int endSeq, int offset)
+ {
+ if (!av.hasHiddenColumns)
+ {
+ draw(g1, startRes, endRes, startSeq, endSeq, offset);
+ }
+ else
+ {
+ java.util.Vector regions = av.getColumnSelection().getHiddenColumns();
+
+ int screenY = 0;
+ int blockStart = startRes;
+ int blockEnd = endRes;
+
+ for (int i = 0; i < regions.size(); i++)
+ {
+ int[] region = (int[]) regions.elementAt(i);
+ int hideStart = region[0];
+ int hideEnd = region[1];
+
+ if (hideStart <= blockStart)
+ {
+ blockStart += (hideEnd - hideStart) + 1;
+ continue;
+ }
+
+ blockEnd = hideStart - 1;
+
+ g1.translate(screenY * av.charWidth, 0);
+
+ draw(g1, blockStart, blockEnd, startSeq, endSeq, offset);
+
+ if (av.getShowHiddenMarkers())
+ {
+ g1.setColor(Color.blue);
+ g1.drawLine( (blockEnd - blockStart + 1) * av.charWidth - 1,
+ 0 + offset,
+ (blockEnd - blockStart + 1) * av.charWidth - 1,
+ (endSeq - startSeq) * av.charHeight + offset);
+ }
+
+ g1.translate( -screenY * av.charWidth, 0);
+ screenY += blockEnd - blockStart + 1;
+ blockStart = hideEnd + 1;
+ }
+
+ if (screenY <= (endRes - startRes))
+ {
+ blockEnd = blockStart + (endRes - startRes) - screenY;
+ g1.translate(screenY * av.charWidth, 0);
+ draw(g1, blockStart, blockEnd, startSeq, endSeq, offset);
+
+ g1.translate( -screenY * av.charWidth, 0);
+ }
+ }
+
+ }
+
+ //int startRes, int endRes, int startSeq, int endSeq, int x, int y,
+ // int x1, int x2, int y1, int y2, int startx, int starty,
+ void draw(Graphics g,
+ int startRes, int endRes,
+ int startSeq, int endSeq,
+ int offset)
+ {
+ g.setFont(av.getFont());
+ sr.prepare(g, av.renderGaps);
+
+ SequenceI nextSeq;
+
+ /// First draw the sequences
+ /////////////////////////////
+ for (int i = startSeq; i < endSeq; i++)
+ {
+ nextSeq = av.alignment.getSequenceAt(i);
+
+ if (nextSeq == null)
+ {
+ continue;
+ }
+
+ sr.drawSequence(nextSeq, av.alignment.findAllGroups(nextSeq),
+ startRes, endRes,
+ offset + ( (i - startSeq) * av.charHeight));
+
+ if (av.showSequenceFeatures)
+ {
+ fr.drawSequence(g, nextSeq, startRes, endRes,
+ offset + ( (i - startSeq) * av.charHeight));
+ }
+
+ /// Highlight search Results once all sequences have been drawn
+ //////////////////////////////////////////////////////////
+ if (searchResults != null)
+ {
+ int[] visibleResults = searchResults.getResults(nextSeq, startRes,
+ endRes);
+ if (visibleResults != null)
+ {
+ for (int r = 0; r < visibleResults.length; r += 2)
+ {
+ sr.drawHighlightedText(nextSeq, visibleResults[r],
+ visibleResults[r + 1],
+ (visibleResults[r] - startRes) *
+ av.charWidth,
+ offset + ( (i - startSeq) * av.charHeight));
+ }
+ }
+ }
+
+ if (av.cursorMode && cursorY == i
+ && cursorX >= startRes && cursorX <= endRes)
+ {
+ sr.drawCursor(nextSeq, cursorX, (cursorX - startRes) * av.charWidth,
+ offset + ( (i - startSeq) * av.charHeight));
+ }
+ }
+
+ if (av.getSelectionGroup() != null || av.alignment.getGroups().size() > 0)
+ {
+ drawGroupsBoundaries(g, startRes, endRes, startSeq, endSeq, offset);
+ }
+
+ }
+
+ void drawGroupsBoundaries(Graphics g,
+ int startRes, int endRes,
+ int startSeq, int endSeq,
+ int offset)
+ {
+ //
+ /////////////////////////////////////
+ // Now outline any areas if necessary
+ /////////////////////////////////////
+ SequenceGroup group = av.getSelectionGroup();
+
+ int sx = -1;
+ int sy = -1;
+ int ex = -1;
+ int groupIndex = -1;
+
+ if ( (group == null) && (av.alignment.getGroups().size() > 0))
+ {
+ group = (SequenceGroup) av.alignment.getGroups().elementAt(0);
+ groupIndex = 0;
+ }
+
+ if (group != null)
+ {
+ do
+ {
+ int oldY = -1;
+ int i = 0;
+ boolean inGroup = false;
+ int top = -1;
+ int bottom = -1;
+ int alHeight = av.alignment.getHeight() - 1;
+
+ for (i = startSeq; i < endSeq; i++)
+ {
+ sx = (group.getStartRes() - startRes) * av.charWidth;
+ sy = offset + ( (i - startSeq) * av.charHeight);
+ ex = ( ( (group.getEndRes() + 1) - group.getStartRes()) *
+ av.charWidth) -
+ 1;
+
+ if (sx + ex < 0 || sx > imgWidth)
+ {
+ continue;
+ }
+
+ if ( (sx <= (endRes - startRes) * av.charWidth) &&
+ group.getSequences(null).
+ contains(av.alignment.getSequenceAt(i)))
+ {
+ if ( (bottom == -1) &&
+ (i >= alHeight ||
+ !group.getSequences(null).contains(
+ av.alignment.getSequenceAt(i + 1))))
+ {
+ bottom = sy + av.charHeight;
+ }
+
+ if (!inGroup)
+ {
+ if ( ( (top == -1) && (i == 0)) ||
+ !group.getSequences(null).contains(
+ av.alignment.getSequenceAt(i - 1)))
+ {
+ top = sy;
+ }
+
+ oldY = sy;
+ inGroup = true;
+
+ if (group == av.getSelectionGroup())
+ {
+ g.setColor(Color.red);
+ }
+ else
+ {
+ g.setColor(group.getOutlineColour());
+ }
+ }
+ }
+ else
+ {
+ if (inGroup)
+ {
+ if (sx >= 0 && sx < imgWidth)
+ {
+ g.drawLine(sx, oldY, sx, sy);
+ }
+
+ if (sx + ex < imgWidth)
+ {
+ g.drawLine(sx + ex, oldY, sx + ex, sy);
+ }
+
+ if (sx < 0)
+ {
+ ex += sx;
+ sx = 0;
+ }
+
+ if (sx + ex > imgWidth)
+ {
+ ex = imgWidth;
+ }
+
+ else if (sx + ex >= (endRes - startRes + 1) * av.charWidth)
+ {
+ ex = (endRes - startRes + 1) * av.charWidth;
+ }
+
+ if (top != -1)
+ {
+ g.drawLine(sx, top, sx + ex, top);
+ top = -1;
+ }
+
+ if (bottom != -1)
+ {
+ g.drawLine(sx, bottom, sx + ex, bottom);
+ bottom = -1;
+ }
+
+ inGroup = false;
+ }
+ }
+ }
+
+ if (inGroup)
+ {
+ sy = offset + ( (i - startSeq) * av.charHeight);
+ if (sx >= 0 && sx < imgWidth)
+ {
+ g.drawLine(sx, oldY, sx, sy);
+ }
+
+ if (sx + ex < imgWidth)
+ {
+ g.drawLine(sx + ex, oldY, sx + ex, sy);
+ }
+
+ if (sx < 0)
+ {
+ ex += sx;
+ sx = 0;
+ }
+
+ if (sx + ex > imgWidth)
+ {
+ ex = imgWidth;
+ }
+ else if (sx + ex >= (endRes - startRes + 1) * av.charWidth)
+ {
+ ex = (endRes - startRes + 1) * av.charWidth;
+ }
+
+ if (top != -1)
+ {
+ g.drawLine(sx, top, sx + ex, top);
+ top = -1;
+ }
+
+ if (bottom != -1)
+ {
+ g.drawLine(sx, bottom - 1, sx + ex, bottom - 1);
+ bottom = -1;
+ }
+
+ inGroup = false;
+ }
+
+ groupIndex++;
+
+ if (groupIndex >= av.alignment.getGroups().size())
+ {
+ break;
+ }
+
+ group = (SequenceGroup) av.alignment.getGroups().elementAt(groupIndex);
+ }
+ while (groupIndex < av.alignment.getGroups().size());
+
+ }
+ }
+
+ public void highlightSearchResults(SearchResults results)
+ {
+ searchResults = results;
+
+ repaint();
+ }
+
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.appletgui;
import java.util.*;
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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
-package jalview.appletgui;\r
-\r
-import java.awt.*;\r
-\r
-import jalview.datamodel.*;\r
-import jalview.schemes.*;\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
- boolean forOverview = false;\r
-\r
- public SequenceRenderer(AlignViewport av)\r
- {\r
- this.av = av;\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param b DOCUMENT ME!\r
- */\r
- public void prepare(Graphics g, boolean renderGaps)\r
- {\r
- graphics = g;\r
- fm = g.getFontMetrics();\r
-\r
- this.renderGaps = renderGaps;\r
- }\r
-\r
- public Color getResidueBoxColour(SequenceI seq, int i)\r
- {\r
- allGroups = av.alignment.findAllGroups(seq);\r
-\r
- if (inCurrentSequenceGroup(i))\r
- {\r
- if (currentSequenceGroup.getDisplayBoxes())\r
- {\r
- getBoxColour(currentSequenceGroup.cs, seq, i);\r
- }\r
- }\r
- else if (av.getShowBoxes())\r
- {\r
- getBoxColour(av.globalColourScheme, seq, i);\r
- }\r
-\r
- return resBoxColour;\r
- }\r
-\r
- void getBoxColour(ColourSchemeI cs, SequenceI seq, int i)\r
- {\r
- if (cs != null)\r
- {\r
- resBoxColour = cs.findColour(seq.getCharAt(i), i);\r
- }\r
- else if (forOverview && !jalview.util.Comparison.isGap(seq.getCharAt(i)))\r
- {\r
- resBoxColour = Color.lightGray;\r
- }\r
- else\r
- {\r
- resBoxColour = Color.white;\r
- }\r
-\r
- }\r
-\r
- public Color findSequenceColour(SequenceI seq, int i)\r
- {\r
- allGroups = av.alignment.findAllGroups(seq);\r
- drawBoxes(seq, i, i, 0);\r
- return resBoxColour;\r
- }\r
-\r
- public void drawSequence(SequenceI seq, SequenceGroup[] sg,\r
- int start, int end, int y1)\r
- {\r
- if (seq == null)\r
- {\r
- return;\r
- }\r
-\r
- allGroups = sg;\r
-\r
- drawBoxes(seq, start, end, y1);\r
-\r
- if (av.validCharWidth)\r
- {\r
- drawText(seq, start, end, y1);\r
- }\r
- }\r
-\r
- public void drawBoxes(SequenceI seq, int start, int end, int y1)\r
- {\r
- int i = start;\r
- int length = seq.getLength();\r
-\r
- int curStart = -1;\r
- int curWidth = av.charWidth;\r
-\r
- Color tempColour = null;\r
- while (i <= end)\r
- {\r
- resBoxColour = Color.white;\r
- if (i < length)\r
- {\r
- if (inCurrentSequenceGroup(i))\r
- {\r
- if (currentSequenceGroup.getDisplayBoxes())\r
- {\r
- getBoxColour(currentSequenceGroup.cs, seq, i);\r
- }\r
- }\r
- else if (av.getShowBoxes())\r
- {\r
- getBoxColour(av.getGlobalColourScheme(), seq, i);\r
- }\r
- }\r
-\r
- if (resBoxColour != tempColour)\r
- {\r
- if (tempColour != null)\r
- {\r
- graphics.fillRect(av.charWidth * (curStart - start), y1, curWidth,\r
- av.charHeight);\r
- }\r
- graphics.setColor(resBoxColour);\r
-\r
- curStart = i;\r
- curWidth = av.charWidth;\r
- tempColour = resBoxColour;\r
-\r
- }\r
- else\r
- {\r
- curWidth += av.charWidth;\r
- }\r
-\r
- i++;\r
- }\r
-\r
- graphics.fillRect(av.charWidth * (curStart - start), y1, curWidth,\r
- av.charHeight);\r
- }\r
-\r
- public void drawText(SequenceI seq, int start, int end, int y1)\r
- {\r
- Font boldFont = null;\r
- boolean bold = false;\r
- if (av.upperCasebold)\r
- {\r
- boldFont = new Font(av.getFont().getName(), Font.BOLD, av.charHeight);\r
-\r
- graphics.setFont(av.getFont());\r
- }\r
-\r
- y1 += av.charHeight - av.charHeight / 5; // height/5 replaces pady\r
-\r
- int charOffset = 0;\r
-\r
- // Need to find the sequence position here.\r
- if (end + 1 >= seq.getLength())\r
- {\r
- end = seq.getLength() - 1;\r
- }\r
-\r
- char s = ' ';\r
-\r
- for (int i = start; i <= end; i++)\r
- {\r
- graphics.setColor(Color.black);\r
-\r
- s = seq.getCharAt(i);\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
- if (av.getShowBoxes())\r
- {\r
- graphics.setColor(resBoxColour.darker());\r
- }\r
- else\r
- {\r
- graphics.setColor(resBoxColour);\r
- }\r
- }\r
- }\r
-\r
- if (av.upperCasebold)\r
- {\r
- fm = graphics.getFontMetrics();\r
- if ('A' <= s && s <= 'Z')\r
- {\r
- if (!bold)\r
- {\r
-\r
- graphics.setFont(boldFont);\r
- }\r
- bold = true;\r
- }\r
- else if (bold)\r
- {\r
- graphics.setFont(av.font);\r
- bold = false;\r
- }\r
-\r
- }\r
-\r
- charOffset = (av.charWidth - fm.charWidth(s)) / 2;\r
- graphics.drawString(String.valueOf(s),\r
- charOffset + av.charWidth * (i - start),\r
- y1);\r
- }\r
-\r
- }\r
-\r
- boolean inCurrentSequenceGroup(int res)\r
- {\r
- if (allGroups == null)\r
- {\r
- return false;\r
- }\r
-\r
- for (int i = 0; i < allGroups.length; i++)\r
- {\r
- if (allGroups[i].getStartRes() <= res && allGroups[i].getEndRes() >= res)\r
- {\r
- currentSequenceGroup = allGroups[i];\r
- return true;\r
- }\r
- }\r
-\r
- return false;\r
- }\r
-\r
- public void drawHighlightedText(SequenceI seq, int start, int end, int x1,\r
- int y1)\r
- {\r
- int pady = av.charHeight / 5;\r
- int charOffset = 0;\r
- graphics.setColor(Color.black);\r
- graphics.fillRect(x1, y1, av.charWidth * (end - start + 1), av.charHeight);\r
- graphics.setColor(Color.white);\r
-\r
- char s = '~';\r
- // Need to find the sequence position here.\r
- if (av.validCharWidth)\r
- {\r
- for (int i = start; i <= end; i++)\r
- {\r
- if (i < seq.getLength())\r
- {\r
- s = seq.getCharAt(i);\r
- }\r
-\r
- charOffset = (av.charWidth - fm.charWidth(s)) / 2;\r
- graphics.drawString(String.valueOf(s),\r
- charOffset + x1 + av.charWidth * (i - start),\r
- y1 + av.charHeight - pady);\r
- }\r
- }\r
- }\r
-\r
- public void drawCursor(SequenceI seq, int res, int x1, int y1)\r
- {\r
- int pady = av.charHeight / 5;\r
- int charOffset = 0;\r
- graphics.setColor(Color.black);\r
- graphics.fillRect(x1, y1, av.charWidth, av.charHeight);\r
- graphics.setColor(Color.white);\r
-\r
- graphics.setColor(Color.white);\r
-\r
- char s = seq.getCharAt(res);\r
- if (av.validCharWidth)\r
- {\r
-\r
- charOffset = (av.charWidth - fm.charWidth(s)) / 2;\r
- graphics.drawString(String.valueOf(s),\r
- charOffset + x1,\r
- (y1 + av.charHeight) - pady);\r
- }\r
- }\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.appletgui;
+
+import java.awt.*;
+
+import jalview.datamodel.*;
+import jalview.schemes.*;
+
+public class SequenceRenderer
+{
+ AlignViewport av;
+ FontMetrics fm;
+ boolean renderGaps = true;
+ SequenceGroup currentSequenceGroup = null;
+ SequenceGroup[] allGroups = null;
+ Color resBoxColour;
+ Graphics graphics;
+ boolean forOverview = false;
+
+ public SequenceRenderer(AlignViewport av)
+ {
+ this.av = av;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param b DOCUMENT ME!
+ */
+ public void prepare(Graphics g, boolean renderGaps)
+ {
+ graphics = g;
+ fm = g.getFontMetrics();
+
+ this.renderGaps = renderGaps;
+ }
+
+ public Color getResidueBoxColour(SequenceI seq, int i)
+ {
+ allGroups = av.alignment.findAllGroups(seq);
+
+ if (inCurrentSequenceGroup(i))
+ {
+ if (currentSequenceGroup.getDisplayBoxes())
+ {
+ getBoxColour(currentSequenceGroup.cs, seq, i);
+ }
+ }
+ else if (av.getShowBoxes())
+ {
+ getBoxColour(av.globalColourScheme, seq, i);
+ }
+
+ return resBoxColour;
+ }
+
+ void getBoxColour(ColourSchemeI cs, SequenceI seq, int i)
+ {
+ if (cs != null)
+ {
+ resBoxColour = cs.findColour(seq.getCharAt(i), i);
+ }
+ else if (forOverview && !jalview.util.Comparison.isGap(seq.getCharAt(i)))
+ {
+ resBoxColour = Color.lightGray;
+ }
+ else
+ {
+ resBoxColour = Color.white;
+ }
+
+ }
+
+ public Color findSequenceColour(SequenceI seq, int i)
+ {
+ allGroups = av.alignment.findAllGroups(seq);
+ drawBoxes(seq, i, i, 0);
+ return resBoxColour;
+ }
+
+ public void drawSequence(SequenceI seq, SequenceGroup[] sg,
+ int start, int end, int y1)
+ {
+ if (seq == null)
+ {
+ return;
+ }
+
+ allGroups = sg;
+
+ drawBoxes(seq, start, end, y1);
+
+ if (av.validCharWidth)
+ {
+ drawText(seq, start, end, y1);
+ }
+ }
+
+ public void drawBoxes(SequenceI seq, int start, int end, int y1)
+ {
+ int i = start;
+ int length = seq.getLength();
+
+ int curStart = -1;
+ int curWidth = av.charWidth;
+
+ Color tempColour = null;
+ while (i <= end)
+ {
+ resBoxColour = Color.white;
+ if (i < length)
+ {
+ if (inCurrentSequenceGroup(i))
+ {
+ if (currentSequenceGroup.getDisplayBoxes())
+ {
+ getBoxColour(currentSequenceGroup.cs, seq, i);
+ }
+ }
+ else if (av.getShowBoxes())
+ {
+ getBoxColour(av.getGlobalColourScheme(), seq, i);
+ }
+ }
+
+ if (resBoxColour != tempColour)
+ {
+ if (tempColour != null)
+ {
+ graphics.fillRect(av.charWidth * (curStart - start), y1, curWidth,
+ av.charHeight);
+ }
+ graphics.setColor(resBoxColour);
+
+ curStart = i;
+ curWidth = av.charWidth;
+ tempColour = resBoxColour;
+
+ }
+ else
+ {
+ curWidth += av.charWidth;
+ }
+
+ i++;
+ }
+
+ graphics.fillRect(av.charWidth * (curStart - start), y1, curWidth,
+ av.charHeight);
+ }
+
+ public void drawText(SequenceI seq, int start, int end, int y1)
+ {
+ Font boldFont = null;
+ boolean bold = false;
+ if (av.upperCasebold)
+ {
+ boldFont = new Font(av.getFont().getName(), Font.BOLD, av.charHeight);
+
+ graphics.setFont(av.getFont());
+ }
+
+ y1 += av.charHeight - av.charHeight / 5; // height/5 replaces pady
+
+ int charOffset = 0;
+
+ // Need to find the sequence position here.
+ if (end + 1 >= seq.getLength())
+ {
+ end = seq.getLength() - 1;
+ }
+
+ char s = ' ';
+
+ for (int i = start; i <= end; i++)
+ {
+ graphics.setColor(Color.black);
+
+ s = seq.getCharAt(i);
+ if (!renderGaps && jalview.util.Comparison.isGap(s))
+ {
+ continue;
+ }
+
+ if (inCurrentSequenceGroup(i))
+ {
+ if (!currentSequenceGroup.getDisplayText())
+ {
+ continue;
+ }
+
+ if (currentSequenceGroup.getColourText())
+ {
+ getBoxColour(currentSequenceGroup.cs, seq, i);
+ graphics.setColor(resBoxColour.darker());
+ }
+ }
+ else
+ {
+ if (!av.getShowText())
+ {
+ continue;
+ }
+
+ if (av.getColourText())
+ {
+ getBoxColour(av.getGlobalColourScheme(), seq, i);
+ if (av.getShowBoxes())
+ {
+ graphics.setColor(resBoxColour.darker());
+ }
+ else
+ {
+ graphics.setColor(resBoxColour);
+ }
+ }
+ }
+
+ if (av.upperCasebold)
+ {
+ fm = graphics.getFontMetrics();
+ if ('A' <= s && s <= 'Z')
+ {
+ if (!bold)
+ {
+
+ graphics.setFont(boldFont);
+ }
+ bold = true;
+ }
+ else if (bold)
+ {
+ graphics.setFont(av.font);
+ bold = false;
+ }
+
+ }
+
+ charOffset = (av.charWidth - fm.charWidth(s)) / 2;
+ graphics.drawString(String.valueOf(s),
+ charOffset + av.charWidth * (i - start),
+ y1);
+ }
+
+ }
+
+ boolean inCurrentSequenceGroup(int res)
+ {
+ if (allGroups == null)
+ {
+ return false;
+ }
+
+ for (int i = 0; i < allGroups.length; i++)
+ {
+ if (allGroups[i].getStartRes() <= res && allGroups[i].getEndRes() >= res)
+ {
+ currentSequenceGroup = allGroups[i];
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public void drawHighlightedText(SequenceI seq, int start, int end, int x1,
+ int y1)
+ {
+ int pady = av.charHeight / 5;
+ int charOffset = 0;
+ graphics.setColor(Color.black);
+ graphics.fillRect(x1, y1, av.charWidth * (end - start + 1), av.charHeight);
+ graphics.setColor(Color.white);
+
+ char s = '~';
+ // Need to find the sequence position here.
+ if (av.validCharWidth)
+ {
+ for (int i = start; i <= end; i++)
+ {
+ if (i < seq.getLength())
+ {
+ s = seq.getCharAt(i);
+ }
+
+ charOffset = (av.charWidth - fm.charWidth(s)) / 2;
+ graphics.drawString(String.valueOf(s),
+ charOffset + x1 + av.charWidth * (i - start),
+ y1 + av.charHeight - pady);
+ }
+ }
+ }
+
+ public void drawCursor(SequenceI seq, int res, int x1, int y1)
+ {
+ int pady = av.charHeight / 5;
+ int charOffset = 0;
+ graphics.setColor(Color.black);
+ graphics.fillRect(x1, y1, av.charWidth, av.charHeight);
+ graphics.setColor(Color.white);
+
+ graphics.setColor(Color.white);
+
+ char s = seq.getCharAt(res);
+ if (av.validCharWidth)
+ {
+
+ charOffset = (av.charWidth - fm.charWidth(s)) / 2;
+ graphics.drawString(String.valueOf(s),
+ charOffset + x1,
+ (y1 + av.charHeight) - pady);
+ }
+ }
+
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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
-package jalview.appletgui;\r
-\r
-import java.util.*;\r
-\r
-import java.awt.*;\r
-import java.awt.event.*;\r
-\r
-import jalview.datamodel.*;\r
-import jalview.schemes.*;\r
-\r
-public class SliderPanel\r
- extends Panel implements ActionListener,\r
- AdjustmentListener,\r
- MouseListener\r
-{\r
- AlignmentPanel ap;\r
- boolean forConservation = true;\r
- ColourSchemeI cs;\r
-\r
- static Frame conservationSlider;\r
- static Frame PIDSlider;\r
-\r
- public static int setConservationSlider(AlignmentPanel ap, ColourSchemeI cs,\r
- String source)\r
- {\r
- SliderPanel sp = null;\r
-\r
- if (conservationSlider == null)\r
- {\r
- sp = new SliderPanel(ap, cs.getConservationInc(), true, cs);\r
- conservationSlider = new Frame();\r
- conservationSlider.add(sp);\r
- }\r
- else\r
- {\r
- sp = (SliderPanel) conservationSlider.getComponent(0);\r
- sp.cs = cs;\r
- }\r
-\r
- conservationSlider.setTitle("Conservation Colour Increment (" + source +\r
- ")");\r
- if (ap.av.alignment.getGroups() != null)\r
- {\r
- sp.setAllGroupsCheckEnabled(true);\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
- PIDSlider.setVisible(false);\r
- PIDSlider = null;\r
- }\r
- catch (Exception ex)\r
- {}\r
-\r
- if (!conservationSlider.isVisible())\r
- {\r
- jalview.bin.JalviewLite.addFrame(conservationSlider,\r
- conservationSlider.getTitle(), 420, 100);\r
- conservationSlider.addWindowListener(new WindowAdapter()\r
- {\r
- public void windowClosing(WindowEvent e)\r
- {\r
- conservationSlider = null;\r
- }\r
- });\r
-\r
- }\r
-\r
- }\r
-\r
- public static int setPIDSliderSource(AlignmentPanel ap, ColourSchemeI cs,\r
- String source)\r
- {\r
- SliderPanel pid = null;\r
- if (PIDSlider == null)\r
- {\r
- pid = new SliderPanel(ap, 50, false, cs);\r
- PIDSlider = new Frame();\r
- PIDSlider.add(pid);\r
- }\r
- else\r
- {\r
- pid = (SliderPanel) PIDSlider.getComponent(0);\r
- pid.cs = cs;\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
-\r
- public static void showPIDSlider()\r
- {\r
- try\r
- {\r
- conservationSlider.setVisible(false);\r
- conservationSlider = null;\r
- }\r
- catch (Exception ex)\r
- {}\r
-\r
- if (!PIDSlider.isVisible())\r
- {\r
- jalview.bin.JalviewLite.addFrame(PIDSlider, PIDSlider.getTitle(), 420,\r
- 100);\r
- PIDSlider.addWindowListener(new WindowAdapter()\r
- {\r
- public void windowClosing(WindowEvent e)\r
- {\r
- PIDSlider = null;\r
- }\r
- });\r
- }\r
-\r
- }\r
-\r
- public SliderPanel(AlignmentPanel ap, int value, boolean forConserve,\r
- ColourSchemeI cs)\r
- {\r
- try\r
- {\r
- jbInit();\r
- }\r
- catch (Exception e)\r
- {\r
- e.printStackTrace();\r
- }\r
- this.ap = ap;\r
- this.cs = cs;\r
- forConservation = forConserve;\r
- undoButton.setVisible(false);\r
- applyButton.setVisible(false);\r
- if (forConservation)\r
- {\r
- label.setText("Modify conservation visibility");\r
- slider.setMinimum(0);\r
- slider.setMaximum(50 + slider.getVisibleAmount());\r
- slider.setUnitIncrement(1);\r
- }\r
- else\r
- {\r
- label.setText("Colour residues above % occurence");\r
- slider.setMinimum(0);\r
- slider.setMaximum(100 + slider.getVisibleAmount());\r
- slider.setBlockIncrement(1);\r
- }\r
-\r
- slider.addAdjustmentListener(this);\r
- slider.addMouseListener(this);\r
-\r
- slider.setValue(value);\r
- valueField.setText(value + "");\r
- }\r
-\r
- public void valueChanged(int i)\r
- {\r
- if (cs == null)\r
- {\r
- return;\r
- }\r
-\r
- ColourSchemeI toChange = null;\r
- Vector allGroups = null;\r
- int groupIndex = 0;\r
-\r
- if (allGroupsCheck.getState())\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.elementAt(groupIndex)).cs;\r
- }\r
-\r
- if (forConservation)\r
- {\r
- toChange.setConservationInc(i);\r
- }\r
- else\r
- {\r
- toChange.setThreshold(i, ap.av.getIgnoreGapsConsensus());\r
- }\r
-\r
- groupIndex--;\r
- }\r
-\r
- ap.seqPanel.seqCanvas.repaint();\r
-\r
- }\r
-\r
- public void setAllGroupsCheckEnabled(boolean b)\r
- {\r
- allGroupsCheck.setEnabled(b);\r
- }\r
-\r
- public void actionPerformed(ActionEvent evt)\r
- {\r
- if (evt.getSource() == applyButton)\r
- {\r
- applyButton_actionPerformed();\r
- }\r
- else if (evt.getSource() == undoButton)\r
- {\r
- undoButton_actionPerformed();\r
- }\r
- else if (evt.getSource() == valueField)\r
- {\r
- valueField_actionPerformed();\r
- }\r
- }\r
-\r
- public void adjustmentValueChanged(AdjustmentEvent evt)\r
- {\r
- valueField.setText(slider.getValue() + "");\r
- valueChanged(slider.getValue());\r
- }\r
-\r
- public void valueField_actionPerformed()\r
- {\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
- 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
- // this is used for conservation colours, PID colours and redundancy threshold\r
- protected Scrollbar slider = new Scrollbar();\r
- protected TextField valueField = new TextField();\r
- protected Label label = new Label();\r
- Panel jPanel1 = new Panel();\r
- Panel jPanel2 = new Panel();\r
- protected Button applyButton = new Button();\r
- protected Button undoButton = new Button();\r
- FlowLayout flowLayout1 = new FlowLayout();\r
- protected Checkbox allGroupsCheck = new Checkbox();\r
- BorderLayout borderLayout1 = new BorderLayout();\r
- BorderLayout borderLayout2 = new BorderLayout();\r
- FlowLayout flowLayout2 = new FlowLayout();\r
-\r
- private void jbInit()\r
- throws Exception\r
- {\r
- this.setLayout(borderLayout2);\r
-\r
- // slider.setMajorTickSpacing(10);\r
- // slider.setMinorTickSpacing(1);\r
- // slider.setPaintTicks(true);\r
- slider.setBackground(Color.white);\r
- slider.setFont(new java.awt.Font("Verdana", 0, 11));\r
- slider.setOrientation(0);\r
- valueField.setFont(new java.awt.Font("Verdana", 0, 11));\r
- valueField.setText(" ");\r
- valueField.addActionListener(this);\r
- label.setFont(new java.awt.Font("Verdana", 0, 11));\r
- label.setText("set this label text");\r
- jPanel1.setLayout(borderLayout1);\r
- jPanel2.setLayout(flowLayout1);\r
- applyButton.setFont(new java.awt.Font("Verdana", 0, 11));\r
- applyButton.setLabel("Apply");\r
- applyButton.addActionListener(this);\r
- undoButton.setEnabled(false);\r
- undoButton.setFont(new java.awt.Font("Verdana", 0, 11));\r
- undoButton.setLabel("Undo");\r
- undoButton.addActionListener(this);\r
- allGroupsCheck.setEnabled(false);\r
- allGroupsCheck.setFont(new java.awt.Font("Verdana", 0, 11));\r
- allGroupsCheck.setLabel("Apply threshold to all groups");\r
- allGroupsCheck.setName("Apply to all Groups");\r
- this.setBackground(Color.white);\r
- this.setForeground(Color.black);\r
- jPanel2.add(label, null);\r
- jPanel2.add(applyButton, null);\r
- jPanel2.add(undoButton, null);\r
- jPanel2.add(allGroupsCheck);\r
- jPanel1.add(valueField, java.awt.BorderLayout.EAST);\r
- jPanel1.add(slider, java.awt.BorderLayout.CENTER);\r
- this.add(jPanel1, java.awt.BorderLayout.SOUTH);\r
- this.add(jPanel2, java.awt.BorderLayout.CENTER);\r
- }\r
-\r
- protected void applyButton_actionPerformed()\r
- {}\r
-\r
- protected void undoButton_actionPerformed()\r
- {}\r
-\r
- public void mousePressed(MouseEvent evt)\r
- {}\r
-\r
- public void mouseReleased(MouseEvent evt)\r
- {\r
- ap.paintAlignment(true);\r
- }\r
-\r
- public void mouseClicked(MouseEvent evt)\r
- {}\r
-\r
- public void mouseEntered(MouseEvent evt)\r
- {}\r
-\r
- public void mouseExited(MouseEvent evt)\r
- {}\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.appletgui;
+
+import java.util.*;
+
+import java.awt.*;
+import java.awt.event.*;
+
+import jalview.datamodel.*;
+import jalview.schemes.*;
+
+public class SliderPanel
+ extends Panel implements ActionListener,
+ AdjustmentListener,
+ MouseListener
+{
+ AlignmentPanel ap;
+ boolean forConservation = true;
+ ColourSchemeI cs;
+
+ static Frame conservationSlider;
+ static Frame PIDSlider;
+
+ public static int setConservationSlider(AlignmentPanel ap, ColourSchemeI cs,
+ String source)
+ {
+ SliderPanel sp = null;
+
+ if (conservationSlider == null)
+ {
+ sp = new SliderPanel(ap, cs.getConservationInc(), true, cs);
+ conservationSlider = new Frame();
+ conservationSlider.add(sp);
+ }
+ else
+ {
+ sp = (SliderPanel) conservationSlider.getComponent(0);
+ sp.cs = cs;
+ }
+
+ conservationSlider.setTitle("Conservation Colour Increment (" + source +
+ ")");
+ if (ap.av.alignment.getGroups() != null)
+ {
+ sp.setAllGroupsCheckEnabled(true);
+ }
+ else
+ {
+ sp.setAllGroupsCheckEnabled(false);
+ }
+
+ return sp.getValue();
+ }
+
+ public static void showConservationSlider()
+ {
+ try
+ {
+ PIDSlider.setVisible(false);
+ PIDSlider = null;
+ }
+ catch (Exception ex)
+ {}
+
+ if (!conservationSlider.isVisible())
+ {
+ jalview.bin.JalviewLite.addFrame(conservationSlider,
+ conservationSlider.getTitle(), 420, 100);
+ conservationSlider.addWindowListener(new WindowAdapter()
+ {
+ public void windowClosing(WindowEvent e)
+ {
+ conservationSlider = null;
+ }
+ });
+
+ }
+
+ }
+
+ public static int setPIDSliderSource(AlignmentPanel ap, ColourSchemeI cs,
+ String source)
+ {
+ SliderPanel pid = null;
+ if (PIDSlider == null)
+ {
+ pid = new SliderPanel(ap, 50, false, cs);
+ PIDSlider = new Frame();
+ PIDSlider.add(pid);
+ }
+ else
+ {
+ pid = (SliderPanel) PIDSlider.getComponent(0);
+ pid.cs = cs;
+ }
+ PIDSlider.setTitle("Percentage Identity Threshold (" + source + ")");
+
+ if (ap.av.alignment.getGroups() != null)
+ {
+ pid.setAllGroupsCheckEnabled(true);
+ }
+ else
+ {
+ pid.setAllGroupsCheckEnabled(false);
+ }
+
+ return pid.getValue();
+
+ }
+
+ public static void showPIDSlider()
+ {
+ try
+ {
+ conservationSlider.setVisible(false);
+ conservationSlider = null;
+ }
+ catch (Exception ex)
+ {}
+
+ if (!PIDSlider.isVisible())
+ {
+ jalview.bin.JalviewLite.addFrame(PIDSlider, PIDSlider.getTitle(), 420,
+ 100);
+ PIDSlider.addWindowListener(new WindowAdapter()
+ {
+ public void windowClosing(WindowEvent e)
+ {
+ PIDSlider = null;
+ }
+ });
+ }
+
+ }
+
+ public SliderPanel(AlignmentPanel ap, int value, boolean forConserve,
+ ColourSchemeI cs)
+ {
+ try
+ {
+ jbInit();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ this.ap = ap;
+ this.cs = cs;
+ forConservation = forConserve;
+ undoButton.setVisible(false);
+ applyButton.setVisible(false);
+ if (forConservation)
+ {
+ label.setText("Modify conservation visibility");
+ slider.setMinimum(0);
+ slider.setMaximum(50 + slider.getVisibleAmount());
+ slider.setUnitIncrement(1);
+ }
+ else
+ {
+ label.setText("Colour residues above % occurence");
+ slider.setMinimum(0);
+ slider.setMaximum(100 + slider.getVisibleAmount());
+ slider.setBlockIncrement(1);
+ }
+
+ slider.addAdjustmentListener(this);
+ slider.addMouseListener(this);
+
+ slider.setValue(value);
+ valueField.setText(value + "");
+ }
+
+ public void valueChanged(int i)
+ {
+ if (cs == null)
+ {
+ return;
+ }
+
+ ColourSchemeI toChange = null;
+ Vector allGroups = null;
+ int groupIndex = 0;
+
+ if (allGroupsCheck.getState())
+ {
+ allGroups = ap.av.alignment.getGroups();
+ groupIndex = allGroups.size() - 1;
+ }
+ else
+ {
+ toChange = cs;
+ }
+
+ while (groupIndex > -1)
+ {
+ if (allGroups != null)
+ {
+ toChange = ( (SequenceGroup) allGroups.elementAt(groupIndex)).cs;
+ }
+
+ if (forConservation)
+ {
+ toChange.setConservationInc(i);
+ }
+ else
+ {
+ toChange.setThreshold(i, ap.av.getIgnoreGapsConsensus());
+ }
+
+ groupIndex--;
+ }
+
+ ap.seqPanel.seqCanvas.repaint();
+
+ }
+
+ public void setAllGroupsCheckEnabled(boolean b)
+ {
+ allGroupsCheck.setEnabled(b);
+ }
+
+ public void actionPerformed(ActionEvent evt)
+ {
+ if (evt.getSource() == applyButton)
+ {
+ applyButton_actionPerformed();
+ }
+ else if (evt.getSource() == undoButton)
+ {
+ undoButton_actionPerformed();
+ }
+ else if (evt.getSource() == valueField)
+ {
+ valueField_actionPerformed();
+ }
+ }
+
+ public void adjustmentValueChanged(AdjustmentEvent evt)
+ {
+ valueField.setText(slider.getValue() + "");
+ valueChanged(slider.getValue());
+ }
+
+ public void valueField_actionPerformed()
+ {
+ try
+ {
+ int i = Integer.parseInt(valueField.getText());
+ slider.setValue(i);
+ }
+ catch (Exception ex)
+ {
+ valueField.setText(slider.getValue() + "");
+ }
+ }
+
+ public void setValue(int value)
+ {
+ slider.setValue(value);
+ }
+
+ public int getValue()
+ {
+ return Integer.parseInt(valueField.getText());
+ }
+
+ // this is used for conservation colours, PID colours and redundancy threshold
+ protected Scrollbar slider = new Scrollbar();
+ protected TextField valueField = new TextField();
+ protected Label label = new Label();
+ Panel jPanel1 = new Panel();
+ Panel jPanel2 = new Panel();
+ protected Button applyButton = new Button();
+ protected Button undoButton = new Button();
+ FlowLayout flowLayout1 = new FlowLayout();
+ protected Checkbox allGroupsCheck = new Checkbox();
+ BorderLayout borderLayout1 = new BorderLayout();
+ BorderLayout borderLayout2 = new BorderLayout();
+ FlowLayout flowLayout2 = new FlowLayout();
+
+ private void jbInit()
+ throws Exception
+ {
+ this.setLayout(borderLayout2);
+
+ // slider.setMajorTickSpacing(10);
+ // slider.setMinorTickSpacing(1);
+ // slider.setPaintTicks(true);
+ slider.setBackground(Color.white);
+ slider.setFont(new java.awt.Font("Verdana", 0, 11));
+ slider.setOrientation(0);
+ valueField.setFont(new java.awt.Font("Verdana", 0, 11));
+ valueField.setText(" ");
+ valueField.addActionListener(this);
+ label.setFont(new java.awt.Font("Verdana", 0, 11));
+ label.setText("set this label text");
+ jPanel1.setLayout(borderLayout1);
+ jPanel2.setLayout(flowLayout1);
+ applyButton.setFont(new java.awt.Font("Verdana", 0, 11));
+ applyButton.setLabel("Apply");
+ applyButton.addActionListener(this);
+ undoButton.setEnabled(false);
+ undoButton.setFont(new java.awt.Font("Verdana", 0, 11));
+ undoButton.setLabel("Undo");
+ undoButton.addActionListener(this);
+ allGroupsCheck.setEnabled(false);
+ allGroupsCheck.setFont(new java.awt.Font("Verdana", 0, 11));
+ allGroupsCheck.setLabel("Apply threshold to all groups");
+ allGroupsCheck.setName("Apply to all Groups");
+ this.setBackground(Color.white);
+ this.setForeground(Color.black);
+ jPanel2.add(label, null);
+ jPanel2.add(applyButton, null);
+ jPanel2.add(undoButton, null);
+ jPanel2.add(allGroupsCheck);
+ jPanel1.add(valueField, java.awt.BorderLayout.EAST);
+ jPanel1.add(slider, java.awt.BorderLayout.CENTER);
+ this.add(jPanel1, java.awt.BorderLayout.SOUTH);
+ this.add(jPanel2, java.awt.BorderLayout.CENTER);
+ }
+
+ protected void applyButton_actionPerformed()
+ {}
+
+ protected void undoButton_actionPerformed()
+ {}
+
+ public void mousePressed(MouseEvent evt)
+ {}
+
+ public void mouseReleased(MouseEvent evt)
+ {
+ ap.paintAlignment(true);
+ }
+
+ public void mouseClicked(MouseEvent evt)
+ {}
+
+ public void mouseEntered(MouseEvent evt)
+ {}
+
+ public void mouseExited(MouseEvent evt)
+ {}
+}
/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
- *\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
+ * \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
+ * \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
package jalview.appletgui;\r
\r
import java.applet.*;\r
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.appletgui;
import java.util.*;
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.appletgui;
import java.awt.*;
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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
-package jalview.appletgui;\r
-\r
-import java.util.*;\r
-\r
-import java.awt.*;\r
-import java.awt.event.*;\r
-\r
-import jalview.datamodel.*;\r
-import jalview.schemes.*;\r
-\r
-public class UserDefinedColours\r
- extends Panel implements ActionListener, AdjustmentListener\r
-{\r
-\r
- AlignmentPanel ap;\r
- SequenceGroup seqGroup;\r
- Button selectedButton;\r
- Vector oldColours = new Vector();\r
- ColourSchemeI oldColourScheme;\r
- Frame frame;\r
- MCview.AppletPDBCanvas pdbcanvas;\r
- AppletJmol jmol;\r
-\r
- Dialog dialog;\r
- Object caller;\r
- String originalLabel;\r
- Color originalColour;\r
-\r
- int R = 0, G = 0, B = 0;\r
-\r
- public ColourSchemeI loadDefaultColours()\r
- {\r
- // NOT IMPLEMENTED YET IN APPLET VERSION\r
- return null;\r
- }\r
-\r
- public UserDefinedColours(AlignmentPanel ap, SequenceGroup sg)\r
- {\r
- this.ap = ap;\r
- seqGroup = sg;\r
-\r
- if (seqGroup != null)\r
- {\r
- oldColourScheme = seqGroup.cs;\r
- }\r
- else\r
- {\r
- oldColourScheme = ap.av.getGlobalColourScheme();\r
- }\r
-\r
- init();\r
- }\r
-\r
- public UserDefinedColours(MCview.AppletPDBCanvas pdb)\r
- {\r
- this.pdbcanvas = pdb;\r
- init();\r
- }\r
-\r
- public UserDefinedColours(AppletJmol jmol)\r
- {\r
- this.jmol = jmol;\r
- init();\r
- }\r
-\r
- public UserDefinedColours(FeatureRenderer fr, Frame alignframe)\r
- {\r
- caller = fr;\r
- originalColour = fr.colourPanel.getBackground();\r
- originalLabel = "Feature Colour";\r
- setForDialog("Select Feature Colour", alignframe);\r
- setTargetColour(fr.colourPanel.getBackground());\r
- dialog.setVisible(true);\r
- }\r
-\r
- public UserDefinedColours(Component caller,\r
- Color col1,\r
- Frame alignframe)\r
- {\r
- this.caller = caller;\r
- originalColour = col1;\r
- originalLabel = "Select Colour";\r
- setForDialog("Select Colour", alignframe);\r
- setTargetColour(col1);\r
- dialog.setVisible(true);\r
- }\r
-\r
-\r
- public UserDefinedColours(Object caller,\r
- String label,\r
- Color colour)\r
- {\r
- this.caller = caller;\r
- originalColour = colour;\r
- originalLabel = label;\r
- init();\r
- remove(buttonPanel);\r
-\r
- setTargetColour(colour);\r
-\r
- okcancelPanel.setBounds(new Rectangle(0, 113, 400, 35));\r
- frame.setTitle("User Defined Colours - " + label);\r
- frame.setSize(420, 200);\r
- }\r
-\r
- void setForDialog(String title, Frame alignframe)\r
- {\r
- init();\r
- frame.setVisible(false);\r
- remove(buttonPanel);\r
- dialog = new Dialog(alignframe, title, true);\r
-\r
- dialog.add(this);\r
- this.setSize(400,123);\r
- okcancelPanel.setBounds(new Rectangle(0, 123, 400, 35));\r
- int height = 160 + alignframe.getInsets().top + getInsets().bottom;\r
- int width = 400;\r
-\r
- dialog.setBounds(alignframe.getBounds().x\r
- + (alignframe.getSize().width - width) / 2,\r
- alignframe.getBounds().y\r
- + (alignframe.getSize().height - height) / 2,\r
- width, height);\r
-\r
- }\r
-\r
- public void actionPerformed(ActionEvent evt)\r
- {\r
- if (evt.getSource() == okButton)\r
- {\r
- okButton_actionPerformed();\r
- }\r
- else if (evt.getSource() == applyButton)\r
- {\r
- applyButton_actionPerformed();\r
- }\r
- else if (evt.getSource() == cancelButton)\r
- {\r
- cancelButton_actionPerformed();\r
- }\r
- else if (evt.getSource() == rText)\r
- {\r
- rText_actionPerformed();\r
- }\r
- else if (evt.getSource() == gText)\r
- {\r
- gText_actionPerformed();\r
- }\r
- else if (evt.getSource() == bText)\r
- {\r
- bText_actionPerformed();\r
- }\r
- }\r
-\r
- public void adjustmentValueChanged(AdjustmentEvent evt)\r
- {\r
- if (evt.getSource() == rScroller)\r
- {\r
- rScroller_adjustmentValueChanged();\r
- }\r
- else if (evt.getSource() == gScroller)\r
- {\r
- gScroller_adjustmentValueChanged();\r
- }\r
- else if (evt.getSource() == bScroller)\r
- {\r
- bScroller_adjustmentValueChanged();\r
- }\r
- }\r
-\r
- void init()\r
- {\r
- try\r
- {\r
- jbInit();\r
- }\r
- catch (Exception e)\r
- {\r
- e.printStackTrace();\r
- }\r
- frame = new Frame();\r
- frame.add(this);\r
- jalview.bin.JalviewLite.addFrame(frame, "User defined colours", 420, 345);\r
-\r
- if (seqGroup != null)\r
- {\r
- frame.setTitle(frame.getTitle() + " (" + seqGroup.getName() + ")");\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
-\r
- validate();\r
- }\r
-\r
- protected void rText_actionPerformed()\r
- {\r
- try\r
- {\r
- int i = Integer.parseInt(rText.getText());\r
- rScroller.setValue(i);\r
- rScroller_adjustmentValueChanged();\r
- }\r
- catch (NumberFormatException ex)\r
- {}\r
- }\r
-\r
- protected void gText_actionPerformed()\r
- {\r
- try\r
- {\r
- int i = Integer.parseInt(gText.getText());\r
- gScroller.setValue(i);\r
- gScroller_adjustmentValueChanged();\r
- }\r
- catch (NumberFormatException ex)\r
- {}\r
-\r
- }\r
-\r
- protected void bText_actionPerformed()\r
- {\r
- try\r
- {\r
- int i = Integer.parseInt(bText.getText());\r
- bScroller.setValue(i);\r
- bScroller_adjustmentValueChanged();\r
- }\r
- catch (NumberFormatException ex)\r
- {}\r
-\r
- }\r
-\r
- protected void rScroller_adjustmentValueChanged()\r
- {\r
- R = rScroller.getValue();\r
- rText.setText(R + "");\r
- colourChanged();\r
- }\r
-\r
- protected void gScroller_adjustmentValueChanged()\r
- {\r
- G = gScroller.getValue();\r
- gText.setText(G + "");\r
- colourChanged();\r
- }\r
-\r
- protected void bScroller_adjustmentValueChanged()\r
- {\r
- B = bScroller.getValue();\r
- bText.setText(B + "");\r
- colourChanged();\r
- }\r
-\r
- public void colourChanged()\r
- {\r
- Color col = new Color(R, G, B);\r
- target.setBackground(col);\r
- target.repaint();\r
-\r
- if (selectedButton != null)\r
- {\r
- selectedButton.setBackground(col);\r
- selectedButton.repaint();\r
- }\r
- }\r
-\r
- void setTargetColour(Color col)\r
- {\r
- R = col.getRed();\r
- G = col.getGreen();\r
- B = col.getBlue();\r
-\r
- rScroller.setValue(R);\r
- gScroller.setValue(G);\r
- bScroller.setValue(B);\r
- rText.setText(R + "");\r
- gText.setText(G + "");\r
- bText.setText(B + "");\r
- colourChanged();\r
- }\r
-\r
- public void colourButtonPressed(MouseEvent e)\r
- {\r
- selectedButton = (Button) e.getSource();\r
- setTargetColour(selectedButton.getBackground());\r
- }\r
-\r
- void makeButton(String label, String aa)\r
- {\r
- final Button button = new Button();\r
- Color col = Color.white;\r
-\r
- try\r
- {\r
- col = oldColourScheme.findColour(aa.charAt(0), -1);\r
- }\r
- catch (Exception ex)\r
- {}\r
-\r
- button.setBackground(col);\r
- oldColours.addElement(col);\r
- button.setLabel(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 mousePressed(MouseEvent e)\r
- {\r
- colourButtonPressed(e);\r
- }\r
- });\r
-\r
- buttonPanel.add(button, null);\r
- }\r
-\r
- protected void okButton_actionPerformed()\r
- {\r
- applyButton_actionPerformed();\r
- if (dialog != null)\r
- dialog.setVisible(false);\r
-\r
- frame.setVisible(false);\r
- }\r
-\r
- public Color getColor()\r
- {\r
- return new Color(R, G, B);\r
- }\r
-\r
- protected void applyButton_actionPerformed()\r
- {\r
- if (caller != null)\r
- {\r
- if (caller instanceof FeatureSettings)\r
- {\r
- ( (FeatureSettings) caller).setUserColour\r
- (originalLabel, getColor());\r
- }\r
- else if (caller instanceof AnnotationColourChooser)\r
- {\r
- if (originalLabel.equals("Min Colour"))\r
- {\r
- ( (AnnotationColourChooser) caller).minColour_actionPerformed\r
- (getColor());\r
- }\r
- else\r
- {\r
- ( (AnnotationColourChooser) caller).maxColour_actionPerformed\r
- (getColor());\r
- }\r
- }\r
- else if(caller instanceof FeatureRenderer)\r
- {\r
- ((FeatureRenderer)caller).colourPanel.setBackground(getColor());\r
- }\r
-\r
- return;\r
- }\r
-\r
- Color[] newColours = new Color[24];\r
- for (int i = 0; i < 24; i++)\r
- {\r
- Button button = (Button) buttonPanel.getComponent(i);\r
- newColours[i] = button.getBackground();\r
- }\r
-\r
- UserColourScheme ucs = new UserColourScheme(newColours);\r
- if (ap != null)\r
- {\r
- ucs.setThreshold(0, ap.av.getIgnoreGapsConsensus());\r
- }\r
-\r
- if (ap != null)\r
- {\r
- if (seqGroup != null)\r
- {\r
- seqGroup.cs = ucs;\r
- }\r
- else\r
- {\r
- ap.av.setGlobalColourScheme(ucs);\r
- }\r
- ap.seqPanel.seqCanvas.img = null;\r
- ap.paintAlignment(true);\r
- }\r
- else if(jmol!=null)\r
- {\r
- jmol.setJalviewColourScheme(ucs);\r
- }\r
- else if (pdbcanvas != null)\r
- {\r
- pdbcanvas.setColours(ucs);\r
- }\r
- }\r
-\r
- protected void cancelButton_actionPerformed()\r
- {\r
- if (caller != null)\r
- {\r
- if (caller instanceof FeatureSettings)\r
- {\r
- ( (FeatureSettings) caller).setUserColour\r
- (originalLabel, originalColour);\r
- }\r
- else if (caller instanceof AnnotationColourChooser)\r
- {\r
- if (originalLabel.equals("Min Colour"))\r
- {\r
- ( (AnnotationColourChooser) caller).minColour_actionPerformed\r
- (originalColour);\r
- }\r
- else\r
- {\r
- ( (AnnotationColourChooser) caller).maxColour_actionPerformed\r
- (originalColour);\r
- }\r
- }\r
- else if (caller instanceof FeatureRenderer)\r
- {\r
- ( (FeatureRenderer) caller).colourPanel.setBackground(originalColour);\r
-\r
- }\r
-\r
- if(dialog!=null)\r
- dialog.setVisible(false);\r
-\r
- frame.setVisible(false);\r
- return;\r
- }\r
-\r
- Color[] newColours = new Color[24];\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
- UserColourScheme ucs = new UserColourScheme(newColours);\r
-\r
- if (ap != null)\r
- {\r
- if (seqGroup != null)\r
- {\r
- seqGroup.cs = ucs;\r
- }\r
- else\r
- {\r
- ap.av.setGlobalColourScheme(ucs);\r
- }\r
- ap.paintAlignment(true);\r
- }\r
- else if(jmol !=null)\r
- {\r
- jmol.setJalviewColourScheme(ucs);\r
- }\r
- else if (pdbcanvas != null)\r
- {\r
- pdbcanvas.pdb.setColours(ucs);\r
- }\r
-\r
- frame.setVisible(false);\r
- }\r
-\r
- protected Panel buttonPanel = new Panel();\r
- protected GridLayout gridLayout = new GridLayout();\r
- Panel okcancelPanel = new Panel();\r
- protected Button okButton = new Button();\r
- protected Button applyButton = new Button();\r
- protected Button cancelButton = new Button();\r
- protected Scrollbar rScroller = new Scrollbar();\r
- Label label1 = new Label();\r
- protected TextField rText = new TextField();\r
- Label label4 = new Label();\r
- protected Scrollbar gScroller = new Scrollbar();\r
- protected TextField gText = new TextField();\r
- Label label5 = new Label();\r
- protected Scrollbar bScroller = new Scrollbar();\r
- protected TextField bText = new TextField();\r
- protected Panel target = new Panel();\r
-\r
- private void jbInit()\r
- throws Exception\r
- {\r
- this.setLayout(null);\r
- buttonPanel.setLayout(gridLayout);\r
- gridLayout.setColumns(6);\r
- gridLayout.setRows(4);\r
- okButton.setFont(new java.awt.Font("Verdana", 0, 11));\r
- okButton.setLabel("OK");\r
- okButton.addActionListener(this);\r
- applyButton.setFont(new java.awt.Font("Verdana", 0, 11));\r
- applyButton.setLabel("Apply");\r
- applyButton.addActionListener(this);\r
- cancelButton.setFont(new java.awt.Font("Verdana", 0, 11));\r
- cancelButton.setLabel("Cancel");\r
- cancelButton.addActionListener(this);\r
- this.setBackground(new Color(212, 208, 223));\r
- okcancelPanel.setBounds(new Rectangle(0, 265, 400, 35));\r
- buttonPanel.setBounds(new Rectangle(0, 123, 400, 142));\r
- rScroller.setMaximum(256);\r
- rScroller.setMinimum(0);\r
- rScroller.setOrientation(0);\r
- rScroller.setUnitIncrement(1);\r
- rScroller.setVisibleAmount(1);\r
- rScroller.setBounds(new Rectangle(36, 27, 119, 19));\r
- rScroller.addAdjustmentListener(this);\r
- label1.setAlignment(Label.RIGHT);\r
- label1.setText("R");\r
- label1.setBounds(new Rectangle(19, 30, 16, 15));\r
- rText.setFont(new java.awt.Font("Dialog", Font.PLAIN, 10));\r
- rText.setText("0 ");\r
- rText.setBounds(new Rectangle(156, 27, 53, 19));\r
- rText.addActionListener(this);\r
- label4.setAlignment(Label.RIGHT);\r
- label4.setText("G");\r
- label4.setBounds(new Rectangle(15, 56, 20, 15));\r
- gScroller.setMaximum(256);\r
- gScroller.setMinimum(0);\r
- gScroller.setOrientation(0);\r
- gScroller.setUnitIncrement(1);\r
- gScroller.setVisibleAmount(1);\r
- gScroller.setBounds(new Rectangle(35, 52, 120, 20));\r
- gScroller.addAdjustmentListener(this);\r
- gText.setFont(new java.awt.Font("Dialog", Font.PLAIN, 10));\r
- gText.setText("0 ");\r
- gText.setBounds(new Rectangle(156, 52, 53, 20));\r
- gText.addActionListener(this);\r
- label5.setAlignment(Label.RIGHT);\r
- label5.setText("B");\r
- label5.setBounds(new Rectangle(14, 82, 20, 15));\r
- bScroller.setMaximum(256);\r
- bScroller.setMinimum(0);\r
- bScroller.setOrientation(0);\r
- bScroller.setUnitIncrement(1);\r
- bScroller.setVisibleAmount(1);\r
- bScroller.setBounds(new Rectangle(35, 78, 120, 20));\r
- bScroller.addAdjustmentListener(this);\r
- bText.setFont(new java.awt.Font("Dialog", Font.PLAIN, 10));\r
- bText.setText("0 ");\r
- bText.setBounds(new Rectangle(157, 78, 52, 20));\r
- bText.addActionListener(this);\r
- target.setBackground(Color.black);\r
- target.setBounds(new Rectangle(229, 26, 134, 79));\r
- this.add(okcancelPanel, null);\r
- okcancelPanel.add(okButton, null);\r
- okcancelPanel.add(applyButton, null);\r
- okcancelPanel.add(cancelButton, null);\r
- this.add(buttonPanel, null);\r
- this.add(target, null);\r
- this.add(gScroller);\r
- this.add(rScroller);\r
- this.add(bScroller);\r
- this.add(label5);\r
- this.add(label4);\r
- this.add(label1);\r
- this.add(gText);\r
- this.add(rText);\r
- this.add(bText);\r
- }\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.appletgui;
+
+import java.util.*;
+
+import java.awt.*;
+import java.awt.event.*;
+
+import jalview.datamodel.*;
+import jalview.schemes.*;
+
+public class UserDefinedColours
+ extends Panel implements ActionListener, AdjustmentListener
+{
+
+ AlignmentPanel ap;
+ SequenceGroup seqGroup;
+ Button selectedButton;
+ Vector oldColours = new Vector();
+ ColourSchemeI oldColourScheme;
+ Frame frame;
+ MCview.AppletPDBCanvas pdbcanvas;
+ AppletJmol jmol;
+
+ Dialog dialog;
+ Object caller;
+ String originalLabel;
+ Color originalColour;
+
+ int R = 0, G = 0, B = 0;
+
+ public ColourSchemeI loadDefaultColours()
+ {
+ // NOT IMPLEMENTED YET IN APPLET VERSION
+ return null;
+ }
+
+ public UserDefinedColours(AlignmentPanel ap, SequenceGroup sg)
+ {
+ this.ap = ap;
+ seqGroup = sg;
+
+ if (seqGroup != null)
+ {
+ oldColourScheme = seqGroup.cs;
+ }
+ else
+ {
+ oldColourScheme = ap.av.getGlobalColourScheme();
+ }
+
+ init();
+ }
+
+ public UserDefinedColours(MCview.AppletPDBCanvas pdb)
+ {
+ this.pdbcanvas = pdb;
+ init();
+ }
+
+ public UserDefinedColours(AppletJmol jmol)
+ {
+ this.jmol = jmol;
+ init();
+ }
+
+ public UserDefinedColours(FeatureRenderer fr, Frame alignframe)
+ {
+ caller = fr;
+ originalColour = fr.colourPanel.getBackground();
+ originalLabel = "Feature Colour";
+ setForDialog("Select Feature Colour", alignframe);
+ setTargetColour(fr.colourPanel.getBackground());
+ dialog.setVisible(true);
+ }
+
+ public UserDefinedColours(Component caller,
+ Color col1,
+ Frame alignframe)
+ {
+ this.caller = caller;
+ originalColour = col1;
+ originalLabel = "Select Colour";
+ setForDialog("Select Colour", alignframe);
+ setTargetColour(col1);
+ dialog.setVisible(true);
+ }
+
+
+ public UserDefinedColours(Object caller,
+ String label,
+ Color colour)
+ {
+ this.caller = caller;
+ originalColour = colour;
+ originalLabel = label;
+ init();
+ remove(buttonPanel);
+
+ setTargetColour(colour);
+
+ okcancelPanel.setBounds(new Rectangle(0, 113, 400, 35));
+ frame.setTitle("User Defined Colours - " + label);
+ frame.setSize(420, 200);
+ }
+
+ void setForDialog(String title, Frame alignframe)
+ {
+ init();
+ frame.setVisible(false);
+ remove(buttonPanel);
+ dialog = new Dialog(alignframe, title, true);
+
+ dialog.add(this);
+ this.setSize(400,123);
+ okcancelPanel.setBounds(new Rectangle(0, 123, 400, 35));
+ int height = 160 + alignframe.getInsets().top + getInsets().bottom;
+ int width = 400;
+
+ dialog.setBounds(alignframe.getBounds().x
+ + (alignframe.getSize().width - width) / 2,
+ alignframe.getBounds().y
+ + (alignframe.getSize().height - height) / 2,
+ width, height);
+
+ }
+
+ public void actionPerformed(ActionEvent evt)
+ {
+ if (evt.getSource() == okButton)
+ {
+ okButton_actionPerformed();
+ }
+ else if (evt.getSource() == applyButton)
+ {
+ applyButton_actionPerformed();
+ }
+ else if (evt.getSource() == cancelButton)
+ {
+ cancelButton_actionPerformed();
+ }
+ else if (evt.getSource() == rText)
+ {
+ rText_actionPerformed();
+ }
+ else if (evt.getSource() == gText)
+ {
+ gText_actionPerformed();
+ }
+ else if (evt.getSource() == bText)
+ {
+ bText_actionPerformed();
+ }
+ }
+
+ public void adjustmentValueChanged(AdjustmentEvent evt)
+ {
+ if (evt.getSource() == rScroller)
+ {
+ rScroller_adjustmentValueChanged();
+ }
+ else if (evt.getSource() == gScroller)
+ {
+ gScroller_adjustmentValueChanged();
+ }
+ else if (evt.getSource() == bScroller)
+ {
+ bScroller_adjustmentValueChanged();
+ }
+ }
+
+ void init()
+ {
+ try
+ {
+ jbInit();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ frame = new Frame();
+ frame.add(this);
+ jalview.bin.JalviewLite.addFrame(frame, "User defined colours", 420, 345);
+
+ if (seqGroup != null)
+ {
+ frame.setTitle(frame.getTitle() + " (" + seqGroup.getName() + ")");
+ }
+
+ for (int i = 0; i < 20; i++)
+ {
+ makeButton(ResidueProperties.aa2Triplet.get(ResidueProperties.aa[i]) +
+ "", ResidueProperties.aa[i]);
+ }
+
+ makeButton("B", "B");
+ makeButton("Z", "Z");
+ makeButton("X", "X");
+ makeButton("Gap", "'.','-',' '");
+
+ validate();
+ }
+
+ protected void rText_actionPerformed()
+ {
+ try
+ {
+ int i = Integer.parseInt(rText.getText());
+ rScroller.setValue(i);
+ rScroller_adjustmentValueChanged();
+ }
+ catch (NumberFormatException ex)
+ {}
+ }
+
+ protected void gText_actionPerformed()
+ {
+ try
+ {
+ int i = Integer.parseInt(gText.getText());
+ gScroller.setValue(i);
+ gScroller_adjustmentValueChanged();
+ }
+ catch (NumberFormatException ex)
+ {}
+
+ }
+
+ protected void bText_actionPerformed()
+ {
+ try
+ {
+ int i = Integer.parseInt(bText.getText());
+ bScroller.setValue(i);
+ bScroller_adjustmentValueChanged();
+ }
+ catch (NumberFormatException ex)
+ {}
+
+ }
+
+ protected void rScroller_adjustmentValueChanged()
+ {
+ R = rScroller.getValue();
+ rText.setText(R + "");
+ colourChanged();
+ }
+
+ protected void gScroller_adjustmentValueChanged()
+ {
+ G = gScroller.getValue();
+ gText.setText(G + "");
+ colourChanged();
+ }
+
+ protected void bScroller_adjustmentValueChanged()
+ {
+ B = bScroller.getValue();
+ bText.setText(B + "");
+ colourChanged();
+ }
+
+ public void colourChanged()
+ {
+ Color col = new Color(R, G, B);
+ target.setBackground(col);
+ target.repaint();
+
+ if (selectedButton != null)
+ {
+ selectedButton.setBackground(col);
+ selectedButton.repaint();
+ }
+ }
+
+ void setTargetColour(Color col)
+ {
+ R = col.getRed();
+ G = col.getGreen();
+ B = col.getBlue();
+
+ rScroller.setValue(R);
+ gScroller.setValue(G);
+ bScroller.setValue(B);
+ rText.setText(R + "");
+ gText.setText(G + "");
+ bText.setText(B + "");
+ colourChanged();
+ }
+
+ public void colourButtonPressed(MouseEvent e)
+ {
+ selectedButton = (Button) e.getSource();
+ setTargetColour(selectedButton.getBackground());
+ }
+
+ void makeButton(String label, String aa)
+ {
+ final Button button = new Button();
+ Color col = Color.white;
+
+ try
+ {
+ col = oldColourScheme.findColour(aa.charAt(0), -1);
+ }
+ catch (Exception ex)
+ {}
+
+ button.setBackground(col);
+ oldColours.addElement(col);
+ button.setLabel(label);
+ button.setForeground(col.darker().darker().darker());
+ button.setFont(new java.awt.Font("Verdana", 1, 10));
+ button.addMouseListener(new java.awt.event.MouseAdapter()
+ {
+ public void mousePressed(MouseEvent e)
+ {
+ colourButtonPressed(e);
+ }
+ });
+
+ buttonPanel.add(button, null);
+ }
+
+ protected void okButton_actionPerformed()
+ {
+ applyButton_actionPerformed();
+ if (dialog != null)
+ dialog.setVisible(false);
+
+ frame.setVisible(false);
+ }
+
+ public Color getColor()
+ {
+ return new Color(R, G, B);
+ }
+
+ protected void applyButton_actionPerformed()
+ {
+ if (caller != null)
+ {
+ if (caller instanceof FeatureSettings)
+ {
+ ( (FeatureSettings) caller).setUserColour
+ (originalLabel, getColor());
+ }
+ else if (caller instanceof AnnotationColourChooser)
+ {
+ if (originalLabel.equals("Min Colour"))
+ {
+ ( (AnnotationColourChooser) caller).minColour_actionPerformed
+ (getColor());
+ }
+ else
+ {
+ ( (AnnotationColourChooser) caller).maxColour_actionPerformed
+ (getColor());
+ }
+ }
+ else if(caller instanceof FeatureRenderer)
+ {
+ ((FeatureRenderer)caller).colourPanel.setBackground(getColor());
+ }
+
+ return;
+ }
+
+ Color[] newColours = new Color[24];
+ for (int i = 0; i < 24; i++)
+ {
+ Button button = (Button) buttonPanel.getComponent(i);
+ newColours[i] = button.getBackground();
+ }
+
+ UserColourScheme ucs = new UserColourScheme(newColours);
+ if (ap != null)
+ {
+ ucs.setThreshold(0, ap.av.getIgnoreGapsConsensus());
+ }
+
+ if (ap != null)
+ {
+ if (seqGroup != null)
+ {
+ seqGroup.cs = ucs;
+ }
+ else
+ {
+ ap.av.setGlobalColourScheme(ucs);
+ }
+ ap.seqPanel.seqCanvas.img = null;
+ ap.paintAlignment(true);
+ }
+ else if(jmol!=null)
+ {
+ jmol.setJalviewColourScheme(ucs);
+ }
+ else if (pdbcanvas != null)
+ {
+ pdbcanvas.setColours(ucs);
+ }
+ }
+
+ protected void cancelButton_actionPerformed()
+ {
+ if (caller != null)
+ {
+ if (caller instanceof FeatureSettings)
+ {
+ ( (FeatureSettings) caller).setUserColour
+ (originalLabel, originalColour);
+ }
+ else if (caller instanceof AnnotationColourChooser)
+ {
+ if (originalLabel.equals("Min Colour"))
+ {
+ ( (AnnotationColourChooser) caller).minColour_actionPerformed
+ (originalColour);
+ }
+ else
+ {
+ ( (AnnotationColourChooser) caller).maxColour_actionPerformed
+ (originalColour);
+ }
+ }
+ else if (caller instanceof FeatureRenderer)
+ {
+ ( (FeatureRenderer) caller).colourPanel.setBackground(originalColour);
+
+ }
+
+ if(dialog!=null)
+ dialog.setVisible(false);
+
+ frame.setVisible(false);
+ return;
+ }
+
+ Color[] newColours = new Color[24];
+ for (int i = 0; i < 24; i++)
+ {
+ newColours[i] = (Color) oldColours.elementAt(i);
+ buttonPanel.getComponent(i).setBackground(newColours[i]);
+ }
+
+ UserColourScheme ucs = new UserColourScheme(newColours);
+
+ if (ap != null)
+ {
+ if (seqGroup != null)
+ {
+ seqGroup.cs = ucs;
+ }
+ else
+ {
+ ap.av.setGlobalColourScheme(ucs);
+ }
+ ap.paintAlignment(true);
+ }
+ else if(jmol !=null)
+ {
+ jmol.setJalviewColourScheme(ucs);
+ }
+ else if (pdbcanvas != null)
+ {
+ pdbcanvas.pdb.setColours(ucs);
+ }
+
+ frame.setVisible(false);
+ }
+
+ protected Panel buttonPanel = new Panel();
+ protected GridLayout gridLayout = new GridLayout();
+ Panel okcancelPanel = new Panel();
+ protected Button okButton = new Button();
+ protected Button applyButton = new Button();
+ protected Button cancelButton = new Button();
+ protected Scrollbar rScroller = new Scrollbar();
+ Label label1 = new Label();
+ protected TextField rText = new TextField();
+ Label label4 = new Label();
+ protected Scrollbar gScroller = new Scrollbar();
+ protected TextField gText = new TextField();
+ Label label5 = new Label();
+ protected Scrollbar bScroller = new Scrollbar();
+ protected TextField bText = new TextField();
+ protected Panel target = new Panel();
+
+ private void jbInit()
+ throws Exception
+ {
+ this.setLayout(null);
+ buttonPanel.setLayout(gridLayout);
+ gridLayout.setColumns(6);
+ gridLayout.setRows(4);
+ okButton.setFont(new java.awt.Font("Verdana", 0, 11));
+ okButton.setLabel("OK");
+ okButton.addActionListener(this);
+ applyButton.setFont(new java.awt.Font("Verdana", 0, 11));
+ applyButton.setLabel("Apply");
+ applyButton.addActionListener(this);
+ cancelButton.setFont(new java.awt.Font("Verdana", 0, 11));
+ cancelButton.setLabel("Cancel");
+ cancelButton.addActionListener(this);
+ this.setBackground(new Color(212, 208, 223));
+ okcancelPanel.setBounds(new Rectangle(0, 265, 400, 35));
+ buttonPanel.setBounds(new Rectangle(0, 123, 400, 142));
+ rScroller.setMaximum(256);
+ rScroller.setMinimum(0);
+ rScroller.setOrientation(0);
+ rScroller.setUnitIncrement(1);
+ rScroller.setVisibleAmount(1);
+ rScroller.setBounds(new Rectangle(36, 27, 119, 19));
+ rScroller.addAdjustmentListener(this);
+ label1.setAlignment(Label.RIGHT);
+ label1.setText("R");
+ label1.setBounds(new Rectangle(19, 30, 16, 15));
+ rText.setFont(new java.awt.Font("Dialog", Font.PLAIN, 10));
+ rText.setText("0 ");
+ rText.setBounds(new Rectangle(156, 27, 53, 19));
+ rText.addActionListener(this);
+ label4.setAlignment(Label.RIGHT);
+ label4.setText("G");
+ label4.setBounds(new Rectangle(15, 56, 20, 15));
+ gScroller.setMaximum(256);
+ gScroller.setMinimum(0);
+ gScroller.setOrientation(0);
+ gScroller.setUnitIncrement(1);
+ gScroller.setVisibleAmount(1);
+ gScroller.setBounds(new Rectangle(35, 52, 120, 20));
+ gScroller.addAdjustmentListener(this);
+ gText.setFont(new java.awt.Font("Dialog", Font.PLAIN, 10));
+ gText.setText("0 ");
+ gText.setBounds(new Rectangle(156, 52, 53, 20));
+ gText.addActionListener(this);
+ label5.setAlignment(Label.RIGHT);
+ label5.setText("B");
+ label5.setBounds(new Rectangle(14, 82, 20, 15));
+ bScroller.setMaximum(256);
+ bScroller.setMinimum(0);
+ bScroller.setOrientation(0);
+ bScroller.setUnitIncrement(1);
+ bScroller.setVisibleAmount(1);
+ bScroller.setBounds(new Rectangle(35, 78, 120, 20));
+ bScroller.addAdjustmentListener(this);
+ bText.setFont(new java.awt.Font("Dialog", Font.PLAIN, 10));
+ bText.setText("0 ");
+ bText.setBounds(new Rectangle(157, 78, 52, 20));
+ bText.addActionListener(this);
+ target.setBackground(Color.black);
+ target.setBounds(new Rectangle(229, 26, 134, 79));
+ this.add(okcancelPanel, null);
+ okcancelPanel.add(okButton, null);
+ okcancelPanel.add(applyButton, null);
+ okcancelPanel.add(cancelButton, null);
+ this.add(buttonPanel, null);
+ this.add(target, null);
+ this.add(gScroller);
+ this.add(rScroller);
+ this.add(bScroller);
+ this.add(label5);
+ this.add(label4);
+ this.add(label1);
+ this.add(gText);
+ this.add(rText);
+ this.add(bText);
+ }
+
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
/*
- * This class was automatically generated with
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
- * Schema.
- * $Id$
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.binding;
//---------------------------------/
/*
- * This class was automatically generated with
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
- * Schema.
- * $Id$
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.binding;
//---------------------------------/
/*
- * This class was automatically generated with
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
- * Schema.
- * $Id$
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.binding;
//---------------------------------/
/*
- * This class was automatically generated with
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
- * Schema.
- * $Id$
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.binding;
//---------------------------------/
/*
- * This class was automatically generated with
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
- * Schema.
- * $Id$
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.binding;
//---------------------------------/
/*
- * This class was automatically generated with
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
- * Schema.
- * $Id$
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.binding;
//---------------------------------/
/*
- * This class was automatically generated with
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
- * Schema.
- * $Id$
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.binding;
//---------------------------------/
/*
- * This class was automatically generated with
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
- * Schema.
- * $Id$
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.binding;
//---------------------------------/
/*
- * This class was automatically generated with
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
- * Schema.
- * $Id$
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.binding;
//---------------------------------/
/*
- * This class was automatically generated with
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
- * Schema.
- * $Id$
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.binding;
//---------------------------------/
/*
- * This class was automatically generated with
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
- * Schema.
- * $Id$
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.binding;
//---------------------------------/
/*
- * This class was automatically generated with
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
- * Schema.
- * $Id$
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.binding;
//---------------------------------/
/*
- * This class was automatically generated with
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
- * Schema.
- * $Id$
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.binding;
//---------------------------------/
/*
- * This class was automatically generated with
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
- * Schema.
- * $Id$
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.binding;
/**
/*
- * This class was automatically generated with
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
- * Schema.
- * $Id$
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.binding;
//---------------------------------/
/*
- * This class was automatically generated with
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
- * Schema.
- * $Id$
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.binding;
//---------------------------------/
/*
- * This class was automatically generated with
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
- * Schema.
- * $Id$
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.binding;
//---------------------------------/
/*
- * This class was automatically generated with
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
- * Schema.
- * $Id$
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.binding;
//---------------------------------/
/*
- * This class was automatically generated with
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
- * Schema.
- * $Id$
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.binding;
//---------------------------------/
/*
- * This class was automatically generated with
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
- * Schema.
- * $Id$
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.binding;
//---------------------------------/
/*
- * This class was automatically generated with
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
- * Schema.
- * $Id$
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.binding;
//---------------------------------/
/*
- * This class was automatically generated with
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
- * Schema.
- * $Id$
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.binding;
//---------------------------------/
/*
- * This class was automatically generated with
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
- * Schema.
- * $Id$
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.binding;
//---------------------------------/
/*
- * This class was automatically generated with
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
- * Schema.
- * $Id$
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.binding;
//---------------------------------/
/*
- * This class was automatically generated with
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
- * Schema.
- * $Id$
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.binding;
//---------------------------------/
/*
- * This class was automatically generated with
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
- * Schema.
- * $Id$
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.binding;
//---------------------------------/
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.commands;
/*
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.commands;
/*
-
/*
-* Jalview - A Sequence Alignment Editor and Viewer
-* Copyright (C) 2007 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
-*/
-
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.commands;
import jalview.datamodel.*;
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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.Enumeration;\r
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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>\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
-{\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)\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
- /**\r
- * Creates a new AlignmentOrder object.\r
- */\r
- public AlignmentOrder()\r
- {\r
- }\r
-\r
- /**\r
- * AlignmentOrder\r
- *\r
- * @param anOrder Vector\r
- */\r
- public AlignmentOrder(Vector anOrder)\r
- {\r
- Order = anOrder;\r
- }\r
-\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
- /**\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
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param Type DOCUMENT ME!\r
- */\r
- public void setType(int Type)\r
- {\r
- this.Type = Type;\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @return DOCUMENT ME!\r
- */\r
- public int getType()\r
- {\r
- return Type;\r
- }\r
-\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
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @return DOCUMENT ME!\r
- */\r
- public String getName()\r
- {\r
- return Name;\r
- }\r
-\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
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @return DOCUMENT ME!\r
- */\r
- public Vector getOrder()\r
- {\r
- return Order;\r
- }\r
-\r
- /**\r
- * replaces oldref with newref in the alignment order.\r
- * @param oldref\r
- * @param newref\r
- * @return true if oldref was contained in order and replaced with newref\r
- */\r
- public boolean updateSequence(SequenceI oldref, SequenceI newref)\r
- {\r
- int found = Order.indexOf(oldref);\r
- if (found > -1)\r
- {\r
- Order.setElementAt(newref, found);\r
- }\r
- return found > -1;\r
- }\r
-\r
- /**\r
- * Exact equivalence of two AlignmentOrders\r
- * @param o\r
- * @return true if o orders the same sequenceI objects in the same way\r
- */\r
- public boolean equals(AlignmentOrder o)\r
- {\r
- return equals(o, true);\r
- }\r
-\r
- /**\r
- * Exact equivalence of two AlignmentOrders\r
- * // TODO: Weak SequenceI equivalence - will throw Error at moment\r
- * @param o\r
- * @param identity - false - use weak equivalence (refers to same or different parts of same sequence)\r
- * @return true if o orders equivalent sequenceI objects in the same way\r
- */\r
- public boolean equals(AlignmentOrder o, boolean identity)\r
- {\r
- if (o != this)\r
- {\r
- if (o == null)\r
- {\r
- return false;\r
- }\r
- if (Order != null && o.Order != null && Order.size() == o.Order.size())\r
- {\r
- if (!identity)\r
- {\r
- throw new Error("Weak sequenceI equivalence not yet implemented.");\r
- }\r
- else\r
- {\r
- for (int i = 0, j = o.Order.size(); i < j; i++)\r
- {\r
- if (Order.elementAt(i) != o.Order.elementAt(i))\r
- {\r
- return false;\r
- }\r
- }\r
- }\r
- }\r
- else\r
- {\r
- return false;\r
- }\r
- }\r
- return true;\r
- }\r
-\r
- /**\r
- * Consistency test for alignmentOrders\r
- * @param o\r
- * @return true if o contains or is contained by this and the common SequenceI objects are ordered in the same way\r
- */\r
- public boolean isConsistent(AlignmentOrder o)\r
- {\r
- return isConsistent(o, true);\r
- }\r
-\r
- /**\r
- * Consistency test for alignmentOrders\r
- * @param o\r
- * // TODO: Weak SequenceI equivalence - will throw Error at moment\r
- * @param identity - false - use weak equivalence (refers to same or different parts of same sequence)\r
- * @return true if o contains or is contained by this and the common SequenceI objects are ordered in the same way\r
- */\r
- public boolean isConsistent(AlignmentOrder o, boolean identity)\r
- {\r
- if (o != this)\r
- {\r
- if (o == null)\r
- {\r
- return false;\r
- }\r
- if (Order != null && o.Order != null)\r
- {\r
- Vector c, s;\r
- if (o.Order.size() > Order.size())\r
- {\r
- c = o.Order;\r
- s = Order;\r
- }\r
- else\r
- {\r
- c = Order;\r
- s = o.Order;\r
- }\r
- if (!identity)\r
- {\r
- throw new Error("Weak sequenceI equivalence not yet implemented.");\r
- }\r
- else\r
- {\r
- // test if c contains s and order in s is conserved in c\r
- int last = -1;\r
- for (int i = 0, j = s.size(); i < j; i++)\r
- {\r
- int pos = c.indexOf(s.elementAt(i)); // JBPNote - optimize by incremental position search\r
- if (pos > last)\r
- {\r
- last = pos;\r
- }\r
- else\r
- {\r
- return false;\r
- }\r
- }\r
- }\r
- }\r
- else\r
- {\r
- return false;\r
- }\r
- }\r
- return true;\r
- }\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
- } */\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.datamodel;
+
+import java.util.*;
+
+/**
+ * <p>Title: </p>
+ *
+ * <p>Description: </p>
+ *
+ * <p>Copyright: Copyright (c) 2004</p>
+ *
+ * <p>Company: Dundee University</p>
+ *
+ * @author not attributable
+ * @version 1.0
+ */
+public class AlignmentOrder
+{
+ // JBPNote : this method would return a vector containing all sequences in seqset
+ // with those also contained in order at the beginning of the vector in the order
+ // given by order. AlignmentSorter.vectorSubsetToArray already does this, but that method
+ // should be here for completeness.
+
+ /* 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;
+ }
+ */
+
+ /** DOCUMENT ME!! */
+ public static final int FILE = 0;
+
+ /** DOCUMENT ME!! */
+ public static final int MSA = 1;
+
+ /** DOCUMENT ME!! */
+ public static final int USER = 2;
+ private int Type = 0;
+ private String Name;
+ private Vector Order = null;
+
+ /**
+ * Creates a new AlignmentOrder object.
+ */
+ public AlignmentOrder()
+ {
+ }
+
+ /**
+ * AlignmentOrder
+ *
+ * @param anOrder Vector
+ */
+ public AlignmentOrder(Vector anOrder)
+ {
+ Order = anOrder;
+ }
+
+ /**
+ * AlignmentOrder
+ *
+ * @param orderFrom AlignmentI
+ */
+ public AlignmentOrder(AlignmentI orderFrom)
+ {
+ Order = new Vector();
+
+ for (int i = 0, ns = orderFrom.getHeight(); i < ns; i++)
+ {
+ Order.addElement(orderFrom.getSequenceAt(i));
+ }
+ }
+
+ /**
+ * Creates a new AlignmentOrder object.
+ *
+ * @param orderFrom DOCUMENT ME!
+ */
+ public AlignmentOrder(SequenceI[] orderFrom)
+ {
+ Order = new Vector();
+
+ for (int i = 0, ns = orderFrom.length; i < ns; i++)
+ {
+ Order.addElement(orderFrom[i]);
+ }
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param Type DOCUMENT ME!
+ */
+ public void setType(int Type)
+ {
+ this.Type = Type;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public int getType()
+ {
+ return Type;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param Name DOCUMENT ME!
+ */
+ public void setName(String Name)
+ {
+ this.Name = Name;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public String getName()
+ {
+ return Name;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param Order DOCUMENT ME!
+ */
+ public void setOrder(Vector Order)
+ {
+ this.Order = Order;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public Vector getOrder()
+ {
+ return Order;
+ }
+
+ /**
+ * replaces oldref with newref in the alignment order.
+ * @param oldref
+ * @param newref
+ * @return true if oldref was contained in order and replaced with newref
+ */
+ public boolean updateSequence(SequenceI oldref, SequenceI newref)
+ {
+ int found = Order.indexOf(oldref);
+ if (found > -1)
+ {
+ Order.setElementAt(newref, found);
+ }
+ return found > -1;
+ }
+
+ /**
+ * Exact equivalence of two AlignmentOrders
+ * @param o
+ * @return true if o orders the same sequenceI objects in the same way
+ */
+ public boolean equals(AlignmentOrder o)
+ {
+ return equals(o, true);
+ }
+
+ /**
+ * Exact equivalence of two AlignmentOrders
+ * // TODO: Weak SequenceI equivalence - will throw Error at moment
+ * @param o
+ * @param identity - false - use weak equivalence (refers to same or different parts of same sequence)
+ * @return true if o orders equivalent sequenceI objects in the same way
+ */
+ public boolean equals(AlignmentOrder o, boolean identity)
+ {
+ if (o != this)
+ {
+ if (o == null)
+ {
+ return false;
+ }
+ if (Order != null && o.Order != null && Order.size() == o.Order.size())
+ {
+ if (!identity)
+ {
+ throw new Error("Weak sequenceI equivalence not yet implemented.");
+ }
+ else
+ {
+ for (int i = 0, j = o.Order.size(); i < j; i++)
+ {
+ if (Order.elementAt(i) != o.Order.elementAt(i))
+ {
+ return false;
+ }
+ }
+ }
+ }
+ else
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Consistency test for alignmentOrders
+ * @param o
+ * @return true if o contains or is contained by this and the common SequenceI objects are ordered in the same way
+ */
+ public boolean isConsistent(AlignmentOrder o)
+ {
+ return isConsistent(o, true);
+ }
+
+ /**
+ * Consistency test for alignmentOrders
+ * @param o
+ * // TODO: Weak SequenceI equivalence - will throw Error at moment
+ * @param identity - false - use weak equivalence (refers to same or different parts of same sequence)
+ * @return true if o contains or is contained by this and the common SequenceI objects are ordered in the same way
+ */
+ public boolean isConsistent(AlignmentOrder o, boolean identity)
+ {
+ if (o != this)
+ {
+ if (o == null)
+ {
+ return false;
+ }
+ if (Order != null && o.Order != null)
+ {
+ Vector c, s;
+ if (o.Order.size() > Order.size())
+ {
+ c = o.Order;
+ s = Order;
+ }
+ else
+ {
+ c = Order;
+ s = o.Order;
+ }
+ if (!identity)
+ {
+ throw new Error("Weak sequenceI equivalence not yet implemented.");
+ }
+ else
+ {
+ // test if c contains s and order in s is conserved in c
+ int last = -1;
+ for (int i = 0, j = s.size(); i < j; i++)
+ {
+ int pos = c.indexOf(s.elementAt(i)); // JBPNote - optimize by incremental position search
+ if (pos > last)
+ {
+ last = pos;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ }
+ }
+ else
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+ /**
+ * AlignmentOrder
+ *
+ * @param orderThis AlignmentI
+ * @param byThat AlignmentI
+ */
+
+ /* 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
+
+ } */
+}
-/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 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.datamodel;
-
-/**
- * <p>Title: </p>
- *
- * <p>Description: </p>
- *
- * <p>Copyright: Copyright (c) 2004</p>
- *
- * <p>Company: Dundee University</p>
- *
- * @author not attributable
- * @version 1.0
- */
-public class AlignmentView
-{
- /**
- * Transient object compactly representing a 'view' of an alignment - with discontinuities marked.
- */
- private SeqCigar[] sequences = null;
- private int[] contigs = null;
- private int width = 0;
- private int firstCol = 0;
- public AlignmentView(CigarArray seqcigararray)
- {
- if (!seqcigararray.isSeqCigarArray())
- {
- throw new Error("Implementation Error - can only make an alignment view from a CigarArray of sequences.");
- }
- //contigs = seqcigararray.applyDeletions();
- contigs = seqcigararray.getDeletedRegions();
- sequences = seqcigararray.getSeqCigarArray();
- width = seqcigararray.getWidth(); // visible width
- }
-
- /**
- * Create an alignmentView where the first column corresponds with the 'firstcol' column of some reference alignment
- * @param sdata
- * @param firstcol
- */
- public AlignmentView(CigarArray sdata, int firstcol)
- {
- this(sdata);
- firstCol = firstcol;
- }
-
- public void setSequences(SeqCigar[] sequences)
- {
- this.sequences = sequences;
- }
-
- public void setContigs(int[] contigs)
- {
- this.contigs = contigs;
- }
-
- public SeqCigar[] getSequences()
- {
- return sequences;
- }
-
- /**
- * @see CigarArray.getDeletedRegions
- * @return int[] { vis_start, sym_start, length }
- */
- public int[] getContigs()
- {
- return contigs;
- }
-
- /**
- * get the full alignment and a columnselection object marking the hidden regions
- * @param gapCharacter char
- * @return Object[] { SequenceI[], ColumnSelection}
- */
- public Object[] getAlignmentAndColumnSelection(char gapCharacter)
- {
- ColumnSelection colsel = new ColumnSelection();
-
- return new Object[]
- {
- SeqCigar.createAlignmentSequences(sequences, gapCharacter, colsel,
- contigs), colsel};
- }
-
- /**
- * getSequenceStrings
- *
- * @param c char
- * @return String[]
- */
- public String[] getSequenceStrings(char c)
- {
- String[] seqs = new String[sequences.length];
- for (int n = 0; n < sequences.length; n++)
- {
- String fullseq = sequences[n].getSequenceString(c);
- if (contigs != null)
- {
- seqs[n] = "";
- int p = 0;
- for (int h = 0; h < contigs.length; h += 3)
- {
- seqs[n] += fullseq.substring(p, contigs[h + 1]);
- p = contigs[h + 1] + contigs[h + 2];
- }
- seqs[n] += fullseq.substring(p);
- }
- else
- {
- seqs[n] = fullseq;
- }
- }
- return seqs;
- }
-
- /**
- *
- * @return visible number of columns in alignment view
- */
- public int getWidth()
- {
- return width;
- }
-
- protected void setWidth(int width)
- {
- this.width = width;
- }
-
- /**
- * get the contiguous subalignments in an alignment view.
- * @param gapCharacter char
- * @return SequenceI[][]
- */
- public SequenceI[][] getVisibleContigs(char gapCharacter)
- {
- SequenceI[][] smsa;
- int njobs = 1;
- if (sequences == null || width <= 0)
- {
- return null;
- }
- if (contigs != null && contigs.length > 0)
- {
- int start = 0;
- njobs = 0;
- int fwidth = width;
- for (int contig = 0; contig < contigs.length; contig += 3)
- {
- if ( (contigs[contig + 1] - start) > 0)
- {
- njobs++;
- }
- fwidth += contigs[contig + 2]; // end up with full region width (including hidden regions)
- start = contigs[contig + 1] + contigs[contig + 2];
- }
- if (start < fwidth)
- {
- njobs++;
- }
- smsa = new SequenceI[njobs][];
- start = 0;
- int j = 0;
- for (int contig = 0; contig < contigs.length; contig += 3)
- {
- if (contigs[contig + 1] - start > 0)
- {
- SequenceI mseq[] = new SequenceI[sequences.length];
- for (int s = 0; s < mseq.length; s++)
- {
- mseq[s] = sequences[s].getSeq(gapCharacter).getSubSequence(start,
- contigs[contig + 1]);
- }
- smsa[j] = mseq;
- j++;
- }
- start = contigs[contig + 1] + contigs[contig + 2];
- }
- if (start < fwidth)
- {
- SequenceI mseq[] = new SequenceI[sequences.length];
- for (int s = 0; s < mseq.length; s++)
- {
- mseq[s] = sequences[s].getSeq(gapCharacter).getSubSequence(start,
- fwidth + 1);
- }
- smsa[j] = mseq;
- j++;
- }
- }
- else
- {
- smsa = new SequenceI[1][];
- smsa[0] = new SequenceI[sequences.length];
- for (int s = 0; s < sequences.length; s++)
- {
- smsa[0][s] = sequences[s].getSeq(gapCharacter);
- }
- }
- return smsa;
- }
-
- /**
- * return full msa and hidden regions with visible blocks replaced with new sub alignments
- * @param nvismsa SequenceI[][]
- * @param orders AlignmentOrder[] corresponding to each SequenceI[] block.
- * @return Object[]
- */
- public Object[] getUpdatedView(SequenceI[][] nvismsa, AlignmentOrder[] orders,
- char gapCharacter)
- {
- if (sequences == null || width <= 0)
- {
- throw new Error("empty view cannot be updated.");
- }
- if (nvismsa == null)
- {
- throw new Error(
- "nvismsa==null. use getAlignmentAndColumnSelection() instead.");
- }
- if (contigs != null && contigs.length > 0)
- {
- SequenceI[] alignment = new SequenceI[sequences.length];
- ColumnSelection columnselection = new ColumnSelection();
- if (contigs != null && contigs.length > 0)
- {
- int start = 0;
- int nwidth = 0;
- int owidth = width;
- int j = 0;
- for (int contig = 0; contig < contigs.length; contig += 3)
- {
- owidth += contigs[contig + 2]; // recover final column width
- if (contigs[contig + 1] - start > 0)
- {
- int swidth = 0; // subalignment width
- if (nvismsa[j] != null)
- {
- SequenceI mseq[] = nvismsa[j];
- AlignmentOrder order = (orders == null) ? null : orders[j];
- j++;
- if (mseq.length != sequences.length)
- {
- throw new Error(
- "Mismatch between number of sequences in block " + j + " (" +
- mseq.length + ") and the original view (" +
- sequences.length + ")");
- }
- swidth = mseq[0].getLength(); // JBPNote: could ensure padded here.
- for (int s = 0; s < mseq.length; s++)
- {
- if (alignment[s] == null)
- {
- alignment[s] = mseq[s];
- }
- else
- {
- alignment[s].setSequence(alignment[s].getSequenceAsString() +
- mseq[s].getSequenceAsString());
- if (mseq[s].getStart() <= mseq[s].getEnd())
- {
- alignment[s].setEnd(mseq[s].getEnd());
- }
- if (order != null)
- {
- order.updateSequence(mseq[s], alignment[s]);
- }
- }
- }
- }
- else
- {
- // recover original alignment block or place gaps
- if (true)
- {
- // recover input data
- for (int s = 0; s < sequences.length; s++)
- {
- SequenceI oseq = sequences[s].getSeq(gapCharacter).
- getSubSequence(start,
- contigs[contig + 1]);
- if (swidth < oseq.getLength())
- {
- swidth = oseq.getLength();
- }
- if (alignment[s] == null)
- {
- alignment[s] = oseq;
- }
- else
- {
- alignment[s].setSequence(alignment[s].getSequenceAsString() +
- oseq.getSequenceAsString());
- if (oseq.getEnd() >= oseq.getStart())
- {
- alignment[s].setEnd(oseq.getEnd());
- }
- }
- }
-
- }
- j++;
- }
- nwidth += swidth;
- }
- // advance to begining of visible region
- start = contigs[contig + 1] + contigs[contig + 2];
- // add hidden segment to right of next region
- for (int s = 0; s < sequences.length; s++)
- {
- SequenceI hseq = sequences[s].getSeq(gapCharacter).getSubSequence(
- contigs[contig +
- 1], start);
- if (alignment[s] == null)
- {
- alignment[s] = hseq;
- }
- else
- {
- alignment[s].setSequence(alignment[s].getSequenceAsString() +
- hseq.getSequenceAsString());
- if (hseq.getEnd() >= hseq.getStart())
- {
- alignment[s].setEnd(hseq.getEnd());
- }
- }
- }
- // mark hidden segment as hidden in the new alignment
- columnselection.hideColumns(nwidth, nwidth + contigs[contig + 2] - 1);
- nwidth += contigs[contig + 2];
- }
- // Do final segment - if it exists
- if (j < nvismsa.length)
- {
- int swidth = 0;
- if (nvismsa[j] != null)
- {
- SequenceI mseq[] = nvismsa[j];
- AlignmentOrder order = (orders != null) ? orders[j] : null;
- swidth = mseq[0].getLength();
- for (int s = 0; s < mseq.length; s++)
- {
- if (alignment[s] == null)
- {
- alignment[s] = mseq[s];
- }
- else
- {
- alignment[s].setSequence(alignment[s].getSequenceAsString() +
- mseq[s].getSequenceAsString());
- if (mseq[s].getEnd() >= mseq[s].getStart())
- {
- alignment[s].setEnd(mseq[s].getEnd());
- }
- if (order != null)
- {
- order.updateSequence(mseq[s], alignment[s]);
- }
- }
- }
- }
- else
- {
- if (start < owidth)
- {
- // recover input data or place gaps
- if (true)
- {
- // recover input data
- for (int s = 0; s < sequences.length; s++)
- {
- SequenceI oseq = sequences[s].getSeq(gapCharacter).
- getSubSequence(start,
- owidth + 1);
- if (swidth < oseq.getLength())
- {
- swidth = oseq.getLength();
- }
- if (alignment[s] == null)
- {
- alignment[s] = oseq;
- }
- else
- {
- alignment[s].setSequence(alignment[s].getSequenceAsString() +
- oseq.getSequenceAsString());
- if (oseq.getEnd() >= oseq.getStart())
- {
- alignment[s].setEnd(oseq.getEnd());
- }
- }
- }
- nwidth += swidth;
- }
- else
- {
- // place gaps.
- throw new Error("Padding not yet implemented.");
- }
- }
- }
- }
- }
- return new Object[]
- {
- alignment, columnselection};
- }
- else
- {
- if (nvismsa.length != 1)
- {
- throw new Error("Mismatch between visible blocks to update and number of contigs in view (contigs=0,blocks=" +
- nvismsa.length);
- }
- if (nvismsa[0] != null)
- {
- return new Object[]
- {
- nvismsa[0], new ColumnSelection()};
- }
- else
- {
- return getAlignmentAndColumnSelection(gapCharacter);
- }
- }
- }
-
- /**
- * returns simple array of start end positions of visible range on alignment.
- * vis_start and vis_end are inclusive - use SequenceI.getSubSequence(vis_start, vis_end+1) to recover visible sequence from underlying alignment.
- * @return int[] { start_i, end_i } for 1<i<n visible regions.
- */
- public int[] getVisibleContigs()
- {
- if (contigs != null && contigs.length > 0)
- {
- int start = 0;
- int nvis = 0;
- int fwidth = width;
- for (int contig = 0; contig < contigs.length; contig += 3)
- {
- if ( (contigs[contig + 1] - start) > 0)
- {
- nvis++;
- }
- fwidth += contigs[contig + 2]; // end up with full region width (including hidden regions)
- start = contigs[contig + 1] + contigs[contig + 2];
- }
- if (start < fwidth)
- {
- nvis++;
- }
- int viscontigs[] = new int[nvis * 2];
- nvis = 0;
- start = 0;
- for (int contig = 0; contig < contigs.length; contig += 3)
- {
- if ( (contigs[contig + 1] - start) > 0)
- {
- viscontigs[nvis] = start;
- viscontigs[nvis + 1] = contigs[contig + 1] - 1; // end is inclusive
- nvis += 2;
- }
- start = contigs[contig + 1] + contigs[contig + 2];
- }
- if (start < fwidth)
- {
- viscontigs[nvis] = start;
- viscontigs[nvis + 1] = fwidth; // end is inclusive
- nvis += 2;
- }
- return viscontigs;
- }
- else
- {
- return new int[]
- {
- 0, width};
- }
- }
-
- /**
- *
- * @return position of first visible column of AlignmentView within its parent's alignment reference frame
- */
- public int getAlignmentOrigin()
- {
- // TODO Auto-generated method stub
- return firstCol;
- }
-}
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
+/**\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 AlignmentView\r
+{\r
+ /**\r
+ * Transient object compactly representing a 'view' of an alignment - with discontinuities marked.\r
+ */\r
+ private SeqCigar[] sequences = null;\r
+ private int[] contigs = null;\r
+ private int width = 0;\r
+ private int firstCol = 0;\r
+ public AlignmentView(CigarArray seqcigararray)\r
+ {\r
+ if (!seqcigararray.isSeqCigarArray())\r
+ {\r
+ throw new Error("Implementation Error - can only make an alignment view from a CigarArray of sequences.");\r
+ }\r
+ //contigs = seqcigararray.applyDeletions();\r
+ contigs = seqcigararray.getDeletedRegions();\r
+ sequences = seqcigararray.getSeqCigarArray();\r
+ width = seqcigararray.getWidth(); // visible width\r
+ }\r
+\r
+ /**\r
+ * Create an alignmentView where the first column corresponds with the 'firstcol' column of some reference alignment\r
+ * @param sdata\r
+ * @param firstcol\r
+ */\r
+ public AlignmentView(CigarArray sdata, int firstcol)\r
+ {\r
+ this(sdata);\r
+ firstCol = firstcol;\r
+ }\r
+\r
+ public void setSequences(SeqCigar[] sequences)\r
+ {\r
+ this.sequences = sequences;\r
+ }\r
+\r
+ public void setContigs(int[] contigs)\r
+ {\r
+ this.contigs = contigs;\r
+ }\r
+\r
+ public SeqCigar[] getSequences()\r
+ {\r
+ return sequences;\r
+ }\r
+\r
+ /**\r
+ * @see CigarArray.getDeletedRegions\r
+ * @return int[] { vis_start, sym_start, length }\r
+ */\r
+ public int[] getContigs()\r
+ {\r
+ return contigs;\r
+ }\r
+\r
+ /**\r
+ * get the full alignment and a columnselection object marking the hidden regions\r
+ * @param gapCharacter char\r
+ * @return Object[] { SequenceI[], ColumnSelection}\r
+ */\r
+ public Object[] getAlignmentAndColumnSelection(char gapCharacter)\r
+ {\r
+ ColumnSelection colsel = new ColumnSelection();\r
+\r
+ return new Object[]\r
+ {\r
+ SeqCigar.createAlignmentSequences(sequences, gapCharacter, colsel,\r
+ contigs), colsel};\r
+ }\r
+\r
+ /**\r
+ * getSequenceStrings\r
+ *\r
+ * @param c char\r
+ * @return String[]\r
+ */\r
+ public String[] getSequenceStrings(char c)\r
+ {\r
+ String[] seqs = new String[sequences.length];\r
+ for (int n = 0; n < sequences.length; n++)\r
+ {\r
+ String fullseq = sequences[n].getSequenceString(c);\r
+ if (contigs != null)\r
+ {\r
+ seqs[n] = "";\r
+ int p = 0;\r
+ for (int h = 0; h < contigs.length; h += 3)\r
+ {\r
+ seqs[n] += fullseq.substring(p, contigs[h + 1]);\r
+ p = contigs[h + 1] + contigs[h + 2];\r
+ }\r
+ seqs[n] += fullseq.substring(p);\r
+ }\r
+ else\r
+ {\r
+ seqs[n] = fullseq;\r
+ }\r
+ }\r
+ return seqs;\r
+ }\r
+\r
+ /**\r
+ *\r
+ * @return visible number of columns in alignment view\r
+ */\r
+ public int getWidth()\r
+ {\r
+ return width;\r
+ }\r
+\r
+ protected void setWidth(int width)\r
+ {\r
+ this.width = width;\r
+ }\r
+\r
+ /**\r
+ * get the contiguous subalignments in an alignment view.\r
+ * @param gapCharacter char\r
+ * @return SequenceI[][]\r
+ */\r
+ public SequenceI[][] getVisibleContigs(char gapCharacter)\r
+ {\r
+ SequenceI[][] smsa;\r
+ int njobs = 1;\r
+ if (sequences == null || width <= 0)\r
+ {\r
+ return null;\r
+ }\r
+ if (contigs != null && contigs.length > 0)\r
+ {\r
+ int start = 0;\r
+ njobs = 0;\r
+ int fwidth = width;\r
+ for (int contig = 0; contig < contigs.length; contig += 3)\r
+ {\r
+ if ( (contigs[contig + 1] - start) > 0)\r
+ {\r
+ njobs++;\r
+ }\r
+ fwidth += contigs[contig + 2]; // end up with full region width (including hidden regions)\r
+ start = contigs[contig + 1] + contigs[contig + 2];\r
+ }\r
+ if (start < fwidth)\r
+ {\r
+ njobs++;\r
+ }\r
+ smsa = new SequenceI[njobs][];\r
+ start = 0;\r
+ int j = 0;\r
+ for (int contig = 0; contig < contigs.length; contig += 3)\r
+ {\r
+ if (contigs[contig + 1] - start > 0)\r
+ {\r
+ SequenceI mseq[] = new SequenceI[sequences.length];\r
+ for (int s = 0; s < mseq.length; s++)\r
+ {\r
+ mseq[s] = sequences[s].getSeq(gapCharacter).getSubSequence(start,\r
+ contigs[contig + 1]);\r
+ }\r
+ smsa[j] = mseq;\r
+ j++;\r
+ }\r
+ start = contigs[contig + 1] + contigs[contig + 2];\r
+ }\r
+ if (start < fwidth)\r
+ {\r
+ SequenceI mseq[] = new SequenceI[sequences.length];\r
+ for (int s = 0; s < mseq.length; s++)\r
+ {\r
+ mseq[s] = sequences[s].getSeq(gapCharacter).getSubSequence(start,\r
+ fwidth + 1);\r
+ }\r
+ smsa[j] = mseq;\r
+ j++;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ smsa = new SequenceI[1][];\r
+ smsa[0] = new SequenceI[sequences.length];\r
+ for (int s = 0; s < sequences.length; s++)\r
+ {\r
+ smsa[0][s] = sequences[s].getSeq(gapCharacter);\r
+ }\r
+ }\r
+ return smsa;\r
+ }\r
+\r
+ /**\r
+ * return full msa and hidden regions with visible blocks replaced with new sub alignments\r
+ * @param nvismsa SequenceI[][]\r
+ * @param orders AlignmentOrder[] corresponding to each SequenceI[] block.\r
+ * @return Object[]\r
+ */\r
+ public Object[] getUpdatedView(SequenceI[][] nvismsa, AlignmentOrder[] orders,\r
+ char gapCharacter)\r
+ {\r
+ if (sequences == null || width <= 0)\r
+ {\r
+ throw new Error("empty view cannot be updated.");\r
+ }\r
+ if (nvismsa == null)\r
+ {\r
+ throw new Error(\r
+ "nvismsa==null. use getAlignmentAndColumnSelection() instead.");\r
+ }\r
+ if (contigs != null && contigs.length > 0)\r
+ {\r
+ SequenceI[] alignment = new SequenceI[sequences.length];\r
+ ColumnSelection columnselection = new ColumnSelection();\r
+ if (contigs != null && contigs.length > 0)\r
+ {\r
+ int start = 0;\r
+ int nwidth = 0;\r
+ int owidth = width;\r
+ int j = 0;\r
+ for (int contig = 0; contig < contigs.length; contig += 3)\r
+ {\r
+ owidth += contigs[contig + 2]; // recover final column width\r
+ if (contigs[contig + 1] - start > 0)\r
+ {\r
+ int swidth = 0; // subalignment width\r
+ if (nvismsa[j] != null)\r
+ {\r
+ SequenceI mseq[] = nvismsa[j];\r
+ AlignmentOrder order = (orders == null) ? null : orders[j];\r
+ j++;\r
+ if (mseq.length != sequences.length)\r
+ {\r
+ throw new Error(\r
+ "Mismatch between number of sequences in block " + j + " (" +\r
+ mseq.length + ") and the original view (" +\r
+ sequences.length + ")");\r
+ }\r
+ swidth = mseq[0].getLength(); // JBPNote: could ensure padded here.\r
+ for (int s = 0; s < mseq.length; s++)\r
+ {\r
+ if (alignment[s] == null)\r
+ {\r
+ alignment[s] = mseq[s];\r
+ }\r
+ else\r
+ {\r
+ alignment[s].setSequence(alignment[s].getSequenceAsString() +\r
+ mseq[s].getSequenceAsString());\r
+ if (mseq[s].getStart() <= mseq[s].getEnd())\r
+ {\r
+ alignment[s].setEnd(mseq[s].getEnd());\r
+ }\r
+ if (order != null)\r
+ {\r
+ order.updateSequence(mseq[s], alignment[s]);\r
+ }\r
+ }\r
+ }\r
+ }\r
+ else\r
+ {\r
+ // recover original alignment block or place gaps\r
+ if (true)\r
+ {\r
+ // recover input data\r
+ for (int s = 0; s < sequences.length; s++)\r
+ {\r
+ SequenceI oseq = sequences[s].getSeq(gapCharacter).\r
+ getSubSequence(start,\r
+ contigs[contig + 1]);\r
+ if (swidth < oseq.getLength())\r
+ {\r
+ swidth = oseq.getLength();\r
+ }\r
+ if (alignment[s] == null)\r
+ {\r
+ alignment[s] = oseq;\r
+ }\r
+ else\r
+ {\r
+ alignment[s].setSequence(alignment[s].getSequenceAsString() +\r
+ oseq.getSequenceAsString());\r
+ if (oseq.getEnd() >= oseq.getStart())\r
+ {\r
+ alignment[s].setEnd(oseq.getEnd());\r
+ }\r
+ }\r
+ }\r
+\r
+ }\r
+ j++;\r
+ }\r
+ nwidth += swidth;\r
+ }\r
+ // advance to begining of visible region\r
+ start = contigs[contig + 1] + contigs[contig + 2];\r
+ // add hidden segment to right of next region\r
+ for (int s = 0; s < sequences.length; s++)\r
+ {\r
+ SequenceI hseq = sequences[s].getSeq(gapCharacter).getSubSequence(\r
+ contigs[contig +\r
+ 1], start);\r
+ if (alignment[s] == null)\r
+ {\r
+ alignment[s] = hseq;\r
+ }\r
+ else\r
+ {\r
+ alignment[s].setSequence(alignment[s].getSequenceAsString() +\r
+ hseq.getSequenceAsString());\r
+ if (hseq.getEnd() >= hseq.getStart())\r
+ {\r
+ alignment[s].setEnd(hseq.getEnd());\r
+ }\r
+ }\r
+ }\r
+ // mark hidden segment as hidden in the new alignment\r
+ columnselection.hideColumns(nwidth, nwidth + contigs[contig + 2] - 1);\r
+ nwidth += contigs[contig + 2];\r
+ }\r
+ // Do final segment - if it exists\r
+ if (j < nvismsa.length)\r
+ {\r
+ int swidth = 0;\r
+ if (nvismsa[j] != null)\r
+ {\r
+ SequenceI mseq[] = nvismsa[j];\r
+ AlignmentOrder order = (orders != null) ? orders[j] : null;\r
+ swidth = mseq[0].getLength();\r
+ for (int s = 0; s < mseq.length; s++)\r
+ {\r
+ if (alignment[s] == null)\r
+ {\r
+ alignment[s] = mseq[s];\r
+ }\r
+ else\r
+ {\r
+ alignment[s].setSequence(alignment[s].getSequenceAsString() +\r
+ mseq[s].getSequenceAsString());\r
+ if (mseq[s].getEnd() >= mseq[s].getStart())\r
+ {\r
+ alignment[s].setEnd(mseq[s].getEnd());\r
+ }\r
+ if (order != null)\r
+ {\r
+ order.updateSequence(mseq[s], alignment[s]);\r
+ }\r
+ }\r
+ }\r
+ }\r
+ else\r
+ {\r
+ if (start < owidth)\r
+ {\r
+ // recover input data or place gaps\r
+ if (true)\r
+ {\r
+ // recover input data\r
+ for (int s = 0; s < sequences.length; s++)\r
+ {\r
+ SequenceI oseq = sequences[s].getSeq(gapCharacter).\r
+ getSubSequence(start,\r
+ owidth + 1);\r
+ if (swidth < oseq.getLength())\r
+ {\r
+ swidth = oseq.getLength();\r
+ }\r
+ if (alignment[s] == null)\r
+ {\r
+ alignment[s] = oseq;\r
+ }\r
+ else\r
+ {\r
+ alignment[s].setSequence(alignment[s].getSequenceAsString() +\r
+ oseq.getSequenceAsString());\r
+ if (oseq.getEnd() >= oseq.getStart())\r
+ {\r
+ alignment[s].setEnd(oseq.getEnd());\r
+ }\r
+ }\r
+ }\r
+ nwidth += swidth;\r
+ }\r
+ else\r
+ {\r
+ // place gaps.\r
+ throw new Error("Padding not yet implemented.");\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+ return new Object[]\r
+ {\r
+ alignment, columnselection};\r
+ }\r
+ else\r
+ {\r
+ if (nvismsa.length != 1)\r
+ {\r
+ throw new Error("Mismatch between visible blocks to update and number of contigs in view (contigs=0,blocks=" +\r
+ nvismsa.length);\r
+ }\r
+ if (nvismsa[0] != null)\r
+ {\r
+ return new Object[]\r
+ {\r
+ nvismsa[0], new ColumnSelection()};\r
+ }\r
+ else\r
+ {\r
+ return getAlignmentAndColumnSelection(gapCharacter);\r
+ }\r
+ }\r
+ }\r
+\r
+ /**\r
+ * returns simple array of start end positions of visible range on alignment.\r
+ * vis_start and vis_end are inclusive - use SequenceI.getSubSequence(vis_start, vis_end+1) to recover visible sequence from underlying alignment.\r
+ * @return int[] { start_i, end_i } for 1<i<n visible regions.\r
+ */\r
+ public int[] getVisibleContigs()\r
+ {\r
+ if (contigs != null && contigs.length > 0)\r
+ {\r
+ int start = 0;\r
+ int nvis = 0;\r
+ int fwidth = width;\r
+ for (int contig = 0; contig < contigs.length; contig += 3)\r
+ {\r
+ if ( (contigs[contig + 1] - start) > 0)\r
+ {\r
+ nvis++;\r
+ }\r
+ fwidth += contigs[contig + 2]; // end up with full region width (including hidden regions)\r
+ start = contigs[contig + 1] + contigs[contig + 2];\r
+ }\r
+ if (start < fwidth)\r
+ {\r
+ nvis++;\r
+ }\r
+ int viscontigs[] = new int[nvis * 2];\r
+ nvis = 0;\r
+ start = 0;\r
+ for (int contig = 0; contig < contigs.length; contig += 3)\r
+ {\r
+ if ( (contigs[contig + 1] - start) > 0)\r
+ {\r
+ viscontigs[nvis] = start;\r
+ viscontigs[nvis + 1] = contigs[contig + 1] - 1; // end is inclusive\r
+ nvis += 2;\r
+ }\r
+ start = contigs[contig + 1] + contigs[contig + 2];\r
+ }\r
+ if (start < fwidth)\r
+ {\r
+ viscontigs[nvis] = start;\r
+ viscontigs[nvis + 1] = fwidth; // end is inclusive\r
+ nvis += 2;\r
+ }\r
+ return viscontigs;\r
+ }\r
+ else\r
+ {\r
+ return new int[]\r
+ {\r
+ 0, width};\r
+ }\r
+ }\r
+\r
+ /**\r
+ *\r
+ * @return position of first visible column of AlignmentView within its parent's alignment reference frame\r
+ */\r
+ public int getAlignmentOrigin()\r
+ {\r
+ // TODO Auto-generated method stub\r
+ return firstCol;\r
+ }\r
+}\r
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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
-/**\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
- /**\r
- * Creates a new BinaryNode object.\r
- */\r
- public BinaryNode()\r
- {\r
- left = right = parent = null;\r
- bootstrap = 0;\r
- }\r
-\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
-\r
- left = right = null;\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @return DOCUMENT ME!\r
- */\r
- public Object element()\r
- {\r
- return element;\r
- }\r
-\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
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @return DOCUMENT ME!\r
- */\r
- public BinaryNode left()\r
- {\r
- return left;\r
- }\r
-\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
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @return DOCUMENT ME!\r
- */\r
- public BinaryNode right()\r
- {\r
- return right;\r
- }\r
-\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
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @return DOCUMENT ME!\r
- */\r
- public BinaryNode parent()\r
- {\r
- return parent;\r
- }\r
-\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
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @return DOCUMENT ME!\r
- */\r
- public boolean isLeaf()\r
- {\r
- return (left == null) && (right == null);\r
- }\r
-\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
- {\r
- this.setRight(rightchild);\r
- rightchild.detach();\r
- rightchild.setParent(this);\r
- }\r
- }\r
-\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
- }\r
- else\r
- {\r
- if (this.parent.right == this)\r
- {\r
- this.parent.right = null;\r
- }\r
- }\r
- }\r
-\r
- this.parent = null;\r
-\r
- return this;\r
- }\r
-\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
- {\r
- c = c.parent();\r
- }\r
- while ( (c != null) && (c.left() != null) && !c.left().isLeaf());\r
-\r
- return c;\r
- }\r
-\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
- {\r
- c = c.parent();\r
- }\r
- while ( (c != null) && (c.right() != null) && !c.right().isLeaf());\r
-\r
- return c;\r
- }\r
-\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
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @return DOCUMENT ME!\r
- */\r
- public String getName()\r
- {\r
- return this.name;\r
- }\r
-\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
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @return DOCUMENT ME!\r
- */\r
- public int getBootstrap()\r
- {\r
- return bootstrap;\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.datamodel;
+
+/**
+ * DOCUMENT ME!
+ *
+ * @author $author$
+ * @version $Revision$
+ */
+public class BinaryNode
+{
+ Object element;
+ String name;
+ BinaryNode left;
+ BinaryNode right;
+ BinaryNode parent;
+
+ /** DOCUMENT ME!! */
+ public int bootstrap;
+
+ /**
+ * Creates a new BinaryNode object.
+ */
+ public BinaryNode()
+ {
+ left = right = parent = null;
+ bootstrap = 0;
+ }
+
+ /**
+ * Creates a new BinaryNode object.
+ *
+ * @param element DOCUMENT ME!
+ * @param parent DOCUMENT ME!
+ * @param name DOCUMENT ME!
+ */
+ public BinaryNode(Object element, BinaryNode parent, String name)
+ {
+ this.element = element;
+ this.parent = parent;
+ this.name = name;
+
+ left = right = null;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public Object element()
+ {
+ return element;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param v DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public Object setElement(Object v)
+ {
+ return element = v;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public BinaryNode left()
+ {
+ return left;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param n DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public BinaryNode setLeft(BinaryNode n)
+ {
+ return left = n;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public BinaryNode right()
+ {
+ return right;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param n DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public BinaryNode setRight(BinaryNode n)
+ {
+ return right = n;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public BinaryNode parent()
+ {
+ return parent;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param n DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public BinaryNode setParent(BinaryNode n)
+ {
+ return parent = n;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public boolean isLeaf()
+ {
+ return (left == null) && (right == null);
+ }
+
+ /**
+ * 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.
+ *
+ */
+ public void SetChildren(BinaryNode leftchild, BinaryNode rightchild)
+ {
+ if (leftchild != null)
+ {
+ this.setLeft(leftchild);
+ leftchild.detach();
+ leftchild.setParent(this);
+ }
+
+ if (rightchild != null)
+ {
+ this.setRight(rightchild);
+ rightchild.detach();
+ rightchild.setParent(this);
+ }
+ }
+
+ /**
+ * Detaches the node from the binary tree, along with all its child nodes.
+ * @return BinaryNode The detached node.
+ */
+ public BinaryNode detach()
+ {
+ if (this.parent != null)
+ {
+ if (this.parent.left == this)
+ {
+ this.parent.left = null;
+ }
+ else
+ {
+ if (this.parent.right == this)
+ {
+ this.parent.right = null;
+ }
+ }
+ }
+
+ this.parent = null;
+
+ return this;
+ }
+
+ /**
+ * Traverses up through the tree until a node with a free leftchild is discovered.
+ * @return BinaryNode
+ */
+ public BinaryNode ascendLeft()
+ {
+ BinaryNode c = this;
+
+ do
+ {
+ c = c.parent();
+ }
+ while ( (c != null) && (c.left() != null) && !c.left().isLeaf());
+
+ return c;
+ }
+
+ /**
+ * 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
+ */
+ public BinaryNode ascendRight()
+ {
+ BinaryNode c = this;
+
+ do
+ {
+ c = c.parent();
+ }
+ while ( (c != null) && (c.right() != null) && !c.right().isLeaf());
+
+ return c;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param name DOCUMENT ME!
+ */
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public String getName()
+ {
+ return this.name;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param boot DOCUMENT ME!
+ */
+ public void setBootstrap(int boot)
+ {
+ this.bootstrap = boot;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public int getBootstrap()
+ {
+ return bootstrap;
+ }
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
- *\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
+ * \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
+ * \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) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
- *\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
+ * \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
+ * \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
-/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 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.datamodel;
-
-public class CigarCigar
- extends CigarSimple
-{
- SeqCigar refCigar;
- /**
- * Apply CIGAR operations to the result of another cigar
- * @param cigar Cigar
- */
- CigarCigar(SeqCigar cigar)
- {
- super();
- refCigar = cigar;
- }
-
- /**
- *
- * @return String formed by applying CIGAR operations to the reference object
- * @param GapChar char
- * @todo Implement this jalview.datamodel.Cigar method
- */
- public String getSequenceString(char GapChar)
- {
- if (length == 0)
- {
- return "";
- }
- String refString = refCigar.getSequenceString(GapChar);
- if (refString != null)
- {
- return (length == 0) ? "" :
- (String) getSequenceAndDeletions(refString, GapChar)[0];
- }
- else
- {
- return null;
- }
- }
-
-}
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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 CigarCigar\r
+ extends CigarSimple\r
+{\r
+ SeqCigar refCigar;\r
+ /**\r
+ * Apply CIGAR operations to the result of another cigar\r
+ * @param cigar Cigar\r
+ */\r
+ CigarCigar(SeqCigar cigar)\r
+ {\r
+ super();\r
+ refCigar = cigar;\r
+ }\r
+\r
+ /**\r
+ *\r
+ * @return String formed by applying CIGAR operations to the reference object\r
+ * @param GapChar char\r
+ * @todo Implement this jalview.datamodel.Cigar method\r
+ */\r
+ public String getSequenceString(char GapChar)\r
+ {\r
+ if (length == 0)\r
+ {\r
+ return "";\r
+ }\r
+ String refString = refCigar.getSequenceString(GapChar);\r
+ if (refString != null)\r
+ {\r
+ return (length == 0) ? "" :\r
+ (String) getSequenceAndDeletions(refString, GapChar)[0];\r
+ }\r
+ else\r
+ {\r
+ return null;\r
+ }\r
+ }\r
+\r
+}\r
-/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 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.datamodel;
-
-/**
- * <p>Title: </p>
- *
- * <p>Description: </p>
- *
- * <p>Copyright: Copyright (c) 2004</p>
- *
- * <p>Company: Dundee University</p>
- *
- * @author not attributable
- * @version 1.0
- */
-public abstract class CigarSimple
- extends CigarBase
-{
- /**
- * Return a symbol sequence with edits (gaps, insertions and deletions) applied
- * @param GapChar char
- * @return String
- */
- public abstract String getSequenceString(char GapChar);
-
-}
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
+/**\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 abstract class CigarSimple\r
+ extends CigarBase\r
+{\r
+ /**\r
+ * Return a symbol sequence with edits (gaps, insertions and deletions) applied\r
+ * @param GapChar char\r
+ * @return String\r
+ */\r
+ public abstract String getSequenceString(char GapChar);\r
+\r
+}\r
/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
- *\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
+ * \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
+ * \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
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
-/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 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.datamodel;
-/**
- * Defines internal constants for unambiguous annotation
- * of DbRefEntry source strings and describing the data
- * retrieved from external database sources (see jalview.ws.DbSourcProxy)
- * @author JimP
- *
- */
-public class DBRefSource
-{
- /**
- * UNIPROT Accession Number
- */
- public static String UNIPROT = "UNIPROT";
- /**
- * UNIPROT Entry Name
- */
- public static String UP_NAME = "UNIPROT_NAME";
- /**
- * Uniprot Knowledgebase/TrEMBL
- * as served from EMBL protein products.
- */
- public static final String UNIPROTKB = "UniProtKB/TrEMBL";
- /**
- * PDB Entry Code
- */
- public static String PDB = "PDB";
- /**
- * EMBL ID
- */
- public static String EMBL = "EMBL";
- /**
- * EMBLCDS ID
- */
- public static String EMBLCDS = "EMBLCDS";
- /**
- * PFAM ID
- */
- public static String PFAM = "PFAM";
- /**
- * GeneDB ID
- */
- public static final String GENEDB = "GeneDB";
-
- /**
- * List of databases whose sequences might have coding regions annotated
- */
- public static final String[] DNACODINGDBS = { EMBL, EMBLCDS, GENEDB};
- public static final String[] CODINGDBS = { EMBLCDS, GENEDB};
- public static final String[] PROTEINDBS = { UNIPROT, PDB, UNIPROTKB};
- public static final String[] PROTEINSEQ = { UNIPROT, UNIPROTKB};
- public static final String[] PROTEINSTR = { PDB };
- public static final String[] DOMAINDBS = { PFAM };
- /**
- * set of unique DBRefSource property constants.
- * These could be used to reconstruct the above groupings
- */
- public static final Object SEQDB = "SQ";
- /**
- * database of nucleic acid sequences
- */
- public static final Object DNASEQDB = "NASQ";
- /**
- * database of amino acid sequences
- */
- public static final Object PROTSEQDB = "PROTSQ";
- /**
- * database of cDNA sequences
- */
- public static final Object CODINGSEQDB = "CODING";
- /**
- * database of na sequences with exon annotation
- */
- public static final Object DNACODINGSEQDB = "XONCODING";
- /**
- * DB returns several sequences associated with a protein domain
- */
- public static final Object DOMAINDB = "DOMAIN";
- /**
- * DB query can take multiple accession codes concatenated
- * by a separator. Value of property indicates maximum number of accession codes to send at a time.
- */
- public static final Object MULTIACC = "MULTIACC";
-}
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
+ * Defines internal constants for unambiguous annotation\r
+ * of DbRefEntry source strings and describing the data\r
+ * retrieved from external database sources (see jalview.ws.DbSourcProxy)\r
+ * @author JimP\r
+ *\r
+ */\r
+public class DBRefSource\r
+{\r
+ /**\r
+ * UNIPROT Accession Number\r
+ */\r
+ public static String UNIPROT = "UNIPROT";\r
+ /**\r
+ * UNIPROT Entry Name\r
+ */\r
+ public static String UP_NAME = "UNIPROT_NAME";\r
+ /**\r
+ * Uniprot Knowledgebase/TrEMBL\r
+ * as served from EMBL protein products.\r
+ */\r
+ public static final String UNIPROTKB = "UniProtKB/TrEMBL";\r
+ /**\r
+ * PDB Entry Code\r
+ */\r
+ public static String PDB = "PDB";\r
+ /**\r
+ * EMBL ID\r
+ */\r
+ public static String EMBL = "EMBL";\r
+ /**\r
+ * EMBLCDS ID\r
+ */\r
+ public static String EMBLCDS = "EMBLCDS";\r
+ /**\r
+ * PFAM ID\r
+ */\r
+ public static String PFAM = "PFAM";\r
+ /**\r
+ * GeneDB ID\r
+ */\r
+ public static final String GENEDB = "GeneDB";\r
+\r
+ /**\r
+ * List of databases whose sequences might have coding regions annotated\r
+ */\r
+ public static final String[] DNACODINGDBS = { EMBL, EMBLCDS, GENEDB};\r
+ public static final String[] CODINGDBS = { EMBLCDS, GENEDB};\r
+ public static final String[] PROTEINDBS = { UNIPROT, PDB, UNIPROTKB};\r
+ public static final String[] PROTEINSEQ = { UNIPROT, UNIPROTKB};\r
+ public static final String[] PROTEINSTR = { PDB };\r
+ public static final String[] DOMAINDBS = { PFAM };\r
+ /**\r
+ * set of unique DBRefSource property constants.\r
+ * These could be used to reconstruct the above groupings\r
+ */\r
+ public static final Object SEQDB = "SQ";\r
+ /**\r
+ * database of nucleic acid sequences\r
+ */\r
+ public static final Object DNASEQDB = "NASQ";\r
+ /**\r
+ * database of amino acid sequences\r
+ */\r
+ public static final Object PROTSEQDB = "PROTSQ";\r
+ /**\r
+ * database of cDNA sequences\r
+ */\r
+ public static final Object CODINGSEQDB = "CODING";\r
+ /**\r
+ * database of na sequences with exon annotation\r
+ */\r
+ public static final Object DNACODINGSEQDB = "XONCODING";\r
+ /**\r
+ * DB returns several sequences associated with a protein domain\r
+ */\r
+ public static final Object DOMAINDB = "DOMAIN";\r
+ /**\r
+ * DB query can take multiple accession codes concatenated\r
+ * by a separator. Value of property indicates maximum number of accession codes to send at a time.\r
+ */\r
+ public static final Object MULTIACC = "MULTIACC";\r
+}\r
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
/**\r
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.datamodel;
import java.util.*;
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.datamodel;
import java.util.Vector;
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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
-public class Provenance\r
-{\r
- Vector entries = new Vector();\r
- public Provenance()\r
- {\r
-\r
- }\r
-\r
- public ProvenanceEntry[] getEntries()\r
- {\r
- ProvenanceEntry[] ret = new ProvenanceEntry[entries.size()];\r
- for (int i = 0; i < entries.size(); i++)\r
- {\r
- ret[i] = (ProvenanceEntry) entries.elementAt(i);\r
- }\r
- return ret;\r
- }\r
-\r
- public void addEntry(String user, String action, java.util.Date date,\r
- String id)\r
- {\r
- entries.addElement(new ProvenanceEntry(user, action, date, id));\r
- }\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.datamodel;
+
+import java.util.*;
+
+public class Provenance
+{
+ Vector entries = new Vector();
+ public Provenance()
+ {
+
+ }
+
+ public ProvenanceEntry[] getEntries()
+ {
+ ProvenanceEntry[] ret = new ProvenanceEntry[entries.size()];
+ for (int i = 0; i < entries.size(); i++)
+ {
+ ret[i] = (ProvenanceEntry) entries.elementAt(i);
+ }
+ return ret;
+ }
+
+ public void addEntry(String user, String action, java.util.Date date,
+ String id)
+ {
+ entries.addElement(new ProvenanceEntry(user, action, date, id));
+ }
+
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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 ProvenanceEntry\r
-{\r
- String user, action, id;\r
- java.util.Date date;\r
- public ProvenanceEntry(String u, String a, java.util.Date d, String i)\r
- {\r
- user = u;\r
- action = a;\r
- date = d;\r
- id = i;\r
- }\r
-\r
- public String getUser()\r
- {\r
- return user;\r
- }\r
-\r
- public String getAction()\r
- {\r
- return action;\r
- }\r
-\r
- public java.util.Date getDate()\r
- {\r
- return date;\r
- }\r
-\r
- public String getID()\r
- {\r
- return id;\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.datamodel;
+
+public class ProvenanceEntry
+{
+ String user, action, id;
+ java.util.Date date;
+ public ProvenanceEntry(String u, String a, java.util.Date d, String i)
+ {
+ user = u;
+ action = a;
+ date = d;
+ id = i;
+ }
+
+ public String getUser()
+ {
+ return user;
+ }
+
+ public String getAction()
+ {
+ return action;
+ }
+
+ public java.util.Date getDate()
+ {
+ return date;
+ }
+
+ public String getID()
+ {
+ return id;
+ }
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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
-public class UniprotEntry\r
-{\r
-\r
- UniprotSequence sequence;\r
- Vector name;\r
- Vector accession;\r
- Vector feature;\r
- Vector dbrefs;\r
- UniprotProteinName protName;\r
-\r
- public void setAccession(Vector items)\r
- {\r
- accession = items;\r
- }\r
-\r
- public void setFeature(Vector items)\r
- {\r
- feature = items;\r
- }\r
-\r
- public Vector getFeature()\r
- {\r
- return feature;\r
- }\r
-\r
- public Vector getAccession()\r
- {\r
- return accession;\r
- }\r
-\r
- public void setProtein(UniprotProteinName names)\r
- {\r
- protName = names;\r
- }\r
-\r
- public UniprotProteinName getProtein()\r
- {\r
- return protName;\r
- }\r
-\r
- public void setName(Vector na)\r
- {\r
- name = na;\r
- }\r
-\r
- public Vector getName()\r
- {\r
- return name;\r
- }\r
-\r
- public UniprotSequence getUniprotSequence()\r
- {\r
- return sequence;\r
- }\r
-\r
- public void setUniprotSequence(UniprotSequence seq)\r
- {\r
- sequence = seq;\r
- }\r
-\r
- public Vector getDbReference()\r
- {\r
- return dbrefs;\r
- }\r
-\r
- public void setDbReference(Vector dbref)\r
- {\r
- this.dbrefs = dbref;\r
- }\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.datamodel;
+
+import java.util.*;
+
+public class UniprotEntry
+{
+
+ UniprotSequence sequence;
+ Vector name;
+ Vector accession;
+ Vector feature;
+ Vector dbrefs;
+ UniprotProteinName protName;
+
+ public void setAccession(Vector items)
+ {
+ accession = items;
+ }
+
+ public void setFeature(Vector items)
+ {
+ feature = items;
+ }
+
+ public Vector getFeature()
+ {
+ return feature;
+ }
+
+ public Vector getAccession()
+ {
+ return accession;
+ }
+
+ public void setProtein(UniprotProteinName names)
+ {
+ protName = names;
+ }
+
+ public UniprotProteinName getProtein()
+ {
+ return protName;
+ }
+
+ public void setName(Vector na)
+ {
+ name = na;
+ }
+
+ public Vector getName()
+ {
+ return name;
+ }
+
+ public UniprotSequence getUniprotSequence()
+ {
+ return sequence;
+ }
+
+ public void setUniprotSequence(UniprotSequence seq)
+ {
+ sequence = seq;
+ }
+
+ public Vector getDbReference()
+ {
+ return dbrefs;
+ }
+
+ public void setDbReference(Vector dbref)
+ {
+ this.dbrefs = dbref;
+ }
+
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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
-public class UniprotFile\r
-{\r
- Vector _items;\r
-\r
- public void setUniprotEntries(Vector items)\r
- {\r
- _items = items;\r
- }\r
-\r
- public Vector getUniprotEntries()\r
- {\r
- return _items;\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.datamodel;
+
+import java.util.*;
+
+public class UniprotFile
+{
+ Vector _items;
+
+ public void setUniprotEntries(Vector items)
+ {
+ _items = items;
+ }
+
+ public Vector getUniprotEntries()
+ {
+ return _items;
+ }
+}
/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
- *\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
+ * \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
+ * \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) 2007 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 UniprotSequence\r
-{\r
- /**\r
- * internal content storage\r
- */\r
- private java.lang.String _content = "";\r
-\r
- public void setContent(String seq)\r
- {\r
- StringBuffer sb = new StringBuffer();\r
- for (int i = 0; i < seq.length(); i++)\r
- {\r
- if (seq.charAt(i) != ' ')\r
- {\r
- sb.append(seq.charAt(i));\r
- }\r
- }\r
- _content = sb.toString();\r
- }\r
-\r
- public String getContent()\r
- {\r
- return _content;\r
- }\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.datamodel;
+
+public class UniprotSequence
+{
+ /**
+ * internal content storage
+ */
+ private java.lang.String _content = "";
+
+ public void setContent(String seq)
+ {
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < seq.length(); i++)
+ {
+ if (seq.charAt(i) != ' ')
+ {
+ sb.append(seq.charAt(i));
+ }
+ }
+ _content = sb.toString();
+ }
+
+ public String getContent()
+ {
+ return _content;
+ }
+
+}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.datamodel.xdb.embl;
public class BasePosition {
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.datamodel.xdb.embl;
import jalview.datamodel.DBRefEntry;
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.datamodel.xdb.embl;
public class EmblError {
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.datamodel.xdb.embl;
import java.util.Hashtable;
import java.util.Vector;
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.datamodel.xdb.embl;
public class EmblFeatureLocElement {
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.datamodel.xdb.embl;
import java.util.Enumeration;
}
return se;
}
-}
\ No newline at end of file
+}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.datamodel.xdb.embl;
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.datamodel.xdb.embl;
public class EmblSequence {
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.datamodel.xdb.embl;
public class Qualifier {
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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 Softwarechang
+ * 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.gui;
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
+ */
/*
* Jalview - A Sequence Alignment Editor and Viewer
* Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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.gui;\r
-\r
-import java.util.*;\r
-\r
-import java.awt.*;\r
-import java.awt.event.*;\r
-import javax.swing.*;\r
-import javax.swing.event.*;\r
-\r
-import jalview.datamodel.*;\r
-import jalview.schemes.*;\r
-import java.awt.Dimension;\r
-\r
-public class AnnotationColourChooser\r
- extends JPanel\r
-{\r
- JInternalFrame frame;\r
- AlignViewport av;\r
- AlignmentPanel ap;\r
- ColourSchemeI oldcs;\r
- Hashtable oldgroupColours;\r
- jalview.datamodel.AlignmentAnnotation currentAnnotation;\r
- boolean adjusting = false;\r
-\r
- public AnnotationColourChooser(AlignViewport av, final AlignmentPanel ap)\r
- {\r
- oldcs = av.getGlobalColourScheme();\r
- if (av.alignment.getGroups() != null)\r
- {\r
- oldgroupColours = new Hashtable();\r
- Vector allGroups = ap.av.alignment.getGroups();\r
- SequenceGroup sg;\r
- for (int g = 0; g < allGroups.size(); g++)\r
- {\r
- sg = (SequenceGroup) allGroups.get(g);\r
- if (sg.cs != null)\r
- {\r
- oldgroupColours.put(sg, sg.cs);\r
- }\r
- }\r
- }\r
- this.av = av;\r
- this.ap = ap;\r
- frame = new JInternalFrame();\r
- frame.setContentPane(this);\r
- frame.setLayer(JLayeredPane.PALETTE_LAYER);\r
- Desktop.addInternalFrame(frame, "Colour by Annotation", 480, 145);\r
-\r
-\r
- slider.addChangeListener(new ChangeListener()\r
- {\r
- public void stateChanged(ChangeEvent evt)\r
- {\r
- if (!adjusting)\r
- {\r
- thresholdValue.setText( ( (float) slider.getValue() / 1000f) + "");\r
- valueChanged();\r
- }\r
- }\r
- });\r
- slider.addMouseListener(new MouseAdapter()\r
- {\r
- public void mouseReleased(MouseEvent evt)\r
- {\r
- ap.paintAlignment(true);\r
- }\r
- });\r
-\r
- if (av.alignment.getAlignmentAnnotation() == null)\r
- {\r
- return;\r
- }\r
-\r
- if (oldcs instanceof AnnotationColourGradient)\r
- {\r
- AnnotationColourGradient acg = (AnnotationColourGradient) oldcs;\r
- minColour.setBackground(acg.getMinColour());\r
- maxColour.setBackground(acg.getMaxColour());\r
- }\r
- else\r
- {\r
- minColour.setBackground(Color.orange);\r
- maxColour.setBackground(Color.red);\r
- }\r
-\r
- adjusting = true;\r
- Vector list = new Vector();\r
- int index = 1;\r
- for (int i = 0; i < av.alignment.getAlignmentAnnotation().length; i++)\r
- {\r
- String label = av.alignment.getAlignmentAnnotation()[i].label;\r
- if (!list.contains(label))\r
- list.addElement(label);\r
- else\r
- list.addElement(label+"_"+(index++));\r
- }\r
-\r
- annotations = new JComboBox(list);\r
-\r
- threshold.addItem("No Threshold");\r
- threshold.addItem("Above Threshold");\r
- threshold.addItem("Below Threshold");\r
-\r
- try\r
- {\r
- jbInit();\r
- }\r
- catch (Exception ex)\r
- {}\r
-\r
- adjusting = false;\r
-\r
- changeColour();\r
-\r
- }\r
-\r
- public AnnotationColourChooser()\r
- {\r
- try\r
- {\r
- jbInit();\r
- }\r
- catch (Exception ex)\r
- {\r
- ex.printStackTrace();\r
- }\r
- }\r
-\r
- private void jbInit()\r
- throws Exception\r
- {\r
- minColour.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
- minColour.setBorder(BorderFactory.createEtchedBorder());\r
- minColour.setPreferredSize(new Dimension(40, 20));\r
- minColour.setToolTipText("Minimum Colour");\r
- minColour.addMouseListener(new MouseAdapter()\r
- {\r
- public void mousePressed(MouseEvent e)\r
- {\r
- if (minColour.isEnabled())\r
- {\r
- minColour_actionPerformed();\r
- }\r
- }\r
- });\r
- maxColour.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
- maxColour.setBorder(BorderFactory.createEtchedBorder());\r
- maxColour.setPreferredSize(new Dimension(40, 20));\r
- maxColour.setToolTipText("Maximum Colour");\r
- maxColour.addMouseListener(new MouseAdapter()\r
- {\r
- public void mousePressed(MouseEvent e)\r
- {\r
- if (maxColour.isEnabled())\r
- {\r
- maxColour_actionPerformed();\r
- }\r
- }\r
- });\r
- ok.setOpaque(false);\r
- ok.setText("OK");\r
- ok.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- ok_actionPerformed(e);\r
- }\r
- });\r
- cancel.setOpaque(false);\r
- cancel.setText("Cancel");\r
- cancel.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- cancel_actionPerformed(e);\r
- }\r
- });\r
- this.setLayout(borderLayout1);\r
- jPanel2.setLayout(flowLayout1);\r
- annotations.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- annotations_actionPerformed(e);\r
- }\r
- });\r
- jPanel1.setBackground(Color.white);\r
- jPanel2.setBackground(Color.white);\r
- threshold.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- threshold_actionPerformed(e);\r
- }\r
- });\r
- jPanel3.setLayout(flowLayout2);\r
- thresholdValue.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- thresholdValue_actionPerformed(e);\r
- }\r
- });\r
- slider.setPaintLabels(false);\r
- slider.setPaintTicks(true);\r
- slider.setBackground(Color.white);\r
- slider.setEnabled(false);\r
- slider.setOpaque(false);\r
- slider.setPreferredSize(new Dimension(100, 32));\r
- thresholdValue.setEnabled(false);\r
- thresholdValue.setColumns(7);\r
- jPanel3.setBackground(Color.white);\r
- currentColours.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
- currentColours.setOpaque(false);\r
- currentColours.setText("Use Original Colours");\r
- currentColours.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- currentColours_actionPerformed(e);\r
- }\r
- });\r
- thresholdIsMin.setBackground(Color.white);\r
- thresholdIsMin.setText("Threshold is Min/Max");\r
- thresholdIsMin.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent actionEvent)\r
- {\r
- thresholdIsMin_actionPerformed(actionEvent);\r
- }\r
- });\r
- jPanel1.add(ok);\r
- jPanel1.add(cancel);\r
- jPanel2.add(annotations);\r
- jPanel2.add(currentColours);\r
- jPanel2.add(minColour);\r
- jPanel2.add(maxColour);\r
- this.add(jPanel3, java.awt.BorderLayout.CENTER);\r
- jPanel3.add(threshold);\r
- jPanel3.add(slider);\r
- jPanel3.add(thresholdValue);\r
- jPanel3.add(thresholdIsMin);\r
- this.add(jPanel1, java.awt.BorderLayout.SOUTH);\r
- this.add(jPanel2, java.awt.BorderLayout.NORTH);\r
- }\r
-\r
- JComboBox annotations;\r
- JPanel minColour = new JPanel();\r
- JPanel maxColour = new JPanel();\r
- JButton ok = new JButton();\r
- JButton cancel = new JButton();\r
- JPanel jPanel1 = new JPanel();\r
- JPanel jPanel2 = new JPanel();\r
- BorderLayout borderLayout1 = new BorderLayout();\r
- JComboBox threshold = new JComboBox();\r
- FlowLayout flowLayout1 = new FlowLayout();\r
- JPanel jPanel3 = new JPanel();\r
- FlowLayout flowLayout2 = new FlowLayout();\r
- JSlider slider = new JSlider();\r
- JTextField thresholdValue = new JTextField(20);\r
- JCheckBox currentColours = new JCheckBox();\r
- JCheckBox thresholdIsMin = new JCheckBox();\r
-\r
- public void minColour_actionPerformed()\r
- {\r
- Color col = JColorChooser.showDialog(this,\r
- "Select Colour for Minimum Value",\r
- minColour.getBackground());\r
- if (col != null)\r
- {\r
- minColour.setBackground(col);\r
- }\r
- minColour.repaint();\r
- changeColour();\r
- }\r
-\r
- public void maxColour_actionPerformed()\r
- {\r
- Color col = JColorChooser.showDialog(this,\r
- "Select Colour for Maximum Value",\r
- maxColour.getBackground());\r
- if (col != null)\r
- {\r
- maxColour.setBackground(col);\r
- }\r
- maxColour.repaint();\r
- changeColour();\r
- }\r
-\r
- void changeColour()\r
- {\r
- // Check if combobox is still adjusting\r
- if (adjusting)\r
- {\r
- return;\r
- }\r
-\r
-\r
- currentAnnotation = av.alignment.getAlignmentAnnotation()[annotations.getSelectedIndex()];\r
-\r
- int aboveThreshold = -1;\r
- if (threshold.getSelectedItem().equals("Above Threshold"))\r
- {\r
- aboveThreshold = AnnotationColourGradient.ABOVE_THRESHOLD;\r
- }\r
- else if (threshold.getSelectedItem().equals("Below Threshold"))\r
- {\r
- aboveThreshold = AnnotationColourGradient.BELOW_THRESHOLD;\r
- }\r
-\r
- slider.setEnabled(true);\r
- thresholdValue.setEnabled(true);\r
-\r
- if (aboveThreshold == AnnotationColourGradient.NO_THRESHOLD)\r
- {\r
- slider.setEnabled(false);\r
- thresholdValue.setEnabled(false);\r
- thresholdValue.setText("");\r
- }\r
- else if (aboveThreshold != AnnotationColourGradient.NO_THRESHOLD &&\r
- currentAnnotation.threshold == null)\r
- {\r
- currentAnnotation.setThreshold(new jalview.datamodel.GraphLine\r
- ( (currentAnnotation.graphMax -\r
- currentAnnotation.graphMin) / 2f,\r
- "Threshold",\r
- Color.black));\r
- }\r
-\r
- if (aboveThreshold != AnnotationColourGradient.NO_THRESHOLD)\r
- {\r
- adjusting = true;\r
- float range = currentAnnotation.graphMax * 1000 -\r
- currentAnnotation.graphMin * 1000;\r
-\r
- slider.setMinimum( (int) (currentAnnotation.graphMin * 1000));\r
- slider.setMaximum( (int) (currentAnnotation.graphMax * 1000));\r
- slider.setValue( (int) (currentAnnotation.threshold.value * 1000));\r
- thresholdValue.setText(currentAnnotation.threshold.value + "");\r
- slider.setMajorTickSpacing( (int) (range / 10f));\r
- slider.setEnabled(true);\r
- thresholdValue.setEnabled(true);\r
- adjusting = false;\r
- }\r
-\r
- AnnotationColourGradient acg = null;\r
- if (currentColours.isSelected())\r
- {\r
- acg = new AnnotationColourGradient(\r
- currentAnnotation,\r
- av.getGlobalColourScheme(), aboveThreshold);\r
- }\r
- else\r
- {\r
- acg =\r
- new AnnotationColourGradient(\r
- currentAnnotation,\r
- minColour.getBackground(),\r
- maxColour.getBackground(),\r
- aboveThreshold);\r
- }\r
-\r
- if(currentAnnotation.graphMin==0f&& currentAnnotation.graphMax==0f)\r
- {\r
- acg.predefinedColours = true;\r
- }\r
-\r
- acg.thresholdIsMinMax = thresholdIsMin.isSelected();\r
-\r
- av.setGlobalColourScheme(acg);\r
-\r
- if (av.alignment.getGroups() != null)\r
- {\r
- Vector allGroups = ap.av.alignment.getGroups();\r
- SequenceGroup sg;\r
- for (int g = 0; g < allGroups.size(); g++)\r
- {\r
- sg = (SequenceGroup) allGroups.get(g);\r
-\r
- if (sg.cs == null)\r
- {\r
- continue;\r
- }\r
-\r
- if (currentColours.isSelected())\r
- {\r
- sg.cs = new AnnotationColourGradient(\r
- currentAnnotation,\r
- sg.cs, aboveThreshold);\r
- }\r
- else\r
- {\r
- sg.cs = new AnnotationColourGradient(\r
- currentAnnotation,\r
- minColour.getBackground(),\r
- maxColour.getBackground(),\r
- aboveThreshold);\r
- }\r
-\r
- }\r
- }\r
-\r
- ap.paintAlignment(false);\r
- }\r
-\r
- public void ok_actionPerformed(ActionEvent e)\r
- {\r
- changeColour();\r
- try\r
- {\r
- frame.setClosed(true);\r
- }\r
- catch (Exception ex)\r
- {}\r
- }\r
-\r
- public void cancel_actionPerformed(ActionEvent e)\r
- {\r
- reset();\r
- try\r
- {\r
- frame.setClosed(true);\r
- }\r
- catch (Exception ex)\r
- {}\r
- }\r
-\r
- void reset()\r
- {\r
- av.setGlobalColourScheme(oldcs);\r
- if (av.alignment.getGroups() != null)\r
- {\r
- Vector allGroups = ap.av.alignment.getGroups();\r
- SequenceGroup sg;\r
- for (int g = 0; g < allGroups.size(); g++)\r
- {\r
- sg = (SequenceGroup) allGroups.get(g);\r
- sg.cs = (ColourSchemeI) oldgroupColours.get(sg);\r
- }\r
- }\r
- }\r
-\r
- public void thresholdCheck_actionPerformed(ActionEvent e)\r
- {\r
- changeColour();\r
- }\r
-\r
- public void annotations_actionPerformed(ActionEvent e)\r
- {\r
- changeColour();\r
- }\r
-\r
- public void threshold_actionPerformed(ActionEvent e)\r
- {\r
- changeColour();\r
- }\r
-\r
- public void thresholdValue_actionPerformed(ActionEvent e)\r
- {\r
- try\r
- {\r
- float f = Float.parseFloat(thresholdValue.getText());\r
- slider.setValue( (int) (f * 1000));\r
- }\r
- catch (NumberFormatException ex)\r
- {}\r
- }\r
-\r
- public void valueChanged()\r
- {\r
- if (currentColours.isSelected()\r
- && ! (av.getGlobalColourScheme() instanceof AnnotationColourGradient))\r
- {\r
- changeColour();\r
- }\r
-\r
- currentAnnotation.threshold.value = (float) slider.getValue() / 1000f;\r
- ap.paintAlignment(false);\r
- }\r
-\r
- public void currentColours_actionPerformed(ActionEvent e)\r
- {\r
- if (currentColours.isSelected())\r
- {\r
- reset();\r
- }\r
-\r
- maxColour.setEnabled(!currentColours.isSelected());\r
- minColour.setEnabled(!currentColours.isSelected());\r
-\r
- changeColour();\r
- }\r
-\r
- public void thresholdIsMin_actionPerformed(ActionEvent actionEvent)\r
- {\r
- changeColour();\r
- }\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.gui;
+
+import java.util.*;
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.event.*;
+
+import jalview.datamodel.*;
+import jalview.schemes.*;
+import java.awt.Dimension;
+
+public class AnnotationColourChooser
+ extends JPanel
+{
+ JInternalFrame frame;
+ AlignViewport av;
+ AlignmentPanel ap;
+ ColourSchemeI oldcs;
+ Hashtable oldgroupColours;
+ jalview.datamodel.AlignmentAnnotation currentAnnotation;
+ boolean adjusting = false;
+
+ public AnnotationColourChooser(AlignViewport av, final AlignmentPanel ap)
+ {
+ oldcs = av.getGlobalColourScheme();
+ if (av.alignment.getGroups() != null)
+ {
+ oldgroupColours = new Hashtable();
+ Vector allGroups = ap.av.alignment.getGroups();
+ SequenceGroup sg;
+ for (int g = 0; g < allGroups.size(); g++)
+ {
+ sg = (SequenceGroup) allGroups.get(g);
+ if (sg.cs != null)
+ {
+ oldgroupColours.put(sg, sg.cs);
+ }
+ }
+ }
+ this.av = av;
+ this.ap = ap;
+ frame = new JInternalFrame();
+ frame.setContentPane(this);
+ frame.setLayer(JLayeredPane.PALETTE_LAYER);
+ Desktop.addInternalFrame(frame, "Colour by Annotation", 480, 145);
+
+
+ slider.addChangeListener(new ChangeListener()
+ {
+ public void stateChanged(ChangeEvent evt)
+ {
+ if (!adjusting)
+ {
+ thresholdValue.setText( ( (float) slider.getValue() / 1000f) + "");
+ valueChanged();
+ }
+ }
+ });
+ slider.addMouseListener(new MouseAdapter()
+ {
+ public void mouseReleased(MouseEvent evt)
+ {
+ ap.paintAlignment(true);
+ }
+ });
+
+ if (av.alignment.getAlignmentAnnotation() == null)
+ {
+ return;
+ }
+
+ if (oldcs instanceof AnnotationColourGradient)
+ {
+ AnnotationColourGradient acg = (AnnotationColourGradient) oldcs;
+ minColour.setBackground(acg.getMinColour());
+ maxColour.setBackground(acg.getMaxColour());
+ }
+ else
+ {
+ minColour.setBackground(Color.orange);
+ maxColour.setBackground(Color.red);
+ }
+
+ adjusting = true;
+ Vector list = new Vector();
+ int index = 1;
+ for (int i = 0; i < av.alignment.getAlignmentAnnotation().length; i++)
+ {
+ String label = av.alignment.getAlignmentAnnotation()[i].label;
+ if (!list.contains(label))
+ list.addElement(label);
+ else
+ list.addElement(label+"_"+(index++));
+ }
+
+ annotations = new JComboBox(list);
+
+ threshold.addItem("No Threshold");
+ threshold.addItem("Above Threshold");
+ threshold.addItem("Below Threshold");
+
+ try
+ {
+ jbInit();
+ }
+ catch (Exception ex)
+ {}
+
+ adjusting = false;
+
+ changeColour();
+
+ }
+
+ public AnnotationColourChooser()
+ {
+ try
+ {
+ jbInit();
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ private void jbInit()
+ throws Exception
+ {
+ minColour.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
+ minColour.setBorder(BorderFactory.createEtchedBorder());
+ minColour.setPreferredSize(new Dimension(40, 20));
+ minColour.setToolTipText("Minimum Colour");
+ minColour.addMouseListener(new MouseAdapter()
+ {
+ public void mousePressed(MouseEvent e)
+ {
+ if (minColour.isEnabled())
+ {
+ minColour_actionPerformed();
+ }
+ }
+ });
+ maxColour.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
+ maxColour.setBorder(BorderFactory.createEtchedBorder());
+ maxColour.setPreferredSize(new Dimension(40, 20));
+ maxColour.setToolTipText("Maximum Colour");
+ maxColour.addMouseListener(new MouseAdapter()
+ {
+ public void mousePressed(MouseEvent e)
+ {
+ if (maxColour.isEnabled())
+ {
+ maxColour_actionPerformed();
+ }
+ }
+ });
+ ok.setOpaque(false);
+ ok.setText("OK");
+ ok.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ ok_actionPerformed(e);
+ }
+ });
+ cancel.setOpaque(false);
+ cancel.setText("Cancel");
+ cancel.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ cancel_actionPerformed(e);
+ }
+ });
+ this.setLayout(borderLayout1);
+ jPanel2.setLayout(flowLayout1);
+ annotations.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ annotations_actionPerformed(e);
+ }
+ });
+ jPanel1.setBackground(Color.white);
+ jPanel2.setBackground(Color.white);
+ threshold.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ threshold_actionPerformed(e);
+ }
+ });
+ jPanel3.setLayout(flowLayout2);
+ thresholdValue.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ thresholdValue_actionPerformed(e);
+ }
+ });
+ slider.setPaintLabels(false);
+ slider.setPaintTicks(true);
+ slider.setBackground(Color.white);
+ slider.setEnabled(false);
+ slider.setOpaque(false);
+ slider.setPreferredSize(new Dimension(100, 32));
+ thresholdValue.setEnabled(false);
+ thresholdValue.setColumns(7);
+ jPanel3.setBackground(Color.white);
+ currentColours.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
+ currentColours.setOpaque(false);
+ currentColours.setText("Use Original Colours");
+ currentColours.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ currentColours_actionPerformed(e);
+ }
+ });
+ thresholdIsMin.setBackground(Color.white);
+ thresholdIsMin.setText("Threshold is Min/Max");
+ thresholdIsMin.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent actionEvent)
+ {
+ thresholdIsMin_actionPerformed(actionEvent);
+ }
+ });
+ jPanel1.add(ok);
+ jPanel1.add(cancel);
+ jPanel2.add(annotations);
+ jPanel2.add(currentColours);
+ jPanel2.add(minColour);
+ jPanel2.add(maxColour);
+ this.add(jPanel3, java.awt.BorderLayout.CENTER);
+ jPanel3.add(threshold);
+ jPanel3.add(slider);
+ jPanel3.add(thresholdValue);
+ jPanel3.add(thresholdIsMin);
+ this.add(jPanel1, java.awt.BorderLayout.SOUTH);
+ this.add(jPanel2, java.awt.BorderLayout.NORTH);
+ }
+
+ JComboBox annotations;
+ JPanel minColour = new JPanel();
+ JPanel maxColour = new JPanel();
+ JButton ok = new JButton();
+ JButton cancel = new JButton();
+ JPanel jPanel1 = new JPanel();
+ JPanel jPanel2 = new JPanel();
+ BorderLayout borderLayout1 = new BorderLayout();
+ JComboBox threshold = new JComboBox();
+ FlowLayout flowLayout1 = new FlowLayout();
+ JPanel jPanel3 = new JPanel();
+ FlowLayout flowLayout2 = new FlowLayout();
+ JSlider slider = new JSlider();
+ JTextField thresholdValue = new JTextField(20);
+ JCheckBox currentColours = new JCheckBox();
+ JCheckBox thresholdIsMin = new JCheckBox();
+
+ public void minColour_actionPerformed()
+ {
+ Color col = JColorChooser.showDialog(this,
+ "Select Colour for Minimum Value",
+ minColour.getBackground());
+ if (col != null)
+ {
+ minColour.setBackground(col);
+ }
+ minColour.repaint();
+ changeColour();
+ }
+
+ public void maxColour_actionPerformed()
+ {
+ Color col = JColorChooser.showDialog(this,
+ "Select Colour for Maximum Value",
+ maxColour.getBackground());
+ if (col != null)
+ {
+ maxColour.setBackground(col);
+ }
+ maxColour.repaint();
+ changeColour();
+ }
+
+ void changeColour()
+ {
+ // Check if combobox is still adjusting
+ if (adjusting)
+ {
+ return;
+ }
+
+
+ currentAnnotation = av.alignment.getAlignmentAnnotation()[annotations.getSelectedIndex()];
+
+ int aboveThreshold = -1;
+ if (threshold.getSelectedItem().equals("Above Threshold"))
+ {
+ aboveThreshold = AnnotationColourGradient.ABOVE_THRESHOLD;
+ }
+ else if (threshold.getSelectedItem().equals("Below Threshold"))
+ {
+ aboveThreshold = AnnotationColourGradient.BELOW_THRESHOLD;
+ }
+
+ slider.setEnabled(true);
+ thresholdValue.setEnabled(true);
+
+ if (aboveThreshold == AnnotationColourGradient.NO_THRESHOLD)
+ {
+ slider.setEnabled(false);
+ thresholdValue.setEnabled(false);
+ thresholdValue.setText("");
+ }
+ else if (aboveThreshold != AnnotationColourGradient.NO_THRESHOLD &&
+ currentAnnotation.threshold == null)
+ {
+ currentAnnotation.setThreshold(new jalview.datamodel.GraphLine
+ ( (currentAnnotation.graphMax -
+ currentAnnotation.graphMin) / 2f,
+ "Threshold",
+ Color.black));
+ }
+
+ if (aboveThreshold != AnnotationColourGradient.NO_THRESHOLD)
+ {
+ adjusting = true;
+ float range = currentAnnotation.graphMax * 1000 -
+ currentAnnotation.graphMin * 1000;
+
+ slider.setMinimum( (int) (currentAnnotation.graphMin * 1000));
+ slider.setMaximum( (int) (currentAnnotation.graphMax * 1000));
+ slider.setValue( (int) (currentAnnotation.threshold.value * 1000));
+ thresholdValue.setText(currentAnnotation.threshold.value + "");
+ slider.setMajorTickSpacing( (int) (range / 10f));
+ slider.setEnabled(true);
+ thresholdValue.setEnabled(true);
+ adjusting = false;
+ }
+
+ AnnotationColourGradient acg = null;
+ if (currentColours.isSelected())
+ {
+ acg = new AnnotationColourGradient(
+ currentAnnotation,
+ av.getGlobalColourScheme(), aboveThreshold);
+ }
+ else
+ {
+ acg =
+ new AnnotationColourGradient(
+ currentAnnotation,
+ minColour.getBackground(),
+ maxColour.getBackground(),
+ aboveThreshold);
+ }
+
+ if(currentAnnotation.graphMin==0f&& currentAnnotation.graphMax==0f)
+ {
+ acg.predefinedColours = true;
+ }
+
+ acg.thresholdIsMinMax = thresholdIsMin.isSelected();
+
+ av.setGlobalColourScheme(acg);
+
+ if (av.alignment.getGroups() != null)
+ {
+ Vector allGroups = ap.av.alignment.getGroups();
+ SequenceGroup sg;
+ for (int g = 0; g < allGroups.size(); g++)
+ {
+ sg = (SequenceGroup) allGroups.get(g);
+
+ if (sg.cs == null)
+ {
+ continue;
+ }
+
+ if (currentColours.isSelected())
+ {
+ sg.cs = new AnnotationColourGradient(
+ currentAnnotation,
+ sg.cs, aboveThreshold);
+ }
+ else
+ {
+ sg.cs = new AnnotationColourGradient(
+ currentAnnotation,
+ minColour.getBackground(),
+ maxColour.getBackground(),
+ aboveThreshold);
+ }
+
+ }
+ }
+
+ ap.paintAlignment(false);
+ }
+
+ public void ok_actionPerformed(ActionEvent e)
+ {
+ changeColour();
+ try
+ {
+ frame.setClosed(true);
+ }
+ catch (Exception ex)
+ {}
+ }
+
+ public void cancel_actionPerformed(ActionEvent e)
+ {
+ reset();
+ try
+ {
+ frame.setClosed(true);
+ }
+ catch (Exception ex)
+ {}
+ }
+
+ void reset()
+ {
+ av.setGlobalColourScheme(oldcs);
+ if (av.alignment.getGroups() != null)
+ {
+ Vector allGroups = ap.av.alignment.getGroups();
+ SequenceGroup sg;
+ for (int g = 0; g < allGroups.size(); g++)
+ {
+ sg = (SequenceGroup) allGroups.get(g);
+ sg.cs = (ColourSchemeI) oldgroupColours.get(sg);
+ }
+ }
+ }
+
+ public void thresholdCheck_actionPerformed(ActionEvent e)
+ {
+ changeColour();
+ }
+
+ public void annotations_actionPerformed(ActionEvent e)
+ {
+ changeColour();
+ }
+
+ public void threshold_actionPerformed(ActionEvent e)
+ {
+ changeColour();
+ }
+
+ public void thresholdValue_actionPerformed(ActionEvent e)
+ {
+ try
+ {
+ float f = Float.parseFloat(thresholdValue.getText());
+ slider.setValue( (int) (f * 1000));
+ }
+ catch (NumberFormatException ex)
+ {}
+ }
+
+ public void valueChanged()
+ {
+ if (currentColours.isSelected()
+ && ! (av.getGlobalColourScheme() instanceof AnnotationColourGradient))
+ {
+ changeColour();
+ }
+
+ currentAnnotation.threshold.value = (float) slider.getValue() / 1000f;
+ ap.paintAlignment(false);
+ }
+
+ public void currentColours_actionPerformed(ActionEvent e)
+ {
+ if (currentColours.isSelected())
+ {
+ reset();
+ }
+
+ maxColour.setEnabled(!currentColours.isSelected());
+ minColour.setEnabled(!currentColours.isSelected());
+
+ changeColour();
+ }
+
+ public void thresholdIsMin_actionPerformed(ActionEvent actionEvent)
+ {
+ changeColour();
+ }
+
+}
/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
- *\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
+ * \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
+ * \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
package jalview.gui;\r
\r
import java.util.*;\r
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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.gui;\r
-\r
-import java.awt.*;\r
-import java.awt.datatransfer.*;\r
-import java.awt.event.*;\r
-import javax.swing.*;\r
-\r
-import jalview.datamodel.*;\r
-import jalview.io.*;\r
-import jalview.jbgui.*;\r
-\r
-/**\r
- * DOCUMENT ME!\r
- *\r
- * @author $author$\r
- * @version $Revision$\r
- */\r
-public class CutAndPasteTransfer\r
- extends GCutAndPasteTransfer\r
-{\r
-\r
- AlignViewport viewport;\r
-\r
- public CutAndPasteTransfer()\r
- {\r
- SwingUtilities.invokeLater(new Runnable()\r
- {\r
- public void run()\r
- {\r
- textarea.requestFocus();\r
- }\r
- });\r
-\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- */\r
- public void setForInput(AlignViewport viewport)\r
- {\r
- this.viewport = viewport;\r
- if (viewport != null)\r
- {\r
- ok.setText("Add");\r
- }\r
-\r
- getContentPane().add(inputButtonPanel, java.awt.BorderLayout.SOUTH);\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @return DOCUMENT ME!\r
- */\r
- public String getText()\r
- {\r
- return textarea.getText();\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param text DOCUMENT ME!\r
- */\r
- public void setText(String text)\r
- {\r
- textarea.setText(text);\r
- }\r
-\r
- public void appendText(String text)\r
- {\r
- textarea.append(text);\r
- }\r
-\r
- public void save_actionPerformed(ActionEvent e)\r
- {\r
- JalviewFileChooser chooser = new JalviewFileChooser(\r
- jalview.bin.Cache.getProperty(\r
- "LAST_DIRECTORY"));\r
-\r
- chooser.setAcceptAllFileFilterUsed(false);\r
- chooser.setFileView(new JalviewFileView());\r
- chooser.setDialogTitle("Save Text to File");\r
- chooser.setToolTipText("Save");\r
-\r
- int value = chooser.showSaveDialog(this);\r
-\r
- if (value == JalviewFileChooser.APPROVE_OPTION)\r
- {\r
- try\r
- {\r
- java.io.PrintWriter out = new java.io.PrintWriter(\r
- new java.io.FileWriter(chooser.getSelectedFile()));\r
-\r
- out.print(getText());\r
- out.close();\r
- }\r
- catch (Exception ex)\r
- {\r
- ex.printStackTrace();\r
- }\r
-\r
- }\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param e DOCUMENT ME!\r
- */\r
- public void copyItem_actionPerformed(ActionEvent e)\r
- {\r
- textarea.getSelectedText();\r
- Clipboard c = Toolkit.getDefaultToolkit().getSystemClipboard();\r
- c.setContents(new StringSelection(textarea.getSelectedText()), null);\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param e DOCUMENT ME!\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
- return;\r
- }\r
-\r
- try\r
- {\r
- textarea.append( (String) contents.getTransferData(\r
- DataFlavor.stringFlavor));\r
- }\r
- catch (Exception ex)\r
- {\r
- }\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param e DOCUMENT ME!\r
- */\r
- public void ok_actionPerformed(ActionEvent e)\r
- {\r
- String format = new IdentifyFile().Identify(getText(), "Paste");\r
- Alignment al = null;\r
-\r
- if (FormatAdapter.isValidFormat(format))\r
- {\r
- try\r
- {\r
- al = new FormatAdapter().readFile(getText(), "Paste", format);\r
- }\r
- catch (java.io.IOException ex)\r
- {\r
- JOptionPane.showInternalMessageDialog(Desktop.desktop,\r
- "Couldn't read the pasted text.\n" +\r
- ex.toString(),\r
- "Error parsing text",\r
- JOptionPane.WARNING_MESSAGE);\r
- }\r
- }\r
-\r
- if (al != null)\r
- {\r
- if (viewport != null)\r
- {\r
- for (int i = 0; i < al.getHeight(); i++)\r
- {\r
- viewport.getAlignment().addSequence(al.getSequenceAt(i));\r
- }\r
-\r
- viewport.firePropertyChange("alignment", null,\r
- viewport.getAlignment().getSequences());\r
- }\r
- else\r
- {\r
- AlignFrame af = new AlignFrame(al,\r
- AlignFrame.DEFAULT_WIDTH,\r
- AlignFrame.DEFAULT_HEIGHT);\r
- af.currentFileFormat = format;\r
- Desktop.addInternalFrame(af, "Cut & Paste input - " + format,\r
- AlignFrame.DEFAULT_WIDTH,\r
- AlignFrame.DEFAULT_HEIGHT);\r
- af.statusBar.setText("Successfully pasted alignment file");\r
-\r
- try\r
- {\r
- af.setMaximum(jalview.bin.Cache.getDefault("SHOW_FULLSCREEN", false));\r
- }\r
- catch (Exception ex)\r
- {\r
- }\r
- }\r
- }\r
- }\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
- public void textarea_mousePressed(MouseEvent e)\r
- {\r
- if (SwingUtilities.isRightMouseButton(e))\r
- {\r
- JPopupMenu popup = new JPopupMenu("Edit");\r
- JMenuItem item = new JMenuItem("Copy");\r
- item.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- copyItem_actionPerformed(e);\r
- }\r
- });\r
- popup.add(item);\r
- item = new JMenuItem("Paste");\r
- item.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- pasteMenu_actionPerformed(e);\r
- }\r
- });\r
- popup.add(item);\r
- popup.show(this, e.getX() + 10, e.getY() + textarea.getY() + 40);\r
-\r
- }\r
- }\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.gui;
+
+import java.awt.*;
+import java.awt.datatransfer.*;
+import java.awt.event.*;
+import javax.swing.*;
+
+import jalview.datamodel.*;
+import jalview.io.*;
+import jalview.jbgui.*;
+
+/**
+ * DOCUMENT ME!
+ *
+ * @author $author$
+ * @version $Revision$
+ */
+public class CutAndPasteTransfer
+ extends GCutAndPasteTransfer
+{
+
+ AlignViewport viewport;
+
+ public CutAndPasteTransfer()
+ {
+ SwingUtilities.invokeLater(new Runnable()
+ {
+ public void run()
+ {
+ textarea.requestFocus();
+ }
+ });
+
+ }
+
+ /**
+ * DOCUMENT ME!
+ */
+ public void setForInput(AlignViewport viewport)
+ {
+ this.viewport = viewport;
+ if (viewport != null)
+ {
+ ok.setText("Add");
+ }
+
+ getContentPane().add(inputButtonPanel, java.awt.BorderLayout.SOUTH);
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public String getText()
+ {
+ return textarea.getText();
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param text DOCUMENT ME!
+ */
+ public void setText(String text)
+ {
+ textarea.setText(text);
+ }
+
+ public void appendText(String text)
+ {
+ textarea.append(text);
+ }
+
+ public void save_actionPerformed(ActionEvent e)
+ {
+ JalviewFileChooser chooser = new JalviewFileChooser(
+ jalview.bin.Cache.getProperty(
+ "LAST_DIRECTORY"));
+
+ chooser.setAcceptAllFileFilterUsed(false);
+ chooser.setFileView(new JalviewFileView());
+ chooser.setDialogTitle("Save Text to File");
+ chooser.setToolTipText("Save");
+
+ int value = chooser.showSaveDialog(this);
+
+ if (value == JalviewFileChooser.APPROVE_OPTION)
+ {
+ try
+ {
+ java.io.PrintWriter out = new java.io.PrintWriter(
+ new java.io.FileWriter(chooser.getSelectedFile()));
+
+ out.print(getText());
+ out.close();
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+
+ }
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param e DOCUMENT ME!
+ */
+ public void copyItem_actionPerformed(ActionEvent e)
+ {
+ textarea.getSelectedText();
+ Clipboard c = Toolkit.getDefaultToolkit().getSystemClipboard();
+ c.setContents(new StringSelection(textarea.getSelectedText()), null);
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param e DOCUMENT ME!
+ */
+ public void pasteMenu_actionPerformed(ActionEvent e)
+ {
+ Clipboard c = Toolkit.getDefaultToolkit().getSystemClipboard();
+ Transferable contents = c.getContents(this);
+
+ if (contents == null)
+ {
+ return;
+ }
+
+ try
+ {
+ textarea.append( (String) contents.getTransferData(
+ DataFlavor.stringFlavor));
+ }
+ catch (Exception ex)
+ {
+ }
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param e DOCUMENT ME!
+ */
+ public void ok_actionPerformed(ActionEvent e)
+ {
+ String format = new IdentifyFile().Identify(getText(), "Paste");
+ Alignment al = null;
+
+ if (FormatAdapter.isValidFormat(format))
+ {
+ try
+ {
+ al = new FormatAdapter().readFile(getText(), "Paste", format);
+ }
+ catch (java.io.IOException ex)
+ {
+ JOptionPane.showInternalMessageDialog(Desktop.desktop,
+ "Couldn't read the pasted text.\n" +
+ ex.toString(),
+ "Error parsing text",
+ JOptionPane.WARNING_MESSAGE);
+ }
+ }
+
+ if (al != null)
+ {
+ if (viewport != null)
+ {
+ for (int i = 0; i < al.getHeight(); i++)
+ {
+ viewport.getAlignment().addSequence(al.getSequenceAt(i));
+ }
+
+ viewport.firePropertyChange("alignment", null,
+ viewport.getAlignment().getSequences());
+ }
+ else
+ {
+ AlignFrame af = new AlignFrame(al,
+ AlignFrame.DEFAULT_WIDTH,
+ AlignFrame.DEFAULT_HEIGHT);
+ af.currentFileFormat = format;
+ Desktop.addInternalFrame(af, "Cut & Paste input - " + format,
+ AlignFrame.DEFAULT_WIDTH,
+ AlignFrame.DEFAULT_HEIGHT);
+ af.statusBar.setText("Successfully pasted alignment file");
+
+ try
+ {
+ af.setMaximum(jalview.bin.Cache.getDefault("SHOW_FULLSCREEN", false));
+ }
+ catch (Exception ex)
+ {
+ }
+ }
+ }
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param e DOCUMENT ME!
+ */
+ public void cancel_actionPerformed(ActionEvent e)
+ {
+ try
+ {
+ this.setClosed(true);
+ }
+ catch (Exception ex)
+ {
+ }
+ }
+
+ public void textarea_mousePressed(MouseEvent e)
+ {
+ if (SwingUtilities.isRightMouseButton(e))
+ {
+ JPopupMenu popup = new JPopupMenu("Edit");
+ JMenuItem item = new JMenuItem("Copy");
+ item.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ copyItem_actionPerformed(e);
+ }
+ });
+ popup.add(item);
+ item = new JMenuItem("Paste");
+ item.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ pasteMenu_actionPerformed(e);
+ }
+ });
+ popup.add(item);
+ popup.show(this, e.getX() + 10, e.getY() + textarea.getY() + 40);
+
+ }
+ }
+
+}
/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
- *\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
+ * \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
+ * \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
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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.gui;\r
-\r
-import java.awt.*;\r
-import java.awt.event.*;\r
-import javax.swing.*;\r
-\r
-public class EPSOptions\r
- extends JPanel\r
-{\r
- JDialog dialog;\r
- public boolean cancelled = false;\r
- String value;\r
-\r
- public EPSOptions()\r
- {\r
- try\r
- {\r
- jbInit();\r
- }\r
- catch (Exception ex)\r
- {\r
- ex.printStackTrace();\r
- }\r
-\r
- ButtonGroup bg = new ButtonGroup();\r
- bg.add(lineart);\r
- bg.add(text);\r
-\r
- JOptionPane pane = new JOptionPane(null,\r
- JOptionPane.DEFAULT_OPTION,\r
- JOptionPane.DEFAULT_OPTION,\r
- null, new Object[]\r
- {this});\r
-\r
- dialog = pane.createDialog(Desktop.desktop, "EPS Rendering options");\r
- dialog.setVisible(true);\r
-\r
- }\r
-\r
- private void jbInit()\r
- throws Exception\r
- {\r
- lineart.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
- lineart.setText("Lineart");\r
- text.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
- text.setText("Text");\r
- text.setSelected(true);\r
- askAgain.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
- askAgain.setText("Don\'t ask me again");\r
- ok.setText("OK");\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
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- cancel_actionPerformed(e);\r
- }\r
- });\r
- jLabel1.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
- jLabel1.setText("Select EPS character rendering style");\r
- this.setLayout(borderLayout1);\r
- jPanel3.setBorder(BorderFactory.createEtchedBorder());\r
- jPanel2.add(text);\r
- jPanel2.add(lineart);\r
- jPanel2.add(askAgain);\r
- jPanel1.add(ok);\r
- jPanel1.add(cancel);\r
- jPanel3.add(jLabel1);\r
- jPanel3.add(jPanel2);\r
- this.add(jPanel3, java.awt.BorderLayout.CENTER);\r
- this.add(jPanel1, java.awt.BorderLayout.SOUTH);\r
- }\r
-\r
- JRadioButton lineart = new JRadioButton();\r
- JRadioButton text = new JRadioButton();\r
- JCheckBox askAgain = new JCheckBox();\r
- JButton ok = new JButton();\r
- JButton cancel = new JButton();\r
- JPanel jPanel1 = new JPanel();\r
- JLabel jLabel1 = new JLabel();\r
- JPanel jPanel2 = new JPanel();\r
- JPanel jPanel3 = new JPanel();\r
- BorderLayout borderLayout1 = new BorderLayout();\r
-\r
- public void ok_actionPerformed(ActionEvent e)\r
- {\r
- if (lineart.isSelected())\r
- {\r
- value = "Lineart";\r
- }\r
- else\r
- {\r
- value = "Text";\r
- }\r
-\r
- if (!askAgain.isSelected())\r
- {\r
- jalview.bin.Cache.applicationProperties.remove("EPS_RENDERING");\r
- }\r
- else\r
- {\r
- jalview.bin.Cache.setProperty("EPS_RENDERING", value);\r
- }\r
-\r
- dialog.setVisible(false);\r
- }\r
-\r
- public void cancel_actionPerformed(ActionEvent e)\r
- {\r
- cancelled = true;\r
- dialog.setVisible(false);\r
- }\r
-\r
- public String getValue()\r
- {\r
- return value;\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.gui;
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+
+public class EPSOptions
+ extends JPanel
+{
+ JDialog dialog;
+ public boolean cancelled = false;
+ String value;
+
+ public EPSOptions()
+ {
+ try
+ {
+ jbInit();
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+
+ ButtonGroup bg = new ButtonGroup();
+ bg.add(lineart);
+ bg.add(text);
+
+ JOptionPane pane = new JOptionPane(null,
+ JOptionPane.DEFAULT_OPTION,
+ JOptionPane.DEFAULT_OPTION,
+ null, new Object[]
+ {this});
+
+ dialog = pane.createDialog(Desktop.desktop, "EPS Rendering options");
+ dialog.setVisible(true);
+
+ }
+
+ private void jbInit()
+ throws Exception
+ {
+ lineart.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
+ lineart.setText("Lineart");
+ text.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
+ text.setText("Text");
+ text.setSelected(true);
+ askAgain.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
+ askAgain.setText("Don\'t ask me again");
+ ok.setText("OK");
+ ok.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ ok_actionPerformed(e);
+ }
+ });
+ cancel.setText("Cancel");
+ cancel.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ cancel_actionPerformed(e);
+ }
+ });
+ jLabel1.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
+ jLabel1.setText("Select EPS character rendering style");
+ this.setLayout(borderLayout1);
+ jPanel3.setBorder(BorderFactory.createEtchedBorder());
+ jPanel2.add(text);
+ jPanel2.add(lineart);
+ jPanel2.add(askAgain);
+ jPanel1.add(ok);
+ jPanel1.add(cancel);
+ jPanel3.add(jLabel1);
+ jPanel3.add(jPanel2);
+ this.add(jPanel3, java.awt.BorderLayout.CENTER);
+ this.add(jPanel1, java.awt.BorderLayout.SOUTH);
+ }
+
+ JRadioButton lineart = new JRadioButton();
+ JRadioButton text = new JRadioButton();
+ JCheckBox askAgain = new JCheckBox();
+ JButton ok = new JButton();
+ JButton cancel = new JButton();
+ JPanel jPanel1 = new JPanel();
+ JLabel jLabel1 = new JLabel();
+ JPanel jPanel2 = new JPanel();
+ JPanel jPanel3 = new JPanel();
+ BorderLayout borderLayout1 = new BorderLayout();
+
+ public void ok_actionPerformed(ActionEvent e)
+ {
+ if (lineart.isSelected())
+ {
+ value = "Lineart";
+ }
+ else
+ {
+ value = "Text";
+ }
+
+ if (!askAgain.isSelected())
+ {
+ jalview.bin.Cache.applicationProperties.remove("EPS_RENDERING");
+ }
+ else
+ {
+ jalview.bin.Cache.setProperty("EPS_RENDERING", value);
+ }
+
+ dialog.setVisible(false);
+ }
+
+ public void cancel_actionPerformed(ActionEvent e)
+ {
+ cancelled = true;
+ dialog.setVisible(false);
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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
-package jalview.gui;\r
-\r
-import java.awt.*;\r
-import javax.swing.*;\r
-\r
-public class EditNameDialog\r
-{\r
- JTextField id, description;\r
- JButton ok = new JButton("Accept");\r
- JButton cancel = new JButton("Cancel");\r
- boolean accept = false;\r
-\r
- public String getName()\r
- {\r
- return id.getText();\r
- }\r
-\r
- public String getDescription()\r
- {\r
- if (description.getText().length() < 1)\r
- {\r
- return null;\r
- }\r
- else\r
- {\r
- return description.getText();\r
- }\r
- }\r
-\r
- public EditNameDialog(String name,\r
- String desc,\r
- String label1,\r
- String label2,\r
- String title)\r
- {\r
- JLabel idlabel = new JLabel(label1);\r
- JLabel desclabel = new JLabel(label2);\r
- idlabel.setFont(new Font("Courier", Font.PLAIN, 12));\r
- desclabel.setFont(new Font("Courier", Font.PLAIN, 12));\r
- id = new JTextField(name, 40);\r
- description = new JTextField(desc, 40);\r
- JPanel panel = new JPanel(new BorderLayout());\r
- JPanel panel2 = new JPanel(new BorderLayout());\r
- panel2.add(idlabel, BorderLayout.WEST);\r
- panel2.add(id, BorderLayout.CENTER);\r
- panel.add(panel2, BorderLayout.NORTH);\r
- if(desc!=null || label2!=null)\r
- {\r
- panel2 = new JPanel(new BorderLayout());\r
- panel2.add(desclabel, BorderLayout.WEST);\r
- panel2.add(description, BorderLayout.CENTER);\r
- panel.add(panel2, BorderLayout.SOUTH);\r
- }\r
-\r
- int reply = JOptionPane.showInternalConfirmDialog(Desktop.desktop,\r
- panel, title,\r
- JOptionPane.OK_CANCEL_OPTION);\r
-\r
- if (reply == JOptionPane.OK_OPTION)\r
- {\r
- accept = true;\r
- }\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.gui;
+
+import java.awt.*;
+import javax.swing.*;
+
+public class EditNameDialog
+{
+ JTextField id, description;
+ JButton ok = new JButton("Accept");
+ JButton cancel = new JButton("Cancel");
+ boolean accept = false;
+
+ public String getName()
+ {
+ return id.getText();
+ }
+
+ public String getDescription()
+ {
+ if (description.getText().length() < 1)
+ {
+ return null;
+ }
+ else
+ {
+ return description.getText();
+ }
+ }
+
+ public EditNameDialog(String name,
+ String desc,
+ String label1,
+ String label2,
+ String title)
+ {
+ JLabel idlabel = new JLabel(label1);
+ JLabel desclabel = new JLabel(label2);
+ idlabel.setFont(new Font("Courier", Font.PLAIN, 12));
+ desclabel.setFont(new Font("Courier", Font.PLAIN, 12));
+ id = new JTextField(name, 40);
+ description = new JTextField(desc, 40);
+ JPanel panel = new JPanel(new BorderLayout());
+ JPanel panel2 = new JPanel(new BorderLayout());
+ panel2.add(idlabel, BorderLayout.WEST);
+ panel2.add(id, BorderLayout.CENTER);
+ panel.add(panel2, BorderLayout.NORTH);
+ if(desc!=null || label2!=null)
+ {
+ panel2 = new JPanel(new BorderLayout());
+ panel2.add(desclabel, BorderLayout.WEST);
+ panel2.add(description, BorderLayout.CENTER);
+ panel.add(panel2, BorderLayout.SOUTH);
+ }
+
+ int reply = JOptionPane.showInternalConfirmDialog(Desktop.desktop,
+ panel, title,
+ JOptionPane.OK_CANCEL_OPTION);
+
+ if (reply == JOptionPane.OK_OPTION)
+ {
+ accept = true;
+ }
+ }
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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.gui;\r
-\r
-import java.awt.*;\r
-import java.awt.event.*;\r
-import javax.swing.*;\r
-\r
-import jalview.bin.*;\r
-import jalview.jbgui.*;\r
-\r
-/**\r
- * DOCUMENT ME!\r
- *\r
- * @author $author$\r
- * @version $Revision$\r
- */\r
-public class FontChooser\r
- extends GFontChooser\r
-{\r
- AlignmentPanel ap;\r
- TreePanel tp;\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(TreePanel tp)\r
- {\r
- this.tp = tp;\r
- ap = tp.treeCanvas.ap;\r
- oldFont = tp.getTreeFont();\r
- defaultButton.setVisible(false);\r
- smoothFont.setEnabled(false);\r
- init();\r
- }\r
-\r
- /**\r
- * Creates a new FontChooser object.\r
- *\r
- * @param ap DOCUMENT ME!\r
- */\r
- public FontChooser(AlignmentPanel ap)\r
- {\r
- oldFont = ap.av.getFont();\r
- this.ap = ap;\r
- init();\r
- }\r
-\r
- void init()\r
- {\r
- frame = new JInternalFrame();\r
- frame.setContentPane(this);\r
-\r
- smoothFont.setSelected(ap.av.antiAlias);\r
-\r
- if (tp != null)\r
- {\r
- Desktop.addInternalFrame(frame, "Change Font (Tree Panel)", 340, 170, false);\r
- }\r
- else\r
- {\r
- Desktop.addInternalFrame(frame, "Change Font", 340, 170, false);\r
- }\r
-\r
- frame.setLayer(JLayeredPane.PALETTE_LAYER);\r
-\r
- String[] fonts = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment()\r
- .getAvailableFontFamilyNames();\r
-\r
- for (int i = 0; i < fonts.length; i++)\r
- {\r
- fontName.addItem(fonts[i]);\r
- }\r
-\r
- for (int i = 1; i < 51; i++)\r
- {\r
- fontSize.addItem(i + "");\r
- }\r
-\r
- fontStyle.addItem("plain");\r
- fontStyle.addItem("bold");\r
- fontStyle.addItem("italic");\r
-\r
- fontName.setSelectedItem(oldFont.getName());\r
- fontSize.setSelectedItem(oldFont.getSize() + "");\r
- fontStyle.setSelectedIndex(oldFont.getStyle());\r
-\r
- FontMetrics fm = getGraphics().getFontMetrics(oldFont);\r
- monospaced.setSelected(fm.getStringBounds("M", getGraphics()).getWidth()\r
- == fm.getStringBounds("|", getGraphics()).getWidth());\r
-\r
- init = false;\r
- }\r
-\r
- public void smoothFont_actionPerformed(ActionEvent e)\r
- {\r
- ap.av.antiAlias = smoothFont.isSelected();\r
- ap.annotationPanel.image = null;\r
- ap.paintAlignment(true);\r
- }\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 != null)\r
- {\r
- if (ap.getOverviewPanel() != null)\r
- {\r
- ap.getOverviewPanel().updateOverviewImage();\r
- }\r
- }\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param e DOCUMENT ME!\r
- */\r
- protected void cancel_actionPerformed(ActionEvent e)\r
- {\r
- if (ap != null)\r
- {\r
- ap.av.setFont(oldFont);\r
- ap.paintAlignment(true);\r
- }\r
- else if (tp != null)\r
- {\r
- tp.setTreeFont(oldFont);\r
- }\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
- * DOCUMENT ME!\r
- */\r
- void changeFont()\r
- {\r
- Font newFont = new Font(fontName.getSelectedItem().toString(),\r
- fontStyle.getSelectedIndex(),\r
- Integer.parseInt(fontSize.getSelectedItem().\r
- toString()));\r
- if (tp != null)\r
- {\r
- tp.setTreeFont(newFont);\r
- }\r
- else if (ap != null)\r
- {\r
- ap.av.setFont(newFont);\r
- ap.fontChanged();\r
- }\r
-\r
- FontMetrics fm = getGraphics().getFontMetrics(newFont);\r
-\r
- monospaced.setSelected(fm.getStringBounds("M", getGraphics()).getWidth()\r
- == fm.getStringBounds("|", getGraphics()).getWidth());\r
-\r
- }\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
- * DOCUMENT ME!\r
- *\r
- * @param e DOCUMENT ME!\r
- */\r
- protected void fontSize_actionPerformed(ActionEvent e)\r
- {\r
- if (init)\r
- {\r
- return;\r
- }\r
-\r
- changeFont();\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param e DOCUMENT ME!\r
- */\r
- protected void fontStyle_actionPerformed(ActionEvent e)\r
- {\r
- if (init)\r
- {\r
- return;\r
- }\r
-\r
- changeFont();\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param e DOCUMENT ME!\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
- Cache.setProperty("ANTI_ALIAS", Boolean.toString(smoothFont.isSelected()));\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.gui;
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+
+import jalview.bin.*;
+import jalview.jbgui.*;
+
+/**
+ * DOCUMENT ME!
+ *
+ * @author $author$
+ * @version $Revision$
+ */
+public class FontChooser
+ extends GFontChooser
+{
+ AlignmentPanel ap;
+ TreePanel tp;
+ Font oldFont;
+ boolean init = true;
+ JInternalFrame frame;
+
+ /**
+ * Creates a new FontChooser object.
+ *
+ * @param ap DOCUMENT ME!
+ */
+ public FontChooser(TreePanel tp)
+ {
+ this.tp = tp;
+ ap = tp.treeCanvas.ap;
+ oldFont = tp.getTreeFont();
+ defaultButton.setVisible(false);
+ smoothFont.setEnabled(false);
+ init();
+ }
+
+ /**
+ * Creates a new FontChooser object.
+ *
+ * @param ap DOCUMENT ME!
+ */
+ public FontChooser(AlignmentPanel ap)
+ {
+ oldFont = ap.av.getFont();
+ this.ap = ap;
+ init();
+ }
+
+ void init()
+ {
+ frame = new JInternalFrame();
+ frame.setContentPane(this);
+
+ smoothFont.setSelected(ap.av.antiAlias);
+
+ if (tp != null)
+ {
+ Desktop.addInternalFrame(frame, "Change Font (Tree Panel)", 340, 170, false);
+ }
+ else
+ {
+ Desktop.addInternalFrame(frame, "Change Font", 340, 170, false);
+ }
+
+ frame.setLayer(JLayeredPane.PALETTE_LAYER);
+
+ String[] fonts = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment()
+ .getAvailableFontFamilyNames();
+
+ for (int i = 0; i < fonts.length; i++)
+ {
+ fontName.addItem(fonts[i]);
+ }
+
+ for (int i = 1; i < 51; i++)
+ {
+ fontSize.addItem(i + "");
+ }
+
+ fontStyle.addItem("plain");
+ fontStyle.addItem("bold");
+ fontStyle.addItem("italic");
+
+ fontName.setSelectedItem(oldFont.getName());
+ fontSize.setSelectedItem(oldFont.getSize() + "");
+ fontStyle.setSelectedIndex(oldFont.getStyle());
+
+ FontMetrics fm = getGraphics().getFontMetrics(oldFont);
+ monospaced.setSelected(fm.getStringBounds("M", getGraphics()).getWidth()
+ == fm.getStringBounds("|", getGraphics()).getWidth());
+
+ init = false;
+ }
+
+ public void smoothFont_actionPerformed(ActionEvent e)
+ {
+ ap.av.antiAlias = smoothFont.isSelected();
+ ap.annotationPanel.image = null;
+ ap.paintAlignment(true);
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param e DOCUMENT ME!
+ */
+ protected void ok_actionPerformed(ActionEvent e)
+ {
+ try
+ {
+ frame.setClosed(true);
+ }
+ catch (Exception ex)
+ {
+ }
+
+ if (ap != null)
+ {
+ if (ap.getOverviewPanel() != null)
+ {
+ ap.getOverviewPanel().updateOverviewImage();
+ }
+ }
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param e DOCUMENT ME!
+ */
+ protected void cancel_actionPerformed(ActionEvent e)
+ {
+ if (ap != null)
+ {
+ ap.av.setFont(oldFont);
+ ap.paintAlignment(true);
+ }
+ else if (tp != null)
+ {
+ tp.setTreeFont(oldFont);
+ }
+ fontName.setSelectedItem(oldFont.getName());
+ fontSize.setSelectedItem(oldFont.getSize() + "");
+ fontStyle.setSelectedIndex(oldFont.getStyle());
+
+ try
+ {
+ frame.setClosed(true);
+ }
+ catch (Exception ex)
+ {
+ }
+ }
+
+ /**
+ * DOCUMENT ME!
+ */
+ void changeFont()
+ {
+ Font newFont = new Font(fontName.getSelectedItem().toString(),
+ fontStyle.getSelectedIndex(),
+ Integer.parseInt(fontSize.getSelectedItem().
+ toString()));
+ if (tp != null)
+ {
+ tp.setTreeFont(newFont);
+ }
+ else if (ap != null)
+ {
+ ap.av.setFont(newFont);
+ ap.fontChanged();
+ }
+
+ FontMetrics fm = getGraphics().getFontMetrics(newFont);
+
+ monospaced.setSelected(fm.getStringBounds("M", getGraphics()).getWidth()
+ == fm.getStringBounds("|", getGraphics()).getWidth());
+
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param e DOCUMENT ME!
+ */
+ protected void fontName_actionPerformed(ActionEvent e)
+ {
+ if (init)
+ {
+ return;
+ }
+
+ changeFont();
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param e DOCUMENT ME!
+ */
+ protected void fontSize_actionPerformed(ActionEvent e)
+ {
+ if (init)
+ {
+ return;
+ }
+
+ changeFont();
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param e DOCUMENT ME!
+ */
+ protected void fontStyle_actionPerformed(ActionEvent e)
+ {
+ if (init)
+ {
+ return;
+ }
+
+ changeFont();
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param e DOCUMENT ME!
+ */
+ public void defaultButton_actionPerformed(ActionEvent e)
+ {
+ Cache.setProperty("FONT_NAME", fontName.getSelectedItem().toString());
+ Cache.setProperty("FONT_STYLE", fontStyle.getSelectedIndex() + "");
+ Cache.setProperty("FONT_SIZE", fontSize.getSelectedItem().toString());
+ Cache.setProperty("ANTI_ALIAS", Boolean.toString(smoothFont.isSelected()));
+ }
+}
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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.gui;\r
\r
/**\r
*/\r
public abstract void setProgressBar(String message, long id);\r
\r
-}
\ No newline at end of file
+}\r
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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.gui;\r
-\r
-import java.awt.*;\r
-import java.awt.image.*;\r
-import javax.swing.*;\r
-\r
-import jalview.datamodel.*;\r
-\r
-/**\r
- * DOCUMENT ME!\r
- *\r
- * @author $author$\r
- * @version $Revision$\r
- */\r
-public class IdCanvas\r
- 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
- FontMetrics fm;\r
- AnnotationLabels labels = null;\r
- AnnotationPanel ap;\r
- Font idfont;\r
-\r
- /**\r
- * Creates a new IdCanvas object.\r
- *\r
- * @param av DOCUMENT ME!\r
- */\r
- public IdCanvas(AlignViewport av)\r
- {\r
- setLayout(new BorderLayout());\r
- this.av = av;\r
- PaintRefresher.Register(this, av.getSequenceSetId());\r
- }\r
-\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
- int xPos = 0;\r
- int panelWidth = getWidth();\r
- int charHeight = av.charHeight;\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().getSequences(null).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(av.getSequenceColour(s));\r
- gg.fillRect(0, ( (i - starty) * charHeight) + ypos, getWidth(),\r
- charHeight);\r
- gg.setColor(Color.black);\r
- }\r
-\r
- if (av.rightAlignIds)\r
- {\r
- xPos = panelWidth - fm.stringWidth(\r
- s.getDisplayId(av.getShowJVSuffix())\r
- ) - 4;\r
- }\r
-\r
- gg.drawString(s.getDisplayId(av.getShowJVSuffix()),\r
- xPos,\r
- ( ( (i - starty + 1) * charHeight) + ypos) - (charHeight / 5));\r
-\r
- if (av.hasHiddenRows && av.showHiddenMarkers)\r
- {\r
- drawMarker(i, starty, ypos);\r
- }\r
-\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param vertical DOCUMENT ME!\r
- */\r
- public void fastPaint(int vertical)\r
- {\r
- if (gg == null)\r
- {\r
- repaint();\r
-\r
- return;\r
- }\r
-\r
- gg.copyArea(0, 0, getWidth(), imgHeight, 0, -vertical * av.charHeight);\r
-\r
- int ss = av.startSeq;\r
- int es = av.endSeq;\r
- int transY = 0;\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
- }\r
- else if (vertical < 0)\r
- {\r
- es = ss - vertical;\r
-\r
- if (es > av.endSeq)\r
- {\r
- es = av.endSeq;\r
- }\r
- }\r
-\r
- gg.translate(0, transY);\r
-\r
- drawIds(ss, es);\r
-\r
- gg.translate(0, -transY);\r
-\r
- fastPaint = true;\r
- repaint();\r
- }\r
-\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
- if (fastPaint)\r
- {\r
- fastPaint = false;\r
- g.drawImage(image, 0, 0, this);\r
-\r
- return;\r
- }\r
-\r
- int oldHeight = imgHeight;\r
-\r
- imgHeight = getHeight();\r
- imgHeight -= (imgHeight % av.charHeight);\r
-\r
- if (imgHeight < 1)\r
- {\r
- return;\r
- }\r
-\r
- if (oldHeight != imgHeight || image.getWidth(this) != getWidth())\r
- {\r
- image = new BufferedImage(getWidth(), imgHeight,\r
- BufferedImage.TYPE_INT_RGB);\r
- }\r
-\r
- gg = (Graphics2D) image.getGraphics();\r
-\r
- //Fill in the background\r
- gg.setColor(Color.white);\r
- gg.fillRect(0, 0, getWidth(), imgHeight);\r
-\r
- drawIds(av.getStartSeq(), av.endSeq);\r
-\r
- g.drawImage(image, 0, 0, this);\r
- }\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
- if (av.seqNameItalics)\r
- {\r
- idfont = new Font(av.getFont().getName(), Font.ITALIC,\r
- av.getFont().getSize());\r
- }\r
- else\r
- {\r
- idfont = av.getFont();\r
- }\r
-\r
- gg.setFont(idfont);\r
- fm = gg.getFontMetrics();\r
-\r
- if (av.antiAlias)\r
- {\r
- gg.setRenderingHint(RenderingHints.KEY_ANTIALIASING,\r
- RenderingHints.VALUE_ANTIALIAS_ON);\r
- }\r
-\r
- Color currentColor = Color.white;\r
- Color currentTextColor = Color.black;\r
-\r
- if (av.getWrapAlignment())\r
- {\r
- int maxwidth = av.alignment.getWidth();\r
- int alheight = av.alignment.getHeight();\r
-\r
- if (av.hasHiddenColumns)\r
- {\r
- maxwidth = av.getColumnSelection().findColumnPosition(maxwidth) - 1;\r
- }\r
-\r
- int annotationHeight = 0;\r
-\r
- if (av.showAnnotation)\r
- {\r
- if (ap == null)\r
- {\r
- ap = new AnnotationPanel(av);\r
- }\r
-\r
- annotationHeight = ap.adjustPanelHeight();\r
- if (labels == null)\r
- {\r
- labels = new AnnotationLabels(av);\r
- }\r
- }\r
-\r
- int hgap = av.charHeight;\r
- if (av.scaleAboveWrapped)\r
- {\r
- hgap += av.charHeight;\r
- }\r
-\r
- int cHeight = alheight * av.charHeight\r
- + hgap\r
- + annotationHeight;\r
-\r
- int rowSize = av.getEndRes() - av.getStartRes();\r
-\r
- // Draw the rest of the panels\r
- for (int ypos = hgap, row = av.startRes;\r
- (ypos <= getHeight()) && (row < maxwidth);\r
- ypos += cHeight, row += rowSize)\r
- {\r
- for (int i = starty; i < alheight; i++)\r
- {\r
- SequenceI s = av.alignment.getSequenceAt(i);\r
- if (av.hasHiddenRows)\r
- {\r
- setHiddenFont(s);\r
- }\r
- else\r
- {\r
- gg.setFont(idfont);\r
- }\r
-\r
- drawIdString(gg, s, i, 0, ypos);\r
- }\r
-\r
- if (labels != null && av.showAnnotation)\r
- {\r
- gg.translate(0, ypos + (alheight * av.charHeight));\r
- labels.drawComponent(gg, getWidth());\r
- gg.translate(0, -ypos - (alheight * av.charHeight));\r
- }\r
- }\r
- }\r
- else\r
- {\r
- //No need to hang on to labels if we're not wrapped\r
- labels = null;\r
-\r
- //Now draw the id strings\r
- int panelWidth = getWidth();\r
- int xPos = 0;\r
-\r
- SequenceI sequence;\r
- //Now draw the id strings\r
- for (int i = starty; i < endy; i++)\r
- {\r
- sequence = av.alignment.getSequenceAt(i);\r
-\r
- if (sequence == null)\r
- {\r
- continue;\r
- }\r
-\r
- if (av.hasHiddenRows)\r
- {\r
- setHiddenFont(sequence);\r
- }\r
-\r
- // Selected sequence colours\r
- if ( (searchResults != null) &&\r
- searchResults.contains(sequence))\r
- {\r
- currentColor = Color.black;\r
- currentTextColor = Color.white;\r
- }\r
- else if ( (av.getSelectionGroup() != null) &&\r
- av.getSelectionGroup().getSequences(null).contains(\r
- sequence))\r
- {\r
- currentColor = Color.lightGray;\r
- currentTextColor = Color.black;\r
- }\r
- else\r
- {\r
- currentColor = av.getSequenceColour(sequence);\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 = sequence.getDisplayId(av.getShowJVSuffix());\r
-\r
- if (av.rightAlignIds)\r
- {\r
- xPos = panelWidth - fm.stringWidth(string) - 4;\r
- }\r
-\r
- gg.drawString(string, xPos,\r
- ( ( (i - starty) * av.charHeight) + av.charHeight) -\r
- (av.charHeight / 5));\r
-\r
- if (av.hasHiddenRows && av.showHiddenMarkers)\r
- {\r
- drawMarker(i, starty, 0);\r
- }\r
-\r
- }\r
-\r
- }\r
- }\r
-\r
- void drawMarker(int i, int starty, int yoffset)\r
- {\r
-\r
- SequenceI[] hseqs = av.alignment.getHiddenSequences().hiddenSequences;\r
- //Use this method here instead of calling hiddenSeq adjust\r
- //3 times.\r
- int hSize = hseqs.length;\r
-\r
- int hiddenIndex = i;\r
- int lastIndex = i - 1;\r
- int nextIndex = i + 1;\r
-\r
- for (int j = 0; j < hSize; j++)\r
- {\r
- if (hseqs[j] != null)\r
- {\r
- if (j - 1 < hiddenIndex)\r
- {\r
- hiddenIndex++;\r
- }\r
- if (j - 1 < lastIndex)\r
- {\r
- lastIndex++;\r
- }\r
- if (j - 1 < nextIndex)\r
- {\r
- nextIndex++;\r
- }\r
- }\r
- }\r
-\r
- boolean below = (hiddenIndex > lastIndex + 1);\r
- boolean above = (nextIndex > hiddenIndex + 1);\r
-\r
- gg.setColor(Color.blue);\r
- if (below)\r
- {\r
- gg.fillPolygon(new int[]\r
- {getWidth() - av.charHeight,\r
- getWidth() - av.charHeight,\r
- getWidth()},\r
- new int[]\r
- {\r
- (i - starty) * av.charHeight + yoffset,\r
- (i - starty) * av.charHeight + yoffset + av.charHeight / 4,\r
- (i - starty) * av.charHeight + yoffset\r
- }, 3);\r
- }\r
- if (above)\r
- {\r
- gg.fillPolygon(new int[]\r
- {getWidth() - av.charHeight,\r
- getWidth() - av.charHeight,\r
- getWidth()},\r
- new int[]\r
- {\r
- (i - starty + 1) * av.charHeight + yoffset,\r
- (i - starty + 1) * av.charHeight + yoffset -\r
- av.charHeight / 4,\r
- (i - starty + 1) * av.charHeight + yoffset\r
- }, 3);\r
-\r
- }\r
- }\r
-\r
- void setHiddenFont(SequenceI seq)\r
- {\r
- Font bold = new Font(av.getFont().getName(), Font.BOLD,\r
- av.getFont().getSize());\r
-\r
- if (av.hiddenRepSequences != null &&\r
- av.hiddenRepSequences.containsKey(seq))\r
- {\r
- gg.setFont(bold);\r
- }\r
- else\r
- {\r
- gg.setFont(idfont);\r
- }\r
- }\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
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.gui;
+
+import java.awt.*;
+import java.awt.image.*;
+import javax.swing.*;
+
+import jalview.datamodel.*;
+
+/**
+ * DOCUMENT ME!
+ *
+ * @author $author$
+ * @version $Revision$
+ */
+public class IdCanvas
+ extends JPanel
+{
+ protected AlignViewport av;
+ protected boolean showScores = true;
+ protected int maxIdLength = -1;
+ protected String maxIdStr = null;
+ BufferedImage image;
+ Graphics2D gg;
+ int imgHeight = 0;
+ boolean fastPaint = false;
+ java.util.Vector searchResults;
+ FontMetrics fm;
+ AnnotationLabels labels = null;
+ AnnotationPanel ap;
+ Font idfont;
+
+ /**
+ * Creates a new IdCanvas object.
+ *
+ * @param av DOCUMENT ME!
+ */
+ public IdCanvas(AlignViewport av)
+ {
+ setLayout(new BorderLayout());
+ this.av = av;
+ PaintRefresher.Register(this, av.getSequenceSetId());
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param gg DOCUMENT ME!
+ * @param s DOCUMENT ME!
+ * @param i DOCUMENT ME!
+ * @param starty DOCUMENT ME!
+ * @param ypos DOCUMENT ME!
+ */
+ public void drawIdString(Graphics2D gg, SequenceI s, int i, int starty,
+ int ypos)
+ {
+ int xPos = 0;
+ int panelWidth = getWidth();
+ int charHeight = av.charHeight;
+
+ if ( (searchResults != null) && searchResults.contains(s))
+ {
+ gg.setColor(Color.black);
+ gg.fillRect(0, ( (i - starty) * charHeight) + ypos, getWidth(),
+ charHeight);
+ gg.setColor(Color.white);
+ }
+ else if ( (av.getSelectionGroup() != null) &&
+ av.getSelectionGroup().getSequences(null).contains(s))
+ {
+ gg.setColor(Color.lightGray);
+ gg.fillRect(0, ( (i - starty) * charHeight) + ypos, getWidth(),
+ charHeight);
+ gg.setColor(Color.white);
+ }
+ else
+ {
+ gg.setColor(av.getSequenceColour(s));
+ gg.fillRect(0, ( (i - starty) * charHeight) + ypos, getWidth(),
+ charHeight);
+ gg.setColor(Color.black);
+ }
+
+ if (av.rightAlignIds)
+ {
+ xPos = panelWidth - fm.stringWidth(
+ s.getDisplayId(av.getShowJVSuffix())
+ ) - 4;
+ }
+
+ gg.drawString(s.getDisplayId(av.getShowJVSuffix()),
+ xPos,
+ ( ( (i - starty + 1) * charHeight) + ypos) - (charHeight / 5));
+
+ if (av.hasHiddenRows && av.showHiddenMarkers)
+ {
+ drawMarker(i, starty, ypos);
+ }
+
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param vertical DOCUMENT ME!
+ */
+ public void fastPaint(int vertical)
+ {
+ if (gg == null)
+ {
+ repaint();
+
+ return;
+ }
+
+ gg.copyArea(0, 0, getWidth(), imgHeight, 0, -vertical * av.charHeight);
+
+ int ss = av.startSeq;
+ int es = av.endSeq;
+ int transY = 0;
+
+ if (vertical > 0) // scroll down
+ {
+ ss = es - vertical;
+
+ if (ss < av.startSeq)
+ { // ie scrolling too fast, more than a page at a time
+ ss = av.startSeq;
+ }
+ else
+ {
+ transY = imgHeight - (vertical * av.charHeight);
+ }
+ }
+ else if (vertical < 0)
+ {
+ es = ss - vertical;
+
+ if (es > av.endSeq)
+ {
+ es = av.endSeq;
+ }
+ }
+
+ gg.translate(0, transY);
+
+ drawIds(ss, es);
+
+ gg.translate(0, -transY);
+
+ fastPaint = true;
+ repaint();
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param g DOCUMENT ME!
+ */
+ public void paintComponent(Graphics g)
+ {
+ g.setColor(Color.white);
+ g.fillRect(0, 0, getWidth(), getHeight());
+
+ if (fastPaint)
+ {
+ fastPaint = false;
+ g.drawImage(image, 0, 0, this);
+
+ return;
+ }
+
+ int oldHeight = imgHeight;
+
+ imgHeight = getHeight();
+ imgHeight -= (imgHeight % av.charHeight);
+
+ if (imgHeight < 1)
+ {
+ return;
+ }
+
+ if (oldHeight != imgHeight || image.getWidth(this) != getWidth())
+ {
+ image = new BufferedImage(getWidth(), imgHeight,
+ BufferedImage.TYPE_INT_RGB);
+ }
+
+ gg = (Graphics2D) image.getGraphics();
+
+ //Fill in the background
+ gg.setColor(Color.white);
+ gg.fillRect(0, 0, getWidth(), imgHeight);
+
+ drawIds(av.getStartSeq(), av.endSeq);
+
+ g.drawImage(image, 0, 0, this);
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param starty DOCUMENT ME!
+ * @param endy DOCUMENT ME!
+ */
+ void drawIds(int starty, int endy)
+ {
+ if (av.seqNameItalics)
+ {
+ idfont = new Font(av.getFont().getName(), Font.ITALIC,
+ av.getFont().getSize());
+ }
+ else
+ {
+ idfont = av.getFont();
+ }
+
+ gg.setFont(idfont);
+ fm = gg.getFontMetrics();
+
+ if (av.antiAlias)
+ {
+ gg.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+ RenderingHints.VALUE_ANTIALIAS_ON);
+ }
+
+ Color currentColor = Color.white;
+ Color currentTextColor = Color.black;
+
+ if (av.getWrapAlignment())
+ {
+ int maxwidth = av.alignment.getWidth();
+ int alheight = av.alignment.getHeight();
+
+ if (av.hasHiddenColumns)
+ {
+ maxwidth = av.getColumnSelection().findColumnPosition(maxwidth) - 1;
+ }
+
+ int annotationHeight = 0;
+
+ if (av.showAnnotation)
+ {
+ if (ap == null)
+ {
+ ap = new AnnotationPanel(av);
+ }
+
+ annotationHeight = ap.adjustPanelHeight();
+ if (labels == null)
+ {
+ labels = new AnnotationLabels(av);
+ }
+ }
+
+ int hgap = av.charHeight;
+ if (av.scaleAboveWrapped)
+ {
+ hgap += av.charHeight;
+ }
+
+ int cHeight = alheight * av.charHeight
+ + hgap
+ + annotationHeight;
+
+ int rowSize = av.getEndRes() - av.getStartRes();
+
+ // Draw the rest of the panels
+ for (int ypos = hgap, row = av.startRes;
+ (ypos <= getHeight()) && (row < maxwidth);
+ ypos += cHeight, row += rowSize)
+ {
+ for (int i = starty; i < alheight; i++)
+ {
+ SequenceI s = av.alignment.getSequenceAt(i);
+ if (av.hasHiddenRows)
+ {
+ setHiddenFont(s);
+ }
+ else
+ {
+ gg.setFont(idfont);
+ }
+
+ drawIdString(gg, s, i, 0, ypos);
+ }
+
+ if (labels != null && av.showAnnotation)
+ {
+ gg.translate(0, ypos + (alheight * av.charHeight));
+ labels.drawComponent(gg, getWidth());
+ gg.translate(0, -ypos - (alheight * av.charHeight));
+ }
+ }
+ }
+ else
+ {
+ //No need to hang on to labels if we're not wrapped
+ labels = null;
+
+ //Now draw the id strings
+ int panelWidth = getWidth();
+ int xPos = 0;
+
+ SequenceI sequence;
+ //Now draw the id strings
+ for (int i = starty; i < endy; i++)
+ {
+ sequence = av.alignment.getSequenceAt(i);
+
+ if (sequence == null)
+ {
+ continue;
+ }
+
+ if (av.hasHiddenRows)
+ {
+ setHiddenFont(sequence);
+ }
+
+ // Selected sequence colours
+ if ( (searchResults != null) &&
+ searchResults.contains(sequence))
+ {
+ currentColor = Color.black;
+ currentTextColor = Color.white;
+ }
+ else if ( (av.getSelectionGroup() != null) &&
+ av.getSelectionGroup().getSequences(null).contains(
+ sequence))
+ {
+ currentColor = Color.lightGray;
+ currentTextColor = Color.black;
+ }
+ else
+ {
+ currentColor = av.getSequenceColour(sequence);
+ currentTextColor = Color.black;
+ }
+
+ gg.setColor(currentColor);
+
+ gg.fillRect(0, (i - starty) * av.charHeight, getWidth(),
+ av.charHeight);
+
+ gg.setColor(currentTextColor);
+
+ String string = sequence.getDisplayId(av.getShowJVSuffix());
+
+ if (av.rightAlignIds)
+ {
+ xPos = panelWidth - fm.stringWidth(string) - 4;
+ }
+
+ gg.drawString(string, xPos,
+ ( ( (i - starty) * av.charHeight) + av.charHeight) -
+ (av.charHeight / 5));
+
+ if (av.hasHiddenRows && av.showHiddenMarkers)
+ {
+ drawMarker(i, starty, 0);
+ }
+
+ }
+
+ }
+ }
+
+ void drawMarker(int i, int starty, int yoffset)
+ {
+
+ SequenceI[] hseqs = av.alignment.getHiddenSequences().hiddenSequences;
+ //Use this method here instead of calling hiddenSeq adjust
+ //3 times.
+ int hSize = hseqs.length;
+
+ int hiddenIndex = i;
+ int lastIndex = i - 1;
+ int nextIndex = i + 1;
+
+ for (int j = 0; j < hSize; j++)
+ {
+ if (hseqs[j] != null)
+ {
+ if (j - 1 < hiddenIndex)
+ {
+ hiddenIndex++;
+ }
+ if (j - 1 < lastIndex)
+ {
+ lastIndex++;
+ }
+ if (j - 1 < nextIndex)
+ {
+ nextIndex++;
+ }
+ }
+ }
+
+ boolean below = (hiddenIndex > lastIndex + 1);
+ boolean above = (nextIndex > hiddenIndex + 1);
+
+ gg.setColor(Color.blue);
+ if (below)
+ {
+ gg.fillPolygon(new int[]
+ {getWidth() - av.charHeight,
+ getWidth() - av.charHeight,
+ getWidth()},
+ new int[]
+ {
+ (i - starty) * av.charHeight + yoffset,
+ (i - starty) * av.charHeight + yoffset + av.charHeight / 4,
+ (i - starty) * av.charHeight + yoffset
+ }, 3);
+ }
+ if (above)
+ {
+ gg.fillPolygon(new int[]
+ {getWidth() - av.charHeight,
+ getWidth() - av.charHeight,
+ getWidth()},
+ new int[]
+ {
+ (i - starty + 1) * av.charHeight + yoffset,
+ (i - starty + 1) * av.charHeight + yoffset -
+ av.charHeight / 4,
+ (i - starty + 1) * av.charHeight + yoffset
+ }, 3);
+
+ }
+ }
+
+ void setHiddenFont(SequenceI seq)
+ {
+ Font bold = new Font(av.getFont().getName(), Font.BOLD,
+ av.getFont().getSize());
+
+ if (av.hiddenRepSequences != null &&
+ av.hiddenRepSequences.containsKey(seq))
+ {
+ gg.setFont(bold);
+ }
+ else
+ {
+ gg.setFont(idfont);
+ }
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param found DOCUMENT ME!
+ */
+ public void setHighlighted(java.util.Vector found)
+ {
+ searchResults = found;
+ repaint();
+ }
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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.gui;\r
-\r
-import java.awt.*;\r
-import java.awt.event.*;\r
-import javax.swing.*;\r
-\r
-/**\r
- * DOCUMENT ME!\r
- *\r
- * @author $author$\r
- * @version $Revision$\r
- */\r
-public class IdwidthAdjuster\r
- extends JPanel implements MouseListener,\r
- MouseMotionListener\r
-{\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
- java.net.URL url = getClass().getResource("/images/idwidth.gif");\r
-\r
- if (url != null)\r
- {\r
- image = java.awt.Toolkit.getDefaultToolkit().createImage(url);\r
- }\r
-\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
- oldX = evt.getX();\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param evt DOCUMENT ME!\r
- */\r
- public void mouseReleased(MouseEvent evt)\r
- {\r
- active = false;\r
- repaint();\r
- }\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
- /**\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
- /**\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.paintAlignment(true);\r
- }\r
-\r
- oldX = evt.getX();\r
- }\r
-\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
- /**\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
- if (active)\r
- {\r
- if (image != null)\r
- {\r
- g.drawImage(image, getWidth() - 20, 2, this);\r
- }\r
- }\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.gui;
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+
+/**
+ * DOCUMENT ME!
+ *
+ * @author $author$
+ * @version $Revision$
+ */
+public class IdwidthAdjuster
+ extends JPanel implements MouseListener,
+ MouseMotionListener
+{
+ boolean active = false;
+ int oldX = 0;
+ Image image;
+ AlignmentPanel ap;
+
+ /**
+ * Creates a new IdwidthAdjuster object.
+ *
+ * @param ap DOCUMENT ME!
+ */
+ public IdwidthAdjuster(AlignmentPanel ap)
+ {
+ this.ap = ap;
+
+ java.net.URL url = getClass().getResource("/images/idwidth.gif");
+
+ if (url != null)
+ {
+ image = java.awt.Toolkit.getDefaultToolkit().createImage(url);
+ }
+
+ addMouseListener(this);
+ addMouseMotionListener(this);
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param evt DOCUMENT ME!
+ */
+ public void mousePressed(MouseEvent evt)
+ {
+ oldX = evt.getX();
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param evt DOCUMENT ME!
+ */
+ public void mouseReleased(MouseEvent evt)
+ {
+ active = false;
+ repaint();
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param evt DOCUMENT ME!
+ */
+ public void mouseEntered(MouseEvent evt)
+ {
+ active = true;
+ repaint();
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param evt DOCUMENT ME!
+ */
+ public void mouseExited(MouseEvent evt)
+ {
+ active = false;
+ repaint();
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param evt DOCUMENT ME!
+ */
+ public void mouseDragged(MouseEvent evt)
+ {
+ active = true;
+
+ Dimension d = ap.idPanel.idCanvas.getPreferredSize();
+ int dif = evt.getX() - oldX;
+
+ if ( ( (d.width + dif) > 20) || (dif > 0))
+ {
+ ap.idPanel.idCanvas.setPreferredSize(new Dimension(d.width + dif,
+ d.height));
+ ap.paintAlignment(true);
+ }
+
+ oldX = evt.getX();
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param evt DOCUMENT ME!
+ */
+ public void mouseMoved(MouseEvent evt)
+ {
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param evt DOCUMENT ME!
+ */
+ public void mouseClicked(MouseEvent evt)
+ {
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param g DOCUMENT ME!
+ */
+ public void paintComponent(Graphics g)
+ {
+ g.setColor(Color.white);
+ g.fillRect(0, 0, getWidth(), getHeight());
+
+ if (active)
+ {
+ if (image != null)
+ {
+ g.drawImage(image, getWidth() - 20, 2, this);
+ }
+ }
+ }
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
- *\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
+ * \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
+ * \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) 2007 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.gui;\r
-\r
-import java.awt.*;\r
-import java.awt.event.*;\r
-import java.awt.image.*;\r
-import javax.swing.*;\r
-\r
-/**\r
- * DOCUMENT ME!\r
- *\r
- * @author $author$\r
- * @version $Revision$\r
- */\r
-public class OverviewPanel\r
- 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 = 20;\r
- int boxX = -1;\r
- int boxY = -1;\r
- int boxWidth = -1;\r
- int boxHeight = -1;\r
- boolean resizing = false;\r
-\r
- // Can set different properties in this seqCanvas than\r
- // main visible SeqCanvas\r
- SequenceRenderer sr;\r
- FeatureRenderer fr;\r
-\r
- /**\r
- * Creates a new OverviewPanel object.\r
- *\r
- * @param ap DOCUMENT ME!\r
- */\r
- public OverviewPanel(AlignmentPanel ap)\r
- {\r
- this.av = ap.av;\r
- this.ap = ap;\r
- setLayout(null);\r
-\r
- sr = new SequenceRenderer(av);\r
- sr.renderGaps = false;\r
- sr.forOverview = true;\r
- fr = new FeatureRenderer(ap);\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.conservation == null)\r
- {\r
- graphHeight = 0;\r
- }\r
-\r
- if (av.alignment.getWidth() > av.alignment.getHeight())\r
- {\r
- // wider\r
- width = 400;\r
- sequencesHeight = (int) (400f / initialScale);\r
- if (sequencesHeight < 40)\r
- {\r
- sequencesHeight = 40;\r
- }\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
- 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
- if (!av.wrapAlignment)\r
- {\r
- boxX = evt.getX();\r
- boxY = evt.getY();\r
- checkValid();\r
- }\r
- }\r
- });\r
-\r
- addMouseListener(new MouseAdapter()\r
- {\r
- public void mousePressed(MouseEvent evt)\r
- {\r
- if (!av.wrapAlignment)\r
- {\r
- boxX = evt.getX();\r
- boxY = evt.getY();\r
- checkValid();\r
- }\r
- }\r
- });\r
-\r
- updateOverviewImage();\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- */\r
- void checkValid()\r
- {\r
- if (boxY < 0)\r
- {\r
- boxY = 0;\r
- }\r
-\r
- if (boxY > (sequencesHeight - boxHeight))\r
- {\r
- boxY = sequencesHeight - boxHeight + 1;\r
- }\r
-\r
- if (boxX < 0)\r
- {\r
- boxX = 0;\r
- }\r
-\r
- if (boxX > (width - boxWidth))\r
- {\r
- if (av.hasHiddenColumns)\r
- {\r
- //Try smallest possible box\r
- boxWidth = (int) ( (av.endRes - av.startRes + 1) *\r
- av.getCharWidth() * scalew);\r
- }\r
- boxX = width - boxWidth;\r
- }\r
-\r
- int col = (int) (boxX / scalew / av.getCharWidth());\r
- int row = (int) (boxY / scaleh / av.getCharHeight());\r
-\r
- if (av.hasHiddenColumns)\r
- {\r
- if (!av.getColumnSelection().isVisible(col))\r
- {\r
- return;\r
- }\r
-\r
- col = av.getColumnSelection().findColumnPosition(col);\r
- }\r
-\r
- if (av.hasHiddenRows)\r
- {\r
- row = av.alignment.getHiddenSequences().findIndexWithoutHiddenSeqs(row);\r
- }\r
-\r
- ap.setScrollValues(col, row);\r
-\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- */\r
- public void updateOverviewImage()\r
- {\r
- if (resizing)\r
- {\r
- resizeAgain = true;\r
- return;\r
- }\r
-\r
- resizing = true;\r
-\r
- if ( (getWidth() > 0) && (getHeight() > 0))\r
- {\r
- width = getWidth();\r
- sequencesHeight = getHeight() - graphHeight;\r
- }\r
-\r
- setPreferredSize(new Dimension(width, sequencesHeight + graphHeight));\r
-\r
- Thread thread = new Thread(this);\r
- thread.start();\r
- repaint();\r
- }\r
-\r
- // This is set true if the user resizes whilst\r
- // the overview is being calculated\r
- boolean resizeAgain = false;\r
-\r
- /**\r
- * DOCUMENT ME!\r
- */\r
- public void run()\r
- {\r
- miniMe = null;\r
-\r
- if (av.showSequenceFeatures)\r
- {\r
- fr.transferSettings(ap.seqPanel.seqCanvas.getFeatureRenderer());\r
- }\r
-\r
- int alwidth = av.alignment.getWidth();\r
- int alheight = av.alignment.getHeight()\r
- + av.alignment.getHiddenSequences().getSize();\r
-\r
- setPreferredSize(new Dimension(width, sequencesHeight + graphHeight));\r
-\r
- int fullsizeWidth = alwidth * av.getCharWidth();\r
- int fullsizeHeight = alheight * av.getCharHeight();\r
-\r
- scalew = (float) width / (float) fullsizeWidth;\r
- scaleh = (float) sequencesHeight / (float) fullsizeHeight;\r
-\r
- miniMe = new BufferedImage(width, sequencesHeight + graphHeight,\r
- BufferedImage.TYPE_INT_RGB);\r
-\r
- Graphics mg = miniMe.getGraphics();\r
- mg.setColor(Color.orange);\r
- mg.fillRect(0, 0, width, miniMe.getHeight());\r
-\r
- float sampleCol = (float) alwidth / (float) width;\r
- float sampleRow = (float) alheight / (float) sequencesHeight;\r
-\r
- int lastcol = -1, lastrow = -1;\r
- int color = Color.white.getRGB();\r
- int row, col;\r
- jalview.datamodel.SequenceI seq;\r
- boolean hiddenRow = false;\r
- for (row = 0; row < sequencesHeight; row++)\r
- {\r
- if ( (int) (row * sampleRow) == lastrow)\r
- {\r
- //No need to recalculate the colours,\r
- //Just copy from the row above\r
- for (col = 0; col < width; col++)\r
- {\r
- miniMe.setRGB(col, row, miniMe.getRGB(col, row - 1));\r
- }\r
- continue;\r
- }\r
-\r
- lastrow = (int) (row * sampleRow);\r
-\r
- hiddenRow = false;\r
- if (av.hasHiddenRows)\r
- {\r
- seq = av.alignment.getHiddenSequences().getHiddenSequence(lastrow);\r
- if (seq == null)\r
- {\r
- int index =\r
- av.alignment.getHiddenSequences().findIndexWithoutHiddenSeqs(\r
- lastrow);\r
-\r
- seq = av.alignment.getSequenceAt(index);\r
- }\r
- else\r
- {\r
- hiddenRow = true;\r
- }\r
- }\r
- else\r
- {\r
- seq = av.alignment.getSequenceAt(lastrow);\r
- }\r
-\r
- if (seq == null)\r
- {\r
- System.out.println(lastrow + " null");\r
- continue;\r
- }\r
-\r
- for (col = 0; col < width; col++)\r
- {\r
- if ( (int) (col * sampleCol) == lastcol &&\r
- (int) (row * sampleRow) == lastrow)\r
- {\r
- miniMe.setRGB(col, row, color);\r
- continue;\r
- }\r
-\r
- lastcol = (int) (col * sampleCol);\r
-\r
- if (seq.getLength() > lastcol)\r
- {\r
- color = sr.getResidueBoxColour(\r
- seq, lastcol).getRGB();\r
-\r
- if (av.showSequenceFeatures)\r
- {\r
- color = fr.findFeatureColour(color, seq, lastcol);\r
- }\r
- }\r
- else\r
- {\r
- color = -1; //White\r
- }\r
-\r
- if (hiddenRow ||\r
- (av.hasHiddenColumns && !av.getColumnSelection().isVisible(lastcol)))\r
- {\r
- color = new Color(color).darker().darker().getRGB();\r
- }\r
-\r
- miniMe.setRGB(col, row, color);\r
-\r
- }\r
- }\r
-\r
- if (av.conservation != null)\r
- {\r
- for (col = 0; col < width; col++)\r
- {\r
- lastcol = (int) (col * sampleCol);\r
- {\r
- mg.translate(col, sequencesHeight);\r
- ap.annotationPanel.drawGraph(mg, av.conservation,\r
- (int) (sampleCol) + 1,\r
- graphHeight,\r
- (int) (col * sampleCol),\r
- (int) (col * sampleCol) + 1);\r
- mg.translate( -col, -sequencesHeight);\r
- }\r
- }\r
- }\r
- System.gc();\r
-\r
- resizing = false;\r
-\r
- setBoxPosition();\r
-\r
- if (resizeAgain)\r
- {\r
- resizeAgain = false;\r
- updateOverviewImage();\r
- }\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- */\r
- public void setBoxPosition()\r
- {\r
- int fullsizeWidth = av.alignment.getWidth() * av.getCharWidth();\r
- int fullsizeHeight = (av.alignment.getHeight()\r
- + av.alignment.getHiddenSequences().getSize()) *\r
- av.getCharHeight();\r
-\r
- int startRes = av.getStartRes();\r
- int endRes = av.getEndRes();\r
-\r
- if (av.hasHiddenColumns)\r
- {\r
- startRes = av.getColumnSelection().adjustForHiddenColumns(startRes);\r
- endRes = av.getColumnSelection().adjustForHiddenColumns(endRes);\r
- }\r
-\r
- int startSeq = av.startSeq;\r
- int endSeq = av.endSeq;\r
-\r
- if (av.hasHiddenRows)\r
- {\r
- startSeq =\r
- av.alignment.getHiddenSequences().adjustForHiddenSeqs(startSeq);\r
-\r
- endSeq =\r
- av.alignment.getHiddenSequences().adjustForHiddenSeqs(endSeq);\r
-\r
- }\r
-\r
- scalew = (float) width / (float) fullsizeWidth;\r
- scaleh = (float) sequencesHeight / (float) fullsizeHeight;\r
-\r
- boxX = (int) (startRes * av.getCharWidth() * scalew);\r
- boxY = (int) (startSeq * av.getCharHeight() * scaleh);\r
-\r
- if (av.hasHiddenColumns)\r
- {\r
- boxWidth = (int) ( (endRes - startRes + 1) * av.getCharWidth() * scalew);\r
- }\r
- else\r
- {\r
- boxWidth = (int) ( (endRes - startRes + 1) * av.getCharWidth() * scalew);\r
- }\r
-\r
- boxHeight = (int) ( (endSeq - startSeq) * av.getCharHeight() * scaleh);\r
-\r
- repaint();\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param g DOCUMENT ME!\r
- */\r
- public void paintComponent(Graphics g)\r
- {\r
- if(resizing)\r
- {\r
- g.setColor(Color.white);\r
- g.fillRect(0,0,getWidth(),getHeight());\r
- }\r
- else 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
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.gui;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.awt.image.*;
+import javax.swing.*;
+
+/**
+ * DOCUMENT ME!
+ *
+ * @author $author$
+ * @version $Revision$
+ */
+public class OverviewPanel
+ extends JPanel implements Runnable
+{
+ BufferedImage miniMe;
+ AlignViewport av;
+ AlignmentPanel ap;
+ float scalew = 1f;
+ float scaleh = 1f;
+ int width;
+ int sequencesHeight;
+ int graphHeight = 20;
+ int boxX = -1;
+ int boxY = -1;
+ int boxWidth = -1;
+ int boxHeight = -1;
+ boolean resizing = false;
+
+ // Can set different properties in this seqCanvas than
+ // main visible SeqCanvas
+ SequenceRenderer sr;
+ FeatureRenderer fr;
+
+ /**
+ * Creates a new OverviewPanel object.
+ *
+ * @param ap DOCUMENT ME!
+ */
+ public OverviewPanel(AlignmentPanel ap)
+ {
+ this.av = ap.av;
+ this.ap = ap;
+ setLayout(null);
+
+ sr = new SequenceRenderer(av);
+ sr.renderGaps = false;
+ sr.forOverview = true;
+ fr = new FeatureRenderer(ap);
+
+ // scale the initial size of overviewpanel to shape of alignment
+ float initialScale = (float) av.alignment.getWidth() /
+ (float) av.alignment.getHeight();
+
+ if (av.conservation == null)
+ {
+ graphHeight = 0;
+ }
+
+ if (av.alignment.getWidth() > av.alignment.getHeight())
+ {
+ // wider
+ width = 400;
+ sequencesHeight = (int) (400f / initialScale);
+ if (sequencesHeight < 40)
+ {
+ sequencesHeight = 40;
+ }
+ }
+ else
+ {
+ // taller
+ width = (int) (400f * initialScale);
+ sequencesHeight = 300;
+
+ if (width < 120)
+ {
+ width = 120;
+ }
+ }
+
+ addComponentListener(new ComponentAdapter()
+ {
+ public void componentResized(ComponentEvent evt)
+ {
+ if ( (getWidth() != width) ||
+ (getHeight() != (sequencesHeight + graphHeight)))
+ {
+ updateOverviewImage();
+ }
+ }
+ });
+
+ addMouseMotionListener(new MouseMotionAdapter()
+ {
+ public void mouseDragged(MouseEvent evt)
+ {
+ if (!av.wrapAlignment)
+ {
+ boxX = evt.getX();
+ boxY = evt.getY();
+ checkValid();
+ }
+ }
+ });
+
+ addMouseListener(new MouseAdapter()
+ {
+ public void mousePressed(MouseEvent evt)
+ {
+ if (!av.wrapAlignment)
+ {
+ boxX = evt.getX();
+ boxY = evt.getY();
+ checkValid();
+ }
+ }
+ });
+
+ updateOverviewImage();
+ }
+
+ /**
+ * DOCUMENT ME!
+ */
+ void checkValid()
+ {
+ if (boxY < 0)
+ {
+ boxY = 0;
+ }
+
+ if (boxY > (sequencesHeight - boxHeight))
+ {
+ boxY = sequencesHeight - boxHeight + 1;
+ }
+
+ if (boxX < 0)
+ {
+ boxX = 0;
+ }
+
+ if (boxX > (width - boxWidth))
+ {
+ if (av.hasHiddenColumns)
+ {
+ //Try smallest possible box
+ boxWidth = (int) ( (av.endRes - av.startRes + 1) *
+ av.getCharWidth() * scalew);
+ }
+ boxX = width - boxWidth;
+ }
+
+ int col = (int) (boxX / scalew / av.getCharWidth());
+ int row = (int) (boxY / scaleh / av.getCharHeight());
+
+ if (av.hasHiddenColumns)
+ {
+ if (!av.getColumnSelection().isVisible(col))
+ {
+ return;
+ }
+
+ col = av.getColumnSelection().findColumnPosition(col);
+ }
+
+ if (av.hasHiddenRows)
+ {
+ row = av.alignment.getHiddenSequences().findIndexWithoutHiddenSeqs(row);
+ }
+
+ ap.setScrollValues(col, row);
+
+ }
+
+ /**
+ * DOCUMENT ME!
+ */
+ public void updateOverviewImage()
+ {
+ if (resizing)
+ {
+ resizeAgain = true;
+ return;
+ }
+
+ resizing = true;
+
+ if ( (getWidth() > 0) && (getHeight() > 0))
+ {
+ width = getWidth();
+ sequencesHeight = getHeight() - graphHeight;
+ }
+
+ setPreferredSize(new Dimension(width, sequencesHeight + graphHeight));
+
+ Thread thread = new Thread(this);
+ thread.start();
+ repaint();
+ }
+
+ // This is set true if the user resizes whilst
+ // the overview is being calculated
+ boolean resizeAgain = false;
+
+ /**
+ * DOCUMENT ME!
+ */
+ public void run()
+ {
+ miniMe = null;
+
+ if (av.showSequenceFeatures)
+ {
+ fr.transferSettings(ap.seqPanel.seqCanvas.getFeatureRenderer());
+ }
+
+ int alwidth = av.alignment.getWidth();
+ int alheight = av.alignment.getHeight()
+ + av.alignment.getHiddenSequences().getSize();
+
+ setPreferredSize(new Dimension(width, sequencesHeight + graphHeight));
+
+ int fullsizeWidth = alwidth * av.getCharWidth();
+ int fullsizeHeight = alheight * av.getCharHeight();
+
+ scalew = (float) width / (float) fullsizeWidth;
+ scaleh = (float) sequencesHeight / (float) fullsizeHeight;
+
+ miniMe = new BufferedImage(width, sequencesHeight + graphHeight,
+ BufferedImage.TYPE_INT_RGB);
+
+ Graphics mg = miniMe.getGraphics();
+ mg.setColor(Color.orange);
+ mg.fillRect(0, 0, width, miniMe.getHeight());
+
+ float sampleCol = (float) alwidth / (float) width;
+ float sampleRow = (float) alheight / (float) sequencesHeight;
+
+ int lastcol = -1, lastrow = -1;
+ int color = Color.white.getRGB();
+ int row, col;
+ jalview.datamodel.SequenceI seq;
+ boolean hiddenRow = false;
+ for (row = 0; row < sequencesHeight; row++)
+ {
+ if ( (int) (row * sampleRow) == lastrow)
+ {
+ //No need to recalculate the colours,
+ //Just copy from the row above
+ for (col = 0; col < width; col++)
+ {
+ miniMe.setRGB(col, row, miniMe.getRGB(col, row - 1));
+ }
+ continue;
+ }
+
+ lastrow = (int) (row * sampleRow);
+
+ hiddenRow = false;
+ if (av.hasHiddenRows)
+ {
+ seq = av.alignment.getHiddenSequences().getHiddenSequence(lastrow);
+ if (seq == null)
+ {
+ int index =
+ av.alignment.getHiddenSequences().findIndexWithoutHiddenSeqs(
+ lastrow);
+
+ seq = av.alignment.getSequenceAt(index);
+ }
+ else
+ {
+ hiddenRow = true;
+ }
+ }
+ else
+ {
+ seq = av.alignment.getSequenceAt(lastrow);
+ }
+
+ if (seq == null)
+ {
+ System.out.println(lastrow + " null");
+ continue;
+ }
+
+ for (col = 0; col < width; col++)
+ {
+ if ( (int) (col * sampleCol) == lastcol &&
+ (int) (row * sampleRow) == lastrow)
+ {
+ miniMe.setRGB(col, row, color);
+ continue;
+ }
+
+ lastcol = (int) (col * sampleCol);
+
+ if (seq.getLength() > lastcol)
+ {
+ color = sr.getResidueBoxColour(
+ seq, lastcol).getRGB();
+
+ if (av.showSequenceFeatures)
+ {
+ color = fr.findFeatureColour(color, seq, lastcol);
+ }
+ }
+ else
+ {
+ color = -1; //White
+ }
+
+ if (hiddenRow ||
+ (av.hasHiddenColumns && !av.getColumnSelection().isVisible(lastcol)))
+ {
+ color = new Color(color).darker().darker().getRGB();
+ }
+
+ miniMe.setRGB(col, row, color);
+
+ }
+ }
+
+ if (av.conservation != null)
+ {
+ for (col = 0; col < width; col++)
+ {
+ lastcol = (int) (col * sampleCol);
+ {
+ mg.translate(col, sequencesHeight);
+ ap.annotationPanel.drawGraph(mg, av.conservation,
+ (int) (sampleCol) + 1,
+ graphHeight,
+ (int) (col * sampleCol),
+ (int) (col * sampleCol) + 1);
+ mg.translate( -col, -sequencesHeight);
+ }
+ }
+ }
+ System.gc();
+
+ resizing = false;
+
+ setBoxPosition();
+
+ if (resizeAgain)
+ {
+ resizeAgain = false;
+ updateOverviewImage();
+ }
+ }
+
+ /**
+ * DOCUMENT ME!
+ */
+ public void setBoxPosition()
+ {
+ int fullsizeWidth = av.alignment.getWidth() * av.getCharWidth();
+ int fullsizeHeight = (av.alignment.getHeight()
+ + av.alignment.getHiddenSequences().getSize()) *
+ av.getCharHeight();
+
+ int startRes = av.getStartRes();
+ int endRes = av.getEndRes();
+
+ if (av.hasHiddenColumns)
+ {
+ startRes = av.getColumnSelection().adjustForHiddenColumns(startRes);
+ endRes = av.getColumnSelection().adjustForHiddenColumns(endRes);
+ }
+
+ int startSeq = av.startSeq;
+ int endSeq = av.endSeq;
+
+ if (av.hasHiddenRows)
+ {
+ startSeq =
+ av.alignment.getHiddenSequences().adjustForHiddenSeqs(startSeq);
+
+ endSeq =
+ av.alignment.getHiddenSequences().adjustForHiddenSeqs(endSeq);
+
+ }
+
+ scalew = (float) width / (float) fullsizeWidth;
+ scaleh = (float) sequencesHeight / (float) fullsizeHeight;
+
+ boxX = (int) (startRes * av.getCharWidth() * scalew);
+ boxY = (int) (startSeq * av.getCharHeight() * scaleh);
+
+ if (av.hasHiddenColumns)
+ {
+ boxWidth = (int) ( (endRes - startRes + 1) * av.getCharWidth() * scalew);
+ }
+ else
+ {
+ boxWidth = (int) ( (endRes - startRes + 1) * av.getCharWidth() * scalew);
+ }
+
+ boxHeight = (int) ( (endSeq - startSeq) * av.getCharHeight() * scaleh);
+
+ repaint();
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param g DOCUMENT ME!
+ */
+ public void paintComponent(Graphics g)
+ {
+ if(resizing)
+ {
+ g.setColor(Color.white);
+ g.fillRect(0,0,getWidth(),getHeight());
+ }
+ else if (miniMe != null)
+ {
+ g.drawImage(miniMe, 0, 0, this);
+ }
+
+ g.setColor(Color.red);
+ g.drawRect(boxX, boxY, boxWidth, boxHeight);
+ g.drawRect(boxX + 1, boxY + 1, boxWidth - 2, boxHeight - 2);
+
+ }
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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.gui;\r
-\r
-import java.util.*;\r
-\r
-import java.awt.*;\r
-\r
-import jalview.datamodel.*;\r
-\r
-/**\r
- * DOCUMENT ME!\r
- *\r
- * @author $author$\r
- * @version $Revision$\r
- */\r
-public class PaintRefresher\r
-{\r
- static Hashtable components;\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param comp DOCUMENT ME!\r
- * @param al DOCUMENT ME!\r
- */\r
- public static void Register(Component comp, String seqSetId)\r
- {\r
- if (components == null)\r
- {\r
- components = new Hashtable();\r
- }\r
-\r
- if (components.containsKey(seqSetId))\r
- {\r
- Vector comps = (Vector) components.get(seqSetId);\r
- if (!comps.contains(comp))\r
- {\r
- comps.addElement(comp);\r
- }\r
- }\r
- else\r
- {\r
- Vector vcoms = new Vector();\r
- vcoms.addElement(comp);\r
- components.put(seqSetId, vcoms);\r
- }\r
- }\r
-\r
- public static void RemoveComponent(Component comp)\r
- {\r
- if (components == null)\r
- {\r
- return;\r
- }\r
-\r
- Enumeration en = components.keys();\r
- while (en.hasMoreElements())\r
- {\r
- String id = en.nextElement().toString();\r
- Vector comps = (Vector) components.get(id);\r
- comps.remove(comp);\r
- if (comps.size() == 0)\r
- {\r
- components.remove(id);\r
- }\r
- }\r
- }\r
-\r
- public static void Refresh(Component source, String id)\r
- {\r
- Refresh(source, id, false, false);\r
- }\r
-\r
- public static void Refresh(Component source,\r
- String id,\r
- boolean alignmentChanged,\r
- boolean validateSequences)\r
- {\r
- if (components == null)\r
- {\r
- return;\r
- }\r
-\r
- Component comp;\r
- Vector comps = (Vector) components.get(id);\r
-\r
- if (comps == null)\r
- {\r
- return;\r
- }\r
-\r
- Enumeration e = comps.elements();\r
- while (e.hasMoreElements())\r
- {\r
- comp = (Component) e.nextElement();\r
-\r
- if (comp == source)\r
- {\r
- continue;\r
- }\r
-\r
- if (validateSequences\r
- && comp instanceof AlignmentPanel\r
- && source instanceof AlignmentPanel)\r
- {\r
- validateSequences( ( (AlignmentPanel) source).av.alignment,\r
- ( (AlignmentPanel) comp).av.alignment);\r
- }\r
-\r
- if (comp instanceof AlignmentPanel && alignmentChanged)\r
- {\r
- ( (AlignmentPanel) comp).alignmentChanged();\r
- }\r
-\r
- comp.repaint();\r
- }\r
- }\r
-\r
- static void validateSequences(AlignmentI source, AlignmentI comp)\r
- {\r
- SequenceI[] a1;\r
- if (source.getHiddenSequences().getSize() > 0)\r
- {\r
- a1 = source.getHiddenSequences().getFullAlignment().getSequencesArray();\r
- }\r
- else\r
- {\r
- a1 = source.getSequencesArray();\r
- }\r
-\r
- SequenceI[] a2;\r
- if (comp.getHiddenSequences().getSize() > 0)\r
- {\r
- a2 = comp.getHiddenSequences().getFullAlignment().getSequencesArray();\r
- }\r
- else\r
- {\r
- a2 = comp.getSequencesArray();\r
- }\r
-\r
- int i, iSize = a1.length, j, jSize = a2.length;\r
-\r
- if (iSize == jSize)\r
- {\r
- return;\r
- }\r
-\r
- boolean exists = false;\r
- for (i = 0; i < iSize; i++)\r
- {\r
- exists = false;\r
-\r
- for (j = 0; j < jSize; j++)\r
- {\r
- if (a2[j] == a1[i])\r
- {\r
- exists = true;\r
- break;\r
- }\r
- }\r
-\r
- if (!exists)\r
- {\r
- if (i < comp.getHeight())\r
- {\r
- comp.getSequences().insertElementAt(a1[i], i);\r
- }\r
- else\r
- {\r
- comp.addSequence(a1[i]);\r
- }\r
-\r
- if (comp.getHiddenSequences().getSize() > 0)\r
- {\r
- a2 = comp.getHiddenSequences().getFullAlignment().getSequencesArray();\r
- }\r
- else\r
- {\r
- a2 = comp.getSequencesArray();\r
- }\r
-\r
- jSize = a2.length;\r
- }\r
- }\r
-\r
- iSize = a1.length;\r
- jSize = a2.length;\r
-\r
- for (j = 0; j < jSize; j++)\r
- {\r
- exists = false;\r
- for (i = 0; i < iSize; i++)\r
- {\r
- if (a2[j] == a1[i])\r
- {\r
- exists = true;\r
- break;\r
- }\r
- }\r
-\r
- if (!exists)\r
- {\r
- comp.deleteSequence(a2[j]);\r
- }\r
- }\r
- }\r
-\r
- static AlignmentPanel[] getAssociatedPanels(String id)\r
- {\r
- Vector comps = (Vector) components.get(id);\r
- Vector tmp = new Vector();\r
- int i, iSize = comps.size();\r
- for (i = 0; i < iSize; i++)\r
- {\r
- if (comps.elementAt(i) instanceof AlignmentPanel)\r
- {\r
- tmp.addElement( ( (AlignmentPanel) comps.elementAt(i)));\r
- }\r
- }\r
- AlignmentPanel[] result = new AlignmentPanel[tmp.size()];\r
- tmp.toArray(result);\r
-\r
- return result;\r
- }\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.gui;
+
+import java.util.*;
+
+import java.awt.*;
+
+import jalview.datamodel.*;
+
+/**
+ * DOCUMENT ME!
+ *
+ * @author $author$
+ * @version $Revision$
+ */
+public class PaintRefresher
+{
+ static Hashtable components;
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param comp DOCUMENT ME!
+ * @param al DOCUMENT ME!
+ */
+ public static void Register(Component comp, String seqSetId)
+ {
+ if (components == null)
+ {
+ components = new Hashtable();
+ }
+
+ if (components.containsKey(seqSetId))
+ {
+ Vector comps = (Vector) components.get(seqSetId);
+ if (!comps.contains(comp))
+ {
+ comps.addElement(comp);
+ }
+ }
+ else
+ {
+ Vector vcoms = new Vector();
+ vcoms.addElement(comp);
+ components.put(seqSetId, vcoms);
+ }
+ }
+
+ public static void RemoveComponent(Component comp)
+ {
+ if (components == null)
+ {
+ return;
+ }
+
+ Enumeration en = components.keys();
+ while (en.hasMoreElements())
+ {
+ String id = en.nextElement().toString();
+ Vector comps = (Vector) components.get(id);
+ comps.remove(comp);
+ if (comps.size() == 0)
+ {
+ components.remove(id);
+ }
+ }
+ }
+
+ public static void Refresh(Component source, String id)
+ {
+ Refresh(source, id, false, false);
+ }
+
+ public static void Refresh(Component source,
+ String id,
+ boolean alignmentChanged,
+ boolean validateSequences)
+ {
+ if (components == null)
+ {
+ return;
+ }
+
+ Component comp;
+ Vector comps = (Vector) components.get(id);
+
+ if (comps == null)
+ {
+ return;
+ }
+
+ Enumeration e = comps.elements();
+ while (e.hasMoreElements())
+ {
+ comp = (Component) e.nextElement();
+
+ if (comp == source)
+ {
+ continue;
+ }
+
+ if (validateSequences
+ && comp instanceof AlignmentPanel
+ && source instanceof AlignmentPanel)
+ {
+ validateSequences( ( (AlignmentPanel) source).av.alignment,
+ ( (AlignmentPanel) comp).av.alignment);
+ }
+
+ if (comp instanceof AlignmentPanel && alignmentChanged)
+ {
+ ( (AlignmentPanel) comp).alignmentChanged();
+ }
+
+ comp.repaint();
+ }
+ }
+
+ static void validateSequences(AlignmentI source, AlignmentI comp)
+ {
+ SequenceI[] a1;
+ if (source.getHiddenSequences().getSize() > 0)
+ {
+ a1 = source.getHiddenSequences().getFullAlignment().getSequencesArray();
+ }
+ else
+ {
+ a1 = source.getSequencesArray();
+ }
+
+ SequenceI[] a2;
+ if (comp.getHiddenSequences().getSize() > 0)
+ {
+ a2 = comp.getHiddenSequences().getFullAlignment().getSequencesArray();
+ }
+ else
+ {
+ a2 = comp.getSequencesArray();
+ }
+
+ int i, iSize = a1.length, j, jSize = a2.length;
+
+ if (iSize == jSize)
+ {
+ return;
+ }
+
+ boolean exists = false;
+ for (i = 0; i < iSize; i++)
+ {
+ exists = false;
+
+ for (j = 0; j < jSize; j++)
+ {
+ if (a2[j] == a1[i])
+ {
+ exists = true;
+ break;
+ }
+ }
+
+ if (!exists)
+ {
+ if (i < comp.getHeight())
+ {
+ comp.getSequences().insertElementAt(a1[i], i);
+ }
+ else
+ {
+ comp.addSequence(a1[i]);
+ }
+
+ if (comp.getHiddenSequences().getSize() > 0)
+ {
+ a2 = comp.getHiddenSequences().getFullAlignment().getSequencesArray();
+ }
+ else
+ {
+ a2 = comp.getSequencesArray();
+ }
+
+ jSize = a2.length;
+ }
+ }
+
+ iSize = a1.length;
+ jSize = a2.length;
+
+ for (j = 0; j < jSize; j++)
+ {
+ exists = false;
+ for (i = 0; i < iSize; i++)
+ {
+ if (a2[j] == a1[i])
+ {
+ exists = true;
+ break;
+ }
+ }
+
+ if (!exists)
+ {
+ comp.deleteSequence(a2[j]);
+ }
+ }
+ }
+
+ static AlignmentPanel[] getAssociatedPanels(String id)
+ {
+ Vector comps = (Vector) components.get(id);
+ Vector tmp = new Vector();
+ int i, iSize = comps.size();
+ for (i = 0; i < iSize; i++)
+ {
+ if (comps.elementAt(i) instanceof AlignmentPanel)
+ {
+ tmp.addElement( ( (AlignmentPanel) comps.elementAt(i)));
+ }
+ }
+ AlignmentPanel[] result = new AlignmentPanel[tmp.size()];
+ tmp.toArray(result);
+
+ return result;
+ }
+
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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.gui;\r
-\r
-import java.util.*;\r
-\r
-import java.awt.*;\r
-import java.awt.event.*;\r
-import javax.swing.*;\r
-\r
-import jalview.datamodel.*;\r
-import jalview.math.*;\r
-\r
-/**\r
- * DOCUMENT ME!\r
- *\r
- * @author $author$\r
- * @version $Revision$\r
- */\r
-public class RotatableCanvas\r
- extends JPanel implements MouseListener,\r
- MouseMotionListener, KeyListener\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
- AlignmentPanel ap;\r
- boolean showLabels = false;\r
- Color bgColour = Color.black;\r
- boolean applyToAllViews = false;\r
-\r
- // Controller controller;\r
- public RotatableCanvas(AlignmentPanel ap)\r
- {\r
- this.av = ap.av;\r
- this.ap = ap;\r
-\r
- addMouseWheelListener(new MouseWheelListener()\r
- {\r
- public void mouseWheelMoved(MouseWheelEvent e)\r
- {\r
- if (e.getWheelRotation() > 0)\r
- {\r
- scale = (float) (scale * 1.1);\r
- repaint();\r
- }\r
-\r
- else\r
- {\r
- scale = (float) (scale * 0.9);\r
- repaint();\r
- }\r
- }\r
- });\r
-\r
- }\r
-\r
- public void showLabels(boolean b)\r
- {\r
- showLabels = b;\r
- repaint();\r
- }\r
-\r
- public void setPoints(Vector points, int npoint)\r
- {\r
- this.points = points;\r
- this.npoint = npoint;\r
- ToolTipManager.sharedInstance().registerComponent(this);\r
- ToolTipManager.sharedInstance().setInitialDelay(0);\r
- ToolTipManager.sharedInstance().setDismissDelay(10000);\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
- {\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
- axes = new float[3][3];\r
- initAxes();\r
-\r
- findCentre();\r
- findWidth();\r
-\r
- scale = findScale();\r
-\r
- addMouseListener(this);\r
-\r
- addMouseMotionListener(this);\r
-\r
- }\r
-\r
- public void initAxes()\r
- {\r
- for (int i = 0; i < 3; i++)\r
- {\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
- * 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
-\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
-\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
- maxwidth = width[0];\r
-\r
- if (width[1] > width[0])\r
- {\r
- maxwidth = width[1];\r
- }\r
-\r
- if (width[2] > width[1])\r
- {\r
- maxwidth = width[2];\r
- }\r
-\r
- //System.out.println("Maxwidth = " + maxwidth);\r
- }\r
-\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
- 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 < height)\r
- {\r
- dim = width;\r
- }\r
- else\r
- {\r
- dim = height;\r
- }\r
-\r
- return (float) ( (dim * scalefactor) / (2 * maxwidth));\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- */\r
- public void findCentre()\r
- {\r
- //Find centre coordinate\r
- findWidth();\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
-\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
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @return DOCUMENT ME!\r
- */\r
- public Dimension getPreferredSize()\r
- {\r
- if (prefsize != null)\r
- {\r
- return prefsize;\r
- }\r
- else\r
- {\r
- return new Dimension(400, 400);\r
- }\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @return DOCUMENT ME!\r
- */\r
- public Dimension getMinimumSize()\r
- {\r
- return getPreferredSize();\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param g DOCUMENT ME!\r
- */\r
- public void paintComponent(Graphics g1)\r
- {\r
-\r
- Graphics2D g = (Graphics2D) g1;\r
-\r
- g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,\r
- RenderingHints.VALUE_ANTIALIAS_ON);\r
- if (points == null)\r
- {\r
- g.setFont(new Font("Verdana", Font.PLAIN, 18));\r
- g.drawString("Calculating PCA....", 20, getHeight() / 2);\r
- }\r
- else\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
- scale = findScale();\r
-\r
- // System.out.println("New scale = " + scale);\r
- img = createImage(getWidth(), getHeight());\r
- ig = img.getGraphics();\r
- }\r
-\r
- drawBackground(ig, bgColour);\r
- drawScene(ig);\r
-\r
- if (drawAxes == true)\r
- {\r
- drawAxes(ig);\r
- }\r
-\r
- g.drawImage(img, 0, 0, this);\r
- }\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param g DOCUMENT ME!\r
- */\r
- public void drawAxes(Graphics g)\r
- {\r
-\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
-\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
- g.setColor(col);\r
- g.fillRect(0, 0, prefsize.width, prefsize.height);\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param g DOCUMENT ME!\r
- */\r
- public void drawScene(Graphics g1)\r
- {\r
-\r
- Graphics2D g = (Graphics2D) g1;\r
-\r
- g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,\r
- RenderingHints.VALUE_ANTIALIAS_ON);\r
-\r
- int halfwidth = getWidth() / 2;\r
- int halfheight = getHeight() / 2;\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 (av.getSequenceColour(sp.sequence) == Color.black)\r
- {\r
- g.setColor(Color.white);\r
- }\r
- else\r
- {\r
- g.setColor(av.getSequenceColour(sp.sequence));\r
- }\r
-\r
- if (av.getSelectionGroup() != null)\r
- {\r
- if (av.getSelectionGroup().getSequences(null).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
- if (showLabels)\r
- {\r
- g.setColor(Color.red);\r
- g.drawString( ( (SequencePoint) points.elementAt(i)).sequence.\r
- getName(),\r
- x - 3, y - 4);\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
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @return DOCUMENT ME!\r
- */\r
- public Dimension minimumsize()\r
- {\r
- return prefsize;\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @return DOCUMENT ME!\r
- */\r
- public Dimension preferredsize()\r
- {\r
- return prefsize;\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param evt DOCUMENT ME!\r
- */\r
- public void keyTyped(KeyEvent evt)\r
- {\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param evt DOCUMENT ME!\r
- */\r
- public void keyReleased(KeyEvent evt)\r
- {\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param evt DOCUMENT ME!\r
- */\r
- public void keyPressed(KeyEvent evt)\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
- if ( (rectx2 != -1) && (recty2 != -1))\r
- {\r
- rectSelect(rectx1, recty1, rectx2, recty2);\r
- }\r
- }\r
-\r
- repaint();\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param evt DOCUMENT ME!\r
- */\r
- public void mouseClicked(MouseEvent evt)\r
- {\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param evt DOCUMENT ME!\r
- */\r
- public void mouseEntered(MouseEvent evt)\r
- {\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param evt DOCUMENT ME!\r
- */\r
- public void mouseExited(MouseEvent evt)\r
- {\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param evt DOCUMENT ME!\r
- */\r
- public void mouseReleased(MouseEvent evt)\r
- {\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
- mx = x;\r
- my = y;\r
-\r
- omx = mx;\r
- omy = my;\r
-\r
- startx = x;\r
- starty = y;\r
-\r
- rectx1 = x;\r
- recty1 = y;\r
-\r
- rectx2 = -1;\r
- recty2 = -1;\r
-\r
- SequenceI found = findPoint(x, y);\r
-\r
- if (found != null)\r
- {\r
- AlignmentPanel[] aps = getAssociatedPanels();\r
-\r
- for (int a = 0; a < aps.length; a++)\r
- {\r
- if (aps[a].av.getSelectionGroup() != null)\r
- {\r
- aps[a].av.getSelectionGroup().addOrRemove(found, true);\r
- }\r
- else\r
- {\r
- aps[a].av.setSelectionGroup(new SequenceGroup());\r
- aps[a].av.getSelectionGroup().addOrRemove(found, true);\r
- aps[a].av.getSelectionGroup().setEndRes(\r
- aps[a].av.alignment.getWidth() - 1);\r
- }\r
- }\r
-\r
- PaintRefresher.Refresh(this, av.getSequenceSetId());\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
- {\r
- this.setToolTipText(null);\r
- }\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param evt DOCUMENT ME!\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
- }\r
- else\r
- {\r
- rotmat.setIdentity();\r
-\r
- rotmat.rotate( (float) (my - omy), 'x');\r
- rotmat.rotate( (float) (mx - omx), 'y');\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
-\r
- //Now apply the rotation matrix\r
- sp.coord = rotmat.vectorMultiply(sp.coord);\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
- for (int i = 0; i < 3; i++)\r
- {\r
- axes[i] = rotmat.vectorMultiply(axes[i]);\r
- }\r
-\r
- omx = mx;\r
- omy = my;\r
-\r
- paint(this.getGraphics());\r
- }\r
- }\r
-\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
- for (int i = 0; i < npoint; i++)\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().getSequences(null).contains(sp.sequence))\r
- {\r
- av.getSelectionGroup().addSequence(sp.sequence, true);\r
- }\r
- }\r
- }\r
- }\r
-\r
- // if (changedSel) {\r
- // fireSequenceSelectionEvent(av.getSelection());\r
- // }\r
- }\r
-\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
-\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
- }\r
- }\r
-\r
- AlignmentPanel[] getAssociatedPanels()\r
- {\r
- if (applyToAllViews)\r
- {\r
- return PaintRefresher.getAssociatedPanels(av.getSequenceSetId());\r
- }\r
- else\r
- {\r
- return new AlignmentPanel[]\r
- {\r
- ap};\r
- }\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.gui;
+
+import java.util.*;
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+
+import jalview.datamodel.*;
+import jalview.math.*;
+
+/**
+ * DOCUMENT ME!
+ *
+ * @author $author$
+ * @version $Revision$
+ */
+public class RotatableCanvas
+ extends JPanel implements MouseListener,
+ MouseMotionListener, KeyListener
+{
+ RotatableMatrix idmat = new RotatableMatrix(3, 3);
+ RotatableMatrix objmat = new RotatableMatrix(3, 3);
+ RotatableMatrix rotmat = new RotatableMatrix(3, 3);
+
+ //RubberbandRectangle rubberband;
+ boolean drawAxes = true;
+ int omx = 0;
+ int mx = 0;
+ int omy = 0;
+ int my = 0;
+ Image img;
+ Graphics ig;
+ Dimension prefsize;
+ float[] centre = new float[3];
+ float[] width = new float[3];
+ float[] max = new float[3];
+ float[] min = new float[3];
+ float maxwidth;
+ float scale;
+ int npoint;
+ Vector points;
+ float[][] orig;
+ float[][] axes;
+ int startx;
+ int starty;
+ int lastx;
+ int lasty;
+ int rectx1;
+ int recty1;
+ int rectx2;
+ int recty2;
+ float scalefactor = 1;
+ AlignViewport av;
+ AlignmentPanel ap;
+ boolean showLabels = false;
+ Color bgColour = Color.black;
+ boolean applyToAllViews = false;
+
+ // Controller controller;
+ public RotatableCanvas(AlignmentPanel ap)
+ {
+ this.av = ap.av;
+ this.ap = ap;
+
+ addMouseWheelListener(new MouseWheelListener()
+ {
+ public void mouseWheelMoved(MouseWheelEvent e)
+ {
+ if (e.getWheelRotation() > 0)
+ {
+ scale = (float) (scale * 1.1);
+ repaint();
+ }
+
+ else
+ {
+ scale = (float) (scale * 0.9);
+ repaint();
+ }
+ }
+ });
+
+ }
+
+ public void showLabels(boolean b)
+ {
+ showLabels = b;
+ repaint();
+ }
+
+ public void setPoints(Vector points, int npoint)
+ {
+ this.points = points;
+ this.npoint = npoint;
+ ToolTipManager.sharedInstance().registerComponent(this);
+ ToolTipManager.sharedInstance().setInitialDelay(0);
+ ToolTipManager.sharedInstance().setDismissDelay(10000);
+
+ prefsize = getPreferredSize();
+ orig = new float[npoint][3];
+
+ for (int i = 0; i < npoint; i++)
+ {
+ SequencePoint sp = (SequencePoint) points.elementAt(i);
+
+ for (int j = 0; j < 3; j++)
+ {
+ orig[i][j] = sp.coord[j];
+ }
+ }
+
+ //Initialize the matrices to identity
+ for (int i = 0; i < 3; i++)
+ {
+ for (int j = 0; j < 3; j++)
+ {
+ if (i != j)
+ {
+ idmat.addElement(i, j, 0);
+ objmat.addElement(i, j, 0);
+ rotmat.addElement(i, j, 0);
+ }
+ else
+ {
+ idmat.addElement(i, j, 0);
+ objmat.addElement(i, j, 0);
+ rotmat.addElement(i, j, 0);
+ }
+ }
+ }
+
+ axes = new float[3][3];
+ initAxes();
+
+ findCentre();
+ findWidth();
+
+ scale = findScale();
+
+ addMouseListener(this);
+
+ addMouseMotionListener(this);
+
+ }
+
+ public void initAxes()
+ {
+ for (int i = 0; i < 3; i++)
+ {
+ for (int j = 0; j < 3; j++)
+ {
+ if (i != j)
+ {
+ axes[i][j] = 0;
+ }
+ else
+ {
+ axes[i][j] = 1;
+ }
+ }
+ }
+ }
+
+ /**
+ * DOCUMENT ME!
+ */
+ public void findWidth()
+ {
+ max = new float[3];
+ min = new float[3];
+
+ max[0] = (float) - 1e30;
+ max[1] = (float) - 1e30;
+ max[2] = (float) - 1e30;
+
+ min[0] = (float) 1e30;
+ min[1] = (float) 1e30;
+ min[2] = (float) 1e30;
+
+ for (int i = 0; i < 3; i++)
+ {
+ for (int j = 0; j < npoint; j++)
+ {
+ SequencePoint sp = (SequencePoint) points.elementAt(j);
+
+ if (sp.coord[i] >= max[i])
+ {
+ max[i] = sp.coord[i];
+ }
+
+ if (sp.coord[i] <= min[i])
+ {
+ min[i] = sp.coord[i];
+ }
+ }
+ }
+
+ // System.out.println("xmax " + max[0] + " min " + min[0]);
+ //System.out.println("ymax " + max[1] + " min " + min[1]);
+ //System.out.println("zmax " + max[2] + " min " + min[2]);
+ width[0] = Math.abs(max[0] - min[0]);
+ width[1] = Math.abs(max[1] - min[1]);
+ width[2] = Math.abs(max[2] - min[2]);
+
+ maxwidth = width[0];
+
+ if (width[1] > width[0])
+ {
+ maxwidth = width[1];
+ }
+
+ if (width[2] > width[1])
+ {
+ maxwidth = width[2];
+ }
+
+ //System.out.println("Maxwidth = " + maxwidth);
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public float findScale()
+ {
+ int dim;
+ int width;
+ int height;
+
+ if (getWidth() != 0)
+ {
+ width = getWidth();
+ height = getHeight();
+ }
+ else
+ {
+ width = prefsize.width;
+ height = prefsize.height;
+ }
+
+ if (width < height)
+ {
+ dim = width;
+ }
+ else
+ {
+ dim = height;
+ }
+
+ return (float) ( (dim * scalefactor) / (2 * maxwidth));
+ }
+
+ /**
+ * DOCUMENT ME!
+ */
+ public void findCentre()
+ {
+ //Find centre coordinate
+ findWidth();
+
+ centre[0] = (max[0] + min[0]) / 2;
+ centre[1] = (max[1] + min[1]) / 2;
+ centre[2] = (max[2] + min[2]) / 2;
+
+ // System.out.println("Centre x " + centre[0]);
+ //System.out.println("Centre y " + centre[1]);
+ //System.out.println("Centre z " + centre[2]);
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public Dimension getPreferredSize()
+ {
+ if (prefsize != null)
+ {
+ return prefsize;
+ }
+ else
+ {
+ return new Dimension(400, 400);
+ }
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public Dimension getMinimumSize()
+ {
+ return getPreferredSize();
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param g DOCUMENT ME!
+ */
+ public void paintComponent(Graphics g1)
+ {
+
+ Graphics2D g = (Graphics2D) g1;
+
+ g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+ RenderingHints.VALUE_ANTIALIAS_ON);
+ if (points == null)
+ {
+ g.setFont(new Font("Verdana", Font.PLAIN, 18));
+ g.drawString("Calculating PCA....", 20, getHeight() / 2);
+ }
+ else
+ {
+ //Only create the image at the beginning -
+ if ( (img == null) || (prefsize.width != getWidth()) ||
+ (prefsize.height != getHeight()))
+ {
+ prefsize.width = getWidth();
+ prefsize.height = getHeight();
+
+ scale = findScale();
+
+ // System.out.println("New scale = " + scale);
+ img = createImage(getWidth(), getHeight());
+ ig = img.getGraphics();
+ }
+
+ drawBackground(ig, bgColour);
+ drawScene(ig);
+
+ if (drawAxes == true)
+ {
+ drawAxes(ig);
+ }
+
+ g.drawImage(img, 0, 0, this);
+ }
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param g DOCUMENT ME!
+ */
+ public void drawAxes(Graphics g)
+ {
+
+ g.setColor(Color.yellow);
+
+ for (int i = 0; i < 3; i++)
+ {
+ g.drawLine(getWidth() / 2, getHeight() / 2,
+ (int) ( (axes[i][0] * scale * max[0]) + (getWidth() / 2)),
+ (int) ( (axes[i][1] * scale * max[1]) + (getHeight() / 2)));
+ }
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param g DOCUMENT ME!
+ * @param col DOCUMENT ME!
+ */
+ public void drawBackground(Graphics g, Color col)
+ {
+ g.setColor(col);
+ g.fillRect(0, 0, prefsize.width, prefsize.height);
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param g DOCUMENT ME!
+ */
+ public void drawScene(Graphics g1)
+ {
+
+ Graphics2D g = (Graphics2D) g1;
+
+ g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+ RenderingHints.VALUE_ANTIALIAS_ON);
+
+ int halfwidth = getWidth() / 2;
+ int halfheight = getHeight() / 2;
+
+ for (int i = 0; i < npoint; i++)
+ {
+ SequencePoint sp = (SequencePoint) points.elementAt(i);
+ int x = (int) ( (float) (sp.coord[0] - centre[0]) * scale) +
+ halfwidth;
+ int y = (int) ( (float) (sp.coord[1] - centre[1]) * scale) +
+ halfheight;
+ float z = sp.coord[1] - centre[2];
+
+ if (av.getSequenceColour(sp.sequence) == Color.black)
+ {
+ g.setColor(Color.white);
+ }
+ else
+ {
+ g.setColor(av.getSequenceColour(sp.sequence));
+ }
+
+ if (av.getSelectionGroup() != null)
+ {
+ if (av.getSelectionGroup().getSequences(null).contains(
+ ( (SequencePoint) points.elementAt(i)).sequence))
+ {
+ g.setColor(Color.gray);
+ }
+ }
+
+ if (z < 0)
+ {
+ g.setColor(g.getColor().darker());
+ }
+
+ g.fillRect(x - 3, y - 3, 6, 6);
+ if (showLabels)
+ {
+ g.setColor(Color.red);
+ g.drawString( ( (SequencePoint) points.elementAt(i)).sequence.
+ getName(),
+ x - 3, y - 4);
+ }
+ }
+
+ // //Now the rectangle
+ // if (rectx2 != -1 && recty2 != -1) {
+ // g.setColor(Color.white);
+ //
+ // g.drawRect(rectx1,recty1,rectx2-rectx1,recty2-recty1);
+ // }
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public Dimension minimumsize()
+ {
+ return prefsize;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public Dimension preferredsize()
+ {
+ return prefsize;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param evt DOCUMENT ME!
+ */
+ public void keyTyped(KeyEvent evt)
+ {
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param evt DOCUMENT ME!
+ */
+ public void keyReleased(KeyEvent evt)
+ {
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param evt DOCUMENT ME!
+ */
+ public void keyPressed(KeyEvent evt)
+ {
+ if (evt.getKeyCode() == KeyEvent.VK_UP)
+ {
+ scalefactor = (float) (scalefactor * 1.1);
+ scale = findScale();
+ }
+ else if (evt.getKeyCode() == KeyEvent.VK_DOWN)
+ {
+ scalefactor = (float) (scalefactor * 0.9);
+ scale = findScale();
+ }
+ else if (evt.getKeyChar() == 's')
+ {
+ System.err.println("DEBUG: Rectangle selection"); // log.debug
+
+ if ( (rectx2 != -1) && (recty2 != -1))
+ {
+ rectSelect(rectx1, recty1, rectx2, recty2);
+ }
+ }
+
+ repaint();
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param evt DOCUMENT ME!
+ */
+ public void mouseClicked(MouseEvent evt)
+ {
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param evt DOCUMENT ME!
+ */
+ public void mouseEntered(MouseEvent evt)
+ {
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param evt DOCUMENT ME!
+ */
+ public void mouseExited(MouseEvent evt)
+ {
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param evt DOCUMENT ME!
+ */
+ public void mouseReleased(MouseEvent evt)
+ {
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param evt DOCUMENT ME!
+ */
+ public void mousePressed(MouseEvent evt)
+ {
+ int x = evt.getX();
+ int y = evt.getY();
+
+ mx = x;
+ my = y;
+
+ omx = mx;
+ omy = my;
+
+ startx = x;
+ starty = y;
+
+ rectx1 = x;
+ recty1 = y;
+
+ rectx2 = -1;
+ recty2 = -1;
+
+ SequenceI found = findPoint(x, y);
+
+ if (found != null)
+ {
+ AlignmentPanel[] aps = getAssociatedPanels();
+
+ for (int a = 0; a < aps.length; a++)
+ {
+ if (aps[a].av.getSelectionGroup() != null)
+ {
+ aps[a].av.getSelectionGroup().addOrRemove(found, true);
+ }
+ else
+ {
+ aps[a].av.setSelectionGroup(new SequenceGroup());
+ aps[a].av.getSelectionGroup().addOrRemove(found, true);
+ aps[a].av.getSelectionGroup().setEndRes(
+ aps[a].av.alignment.getWidth() - 1);
+ }
+ }
+
+ PaintRefresher.Refresh(this, av.getSequenceSetId());
+ }
+
+ repaint();
+ }
+
+ // private void fireSequenceSelectionEvent(Selection sel) {
+ // controller.handleSequenceSelectionEvent(new SequenceSelectionEvent(this,sel));
+ //}
+ public void mouseMoved(MouseEvent evt)
+ {
+ SequenceI found = findPoint(evt.getX(), evt.getY());
+
+ if (found != null)
+ {
+ this.setToolTipText(found.getName());
+ }
+ else
+ {
+ this.setToolTipText(null);
+ }
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param evt DOCUMENT ME!
+ */
+ public void mouseDragged(MouseEvent evt)
+ {
+ mx = evt.getX();
+ my = evt.getY();
+
+ //Check if this is a rectangle drawing drag
+ if ( (evt.getModifiers() & InputEvent.BUTTON2_MASK) != 0)
+ {
+ // rectx2 = evt.getX();
+ // recty2 = evt.getY();
+ }
+ else
+ {
+ rotmat.setIdentity();
+
+ rotmat.rotate( (float) (my - omy), 'x');
+ rotmat.rotate( (float) (mx - omx), 'y');
+
+ for (int i = 0; i < npoint; i++)
+ {
+ SequencePoint sp = (SequencePoint) points.elementAt(i);
+ sp.coord[0] -= centre[0];
+ sp.coord[1] -= centre[1];
+ sp.coord[2] -= centre[2];
+
+ //Now apply the rotation matrix
+ sp.coord = rotmat.vectorMultiply(sp.coord);
+
+ //Now translate back again
+ sp.coord[0] += centre[0];
+ sp.coord[1] += centre[1];
+ sp.coord[2] += centre[2];
+ }
+
+ for (int i = 0; i < 3; i++)
+ {
+ axes[i] = rotmat.vectorMultiply(axes[i]);
+ }
+
+ omx = mx;
+ omy = my;
+
+ paint(this.getGraphics());
+ }
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param x1 DOCUMENT ME!
+ * @param y1 DOCUMENT ME!
+ * @param x2 DOCUMENT ME!
+ * @param y2 DOCUMENT ME!
+ */
+ public void rectSelect(int x1, int y1, int x2, int y2)
+ {
+ for (int i = 0; i < npoint; i++)
+ {
+ SequencePoint sp = (SequencePoint) points.elementAt(i);
+ int tmp1 = (int) ( ( (sp.coord[0] - centre[0]) * scale) +
+ ( (float) getWidth() / 2.0));
+ int tmp2 = (int) ( ( (sp.coord[1] - centre[1]) * scale) +
+ ( (float) getHeight() / 2.0));
+
+ if ( (tmp1 > x1) && (tmp1 < x2) && (tmp2 > y1) && (tmp2 < y2))
+ {
+ if (av != null)
+ {
+ if (!av.getSelectionGroup().getSequences(null).contains(sp.sequence))
+ {
+ av.getSelectionGroup().addSequence(sp.sequence, true);
+ }
+ }
+ }
+ }
+
+ // if (changedSel) {
+ // fireSequenceSelectionEvent(av.getSelection());
+ // }
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param x DOCUMENT ME!
+ * @param y DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public SequenceI findPoint(int x, int y)
+ {
+ int halfwidth = getWidth() / 2;
+ int halfheight = getHeight() / 2;
+
+ int found = -1;
+
+ for (int i = 0; i < npoint; i++)
+ {
+ SequencePoint sp = (SequencePoint) points.elementAt(i);
+ int px = (int) ( (float) (sp.coord[0] - centre[0]) * scale) +
+ halfwidth;
+ int py = (int) ( (float) (sp.coord[1] - centre[1]) * scale) +
+ halfheight;
+
+ if ( (Math.abs(px - x) < 3) && (Math.abs(py - y) < 3))
+ {
+ found = i;
+ }
+ }
+
+ if (found != -1)
+ {
+ return ( (SequencePoint) points.elementAt(found)).sequence;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ AlignmentPanel[] getAssociatedPanels()
+ {
+ if (applyToAllViews)
+ {
+ return PaintRefresher.getAssociatedPanels(av.getSequenceSetId());
+ }
+ else
+ {
+ return new AlignmentPanel[]
+ {
+ ap};
+ }
+ }
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
-/* $RCSfile$\r
- * $Author$\r
- * $Date$\r
- * $Revision$\r
- *\r
- * Copyright (C) 2002-2005 The Jmol Development Team\r
- *\r
- * Contact: jmol-developers@lists.sf.net\r
- *\r
- * This library is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU Lesser General Public\r
- * License as published by the Free Software Foundation; either\r
- * version 2.1 of the License, or (at your option) any later version.\r
- *\r
- * This library 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 GNU\r
- * Lesser General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU Lesser General Public\r
- * License along with this library; if not, write to the Free Software\r
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.\r
-\r
- *\r
- * Modified and added to Jalview by A Waterhouse to extend JInternalFrame\r
- *\r
-\r
- */\r
-package jalview.gui;\r
-\r
-import org.jmol.api.*;\r
-\r
-import java.awt.*;\r
-import java.awt.event.*;\r
-import javax.swing.*;\r
-import javax.swing.text.*;\r
-import java.util.Vector;\r
-\r
-import org.jmol.i18n.GT;\r
-import org.jmol.util.Logger;\r
-import org.jmol.util.CommandHistory;\r
-\r
-public final class ScriptWindow extends JPanel\r
- implements ActionListener, EnterListener{\r
-\r
- private ConsoleTextPane console;\r
- private JButton closeButton;\r
- private JButton runButton;\r
- private JButton haltButton;\r
- private JButton clearButton;\r
- private JButton historyButton;\r
- private JButton stateButton;\r
- JmolViewer viewer;\r
- AppJmol appJmol;\r
-\r
- public ScriptWindow(AppJmol appJmol)\r
- {\r
- this.viewer = appJmol.viewer;\r
- this.appJmol = appJmol;\r
-\r
-\r
- setLayout(new BorderLayout());\r
-\r
- console = new ConsoleTextPane(this);\r
-\r
-\r
- console.setPrompt();\r
- add(new JScrollPane(console)\r
- , BorderLayout.CENTER);\r
-\r
- JPanel buttonPanel = new JPanel();\r
- add(buttonPanel, BorderLayout.SOUTH);\r
-\r
- runButton = new JButton(GT._("Run"));\r
- haltButton = new JButton(GT._("Halt"));\r
- runButton.addActionListener(this);\r
- // buttonPanel.add(runButton);\r
- haltButton.addActionListener(this);\r
- // buttonPanel.add(haltButton);\r
- haltButton.setEnabled(false);\r
-\r
- clearButton = new JButton(GT._("Clear"));\r
- clearButton.addActionListener(this);\r
- buttonPanel.add(clearButton);\r
-\r
- historyButton = new JButton(GT._("History"));\r
- historyButton.addActionListener(this);\r
- buttonPanel.add(historyButton);\r
-\r
- stateButton = new JButton(GT._("State"));\r
- stateButton.addActionListener(this);\r
- buttonPanel.add(stateButton);\r
-\r
- closeButton = new JButton(GT._("Close"));\r
- closeButton.addActionListener(this);\r
- buttonPanel.add(closeButton);\r
-\r
- for(int i=0; i<buttonPanel.getComponentCount(); i++)\r
- {\r
- // ((JButton)buttonPanel.getComponent(i))\r
- // .setMargin(new Insets(0, 0, 0, 0));\r
- }\r
-\r
- }\r
-\r
- public void sendConsoleEcho(String strEcho) {\r
- if (strEcho != null && !isError) {\r
-\r
- console.outputEcho(strEcho);\r
-\r
- }\r
- setError(false);\r
- }\r
-\r
- boolean isError = false;\r
- void setError(boolean TF) {\r
- isError = TF;\r
- //if (isError)\r
- //console.recallCommand(true);\r
- }\r
-\r
- public void sendConsoleMessage(String strStatus) {\r
- if (strStatus == null) {\r
- console.clearContent();\r
- console.outputStatus("");\r
- } else if (strStatus.indexOf("ERROR:") >= 0) {\r
- console.outputError(strStatus);\r
- isError = true;\r
- } else if (!isError) {\r
- console.outputStatus(strStatus);\r
- }\r
- }\r
-\r
- public void notifyScriptTermination(String strMsg, int msWalltime) {\r
- if (strMsg != null && strMsg.indexOf("ERROR") >= 0) {\r
- console.outputError(strMsg);\r
- }\r
- runButton.setEnabled(true);\r
- haltButton.setEnabled(false);\r
- }\r
-\r
- public void enterPressed() {\r
- runButton.doClick(100);\r
- // executeCommand();\r
- }\r
-\r
-\r
- class ExecuteCommandThread extends Thread {\r
-\r
- String strCommand;\r
- ExecuteCommandThread (String command) {\r
- strCommand = command;\r
- }\r
-\r
- public void run() {\r
- try {\r
- executeCommand(strCommand);\r
- } catch (Exception ie) {\r
- Logger.debug("execution command interrupted!"+ie);\r
- }\r
- }\r
- }\r
-\r
- ExecuteCommandThread execThread;\r
- void executeCommandAsThread(){\r
- String strCommand = console.getCommandString().trim();\r
- if (strCommand.length() > 0) {\r
- execThread = new ExecuteCommandThread(strCommand);\r
- execThread.start();\r
- }\r
- }\r
-\r
- void executeCommand(String strCommand) {\r
- boolean doWait;\r
- setError(false);\r
- console.appendNewline();\r
- console.setPrompt();\r
- if (strCommand.length() > 0) {\r
- String strErrorMessage = null;\r
- doWait = (strCommand.indexOf("WAIT ") == 0);\r
- if (doWait) { //for testing, mainly\r
- // demonstrates using the statusManager system.\r
- runButton.setEnabled(false);\r
- haltButton.setEnabled(true);\r
-\r
- Vector info = (Vector) viewer\r
- .scriptWaitStatus(strCommand.substring(5),\r
- "+fileLoaded,+scriptStarted,+scriptStatus,+scriptEcho,+scriptTerminated");\r
- runButton.setEnabled(true);\r
- haltButton.setEnabled(false);\r
- /*\r
- * info = [ statusRecortSet0, statusRecortSet1, statusRecortSet2, ...]\r
- * statusRecordSet = [ statusRecord0, statusRecord1, statusRecord2, ...]\r
- * statusRecord = [int msgPtr, String statusName, int intInfo, String msg]\r
- */\r
- for (int i = 0; i < info.size(); i++) {\r
- Vector statusRecordSet = (Vector) info.get(i);\r
- for (int j = 0; j < statusRecordSet.size(); j++) {\r
- Vector statusRecord = (Vector) statusRecordSet.get(j);\r
- Logger.info("msg#=" + statusRecord.get(0) + " "\r
- + statusRecord.get(1) + " intInfo=" + statusRecord.get(2)\r
- + " stringInfo=" + statusRecord.get(3));\r
- }\r
- }\r
- console.appendNewline();\r
- } else {\r
- boolean isScriptExecuting = viewer.isScriptExecuting();\r
- if (viewer.checkHalt(strCommand))\r
- strErrorMessage = (isScriptExecuting ? "string execution halted with " + strCommand : "no script was executing");\r
- else\r
- strErrorMessage = "";//viewer.scriptCheck(strCommand);\r
- //the problem is that scriptCheck is synchronized, so these might get backed up.\r
- if (strErrorMessage != null && strErrorMessage.length() > 0) {\r
- console.outputError(strErrorMessage);\r
- } else {\r
- //runButton.setEnabled(false);\r
- haltButton.setEnabled(true);\r
- viewer.script(strCommand);\r
- }\r
- }\r
- }\r
- console.grabFocus();\r
- }\r
-\r
- public void actionPerformed(ActionEvent e) {\r
- Object source = e.getSource();\r
- if (source == closeButton) {\r
- appJmol.showConsole(false);\r
- } else if (source == runButton) {\r
- executeCommandAsThread();\r
- } else if (source == clearButton) {\r
- console.clearContent();\r
- } else if (source == historyButton) {\r
- console.clearContent(viewer.getSetHistory(Integer.MAX_VALUE));\r
- } else if (source == stateButton) {\r
- console.clearContent(viewer.getStateInfo());\r
- } else if (source == haltButton) {\r
- viewer.haltScriptExecution();\r
- }\r
- console.grabFocus(); // always grab the focus (e.g., after clear)\r
- }\r
-}\r
-\r
-class ConsoleTextPane extends JTextPane {\r
-\r
- ConsoleDocument consoleDoc;\r
- EnterListener enterListener;\r
- JmolViewer viewer;\r
-\r
- ConsoleTextPane(ScriptWindow scriptWindow) {\r
- super(new ConsoleDocument());\r
- consoleDoc = (ConsoleDocument)getDocument();\r
- consoleDoc.setConsoleTextPane(this);\r
- this.enterListener = (EnterListener) scriptWindow;\r
- this.viewer = scriptWindow.viewer;\r
- }\r
-\r
- public String getCommandString() {\r
- String cmd = consoleDoc.getCommandString();\r
- return cmd;\r
- }\r
-\r
- public void setPrompt() {\r
- consoleDoc.setPrompt();\r
- }\r
-\r
- public void appendNewline() {\r
- consoleDoc.appendNewline();\r
- }\r
-\r
- public void outputError(String strError) {\r
- consoleDoc.outputError(strError);\r
- }\r
-\r
- public void outputErrorForeground(String strError) {\r
- consoleDoc.outputErrorForeground(strError);\r
- }\r
-\r
- public void outputEcho(String strEcho) {\r
- consoleDoc.outputEcho(strEcho);\r
- }\r
-\r
- public void outputStatus(String strStatus) {\r
- consoleDoc.outputStatus(strStatus);\r
- }\r
-\r
- public void enterPressed() {\r
- if (enterListener != null)\r
- enterListener.enterPressed();\r
- }\r
-\r
- public void clearContent() {\r
- clearContent(null);\r
- }\r
- public void clearContent(String text) {\r
- consoleDoc.clearContent();\r
- if (text != null)\r
- consoleDoc.outputEcho(text);\r
- setPrompt();\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see java.awt.Component#processKeyEvent(java.awt.event.KeyEvent)\r
- */\r
-\r
- /**\r
- * Custom key event processing for command 0 implementation.\r
- *\r
- * Captures key up and key down strokes to call command history\r
- * and redefines the same events with control down to allow\r
- * caret vertical shift.\r
- *\r
- * @see java.awt.Component#processKeyEvent(java.awt.event.KeyEvent)\r
- */\r
- protected void processKeyEvent(KeyEvent ke)\r
- {\r
- // Id Control key is down, captures events does command\r
- // history recall and inhibits caret vertical shift.\r
- if (ke.getKeyCode() == KeyEvent.VK_UP\r
- && ke.getID() == KeyEvent.KEY_PRESSED\r
- && !ke.isControlDown())\r
- {\r
- recallCommand(true);\r
- }\r
- else if (\r
- ke.getKeyCode() == KeyEvent.VK_DOWN\r
- && ke.getID() == KeyEvent.KEY_PRESSED\r
- && !ke.isControlDown())\r
- {\r
- recallCommand(false);\r
- }\r
- // If Control key is down, redefines the event as if it\r
- // where a key up or key down stroke without modifiers.\r
- // This allows to move the caret up and down\r
- // with no command history recall.\r
- else if (\r
- (ke.getKeyCode() == KeyEvent.VK_DOWN\r
- || ke.getKeyCode() == KeyEvent.VK_UP)\r
- && ke.getID() == KeyEvent.KEY_PRESSED\r
- && ke.isControlDown())\r
- {\r
- super\r
- .processKeyEvent(new KeyEvent(\r
- (Component) ke.getSource(),\r
- ke.getID(),\r
- ke.getWhen(),\r
- 0, // No modifiers\r
- ke.getKeyCode(),\r
- ke.getKeyChar(),\r
- ke.getKeyLocation()));\r
- }\r
- // Standard processing for other events.\r
- else\r
- {\r
- super.processKeyEvent(ke);\r
- //check command for compiler-identifyable syntax issues\r
- //this may have to be taken out if people start complaining\r
- //that only some of the commands are being checked\r
- //that is -- that the script itself is not being fully checked\r
-\r
- //not perfect -- help here?\r
- if (ke.getID() == KeyEvent.KEY_RELEASED\r
- && (ke.getKeyCode() > KeyEvent.VK_DOWN) || ke.getKeyCode() == KeyEvent.VK_BACK_SPACE)\r
- checkCommand();\r
- }\r
- }\r
-\r
- /**\r
- * Recall command history.\r
- *\r
- * @param up - history up or down\r
- */\r
- void recallCommand(boolean up) {\r
- String cmd = viewer.getSetHistory(up ? -1 : 1);\r
- if (cmd == null) {\r
- return;\r
- }\r
- try {\r
- if (cmd.endsWith(CommandHistory.ERROR_FLAG)) {\r
- cmd = cmd.substring(0, cmd.indexOf(CommandHistory.ERROR_FLAG));\r
- consoleDoc.replaceCommand(cmd, true);\r
- } else {\r
- consoleDoc.replaceCommand(cmd, false);\r
- }\r
- } catch (BadLocationException e) {\r
- e.printStackTrace();\r
- }\r
- }\r
-\r
- void checkCommand() {\r
- String strCommand = consoleDoc.getCommandString();\r
- if (strCommand.length() == 0)\r
- return;\r
- consoleDoc\r
- .colorCommand(viewer.scriptCheck(strCommand) == null ? consoleDoc.attUserInput\r
- : consoleDoc.attError);\r
- }\r
-\r
-\r
-}\r
-\r
-class ConsoleDocument extends DefaultStyledDocument {\r
-\r
- ConsoleTextPane consoleTextPane;\r
-\r
- SimpleAttributeSet attError;\r
- SimpleAttributeSet attEcho;\r
- SimpleAttributeSet attPrompt;\r
- SimpleAttributeSet attUserInput;\r
- SimpleAttributeSet attStatus;\r
-\r
- ConsoleDocument() {\r
- super();\r
-\r
- attError = new SimpleAttributeSet();\r
- StyleConstants.setForeground(attError, Color.red);\r
-\r
- attPrompt = new SimpleAttributeSet();\r
- StyleConstants.setForeground(attPrompt, Color.magenta);\r
-\r
- attUserInput = new SimpleAttributeSet();\r
- StyleConstants.setForeground(attUserInput, Color.black);\r
-\r
- attEcho = new SimpleAttributeSet();\r
- StyleConstants.setForeground(attEcho, Color.blue);\r
- StyleConstants.setBold(attEcho, true);\r
-\r
- attStatus = new SimpleAttributeSet();\r
- StyleConstants.setForeground(attStatus, Color.black);\r
- StyleConstants.setItalic(attStatus, true);\r
- }\r
-\r
- void setConsoleTextPane(ConsoleTextPane consoleTextPane) {\r
- this.consoleTextPane = consoleTextPane;\r
- }\r
-\r
- Position positionBeforePrompt; // starts at 0, so first time isn't tracked (at least on Mac OS X)\r
- Position positionAfterPrompt; // immediately after $, so this will track\r
- int offsetAfterPrompt; // only still needed for the insertString override and replaceCommand\r
-\r
- /**\r
- * Removes all content of the script window, and add a new prompt.\r
- */\r
- void clearContent() {\r
- try {\r
- super.remove(0, getLength());\r
- } catch (BadLocationException exception) {\r
- System.out.println("Could not clear script window content: " + exception.getMessage());\r
- }\r
- }\r
-\r
- void setPrompt() {\r
- try {\r
- super.insertString(getLength(), "$ ", attPrompt);\r
- setOffsetPositions();\r
- consoleTextPane.setCaretPosition(offsetAfterPrompt);\r
- } catch (BadLocationException e) {\r
- e.printStackTrace();\r
- }\r
- }\r
-\r
- void setOffsetPositions() {\r
- try {\r
- offsetAfterPrompt = getLength();\r
- positionBeforePrompt = createPosition(offsetAfterPrompt - 2);\r
- // after prompt should be immediately after $ otherwise tracks the end\r
- // of the line (and no command will be found) at least on Mac OS X it did.\r
- positionAfterPrompt = createPosition(offsetAfterPrompt - 1);\r
- } catch (BadLocationException e) {\r
- e.printStackTrace();\r
- }\r
- }\r
-\r
- void setNoPrompt() {\r
- try {\r
- offsetAfterPrompt = getLength();\r
- positionAfterPrompt = positionBeforePrompt = createPosition(offsetAfterPrompt);\r
- consoleTextPane.setCaretPosition(offsetAfterPrompt);\r
- } catch (BadLocationException e) {\r
- e.printStackTrace();\r
- }\r
- }\r
-\r
- // it looks like the positionBeforePrompt does not track when it started out as 0\r
- // and a insertString at location 0 occurs. It may be better to track the\r
- // position after the prompt in stead\r
- void outputBeforePrompt(String str, SimpleAttributeSet attribute) {\r
- try {\r
- int pt = consoleTextPane.getCaretPosition();\r
- Position caretPosition = createPosition(pt);\r
- pt = positionBeforePrompt.getOffset();\r
- super.insertString(pt, str+"\n", attribute);\r
- setOffsetPositions();\r
- pt = caretPosition.getOffset();\r
- consoleTextPane.setCaretPosition(pt);\r
- } catch (BadLocationException e) {\r
- e.printStackTrace();\r
- }\r
- }\r
-\r
- void outputError(String strError) {\r
- outputBeforePrompt(strError, attError);\r
- }\r
-\r
- void outputErrorForeground(String strError) {\r
- try {\r
- super.insertString(getLength(), strError+"\n", attError);\r
- consoleTextPane.setCaretPosition(getLength());\r
- } catch (BadLocationException e) {\r
- e.printStackTrace();\r
-\r
- }\r
- }\r
-\r
- void outputEcho(String strEcho) {\r
- outputBeforePrompt(strEcho, attEcho);\r
- }\r
-\r
- void outputStatus(String strStatus) {\r
- outputBeforePrompt(strStatus, attStatus);\r
- }\r
-\r
- void appendNewline() {\r
- try {\r
- super.insertString(getLength(), "\n", attUserInput);\r
- consoleTextPane.setCaretPosition(getLength());\r
- } catch (BadLocationException e) {\r
- e.printStackTrace();\r
- }\r
- }\r
-\r
- // override the insertString to make sure everything typed ends up at the end\r
- // or in the 'command line' using the proper font, and the newline is processed.\r
- public void insertString(int offs, String str, AttributeSet a)\r
- throws BadLocationException {\r
- int ichNewline = str.indexOf('\n');\r
- if (ichNewline > 0)\r
- str = str.substring(0, ichNewline);\r
- if (ichNewline != 0) {\r
- if (offs < offsetAfterPrompt) {\r
- offs = getLength();\r
- }\r
- super.insertString(offs, str, a == attError ? a : attUserInput);\r
- consoleTextPane.setCaretPosition(offs+str.length());\r
- }\r
- if (ichNewline >= 0) {\r
- consoleTextPane.enterPressed();\r
- }\r
- }\r
-\r
- String getCommandString() {\r
- String strCommand = "";\r
- try {\r
- int cmdStart = positionAfterPrompt.getOffset();\r
- strCommand = getText(cmdStart, getLength() - cmdStart);\r
- while (strCommand.length() > 0 && strCommand.charAt(0) == ' ')\r
- strCommand = strCommand.substring(1);\r
- } catch (BadLocationException e) {\r
- e.printStackTrace();\r
- }\r
- return strCommand;\r
- }\r
-\r
- public void remove(int offs, int len)\r
- throws BadLocationException {\r
- if (offs < offsetAfterPrompt) {\r
- len -= offsetAfterPrompt - offs;\r
- if (len <= 0)\r
- return;\r
- offs = offsetAfterPrompt;\r
- }\r
- super.remove(offs, len);\r
-// consoleTextPane.setCaretPosition(offs);\r
- }\r
-\r
- public void replace(int offs, int length, String str, AttributeSet attrs)\r
- throws BadLocationException {\r
- if (offs < offsetAfterPrompt) {\r
- if (offs + length < offsetAfterPrompt) {\r
- offs = getLength();\r
- length = 0;\r
- } else {\r
- length -= offsetAfterPrompt - offs;\r
- offs = offsetAfterPrompt;\r
- }\r
- }\r
- super.replace(offs, length, str, attrs);\r
-// consoleTextPane.setCaretPosition(offs + str.length());\r
- }\r
-\r
- /**\r
- * Replaces current command on script.\r
- *\r
- * @param newCommand new command value\r
- * @param isError true to set error color ends with #??\r
- *\r
- * @throws BadLocationException\r
- */\r
- void replaceCommand(String newCommand, boolean isError) throws BadLocationException {\r
- if (positionAfterPrompt == positionBeforePrompt)\r
- return;\r
- replace(offsetAfterPrompt, getLength() - offsetAfterPrompt, newCommand,\r
- isError ? attError : attUserInput);\r
- }\r
-\r
- void colorCommand(SimpleAttributeSet att) {\r
- if (positionAfterPrompt == positionBeforePrompt)\r
- return;\r
- setCharacterAttributes(offsetAfterPrompt, getLength() - offsetAfterPrompt, att, true);\r
- }\r
-}\r
-\r
-interface EnterListener {\r
- public void enterPressed();\r
-}\r
-\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.gui;
+
+import org.jmol.api.*;
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.text.*;
+import java.util.Vector;
+
+import org.jmol.i18n.GT;
+import org.jmol.util.Logger;
+import org.jmol.util.CommandHistory;
+
+public final class ScriptWindow extends JPanel
+ implements ActionListener, EnterListener{
+
+ private ConsoleTextPane console;
+ private JButton closeButton;
+ private JButton runButton;
+ private JButton haltButton;
+ private JButton clearButton;
+ private JButton historyButton;
+ private JButton stateButton;
+ JmolViewer viewer;
+ AppJmol appJmol;
+
+ public ScriptWindow(AppJmol appJmol)
+ {
+ this.viewer = appJmol.viewer;
+ this.appJmol = appJmol;
+
+
+ setLayout(new BorderLayout());
+
+ console = new ConsoleTextPane(this);
+
+
+ console.setPrompt();
+ add(new JScrollPane(console)
+ , BorderLayout.CENTER);
+
+ JPanel buttonPanel = new JPanel();
+ add(buttonPanel, BorderLayout.SOUTH);
+
+ runButton = new JButton(GT._("Run"));
+ haltButton = new JButton(GT._("Halt"));
+ runButton.addActionListener(this);
+ // buttonPanel.add(runButton);
+ haltButton.addActionListener(this);
+ // buttonPanel.add(haltButton);
+ haltButton.setEnabled(false);
+
+ clearButton = new JButton(GT._("Clear"));
+ clearButton.addActionListener(this);
+ buttonPanel.add(clearButton);
+
+ historyButton = new JButton(GT._("History"));
+ historyButton.addActionListener(this);
+ buttonPanel.add(historyButton);
+
+ stateButton = new JButton(GT._("State"));
+ stateButton.addActionListener(this);
+ buttonPanel.add(stateButton);
+
+ closeButton = new JButton(GT._("Close"));
+ closeButton.addActionListener(this);
+ buttonPanel.add(closeButton);
+
+ for(int i=0; i<buttonPanel.getComponentCount(); i++)
+ {
+ // ((JButton)buttonPanel.getComponent(i))
+ // .setMargin(new Insets(0, 0, 0, 0));
+ }
+
+ }
+
+ public void sendConsoleEcho(String strEcho) {
+ if (strEcho != null && !isError) {
+
+ console.outputEcho(strEcho);
+
+ }
+ setError(false);
+ }
+
+ boolean isError = false;
+ void setError(boolean TF) {
+ isError = TF;
+ //if (isError)
+ //console.recallCommand(true);
+ }
+
+ public void sendConsoleMessage(String strStatus) {
+ if (strStatus == null) {
+ console.clearContent();
+ console.outputStatus("");
+ } else if (strStatus.indexOf("ERROR:") >= 0) {
+ console.outputError(strStatus);
+ isError = true;
+ } else if (!isError) {
+ console.outputStatus(strStatus);
+ }
+ }
+
+ public void notifyScriptTermination(String strMsg, int msWalltime) {
+ if (strMsg != null && strMsg.indexOf("ERROR") >= 0) {
+ console.outputError(strMsg);
+ }
+ runButton.setEnabled(true);
+ haltButton.setEnabled(false);
+ }
+
+ public void enterPressed() {
+ runButton.doClick(100);
+ // executeCommand();
+ }
+
+
+ class ExecuteCommandThread extends Thread {
+
+ String strCommand;
+ ExecuteCommandThread (String command) {
+ strCommand = command;
+ }
+
+ public void run() {
+ try {
+ executeCommand(strCommand);
+ } catch (Exception ie) {
+ Logger.debug("execution command interrupted!"+ie);
+ }
+ }
+ }
+
+ ExecuteCommandThread execThread;
+ void executeCommandAsThread(){
+ String strCommand = console.getCommandString().trim();
+ if (strCommand.length() > 0) {
+ execThread = new ExecuteCommandThread(strCommand);
+ execThread.start();
+ }
+ }
+
+ void executeCommand(String strCommand) {
+ boolean doWait;
+ setError(false);
+ console.appendNewline();
+ console.setPrompt();
+ if (strCommand.length() > 0) {
+ String strErrorMessage = null;
+ doWait = (strCommand.indexOf("WAIT ") == 0);
+ if (doWait) { //for testing, mainly
+ // demonstrates using the statusManager system.
+ runButton.setEnabled(false);
+ haltButton.setEnabled(true);
+
+ Vector info = (Vector) viewer
+ .scriptWaitStatus(strCommand.substring(5),
+ "+fileLoaded,+scriptStarted,+scriptStatus,+scriptEcho,+scriptTerminated");
+ runButton.setEnabled(true);
+ haltButton.setEnabled(false);
+ /*
+ * info = [ statusRecortSet0, statusRecortSet1, statusRecortSet2, ...]
+ * statusRecordSet = [ statusRecord0, statusRecord1, statusRecord2, ...]
+ * statusRecord = [int msgPtr, String statusName, int intInfo, String msg]
+ */
+ for (int i = 0; i < info.size(); i++) {
+ Vector statusRecordSet = (Vector) info.get(i);
+ for (int j = 0; j < statusRecordSet.size(); j++) {
+ Vector statusRecord = (Vector) statusRecordSet.get(j);
+ Logger.info("msg#=" + statusRecord.get(0) + " "
+ + statusRecord.get(1) + " intInfo=" + statusRecord.get(2)
+ + " stringInfo=" + statusRecord.get(3));
+ }
+ }
+ console.appendNewline();
+ } else {
+ boolean isScriptExecuting = viewer.isScriptExecuting();
+ if (viewer.checkHalt(strCommand))
+ strErrorMessage = (isScriptExecuting ? "string execution halted with " + strCommand : "no script was executing");
+ else
+ strErrorMessage = "";//viewer.scriptCheck(strCommand);
+ //the problem is that scriptCheck is synchronized, so these might get backed up.
+ if (strErrorMessage != null && strErrorMessage.length() > 0) {
+ console.outputError(strErrorMessage);
+ } else {
+ //runButton.setEnabled(false);
+ haltButton.setEnabled(true);
+ viewer.script(strCommand);
+ }
+ }
+ }
+ console.grabFocus();
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ Object source = e.getSource();
+ if (source == closeButton) {
+ appJmol.showConsole(false);
+ } else if (source == runButton) {
+ executeCommandAsThread();
+ } else if (source == clearButton) {
+ console.clearContent();
+ } else if (source == historyButton) {
+ console.clearContent(viewer.getSetHistory(Integer.MAX_VALUE));
+ } else if (source == stateButton) {
+ console.clearContent(viewer.getStateInfo());
+ } else if (source == haltButton) {
+ viewer.haltScriptExecution();
+ }
+ console.grabFocus(); // always grab the focus (e.g., after clear)
+ }
+}
+
+class ConsoleTextPane extends JTextPane {
+
+ ConsoleDocument consoleDoc;
+ EnterListener enterListener;
+ JmolViewer viewer;
+
+ ConsoleTextPane(ScriptWindow scriptWindow) {
+ super(new ConsoleDocument());
+ consoleDoc = (ConsoleDocument)getDocument();
+ consoleDoc.setConsoleTextPane(this);
+ this.enterListener = (EnterListener) scriptWindow;
+ this.viewer = scriptWindow.viewer;
+ }
+
+ public String getCommandString() {
+ String cmd = consoleDoc.getCommandString();
+ return cmd;
+ }
+
+ public void setPrompt() {
+ consoleDoc.setPrompt();
+ }
+
+ public void appendNewline() {
+ consoleDoc.appendNewline();
+ }
+
+ public void outputError(String strError) {
+ consoleDoc.outputError(strError);
+ }
+
+ public void outputErrorForeground(String strError) {
+ consoleDoc.outputErrorForeground(strError);
+ }
+
+ public void outputEcho(String strEcho) {
+ consoleDoc.outputEcho(strEcho);
+ }
+
+ public void outputStatus(String strStatus) {
+ consoleDoc.outputStatus(strStatus);
+ }
+
+ public void enterPressed() {
+ if (enterListener != null)
+ enterListener.enterPressed();
+ }
+
+ public void clearContent() {
+ clearContent(null);
+ }
+ public void clearContent(String text) {
+ consoleDoc.clearContent();
+ if (text != null)
+ consoleDoc.outputEcho(text);
+ setPrompt();
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.Component#processKeyEvent(java.awt.event.KeyEvent)
+ */
+
+ /**
+ * Custom key event processing for command 0 implementation.
+ *
+ * Captures key up and key down strokes to call command history
+ * and redefines the same events with control down to allow
+ * caret vertical shift.
+ *
+ * @see java.awt.Component#processKeyEvent(java.awt.event.KeyEvent)
+ */
+ protected void processKeyEvent(KeyEvent ke)
+ {
+ // Id Control key is down, captures events does command
+ // history recall and inhibits caret vertical shift.
+ if (ke.getKeyCode() == KeyEvent.VK_UP
+ && ke.getID() == KeyEvent.KEY_PRESSED
+ && !ke.isControlDown())
+ {
+ recallCommand(true);
+ }
+ else if (
+ ke.getKeyCode() == KeyEvent.VK_DOWN
+ && ke.getID() == KeyEvent.KEY_PRESSED
+ && !ke.isControlDown())
+ {
+ recallCommand(false);
+ }
+ // If Control key is down, redefines the event as if it
+ // where a key up or key down stroke without modifiers.
+ // This allows to move the caret up and down
+ // with no command history recall.
+ else if (
+ (ke.getKeyCode() == KeyEvent.VK_DOWN
+ || ke.getKeyCode() == KeyEvent.VK_UP)
+ && ke.getID() == KeyEvent.KEY_PRESSED
+ && ke.isControlDown())
+ {
+ super
+ .processKeyEvent(new KeyEvent(
+ (Component) ke.getSource(),
+ ke.getID(),
+ ke.getWhen(),
+ 0, // No modifiers
+ ke.getKeyCode(),
+ ke.getKeyChar(),
+ ke.getKeyLocation()));
+ }
+ // Standard processing for other events.
+ else
+ {
+ super.processKeyEvent(ke);
+ //check command for compiler-identifyable syntax issues
+ //this may have to be taken out if people start complaining
+ //that only some of the commands are being checked
+ //that is -- that the script itself is not being fully checked
+
+ //not perfect -- help here?
+ if (ke.getID() == KeyEvent.KEY_RELEASED
+ && (ke.getKeyCode() > KeyEvent.VK_DOWN) || ke.getKeyCode() == KeyEvent.VK_BACK_SPACE)
+ checkCommand();
+ }
+ }
+
+ /**
+ * Recall command history.
+ *
+ * @param up - history up or down
+ */
+ void recallCommand(boolean up) {
+ String cmd = viewer.getSetHistory(up ? -1 : 1);
+ if (cmd == null) {
+ return;
+ }
+ try {
+ if (cmd.endsWith(CommandHistory.ERROR_FLAG)) {
+ cmd = cmd.substring(0, cmd.indexOf(CommandHistory.ERROR_FLAG));
+ consoleDoc.replaceCommand(cmd, true);
+ } else {
+ consoleDoc.replaceCommand(cmd, false);
+ }
+ } catch (BadLocationException e) {
+ e.printStackTrace();
+ }
+ }
+
+ void checkCommand() {
+ String strCommand = consoleDoc.getCommandString();
+ if (strCommand.length() == 0)
+ return;
+ consoleDoc
+ .colorCommand(viewer.scriptCheck(strCommand) == null ? consoleDoc.attUserInput
+ : consoleDoc.attError);
+ }
+
+
+}
+
+class ConsoleDocument extends DefaultStyledDocument {
+
+ ConsoleTextPane consoleTextPane;
+
+ SimpleAttributeSet attError;
+ SimpleAttributeSet attEcho;
+ SimpleAttributeSet attPrompt;
+ SimpleAttributeSet attUserInput;
+ SimpleAttributeSet attStatus;
+
+ ConsoleDocument() {
+ super();
+
+ attError = new SimpleAttributeSet();
+ StyleConstants.setForeground(attError, Color.red);
+
+ attPrompt = new SimpleAttributeSet();
+ StyleConstants.setForeground(attPrompt, Color.magenta);
+
+ attUserInput = new SimpleAttributeSet();
+ StyleConstants.setForeground(attUserInput, Color.black);
+
+ attEcho = new SimpleAttributeSet();
+ StyleConstants.setForeground(attEcho, Color.blue);
+ StyleConstants.setBold(attEcho, true);
+
+ attStatus = new SimpleAttributeSet();
+ StyleConstants.setForeground(attStatus, Color.black);
+ StyleConstants.setItalic(attStatus, true);
+ }
+
+ void setConsoleTextPane(ConsoleTextPane consoleTextPane) {
+ this.consoleTextPane = consoleTextPane;
+ }
+
+ Position positionBeforePrompt; // starts at 0, so first time isn't tracked (at least on Mac OS X)
+ Position positionAfterPrompt; // immediately after $, so this will track
+ int offsetAfterPrompt; // only still needed for the insertString override and replaceCommand
+
+ /**
+ * Removes all content of the script window, and add a new prompt.
+ */
+ void clearContent() {
+ try {
+ super.remove(0, getLength());
+ } catch (BadLocationException exception) {
+ System.out.println("Could not clear script window content: " + exception.getMessage());
+ }
+ }
+
+ void setPrompt() {
+ try {
+ super.insertString(getLength(), "$ ", attPrompt);
+ setOffsetPositions();
+ consoleTextPane.setCaretPosition(offsetAfterPrompt);
+ } catch (BadLocationException e) {
+ e.printStackTrace();
+ }
+ }
+
+ void setOffsetPositions() {
+ try {
+ offsetAfterPrompt = getLength();
+ positionBeforePrompt = createPosition(offsetAfterPrompt - 2);
+ // after prompt should be immediately after $ otherwise tracks the end
+ // of the line (and no command will be found) at least on Mac OS X it did.
+ positionAfterPrompt = createPosition(offsetAfterPrompt - 1);
+ } catch (BadLocationException e) {
+ e.printStackTrace();
+ }
+ }
+
+ void setNoPrompt() {
+ try {
+ offsetAfterPrompt = getLength();
+ positionAfterPrompt = positionBeforePrompt = createPosition(offsetAfterPrompt);
+ consoleTextPane.setCaretPosition(offsetAfterPrompt);
+ } catch (BadLocationException e) {
+ e.printStackTrace();
+ }
+ }
+
+ // it looks like the positionBeforePrompt does not track when it started out as 0
+ // and a insertString at location 0 occurs. It may be better to track the
+ // position after the prompt in stead
+ void outputBeforePrompt(String str, SimpleAttributeSet attribute) {
+ try {
+ int pt = consoleTextPane.getCaretPosition();
+ Position caretPosition = createPosition(pt);
+ pt = positionBeforePrompt.getOffset();
+ super.insertString(pt, str+"\n", attribute);
+ setOffsetPositions();
+ pt = caretPosition.getOffset();
+ consoleTextPane.setCaretPosition(pt);
+ } catch (BadLocationException e) {
+ e.printStackTrace();
+ }
+ }
+
+ void outputError(String strError) {
+ outputBeforePrompt(strError, attError);
+ }
+
+ void outputErrorForeground(String strError) {
+ try {
+ super.insertString(getLength(), strError+"\n", attError);
+ consoleTextPane.setCaretPosition(getLength());
+ } catch (BadLocationException e) {
+ e.printStackTrace();
+
+ }
+ }
+
+ void outputEcho(String strEcho) {
+ outputBeforePrompt(strEcho, attEcho);
+ }
+
+ void outputStatus(String strStatus) {
+ outputBeforePrompt(strStatus, attStatus);
+ }
+
+ void appendNewline() {
+ try {
+ super.insertString(getLength(), "\n", attUserInput);
+ consoleTextPane.setCaretPosition(getLength());
+ } catch (BadLocationException e) {
+ e.printStackTrace();
+ }
+ }
+
+ // override the insertString to make sure everything typed ends up at the end
+ // or in the 'command line' using the proper font, and the newline is processed.
+ public void insertString(int offs, String str, AttributeSet a)
+ throws BadLocationException {
+ int ichNewline = str.indexOf('\n');
+ if (ichNewline > 0)
+ str = str.substring(0, ichNewline);
+ if (ichNewline != 0) {
+ if (offs < offsetAfterPrompt) {
+ offs = getLength();
+ }
+ super.insertString(offs, str, a == attError ? a : attUserInput);
+ consoleTextPane.setCaretPosition(offs+str.length());
+ }
+ if (ichNewline >= 0) {
+ consoleTextPane.enterPressed();
+ }
+ }
+
+ String getCommandString() {
+ String strCommand = "";
+ try {
+ int cmdStart = positionAfterPrompt.getOffset();
+ strCommand = getText(cmdStart, getLength() - cmdStart);
+ while (strCommand.length() > 0 && strCommand.charAt(0) == ' ')
+ strCommand = strCommand.substring(1);
+ } catch (BadLocationException e) {
+ e.printStackTrace();
+ }
+ return strCommand;
+ }
+
+ public void remove(int offs, int len)
+ throws BadLocationException {
+ if (offs < offsetAfterPrompt) {
+ len -= offsetAfterPrompt - offs;
+ if (len <= 0)
+ return;
+ offs = offsetAfterPrompt;
+ }
+ super.remove(offs, len);
+// consoleTextPane.setCaretPosition(offs);
+ }
+
+ public void replace(int offs, int length, String str, AttributeSet attrs)
+ throws BadLocationException {
+ if (offs < offsetAfterPrompt) {
+ if (offs + length < offsetAfterPrompt) {
+ offs = getLength();
+ length = 0;
+ } else {
+ length -= offsetAfterPrompt - offs;
+ offs = offsetAfterPrompt;
+ }
+ }
+ super.replace(offs, length, str, attrs);
+// consoleTextPane.setCaretPosition(offs + str.length());
+ }
+
+ /**
+ * Replaces current command on script.
+ *
+ * @param newCommand new command value
+ * @param isError true to set error color ends with #??
+ *
+ * @throws BadLocationException
+ */
+ void replaceCommand(String newCommand, boolean isError) throws BadLocationException {
+ if (positionAfterPrompt == positionBeforePrompt)
+ return;
+ replace(offsetAfterPrompt, getLength() - offsetAfterPrompt, newCommand,
+ isError ? attError : attUserInput);
+ }
+
+ void colorCommand(SimpleAttributeSet att) {
+ if (positionAfterPrompt == positionBeforePrompt)
+ return;
+ setCharacterAttributes(offsetAfterPrompt, getLength() - offsetAfterPrompt, att, true);
+ }
+}
+
+interface EnterListener {
+ public void enterPressed();
+}
+
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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.gui;\r
-\r
-import java.awt.*;\r
-\r
-import jalview.datamodel.*;\r
-import jalview.schemes.*;\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
- boolean monospacedFont;\r
- boolean forOverview = false;\r
-\r
- /**\r
- * Creates a new SequenceRenderer object.\r
- *\r
- * @param av DOCUMENT ME!\r
- */\r
- public SequenceRenderer(AlignViewport av)\r
- {\r
- this.av = av;\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param b DOCUMENT ME!\r
- */\r
- public void prepare(Graphics g, boolean renderGaps)\r
- {\r
- graphics = g;\r
- fm = g.getFontMetrics();\r
-\r
- // If EPS graphics, stringWidth will be a double, not an int\r
- double dwidth = fm.getStringBounds("M", g).getWidth();\r
-\r
- monospacedFont =\r
- (dwidth == fm.getStringBounds("|", g).getWidth()\r
- && (float) av.charWidth == dwidth);\r
-\r
- this.renderGaps = renderGaps;\r
- }\r
-\r
- public Color getResidueBoxColour(SequenceI seq, int i)\r
- {\r
- allGroups = av.alignment.findAllGroups(seq);\r
-\r
- if (inCurrentSequenceGroup(i))\r
- {\r
- if (currentSequenceGroup.getDisplayBoxes())\r
- {\r
- getBoxColour(currentSequenceGroup.cs, seq, i);\r
- }\r
- }\r
- else if (av.getShowBoxes())\r
- {\r
- getBoxColour(av.globalColourScheme, seq, i);\r
- }\r
-\r
- return resBoxColour;\r
- }\r
-\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 (cs != null)\r
- {\r
- resBoxColour = cs.findColour(seq.getCharAt(i), i);\r
- }\r
- else if (forOverview && !jalview.util.Comparison.isGap(seq.getCharAt(i)))\r
- {\r
- resBoxColour = Color.lightGray;\r
- }\r
- else\r
- {\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(SequenceI seq, SequenceGroup[] sg,\r
- int start, int end, int y1)\r
- {\r
- allGroups = sg;\r
-\r
- drawBoxes(seq, start, end, y1);\r
-\r
- if (av.validCharWidth)\r
- {\r
- drawText(seq, start, end, y1);\r
- }\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 synchronized void drawBoxes(SequenceI seq, int start, int end, int y1)\r
- {\r
- int i = start;\r
- int length = seq.getLength();\r
-\r
- int curStart = -1;\r
- int curWidth = av.charWidth;\r
-\r
- Color tempColour = null;\r
-\r
- while (i <= end)\r
- {\r
- resBoxColour = Color.white;\r
-\r
- if (i < length)\r
- {\r
- if (inCurrentSequenceGroup(i))\r
- {\r
- if (currentSequenceGroup.getDisplayBoxes())\r
- {\r
- getBoxColour(currentSequenceGroup.cs, seq, i);\r
- }\r
- }\r
- else if (av.getShowBoxes())\r
- {\r
- getBoxColour(av.globalColourScheme, seq, i);\r
- }\r
-\r
- }\r
-\r
- if (resBoxColour != tempColour)\r
- {\r
- if (tempColour != null)\r
- {\r
- graphics.fillRect(av.charWidth * (curStart - start), y1,\r
- curWidth, av.charHeight);\r
- }\r
-\r
- graphics.setColor(resBoxColour);\r
-\r
- curStart = i;\r
- curWidth = av.charWidth;\r
- tempColour = resBoxColour;\r
- }\r
- else\r
- {\r
- curWidth += av.charWidth;\r
- }\r
-\r
- i++;\r
- }\r
-\r
- graphics.fillRect(av.charWidth * (curStart - start), y1, curWidth,\r
- av.charHeight);\r
-\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 y1)\r
- {\r
- y1 += av.charHeight - av.charHeight / 5; // height/5 replaces pady\r
- int charOffset = 0;\r
- char s;\r
-\r
- if (end + 1 >= seq.getLength())\r
- {\r
- end = seq.getLength() - 1;\r
- }\r
- graphics.setColor(av.textColour);\r
-\r
- if (monospacedFont\r
- && av.showText\r
- && allGroups.length == 0\r
- && !av.getColourText()\r
- && av.thresholdTextColour == 0)\r
- {\r
- if (av.renderGaps)\r
- {\r
- graphics.drawString(seq.getSequenceAsString(start, end + 1), 0, y1);\r
- }\r
- else\r
- {\r
- char gap = av.getGapCharacter();\r
- graphics.drawString(seq.getSequenceAsString(start, end + 1).replace(gap,\r
- ' '), 0, y1);\r
- }\r
- }\r
- else\r
- {\r
- boolean getboxColour = false;\r
- for (int i = start; i <= end; i++)\r
- {\r
- graphics.setColor(av.textColour);\r
- getboxColour = false;\r
- s = seq.getCharAt(i);\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.thresholdTextColour > 0\r
- || currentSequenceGroup.getColourText())\r
- {\r
- getboxColour = true;\r
- getBoxColour(currentSequenceGroup.cs, seq, i);\r
-\r
- if (currentSequenceGroup.getColourText())\r
- {\r
- graphics.setColor(resBoxColour.darker());\r
- }\r
-\r
- if (currentSequenceGroup.thresholdTextColour > 0)\r
- {\r
- if (resBoxColour.getRed() +\r
- resBoxColour.getBlue() +\r
- resBoxColour.getGreen() <\r
- currentSequenceGroup.thresholdTextColour)\r
- {\r
- graphics.setColor(currentSequenceGroup.textColour2);\r
- }\r
- }\r
- }\r
- else\r
- {\r
- graphics.setColor(currentSequenceGroup.textColour);\r
- }\r
-\r
- }\r
- else\r
- {\r
- if (!av.getShowText())\r
- {\r
- continue;\r
- }\r
-\r
- if (av.getColourText())\r
- {\r
- getboxColour = true;\r
- getBoxColour(av.globalColourScheme, 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 (av.thresholdTextColour > 0)\r
- {\r
- if (!getboxColour)\r
- {\r
- getBoxColour(av.globalColourScheme, seq, i);\r
- }\r
-\r
- if (resBoxColour.getRed() +\r
- resBoxColour.getBlue() +\r
- resBoxColour.getGreen() < av.thresholdTextColour)\r
- {\r
- graphics.setColor(av.textColour2);\r
- }\r
- }\r
-\r
- }\r
-\r
- charOffset = (av.charWidth - fm.charWidth(s)) / 2;\r
- graphics.drawString(String.valueOf(s),\r
- charOffset + av.charWidth * (i - start),\r
- y1);\r
-\r
- }\r
- }\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
- return false;\r
- }\r
-\r
- for (int i = 0; i < allGroups.length; i++)\r
- {\r
- if ( (allGroups[i].getStartRes() <= res) &&\r
- (allGroups[i].getEndRes() >= res))\r
- {\r
- currentSequenceGroup = allGroups[i];\r
-\r
- return true;\r
- }\r
- }\r
-\r
- return false;\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 drawHighlightedText(SequenceI seq, int start, int end, int x1,\r
- int y1)\r
- {\r
- int pady = av.charHeight / 5;\r
- int charOffset = 0;\r
- graphics.setColor(Color.BLACK);\r
- graphics.fillRect(x1, y1, av.charWidth * (end - start + 1), av.charHeight);\r
- graphics.setColor(Color.white);\r
-\r
- char s = '~';\r
-\r
- // Need to find the sequence position here.\r
- if (av.validCharWidth)\r
- {\r
- for (int i = start; i <= end; i++)\r
- {\r
- if (i < seq.getLength())\r
- {\r
- s = seq.getCharAt(i);\r
- }\r
-\r
- charOffset = (av.charWidth - fm.charWidth(s)) / 2;\r
- graphics.drawString(String.valueOf(s),\r
- charOffset + x1 + (av.charWidth * (i - start)),\r
- (y1 + av.charHeight) - pady);\r
- }\r
- }\r
- }\r
-\r
- public void drawCursor(SequenceI seq, int res, int x1, int y1)\r
- {\r
- int pady = av.charHeight / 5;\r
- int charOffset = 0;\r
- graphics.setColor(Color.black);\r
- graphics.fillRect(x1, y1, av.charWidth, av.charHeight);\r
-\r
- if (av.validCharWidth)\r
- {\r
- graphics.setColor(Color.white);\r
-\r
- char s = seq.getCharAt(res);\r
-\r
- charOffset = (av.charWidth - fm.charWidth(s)) / 2;\r
- graphics.drawString(String.valueOf(s),\r
- charOffset + x1,\r
- (y1 + av.charHeight) - pady);\r
- }\r
-\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.gui;
+
+import java.awt.*;
+
+import jalview.datamodel.*;
+import jalview.schemes.*;
+
+/**
+ * DOCUMENT ME!
+ *
+ * @author $author$
+ * @version $Revision$
+ */
+public class SequenceRenderer
+{
+ AlignViewport av;
+ FontMetrics fm;
+ boolean renderGaps = true;
+ SequenceGroup currentSequenceGroup = null;
+ SequenceGroup[] allGroups = null;
+ Color resBoxColour;
+ Graphics graphics;
+ boolean monospacedFont;
+ boolean forOverview = false;
+
+ /**
+ * Creates a new SequenceRenderer object.
+ *
+ * @param av DOCUMENT ME!
+ */
+ public SequenceRenderer(AlignViewport av)
+ {
+ this.av = av;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param b DOCUMENT ME!
+ */
+ public void prepare(Graphics g, boolean renderGaps)
+ {
+ graphics = g;
+ fm = g.getFontMetrics();
+
+ // If EPS graphics, stringWidth will be a double, not an int
+ double dwidth = fm.getStringBounds("M", g).getWidth();
+
+ monospacedFont =
+ (dwidth == fm.getStringBounds("|", g).getWidth()
+ && (float) av.charWidth == dwidth);
+
+ this.renderGaps = renderGaps;
+ }
+
+ public Color getResidueBoxColour(SequenceI seq, int i)
+ {
+ allGroups = av.alignment.findAllGroups(seq);
+
+ if (inCurrentSequenceGroup(i))
+ {
+ if (currentSequenceGroup.getDisplayBoxes())
+ {
+ getBoxColour(currentSequenceGroup.cs, seq, i);
+ }
+ }
+ else if (av.getShowBoxes())
+ {
+ getBoxColour(av.globalColourScheme, seq, i);
+ }
+
+ return resBoxColour;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param cs DOCUMENT ME!
+ * @param seq DOCUMENT ME!
+ * @param i DOCUMENT ME!
+ */
+ void getBoxColour(ColourSchemeI cs, SequenceI seq, int i)
+ {
+ if (cs != null)
+ {
+ resBoxColour = cs.findColour(seq.getCharAt(i), i);
+ }
+ else if (forOverview && !jalview.util.Comparison.isGap(seq.getCharAt(i)))
+ {
+ resBoxColour = Color.lightGray;
+ }
+ else
+ {
+ resBoxColour = Color.white;
+ }
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param g DOCUMENT ME!
+ * @param seq DOCUMENT ME!
+ * @param sg DOCUMENT ME!
+ * @param start DOCUMENT ME!
+ * @param end DOCUMENT ME!
+ * @param x1 DOCUMENT ME!
+ * @param y1 DOCUMENT ME!
+ * @param width DOCUMENT ME!
+ * @param height DOCUMENT ME!
+ */
+ public void drawSequence(SequenceI seq, SequenceGroup[] sg,
+ int start, int end, int y1)
+ {
+ allGroups = sg;
+
+ drawBoxes(seq, start, end, y1);
+
+ if (av.validCharWidth)
+ {
+ drawText(seq, start, end, y1);
+ }
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param seq DOCUMENT ME!
+ * @param start DOCUMENT ME!
+ * @param end DOCUMENT ME!
+ * @param x1 DOCUMENT ME!
+ * @param y1 DOCUMENT ME!
+ * @param width DOCUMENT ME!
+ * @param height DOCUMENT ME!
+ */
+ public synchronized void drawBoxes(SequenceI seq, int start, int end, int y1)
+ {
+ int i = start;
+ int length = seq.getLength();
+
+ int curStart = -1;
+ int curWidth = av.charWidth;
+
+ Color tempColour = null;
+
+ while (i <= end)
+ {
+ resBoxColour = Color.white;
+
+ if (i < length)
+ {
+ if (inCurrentSequenceGroup(i))
+ {
+ if (currentSequenceGroup.getDisplayBoxes())
+ {
+ getBoxColour(currentSequenceGroup.cs, seq, i);
+ }
+ }
+ else if (av.getShowBoxes())
+ {
+ getBoxColour(av.globalColourScheme, seq, i);
+ }
+
+ }
+
+ if (resBoxColour != tempColour)
+ {
+ if (tempColour != null)
+ {
+ graphics.fillRect(av.charWidth * (curStart - start), y1,
+ curWidth, av.charHeight);
+ }
+
+ graphics.setColor(resBoxColour);
+
+ curStart = i;
+ curWidth = av.charWidth;
+ tempColour = resBoxColour;
+ }
+ else
+ {
+ curWidth += av.charWidth;
+ }
+
+ i++;
+ }
+
+ graphics.fillRect(av.charWidth * (curStart - start), y1, curWidth,
+ av.charHeight);
+
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param seq DOCUMENT ME!
+ * @param start DOCUMENT ME!
+ * @param end DOCUMENT ME!
+ * @param x1 DOCUMENT ME!
+ * @param y1 DOCUMENT ME!
+ * @param width DOCUMENT ME!
+ * @param height DOCUMENT ME!
+ */
+ public void drawText(SequenceI seq, int start, int end, int y1)
+ {
+ y1 += av.charHeight - av.charHeight / 5; // height/5 replaces pady
+ int charOffset = 0;
+ char s;
+
+ if (end + 1 >= seq.getLength())
+ {
+ end = seq.getLength() - 1;
+ }
+ graphics.setColor(av.textColour);
+
+ if (monospacedFont
+ && av.showText
+ && allGroups.length == 0
+ && !av.getColourText()
+ && av.thresholdTextColour == 0)
+ {
+ if (av.renderGaps)
+ {
+ graphics.drawString(seq.getSequenceAsString(start, end + 1), 0, y1);
+ }
+ else
+ {
+ char gap = av.getGapCharacter();
+ graphics.drawString(seq.getSequenceAsString(start, end + 1).replace(gap,
+ ' '), 0, y1);
+ }
+ }
+ else
+ {
+ boolean getboxColour = false;
+ for (int i = start; i <= end; i++)
+ {
+ graphics.setColor(av.textColour);
+ getboxColour = false;
+ s = seq.getCharAt(i);
+ if (!renderGaps && jalview.util.Comparison.isGap(s))
+ {
+ continue;
+ }
+
+ if (inCurrentSequenceGroup(i))
+ {
+ if (!currentSequenceGroup.getDisplayText())
+ {
+ continue;
+ }
+
+ if (currentSequenceGroup.thresholdTextColour > 0
+ || currentSequenceGroup.getColourText())
+ {
+ getboxColour = true;
+ getBoxColour(currentSequenceGroup.cs, seq, i);
+
+ if (currentSequenceGroup.getColourText())
+ {
+ graphics.setColor(resBoxColour.darker());
+ }
+
+ if (currentSequenceGroup.thresholdTextColour > 0)
+ {
+ if (resBoxColour.getRed() +
+ resBoxColour.getBlue() +
+ resBoxColour.getGreen() <
+ currentSequenceGroup.thresholdTextColour)
+ {
+ graphics.setColor(currentSequenceGroup.textColour2);
+ }
+ }
+ }
+ else
+ {
+ graphics.setColor(currentSequenceGroup.textColour);
+ }
+
+ }
+ else
+ {
+ if (!av.getShowText())
+ {
+ continue;
+ }
+
+ if (av.getColourText())
+ {
+ getboxColour = true;
+ getBoxColour(av.globalColourScheme, seq, i);
+
+ if (av.getShowBoxes())
+ {
+ graphics.setColor(resBoxColour.darker());
+ }
+ else
+ {
+ graphics.setColor(resBoxColour);
+ }
+ }
+
+ if (av.thresholdTextColour > 0)
+ {
+ if (!getboxColour)
+ {
+ getBoxColour(av.globalColourScheme, seq, i);
+ }
+
+ if (resBoxColour.getRed() +
+ resBoxColour.getBlue() +
+ resBoxColour.getGreen() < av.thresholdTextColour)
+ {
+ graphics.setColor(av.textColour2);
+ }
+ }
+
+ }
+
+ charOffset = (av.charWidth - fm.charWidth(s)) / 2;
+ graphics.drawString(String.valueOf(s),
+ charOffset + av.charWidth * (i - start),
+ y1);
+
+ }
+ }
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param res DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ boolean inCurrentSequenceGroup(int res)
+ {
+ if (allGroups == null)
+ {
+ return false;
+ }
+
+ for (int i = 0; i < allGroups.length; i++)
+ {
+ if ( (allGroups[i].getStartRes() <= res) &&
+ (allGroups[i].getEndRes() >= res))
+ {
+ currentSequenceGroup = allGroups[i];
+
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param seq DOCUMENT ME!
+ * @param start DOCUMENT ME!
+ * @param end DOCUMENT ME!
+ * @param x1 DOCUMENT ME!
+ * @param y1 DOCUMENT ME!
+ * @param width DOCUMENT ME!
+ * @param height DOCUMENT ME!
+ */
+ public void drawHighlightedText(SequenceI seq, int start, int end, int x1,
+ int y1)
+ {
+ int pady = av.charHeight / 5;
+ int charOffset = 0;
+ graphics.setColor(Color.BLACK);
+ graphics.fillRect(x1, y1, av.charWidth * (end - start + 1), av.charHeight);
+ graphics.setColor(Color.white);
+
+ char s = '~';
+
+ // Need to find the sequence position here.
+ if (av.validCharWidth)
+ {
+ for (int i = start; i <= end; i++)
+ {
+ if (i < seq.getLength())
+ {
+ s = seq.getCharAt(i);
+ }
+
+ charOffset = (av.charWidth - fm.charWidth(s)) / 2;
+ graphics.drawString(String.valueOf(s),
+ charOffset + x1 + (av.charWidth * (i - start)),
+ (y1 + av.charHeight) - pady);
+ }
+ }
+ }
+
+ public void drawCursor(SequenceI seq, int res, int x1, int y1)
+ {
+ int pady = av.charHeight / 5;
+ int charOffset = 0;
+ graphics.setColor(Color.black);
+ graphics.fillRect(x1, y1, av.charWidth, av.charHeight);
+
+ if (av.validCharWidth)
+ {
+ graphics.setColor(Color.white);
+
+ char s = seq.getCharAt(res);
+
+ charOffset = (av.charWidth - fm.charWidth(s)) / 2;
+ graphics.drawString(String.valueOf(s),
+ charOffset + x1,
+ (y1 + av.charHeight) - pady);
+ }
+
+ }
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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.gui;\r
-\r
-import java.util.*;\r
-\r
-import java.awt.event.*;\r
-import javax.swing.*;\r
-import javax.swing.event.*;\r
-\r
-import jalview.datamodel.*;\r
-import jalview.jbgui.*;\r
-import jalview.schemes.*;\r
-\r
-/**\r
- * DOCUMENT ME!\r
- *\r
- * @author $author$\r
- * @version $Revision$\r
- */\r
-public class SliderPanel\r
- extends GSliderPanel\r
-{\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(final 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(100);\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
- {\r
- public void stateChanged(ChangeEvent evt)\r
- {\r
- valueField.setText(slider.getValue() + "");\r
- valueChanged(slider.getValue());\r
- }\r
- });\r
-\r
- slider.addMouseListener(new MouseAdapter()\r
- {\r
- public void mouseReleased(MouseEvent evt)\r
- {\r
- ap.paintAlignment(true);\r
- }\r
- });\r
-\r
- slider.setValue(value);\r
- valueField.setText(value + "");\r
- }\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 setConservationSlider(AlignmentPanel ap,\r
- ColourSchemeI cs, String source)\r
- {\r
- SliderPanel sp = null;\r
-\r
- if (conservationSlider == null)\r
- {\r
- sp = new SliderPanel(ap, cs.getConservationInc(), 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.setTitle("Conservation Colour Increment (" +\r
- source + ")");\r
-\r
- if (ap.av.alignment.getGroups() != null)\r
- {\r
- sp.setAllGroupsCheckEnabled(true);\r
- }\r
- else\r
- {\r
- sp.setAllGroupsCheckEnabled(false);\r
- }\r
-\r
- return sp.getValue();\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- */\r
- public static void showConservationSlider()\r
- {\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.\r
- 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
-\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
- SliderPanel pid = null;\r
-\r
- int threshold = cs.getThreshold();\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
- 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
- /**\r
- * DOCUMENT ME!\r
- */\r
- public static void showPIDSlider()\r
- {\r
- try\r
- {\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.\r
- 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
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param i DOCUMENT ME!\r
- */\r
- public void valueChanged(int i)\r
- {\r
- if (cs == null)\r
- {\r
- return;\r
- }\r
-\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
- }\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.conservationApplied())\r
- {\r
- toChange.setConservationInc(i);\r
- }\r
- }\r
- else\r
- {\r
- toChange.setThreshold(i, ap.av.getIgnoreGapsConsensus());\r
- }\r
-\r
- groupIndex--;\r
- }\r
-\r
- ap.seqPanel.seqCanvas.repaint();\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param b DOCUMENT ME!\r
- */\r
- public void setAllGroupsCheckEnabled(boolean b)\r
- {\r
- allGroupsCheck.setEnabled(b);\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param e DOCUMENT ME!\r
- */\r
- public void valueField_actionPerformed(ActionEvent e)\r
- {\r
- try\r
- {\r
- int i = Integer.parseInt(valueField.getText());\r
- slider.setValue(i);\r
- }\r
- catch (NumberFormatException ex)\r
- {\r
- valueField.setText(slider.getValue() + "");\r
- }\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param value DOCUMENT ME!\r
- */\r
- public void setValue(int value)\r
- {\r
- slider.setValue(value);\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @return DOCUMENT ME!\r
- */\r
- public int getValue()\r
- {\r
- return Integer.parseInt(valueField.getText());\r
- }\r
-\r
- public void slider_mouseReleased(MouseEvent e)\r
- {\r
- if (ap.overviewPanel != null)\r
- {\r
- ap.overviewPanel.updateOverviewImage();\r
- }\r
- }\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.gui;
+
+import java.util.*;
+
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.event.*;
+
+import jalview.datamodel.*;
+import jalview.jbgui.*;
+import jalview.schemes.*;
+
+/**
+ * DOCUMENT ME!
+ *
+ * @author $author$
+ * @version $Revision$
+ */
+public class SliderPanel
+ extends GSliderPanel
+{
+ static JInternalFrame conservationSlider;
+ static JInternalFrame PIDSlider;
+ AlignmentPanel ap;
+ boolean forConservation = true;
+ ColourSchemeI cs;
+
+ /**
+ * Creates a new SliderPanel object.
+ *
+ * @param ap DOCUMENT ME!
+ * @param value DOCUMENT ME!
+ * @param forConserve DOCUMENT ME!
+ * @param cs DOCUMENT ME!
+ */
+ public SliderPanel(final AlignmentPanel ap, int value, boolean forConserve,
+ ColourSchemeI cs)
+ {
+ this.ap = ap;
+ this.cs = cs;
+ forConservation = forConserve;
+ undoButton.setVisible(false);
+ applyButton.setVisible(false);
+
+ if (forConservation)
+ {
+ label.setText("Enter value to increase conservation visibility");
+ slider.setMinimum(0);
+ slider.setMaximum(100);
+ }
+ else
+ {
+ label.setText("Enter % identity above which to colour residues");
+ slider.setMinimum(0);
+ slider.setMaximum(100);
+ }
+
+ slider.addChangeListener(new ChangeListener()
+ {
+ public void stateChanged(ChangeEvent evt)
+ {
+ valueField.setText(slider.getValue() + "");
+ valueChanged(slider.getValue());
+ }
+ });
+
+ slider.addMouseListener(new MouseAdapter()
+ {
+ public void mouseReleased(MouseEvent evt)
+ {
+ ap.paintAlignment(true);
+ }
+ });
+
+ slider.setValue(value);
+ valueField.setText(value + "");
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param ap DOCUMENT ME!
+ * @param cs DOCUMENT ME!
+ * @param source DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public static int setConservationSlider(AlignmentPanel ap,
+ ColourSchemeI cs, String source)
+ {
+ SliderPanel sp = null;
+
+ if (conservationSlider == null)
+ {
+ sp = new SliderPanel(ap, cs.getConservationInc(), true, cs);
+ conservationSlider = new JInternalFrame();
+ conservationSlider.setContentPane(sp);
+ conservationSlider.setLayer(JLayeredPane.PALETTE_LAYER);
+ }
+ else
+ {
+ sp = (SliderPanel) conservationSlider.getContentPane();
+ sp.cs = cs;
+ }
+
+ conservationSlider.setTitle("Conservation Colour Increment (" +
+ source + ")");
+
+ if (ap.av.alignment.getGroups() != null)
+ {
+ sp.setAllGroupsCheckEnabled(true);
+ }
+ else
+ {
+ sp.setAllGroupsCheckEnabled(false);
+ }
+
+ return sp.getValue();
+ }
+
+ /**
+ * DOCUMENT ME!
+ */
+ public static void showConservationSlider()
+ {
+ try
+ {
+ PIDSlider.setClosed(true);
+ PIDSlider = null;
+ }
+ catch (Exception ex)
+ {
+ }
+
+ if (!conservationSlider.isVisible())
+ {
+ Desktop.addInternalFrame(conservationSlider,
+ conservationSlider.getTitle(), 420, 90, false);
+ conservationSlider.addInternalFrameListener(new javax.swing.event.
+ InternalFrameAdapter()
+ {
+ public void internalFrameClosed(
+ javax.swing.event.InternalFrameEvent e)
+ {
+ conservationSlider = null;
+ }
+ });
+ conservationSlider.setLayer(JLayeredPane.PALETTE_LAYER);
+ }
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param ap DOCUMENT ME!
+ * @param cs DOCUMENT ME!
+ * @param source DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public static int setPIDSliderSource(AlignmentPanel ap, ColourSchemeI cs,
+ String source)
+ {
+ SliderPanel pid = null;
+
+ int threshold = cs.getThreshold();
+
+ if (PIDSlider == null)
+ {
+ pid = new SliderPanel(ap, threshold, false, cs);
+ PIDSlider = new JInternalFrame();
+ PIDSlider.setContentPane(pid);
+ PIDSlider.setLayer(JLayeredPane.PALETTE_LAYER);
+ }
+ else
+ {
+ pid = (SliderPanel) PIDSlider.getContentPane();
+ pid.cs = cs;
+ }
+
+ PIDSlider.setTitle("Percentage Identity Threshold (" + source + ")");
+
+ if (ap.av.alignment.getGroups() != null)
+ {
+ pid.setAllGroupsCheckEnabled(true);
+ }
+ else
+ {
+ pid.setAllGroupsCheckEnabled(false);
+ }
+
+ return pid.getValue();
+ }
+
+ /**
+ * DOCUMENT ME!
+ */
+ public static void showPIDSlider()
+ {
+ try
+ {
+ conservationSlider.setClosed(true);
+ conservationSlider = null;
+ }
+ catch (Exception ex)
+ {
+ }
+
+ if (!PIDSlider.isVisible())
+ {
+ Desktop.addInternalFrame(PIDSlider, PIDSlider.getTitle(), 420, 90,
+ false);
+ PIDSlider.setLayer(JLayeredPane.PALETTE_LAYER);
+ PIDSlider.addInternalFrameListener(new javax.swing.event.
+ InternalFrameAdapter()
+ {
+ public void internalFrameClosed(
+ javax.swing.event.InternalFrameEvent e)
+ {
+ PIDSlider = null;
+ }
+ });
+ PIDSlider.setLayer(JLayeredPane.PALETTE_LAYER);
+ }
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param i DOCUMENT ME!
+ */
+ public void valueChanged(int i)
+ {
+ if (cs == null)
+ {
+ return;
+ }
+
+ ColourSchemeI toChange = null;
+ Vector allGroups = null;
+ int groupIndex = 0;
+
+ if (allGroupsCheck.isSelected())
+ {
+ allGroups = ap.av.alignment.getGroups();
+ groupIndex = allGroups.size() - 1;
+ }
+ else
+ {
+ toChange = cs;
+ }
+
+ while (groupIndex > -1)
+ {
+ if (allGroups != null)
+ {
+ toChange = ( (SequenceGroup) allGroups.get(groupIndex)).cs;
+
+ if (toChange == null)
+ {
+ groupIndex--;
+
+ continue;
+ }
+ }
+
+ if (forConservation)
+ {
+ if (toChange.conservationApplied())
+ {
+ toChange.setConservationInc(i);
+ }
+ }
+ else
+ {
+ toChange.setThreshold(i, ap.av.getIgnoreGapsConsensus());
+ }
+
+ groupIndex--;
+ }
+
+ ap.seqPanel.seqCanvas.repaint();
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param b DOCUMENT ME!
+ */
+ public void setAllGroupsCheckEnabled(boolean b)
+ {
+ allGroupsCheck.setEnabled(b);
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param e DOCUMENT ME!
+ */
+ public void valueField_actionPerformed(ActionEvent e)
+ {
+ try
+ {
+ int i = Integer.parseInt(valueField.getText());
+ slider.setValue(i);
+ }
+ catch (NumberFormatException ex)
+ {
+ valueField.setText(slider.getValue() + "");
+ }
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param value DOCUMENT ME!
+ */
+ public void setValue(int value)
+ {
+ slider.setValue(value);
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public int getValue()
+ {
+ return Integer.parseInt(valueField.getText());
+ }
+
+ public void slider_mouseReleased(MouseEvent e)
+ {
+ if (ap.overviewPanel != null)
+ {
+ ap.overviewPanel.updateOverviewImage();
+ }
+ }
+
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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
-package jalview.gui;\r
-\r
-import java.util.*;\r
-\r
-import java.awt.*;\r
-import java.awt.event.*;\r
-import javax.swing.*;\r
-import javax.swing.event.*;\r
-\r
-import jalview.datamodel.*;\r
-\r
-public class TextColourChooser\r
-{\r
- AlignmentPanel ap;\r
- SequenceGroup sg;\r
-\r
- public void chooseColour(AlignmentPanel ap, SequenceGroup sg)\r
- {\r
- this.ap = ap;\r
- this.sg = sg;\r
-\r
- int original1, original2, originalThreshold;\r
- if (sg == null)\r
- {\r
- original1 = ap.av.textColour.getRGB();\r
- original2 = ap.av.textColour2.getRGB();\r
- originalThreshold = ap.av.thresholdTextColour;\r
- }\r
- else\r
- {\r
- original1 = sg.textColour.getRGB();\r
- original2 = sg.textColour2.getRGB();\r
- originalThreshold = sg.thresholdTextColour;\r
- }\r
-\r
- final JSlider slider = new JSlider(0, 750, originalThreshold);\r
- final JPanel col1 = new JPanel();\r
- col1.setPreferredSize(new Dimension(40, 20));\r
- col1.setBorder(BorderFactory.createEtchedBorder());\r
- col1.setToolTipText("Dark Colour");\r
- col1.setBackground(new Color(original1));\r
- final JPanel col2 = new JPanel();\r
- col2.setPreferredSize(new Dimension(40, 20));\r
- col2.setBorder(BorderFactory.createEtchedBorder());\r
- col2.setToolTipText("Light Colour");\r
- col2.setBackground(new Color(original2));\r
- final JPanel bigpanel = new JPanel(new BorderLayout());\r
- JPanel panel = new JPanel();\r
- bigpanel.add(panel, BorderLayout.CENTER);\r
- bigpanel.add(new JLabel(\r
- "<html><i>Select a dark and light text colour, then set the threshold to"\r
- + "<br>switch between colours, based on background colour</i></html>"),\r
- BorderLayout.NORTH);\r
- panel.add(col1);\r
- panel.add(slider);\r
- panel.add(col2);\r
-\r
- col1.addMouseListener(new MouseAdapter()\r
- {\r
- public void mousePressed(MouseEvent e)\r
- {\r
- Color col = JColorChooser.showDialog(bigpanel,\r
- "Select Colour for Text",\r
- col1.getBackground());\r
- if (col != null)\r
- {\r
- colour1Changed(col);\r
- col1.setBackground(col);\r
- }\r
- }\r
- });\r
-\r
- col2.addMouseListener(new MouseAdapter()\r
- {\r
- public void mousePressed(MouseEvent e)\r
- {\r
- Color col = JColorChooser.showDialog(bigpanel,\r
- "Select Colour for Text",\r
- col2.getBackground());\r
- if (col != null)\r
- {\r
- colour2Changed(col);\r
- col2.setBackground(col);\r
- }\r
- }\r
- });\r
-\r
- slider.addChangeListener(new ChangeListener()\r
- {\r
- public void stateChanged(ChangeEvent evt)\r
- {\r
- thresholdChanged(slider.getValue());\r
- }\r
- });\r
-\r
- int reply = JOptionPane.showInternalOptionDialog(\r
- ap,\r
- bigpanel,\r
- "Adjust Foreground Text Colour Threshold",\r
- JOptionPane.OK_CANCEL_OPTION,\r
- JOptionPane.QUESTION_MESSAGE,\r
- null,\r
- null, null);\r
-\r
- if (reply == JOptionPane.CANCEL_OPTION)\r
- {\r
- if (sg == null)\r
- {\r
- ap.av.textColour = new Color(original1);\r
- ap.av.textColour2 = new Color(original2);\r
- ap.av.thresholdTextColour = originalThreshold;\r
- }\r
- else\r
- {\r
- sg.textColour = new Color(original1);\r
- sg.textColour2 = new Color(original2);\r
- sg.thresholdTextColour = originalThreshold;\r
- }\r
- }\r
- }\r
-\r
- void colour1Changed(Color col)\r
- {\r
- if (sg == null)\r
- {\r
- ap.av.textColour = col;\r
- if (ap.av.colourAppliesToAllGroups)\r
- {\r
- setGroupTextColour();\r
- }\r
- }\r
- else\r
- {\r
- sg.textColour = col;\r
- }\r
-\r
- ap.paintAlignment(true);\r
- }\r
-\r
- void colour2Changed(Color col)\r
- {\r
- if (sg == null)\r
- {\r
- ap.av.textColour2 = col;\r
- if (ap.av.colourAppliesToAllGroups)\r
- {\r
- setGroupTextColour();\r
- }\r
- }\r
- else\r
- {\r
- sg.textColour2 = col;\r
- }\r
-\r
- ap.paintAlignment(true);\r
- }\r
-\r
- void thresholdChanged(int value)\r
- {\r
- if (sg == null)\r
- {\r
- ap.av.thresholdTextColour = value;\r
- if (ap.av.colourAppliesToAllGroups)\r
- {\r
- setGroupTextColour();\r
- }\r
- }\r
- else\r
- {\r
- sg.thresholdTextColour = value;\r
- }\r
-\r
- ap.paintAlignment(true);\r
- }\r
-\r
- void setGroupTextColour()\r
- {\r
- if (ap.av.alignment.getGroups() == null)\r
- {\r
- return;\r
- }\r
-\r
- Vector groups = ap.av.alignment.getGroups();\r
-\r
- for (int i = 0; i < groups.size(); i++)\r
- {\r
- SequenceGroup sg = (SequenceGroup) groups.elementAt(i);\r
- sg.textColour = ap.av.textColour;\r
- sg.textColour2 = ap.av.textColour2;\r
- sg.thresholdTextColour = ap.av.thresholdTextColour;\r
- }\r
- }\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.gui;
+
+import java.util.*;
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.event.*;
+
+import jalview.datamodel.*;
+
+public class TextColourChooser
+{
+ AlignmentPanel ap;
+ SequenceGroup sg;
+
+ public void chooseColour(AlignmentPanel ap, SequenceGroup sg)
+ {
+ this.ap = ap;
+ this.sg = sg;
+
+ int original1, original2, originalThreshold;
+ if (sg == null)
+ {
+ original1 = ap.av.textColour.getRGB();
+ original2 = ap.av.textColour2.getRGB();
+ originalThreshold = ap.av.thresholdTextColour;
+ }
+ else
+ {
+ original1 = sg.textColour.getRGB();
+ original2 = sg.textColour2.getRGB();
+ originalThreshold = sg.thresholdTextColour;
+ }
+
+ final JSlider slider = new JSlider(0, 750, originalThreshold);
+ final JPanel col1 = new JPanel();
+ col1.setPreferredSize(new Dimension(40, 20));
+ col1.setBorder(BorderFactory.createEtchedBorder());
+ col1.setToolTipText("Dark Colour");
+ col1.setBackground(new Color(original1));
+ final JPanel col2 = new JPanel();
+ col2.setPreferredSize(new Dimension(40, 20));
+ col2.setBorder(BorderFactory.createEtchedBorder());
+ col2.setToolTipText("Light Colour");
+ col2.setBackground(new Color(original2));
+ final JPanel bigpanel = new JPanel(new BorderLayout());
+ JPanel panel = new JPanel();
+ bigpanel.add(panel, BorderLayout.CENTER);
+ bigpanel.add(new JLabel(
+ "<html><i>Select a dark and light text colour, then set the threshold to"
+ + "<br>switch between colours, based on background colour</i></html>"),
+ BorderLayout.NORTH);
+ panel.add(col1);
+ panel.add(slider);
+ panel.add(col2);
+
+ col1.addMouseListener(new MouseAdapter()
+ {
+ public void mousePressed(MouseEvent e)
+ {
+ Color col = JColorChooser.showDialog(bigpanel,
+ "Select Colour for Text",
+ col1.getBackground());
+ if (col != null)
+ {
+ colour1Changed(col);
+ col1.setBackground(col);
+ }
+ }
+ });
+
+ col2.addMouseListener(new MouseAdapter()
+ {
+ public void mousePressed(MouseEvent e)
+ {
+ Color col = JColorChooser.showDialog(bigpanel,
+ "Select Colour for Text",
+ col2.getBackground());
+ if (col != null)
+ {
+ colour2Changed(col);
+ col2.setBackground(col);
+ }
+ }
+ });
+
+ slider.addChangeListener(new ChangeListener()
+ {
+ public void stateChanged(ChangeEvent evt)
+ {
+ thresholdChanged(slider.getValue());
+ }
+ });
+
+ int reply = JOptionPane.showInternalOptionDialog(
+ ap,
+ bigpanel,
+ "Adjust Foreground Text Colour Threshold",
+ JOptionPane.OK_CANCEL_OPTION,
+ JOptionPane.QUESTION_MESSAGE,
+ null,
+ null, null);
+
+ if (reply == JOptionPane.CANCEL_OPTION)
+ {
+ if (sg == null)
+ {
+ ap.av.textColour = new Color(original1);
+ ap.av.textColour2 = new Color(original2);
+ ap.av.thresholdTextColour = originalThreshold;
+ }
+ else
+ {
+ sg.textColour = new Color(original1);
+ sg.textColour2 = new Color(original2);
+ sg.thresholdTextColour = originalThreshold;
+ }
+ }
+ }
+
+ void colour1Changed(Color col)
+ {
+ if (sg == null)
+ {
+ ap.av.textColour = col;
+ if (ap.av.colourAppliesToAllGroups)
+ {
+ setGroupTextColour();
+ }
+ }
+ else
+ {
+ sg.textColour = col;
+ }
+
+ ap.paintAlignment(true);
+ }
+
+ void colour2Changed(Color col)
+ {
+ if (sg == null)
+ {
+ ap.av.textColour2 = col;
+ if (ap.av.colourAppliesToAllGroups)
+ {
+ setGroupTextColour();
+ }
+ }
+ else
+ {
+ sg.textColour2 = col;
+ }
+
+ ap.paintAlignment(true);
+ }
+
+ void thresholdChanged(int value)
+ {
+ if (sg == null)
+ {
+ ap.av.thresholdTextColour = value;
+ if (ap.av.colourAppliesToAllGroups)
+ {
+ setGroupTextColour();
+ }
+ }
+ else
+ {
+ sg.thresholdTextColour = value;
+ }
+
+ ap.paintAlignment(true);
+ }
+
+ void setGroupTextColour()
+ {
+ if (ap.av.alignment.getGroups() == null)
+ {
+ return;
+ }
+
+ Vector groups = ap.av.alignment.getGroups();
+
+ for (int i = 0; i < groups.size(); i++)
+ {
+ SequenceGroup sg = (SequenceGroup) groups.elementAt(i);
+ sg.textColour = ap.av.textColour;
+ sg.textColour2 = ap.av.textColour2;
+ sg.thresholdTextColour = ap.av.thresholdTextColour;
+ }
+ }
+
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.gui;
import java.io.*;
-/**
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.gui;
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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
-public class AMSAFile\r
- extends jalview.io.FastaFile\r
-{\r
-\r
- AlignmentI al;\r
- /**\r
- * Creates a new AMSAFile object for output.\r
- */\r
- public AMSAFile(AlignmentI al)\r
- {\r
- this.al = al;\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @return DOCUMENT ME!\r
- */\r
- public String print()\r
- {\r
- super.print(getSeqsAsArray());\r
-\r
- AlignmentAnnotation aa;\r
- if (al.getAlignmentAnnotation() != null)\r
- {\r
-\r
- for (int i = 0; i < al.getAlignmentAnnotation().length; i++)\r
- {\r
- aa = al.getAlignmentAnnotation()[i];\r
-\r
-\r
- if (aa.autoCalculated || !aa.visible)\r
- {\r
- continue;\r
- }\r
-\r
- out.append(">#_" + aa.label);\r
- if (aa.description != null)\r
- {\r
- out.append(" " + aa.description);\r
- }\r
-\r
- out.append("\n");\r
-\r
- int nochunks = Math.min(aa.annotations.length, al.getWidth())\r
- / len + 1;\r
-\r
- for (int j = 0; j < nochunks; j++)\r
- {\r
- int start = j * len;\r
- int end = start + len;\r
- if (end > aa.annotations.length)\r
- {\r
- end = aa.annotations.length;\r
- }\r
-\r
- String ch;\r
- for (int k = start; k < end; k++)\r
- {\r
- if (aa.annotations[k] == null)\r
- {\r
- ch = " ";\r
- }\r
- else\r
- {\r
- ch = aa.annotations[k].displayCharacter;\r
- }\r
-\r
- out.append(ch);\r
-\r
- }\r
- out.append("\n");\r
- }\r
- }\r
- }\r
- return out.toString();\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.io;
+
+import jalview.datamodel.*;
+
+public class AMSAFile
+ extends jalview.io.FastaFile
+{
+
+ AlignmentI al;
+ /**
+ * Creates a new AMSAFile object for output.
+ */
+ public AMSAFile(AlignmentI al)
+ {
+ this.al = al;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public String print()
+ {
+ super.print(getSeqsAsArray());
+
+ AlignmentAnnotation aa;
+ if (al.getAlignmentAnnotation() != null)
+ {
+
+ for (int i = 0; i < al.getAlignmentAnnotation().length; i++)
+ {
+ aa = al.getAlignmentAnnotation()[i];
+
+
+ if (aa.autoCalculated || !aa.visible)
+ {
+ continue;
+ }
+
+ out.append(">#_" + aa.label);
+ if (aa.description != null)
+ {
+ out.append(" " + aa.description);
+ }
+
+ out.append("\n");
+
+ int nochunks = Math.min(aa.annotations.length, al.getWidth())
+ / len + 1;
+
+ for (int j = 0; j < nochunks; j++)
+ {
+ int start = j * len;
+ int end = start + len;
+ if (end > aa.annotations.length)
+ {
+ end = aa.annotations.length;
+ }
+
+ String ch;
+ for (int k = start; k < end; k++)
+ {
+ if (aa.annotations[k] == null)
+ {
+ ch = " ";
+ }
+ else
+ {
+ ch = aa.annotations[k].displayCharacter;
+ }
+
+ out.append(ch);
+
+ }
+ out.append("\n");
+ }
+ }
+ }
+ return out.toString();
+ }
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
- *\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
+ * \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
+ * \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
package jalview.io;\r
\r
import java.io.*;\r
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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.IOException;\r
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
- *\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
+ * \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
+ * \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
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.io;
import java.util.*;
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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.awt.*;\r
-\r
-import jalview.datamodel.*;\r
-import jalview.gui.*;\r
-\r
-public class HTMLOutput\r
-{\r
- AlignViewport av;\r
- SequenceRenderer sr;\r
- FeatureRenderer fr;\r
- Color color;\r
-\r
- public HTMLOutput(AlignmentPanel ap, SequenceRenderer sr, FeatureRenderer fr1)\r
- {\r
- this.av = ap.av;\r
- this.sr = sr;\r
-\r
- fr = new FeatureRenderer(ap);\r
- fr.transferSettings(fr1);\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
- if (av.getFont().getStyle() == Font.ITALIC)\r
- {\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
-\r
- if (av.getWrapAlignment())\r
- {\r
- drawWrappedAlignment(out);\r
- }\r
- else\r
- {\r
- drawUnwrappedAlignment(out);\r
- }\r
-\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
- SequenceI seq;\r
- AlignmentI alignment = av.getAlignment();\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
-\r
- for (i = 0; i < alignment.getHeight(); i++)\r
- {\r
- seq = alignment.getSequenceAt(i);\r
-\r
- String id = seq.getDisplayId(av.getShowJVSuffix());\r
-\r
- out.println("<tr><td nowrap>" + id +\r
- " </td>");\r
-\r
- for (int res = 0; res < seq.getLength(); res++)\r
- {\r
- if (!jalview.util.Comparison.isGap(seq.getCharAt(res)))\r
- {\r
- color = sr.getResidueBoxColour(seq, res);\r
-\r
- color = fr.findFeatureColour(color, seq, res);\r
- }\r
- else\r
- {\r
- color = Color.white;\r
- }\r
-\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
- out.println("</tr>");\r
- }\r
-\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
- SequenceI seq;\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.getWrappedWidth())\r
- {\r
- int endRes = startRes + av.getWrappedWidth();\r
-\r
- if (endRes > al.getWidth())\r
- {\r
- endRes = al.getWidth();\r
- }\r
-\r
- if (av.getScaleAboveWrapped())\r
- {\r
- out.println("<tr>");\r
-\r
- if (av.getScaleLeftWrapped())\r
- {\r
- out.println("<td colspan=\"7\"> </td>");\r
- }\r
- else\r
- {\r
- out.println("<td colspan=\"6\"> </td>");\r
- }\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("</tr>");\r
- }\r
-\r
- int startPos, endPos;\r
- for (int s = 0; s < al.getHeight(); s++)\r
- {\r
- out.println("<tr>");\r
- seq = al.getSequenceAt(s);\r
-\r
- startPos = seq.findPosition(startRes);\r
- endPos = seq.findPosition(endRes) - 1;\r
-\r
- String id = seq.getDisplayId(av.getShowJVSuffix());\r
-\r
- out.println("<td nowrap>" + id +\r
- " </td>");\r
-\r
- if (av.getScaleLeftWrapped())\r
- {\r
- if (startPos > seq.getEnd() || endPos == 0)\r
- {\r
- out.println("<td nowrap> </td>");\r
- }\r
- else\r
- {\r
- out.println("<td nowrap>" + startPos +\r
- " </td>");\r
- }\r
- }\r
-\r
- for (int res = startRes; res < endRes; res++)\r
- {\r
- if (!jalview.util.Comparison.isGap(seq.getCharAt(res)))\r
- {\r
- color = sr.getResidueBoxColour(seq, res);\r
-\r
- color = fr.findFeatureColour(color, seq, res);\r
- }\r
- else\r
- {\r
- color = Color.white;\r
- }\r
-\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
- if (av.getScaleRightWrapped() &&\r
- endRes < startRes + av.getWrappedWidth())\r
- {\r
- out.println("<td colspan=\"" +\r
- (startRes + av.getWrappedWidth() - endRes) + "\">"\r
- + " </td>");\r
- }\r
-\r
- if (av.getScaleRightWrapped() && startPos < endPos)\r
- {\r
- out.println("<td nowrap> " + endPos +\r
- " </td>");\r
- }\r
-\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
- +\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
- +\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
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.io;
+
+import java.io.*;
+
+import java.awt.*;
+
+import jalview.datamodel.*;
+import jalview.gui.*;
+
+public class HTMLOutput
+{
+ AlignViewport av;
+ SequenceRenderer sr;
+ FeatureRenderer fr;
+ Color color;
+
+ public HTMLOutput(AlignmentPanel ap, SequenceRenderer sr, FeatureRenderer fr1)
+ {
+ this.av = ap.av;
+ this.sr = sr;
+
+ fr = new FeatureRenderer(ap);
+ fr.transferSettings(fr1);
+
+ JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.
+ getProperty(
+ "LAST_DIRECTORY"), new String[]
+ {"html"},
+ new String[]
+ {"HTML files"}, "HTML files");
+
+ chooser.setFileView(new JalviewFileView());
+ chooser.setDialogTitle("Save as HTML");
+ chooser.setToolTipText("Save");
+
+ int value = chooser.showSaveDialog(null);
+
+ if (value == JalviewFileChooser.APPROVE_OPTION)
+ {
+ String choice = chooser.getSelectedFile().getPath();
+ jalview.bin.Cache.setProperty("LAST_DIRECTORY",
+ chooser.getSelectedFile().getParent());
+
+ try
+ {
+ PrintWriter out = new java.io.PrintWriter(new java.io.FileWriter(
+ choice));
+ out.println("<HTML>");
+ out.println("<style type=\"text/css\">");
+ out.println("<!--");
+ out.print("td {font-family: \"" + av.getFont().getFamily() +
+ "\", \"" + av.getFont().getName() + "\", mono; " +
+ "font-size: " + av.getFont().getSize() + "px; ");
+
+ if (av.getFont().getStyle() == Font.BOLD)
+ {
+ out.print("font-weight: BOLD; ");
+ }
+
+ if (av.getFont().getStyle() == Font.ITALIC)
+ {
+ out.print("font-style: italic; ");
+ }
+
+ out.println("text-align: center; }");
+
+ out.println("-->");
+ out.println("</style>");
+ out.println("<BODY>");
+
+ if (av.getWrapAlignment())
+ {
+ drawWrappedAlignment(out);
+ }
+ else
+ {
+ drawUnwrappedAlignment(out);
+ }
+
+ out.println("\n</body>\n</html>");
+ out.close();
+ jalview.util.BrowserLauncher.openURL("file:///" + choice);
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+ }
+
+ void drawUnwrappedAlignment(PrintWriter out)
+ {
+ out.println("<table border=\"1\"><tr><td>\n");
+ out.println(
+ "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n");
+
+ //////////////
+ SequenceI seq;
+ AlignmentI alignment = av.getAlignment();
+
+ // draws the top row, the measure rule
+ out.println("<tr><td colspan=\"6\"></td>");
+
+ int i = 0;
+
+ for (i = 10; i < (alignment.getWidth() - 10); i += 10)
+ {
+ out.println("<td colspan=\"9\">" + i + "<br>|</td><td></td>");
+ }
+
+ out.println("<td colspan=\"3\"></td><td colspan=\"3\">" + i +
+ "<br>|</td>");
+ out.println("</tr>");
+
+ for (i = 0; i < alignment.getHeight(); i++)
+ {
+ seq = alignment.getSequenceAt(i);
+
+ String id = seq.getDisplayId(av.getShowJVSuffix());
+
+ out.println("<tr><td nowrap>" + id +
+ " </td>");
+
+ for (int res = 0; res < seq.getLength(); res++)
+ {
+ if (!jalview.util.Comparison.isGap(seq.getCharAt(res)))
+ {
+ color = sr.getResidueBoxColour(seq, res);
+
+ color = fr.findFeatureColour(color, seq, res);
+ }
+ else
+ {
+ color = Color.white;
+ }
+
+ if (color.getRGB() < -1)
+ {
+ out.println("<td bgcolor=\"#" +
+ jalview.util.Format.getHexString(color) + "\">" +
+ seq.getCharAt(res) + "</td>");
+ }
+ else
+ {
+ out.println("<td>" + seq.getCharAt(res) + "</td>");
+ }
+ }
+
+ out.println("</tr>");
+ }
+
+ //////////////
+ out.println("</table>");
+ out.println("</td></tr></table>");
+ }
+
+ void drawWrappedAlignment(PrintWriter out)
+ {
+ ////////////////////////////////////
+ /// How many sequences and residues can we fit on a printable page?
+ AlignmentI al = av.getAlignment();
+ SequenceI seq;
+ String r;
+ String g;
+ String b;
+
+ out.println("<table border=\"1\"><tr><td>\n");
+ out.println(
+ "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n");
+
+ for (int startRes = 0; startRes < al.getWidth();
+ startRes += av.getWrappedWidth())
+ {
+ int endRes = startRes + av.getWrappedWidth();
+
+ if (endRes > al.getWidth())
+ {
+ endRes = al.getWidth();
+ }
+
+ if (av.getScaleAboveWrapped())
+ {
+ out.println("<tr>");
+
+ if (av.getScaleLeftWrapped())
+ {
+ out.println("<td colspan=\"7\"> </td>");
+ }
+ else
+ {
+ out.println("<td colspan=\"6\"> </td>");
+ }
+
+ for (int i = startRes + 10; i < endRes; i += 10)
+ {
+ out.println("<td colspan=\"9\">" + i + "<br>|</td><td></td>");
+ }
+
+ out.println("</tr>");
+ }
+
+ int startPos, endPos;
+ for (int s = 0; s < al.getHeight(); s++)
+ {
+ out.println("<tr>");
+ seq = al.getSequenceAt(s);
+
+ startPos = seq.findPosition(startRes);
+ endPos = seq.findPosition(endRes) - 1;
+
+ String id = seq.getDisplayId(av.getShowJVSuffix());
+
+ out.println("<td nowrap>" + id +
+ " </td>");
+
+ if (av.getScaleLeftWrapped())
+ {
+ if (startPos > seq.getEnd() || endPos == 0)
+ {
+ out.println("<td nowrap> </td>");
+ }
+ else
+ {
+ out.println("<td nowrap>" + startPos +
+ " </td>");
+ }
+ }
+
+ for (int res = startRes; res < endRes; res++)
+ {
+ if (!jalview.util.Comparison.isGap(seq.getCharAt(res)))
+ {
+ color = sr.getResidueBoxColour(seq, res);
+
+ color = fr.findFeatureColour(color, seq, res);
+ }
+ else
+ {
+ color = Color.white;
+ }
+
+ if (color.getRGB() < -1)
+ {
+ out.println("<td bgcolor=\"#" +
+ jalview.util.Format.getHexString(color) + "\">" +
+ seq.getCharAt(res) + "</td>");
+ }
+ else
+ {
+ out.println("<td>" + seq.getCharAt(res) + "</td>");
+ }
+
+ }
+
+ if (av.getScaleRightWrapped() &&
+ endRes < startRes + av.getWrappedWidth())
+ {
+ out.println("<td colspan=\"" +
+ (startRes + av.getWrappedWidth() - endRes) + "\">"
+ + " </td>");
+ }
+
+ if (av.getScaleRightWrapped() && startPos < endPos)
+ {
+ out.println("<td nowrap> " + endPos +
+ " </td>");
+ }
+
+ out.println("</tr>");
+ }
+
+ if (endRes < al.getWidth())
+ {
+ out.println("<tr><td height=\"5\"></td></tr>");
+ }
+ }
+
+ out.println("</table>");
+ out.println("</table>");
+ }
+
+ public static String getImageMapHTML()
+ {
+ return new String(
+ "<html>\n"
+ + "<head>\n"
+ + "<script language=\"JavaScript\">\n"
+ + "var ns4 = document.layers;\n"
+ + "var ns6 = document.getElementById && !document.all;\n"
+ + "var ie4 = document.all;\n"
+ + "offsetX = 0;\n"
+ + "offsetY = 20;\n"
+ + "var toolTipSTYLE=\"\";\n"
+ + "function initToolTips()\n"
+ + "{\n"
+ + " if(ns4||ns6||ie4)\n"
+ + " {\n"
+ + " if(ns4) toolTipSTYLE = document.toolTipLayer;\n"
+ + " else if(ns6) toolTipSTYLE = document.getElementById(\"toolTipLayer\").style;\n"
+ + " else if(ie4) toolTipSTYLE = document.all.toolTipLayer.style;\n"
+ + " if(ns4) document.captureEvents(Event.MOUSEMOVE);\n"
+ + " else\n"
+ + " {\n"
+ + " toolTipSTYLE.visibility = \"visible\";\n"
+ + " toolTipSTYLE.display = \"none\";\n"
+ + " }\n"
+ + " document.onmousemove = moveToMouseLoc;\n"
+ + " }\n"
+ + "}\n"
+ + "function toolTip(msg, fg, bg)\n"
+ + "{\n"
+ + " if(toolTip.arguments.length < 1) // hide\n"
+ + " {\n"
+ + " if(ns4) toolTipSTYLE.visibility = \"hidden\";\n"
+ + " else toolTipSTYLE.display = \"none\";\n"
+ + " }\n"
+ + " else // show\n"
+ + " {\n"
+ + " if(!fg) fg = \"#555555\";\n"
+ + " if(!bg) bg = \"#FFFFFF\";\n"
+ + " var content =\n"
+ + " '<table border=\"0\" cellspacing=\"0\" cellpadding=\"1\" bgcolor=\"' + fg + '\"><td>' +\n"
+ + " '<table border=\"0\" cellspacing=\"0\" cellpadding=\"1\" bgcolor=\"' + bg + \n"
+ +
+ " '\"><td align=\"center\"><font face=\"sans-serif\" color=\"' + fg +\n"
+ + " '\" size=\"-2\"> ' + msg +\n"
+ + " ' </font></td></table></td></table>';\n"
+ + " if(ns4)\n"
+ + " {\n"
+ + " toolTipSTYLE.document.write(content);\n"
+ + " toolTipSTYLE.document.close();\n"
+ + " toolTipSTYLE.visibility = \"visible\";\n"
+ + " }\n"
+ + " if(ns6)\n"
+ + " {\n"
+ +
+ " document.getElementById(\"toolTipLayer\").innerHTML = content;\n"
+ + " toolTipSTYLE.display='block'\n"
+ + " }\n"
+ + " if(ie4)\n"
+ + " {\n"
+ + " document.all(\"toolTipLayer\").innerHTML=content;\n"
+ + " toolTipSTYLE.display='block'\n"
+ + " }\n"
+ + " }\n"
+ + "}\n"
+ + "function moveToMouseLoc(e)\n"
+ + "{\n"
+ + " if(ns4||ns6)\n"
+ + " {\n"
+ + " x = e.pageX;\n"
+ + " y = e.pageY;\n"
+ + " }\n"
+ + " else\n"
+ + " {\n"
+ + " x = event.x + document.body.scrollLeft;\n"
+ + " y = event.y + document.body.scrollTop;\n"
+ + " }\n"
+ + " toolTipSTYLE.left = x + offsetX;\n"
+ + " toolTipSTYLE.top = y + offsetY;\n"
+ + " return true;\n"
+ + "}\n"
+ + "</script>\n"
+ + "</head>\n"
+ + "<body>\n"
+ + "<div id=\"toolTipLayer\" style=\"position:absolute; visibility: hidden\"></div>\n"
+ + "<script language=\"JavaScript\"><!--\n"
+ + "initToolTips(); //--></script>\n");
+
+ }
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
*/
-
/**
* PredFile.java
* JalviewX / Vamsas Project
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.io;
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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
-import java.util.*;\r
-\r
-import javax.swing.filechooser.FileFilter;\r
-\r
-public class JalviewFileFilter\r
- extends FileFilter\r
-{\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
- setDescription(description);\r
- }\r
-\r
- public JalviewFileFilter(String[] filts)\r
- {\r
- this(filts, null);\r
- }\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
- if (description != null)\r
- {\r
- setDescription(description);\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
- return true;\r
- }\r
-\r
- if ( (extension != null) && (filters.get(getExtension(f)) != null))\r
- {\r
- return true;\r
- }\r
- }\r
-\r
- return false;\r
- }\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
- if ( (i > 0) && (i < (filename.length() - 1)))\r
- {\r
- return filename.substring(i + 1).toLowerCase();\r
- }\r
-\r
- ;\r
- }\r
-\r
- return "";\r
- }\r
-\r
- public void addExtension(String extension)\r
- {\r
- if (filters == null)\r
- {\r
- filters = new Hashtable(5);\r
- }\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
- fullDescription += ")";\r
- }\r
- else\r
- {\r
- fullDescription = description;\r
- }\r
- }\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
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.io;
+
+import java.io.*;
+import java.util.*;
+
+import javax.swing.filechooser.FileFilter;
+
+public class JalviewFileFilter
+ extends FileFilter
+{
+ public static Hashtable suffixHash = new Hashtable();
+ private Hashtable filters = null;
+ private String description = "no description";
+ private String fullDescription = "full description";
+ private boolean useExtensionsInDescription = true;
+
+ public JalviewFileFilter(String extension, String description)
+ {
+ StringTokenizer st = new StringTokenizer(extension, ",");
+
+ while (st.hasMoreElements())
+ {
+ addExtension(st.nextToken().trim());
+ }
+
+ setDescription(description);
+ }
+
+ public JalviewFileFilter(String[] filts)
+ {
+ this(filts, null);
+ }
+
+ public JalviewFileFilter(String[] filts, String description)
+ {
+ for (int i = 0; i < filts.length; i++)
+ {
+ // add filters one by one
+ addExtension(filts[i]);
+ }
+
+ if (description != null)
+ {
+ setDescription(description);
+ }
+ }
+
+ public String getAcceptableExtension()
+ {
+ return filters.keys().nextElement().toString();
+ }
+
+ // takes account of the fact that database is a directory
+ public boolean accept(File f)
+ {
+ if (f != null)
+ {
+ String extension = getExtension(f);
+
+ if (f.isDirectory())
+ {
+ return true;
+ }
+
+ if ( (extension != null) && (filters.get(getExtension(f)) != null))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public String getExtension(File f)
+ {
+ if (f != null)
+ {
+ String filename = f.getName();
+ int i = filename.lastIndexOf('.');
+
+ if ( (i > 0) && (i < (filename.length() - 1)))
+ {
+ return filename.substring(i + 1).toLowerCase();
+ }
+
+ ;
+ }
+
+ return "";
+ }
+
+ public void addExtension(String extension)
+ {
+ if (filters == null)
+ {
+ filters = new Hashtable(5);
+ }
+
+ filters.put(extension.toLowerCase(), this);
+ fullDescription = null;
+ }
+
+ public String getDescription()
+ {
+ if (fullDescription == null)
+ {
+ if ( (description == null) || isExtensionListInDescription())
+ {
+ fullDescription = (description == null) ? "(" : (description +
+ " (");
+
+ // build the description from the extension list
+ Enumeration extensions = filters.keys();
+
+ if (extensions != null)
+ {
+ fullDescription += ("." +
+ (String) extensions.nextElement());
+
+ while (extensions.hasMoreElements())
+ {
+ fullDescription += (", " +
+ (String) extensions.nextElement());
+ }
+ }
+
+ fullDescription += ")";
+ }
+ else
+ {
+ fullDescription = description;
+ }
+ }
+
+ return fullDescription;
+ }
+
+ public void setDescription(String description)
+ {
+ this.description = description;
+ fullDescription = null;
+ }
+
+ public void setExtensionListInDescription(boolean b)
+ {
+ useExtensionsInDescription = b;
+ fullDescription = null;
+ }
+
+ public boolean isExtensionListInDescription()
+ {
+ return useExtensionsInDescription;
+ }
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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
-import java.util.*;\r
-\r
-import javax.swing.*;\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
- return type;\r
- }\r
-\r
- public Icon getIcon(File f)\r
- {\r
- String extension = getExtension(f);\r
- Icon icon = null;\r
-\r
- if (extension != null)\r
- {\r
- if (alignSuffix.containsKey(extension))\r
- {\r
- icon = createImageIcon("/images/file.png");\r
- }\r
- }\r
-\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
- return ext;\r
- }\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
- 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
- return null;\r
- }\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.io;
+
+import java.io.*;
+import java.util.*;
+
+import javax.swing.*;
+import javax.swing.filechooser.*;
+
+public class JalviewFileView
+ extends FileView
+{
+ static Hashtable alignSuffix = new Hashtable();
+
+ static
+ {
+ alignSuffix.put("fasta", "Fasta file");
+ alignSuffix.put("fa", "Fasta file");
+ alignSuffix.put("fastq", "Fasta file");
+ alignSuffix.put("blc", "BLC file");
+ alignSuffix.put("msf", "MSF file");
+ alignSuffix.put("pfam", "PFAM file");
+ alignSuffix.put("aln", "Clustal file");
+ alignSuffix.put("pir", "PIR file");
+ alignSuffix.put("jar", "Jalview file");
+ }
+
+ public String getTypeDescription(File f)
+ {
+ String extension = getExtension(f);
+ String type = null;
+
+ if (extension != null)
+ {
+ if (alignSuffix.containsKey(extension))
+ {
+ type = alignSuffix.get(extension).toString();
+ }
+ }
+
+ return type;
+ }
+
+ public Icon getIcon(File f)
+ {
+ String extension = getExtension(f);
+ Icon icon = null;
+
+ if (extension != null)
+ {
+ if (alignSuffix.containsKey(extension))
+ {
+ icon = createImageIcon("/images/file.png");
+ }
+ }
+
+ return icon;
+ }
+
+ /*
+ * Get the extension of a file.
+ */
+ public static String getExtension(File f)
+ {
+ String ext = null;
+ String s = f.getName();
+ int i = s.lastIndexOf('.');
+
+ if ( (i > 0) && (i < (s.length() - 1)))
+ {
+ ext = s.substring(i + 1).toLowerCase();
+ }
+
+ return ext;
+ }
+
+ /** Returns an ImageIcon, or null if the path was invalid. */
+ protected static ImageIcon createImageIcon(String path)
+ {
+ java.net.URL imgURL = JalviewFileView.class.getResource(path);
+
+ if (imgURL != null)
+ {
+ return new ImageIcon(imgURL);
+ }
+ else
+ {
+ System.err.println(
+ "JalviewFileView.createImageIcon: Couldn't find file: " + path);
+
+ return null;
+ }
+ }
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.io;
+ */
+package jalview.io;
import jalview.datamodel.*;
* @param firstSeq int the index of the sequence to attach the annotation to (usually zero)
* @param noMsa boolean
* @param delMap mapping from columns in JPredFile prediction to residue number in al.getSequence(firstSeq)
- */
+ */
public static void add_annotation(JPredFile prediction, AlignmentI al,
int firstSeq, boolean noMsa, int[] delMap)
throws Exception
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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.IOException;\r
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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
-public class ModellerDescription\r
-{\r
- /**\r
- * Translates between a String containing a set of colon-separated values\r
- * on a single line, and sequence start/end and other properties.\r
- * See PIRFile IO for its use.\r
- */\r
- final String[] seqTypes =\r
- {\r
- "sequence", "structure", "structureX", "structureN"};\r
- final String[] Fields =\r
- {\r
- "objectType", "objectId",\r
- "startField", "startCode",\r
- "endField", "endCode",\r
- "description1", "description2",\r
- "resolutionField", "tailField"};\r
- final int TYPE = 0;\r
- final int LOCALID = 1;\r
- final int START = 2;\r
- final int START_CHAIN = 3;\r
- final int END = 4;\r
- final int END_CHAIN = 5;\r
- final int DESCRIPTION1 = 6;\r
- final int DESCRIPTION2 = 7;\r
- final int RESOLUTION = 8;\r
- final int TAIL = 9;\r
-\r
- /**\r
- * 0 is free text or empty\r
- * 1 is something that parses to an integer, or \@\r
- */\r
- final int Types[] =\r
- {\r
- 0, 0, 1, 0, 1, 0, 0, 0, 0, 0\r
- };\r
- final char Padding[] =\r
- {\r
- ' ', ' ', ' ', '.', ' ', '.', '.', '.', '.', '.'\r
- };\r
-\r
- java.util.Hashtable fields = new java.util.Hashtable();\r
- ModellerDescription()\r
- {\r
- fields.put(Fields[TAIL], "");\r
- }\r
-\r
- class resCode\r
- {\r
- Integer val;\r
- String field;\r
- resCode(String f, Integer v)\r
- {\r
- val = v;\r
- field = f;\r
- }\r
-\r
- resCode(int v)\r
- {\r
- val = new Integer(v);\r
- field = val.toString();\r
- }\r
- };\r
-\r
- private resCode validResidueCode(String field)\r
- {\r
- Integer val = null;\r
- com.stevesoft.pat.Regex r = new com.stevesoft.pat.Regex(\r
- "\\s*((([-0-9]+).?)|FIRST|LAST|@)");\r
-\r
- if (!r.search(field))\r
- {\r
- return null; // invalid\r
- }\r
- String value = r.stringMatched(3);\r
- if (value == null)\r
- {\r
- value = r.stringMatched(1);\r
- }\r
- // jalview.bin.Cache.log.debug("from '" + field + "' matched '" + value +\r
- // "'");\r
- try\r
- {\r
- val = Integer.valueOf(value);\r
- return new resCode(field, val); // successful numeric extraction\r
- }\r
- catch (Exception e)\r
- {\r
- }\r
- return new resCode(field, null);\r
- }\r
-\r
- private java.util.Hashtable parseDescription(String desc)\r
- {\r
- java.util.Hashtable fields = new java.util.Hashtable();\r
- java.util.StringTokenizer st = new java.util.StringTokenizer(desc, ":");\r
- String field;\r
- int type = -1;\r
- if (st.countTokens() > 0)\r
- {\r
- // parse colon-fields\r
- int i = 0;\r
- field = st.nextToken(":");\r
- do\r
- {\r
- if (seqTypes[i].equalsIgnoreCase(field))\r
- {\r
- break;\r
- }\r
- }\r
- while (++i < seqTypes.length);\r
-\r
- if (i < seqTypes.length)\r
- {\r
- // valid seqType for modeller\r
- type = i;\r
- i = 1; // continue parsing fields\r
- while (i < TAIL && st.hasMoreTokens())\r
- {\r
- if ( (field = st.nextToken(":")) != null)\r
- {\r
- // validate residue field value\r
- if (Types[i] == 1)\r
- {\r
- resCode val = validResidueCode(field);\r
- if (val != null)\r
- {\r
- fields.put(new String(Fields[i] + "num"), val);\r
- }\r
- else\r
- {\r
- // jalview.bin.Cache.log.debug(\r
- // "Ignoring non-Modeller description: invalid integer-like field '" + field + "'");\r
- type = -1; /* invalid field! - throw the FieldSet away */\r
- }\r
- ;\r
- }\r
- fields.put(Fields[i++], field);\r
- }\r
- }\r
- if (i == TAIL)\r
- {\r
- // slurp remaining fields\r
- while (st.hasMoreTokens())\r
- {\r
- field += ":" + st.nextToken(":");\r
- }\r
- fields.put(Fields[TAIL], field);\r
- }\r
- }\r
- }\r
- if (type == -1)\r
- {\r
- // object is not a proper ModellerPIR object\r
- fields = new java.util.Hashtable();\r
- fields.put(Fields[TAIL], new String(desc));\r
- }\r
- else\r
- {\r
- fields.put(Fields[TYPE], seqTypes[type]);\r
- }\r
- return fields;\r
- }\r
-\r
- ModellerDescription(String desc)\r
- {\r
- if (desc == null)\r
- {\r
- desc = "";\r
- }\r
- fields = parseDescription(desc);\r
- }\r
-\r
- void setStartCode(int v)\r
- {\r
- resCode r;\r
- fields.put(Fields[START] + "num", r = new resCode(v));\r
- fields.put(Fields[START], r.field);\r
- }\r
-\r
- void setEndCode(int v)\r
- {\r
- resCode r;\r
- fields.put(Fields[END] + "num", r = new resCode(v));\r
- fields.put(Fields[END], r.field);\r
- }\r
-\r
- /**\r
- * make a possibly updated modeller field line for the sequence object\r
- * @param seq SequenceI\r
- */\r
- ModellerDescription(SequenceI seq)\r
- {\r
-\r
- if (seq.getDescription() != null)\r
- {\r
- fields = parseDescription(seq.getDescription());\r
- }\r
-\r
- if (isModellerFieldset())\r
- {\r
- // Set start and end before we update the type (in the case of a synthesized field set)\r
- if (getStartNum() != seq.getStart() && getStartCode().val != null)\r
- {\r
- setStartCode(seq.getStart());\r
- }\r
-\r
- if (getEndNum() != seq.getEnd() && getStartCode().val != null)\r
- {\r
- setEndCode(seq.getEnd());\r
- }\r
- }\r
- else\r
- {\r
- // synthesize fields\r
- setStartCode(seq.getStart());\r
- setEndCode(seq.getEnd());\r
- fields.put(Fields[LOCALID], seq.getName()); // this may be overwritten below...\r
- // type - decide based on evidence of PDB database references - this also sets the local reference field\r
- int t = 0; // sequence\r
- if (seq.getDatasetSequence() != null &&\r
- seq.getDatasetSequence().getDBRef() != null)\r
- {\r
- jalview.datamodel.DBRefEntry[] dbr = seq.getDatasetSequence().getDBRef();\r
- int i, j;\r
- for (i = 0, j = dbr.length; i < j; i++)\r
- {\r
- if (dbr[i] != null)\r
- {\r
- // JBPNote PDB dbRefEntry needs properties to propagate onto ModellerField\r
- // JBPNote Need to get info from the user about whether the sequence is the one being modelled, or if it is a template.\r
- if (dbr[i].getSource().equals(jalview.datamodel.DBRefSource.PDB))\r
- {\r
- fields.put(Fields[LOCALID], dbr[i].getAccessionId());\r
- t = 2;\r
- break;\r
- }\r
- }\r
- }\r
- }\r
- fields.put(Fields[TYPE], seqTypes[t]);\r
- }\r
-\r
- }\r
-\r
- /**\r
- * Indicate if fields parsed to a modeller-like colon-separated value line\r
- * @return boolean\r
- */\r
- boolean isModellerFieldset()\r
- {\r
- return (fields.containsKey(Fields[TYPE]));\r
- }\r
-\r
- String getDescriptionLine()\r
- {\r
- String desc = "";\r
- int lastfield = Fields.length - 1;\r
-\r
- if (isModellerFieldset())\r
- {\r
- String value;\r
- // try to write a minimal modeller field set, so..\r
-\r
- // find the last valid field in the entry\r
-\r
- for (; lastfield > 6; lastfield--)\r
- {\r
- if (fields.containsKey(Fields[lastfield]))\r
- {\r
- break;\r
- }\r
- }\r
-\r
- for (int i = 0; i < lastfield; i++)\r
- {\r
- value = (String) fields.get(Fields[i]);\r
- if (value != null && value.length() > 0)\r
- {\r
- desc += ( (String) fields.get(Fields[i])) + ":";\r
- }\r
- else\r
- {\r
- desc += Padding[i] + ":";\r
- }\r
- }\r
- }\r
- // just return the last field if no others were defined.\r
- if (fields.containsKey(Fields[lastfield]))\r
- {\r
- desc += (String) fields.get(Fields[lastfield]);\r
- }\r
- else\r
- {\r
- desc += ".";\r
- }\r
- return desc;\r
- }\r
-\r
- int getStartNum()\r
- {\r
- int start = 0;\r
- resCode val = getStartCode();\r
- if (val.val != null)\r
- {\r
- return val.val.intValue();\r
- }\r
- return start;\r
- }\r
-\r
- resCode getStartCode()\r
- {\r
- if (isModellerFieldset() && fields.containsKey(Fields[START] + "num"))\r
- {\r
- return (resCode) fields.get(Fields[START] + "num");\r
- }\r
- return null;\r
- }\r
-\r
- resCode getEndCode()\r
- {\r
- if (isModellerFieldset() && fields.containsKey(Fields[END] + "num"))\r
- {\r
- return (resCode) fields.get(Fields[END] + "num");\r
- }\r
- return null;\r
- }\r
-\r
- int getEndNum()\r
- {\r
- int end = 0;\r
- resCode val = getEndCode();\r
- if (val.val != null)\r
- {\r
- return val.val.intValue();\r
- }\r
- return end;\r
- }\r
-\r
- /**\r
- * returns true if sequence object was modifed with a valid modellerField set\r
- * @param newSeq SequenceI\r
- * @return boolean\r
- */\r
- boolean updateSequenceI(SequenceI newSeq)\r
- {\r
- if (isModellerFieldset())\r
- {\r
- if (getStartCode().val != null)\r
- {\r
- newSeq.setStart(getStartNum());\r
- }\r
- else\r
- {\r
- newSeq.setStart(1);\r
- }\r
- if (getEndCode().val != null)\r
- {\r
- newSeq.setEnd(getEndNum());\r
- }\r
- else\r
- {\r
- newSeq.setEnd(newSeq.getStart() + newSeq.getLength());\r
- }\r
- return true;\r
- }\r
- return false;\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.io;
+
+import jalview.datamodel.*;
+
+public class ModellerDescription
+{
+ /**
+ * Translates between a String containing a set of colon-separated values
+ * on a single line, and sequence start/end and other properties.
+ * See PIRFile IO for its use.
+ */
+ final String[] seqTypes =
+ {
+ "sequence", "structure", "structureX", "structureN"};
+ final String[] Fields =
+ {
+ "objectType", "objectId",
+ "startField", "startCode",
+ "endField", "endCode",
+ "description1", "description2",
+ "resolutionField", "tailField"};
+ final int TYPE = 0;
+ final int LOCALID = 1;
+ final int START = 2;
+ final int START_CHAIN = 3;
+ final int END = 4;
+ final int END_CHAIN = 5;
+ final int DESCRIPTION1 = 6;
+ final int DESCRIPTION2 = 7;
+ final int RESOLUTION = 8;
+ final int TAIL = 9;
+
+ /**
+ * 0 is free text or empty
+ * 1 is something that parses to an integer, or \@
+ */
+ final int Types[] =
+ {
+ 0, 0, 1, 0, 1, 0, 0, 0, 0, 0
+ };
+ final char Padding[] =
+ {
+ ' ', ' ', ' ', '.', ' ', '.', '.', '.', '.', '.'
+ };
+
+ java.util.Hashtable fields = new java.util.Hashtable();
+ ModellerDescription()
+ {
+ fields.put(Fields[TAIL], "");
+ }
+
+ class resCode
+ {
+ Integer val;
+ String field;
+ resCode(String f, Integer v)
+ {
+ val = v;
+ field = f;
+ }
+
+ resCode(int v)
+ {
+ val = new Integer(v);
+ field = val.toString();
+ }
+ };
+
+ private resCode validResidueCode(String field)
+ {
+ Integer val = null;
+ com.stevesoft.pat.Regex r = new com.stevesoft.pat.Regex(
+ "\\s*((([-0-9]+).?)|FIRST|LAST|@)");
+
+ if (!r.search(field))
+ {
+ return null; // invalid
+ }
+ String value = r.stringMatched(3);
+ if (value == null)
+ {
+ value = r.stringMatched(1);
+ }
+ // jalview.bin.Cache.log.debug("from '" + field + "' matched '" + value +
+ // "'");
+ try
+ {
+ val = Integer.valueOf(value);
+ return new resCode(field, val); // successful numeric extraction
+ }
+ catch (Exception e)
+ {
+ }
+ return new resCode(field, null);
+ }
+
+ private java.util.Hashtable parseDescription(String desc)
+ {
+ java.util.Hashtable fields = new java.util.Hashtable();
+ java.util.StringTokenizer st = new java.util.StringTokenizer(desc, ":");
+ String field;
+ int type = -1;
+ if (st.countTokens() > 0)
+ {
+ // parse colon-fields
+ int i = 0;
+ field = st.nextToken(":");
+ do
+ {
+ if (seqTypes[i].equalsIgnoreCase(field))
+ {
+ break;
+ }
+ }
+ while (++i < seqTypes.length);
+
+ if (i < seqTypes.length)
+ {
+ // valid seqType for modeller
+ type = i;
+ i = 1; // continue parsing fields
+ while (i < TAIL && st.hasMoreTokens())
+ {
+ if ( (field = st.nextToken(":")) != null)
+ {
+ // validate residue field value
+ if (Types[i] == 1)
+ {
+ resCode val = validResidueCode(field);
+ if (val != null)
+ {
+ fields.put(new String(Fields[i] + "num"), val);
+ }
+ else
+ {
+ // jalview.bin.Cache.log.debug(
+ // "Ignoring non-Modeller description: invalid integer-like field '" + field + "'");
+ type = -1; /* invalid field! - throw the FieldSet away */
+ }
+ ;
+ }
+ fields.put(Fields[i++], field);
+ }
+ }
+ if (i == TAIL)
+ {
+ // slurp remaining fields
+ while (st.hasMoreTokens())
+ {
+ field += ":" + st.nextToken(":");
+ }
+ fields.put(Fields[TAIL], field);
+ }
+ }
+ }
+ if (type == -1)
+ {
+ // object is not a proper ModellerPIR object
+ fields = new java.util.Hashtable();
+ fields.put(Fields[TAIL], new String(desc));
+ }
+ else
+ {
+ fields.put(Fields[TYPE], seqTypes[type]);
+ }
+ return fields;
+ }
+
+ ModellerDescription(String desc)
+ {
+ if (desc == null)
+ {
+ desc = "";
+ }
+ fields = parseDescription(desc);
+ }
+
+ void setStartCode(int v)
+ {
+ resCode r;
+ fields.put(Fields[START] + "num", r = new resCode(v));
+ fields.put(Fields[START], r.field);
+ }
+
+ void setEndCode(int v)
+ {
+ resCode r;
+ fields.put(Fields[END] + "num", r = new resCode(v));
+ fields.put(Fields[END], r.field);
+ }
+
+ /**
+ * make a possibly updated modeller field line for the sequence object
+ * @param seq SequenceI
+ */
+ ModellerDescription(SequenceI seq)
+ {
+
+ if (seq.getDescription() != null)
+ {
+ fields = parseDescription(seq.getDescription());
+ }
+
+ if (isModellerFieldset())
+ {
+ // Set start and end before we update the type (in the case of a synthesized field set)
+ if (getStartNum() != seq.getStart() && getStartCode().val != null)
+ {
+ setStartCode(seq.getStart());
+ }
+
+ if (getEndNum() != seq.getEnd() && getStartCode().val != null)
+ {
+ setEndCode(seq.getEnd());
+ }
+ }
+ else
+ {
+ // synthesize fields
+ setStartCode(seq.getStart());
+ setEndCode(seq.getEnd());
+ fields.put(Fields[LOCALID], seq.getName()); // this may be overwritten below...
+ // type - decide based on evidence of PDB database references - this also sets the local reference field
+ int t = 0; // sequence
+ if (seq.getDatasetSequence() != null &&
+ seq.getDatasetSequence().getDBRef() != null)
+ {
+ jalview.datamodel.DBRefEntry[] dbr = seq.getDatasetSequence().getDBRef();
+ int i, j;
+ for (i = 0, j = dbr.length; i < j; i++)
+ {
+ if (dbr[i] != null)
+ {
+ // JBPNote PDB dbRefEntry needs properties to propagate onto ModellerField
+ // JBPNote Need to get info from the user about whether the sequence is the one being modelled, or if it is a template.
+ if (dbr[i].getSource().equals(jalview.datamodel.DBRefSource.PDB))
+ {
+ fields.put(Fields[LOCALID], dbr[i].getAccessionId());
+ t = 2;
+ break;
+ }
+ }
+ }
+ }
+ fields.put(Fields[TYPE], seqTypes[t]);
+ }
+
+ }
+
+ /**
+ * Indicate if fields parsed to a modeller-like colon-separated value line
+ * @return boolean
+ */
+ boolean isModellerFieldset()
+ {
+ return (fields.containsKey(Fields[TYPE]));
+ }
+
+ String getDescriptionLine()
+ {
+ String desc = "";
+ int lastfield = Fields.length - 1;
+
+ if (isModellerFieldset())
+ {
+ String value;
+ // try to write a minimal modeller field set, so..
+
+ // find the last valid field in the entry
+
+ for (; lastfield > 6; lastfield--)
+ {
+ if (fields.containsKey(Fields[lastfield]))
+ {
+ break;
+ }
+ }
+
+ for (int i = 0; i < lastfield; i++)
+ {
+ value = (String) fields.get(Fields[i]);
+ if (value != null && value.length() > 0)
+ {
+ desc += ( (String) fields.get(Fields[i])) + ":";
+ }
+ else
+ {
+ desc += Padding[i] + ":";
+ }
+ }
+ }
+ // just return the last field if no others were defined.
+ if (fields.containsKey(Fields[lastfield]))
+ {
+ desc += (String) fields.get(Fields[lastfield]);
+ }
+ else
+ {
+ desc += ".";
+ }
+ return desc;
+ }
+
+ int getStartNum()
+ {
+ int start = 0;
+ resCode val = getStartCode();
+ if (val.val != null)
+ {
+ return val.val.intValue();
+ }
+ return start;
+ }
+
+ resCode getStartCode()
+ {
+ if (isModellerFieldset() && fields.containsKey(Fields[START] + "num"))
+ {
+ return (resCode) fields.get(Fields[START] + "num");
+ }
+ return null;
+ }
+
+ resCode getEndCode()
+ {
+ if (isModellerFieldset() && fields.containsKey(Fields[END] + "num"))
+ {
+ return (resCode) fields.get(Fields[END] + "num");
+ }
+ return null;
+ }
+
+ int getEndNum()
+ {
+ int end = 0;
+ resCode val = getEndCode();
+ if (val.val != null)
+ {
+ return val.val.intValue();
+ }
+ return end;
+ }
+
+ /**
+ * returns true if sequence object was modifed with a valid modellerField set
+ * @param newSeq SequenceI
+ * @return boolean
+ */
+ boolean updateSequenceI(SequenceI newSeq)
+ {
+ if (isModellerFieldset())
+ {
+ if (getStartCode().val != null)
+ {
+ newSeq.setStart(getStartNum());
+ }
+ else
+ {
+ newSeq.setStart(1);
+ }
+ if (getEndCode().val != null)
+ {
+ newSeq.setEnd(getEndNum());
+ }
+ else
+ {
+ newSeq.setEnd(newSeq.getStart() + newSeq.getLength());
+ }
+ return true;
+ }
+ return false;
+ }
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
*/
-
// NewickFile.java
// Tree I/O
// http://evolution.genetics.washington.edu/phylip/newick_doc.html
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
- *\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
+ * \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
+ * \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
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.io;
import jalview.bin.Cache;
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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.util.*;\r
-\r
-import javax.swing.*;\r
-\r
-import jalview.analysis.*;\r
-import jalview.datamodel.*;\r
-import jalview.gui.*;\r
-import uk.ac.ebi.www.*;\r
-\r
-/**\r
- * DOCUMENT ME!\r
- *\r
- * @author $author$\r
- * @version $Revision$\r
- */\r
-public class WSWUBlastClient\r
-{\r
- AlignmentPanel ap;\r
- AlignmentI al;\r
- CutAndPasteTransfer output = new CutAndPasteTransfer();\r
- int jobsRunning = 0;\r
-\r
- Vector suggestedIds = new Vector();\r
- /**\r
- * Creates a new WSWUBlastClient object.\r
- *\r
- * @param al DOCUMENT ME!\r
- * @param ids DOCUMENT ME!\r
- */\r
- public WSWUBlastClient(AlignmentPanel ap, AlignmentI al, ArrayList ids)\r
- {\r
- this.ap = ap;\r
- this.al = al;\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
- + "\n\nRunning WSWUBlast at EBI."\r
- + "\nPlease quote Pillai S., Silventoinen V., Kallio K., Senger M., Sobhany S., Tate J., Velankar S., Golovin A., Henrick K., Rice P., Stoehr P., Lopez R."\r
- +\r
- "\nSOAP-based services provided by the European Bioinformatics Institute."\r
- + "\nNucleic Acids Res. 33(1):W25-W28 (2005));");\r
-\r
- Desktop.addInternalFrame(output,\r
- "BLASTing for unidentified sequences ", 800, 300);\r
-\r
- for (int i = 0; i < ids.size(); i++)\r
- {\r
- Sequence sequence = (Sequence) ids.get(i);\r
- System.out.println(sequence.getName());\r
-\r
- BlastThread thread = new BlastThread(sequence);\r
- thread.start();\r
- jobsRunning++;\r
- }\r
-\r
- ImageTwirler thread = new ImageTwirler();\r
- thread.start();\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param id1 DOCUMENT ME!\r
- * @param res DOCUMENT ME!\r
- */\r
- void parseResult(Sequence seq, 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" + seq.getName() + " :");\r
-\r
- while (st.hasMoreTokens())\r
- {\r
- data = st.nextToken();\r
-\r
- if (data.indexOf(">UNIPROT") > -1)\r
- {\r
- int index = data.indexOf(">UNIPROT") + 9;\r
- id2 = data.substring(index, data.indexOf(" ", index));\r
-\r
- boolean identitiesFound = false;\r
- while (!identitiesFound)\r
- {\r
- data = st.nextToken();\r
-\r
- if (data.indexOf("Identities") > -1)\r
- {\r
- identitiesFound = true;\r
-\r
- int value = Integer.parseInt(data.substring(data.indexOf(\r
- "(") + 1,\r
- data.indexOf("%")));\r
-\r
- if (value >= maxFound)\r
- {\r
- maxFound = value;\r
- buffer.append(" " + id2 + " " + value + "%; ");\r
- suggestedIds.addElement(new Object[]\r
- {seq, id2});\r
- }\r
- }\r
- }\r
- }\r
- }\r
-\r
- output.appendText(buffer.toString());\r
- }\r
-\r
- void updateIds()\r
- {\r
- // This must be outside the run() body as java 1.5\r
- // will not return any value from the OptionPane to the expired thread.\r
- int reply = JOptionPane.showConfirmDialog(\r
- Desktop.desktop, "Automatically update suggested ids?",\r
- "Auto replace sequence ids", JOptionPane.YES_NO_OPTION);\r
-\r
- if (reply == JOptionPane.YES_OPTION)\r
- {\r
- Enumeration keys = suggestedIds.elements();\r
- while (keys.hasMoreElements())\r
- {\r
- Object[] object = (Object[]) keys.nextElement();\r
-\r
- Sequence oldseq = (Sequence) object[0];\r
-\r
- oldseq.setName(object[1].toString());\r
-\r
- // Oldseq is actually in the dataset, we must find the\r
- // Visible seq and change its name also.\r
- for (int i = 0; i < al.getHeight(); i++)\r
- {\r
- if (al.getSequenceAt(i).getDatasetSequence() == oldseq)\r
- {\r
- al.getSequenceAt(i).setName(oldseq.getName());\r
- break;\r
- }\r
- }\r
-\r
- DBRefEntry[] entries = oldseq.getDBRef();\r
- if (entries != null)\r
- {\r
- oldseq.addDBRef(new jalview.datamodel.\r
- DBRefEntry(jalview.datamodel.DBRefSource.UNIPROT,\r
- "0",\r
- entries[0].getAccessionId()));\r
- }\r
- }\r
- }\r
- ap.paintAlignment(true);\r
-\r
- }\r
-\r
- class ImageTwirler\r
- extends Thread\r
- {\r
- ImageIcon[] imageIcon;\r
- int imageIndex = 0;\r
-\r
- public ImageTwirler()\r
- {\r
- imageIcon = new ImageIcon[9];\r
-\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
- {\r
- imageIcon[i] = new ImageIcon(url);\r
- }\r
- }\r
- }\r
-\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
- }\r
- catch (Exception ex)\r
- {\r
- }\r
- }\r
-\r
- if (jobsRunning == 0)\r
- {\r
- updateIds();\r
- }\r
- }\r
- }\r
-\r
- class BlastThread\r
- extends Thread\r
- {\r
- Sequence sequence;\r
- String jobid;\r
- boolean jobComplete = false;\r
-\r
- BlastThread(Sequence sequence)\r
- {\r
- System.out.println("blasting for: " + sequence.getName());\r
- this.sequence = sequence;\r
- }\r
-\r
- public void run()\r
- {\r
- StartJob();\r
-\r
- while (!jobComplete)\r
- {\r
- try\r
- {\r
- WSWUBlastService service = new WSWUBlastServiceLocator();\r
- WSWUBlast wublast = service.getWSWUBlast();\r
- WSFile[] results = wublast.getResults(jobid);\r
-\r
- if (results != null)\r
- {\r
- String result = new String(wublast.poll(jobid, "tooloutput"));\r
- parseResult(sequence, result);\r
- jobComplete = true;\r
- jobsRunning--;\r
- }\r
- else\r
- {\r
- Thread.sleep(10000);\r
- System.out.println("WSWuBlastClient: I'm alive " +\r
- sequence.getName() + " " + jobid); // log.debug\r
- }\r
- }\r
- catch (Exception ex)\r
- {\r
- }\r
- }\r
- }\r
-\r
- void StartJob()\r
- {\r
- InputParams params = new InputParams();\r
-\r
- params.setProgram("blastp");\r
- params.setDatabase("uniprot");\r
- params.setMatrix("pam10");\r
-\r
- params.setNumal(5);\r
- params.setSensitivity("low");\r
- params.setSort("totalscore");\r
- params.setOutformat("txt");\r
- params.setAsync(true);\r
-\r
- try\r
- {\r
- Data inputs[] = new Data[1];\r
- Data input = new Data();\r
- input.setType("sequence");\r
- input.setContent(AlignSeq.extractGaps("-. ",\r
- sequence.getSequenceAsString()));\r
- inputs[0] = input;\r
-\r
- WSWUBlastService service = new WSWUBlastServiceLocator();\r
- WSWUBlast wublast = service.getWSWUBlast();\r
- jobid = wublast.runWUBlast(params, inputs);\r
- }\r
- catch (Exception exp)\r
- {\r
- jobComplete = true;\r
- jobsRunning--;\r
- System.err.println("WSWUBlastClient error:\n" + exp.toString());\r
- exp.printStackTrace();\r
- }\r
- }\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.io;
+
+import java.util.*;
+
+import javax.swing.*;
+
+import jalview.analysis.*;
+import jalview.datamodel.*;
+import jalview.gui.*;
+import uk.ac.ebi.www.*;
+
+/**
+ * DOCUMENT ME!
+ *
+ * @author $author$
+ * @version $Revision$
+ */
+public class WSWUBlastClient
+{
+ AlignmentPanel ap;
+ AlignmentI al;
+ CutAndPasteTransfer output = new CutAndPasteTransfer();
+ int jobsRunning = 0;
+
+ Vector suggestedIds = new Vector();
+ /**
+ * Creates a new WSWUBlastClient object.
+ *
+ * @param al DOCUMENT ME!
+ * @param ids DOCUMENT ME!
+ */
+ public WSWUBlastClient(AlignmentPanel ap, AlignmentI al, ArrayList ids)
+ {
+ this.ap = ap;
+ this.al = al;
+ output.setText(
+ "To display sequence features an exact Uniprot id with 100% sequence identity match must be entered."
+ + "\nIn order to display these features, try changing the names of your sequences to the ids suggested below."
+ + "\n\nRunning WSWUBlast at EBI."
+ + "\nPlease quote Pillai S., Silventoinen V., Kallio K., Senger M., Sobhany S., Tate J., Velankar S., Golovin A., Henrick K., Rice P., Stoehr P., Lopez R."
+ +
+ "\nSOAP-based services provided by the European Bioinformatics Institute."
+ + "\nNucleic Acids Res. 33(1):W25-W28 (2005));");
+
+ Desktop.addInternalFrame(output,
+ "BLASTing for unidentified sequences ", 800, 300);
+
+ for (int i = 0; i < ids.size(); i++)
+ {
+ Sequence sequence = (Sequence) ids.get(i);
+ System.out.println(sequence.getName());
+
+ BlastThread thread = new BlastThread(sequence);
+ thread.start();
+ jobsRunning++;
+ }
+
+ ImageTwirler thread = new ImageTwirler();
+ thread.start();
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param id1 DOCUMENT ME!
+ * @param res DOCUMENT ME!
+ */
+ void parseResult(Sequence seq, String res)
+ {
+ StringTokenizer st = new StringTokenizer(res, "\n");
+ String data;
+ String id2;
+ int maxFound = 90;
+ StringBuffer buffer = new StringBuffer("\n\n" + seq.getName() + " :");
+
+ while (st.hasMoreTokens())
+ {
+ data = st.nextToken();
+
+ if (data.indexOf(">UNIPROT") > -1)
+ {
+ int index = data.indexOf(">UNIPROT") + 9;
+ id2 = data.substring(index, data.indexOf(" ", index));
+
+ boolean identitiesFound = false;
+ while (!identitiesFound)
+ {
+ data = st.nextToken();
+
+ if (data.indexOf("Identities") > -1)
+ {
+ identitiesFound = true;
+
+ int value = Integer.parseInt(data.substring(data.indexOf(
+ "(") + 1,
+ data.indexOf("%")));
+
+ if (value >= maxFound)
+ {
+ maxFound = value;
+ buffer.append(" " + id2 + " " + value + "%; ");
+ suggestedIds.addElement(new Object[]
+ {seq, id2});
+ }
+ }
+ }
+ }
+ }
+
+ output.appendText(buffer.toString());
+ }
+
+ void updateIds()
+ {
+ // This must be outside the run() body as java 1.5
+ // will not return any value from the OptionPane to the expired thread.
+ int reply = JOptionPane.showConfirmDialog(
+ Desktop.desktop, "Automatically update suggested ids?",
+ "Auto replace sequence ids", JOptionPane.YES_NO_OPTION);
+
+ if (reply == JOptionPane.YES_OPTION)
+ {
+ Enumeration keys = suggestedIds.elements();
+ while (keys.hasMoreElements())
+ {
+ Object[] object = (Object[]) keys.nextElement();
+
+ Sequence oldseq = (Sequence) object[0];
+
+ oldseq.setName(object[1].toString());
+
+ // Oldseq is actually in the dataset, we must find the
+ // Visible seq and change its name also.
+ for (int i = 0; i < al.getHeight(); i++)
+ {
+ if (al.getSequenceAt(i).getDatasetSequence() == oldseq)
+ {
+ al.getSequenceAt(i).setName(oldseq.getName());
+ break;
+ }
+ }
+
+ DBRefEntry[] entries = oldseq.getDBRef();
+ if (entries != null)
+ {
+ oldseq.addDBRef(new jalview.datamodel.
+ DBRefEntry(jalview.datamodel.DBRefSource.UNIPROT,
+ "0",
+ entries[0].getAccessionId()));
+ }
+ }
+ }
+ ap.paintAlignment(true);
+
+ }
+
+ class ImageTwirler
+ extends Thread
+ {
+ ImageIcon[] imageIcon;
+ int imageIndex = 0;
+
+ public ImageTwirler()
+ {
+ imageIcon = new ImageIcon[9];
+
+ for (int i = 0; i < 9; i++)
+ {
+ java.net.URL url = getClass().getResource("/images/dna" +
+ (i + 1) + ".gif");
+
+ if (url != null)
+ {
+ imageIcon[i] = new ImageIcon(url);
+ }
+ }
+ }
+
+ public void run()
+ {
+ while (jobsRunning > 0)
+ {
+ try
+ {
+ Thread.sleep(100);
+ imageIndex++;
+ imageIndex %= 9;
+ output.setFrameIcon(imageIcon[imageIndex]);
+ output.setTitle("BLASTing for unidentified sequences - " +
+ jobsRunning + " jobs running.");
+ }
+ catch (Exception ex)
+ {
+ }
+ }
+
+ if (jobsRunning == 0)
+ {
+ updateIds();
+ }
+ }
+ }
+
+ class BlastThread
+ extends Thread
+ {
+ Sequence sequence;
+ String jobid;
+ boolean jobComplete = false;
+
+ BlastThread(Sequence sequence)
+ {
+ System.out.println("blasting for: " + sequence.getName());
+ this.sequence = sequence;
+ }
+
+ public void run()
+ {
+ StartJob();
+
+ while (!jobComplete)
+ {
+ try
+ {
+ WSWUBlastService service = new WSWUBlastServiceLocator();
+ WSWUBlast wublast = service.getWSWUBlast();
+ WSFile[] results = wublast.getResults(jobid);
+
+ if (results != null)
+ {
+ String result = new String(wublast.poll(jobid, "tooloutput"));
+ parseResult(sequence, result);
+ jobComplete = true;
+ jobsRunning--;
+ }
+ else
+ {
+ Thread.sleep(10000);
+ System.out.println("WSWuBlastClient: I'm alive " +
+ sequence.getName() + " " + jobid); // log.debug
+ }
+ }
+ catch (Exception ex)
+ {
+ }
+ }
+ }
+
+ void StartJob()
+ {
+ InputParams params = new InputParams();
+
+ params.setProgram("blastp");
+ params.setDatabase("uniprot");
+ params.setMatrix("pam10");
+
+ params.setNumal(5);
+ params.setSensitivity("low");
+ params.setSort("totalscore");
+ params.setOutformat("txt");
+ params.setAsync(true);
+
+ try
+ {
+ Data inputs[] = new Data[1];
+ Data input = new Data();
+ input.setType("sequence");
+ input.setContent(AlignSeq.extractGaps("-. ",
+ sequence.getSequenceAsString()));
+ inputs[0] = input;
+
+ WSWUBlastService service = new WSWUBlastServiceLocator();
+ WSWUBlast wublast = service.getWSWUBlast();
+ jobid = wublast.runWUBlast(params, inputs);
+ }
+ catch (Exception exp)
+ {
+ jobComplete = true;
+ jobsRunning--;
+ System.err.println("WSWUBlastClient error:\n" + exp.toString());
+ exp.printStackTrace();
+ }
+ }
+ }
+}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.io.vamsas;
import jalview.bin.Cache;
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.io.vamsas;
import jalview.datamodel.DBRefEntry;
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.io.vamsas;
import uk.ac.vamsas.client.Vobject;
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.io.vamsas;
}
}
-}
\ No newline at end of file
+}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.io.vamsas;
import java.util.Vector;
}
}
}
-}
\ No newline at end of file
+}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.io.vamsas;
import java.io.IOException;
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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 javax.swing.*;\r
-import javax.swing.border.*;\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 GAlignmentPanel()\r
- {\r
- try\r
- {\r
- jbInit();\r
- }\r
- catch (Exception e)\r
- {\r
- e.printStackTrace();\r
- }\r
- }\r
-\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
-\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
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.jbgui;
+
+import java.awt.*;
+import javax.swing.*;
+import javax.swing.border.*;
+
+public class GAlignmentPanel
+ extends JPanel
+{
+ protected JPanel sequenceHolderPanel = new JPanel();
+ protected JScrollBar vscroll = new JScrollBar();
+ protected JScrollBar hscroll = new JScrollBar();
+ protected JPanel seqPanelHolder = new JPanel();
+ BorderLayout borderLayout1 = new BorderLayout();
+ BorderLayout borderLayout3 = new BorderLayout();
+ protected JPanel scalePanelHolder = new JPanel();
+ protected JPanel idPanelHolder = new JPanel();
+ BorderLayout borderLayout5 = new BorderLayout();
+ protected JPanel idSpaceFillerPanel1 = new JPanel();
+ public JPanel annotationSpaceFillerHolder = new JPanel();
+ BorderLayout borderLayout6 = new BorderLayout();
+ ButtonGroup buttonGroup1 = new ButtonGroup();
+ BorderLayout borderLayout7 = new BorderLayout();
+ JPanel hscrollHolder = new JPanel();
+ BorderLayout borderLayout10 = new BorderLayout();
+ protected JPanel hscrollFillerPanel = new JPanel();
+ BorderLayout borderLayout11 = new BorderLayout();
+ public JScrollPane annotationScroller = new JScrollPane();
+ Border border1;
+ BorderLayout borderLayout4 = new BorderLayout();
+
+ public GAlignmentPanel()
+ {
+ try
+ {
+ jbInit();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ private void jbInit()
+ throws Exception
+ {
+ border1 = BorderFactory.createLineBorder(Color.gray, 1);
+ idPanelHolder.setBorder(null);
+ idPanelHolder.setPreferredSize(new Dimension(70, 10));
+ this.setLayout(borderLayout7);
+ sequenceHolderPanel.setMaximumSize(new Dimension(2147483647, 2147483647));
+ sequenceHolderPanel.setMinimumSize(new Dimension(150, 150));
+ sequenceHolderPanel.setPreferredSize(new Dimension(150, 150));
+ sequenceHolderPanel.setLayout(borderLayout3);
+ seqPanelHolder.setLayout(borderLayout1);
+ scalePanelHolder.setBackground(Color.white);
+ scalePanelHolder.setMinimumSize(new Dimension(10, 80));
+ scalePanelHolder.setPreferredSize(new Dimension(10, 30));
+ scalePanelHolder.setLayout(borderLayout6);
+ idPanelHolder.setLayout(borderLayout5);
+ idSpaceFillerPanel1.setBackground(Color.white);
+ idSpaceFillerPanel1.setPreferredSize(new Dimension(10, 30));
+ idSpaceFillerPanel1.setLayout(borderLayout11);
+ annotationSpaceFillerHolder.setBackground(Color.white);
+ annotationSpaceFillerHolder.setPreferredSize(new Dimension(10, 80));
+ annotationSpaceFillerHolder.setLayout(borderLayout4);
+ hscroll.setOrientation(JScrollBar.HORIZONTAL);
+ hscrollHolder.setLayout(borderLayout10);
+ hscrollFillerPanel.setBackground(Color.white);
+ hscrollFillerPanel.setPreferredSize(new Dimension(70, 10));
+ hscrollHolder.setBackground(Color.white);
+ annotationScroller.setBorder(null);
+ annotationScroller.setPreferredSize(new Dimension(10, 80));
+ this.setPreferredSize(new Dimension(220, 166));
+
+ sequenceHolderPanel.add(scalePanelHolder, BorderLayout.NORTH);
+ sequenceHolderPanel.add(seqPanelHolder, BorderLayout.CENTER);
+ seqPanelHolder.add(vscroll, BorderLayout.EAST);
+ sequenceHolderPanel.add(annotationScroller, BorderLayout.SOUTH);
+
+ // jPanel3.add(secondaryPanelHolder, BorderLayout.SOUTH);
+ this.add(idPanelHolder, BorderLayout.WEST);
+ idPanelHolder.add(idSpaceFillerPanel1, BorderLayout.NORTH);
+ idPanelHolder.add(annotationSpaceFillerHolder, BorderLayout.SOUTH);
+ this.add(hscrollHolder, BorderLayout.SOUTH);
+ hscrollHolder.add(hscroll, BorderLayout.CENTER);
+ hscrollHolder.add(hscrollFillerPanel, BorderLayout.WEST);
+ this.add(sequenceHolderPanel, BorderLayout.CENTER);
+ }
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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
-import javax.swing.*;\r
-\r
-/**\r
- * DOCUMENT ME!\r
- *\r
- * @author $author$\r
- * @version $Revision$\r
- */\r
-public class GCutAndPasteTransfer\r
- extends JInternalFrame\r
-{\r
- protected JTextArea textarea = new JTextArea();\r
- protected JScrollPane scrollPane = new JScrollPane();\r
- BorderLayout borderLayout1 = new BorderLayout();\r
- JMenuBar editMenubar = new JMenuBar();\r
- JMenu editMenu = new JMenu();\r
- JMenuItem copyItem = new JMenuItem();\r
- JMenuItem pasteMenu = new JMenuItem();\r
- BorderLayout borderLayout2 = new BorderLayout();\r
- protected JPanel inputButtonPanel = new JPanel();\r
- protected JButton ok = new JButton();\r
- JButton cancel = new JButton();\r
- JMenuItem selectAll = new JMenuItem();\r
- JMenu jMenu1 = new JMenu();\r
- JMenuItem save = new JMenuItem();\r
-\r
- /**\r
- * Creates a new GCutAndPasteTransfer object.\r
- */\r
- public GCutAndPasteTransfer()\r
- {\r
- try\r
- {\r
- setJMenuBar(editMenubar);\r
- jbInit();\r
- }\r
- catch (Exception e)\r
- {\r
- e.printStackTrace();\r
- }\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @throws Exception DOCUMENT ME!\r
- */\r
- private void jbInit()\r
- throws Exception\r
- {\r
- scrollPane.setBorder(null);\r
- ok.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
- ok.setText("New Window");\r
- ok.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- ok_actionPerformed(e);\r
- }\r
- });\r
- cancel.setText("Close");\r
- cancel.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- cancel_actionPerformed(e);\r
- }\r
- });\r
- textarea.setBorder(null);\r
-\r
- selectAll.setText("Select All");\r
- selectAll.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.\r
- KeyEvent.VK_A, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));\r
- selectAll.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- selectAll_actionPerformed(e);\r
- }\r
- });\r
- jMenu1.setText("File");\r
- save.setText("Save");\r
- save.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.\r
- KeyEvent.VK_S, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));\r
- save.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- save_actionPerformed(e);\r
- }\r
- });\r
- copyItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.\r
- KeyEvent.VK_C, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));\r
- pasteMenu.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.\r
- KeyEvent.VK_V, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));\r
- editMenubar.add(jMenu1);\r
- editMenubar.add(editMenu);\r
- textarea.setFont(new java.awt.Font("Monospaced", Font.PLAIN, 12));\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
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- pasteMenu_actionPerformed(e);\r
- }\r
- });\r
- copyItem.setText("Copy");\r
- copyItem.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- copyItem_actionPerformed(e);\r
- }\r
- });\r
- this.getContentPane().setLayout(borderLayout2);\r
- scrollPane.setBorder(null);\r
- scrollPane.getViewport().add(textarea, null);\r
- editMenu.add(selectAll);\r
- editMenu.add(copyItem);\r
- editMenu.add(pasteMenu);\r
- this.getContentPane().add(scrollPane, java.awt.BorderLayout.CENTER);\r
- inputButtonPanel.add(ok);\r
- inputButtonPanel.add(cancel);\r
- jMenu1.add(save);\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param e DOCUMENT ME!\r
- */\r
- public void textarea_mousePressed(MouseEvent e)\r
- {\r
-\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param e DOCUMENT ME!\r
- */\r
- public void copyItem_actionPerformed(ActionEvent e)\r
- {\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param e DOCUMENT ME!\r
- */\r
- public void pasteMenu_actionPerformed(ActionEvent e)\r
- {\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param e DOCUMENT ME!\r
- */\r
- public void ok_actionPerformed(ActionEvent e)\r
- {\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param e DOCUMENT ME!\r
- */\r
- public void cancel_actionPerformed(ActionEvent e)\r
- {\r
- }\r
-\r
- public void selectAll_actionPerformed(ActionEvent e)\r
- {\r
- textarea.selectAll();\r
- }\r
-\r
- public void save_actionPerformed(ActionEvent e)\r
- {\r
-\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.jbgui;
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+
+/**
+ * DOCUMENT ME!
+ *
+ * @author $author$
+ * @version $Revision$
+ */
+public class GCutAndPasteTransfer
+ extends JInternalFrame
+{
+ protected JTextArea textarea = new JTextArea();
+ protected JScrollPane scrollPane = new JScrollPane();
+ BorderLayout borderLayout1 = new BorderLayout();
+ JMenuBar editMenubar = new JMenuBar();
+ JMenu editMenu = new JMenu();
+ JMenuItem copyItem = new JMenuItem();
+ JMenuItem pasteMenu = new JMenuItem();
+ BorderLayout borderLayout2 = new BorderLayout();
+ protected JPanel inputButtonPanel = new JPanel();
+ protected JButton ok = new JButton();
+ JButton cancel = new JButton();
+ JMenuItem selectAll = new JMenuItem();
+ JMenu jMenu1 = new JMenu();
+ JMenuItem save = new JMenuItem();
+
+ /**
+ * Creates a new GCutAndPasteTransfer object.
+ */
+ public GCutAndPasteTransfer()
+ {
+ try
+ {
+ setJMenuBar(editMenubar);
+ jbInit();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @throws Exception DOCUMENT ME!
+ */
+ private void jbInit()
+ throws Exception
+ {
+ scrollPane.setBorder(null);
+ ok.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
+ ok.setText("New Window");
+ ok.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ ok_actionPerformed(e);
+ }
+ });
+ cancel.setText("Close");
+ cancel.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ cancel_actionPerformed(e);
+ }
+ });
+ textarea.setBorder(null);
+
+ selectAll.setText("Select All");
+ selectAll.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.
+ KeyEvent.VK_A, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));
+ selectAll.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ selectAll_actionPerformed(e);
+ }
+ });
+ jMenu1.setText("File");
+ save.setText("Save");
+ save.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.
+ KeyEvent.VK_S, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));
+ save.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ save_actionPerformed(e);
+ }
+ });
+ copyItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.
+ KeyEvent.VK_C, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));
+ pasteMenu.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.
+ KeyEvent.VK_V, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));
+ editMenubar.add(jMenu1);
+ editMenubar.add(editMenu);
+ textarea.setFont(new java.awt.Font("Monospaced", Font.PLAIN, 12));
+ textarea.addMouseListener(new java.awt.event.MouseAdapter()
+ {
+ public void mousePressed(MouseEvent e)
+ {
+ textarea_mousePressed(e);
+ }
+ });
+ editMenu.setText("Edit");
+ pasteMenu.setText("Paste");
+ pasteMenu.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ pasteMenu_actionPerformed(e);
+ }
+ });
+ copyItem.setText("Copy");
+ copyItem.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ copyItem_actionPerformed(e);
+ }
+ });
+ this.getContentPane().setLayout(borderLayout2);
+ scrollPane.setBorder(null);
+ scrollPane.getViewport().add(textarea, null);
+ editMenu.add(selectAll);
+ editMenu.add(copyItem);
+ editMenu.add(pasteMenu);
+ this.getContentPane().add(scrollPane, java.awt.BorderLayout.CENTER);
+ inputButtonPanel.add(ok);
+ inputButtonPanel.add(cancel);
+ jMenu1.add(save);
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param e DOCUMENT ME!
+ */
+ public void textarea_mousePressed(MouseEvent e)
+ {
+
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param e DOCUMENT ME!
+ */
+ public void copyItem_actionPerformed(ActionEvent e)
+ {
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param e DOCUMENT ME!
+ */
+ public void pasteMenu_actionPerformed(ActionEvent e)
+ {
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param e DOCUMENT ME!
+ */
+ public void ok_actionPerformed(ActionEvent e)
+ {
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param e DOCUMENT ME!
+ */
+ public void cancel_actionPerformed(ActionEvent e)
+ {
+ }
+
+ public void selectAll_actionPerformed(ActionEvent e)
+ {
+ textarea.selectAll();
+ }
+
+ public void save_actionPerformed(ActionEvent e)
+ {
+
+ }
+}
/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
- *\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
+ * \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
+ * \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
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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
-import javax.swing.*;\r
-\r
-/**\r
- * DOCUMENT ME!\r
- *\r
- * @author $author$\r
- * @version $Revision$\r
- */\r
-public class GFontChooser\r
- extends JPanel\r
-{\r
- JLabel jLabel1 = new JLabel();\r
- protected JComboBox fontSize = new JComboBox();\r
- protected JComboBox fontStyle = new JComboBox();\r
- JLabel jLabel2 = new JLabel();\r
- JLabel jLabel3 = new JLabel();\r
- protected JComboBox fontName = new JComboBox();\r
- JButton ok = new JButton();\r
- JButton cancel = new JButton();\r
- JPanel jPanel1 = new JPanel();\r
- JPanel jPanel2 = new JPanel();\r
- JPanel jPanel3 = new JPanel();\r
- BorderLayout borderLayout1 = new BorderLayout();\r
- BorderLayout borderLayout2 = new BorderLayout();\r
- BorderLayout borderLayout3 = new BorderLayout();\r
- protected JButton defaultButton = new JButton();\r
- protected JCheckBox smoothFont = new JCheckBox();\r
- BorderLayout borderLayout4 = new BorderLayout();\r
- protected JCheckBox monospaced = new JCheckBox();\r
- JPanel jPanel4 = new JPanel();\r
-\r
- /**\r
- * Creates a new GFontChooser object.\r
- */\r
- public GFontChooser()\r
- {\r
- try\r
- {\r
- jbInit();\r
- }\r
- catch (Exception e)\r
- {\r
- e.printStackTrace();\r
- }\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @throws Exception DOCUMENT ME!\r
- */\r
- private void jbInit()\r
- throws Exception\r
- {\r
- jLabel1.setFont(new java.awt.Font("Verdana", 0, 11));\r
- jLabel1.setHorizontalAlignment(SwingConstants.RIGHT);\r
- jLabel1.setText("Font: ");\r
- jLabel1.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);\r
- this.setLayout(null);\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
- {\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
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- fontStyle_actionPerformed(e);\r
- }\r
- });\r
- jLabel2.setFont(new java.awt.Font("Verdana", 0, 11));\r
- jLabel2.setHorizontalAlignment(SwingConstants.RIGHT);\r
- jLabel2.setText("Size: ");\r
- jLabel2.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);\r
- jLabel3.setFont(new java.awt.Font("Verdana", 0, 11));\r
- jLabel3.setHorizontalAlignment(SwingConstants.RIGHT);\r
- jLabel3.setText("Style: ");\r
- jLabel3.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);\r
- fontName.setFont(new java.awt.Font("Verdana", 0, 11));\r
- fontName.setMaximumSize(new Dimension(32767, 32767));\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
- {\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
- {\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
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- cancel_actionPerformed(e);\r
- }\r
- });\r
- this.setBackground(Color.white);\r
- jPanel1.setOpaque(false);\r
- jPanel1.setBounds(new Rectangle(5, 6, 308, 23));\r
- jPanel1.setLayout(borderLayout1);\r
- jPanel2.setOpaque(false);\r
- jPanel2.setBounds(new Rectangle(5, 37, 128, 21));\r
- jPanel2.setLayout(borderLayout3);\r
- jPanel3.setOpaque(false);\r
- jPanel3.setBounds(new Rectangle(174, 38, 134, 21));\r
- jPanel3.setLayout(borderLayout2);\r
- defaultButton.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
- defaultButton.setText("Set as Default");\r
- defaultButton.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- defaultButton_actionPerformed(e);\r
- }\r
- });\r
- smoothFont.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
- smoothFont.setOpaque(false);\r
- smoothFont.setText("Anti-alias Fonts (Slower to render)");\r
- smoothFont.setBounds(new Rectangle(41, 65, 223, 23));\r
- smoothFont.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- smoothFont_actionPerformed(e);\r
- }\r
- });\r
- monospaced.setEnabled(false);\r
- monospaced.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
- monospaced.setOpaque(false);\r
- monospaced.setToolTipText("Monospaced fonts are faster to render");\r
- monospaced.setText("Monospaced");\r
- jPanel4.setOpaque(false);\r
- jPanel4.setBounds(new Rectangle(24, 92, 259, 35));\r
- jPanel1.add(jLabel1, BorderLayout.WEST);\r
- jPanel1.add(fontName, BorderLayout.CENTER);\r
- jPanel1.add(monospaced, java.awt.BorderLayout.EAST);\r
- this.add(jPanel3, null);\r
- this.add(jPanel2, null);\r
- jPanel2.add(fontSize, java.awt.BorderLayout.CENTER);\r
- jPanel2.add(jLabel2, java.awt.BorderLayout.WEST);\r
- jPanel4.add(defaultButton);\r
- jPanel4.add(ok);\r
- jPanel4.add(cancel);\r
- this.add(smoothFont);\r
- this.add(jPanel4);\r
- jPanel3.add(jLabel3, java.awt.BorderLayout.WEST);\r
- jPanel3.add(fontStyle, java.awt.BorderLayout.CENTER);\r
- this.add(jPanel1, null);\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param e DOCUMENT ME!\r
- */\r
- protected void ok_actionPerformed(ActionEvent e)\r
- {\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param e DOCUMENT ME!\r
- */\r
- protected void cancel_actionPerformed(ActionEvent e)\r
- {\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param e DOCUMENT ME!\r
- */\r
- protected void fontName_actionPerformed(ActionEvent e)\r
- {\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param e DOCUMENT ME!\r
- */\r
- protected void fontSize_actionPerformed(ActionEvent e)\r
- {\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param e DOCUMENT ME!\r
- */\r
- protected void fontStyle_actionPerformed(ActionEvent e)\r
- {\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param e DOCUMENT ME!\r
- */\r
- public void defaultButton_actionPerformed(ActionEvent e)\r
- {\r
- }\r
-\r
- public void smoothFont_actionPerformed(ActionEvent e)\r
- {\r
-\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.jbgui;
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+
+/**
+ * DOCUMENT ME!
+ *
+ * @author $author$
+ * @version $Revision$
+ */
+public class GFontChooser
+ extends JPanel
+{
+ JLabel jLabel1 = new JLabel();
+ protected JComboBox fontSize = new JComboBox();
+ protected JComboBox fontStyle = new JComboBox();
+ JLabel jLabel2 = new JLabel();
+ JLabel jLabel3 = new JLabel();
+ protected JComboBox fontName = new JComboBox();
+ JButton ok = new JButton();
+ JButton cancel = new JButton();
+ JPanel jPanel1 = new JPanel();
+ JPanel jPanel2 = new JPanel();
+ JPanel jPanel3 = new JPanel();
+ BorderLayout borderLayout1 = new BorderLayout();
+ BorderLayout borderLayout2 = new BorderLayout();
+ BorderLayout borderLayout3 = new BorderLayout();
+ protected JButton defaultButton = new JButton();
+ protected JCheckBox smoothFont = new JCheckBox();
+ BorderLayout borderLayout4 = new BorderLayout();
+ protected JCheckBox monospaced = new JCheckBox();
+ JPanel jPanel4 = new JPanel();
+
+ /**
+ * Creates a new GFontChooser object.
+ */
+ public GFontChooser()
+ {
+ try
+ {
+ jbInit();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @throws Exception DOCUMENT ME!
+ */
+ private void jbInit()
+ throws Exception
+ {
+ jLabel1.setFont(new java.awt.Font("Verdana", 0, 11));
+ jLabel1.setHorizontalAlignment(SwingConstants.RIGHT);
+ jLabel1.setText("Font: ");
+ jLabel1.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
+ this.setLayout(null);
+ fontSize.setFont(new java.awt.Font("Verdana", 0, 11));
+ fontSize.setOpaque(false);
+ fontSize.setPreferredSize(new Dimension(50, 21));
+ fontSize.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ fontSize_actionPerformed(e);
+ }
+ });
+ fontStyle.setFont(new java.awt.Font("Verdana", 0, 11));
+ fontStyle.setOpaque(false);
+ fontStyle.setPreferredSize(new Dimension(90, 21));
+ fontStyle.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ fontStyle_actionPerformed(e);
+ }
+ });
+ jLabel2.setFont(new java.awt.Font("Verdana", 0, 11));
+ jLabel2.setHorizontalAlignment(SwingConstants.RIGHT);
+ jLabel2.setText("Size: ");
+ jLabel2.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
+ jLabel3.setFont(new java.awt.Font("Verdana", 0, 11));
+ jLabel3.setHorizontalAlignment(SwingConstants.RIGHT);
+ jLabel3.setText("Style: ");
+ jLabel3.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
+ fontName.setFont(new java.awt.Font("Verdana", 0, 11));
+ fontName.setMaximumSize(new Dimension(32767, 32767));
+ fontName.setMinimumSize(new Dimension(300, 21));
+ fontName.setOpaque(false);
+ fontName.setPreferredSize(new Dimension(180, 21));
+ fontName.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ fontName_actionPerformed(e);
+ }
+ });
+ ok.setFont(new java.awt.Font("Verdana", 0, 11));
+ ok.setText("OK");
+ ok.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ ok_actionPerformed(e);
+ }
+ });
+ cancel.setFont(new java.awt.Font("Verdana", 0, 11));
+ cancel.setText("Cancel");
+ cancel.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ cancel_actionPerformed(e);
+ }
+ });
+ this.setBackground(Color.white);
+ jPanel1.setOpaque(false);
+ jPanel1.setBounds(new Rectangle(5, 6, 308, 23));
+ jPanel1.setLayout(borderLayout1);
+ jPanel2.setOpaque(false);
+ jPanel2.setBounds(new Rectangle(5, 37, 128, 21));
+ jPanel2.setLayout(borderLayout3);
+ jPanel3.setOpaque(false);
+ jPanel3.setBounds(new Rectangle(174, 38, 134, 21));
+ jPanel3.setLayout(borderLayout2);
+ defaultButton.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
+ defaultButton.setText("Set as Default");
+ defaultButton.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ defaultButton_actionPerformed(e);
+ }
+ });
+ smoothFont.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
+ smoothFont.setOpaque(false);
+ smoothFont.setText("Anti-alias Fonts (Slower to render)");
+ smoothFont.setBounds(new Rectangle(41, 65, 223, 23));
+ smoothFont.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ smoothFont_actionPerformed(e);
+ }
+ });
+ monospaced.setEnabled(false);
+ monospaced.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
+ monospaced.setOpaque(false);
+ monospaced.setToolTipText("Monospaced fonts are faster to render");
+ monospaced.setText("Monospaced");
+ jPanel4.setOpaque(false);
+ jPanel4.setBounds(new Rectangle(24, 92, 259, 35));
+ jPanel1.add(jLabel1, BorderLayout.WEST);
+ jPanel1.add(fontName, BorderLayout.CENTER);
+ jPanel1.add(monospaced, java.awt.BorderLayout.EAST);
+ this.add(jPanel3, null);
+ this.add(jPanel2, null);
+ jPanel2.add(fontSize, java.awt.BorderLayout.CENTER);
+ jPanel2.add(jLabel2, java.awt.BorderLayout.WEST);
+ jPanel4.add(defaultButton);
+ jPanel4.add(ok);
+ jPanel4.add(cancel);
+ this.add(smoothFont);
+ this.add(jPanel4);
+ jPanel3.add(jLabel3, java.awt.BorderLayout.WEST);
+ jPanel3.add(fontStyle, java.awt.BorderLayout.CENTER);
+ this.add(jPanel1, null);
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param e DOCUMENT ME!
+ */
+ protected void ok_actionPerformed(ActionEvent e)
+ {
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param e DOCUMENT ME!
+ */
+ protected void cancel_actionPerformed(ActionEvent e)
+ {
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param e DOCUMENT ME!
+ */
+ protected void fontName_actionPerformed(ActionEvent e)
+ {
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param e DOCUMENT ME!
+ */
+ protected void fontSize_actionPerformed(ActionEvent e)
+ {
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param e DOCUMENT ME!
+ */
+ protected void fontStyle_actionPerformed(ActionEvent e)
+ {
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param e DOCUMENT ME!
+ */
+ public void defaultButton_actionPerformed(ActionEvent e)
+ {
+ }
+
+ public void smoothFont_actionPerformed(ActionEvent e)
+ {
+
+ }
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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
-import javax.swing.*;\r
-import javax.swing.event.*;\r
-\r
-public class GPCAPanel\r
- extends JInternalFrame\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
- JMenuBar jMenuBar1 = new JMenuBar();\r
- JMenu fileMenu = new JMenu();\r
- JMenu saveMenu = new JMenu();\r
- JMenuItem eps = new JMenuItem();\r
- JMenuItem png = new JMenuItem();\r
- JMenuItem print = new JMenuItem();\r
- JMenuItem outputValues = new JMenuItem();\r
- protected JMenu viewMenu = new JMenu();\r
- protected JCheckBoxMenuItem showLabels = new JCheckBoxMenuItem();\r
- JMenuItem bgcolour = new JMenuItem();\r
- JMenuItem originalSeqData = new JMenuItem();\r
- protected JMenu associateViewsMenu = new JMenu();\r
-\r
- public GPCAPanel()\r
- {\r
- try\r
- {\r
- jbInit();\r
- }\r
- catch (Exception e)\r
- {\r
- e.printStackTrace();\r
- }\r
-\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
- setJMenuBar(jMenuBar1);\r
- }\r
-\r
- private void jbInit()\r
- throws Exception\r
- {\r
- this.getContentPane().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
- fileMenu.setText("File");\r
- saveMenu.setText("Save as");\r
- eps.setText("EPS");\r
- eps.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- eps_actionPerformed(e);\r
- }\r
- });\r
- png.setText("PNG");\r
- png.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- png_actionPerformed(e);\r
- }\r
- });\r
- outputValues.setText("Output Values...");\r
- outputValues.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- outputValues_actionPerformed(e);\r
- }\r
- });\r
- print.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- print_actionPerformed(e);\r
- }\r
- });\r
- viewMenu.setText("View");\r
- viewMenu.addMenuListener(new MenuListener()\r
- {\r
- public void menuSelected(MenuEvent e)\r
- {\r
- viewMenu_menuSelected();\r
- }\r
-\r
- public void menuDeselected(MenuEvent e)\r
- {\r
- }\r
-\r
- public void menuCanceled(MenuEvent e)\r
- {\r
- }\r
- });\r
- showLabels.setText("Show Labels");\r
- showLabels.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- showLabels_actionPerformed(e);\r
- }\r
- });\r
- print.setText("Print");\r
- bgcolour.setText("Background Colour...");\r
- bgcolour.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- bgcolour_actionPerformed(e);\r
- }\r
- });\r
- originalSeqData.setText("Input Data...");\r
- originalSeqData.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- originalSeqData_actionPerformed(e);\r
- }\r
- });\r
- associateViewsMenu.setText("Associate Nodes With");\r
- this.getContentPane().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
- jMenuBar1.add(fileMenu);\r
- jMenuBar1.add(viewMenu);\r
- fileMenu.add(saveMenu);\r
- fileMenu.add(outputValues);\r
- fileMenu.add(print);\r
- fileMenu.add(originalSeqData);\r
- saveMenu.add(eps);\r
- saveMenu.add(png);\r
- viewMenu.add(showLabels);\r
- viewMenu.add(bgcolour);\r
- viewMenu.add(associateViewsMenu);\r
- }\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
- public void eps_actionPerformed(ActionEvent e)\r
- {\r
-\r
- }\r
-\r
- public void png_actionPerformed(ActionEvent e)\r
- {\r
-\r
- }\r
-\r
- public void outputValues_actionPerformed(ActionEvent e)\r
- {\r
-\r
- }\r
-\r
- public void print_actionPerformed(ActionEvent e)\r
- {\r
-\r
- }\r
-\r
- public void showLabels_actionPerformed(ActionEvent e)\r
- {\r
-\r
- }\r
-\r
- public void bgcolour_actionPerformed(ActionEvent e)\r
- {\r
-\r
- }\r
-\r
- public void originalSeqData_actionPerformed(ActionEvent e)\r
- {\r
-\r
- }\r
-\r
- public void viewMenu_menuSelected()\r
- {\r
-\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.jbgui;
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.event.*;
+
+public class GPCAPanel
+ extends JInternalFrame
+{
+ JPanel jPanel2 = new JPanel();
+ JLabel jLabel1 = new JLabel();
+ JLabel jLabel2 = new JLabel();
+ JLabel jLabel3 = new JLabel();
+ protected JComboBox xCombobox = new JComboBox();
+ protected JComboBox yCombobox = new JComboBox();
+ protected JComboBox zCombobox = new JComboBox();
+ FlowLayout flowLayout1 = new FlowLayout();
+ BorderLayout borderLayout1 = new BorderLayout();
+ JMenuBar jMenuBar1 = new JMenuBar();
+ JMenu fileMenu = new JMenu();
+ JMenu saveMenu = new JMenu();
+ JMenuItem eps = new JMenuItem();
+ JMenuItem png = new JMenuItem();
+ JMenuItem print = new JMenuItem();
+ JMenuItem outputValues = new JMenuItem();
+ protected JMenu viewMenu = new JMenu();
+ protected JCheckBoxMenuItem showLabels = new JCheckBoxMenuItem();
+ JMenuItem bgcolour = new JMenuItem();
+ JMenuItem originalSeqData = new JMenuItem();
+ protected JMenu associateViewsMenu = new JMenu();
+
+ public GPCAPanel()
+ {
+ try
+ {
+ jbInit();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+
+ for (int i = 1; i < 8; i++)
+ {
+ xCombobox.addItem("dim " + i);
+ yCombobox.addItem("dim " + i);
+ zCombobox.addItem("dim " + i);
+ }
+
+ setJMenuBar(jMenuBar1);
+ }
+
+ private void jbInit()
+ throws Exception
+ {
+ this.getContentPane().setLayout(borderLayout1);
+ jPanel2.setLayout(flowLayout1);
+ jLabel1.setFont(new java.awt.Font("Verdana", 0, 12));
+ jLabel1.setText("x=");
+ jLabel2.setFont(new java.awt.Font("Verdana", 0, 12));
+ jLabel2.setText("y=");
+ jLabel3.setFont(new java.awt.Font("Verdana", 0, 12));
+ jLabel3.setText("z=");
+ jPanel2.setBackground(Color.white);
+ jPanel2.setBorder(null);
+ zCombobox.setFont(new java.awt.Font("Verdana", 0, 12));
+ zCombobox.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ zCombobox_actionPerformed(e);
+ }
+ });
+ yCombobox.setFont(new java.awt.Font("Verdana", 0, 12));
+ yCombobox.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ yCombobox_actionPerformed(e);
+ }
+ });
+ xCombobox.setFont(new java.awt.Font("Verdana", 0, 12));
+ xCombobox.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ xCombobox_actionPerformed(e);
+ }
+ });
+ fileMenu.setText("File");
+ saveMenu.setText("Save as");
+ eps.setText("EPS");
+ eps.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ eps_actionPerformed(e);
+ }
+ });
+ png.setText("PNG");
+ png.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ png_actionPerformed(e);
+ }
+ });
+ outputValues.setText("Output Values...");
+ outputValues.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ outputValues_actionPerformed(e);
+ }
+ });
+ print.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ print_actionPerformed(e);
+ }
+ });
+ viewMenu.setText("View");
+ viewMenu.addMenuListener(new MenuListener()
+ {
+ public void menuSelected(MenuEvent e)
+ {
+ viewMenu_menuSelected();
+ }
+
+ public void menuDeselected(MenuEvent e)
+ {
+ }
+
+ public void menuCanceled(MenuEvent e)
+ {
+ }
+ });
+ showLabels.setText("Show Labels");
+ showLabels.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ showLabels_actionPerformed(e);
+ }
+ });
+ print.setText("Print");
+ bgcolour.setText("Background Colour...");
+ bgcolour.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ bgcolour_actionPerformed(e);
+ }
+ });
+ originalSeqData.setText("Input Data...");
+ originalSeqData.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ originalSeqData_actionPerformed(e);
+ }
+ });
+ associateViewsMenu.setText("Associate Nodes With");
+ this.getContentPane().add(jPanel2, BorderLayout.SOUTH);
+ jPanel2.add(jLabel1, null);
+ jPanel2.add(xCombobox, null);
+ jPanel2.add(jLabel2, null);
+ jPanel2.add(yCombobox, null);
+ jPanel2.add(jLabel3, null);
+ jPanel2.add(zCombobox, null);
+ jMenuBar1.add(fileMenu);
+ jMenuBar1.add(viewMenu);
+ fileMenu.add(saveMenu);
+ fileMenu.add(outputValues);
+ fileMenu.add(print);
+ fileMenu.add(originalSeqData);
+ saveMenu.add(eps);
+ saveMenu.add(png);
+ viewMenu.add(showLabels);
+ viewMenu.add(bgcolour);
+ viewMenu.add(associateViewsMenu);
+ }
+
+ protected void xCombobox_actionPerformed(ActionEvent e)
+ {
+ }
+
+ protected void yCombobox_actionPerformed(ActionEvent e)
+ {
+ }
+
+ protected void zCombobox_actionPerformed(ActionEvent e)
+ {
+ }
+
+ public void eps_actionPerformed(ActionEvent e)
+ {
+
+ }
+
+ public void png_actionPerformed(ActionEvent e)
+ {
+
+ }
+
+ public void outputValues_actionPerformed(ActionEvent e)
+ {
+
+ }
+
+ public void print_actionPerformed(ActionEvent e)
+ {
+
+ }
+
+ public void showLabels_actionPerformed(ActionEvent e)
+ {
+
+ }
+
+ public void bgcolour_actionPerformed(ActionEvent e)
+ {
+
+ }
+
+ public void originalSeqData_actionPerformed(ActionEvent e)
+ {
+
+ }
+
+ public void viewMenu_menuSelected()
+ {
+
+ }
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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
-import javax.swing.*;\r
-\r
-/**\r
- * DOCUMENT ME!\r
- *\r
- * @author $author$\r
- * @version $Revision$\r
- */\r
-public class GPairwiseAlignPanel\r
- 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
- /**\r
- * Creates a new GPairwiseAlignPanel object.\r
- */\r
- public GPairwiseAlignPanel()\r
- {\r
- try\r
- {\r
- jbInit();\r
- }\r
- catch (Exception e)\r
- {\r
- e.printStackTrace();\r
- }\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @throws Exception DOCUMENT ME!\r
- */\r
- private void jbInit()\r
- 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
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- viewInEditorButton_actionPerformed(e);\r
- }\r
- });\r
- this.add(scrollPane, BorderLayout.CENTER);\r
- scrollPane.getViewport().add(textarea, null);\r
- this.add(jPanel1, BorderLayout.SOUTH);\r
- jPanel1.add(viewInEditorButton, null);\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param e DOCUMENT ME!\r
- */\r
- protected void viewInEditorButton_actionPerformed(ActionEvent e)\r
- {\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.jbgui;
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+
+/**
+ * DOCUMENT ME!
+ *
+ * @author $author$
+ * @version $Revision$
+ */
+public class GPairwiseAlignPanel
+ extends JPanel
+{
+ protected JScrollPane scrollPane = new JScrollPane();
+ protected JTextArea textarea = new JTextArea();
+ protected JButton viewInEditorButton = new JButton();
+ JPanel jPanel1 = new JPanel();
+ BorderLayout borderLayout1 = new BorderLayout();
+
+ /**
+ * Creates a new GPairwiseAlignPanel object.
+ */
+ public GPairwiseAlignPanel()
+ {
+ try
+ {
+ jbInit();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @throws Exception DOCUMENT ME!
+ */
+ private void jbInit()
+ throws Exception
+ {
+ this.setLayout(borderLayout1);
+ textarea.setFont(new java.awt.Font("Monospaced", 0, 12));
+ textarea.setText("");
+ textarea.setWrapStyleWord(false);
+ viewInEditorButton.setFont(new java.awt.Font("Verdana", 0, 12));
+ viewInEditorButton.setText("View in alignment editor");
+ viewInEditorButton.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ viewInEditorButton_actionPerformed(e);
+ }
+ });
+ this.add(scrollPane, BorderLayout.CENTER);
+ scrollPane.getViewport().add(textarea, null);
+ this.add(jPanel1, BorderLayout.SOUTH);
+ jPanel1.add(viewInEditorButton, null);
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param e DOCUMENT ME!
+ */
+ protected void viewInEditorButton_actionPerformed(ActionEvent e)
+ {
+ }
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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
-import javax.swing.*;\r
-import javax.swing.border.*;\r
-import javax.swing.event.*;\r
-import java.awt.Rectangle;\r
-\r
-/**\r
- * DOCUMENT ME!\r
- *\r
- * @author $author$\r
- * @version $Revision$\r
- */\r
-public class GPreferences\r
- extends JPanel\r
-{\r
- JTabbedPane tabbedPane = new JTabbedPane();\r
-\r
- JButton ok = new JButton();\r
- JButton cancel = new JButton();\r
- JPanel okCancelPanel = new JPanel();\r
- BorderLayout borderLayout1 = new BorderLayout();\r
- protected JCheckBox quality = new JCheckBox();\r
- JPanel visualTab = new JPanel();\r
- protected JCheckBox fullScreen = new JCheckBox();\r
- protected JCheckBox conservation = new JCheckBox();\r
- protected JCheckBox identity = new JCheckBox();\r
- protected JCheckBox annotations = new JCheckBox();\r
- JLabel gapLabel = new JLabel();\r
- protected JComboBox colour = new JComboBox();\r
- JLabel colourLabel = new JLabel();\r
- JLabel fontLabel = new JLabel();\r
- protected JComboBox fontSizeCB = new JComboBox();\r
- protected JComboBox fontStyleCB = new JComboBox();\r
- protected JComboBox fontNameCB = new JComboBox();\r
- protected JComboBox gapSymbolCB = new JComboBox();\r
- protected JCheckBox startupCheckbox = new JCheckBox();\r
- protected JTextField startupFileTextfield = new JTextField();\r
- JPanel connectTab = new JPanel();\r
- JLabel serverLabel = new JLabel();\r
- protected JList linkURLList = new JList();\r
- protected JTextField proxyServerTB = new JTextField();\r
- protected JTextField proxyPortTB = new JTextField();\r
- JLabel portLabel = new JLabel();\r
- JLabel browserLabel = new JLabel();\r
- protected JTextField defaultBrowser = new JTextField();\r
- JButton newLink = new JButton();\r
- JButton editLink = new JButton();\r
- JButton deleteLink = new JButton();\r
- JScrollPane linkScrollPane = new JScrollPane();\r
- JPanel linkPanel = new JPanel();\r
- BorderLayout borderLayout2 = new BorderLayout();\r
- JPanel editLinkButtons = new JPanel();\r
- GridLayout gridLayout1 = new GridLayout();\r
- protected JList linkNameList = new JList();\r
- JPanel linkPanel2 = new JPanel();\r
- BorderLayout borderLayout3 = new BorderLayout();\r
- protected JCheckBox useProxy = new JCheckBox();\r
- JPanel jPanel1 = new JPanel();\r
- TitledBorder titledBorder1 = new TitledBorder("Proxy Server");\r
- TitledBorder titledBorder2 = new TitledBorder("File Output");\r
- GridBagLayout gridBagLayout2 = new GridBagLayout();\r
- GridBagLayout gridBagLayout1 = new GridBagLayout();\r
- GridBagLayout gridBagLayout3 = new GridBagLayout();\r
- protected JComboBox sortby = new JComboBox();\r
- JLabel sortLabel = new JLabel();\r
- JPanel jPanel2 = new JPanel();\r
- GridLayout gridLayout2 = new GridLayout();\r
- JPanel jPanel3 = new JPanel();\r
- JPanel exportTab = new JPanel();\r
- JLabel epsLabel = new JLabel();\r
- protected JComboBox epsRendering = new JComboBox();\r
- JLabel jLabel1 = new JLabel();\r
- protected JCheckBox blcjv = new JCheckBox();\r
- protected JCheckBox pileupjv = new JCheckBox();\r
- protected JCheckBox clustaljv = new JCheckBox();\r
- protected JCheckBox msfjv = new JCheckBox();\r
- protected JCheckBox fastajv = new JCheckBox();\r
- protected JCheckBox pfamjv = new JCheckBox();\r
- FlowLayout flowLayout1 = new FlowLayout();\r
- protected JCheckBox pirjv = new JCheckBox();\r
- JPanel jPanel11 = new JPanel();\r
- Font verdana11 = new java.awt.Font("Verdana", Font.PLAIN, 11);\r
- protected JCheckBox seqLimit = new JCheckBox();\r
- GridLayout gridLayout3 = new GridLayout();\r
- protected JCheckBox smoothFont = new JCheckBox();\r
- JPanel calcTab = new JPanel();\r
- protected JCheckBox autoCalculateConsCheck = new JCheckBox();\r
- protected JCheckBox padGaps = new JCheckBox();\r
- protected JCheckBox modellerOutput = new JCheckBox();\r
- protected JPanel dasPanel = new JPanel();\r
- BorderLayout borderLayout4 = new BorderLayout();\r
- protected JCheckBox wrap = new JCheckBox();\r
- protected JCheckBox rightAlign = new JCheckBox();\r
- protected JCheckBox idItalics = new JCheckBox();\r
- protected JCheckBox openoverv = new JCheckBox();\r
- /**\r
- * Creates a new GPreferences object.\r
- */\r
- public GPreferences()\r
- {\r
- try\r
- {\r
- jbInit();\r
- }\r
- catch (Exception ex)\r
- {\r
- ex.printStackTrace();\r
- }\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @throws Exception DOCUMENT ME!\r
- */\r
- private void jbInit()\r
- throws Exception\r
- {\r
- this.setLayout(borderLayout1);\r
- ok.setText("OK");\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
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- cancel_actionPerformed(e);\r
- }\r
- });\r
- quality.setEnabled(false);\r
- quality.setFont(verdana11);\r
- quality.setHorizontalAlignment(SwingConstants.RIGHT);\r
- quality.setHorizontalTextPosition(SwingConstants.LEFT);\r
- quality.setSelected(true);\r
- quality.setText("Quality");\r
- visualTab.setBorder(new TitledBorder("Open new alignment"));\r
- visualTab.setLayout(null);\r
- fullScreen.setFont(verdana11);\r
- fullScreen.setHorizontalAlignment(SwingConstants.RIGHT);\r
- fullScreen.setHorizontalTextPosition(SwingConstants.LEFT);\r
- fullScreen.setText("Maximise Window");\r
- conservation.setEnabled(false);\r
- conservation.setFont(verdana11);\r
- conservation.setHorizontalAlignment(SwingConstants.RIGHT);\r
- conservation.setHorizontalTextPosition(SwingConstants.LEFT);\r
- conservation.setSelected(true);\r
- conservation.setText("Conservation");\r
- identity.setEnabled(false);\r
- identity.setFont(verdana11);\r
- identity.setHorizontalAlignment(SwingConstants.RIGHT);\r
- identity.setHorizontalTextPosition(SwingConstants.LEFT);\r
- identity.setSelected(true);\r
- identity.setText("Consensus");\r
- annotations.setFont(verdana11);\r
- annotations.setHorizontalAlignment(SwingConstants.RIGHT);\r
- annotations.setHorizontalTextPosition(SwingConstants.LEFT);\r
- annotations.setSelected(true);\r
- annotations.setText("Show Annotations");\r
- annotations.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- annotations_actionPerformed(e);\r
- }\r
- });\r
- gapLabel.setFont(verdana11);\r
- gapLabel.setHorizontalAlignment(SwingConstants.RIGHT);\r
- gapLabel.setText("Gap Symbol ");\r
- colour.setFont(verdana11);\r
- colour.setBounds(new Rectangle(172, 225, 155, 21));\r
- colourLabel.setFont(verdana11);\r
- colourLabel.setHorizontalAlignment(SwingConstants.RIGHT);\r
- colourLabel.setText("Colour ");\r
- fontLabel.setFont(verdana11);\r
- fontLabel.setHorizontalAlignment(SwingConstants.RIGHT);\r
- fontLabel.setText("Font ");\r
- fontSizeCB.setFont(verdana11);\r
- fontSizeCB.setBounds(new Rectangle(319, 111, 49, 21));\r
- fontStyleCB.setFont(verdana11);\r
- fontStyleCB.setBounds(new Rectangle(367, 111, 70, 21));\r
- fontNameCB.setFont(verdana11);\r
- fontNameCB.setBounds(new Rectangle(172, 111, 147, 21));\r
- gapSymbolCB.setFont(verdana11);\r
- gapSymbolCB.setBounds(new Rectangle(172, 204, 69, 21));\r
- startupCheckbox.setText("Open file");\r
- startupCheckbox.setFont(verdana11);\r
- startupCheckbox.setHorizontalAlignment(SwingConstants.RIGHT);\r
- startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);\r
- startupCheckbox.setSelected(true);\r
- startupFileTextfield.setFont(verdana11);\r
- startupFileTextfield.setBounds(new Rectangle(172, 273, 270, 20));\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
- connectTab.setLayout(gridBagLayout3);\r
- serverLabel.setText("Address");\r
- serverLabel.setHorizontalAlignment(SwingConstants.RIGHT);\r
- serverLabel.setFont(verdana11);\r
- proxyServerTB.setFont(verdana11);\r
- proxyPortTB.setFont(verdana11);\r
- portLabel.setFont(verdana11);\r
- portLabel.setHorizontalAlignment(SwingConstants.RIGHT);\r
- portLabel.setText("Port");\r
- browserLabel.setFont(new java.awt.Font("SansSerif", 0, 11));\r
- browserLabel.setHorizontalAlignment(SwingConstants.TRAILING);\r
- browserLabel.setText("Default Browser (Unix)");\r
- defaultBrowser.setFont(verdana11);\r
- defaultBrowser.setText("");\r
- newLink.setText("New");\r
- newLink.addActionListener(new java.awt.event.ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- newLink_actionPerformed(e);\r
- }\r
- });\r
- editLink.setText("Edit");\r
- editLink.addActionListener(new java.awt.event.ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- editLink_actionPerformed(e);\r
- }\r
- });\r
- deleteLink.setText("Delete");\r
- deleteLink.addActionListener(new java.awt.event.ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- deleteLink_actionPerformed(e);\r
- }\r
- });\r
-\r
- linkURLList.addListSelectionListener(new ListSelectionListener()\r
- {\r
- public void valueChanged(ListSelectionEvent e)\r
- {\r
- int index = linkURLList.getSelectedIndex();\r
- linkNameList.setSelectedIndex(index);\r
- }\r
- });\r
-\r
- linkNameList.addListSelectionListener(new ListSelectionListener()\r
- {\r
- public void valueChanged(ListSelectionEvent e)\r
- {\r
- int index = linkNameList.getSelectedIndex();\r
- linkURLList.setSelectedIndex(index);\r
- }\r
- });\r
-\r
- linkScrollPane.setBorder(null);\r
- linkPanel.setBorder(new TitledBorder("URL link from Sequence ID"));\r
- linkPanel.setLayout(borderLayout2);\r
- editLinkButtons.setLayout(gridLayout1);\r
- gridLayout1.setRows(3);\r
- linkNameList.setFont(verdana11);\r
- linkNameList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);\r
- linkPanel2.setLayout(borderLayout3);\r
- linkURLList.setFont(verdana11);\r
- linkURLList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);\r
-\r
- defaultBrowser.addMouseListener(new MouseAdapter()\r
- {\r
- public void mouseClicked(MouseEvent e)\r
- {\r
- if (e.getClickCount() > 1)\r
- {\r
- defaultBrowser_mouseClicked(e);\r
- }\r
- }\r
- });\r
- useProxy.setFont(verdana11);\r
- useProxy.setHorizontalAlignment(SwingConstants.RIGHT);\r
- useProxy.setHorizontalTextPosition(SwingConstants.LEADING);\r
- useProxy.setText("Use a proxy server");\r
- useProxy.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- useProxy_actionPerformed();\r
- }\r
- });\r
- jPanel1.setBorder(titledBorder1);\r
- jPanel1.setLayout(gridBagLayout1);\r
- sortby.setFont(verdana11);\r
- sortby.setBounds(new Rectangle(172, 249, 155, 21));\r
- sortLabel.setFont(verdana11);\r
- sortLabel.setHorizontalAlignment(SwingConstants.RIGHT);\r
- sortLabel.setText("Sort by ");\r
- jPanel2.setBounds(new Rectangle(7, 17, 158, 278));\r
- jPanel2.setLayout(gridLayout2);\r
- gridLayout2.setRows(12);\r
- jPanel3.setBounds(new Rectangle(173, 35, 274, 26));\r
- exportTab.setLayout(null);\r
- epsLabel.setFont(verdana11);\r
- epsLabel.setHorizontalAlignment(SwingConstants.RIGHT);\r
- epsLabel.setText("EPS Rendering Style");\r
- epsLabel.setBounds(new Rectangle(9, 31, 140, 24));\r
- epsRendering.setFont(verdana11);\r
- epsRendering.setBounds(new Rectangle(154, 34, 187, 21));\r
- jLabel1.setFont(verdana11);\r
- jLabel1.setHorizontalAlignment(SwingConstants.CENTER);\r
- jLabel1.setText("Append /start-end (/15-380)");\r
- jLabel1.setFont(verdana11);\r
- fastajv.setFont(verdana11);\r
- fastajv.setHorizontalAlignment(SwingConstants.LEFT);\r
- clustaljv.setText("Clustal ");\r
- blcjv.setText("BLC ");\r
- fastajv.setText("Fasta ");\r
- msfjv.setText("MSF ");\r
- pfamjv.setText("PFAM ");\r
- pileupjv.setText("Pileup ");\r
- msfjv.setFont(verdana11);\r
- msfjv.setHorizontalAlignment(SwingConstants.LEFT);\r
- pirjv.setText("PIR ");\r
- jPanel11.setFont(verdana11);\r
- jPanel11.setBorder(titledBorder2);\r
- jPanel11.setBounds(new Rectangle(30, 72, 196, 182));\r
- jPanel11.setLayout(gridLayout3);\r
- blcjv.setFont(verdana11);\r
- blcjv.setHorizontalAlignment(SwingConstants.LEFT);\r
- clustaljv.setFont(verdana11);\r
- clustaljv.setHorizontalAlignment(SwingConstants.LEFT);\r
- pfamjv.setFont(verdana11);\r
- pfamjv.setHorizontalAlignment(SwingConstants.LEFT);\r
- pileupjv.setFont(verdana11);\r
- pileupjv.setHorizontalAlignment(SwingConstants.LEFT);\r
- pirjv.setFont(verdana11);\r
- pirjv.setHorizontalAlignment(SwingConstants.LEFT);\r
- seqLimit.setFont(verdana11);\r
- seqLimit.setHorizontalAlignment(SwingConstants.RIGHT);\r
- seqLimit.setHorizontalTextPosition(SwingConstants.LEFT);\r
- seqLimit.setText("Full Sequence Id");\r
- gridLayout3.setRows(8);\r
- smoothFont.setFont(verdana11);\r
- smoothFont.setHorizontalAlignment(SwingConstants.RIGHT);\r
- smoothFont.setHorizontalTextPosition(SwingConstants.LEADING);\r
- smoothFont.setText("Smooth Font");\r
- calcTab.setLayout(null);\r
- autoCalculateConsCheck.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
- autoCalculateConsCheck.setText("AutoCalculate Consensus");\r
- autoCalculateConsCheck.setBounds(new Rectangle(21, 52, 209, 23));\r
- padGaps.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
- padGaps.setText("Pad gaps when editing");\r
- padGaps.setBounds(new Rectangle(22, 94, 168, 23));\r
- modellerOutput.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
- modellerOutput.setText("Use Modeller Output");\r
- modellerOutput.setBounds(new Rectangle(228, 226, 168, 23));\r
- dasPanel.setLayout(borderLayout4);\r
- wrap.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
- wrap.setHorizontalAlignment(SwingConstants.TRAILING);\r
- wrap.setHorizontalTextPosition(SwingConstants.LEADING);\r
- wrap.setText("Wrap Alignment");\r
- rightAlign.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
- rightAlign.setForeground(Color.black);\r
- rightAlign.setHorizontalAlignment(SwingConstants.RIGHT);\r
- rightAlign.setHorizontalTextPosition(SwingConstants.LEFT);\r
- rightAlign.setText("Right Align Ids");\r
- idItalics.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
- idItalics.setHorizontalAlignment(SwingConstants.RIGHT);\r
- idItalics.setHorizontalTextPosition(SwingConstants.LEADING);\r
- idItalics.setText("Sequence Name Italics");\r
- openoverv.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
- openoverv.setActionCommand("Open Overview");\r
- openoverv.setHorizontalAlignment(SwingConstants.RIGHT);\r
- openoverv.setHorizontalTextPosition(SwingConstants.LEADING);\r
- openoverv.setText("Open Overview Window");\r
- openoverv.setBounds(new Rectangle(169, 17, 200, 23));\r
- jPanel2.add(fullScreen);\r
- jPanel2.add(annotations);\r
- jPanel2.add(seqLimit);\r
- jPanel2.add(rightAlign);\r
- jPanel2.add(fontLabel);\r
- jPanel2.add(idItalics);\r
- jPanel2.add(smoothFont);\r
- jPanel2.add(wrap);\r
- jPanel2.add(gapLabel);\r
- jPanel2.add(colourLabel);\r
- jPanel2.add(sortLabel);\r
- jPanel2.add(startupCheckbox);\r
- visualTab.add(openoverv);\r
- visualTab.add(startupFileTextfield);\r
- visualTab.add(sortby);\r
- visualTab.add(colour);\r
- visualTab.add(gapSymbolCB);\r
- visualTab.add(jPanel3);\r
- visualTab.add(fontNameCB);\r
- visualTab.add(fontSizeCB);\r
- visualTab.add(fontStyleCB);\r
- jPanel3.add(conservation);\r
- jPanel3.add(identity);\r
- jPanel3.add(quality);\r
- visualTab.add(jPanel2);\r
- linkPanel.add(editLinkButtons, BorderLayout.EAST);\r
- editLinkButtons.add(newLink, null);\r
- editLinkButtons.add(editLink, null);\r
- editLinkButtons.add(deleteLink, null);\r
- linkPanel.add(linkScrollPane, BorderLayout.CENTER);\r
- linkScrollPane.getViewport().add(linkPanel2, null);\r
- linkPanel2.add(linkURLList, BorderLayout.CENTER);\r
- linkPanel2.add(linkNameList, BorderLayout.WEST);\r
- okCancelPanel.add(ok);\r
- okCancelPanel.add(cancel);\r
- this.add(tabbedPane, java.awt.BorderLayout.CENTER);\r
-\r
- this.add(okCancelPanel, java.awt.BorderLayout.SOUTH);\r
- jPanel1.add(serverLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0\r
- , GridBagConstraints.WEST, GridBagConstraints.NONE,\r
- new Insets(0, 2, 4, 0), 5, 0));\r
- jPanel1.add(portLabel, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0\r
- , GridBagConstraints.WEST,\r
- GridBagConstraints.NONE,\r
- new Insets(0, 0, 4, 0), 11, 6));\r
- connectTab.add(linkPanel, new GridBagConstraints(0, 0, 2, 1, 1.0, 1.0\r
- , GridBagConstraints.CENTER, GridBagConstraints.BOTH,\r
- new Insets(16, 0, 0, 12), 359, -17));\r
- connectTab.add(jPanel1, new GridBagConstraints(0, 2, 2, 1, 1.0, 1.0\r
- , GridBagConstraints.CENTER, GridBagConstraints.BOTH,\r
- new Insets(21, 0, 35, 12), 4, 6));\r
- connectTab.add(browserLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0\r
- , GridBagConstraints.WEST, GridBagConstraints.NONE,\r
- new Insets(16, 0, 0, 0), 5, 1));\r
- jPanel1.add(proxyPortTB, new GridBagConstraints(3, 1, 1, 1, 1.0, 0.0\r
- , GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,\r
- new Insets(0, 2, 4, 2), 54, 1));\r
- jPanel1.add(proxyServerTB, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0\r
- , GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,\r
- new Insets(0, 2, 4, 0), 263, 1));\r
- connectTab.add(defaultBrowser, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0\r
- , GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,\r
- new Insets(15, 0, 0, 15), 307, 1));\r
-\r
- jPanel1.add(useProxy, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0\r
- , GridBagConstraints.WEST,\r
- GridBagConstraints.NONE,\r
- new Insets(0, 2, 5, 185), 2,\r
- -4));\r
- DefaultListCellRenderer dlcr = new DefaultListCellRenderer();\r
- dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER);\r
- gapSymbolCB.setRenderer(dlcr);\r
-\r
- tabbedPane.add(visualTab, "Visual");\r
- tabbedPane.add(connectTab, "Connections");\r
- tabbedPane.add(exportTab, "Output");\r
- jPanel11.add(jLabel1);\r
- jPanel11.add(blcjv);\r
- jPanel11.add(clustaljv);\r
- jPanel11.add(fastajv);\r
- jPanel11.add(msfjv);\r
- jPanel11.add(pfamjv);\r
- jPanel11.add(pileupjv);\r
- jPanel11.add(pirjv);\r
- exportTab.add(modellerOutput);\r
- tabbedPane.add(calcTab, "Editing");\r
- calcTab.add(autoCalculateConsCheck);\r
- calcTab.add(padGaps);\r
- tabbedPane.add(dasPanel, "DAS Settings");\r
-\r
- exportTab.add(epsLabel);\r
- exportTab.add(epsRendering);\r
- exportTab.add(jPanel11);\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param e DOCUMENT ME!\r
- */\r
- public void ok_actionPerformed(ActionEvent e)\r
- {\r
- }\r
-\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 e DOCUMENT ME!\r
- */\r
- public void annotations_actionPerformed(ActionEvent e)\r
- {\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- */\r
- public void startupFileTextfield_mouseClicked()\r
- {\r
- }\r
-\r
- public void newLink_actionPerformed(ActionEvent e)\r
- {\r
-\r
- }\r
-\r
- public void editLink_actionPerformed(ActionEvent e)\r
- {\r
-\r
- }\r
-\r
- public void deleteLink_actionPerformed(ActionEvent e)\r
- {\r
-\r
- }\r
-\r
- public void defaultBrowser_mouseClicked(MouseEvent e)\r
- {\r
-\r
- }\r
-\r
- public void linkURLList_keyTyped(KeyEvent e)\r
- {\r
-\r
- }\r
-\r
- public void useProxy_actionPerformed()\r
- {\r
- proxyServerTB.setEnabled(useProxy.isSelected());\r
- proxyPortTB.setEnabled(useProxy.isSelected());\r
- }\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.jbgui;
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.border.*;
+import javax.swing.event.*;
+import java.awt.Rectangle;
+
+/**
+ * DOCUMENT ME!
+ *
+ * @author $author$
+ * @version $Revision$
+ */
+public class GPreferences
+ extends JPanel
+{
+ JTabbedPane tabbedPane = new JTabbedPane();
+
+ JButton ok = new JButton();
+ JButton cancel = new JButton();
+ JPanel okCancelPanel = new JPanel();
+ BorderLayout borderLayout1 = new BorderLayout();
+ protected JCheckBox quality = new JCheckBox();
+ JPanel visualTab = new JPanel();
+ protected JCheckBox fullScreen = new JCheckBox();
+ protected JCheckBox conservation = new JCheckBox();
+ protected JCheckBox identity = new JCheckBox();
+ protected JCheckBox annotations = new JCheckBox();
+ JLabel gapLabel = new JLabel();
+ protected JComboBox colour = new JComboBox();
+ JLabel colourLabel = new JLabel();
+ JLabel fontLabel = new JLabel();
+ protected JComboBox fontSizeCB = new JComboBox();
+ protected JComboBox fontStyleCB = new JComboBox();
+ protected JComboBox fontNameCB = new JComboBox();
+ protected JComboBox gapSymbolCB = new JComboBox();
+ protected JCheckBox startupCheckbox = new JCheckBox();
+ protected JTextField startupFileTextfield = new JTextField();
+ JPanel connectTab = new JPanel();
+ JLabel serverLabel = new JLabel();
+ protected JList linkURLList = new JList();
+ protected JTextField proxyServerTB = new JTextField();
+ protected JTextField proxyPortTB = new JTextField();
+ JLabel portLabel = new JLabel();
+ JLabel browserLabel = new JLabel();
+ protected JTextField defaultBrowser = new JTextField();
+ JButton newLink = new JButton();
+ JButton editLink = new JButton();
+ JButton deleteLink = new JButton();
+ JScrollPane linkScrollPane = new JScrollPane();
+ JPanel linkPanel = new JPanel();
+ BorderLayout borderLayout2 = new BorderLayout();
+ JPanel editLinkButtons = new JPanel();
+ GridLayout gridLayout1 = new GridLayout();
+ protected JList linkNameList = new JList();
+ JPanel linkPanel2 = new JPanel();
+ BorderLayout borderLayout3 = new BorderLayout();
+ protected JCheckBox useProxy = new JCheckBox();
+ JPanel jPanel1 = new JPanel();
+ TitledBorder titledBorder1 = new TitledBorder("Proxy Server");
+ TitledBorder titledBorder2 = new TitledBorder("File Output");
+ GridBagLayout gridBagLayout2 = new GridBagLayout();
+ GridBagLayout gridBagLayout1 = new GridBagLayout();
+ GridBagLayout gridBagLayout3 = new GridBagLayout();
+ protected JComboBox sortby = new JComboBox();
+ JLabel sortLabel = new JLabel();
+ JPanel jPanel2 = new JPanel();
+ GridLayout gridLayout2 = new GridLayout();
+ JPanel jPanel3 = new JPanel();
+ JPanel exportTab = new JPanel();
+ JLabel epsLabel = new JLabel();
+ protected JComboBox epsRendering = new JComboBox();
+ JLabel jLabel1 = new JLabel();
+ protected JCheckBox blcjv = new JCheckBox();
+ protected JCheckBox pileupjv = new JCheckBox();
+ protected JCheckBox clustaljv = new JCheckBox();
+ protected JCheckBox msfjv = new JCheckBox();
+ protected JCheckBox fastajv = new JCheckBox();
+ protected JCheckBox pfamjv = new JCheckBox();
+ FlowLayout flowLayout1 = new FlowLayout();
+ protected JCheckBox pirjv = new JCheckBox();
+ JPanel jPanel11 = new JPanel();
+ Font verdana11 = new java.awt.Font("Verdana", Font.PLAIN, 11);
+ protected JCheckBox seqLimit = new JCheckBox();
+ GridLayout gridLayout3 = new GridLayout();
+ protected JCheckBox smoothFont = new JCheckBox();
+ JPanel calcTab = new JPanel();
+ protected JCheckBox autoCalculateConsCheck = new JCheckBox();
+ protected JCheckBox padGaps = new JCheckBox();
+ protected JCheckBox modellerOutput = new JCheckBox();
+ protected JPanel dasPanel = new JPanel();
+ BorderLayout borderLayout4 = new BorderLayout();
+ protected JCheckBox wrap = new JCheckBox();
+ protected JCheckBox rightAlign = new JCheckBox();
+ protected JCheckBox idItalics = new JCheckBox();
+ protected JCheckBox openoverv = new JCheckBox();
+ /**
+ * Creates a new GPreferences object.
+ */
+ public GPreferences()
+ {
+ try
+ {
+ jbInit();
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @throws Exception DOCUMENT ME!
+ */
+ private void jbInit()
+ throws Exception
+ {
+ this.setLayout(borderLayout1);
+ ok.setText("OK");
+ ok.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ ok_actionPerformed(e);
+ }
+ });
+ cancel.setText("Cancel");
+ cancel.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ cancel_actionPerformed(e);
+ }
+ });
+ quality.setEnabled(false);
+ quality.setFont(verdana11);
+ quality.setHorizontalAlignment(SwingConstants.RIGHT);
+ quality.setHorizontalTextPosition(SwingConstants.LEFT);
+ quality.setSelected(true);
+ quality.setText("Quality");
+ visualTab.setBorder(new TitledBorder("Open new alignment"));
+ visualTab.setLayout(null);
+ fullScreen.setFont(verdana11);
+ fullScreen.setHorizontalAlignment(SwingConstants.RIGHT);
+ fullScreen.setHorizontalTextPosition(SwingConstants.LEFT);
+ fullScreen.setText("Maximise Window");
+ conservation.setEnabled(false);
+ conservation.setFont(verdana11);
+ conservation.setHorizontalAlignment(SwingConstants.RIGHT);
+ conservation.setHorizontalTextPosition(SwingConstants.LEFT);
+ conservation.setSelected(true);
+ conservation.setText("Conservation");
+ identity.setEnabled(false);
+ identity.setFont(verdana11);
+ identity.setHorizontalAlignment(SwingConstants.RIGHT);
+ identity.setHorizontalTextPosition(SwingConstants.LEFT);
+ identity.setSelected(true);
+ identity.setText("Consensus");
+ annotations.setFont(verdana11);
+ annotations.setHorizontalAlignment(SwingConstants.RIGHT);
+ annotations.setHorizontalTextPosition(SwingConstants.LEFT);
+ annotations.setSelected(true);
+ annotations.setText("Show Annotations");
+ annotations.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ annotations_actionPerformed(e);
+ }
+ });
+ gapLabel.setFont(verdana11);
+ gapLabel.setHorizontalAlignment(SwingConstants.RIGHT);
+ gapLabel.setText("Gap Symbol ");
+ colour.setFont(verdana11);
+ colour.setBounds(new Rectangle(172, 225, 155, 21));
+ colourLabel.setFont(verdana11);
+ colourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
+ colourLabel.setText("Colour ");
+ fontLabel.setFont(verdana11);
+ fontLabel.setHorizontalAlignment(SwingConstants.RIGHT);
+ fontLabel.setText("Font ");
+ fontSizeCB.setFont(verdana11);
+ fontSizeCB.setBounds(new Rectangle(319, 111, 49, 21));
+ fontStyleCB.setFont(verdana11);
+ fontStyleCB.setBounds(new Rectangle(367, 111, 70, 21));
+ fontNameCB.setFont(verdana11);
+ fontNameCB.setBounds(new Rectangle(172, 111, 147, 21));
+ gapSymbolCB.setFont(verdana11);
+ gapSymbolCB.setBounds(new Rectangle(172, 204, 69, 21));
+ startupCheckbox.setText("Open file");
+ startupCheckbox.setFont(verdana11);
+ startupCheckbox.setHorizontalAlignment(SwingConstants.RIGHT);
+ startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
+ startupCheckbox.setSelected(true);
+ startupFileTextfield.setFont(verdana11);
+ startupFileTextfield.setBounds(new Rectangle(172, 273, 270, 20));
+ startupFileTextfield.addMouseListener(new MouseAdapter()
+ {
+ public void mouseClicked(MouseEvent e)
+ {
+ if (e.getClickCount() > 1)
+ {
+ startupFileTextfield_mouseClicked();
+ }
+ }
+ });
+
+ connectTab.setLayout(gridBagLayout3);
+ serverLabel.setText("Address");
+ serverLabel.setHorizontalAlignment(SwingConstants.RIGHT);
+ serverLabel.setFont(verdana11);
+ proxyServerTB.setFont(verdana11);
+ proxyPortTB.setFont(verdana11);
+ portLabel.setFont(verdana11);
+ portLabel.setHorizontalAlignment(SwingConstants.RIGHT);
+ portLabel.setText("Port");
+ browserLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
+ browserLabel.setHorizontalAlignment(SwingConstants.TRAILING);
+ browserLabel.setText("Default Browser (Unix)");
+ defaultBrowser.setFont(verdana11);
+ defaultBrowser.setText("");
+ newLink.setText("New");
+ newLink.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ newLink_actionPerformed(e);
+ }
+ });
+ editLink.setText("Edit");
+ editLink.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ editLink_actionPerformed(e);
+ }
+ });
+ deleteLink.setText("Delete");
+ deleteLink.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ deleteLink_actionPerformed(e);
+ }
+ });
+
+ linkURLList.addListSelectionListener(new ListSelectionListener()
+ {
+ public void valueChanged(ListSelectionEvent e)
+ {
+ int index = linkURLList.getSelectedIndex();
+ linkNameList.setSelectedIndex(index);
+ }
+ });
+
+ linkNameList.addListSelectionListener(new ListSelectionListener()
+ {
+ public void valueChanged(ListSelectionEvent e)
+ {
+ int index = linkNameList.getSelectedIndex();
+ linkURLList.setSelectedIndex(index);
+ }
+ });
+
+ linkScrollPane.setBorder(null);
+ linkPanel.setBorder(new TitledBorder("URL link from Sequence ID"));
+ linkPanel.setLayout(borderLayout2);
+ editLinkButtons.setLayout(gridLayout1);
+ gridLayout1.setRows(3);
+ linkNameList.setFont(verdana11);
+ linkNameList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+ linkPanel2.setLayout(borderLayout3);
+ linkURLList.setFont(verdana11);
+ linkURLList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+
+ defaultBrowser.addMouseListener(new MouseAdapter()
+ {
+ public void mouseClicked(MouseEvent e)
+ {
+ if (e.getClickCount() > 1)
+ {
+ defaultBrowser_mouseClicked(e);
+ }
+ }
+ });
+ useProxy.setFont(verdana11);
+ useProxy.setHorizontalAlignment(SwingConstants.RIGHT);
+ useProxy.setHorizontalTextPosition(SwingConstants.LEADING);
+ useProxy.setText("Use a proxy server");
+ useProxy.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ useProxy_actionPerformed();
+ }
+ });
+ jPanel1.setBorder(titledBorder1);
+ jPanel1.setLayout(gridBagLayout1);
+ sortby.setFont(verdana11);
+ sortby.setBounds(new Rectangle(172, 249, 155, 21));
+ sortLabel.setFont(verdana11);
+ sortLabel.setHorizontalAlignment(SwingConstants.RIGHT);
+ sortLabel.setText("Sort by ");
+ jPanel2.setBounds(new Rectangle(7, 17, 158, 278));
+ jPanel2.setLayout(gridLayout2);
+ gridLayout2.setRows(12);
+ jPanel3.setBounds(new Rectangle(173, 35, 274, 26));
+ exportTab.setLayout(null);
+ epsLabel.setFont(verdana11);
+ epsLabel.setHorizontalAlignment(SwingConstants.RIGHT);
+ epsLabel.setText("EPS Rendering Style");
+ epsLabel.setBounds(new Rectangle(9, 31, 140, 24));
+ epsRendering.setFont(verdana11);
+ epsRendering.setBounds(new Rectangle(154, 34, 187, 21));
+ jLabel1.setFont(verdana11);
+ jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
+ jLabel1.setText("Append /start-end (/15-380)");
+ jLabel1.setFont(verdana11);
+ fastajv.setFont(verdana11);
+ fastajv.setHorizontalAlignment(SwingConstants.LEFT);
+ clustaljv.setText("Clustal ");
+ blcjv.setText("BLC ");
+ fastajv.setText("Fasta ");
+ msfjv.setText("MSF ");
+ pfamjv.setText("PFAM ");
+ pileupjv.setText("Pileup ");
+ msfjv.setFont(verdana11);
+ msfjv.setHorizontalAlignment(SwingConstants.LEFT);
+ pirjv.setText("PIR ");
+ jPanel11.setFont(verdana11);
+ jPanel11.setBorder(titledBorder2);
+ jPanel11.setBounds(new Rectangle(30, 72, 196, 182));
+ jPanel11.setLayout(gridLayout3);
+ blcjv.setFont(verdana11);
+ blcjv.setHorizontalAlignment(SwingConstants.LEFT);
+ clustaljv.setFont(verdana11);
+ clustaljv.setHorizontalAlignment(SwingConstants.LEFT);
+ pfamjv.setFont(verdana11);
+ pfamjv.setHorizontalAlignment(SwingConstants.LEFT);
+ pileupjv.setFont(verdana11);
+ pileupjv.setHorizontalAlignment(SwingConstants.LEFT);
+ pirjv.setFont(verdana11);
+ pirjv.setHorizontalAlignment(SwingConstants.LEFT);
+ seqLimit.setFont(verdana11);
+ seqLimit.setHorizontalAlignment(SwingConstants.RIGHT);
+ seqLimit.setHorizontalTextPosition(SwingConstants.LEFT);
+ seqLimit.setText("Full Sequence Id");
+ gridLayout3.setRows(8);
+ smoothFont.setFont(verdana11);
+ smoothFont.setHorizontalAlignment(SwingConstants.RIGHT);
+ smoothFont.setHorizontalTextPosition(SwingConstants.LEADING);
+ smoothFont.setText("Smooth Font");
+ calcTab.setLayout(null);
+ autoCalculateConsCheck.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
+ autoCalculateConsCheck.setText("AutoCalculate Consensus");
+ autoCalculateConsCheck.setBounds(new Rectangle(21, 52, 209, 23));
+ padGaps.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
+ padGaps.setText("Pad gaps when editing");
+ padGaps.setBounds(new Rectangle(22, 94, 168, 23));
+ modellerOutput.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
+ modellerOutput.setText("Use Modeller Output");
+ modellerOutput.setBounds(new Rectangle(228, 226, 168, 23));
+ dasPanel.setLayout(borderLayout4);
+ wrap.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
+ wrap.setHorizontalAlignment(SwingConstants.TRAILING);
+ wrap.setHorizontalTextPosition(SwingConstants.LEADING);
+ wrap.setText("Wrap Alignment");
+ rightAlign.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
+ rightAlign.setForeground(Color.black);
+ rightAlign.setHorizontalAlignment(SwingConstants.RIGHT);
+ rightAlign.setHorizontalTextPosition(SwingConstants.LEFT);
+ rightAlign.setText("Right Align Ids");
+ idItalics.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
+ idItalics.setHorizontalAlignment(SwingConstants.RIGHT);
+ idItalics.setHorizontalTextPosition(SwingConstants.LEADING);
+ idItalics.setText("Sequence Name Italics");
+ openoverv.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
+ openoverv.setActionCommand("Open Overview");
+ openoverv.setHorizontalAlignment(SwingConstants.RIGHT);
+ openoverv.setHorizontalTextPosition(SwingConstants.LEADING);
+ openoverv.setText("Open Overview Window");
+ openoverv.setBounds(new Rectangle(169, 17, 200, 23));
+ jPanel2.add(fullScreen);
+ jPanel2.add(annotations);
+ jPanel2.add(seqLimit);
+ jPanel2.add(rightAlign);
+ jPanel2.add(fontLabel);
+ jPanel2.add(idItalics);
+ jPanel2.add(smoothFont);
+ jPanel2.add(wrap);
+ jPanel2.add(gapLabel);
+ jPanel2.add(colourLabel);
+ jPanel2.add(sortLabel);
+ jPanel2.add(startupCheckbox);
+ visualTab.add(openoverv);
+ visualTab.add(startupFileTextfield);
+ visualTab.add(sortby);
+ visualTab.add(colour);
+ visualTab.add(gapSymbolCB);
+ visualTab.add(jPanel3);
+ visualTab.add(fontNameCB);
+ visualTab.add(fontSizeCB);
+ visualTab.add(fontStyleCB);
+ jPanel3.add(conservation);
+ jPanel3.add(identity);
+ jPanel3.add(quality);
+ visualTab.add(jPanel2);
+ linkPanel.add(editLinkButtons, BorderLayout.EAST);
+ editLinkButtons.add(newLink, null);
+ editLinkButtons.add(editLink, null);
+ editLinkButtons.add(deleteLink, null);
+ linkPanel.add(linkScrollPane, BorderLayout.CENTER);
+ linkScrollPane.getViewport().add(linkPanel2, null);
+ linkPanel2.add(linkURLList, BorderLayout.CENTER);
+ linkPanel2.add(linkNameList, BorderLayout.WEST);
+ okCancelPanel.add(ok);
+ okCancelPanel.add(cancel);
+ this.add(tabbedPane, java.awt.BorderLayout.CENTER);
+
+ this.add(okCancelPanel, java.awt.BorderLayout.SOUTH);
+ jPanel1.add(serverLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0
+ , GridBagConstraints.WEST, GridBagConstraints.NONE,
+ new Insets(0, 2, 4, 0), 5, 0));
+ jPanel1.add(portLabel, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0
+ , GridBagConstraints.WEST,
+ GridBagConstraints.NONE,
+ new Insets(0, 0, 4, 0), 11, 6));
+ connectTab.add(linkPanel, new GridBagConstraints(0, 0, 2, 1, 1.0, 1.0
+ , GridBagConstraints.CENTER, GridBagConstraints.BOTH,
+ new Insets(16, 0, 0, 12), 359, -17));
+ connectTab.add(jPanel1, new GridBagConstraints(0, 2, 2, 1, 1.0, 1.0
+ , GridBagConstraints.CENTER, GridBagConstraints.BOTH,
+ new Insets(21, 0, 35, 12), 4, 6));
+ connectTab.add(browserLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0
+ , GridBagConstraints.WEST, GridBagConstraints.NONE,
+ new Insets(16, 0, 0, 0), 5, 1));
+ jPanel1.add(proxyPortTB, new GridBagConstraints(3, 1, 1, 1, 1.0, 0.0
+ , GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
+ new Insets(0, 2, 4, 2), 54, 1));
+ jPanel1.add(proxyServerTB, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0
+ , GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
+ new Insets(0, 2, 4, 0), 263, 1));
+ connectTab.add(defaultBrowser, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0
+ , GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
+ new Insets(15, 0, 0, 15), 307, 1));
+
+ jPanel1.add(useProxy, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0
+ , GridBagConstraints.WEST,
+ GridBagConstraints.NONE,
+ new Insets(0, 2, 5, 185), 2,
+ -4));
+ DefaultListCellRenderer dlcr = new DefaultListCellRenderer();
+ dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER);
+ gapSymbolCB.setRenderer(dlcr);
+
+ tabbedPane.add(visualTab, "Visual");
+ tabbedPane.add(connectTab, "Connections");
+ tabbedPane.add(exportTab, "Output");
+ jPanel11.add(jLabel1);
+ jPanel11.add(blcjv);
+ jPanel11.add(clustaljv);
+ jPanel11.add(fastajv);
+ jPanel11.add(msfjv);
+ jPanel11.add(pfamjv);
+ jPanel11.add(pileupjv);
+ jPanel11.add(pirjv);
+ exportTab.add(modellerOutput);
+ tabbedPane.add(calcTab, "Editing");
+ calcTab.add(autoCalculateConsCheck);
+ calcTab.add(padGaps);
+ tabbedPane.add(dasPanel, "DAS Settings");
+
+ exportTab.add(epsLabel);
+ exportTab.add(epsRendering);
+ exportTab.add(jPanel11);
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param e DOCUMENT ME!
+ */
+ public void ok_actionPerformed(ActionEvent e)
+ {
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param e DOCUMENT ME!
+ */
+ public void cancel_actionPerformed(ActionEvent e)
+ {
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param e DOCUMENT ME!
+ */
+ public void annotations_actionPerformed(ActionEvent e)
+ {
+ }
+
+ /**
+ * DOCUMENT ME!
+ */
+ public void startupFileTextfield_mouseClicked()
+ {
+ }
+
+ public void newLink_actionPerformed(ActionEvent e)
+ {
+
+ }
+
+ public void editLink_actionPerformed(ActionEvent e)
+ {
+
+ }
+
+ public void deleteLink_actionPerformed(ActionEvent e)
+ {
+
+ }
+
+ public void defaultBrowser_mouseClicked(MouseEvent e)
+ {
+
+ }
+
+ public void linkURLList_keyTyped(KeyEvent e)
+ {
+
+ }
+
+ public void useProxy_actionPerformed()
+ {
+ proxyServerTB.setEnabled(useProxy.isSelected());
+ proxyPortTB.setEnabled(useProxy.isSelected());
+ }
+
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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
-import javax.swing.*;\r
-\r
-/**\r
- * DOCUMENT ME!\r
- *\r
- * @author $author$\r
- * @version $Revision$\r
- */\r
-public class GSliderPanel\r
- 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 JLabel label = new JLabel();\r
- protected JPanel southPanel = new JPanel();\r
- GridLayout gridLayout1 = new GridLayout();\r
- JPanel jPanel2 = new JPanel();\r
- protected JButton applyButton = new JButton();\r
- protected JButton undoButton = new JButton();\r
- FlowLayout flowLayout1 = new FlowLayout();\r
- protected JCheckBox allGroupsCheck = new JCheckBox();\r
- BorderLayout borderLayout1 = new BorderLayout();\r
- JPanel jPanel1 = new JPanel();\r
- BorderLayout borderLayout2 = new BorderLayout();\r
-\r
- /**\r
- * Creates a new GSliderPanel object.\r
- */\r
- public GSliderPanel()\r
- {\r
- try\r
- {\r
- jbInit();\r
- }\r
- catch (Exception e)\r
- {\r
- e.printStackTrace();\r
- }\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @throws Exception DOCUMENT ME!\r
- */\r
- private void jbInit()\r
- throws Exception\r
- {\r
- this.setLayout(gridLayout1);\r
- slider.setMajorTickSpacing(10);\r
- slider.setMinorTickSpacing(1);\r
- slider.setPaintTicks(true);\r
- slider.setBackground(Color.white);\r
- slider.setFont(new java.awt.Font("Verdana", 0, 11));\r
- slider.setDoubleBuffered(true);\r
- slider.addMouseListener(new MouseAdapter()\r
- {\r
- public void mouseReleased(MouseEvent e)\r
- {\r
- slider_mouseReleased(e);\r
- }\r
- });\r
- valueField.setFont(new java.awt.Font("Verdana", 0, 11));\r
- valueField.setMinimumSize(new Dimension(6, 14));\r
- valueField.setPreferredSize(new Dimension(50, 12));\r
- valueField.setText("");\r
- valueField.setHorizontalAlignment(SwingConstants.CENTER);\r
- valueField.addActionListener(new java.awt.event.ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- valueField_actionPerformed(e);\r
- }\r
- });\r
- label.setFont(new java.awt.Font("Verdana", 0, 11));\r
- label.setOpaque(false);\r
- label.setHorizontalAlignment(SwingConstants.CENTER);\r
- label.setText("set this label text");\r
- southPanel.setLayout(borderLayout1);\r
- gridLayout1.setRows(2);\r
- jPanel2.setLayout(flowLayout1);\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
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- applyButton_actionPerformed(e);\r
- }\r
- });\r
- undoButton.setEnabled(false);\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
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- undoButton_actionPerformed(e);\r
- }\r
- });\r
- allGroupsCheck.setEnabled(false);\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
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- allGroupsCheck_actionPerformed(e);\r
- }\r
- });\r
- this.setBackground(Color.white);\r
- this.setPreferredSize(new Dimension(415, 84));\r
- jPanel2.setOpaque(false);\r
- southPanel.setOpaque(false);\r
- jPanel1.setLayout(borderLayout2);\r
- jPanel1.setOpaque(false);\r
- this.add(jPanel2, null);\r
- jPanel2.add(label, null);\r
- jPanel2.add(applyButton, null);\r
- jPanel2.add(undoButton, null);\r
- this.add(southPanel, null);\r
- southPanel.add(jPanel1, java.awt.BorderLayout.EAST);\r
- southPanel.add(slider, java.awt.BorderLayout.CENTER);\r
- jPanel1.add(valueField, java.awt.BorderLayout.CENTER);\r
- jPanel1.add(allGroupsCheck, java.awt.BorderLayout.EAST);\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param e DOCUMENT ME!\r
- */\r
- protected void valueField_actionPerformed(ActionEvent e)\r
- {\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param e DOCUMENT ME!\r
- */\r
- protected void applyButton_actionPerformed(ActionEvent e)\r
- {\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param e DOCUMENT ME!\r
- */\r
- protected void undoButton_actionPerformed(ActionEvent e)\r
- {\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param e DOCUMENT ME!\r
- */\r
- protected void allGroupsCheck_actionPerformed(ActionEvent e)\r
- {\r
- }\r
-\r
- public void slider_mouseReleased(MouseEvent e)\r
- {\r
-\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.jbgui;
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+
+/**
+ * DOCUMENT ME!
+ *
+ * @author $author$
+ * @version $Revision$
+ */
+public class GSliderPanel
+ extends JPanel
+{
+ // this is used for conservation colours, PID colours and redundancy threshold
+ protected JSlider slider = new JSlider();
+ protected JTextField valueField = new JTextField();
+ protected JLabel label = new JLabel();
+ protected JPanel southPanel = new JPanel();
+ GridLayout gridLayout1 = new GridLayout();
+ JPanel jPanel2 = new JPanel();
+ protected JButton applyButton = new JButton();
+ protected JButton undoButton = new JButton();
+ FlowLayout flowLayout1 = new FlowLayout();
+ protected JCheckBox allGroupsCheck = new JCheckBox();
+ BorderLayout borderLayout1 = new BorderLayout();
+ JPanel jPanel1 = new JPanel();
+ BorderLayout borderLayout2 = new BorderLayout();
+
+ /**
+ * Creates a new GSliderPanel object.
+ */
+ public GSliderPanel()
+ {
+ try
+ {
+ jbInit();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @throws Exception DOCUMENT ME!
+ */
+ private void jbInit()
+ throws Exception
+ {
+ this.setLayout(gridLayout1);
+ slider.setMajorTickSpacing(10);
+ slider.setMinorTickSpacing(1);
+ slider.setPaintTicks(true);
+ slider.setBackground(Color.white);
+ slider.setFont(new java.awt.Font("Verdana", 0, 11));
+ slider.setDoubleBuffered(true);
+ slider.addMouseListener(new MouseAdapter()
+ {
+ public void mouseReleased(MouseEvent e)
+ {
+ slider_mouseReleased(e);
+ }
+ });
+ valueField.setFont(new java.awt.Font("Verdana", 0, 11));
+ valueField.setMinimumSize(new Dimension(6, 14));
+ valueField.setPreferredSize(new Dimension(50, 12));
+ valueField.setText("");
+ valueField.setHorizontalAlignment(SwingConstants.CENTER);
+ valueField.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ valueField_actionPerformed(e);
+ }
+ });
+ label.setFont(new java.awt.Font("Verdana", 0, 11));
+ label.setOpaque(false);
+ label.setHorizontalAlignment(SwingConstants.CENTER);
+ label.setText("set this label text");
+ southPanel.setLayout(borderLayout1);
+ gridLayout1.setRows(2);
+ jPanel2.setLayout(flowLayout1);
+ applyButton.setFont(new java.awt.Font("Verdana", 0, 11));
+ applyButton.setOpaque(false);
+ applyButton.setText("Apply");
+ applyButton.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ applyButton_actionPerformed(e);
+ }
+ });
+ undoButton.setEnabled(false);
+ undoButton.setFont(new java.awt.Font("Verdana", 0, 11));
+ undoButton.setOpaque(false);
+ undoButton.setText("Undo");
+ undoButton.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ undoButton_actionPerformed(e);
+ }
+ });
+ allGroupsCheck.setEnabled(false);
+ allGroupsCheck.setFont(new java.awt.Font("Verdana", 0, 11));
+ allGroupsCheck.setOpaque(false);
+ allGroupsCheck.setText("Apply to all Groups");
+ allGroupsCheck.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ allGroupsCheck_actionPerformed(e);
+ }
+ });
+ this.setBackground(Color.white);
+ this.setPreferredSize(new Dimension(415, 84));
+ jPanel2.setOpaque(false);
+ southPanel.setOpaque(false);
+ jPanel1.setLayout(borderLayout2);
+ jPanel1.setOpaque(false);
+ this.add(jPanel2, null);
+ jPanel2.add(label, null);
+ jPanel2.add(applyButton, null);
+ jPanel2.add(undoButton, null);
+ this.add(southPanel, null);
+ southPanel.add(jPanel1, java.awt.BorderLayout.EAST);
+ southPanel.add(slider, java.awt.BorderLayout.CENTER);
+ jPanel1.add(valueField, java.awt.BorderLayout.CENTER);
+ jPanel1.add(allGroupsCheck, java.awt.BorderLayout.EAST);
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param e DOCUMENT ME!
+ */
+ protected void valueField_actionPerformed(ActionEvent e)
+ {
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param e DOCUMENT ME!
+ */
+ protected void applyButton_actionPerformed(ActionEvent e)
+ {
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param e DOCUMENT ME!
+ */
+ protected void undoButton_actionPerformed(ActionEvent e)
+ {
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param e DOCUMENT ME!
+ */
+ protected void allGroupsCheck_actionPerformed(ActionEvent e)
+ {
+ }
+
+ public void slider_mouseReleased(MouseEvent e)
+ {
+
+ }
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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
-package jalview.jbgui;\r
-\r
-import javax.swing.*;\r
-import java.awt.event.ActionListener;\r
-import java.awt.event.ActionEvent;\r
-\r
-public class GStructureViewer extends JInternalFrame\r
-{\r
- public GStructureViewer()\r
- {\r
- try\r
- {\r
- jbInit();\r
- }\r
- catch (Exception ex)\r
- {\r
- ex.printStackTrace();\r
- }\r
- }\r
-\r
- private void jbInit()\r
- throws Exception\r
- {\r
- this.setJMenuBar(menuBar);\r
- fileMenu.setText("File");\r
- savemenu.setActionCommand("Save Image");\r
- savemenu.setText("Save As");\r
- pdbFile.setText("PDB File");\r
- pdbFile.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent actionEvent)\r
- {\r
- pdbFile_actionPerformed(actionEvent);\r
- }\r
- });\r
- png.setText("PNG");\r
- png.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent actionEvent)\r
- {\r
- png_actionPerformed(actionEvent);\r
- }\r
- });\r
- eps.setText("EPS");\r
- eps.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent actionEvent)\r
- {\r
- eps_actionPerformed(actionEvent);\r
- }\r
- });\r
- viewMapping.setText("View Mapping");\r
- viewMapping.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent actionEvent)\r
- {\r
- viewMapping_actionPerformed(actionEvent);\r
- }\r
- });\r
- viewMenu.setText("View");\r
- chainMenu.setText("Show Chain");\r
- colourMenu.setText("Colours");\r
- backGround.setText("Background Colour...");\r
- backGround.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent actionEvent)\r
- {\r
- backGround_actionPerformed(actionEvent);\r
- }\r
- });\r
- seqColour.setSelected(true);\r
- seqColour.setText("By Sequence");\r
- seqColour.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent actionEvent)\r
- {\r
- seqColour_actionPerformed(actionEvent);\r
- }\r
- });\r
- chainColour.setText("By Chain");\r
- chainColour.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent actionEvent)\r
- {\r
- chainColour_actionPerformed(actionEvent);\r
- }\r
- });\r
- chargeColour.setText("Charge & Cysteine");\r
- chargeColour.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent actionEvent)\r
- {\r
- chargeColour_actionPerformed(actionEvent);\r
- }\r
- });\r
- zappoColour.setText("Zappo");\r
- zappoColour.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent actionEvent)\r
- {\r
- zappoColour_actionPerformed(actionEvent);\r
- }\r
- });\r
- taylorColour.setText("Taylor");\r
- taylorColour.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent actionEvent)\r
- {\r
- taylorColour_actionPerformed(actionEvent);\r
- }\r
- });\r
- hydroColour.setText("Hydro");\r
- hydroColour.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent actionEvent)\r
- {\r
- hydroColour_actionPerformed(actionEvent);\r
- }\r
- });\r
- strandColour.setText("Strand");\r
- strandColour.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent actionEvent)\r
- {\r
- strandColour_actionPerformed(actionEvent);\r
- }\r
- });\r
- helixColour.setText("Helix Propensity");\r
- helixColour.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent actionEvent)\r
- {\r
- helixColour_actionPerformed(actionEvent);\r
- }\r
- });\r
- turnColour.setText("Turn Propensity");\r
- turnColour.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent actionEvent)\r
- {\r
- turnColour_actionPerformed(actionEvent);\r
- }\r
- });\r
- buriedColour.setText("Buried Index");\r
- buriedColour.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent actionEvent)\r
- {\r
- buriedColour_actionPerformed(actionEvent);\r
- }\r
- });\r
- userColour.setText("User Defined ...");\r
- userColour.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent actionEvent)\r
- {\r
- userColour_actionPerformed(actionEvent);\r
- }\r
- });\r
- helpMenu.setText("Help");\r
- jmolHelp.setText("Jmol Help");\r
- jmolHelp.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent actionEvent)\r
- {\r
- jmolHelp_actionPerformed(actionEvent);\r
- }\r
- });\r
- menuBar.add(fileMenu);\r
- menuBar.add(viewMenu);\r
- menuBar.add(colourMenu);\r
- menuBar.add(helpMenu);\r
- fileMenu.add(savemenu);\r
- fileMenu.add(viewMapping);\r
- savemenu.add(pdbFile);\r
- savemenu.add(png);\r
- savemenu.add(eps);\r
- viewMenu.add(chainMenu);\r
- colourMenu.add(seqColour);\r
- colourMenu.add(chainColour);\r
- colourMenu.add(chargeColour);\r
- colourMenu.add(zappoColour);\r
- colourMenu.add(taylorColour);\r
- colourMenu.add(hydroColour);\r
- colourMenu.add(helixColour);\r
- colourMenu.add(strandColour);\r
- colourMenu.add(turnColour);\r
- colourMenu.add(buriedColour);\r
- colourMenu.add(userColour);\r
- colourMenu.add(backGround);\r
- helpMenu.add(jmolHelp);\r
- }\r
-\r
- JMenuBar menuBar = new JMenuBar();\r
- JMenu fileMenu = new JMenu();\r
- JMenu savemenu = new JMenu();\r
- JMenuItem pdbFile = new JMenuItem();\r
- JMenuItem png = new JMenuItem();\r
- JMenuItem eps = new JMenuItem();\r
- JMenuItem viewMapping = new JMenuItem();\r
- JMenu viewMenu = new JMenu();\r
- protected JMenu chainMenu = new JMenu();\r
- JMenu jMenu1 = new JMenu();\r
- JMenu colourMenu = new JMenu();\r
- JMenuItem backGround = new JMenuItem();\r
- protected JCheckBoxMenuItem seqColour = new JCheckBoxMenuItem();\r
- JMenuItem chainColour = new JMenuItem();\r
- JMenuItem chargeColour = new JMenuItem();\r
- JMenuItem zappoColour = new JMenuItem();\r
- JMenuItem taylorColour = new JMenuItem();\r
- JMenuItem hydroColour = new JMenuItem();\r
- JMenuItem strandColour = new JMenuItem();\r
- JMenuItem helixColour = new JMenuItem();\r
- JMenuItem turnColour = new JMenuItem();\r
- JMenuItem buriedColour = new JMenuItem();\r
- JMenuItem userColour = new JMenuItem();\r
- JMenu helpMenu = new JMenu();\r
- JMenuItem jmolHelp = new JMenuItem();\r
- public void pdbFile_actionPerformed(ActionEvent actionEvent)\r
- {\r
-\r
- }\r
-\r
- public void png_actionPerformed(ActionEvent actionEvent)\r
- {\r
-\r
- }\r
-\r
- public void eps_actionPerformed(ActionEvent actionEvent)\r
- {\r
-\r
- }\r
-\r
- public void viewMapping_actionPerformed(ActionEvent actionEvent)\r
- {\r
-\r
- }\r
-\r
- public void seqColour_actionPerformed(ActionEvent actionEvent)\r
- {\r
-\r
- }\r
-\r
- public void chainColour_actionPerformed(ActionEvent actionEvent)\r
- {\r
-\r
- }\r
-\r
- public void chargeColour_actionPerformed(ActionEvent actionEvent)\r
- {\r
-\r
- }\r
-\r
- public void zappoColour_actionPerformed(ActionEvent actionEvent)\r
- {\r
-\r
- }\r
-\r
- public void taylorColour_actionPerformed(ActionEvent actionEvent)\r
- {\r
-\r
- }\r
-\r
- public void hydroColour_actionPerformed(ActionEvent actionEvent)\r
- {\r
-\r
- }\r
-\r
- public void helixColour_actionPerformed(ActionEvent actionEvent)\r
- {\r
-\r
- }\r
-\r
- public void strandColour_actionPerformed(ActionEvent actionEvent)\r
- {\r
-\r
- }\r
-\r
- public void turnColour_actionPerformed(ActionEvent actionEvent)\r
- {\r
-\r
- }\r
-\r
- public void buriedColour_actionPerformed(ActionEvent actionEvent)\r
- {\r
-\r
- }\r
-\r
- public void userColour_actionPerformed(ActionEvent actionEvent)\r
- {\r
-\r
- }\r
-\r
- public void backGround_actionPerformed(ActionEvent actionEvent)\r
- {\r
-\r
- }\r
-\r
- public void jmolHelp_actionPerformed(ActionEvent actionEvent)\r
- {\r
-\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.jbgui;
+
+import javax.swing.*;
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+
+public class GStructureViewer extends JInternalFrame
+{
+ public GStructureViewer()
+ {
+ try
+ {
+ jbInit();
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ private void jbInit()
+ throws Exception
+ {
+ this.setJMenuBar(menuBar);
+ fileMenu.setText("File");
+ savemenu.setActionCommand("Save Image");
+ savemenu.setText("Save As");
+ pdbFile.setText("PDB File");
+ pdbFile.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent actionEvent)
+ {
+ pdbFile_actionPerformed(actionEvent);
+ }
+ });
+ png.setText("PNG");
+ png.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent actionEvent)
+ {
+ png_actionPerformed(actionEvent);
+ }
+ });
+ eps.setText("EPS");
+ eps.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent actionEvent)
+ {
+ eps_actionPerformed(actionEvent);
+ }
+ });
+ viewMapping.setText("View Mapping");
+ viewMapping.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent actionEvent)
+ {
+ viewMapping_actionPerformed(actionEvent);
+ }
+ });
+ viewMenu.setText("View");
+ chainMenu.setText("Show Chain");
+ colourMenu.setText("Colours");
+ backGround.setText("Background Colour...");
+ backGround.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent actionEvent)
+ {
+ backGround_actionPerformed(actionEvent);
+ }
+ });
+ seqColour.setSelected(true);
+ seqColour.setText("By Sequence");
+ seqColour.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent actionEvent)
+ {
+ seqColour_actionPerformed(actionEvent);
+ }
+ });
+ chainColour.setText("By Chain");
+ chainColour.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent actionEvent)
+ {
+ chainColour_actionPerformed(actionEvent);
+ }
+ });
+ chargeColour.setText("Charge & Cysteine");
+ chargeColour.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent actionEvent)
+ {
+ chargeColour_actionPerformed(actionEvent);
+ }
+ });
+ zappoColour.setText("Zappo");
+ zappoColour.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent actionEvent)
+ {
+ zappoColour_actionPerformed(actionEvent);
+ }
+ });
+ taylorColour.setText("Taylor");
+ taylorColour.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent actionEvent)
+ {
+ taylorColour_actionPerformed(actionEvent);
+ }
+ });
+ hydroColour.setText("Hydro");
+ hydroColour.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent actionEvent)
+ {
+ hydroColour_actionPerformed(actionEvent);
+ }
+ });
+ strandColour.setText("Strand");
+ strandColour.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent actionEvent)
+ {
+ strandColour_actionPerformed(actionEvent);
+ }
+ });
+ helixColour.setText("Helix Propensity");
+ helixColour.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent actionEvent)
+ {
+ helixColour_actionPerformed(actionEvent);
+ }
+ });
+ turnColour.setText("Turn Propensity");
+ turnColour.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent actionEvent)
+ {
+ turnColour_actionPerformed(actionEvent);
+ }
+ });
+ buriedColour.setText("Buried Index");
+ buriedColour.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent actionEvent)
+ {
+ buriedColour_actionPerformed(actionEvent);
+ }
+ });
+ userColour.setText("User Defined ...");
+ userColour.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent actionEvent)
+ {
+ userColour_actionPerformed(actionEvent);
+ }
+ });
+ helpMenu.setText("Help");
+ jmolHelp.setText("Jmol Help");
+ jmolHelp.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent actionEvent)
+ {
+ jmolHelp_actionPerformed(actionEvent);
+ }
+ });
+ menuBar.add(fileMenu);
+ menuBar.add(viewMenu);
+ menuBar.add(colourMenu);
+ menuBar.add(helpMenu);
+ fileMenu.add(savemenu);
+ fileMenu.add(viewMapping);
+ savemenu.add(pdbFile);
+ savemenu.add(png);
+ savemenu.add(eps);
+ viewMenu.add(chainMenu);
+ colourMenu.add(seqColour);
+ colourMenu.add(chainColour);
+ colourMenu.add(chargeColour);
+ colourMenu.add(zappoColour);
+ colourMenu.add(taylorColour);
+ colourMenu.add(hydroColour);
+ colourMenu.add(helixColour);
+ colourMenu.add(strandColour);
+ colourMenu.add(turnColour);
+ colourMenu.add(buriedColour);
+ colourMenu.add(userColour);
+ colourMenu.add(backGround);
+ helpMenu.add(jmolHelp);
+ }
+
+ JMenuBar menuBar = new JMenuBar();
+ JMenu fileMenu = new JMenu();
+ JMenu savemenu = new JMenu();
+ JMenuItem pdbFile = new JMenuItem();
+ JMenuItem png = new JMenuItem();
+ JMenuItem eps = new JMenuItem();
+ JMenuItem viewMapping = new JMenuItem();
+ JMenu viewMenu = new JMenu();
+ protected JMenu chainMenu = new JMenu();
+ JMenu jMenu1 = new JMenu();
+ JMenu colourMenu = new JMenu();
+ JMenuItem backGround = new JMenuItem();
+ protected JCheckBoxMenuItem seqColour = new JCheckBoxMenuItem();
+ JMenuItem chainColour = new JMenuItem();
+ JMenuItem chargeColour = new JMenuItem();
+ JMenuItem zappoColour = new JMenuItem();
+ JMenuItem taylorColour = new JMenuItem();
+ JMenuItem hydroColour = new JMenuItem();
+ JMenuItem strandColour = new JMenuItem();
+ JMenuItem helixColour = new JMenuItem();
+ JMenuItem turnColour = new JMenuItem();
+ JMenuItem buriedColour = new JMenuItem();
+ JMenuItem userColour = new JMenuItem();
+ JMenu helpMenu = new JMenu();
+ JMenuItem jmolHelp = new JMenuItem();
+ public void pdbFile_actionPerformed(ActionEvent actionEvent)
+ {
+
+ }
+
+ public void png_actionPerformed(ActionEvent actionEvent)
+ {
+
+ }
+
+ public void eps_actionPerformed(ActionEvent actionEvent)
+ {
+
+ }
+
+ public void viewMapping_actionPerformed(ActionEvent actionEvent)
+ {
+
+ }
+
+ public void seqColour_actionPerformed(ActionEvent actionEvent)
+ {
+
+ }
+
+ public void chainColour_actionPerformed(ActionEvent actionEvent)
+ {
+
+ }
+
+ public void chargeColour_actionPerformed(ActionEvent actionEvent)
+ {
+
+ }
+
+ public void zappoColour_actionPerformed(ActionEvent actionEvent)
+ {
+
+ }
+
+ public void taylorColour_actionPerformed(ActionEvent actionEvent)
+ {
+
+ }
+
+ public void hydroColour_actionPerformed(ActionEvent actionEvent)
+ {
+
+ }
+
+ public void helixColour_actionPerformed(ActionEvent actionEvent)
+ {
+
+ }
+
+ public void strandColour_actionPerformed(ActionEvent actionEvent)
+ {
+
+ }
+
+ public void turnColour_actionPerformed(ActionEvent actionEvent)
+ {
+
+ }
+
+ public void buriedColour_actionPerformed(ActionEvent actionEvent)
+ {
+
+ }
+
+ public void userColour_actionPerformed(ActionEvent actionEvent)
+ {
+
+ }
+
+ public void backGround_actionPerformed(ActionEvent actionEvent)
+ {
+
+ }
+
+ public void jmolHelp_actionPerformed(ActionEvent actionEvent)
+ {
+
+ }
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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
-import javax.swing.*;\r
-import javax.swing.event.*;\r
-\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 fileMenu = new JMenu();\r
- JMenuItem saveAsNewick = new JMenuItem();\r
- JMenuItem printMenu = new JMenuItem();\r
- protected JMenu viewMenu = new JMenu();\r
- public JMenuItem font = 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
- public JMenuItem originalSeqData = new JMenuItem();\r
- protected JMenu associateLeavesMenu = new JMenu();\r
- public GTreePanel()\r
- {\r
- try\r
- {\r
- jbInit();\r
- this.setJMenuBar(jMenuBar1);\r
- }\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
- fileMenu.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
- viewMenu.setText("View");\r
- viewMenu.addMenuListener(new MenuListener()\r
- {\r
- public void menuSelected(MenuEvent e)\r
- {\r
- viewMenu_menuSelected();\r
- }\r
-\r
- public void menuDeselected(MenuEvent e)\r
- {\r
- }\r
-\r
- public void menuCanceled(MenuEvent e)\r
- {\r
- }\r
- });\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
- 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
- originalSeqData.setText("Input Data...");\r
- originalSeqData.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- originalSeqData_actionPerformed(e);\r
- }\r
- });\r
- associateLeavesMenu.setText("Associate Leaves With");\r
- this.getContentPane().add(scrollPane, BorderLayout.CENTER);\r
- jMenuBar1.add(fileMenu);\r
- jMenuBar1.add(viewMenu);\r
- fileMenu.add(saveAsMenu);\r
- fileMenu.add(textbox);\r
- fileMenu.add(printMenu);\r
- fileMenu.add(originalSeqData);\r
- viewMenu.add(fitToWindow);\r
- viewMenu.add(font);\r
- viewMenu.add(distanceMenu);\r
- viewMenu.add(bootstrapMenu);\r
- viewMenu.add(placeholdersMenu);\r
- viewMenu.add(associateLeavesMenu);\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 font_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
- public void fullid_actionPerformed(ActionEvent e)\r
- {\r
-\r
- }\r
-\r
- public void originalSeqData_actionPerformed(ActionEvent e)\r
- {\r
-\r
- }\r
-\r
- public void viewMenu_menuSelected()\r
- {\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.jbgui;
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.event.*;
+
+public class GTreePanel
+ extends JInternalFrame
+{
+ BorderLayout borderLayout1 = new BorderLayout();
+ public JScrollPane scrollPane = new JScrollPane();
+ JMenuBar jMenuBar1 = new JMenuBar();
+ JMenu fileMenu = new JMenu();
+ JMenuItem saveAsNewick = new JMenuItem();
+ JMenuItem printMenu = new JMenuItem();
+ protected JMenu viewMenu = new JMenu();
+ public JMenuItem font = new JMenuItem();
+ public JCheckBoxMenuItem bootstrapMenu = new JCheckBoxMenuItem();
+ public JCheckBoxMenuItem distanceMenu = new JCheckBoxMenuItem();
+ public JCheckBoxMenuItem fitToWindow = new JCheckBoxMenuItem();
+ public JCheckBoxMenuItem placeholdersMenu = new JCheckBoxMenuItem();
+ JMenuItem pngTree = new JMenuItem();
+ JMenuItem epsTree = new JMenuItem();
+ JMenu saveAsMenu = new JMenu();
+ JMenuItem textbox = new JMenuItem();
+ public JMenuItem originalSeqData = new JMenuItem();
+ protected JMenu associateLeavesMenu = new JMenu();
+ public GTreePanel()
+ {
+ try
+ {
+ jbInit();
+ this.setJMenuBar(jMenuBar1);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ private void jbInit()
+ throws Exception
+ {
+ this.getContentPane().setLayout(borderLayout1);
+ this.setBackground(Color.white);
+ this.setFont(new java.awt.Font("Verdana", 0, 12));
+ scrollPane.setOpaque(false);
+ fileMenu.setText("File");
+ saveAsNewick.setText("Newick Format");
+ saveAsNewick.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ saveAsNewick_actionPerformed(e);
+ }
+ });
+ printMenu.setText("Print");
+ printMenu.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ printMenu_actionPerformed(e);
+ }
+ });
+ viewMenu.setText("View");
+ viewMenu.addMenuListener(new MenuListener()
+ {
+ public void menuSelected(MenuEvent e)
+ {
+ viewMenu_menuSelected();
+ }
+
+ public void menuDeselected(MenuEvent e)
+ {
+ }
+
+ public void menuCanceled(MenuEvent e)
+ {
+ }
+ });
+ font.setText("Font...");
+ font.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ font_actionPerformed(e);
+ }
+ });
+ bootstrapMenu.setText("Show Bootstrap Values");
+ bootstrapMenu.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ bootstrapMenu_actionPerformed(e);
+ }
+ });
+ distanceMenu.setText("Show Distances");
+ distanceMenu.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ distanceMenu_actionPerformed(e);
+ }
+ });
+ fitToWindow.setSelected(true);
+ fitToWindow.setText("Fit To Window");
+ fitToWindow.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ fitToWindow_actionPerformed(e);
+ }
+ });
+ epsTree.setText("EPS");
+ epsTree.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ epsTree_actionPerformed(e);
+ }
+ });
+ pngTree.setText("PNG");
+ pngTree.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ pngTree_actionPerformed(e);
+ }
+ });
+ saveAsMenu.setText("Save as");
+ placeholdersMenu.setToolTipText(
+ "Marks leaves of tree not associated with a sequence");
+ placeholdersMenu.setText("Mark Unlinked Leaves");
+ placeholdersMenu.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ placeholdersMenu_actionPerformed(e);
+ }
+ });
+ textbox.setText("Output to Textbox...");
+ textbox.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ textbox_actionPerformed(e);
+ }
+ });
+ originalSeqData.setText("Input Data...");
+ originalSeqData.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ originalSeqData_actionPerformed(e);
+ }
+ });
+ associateLeavesMenu.setText("Associate Leaves With");
+ this.getContentPane().add(scrollPane, BorderLayout.CENTER);
+ jMenuBar1.add(fileMenu);
+ jMenuBar1.add(viewMenu);
+ fileMenu.add(saveAsMenu);
+ fileMenu.add(textbox);
+ fileMenu.add(printMenu);
+ fileMenu.add(originalSeqData);
+ viewMenu.add(fitToWindow);
+ viewMenu.add(font);
+ viewMenu.add(distanceMenu);
+ viewMenu.add(bootstrapMenu);
+ viewMenu.add(placeholdersMenu);
+ viewMenu.add(associateLeavesMenu);
+ saveAsMenu.add(saveAsNewick);
+ saveAsMenu.add(epsTree);
+ saveAsMenu.add(pngTree);
+ }
+
+ public void printMenu_actionPerformed(ActionEvent e)
+ {
+ }
+
+ public void font_actionPerformed(ActionEvent e)
+ {
+ }
+
+ public void distanceMenu_actionPerformed(ActionEvent e)
+ {
+ }
+
+ public void bootstrapMenu_actionPerformed(ActionEvent e)
+ {
+ }
+
+ public void fitToWindow_actionPerformed(ActionEvent e)
+ {
+ }
+
+ public void pngTree_actionPerformed(ActionEvent e)
+ {
+ }
+
+ public void epsTree_actionPerformed(ActionEvent e)
+ {
+ }
+
+ public void saveAsNewick_actionPerformed(ActionEvent e)
+ {
+ }
+
+ public void placeholdersMenu_actionPerformed(ActionEvent e)
+ {
+ }
+
+ public void textbox_actionPerformed(ActionEvent e)
+ {
+ }
+
+ public void fullid_actionPerformed(ActionEvent e)
+ {
+
+ }
+
+ public void originalSeqData_actionPerformed(ActionEvent e)
+ {
+
+ }
+
+ public void viewMenu_menuSelected()
+ {
+ }
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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
-import javax.swing.*;\r
-\r
-/**\r
- * DOCUMENT ME!\r
- *\r
- * @author $author$\r
- * @version $Revision$\r
- */\r
-public class GUserDefinedColours\r
- extends JPanel\r
-{\r
- protected JColorChooser colorChooser = new JColorChooser();\r
- protected JPanel buttonPanel = new JPanel();\r
- protected GridLayout gridLayout = new GridLayout();\r
- JPanel lowerPanel = new JPanel();\r
- protected JButton okButton = new JButton();\r
- protected JButton applyButton = new JButton();\r
- protected JButton loadbutton = new JButton();\r
- protected JButton savebutton = new JButton();\r
- protected JButton cancelButton = new JButton();\r
- JPanel namePanel = new JPanel();\r
- JLabel jLabel1 = new JLabel();\r
- protected JTextField schemeName = new JTextField();\r
- BorderLayout borderLayout1 = new BorderLayout();\r
- JPanel panel1 = new JPanel();\r
- JPanel okCancelPanel = new JPanel();\r
- JPanel saveLoadPanel = new JPanel();\r
- BorderLayout borderLayout3 = new BorderLayout();\r
- GridBagLayout gridBagLayout1 = new GridBagLayout();\r
- BorderLayout borderLayout2 = new BorderLayout();\r
- FlowLayout flowLayout1 = new FlowLayout();\r
- BorderLayout borderLayout4 = new BorderLayout();\r
- JPanel jPanel4 = new JPanel();\r
- BorderLayout borderLayout5 = new BorderLayout();\r
- JLabel label = new JLabel();\r
- protected JPanel casePanel = new JPanel();\r
- protected JCheckBox caseSensitive = new JCheckBox();\r
- protected JButton lcaseColour = new JButton();\r
- /**\r
- * Creates a new GUserDefinedColours object.\r
- */\r
- public GUserDefinedColours()\r
- {\r
- try\r
- {\r
- jbInit();\r
- }\r
- catch (Exception e)\r
- {\r
- e.printStackTrace();\r
- }\r
-\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @throws Exception DOCUMENT ME!\r
- */\r
- private void jbInit()\r
- throws Exception\r
- {\r
- this.setLayout(borderLayout4);\r
- buttonPanel.setLayout(gridLayout);\r
- gridLayout.setColumns(4);\r
- gridLayout.setRows(5);\r
- okButton.setFont(new java.awt.Font("Verdana", 0, 11));\r
- okButton.setText("OK");\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
- {\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
- {\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
- {\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
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- cancelButton_actionPerformed(e);\r
- }\r
- });\r
- this.setBackground(new Color(212, 208, 223));\r
- lowerPanel.setOpaque(false);\r
- lowerPanel.setLayout(borderLayout3);\r
- colorChooser.setOpaque(false);\r
- jLabel1.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
- jLabel1.setText("Name");\r
- namePanel.setMinimumSize(new Dimension(300, 31));\r
- namePanel.setOpaque(false);\r
- namePanel.setPreferredSize(new Dimension(240, 25));\r
- namePanel.setLayout(borderLayout1);\r
- schemeName.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
- schemeName.setPreferredSize(new Dimension(105, 21));\r
- schemeName.setText("");\r
- schemeName.setHorizontalAlignment(SwingConstants.CENTER);\r
- panel1.setLayout(flowLayout1);\r
- panel1.setOpaque(false);\r
- okCancelPanel.setOpaque(false);\r
- saveLoadPanel.setOpaque(false);\r
- jPanel4.setLayout(borderLayout5);\r
- label.setFont(new java.awt.Font("Verdana", Font.ITALIC, 10));\r
- label.setOpaque(false);\r
- label.setPreferredSize(new Dimension(260, 34));\r
- label.setText(\r
- "<html>Save your colour scheme with a unique name and it will be added " +\r
- "to the Colour menu.</html>");\r
- caseSensitive.setText("Case Sensitive");\r
- caseSensitive.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- caseSensitive_actionPerformed(e);\r
- }\r
- });\r
- lcaseColour.setText("Lower Case Colour");\r
- lcaseColour.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- lcaseColour_actionPerformed(e);\r
- }\r
- });\r
-\r
- saveLoadPanel.add(savebutton);\r
- saveLoadPanel.add(loadbutton);\r
- okCancelPanel.add(applyButton);\r
- okCancelPanel.add(okButton);\r
- okCancelPanel.add(cancelButton);\r
- lowerPanel.add(saveLoadPanel, java.awt.BorderLayout.NORTH);\r
- lowerPanel.add(okCancelPanel, java.awt.BorderLayout.SOUTH);\r
-\r
- namePanel.add(schemeName, java.awt.BorderLayout.CENTER);\r
- namePanel.add(jLabel1, java.awt.BorderLayout.WEST);\r
- panel1.add(namePanel, null);\r
- panel1.add(buttonPanel, null);\r
- panel1.add(casePanel);\r
- casePanel.add(caseSensitive);\r
- casePanel.add(lcaseColour);\r
- panel1.add(lowerPanel, null);\r
- panel1.add(label);\r
-\r
- jPanel4.add(panel1, java.awt.BorderLayout.CENTER);\r
- this.add(jPanel4, java.awt.BorderLayout.CENTER);\r
- this.add(colorChooser, java.awt.BorderLayout.EAST);\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param e DOCUMENT ME!\r
- */\r
- protected void okButton_actionPerformed(ActionEvent e)\r
- {\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param e DOCUMENT ME!\r
- */\r
- protected void applyButton_actionPerformed(ActionEvent e)\r
- {\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param e DOCUMENT ME!\r
- */\r
- protected void loadbutton_actionPerformed(ActionEvent e)\r
- {\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param e DOCUMENT ME!\r
- */\r
- protected void savebutton_actionPerformed(ActionEvent e)\r
- {\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param e DOCUMENT ME!\r
- */\r
- protected void cancelButton_actionPerformed(ActionEvent e)\r
- {\r
- }\r
-\r
- public void caseSensitive_actionPerformed(ActionEvent e)\r
- {\r
-\r
- }\r
-\r
- public void lcaseColour_actionPerformed(ActionEvent e)\r
- {\r
-\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.jbgui;
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+
+/**
+ * DOCUMENT ME!
+ *
+ * @author $author$
+ * @version $Revision$
+ */
+public class GUserDefinedColours
+ extends JPanel
+{
+ protected JColorChooser colorChooser = new JColorChooser();
+ protected JPanel buttonPanel = new JPanel();
+ protected GridLayout gridLayout = new GridLayout();
+ JPanel lowerPanel = new JPanel();
+ protected JButton okButton = new JButton();
+ protected JButton applyButton = new JButton();
+ protected JButton loadbutton = new JButton();
+ protected JButton savebutton = new JButton();
+ protected JButton cancelButton = new JButton();
+ JPanel namePanel = new JPanel();
+ JLabel jLabel1 = new JLabel();
+ protected JTextField schemeName = new JTextField();
+ BorderLayout borderLayout1 = new BorderLayout();
+ JPanel panel1 = new JPanel();
+ JPanel okCancelPanel = new JPanel();
+ JPanel saveLoadPanel = new JPanel();
+ BorderLayout borderLayout3 = new BorderLayout();
+ GridBagLayout gridBagLayout1 = new GridBagLayout();
+ BorderLayout borderLayout2 = new BorderLayout();
+ FlowLayout flowLayout1 = new FlowLayout();
+ BorderLayout borderLayout4 = new BorderLayout();
+ JPanel jPanel4 = new JPanel();
+ BorderLayout borderLayout5 = new BorderLayout();
+ JLabel label = new JLabel();
+ protected JPanel casePanel = new JPanel();
+ protected JCheckBox caseSensitive = new JCheckBox();
+ protected JButton lcaseColour = new JButton();
+ /**
+ * Creates a new GUserDefinedColours object.
+ */
+ public GUserDefinedColours()
+ {
+ try
+ {
+ jbInit();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @throws Exception DOCUMENT ME!
+ */
+ private void jbInit()
+ throws Exception
+ {
+ this.setLayout(borderLayout4);
+ buttonPanel.setLayout(gridLayout);
+ gridLayout.setColumns(4);
+ gridLayout.setRows(5);
+ okButton.setFont(new java.awt.Font("Verdana", 0, 11));
+ okButton.setText("OK");
+ okButton.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ okButton_actionPerformed(e);
+ }
+ });
+ applyButton.setFont(new java.awt.Font("Verdana", 0, 11));
+ applyButton.setText("Apply");
+ applyButton.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ applyButton_actionPerformed(e);
+ }
+ });
+ loadbutton.setFont(new java.awt.Font("Verdana", 0, 11));
+ loadbutton.setText("Load scheme");
+ loadbutton.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ loadbutton_actionPerformed(e);
+ }
+ });
+ savebutton.setFont(new java.awt.Font("Verdana", 0, 11));
+ savebutton.setText("Save scheme");
+ savebutton.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ savebutton_actionPerformed(e);
+ }
+ });
+ cancelButton.setFont(new java.awt.Font("Verdana", 0, 11));
+ cancelButton.setText("Cancel");
+ cancelButton.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ cancelButton_actionPerformed(e);
+ }
+ });
+ this.setBackground(new Color(212, 208, 223));
+ lowerPanel.setOpaque(false);
+ lowerPanel.setLayout(borderLayout3);
+ colorChooser.setOpaque(false);
+ jLabel1.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
+ jLabel1.setText("Name");
+ namePanel.setMinimumSize(new Dimension(300, 31));
+ namePanel.setOpaque(false);
+ namePanel.setPreferredSize(new Dimension(240, 25));
+ namePanel.setLayout(borderLayout1);
+ schemeName.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
+ schemeName.setPreferredSize(new Dimension(105, 21));
+ schemeName.setText("");
+ schemeName.setHorizontalAlignment(SwingConstants.CENTER);
+ panel1.setLayout(flowLayout1);
+ panel1.setOpaque(false);
+ okCancelPanel.setOpaque(false);
+ saveLoadPanel.setOpaque(false);
+ jPanel4.setLayout(borderLayout5);
+ label.setFont(new java.awt.Font("Verdana", Font.ITALIC, 10));
+ label.setOpaque(false);
+ label.setPreferredSize(new Dimension(260, 34));
+ label.setText(
+ "<html>Save your colour scheme with a unique name and it will be added " +
+ "to the Colour menu.</html>");
+ caseSensitive.setText("Case Sensitive");
+ caseSensitive.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ caseSensitive_actionPerformed(e);
+ }
+ });
+ lcaseColour.setText("Lower Case Colour");
+ lcaseColour.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ lcaseColour_actionPerformed(e);
+ }
+ });
+
+ saveLoadPanel.add(savebutton);
+ saveLoadPanel.add(loadbutton);
+ okCancelPanel.add(applyButton);
+ okCancelPanel.add(okButton);
+ okCancelPanel.add(cancelButton);
+ lowerPanel.add(saveLoadPanel, java.awt.BorderLayout.NORTH);
+ lowerPanel.add(okCancelPanel, java.awt.BorderLayout.SOUTH);
+
+ namePanel.add(schemeName, java.awt.BorderLayout.CENTER);
+ namePanel.add(jLabel1, java.awt.BorderLayout.WEST);
+ panel1.add(namePanel, null);
+ panel1.add(buttonPanel, null);
+ panel1.add(casePanel);
+ casePanel.add(caseSensitive);
+ casePanel.add(lcaseColour);
+ panel1.add(lowerPanel, null);
+ panel1.add(label);
+
+ jPanel4.add(panel1, java.awt.BorderLayout.CENTER);
+ this.add(jPanel4, java.awt.BorderLayout.CENTER);
+ this.add(colorChooser, java.awt.BorderLayout.EAST);
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param e DOCUMENT ME!
+ */
+ protected void okButton_actionPerformed(ActionEvent e)
+ {
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param e DOCUMENT ME!
+ */
+ protected void applyButton_actionPerformed(ActionEvent e)
+ {
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param e DOCUMENT ME!
+ */
+ protected void loadbutton_actionPerformed(ActionEvent e)
+ {
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param e DOCUMENT ME!
+ */
+ protected void savebutton_actionPerformed(ActionEvent e)
+ {
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param e DOCUMENT ME!
+ */
+ protected void cancelButton_actionPerformed(ActionEvent e)
+ {
+ }
+
+ public void caseSensitive_actionPerformed(ActionEvent e)
+ {
+
+ }
+
+ public void lcaseColour_actionPerformed(ActionEvent e)
+ {
+
+ }
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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
-import javax.swing.*;\r
-\r
-/**\r
- * DOCUMENT ME!\r
- *\r
- * @author $author$\r
- * @version $Revision$\r
- */\r
-public class GWebserviceInfo\r
- extends JPanel\r
-{\r
- protected JTextArea infoText = new JTextArea();\r
- JScrollPane jScrollPane1 = new JScrollPane();\r
- JPanel jPanel1 = new JPanel();\r
- BorderLayout borderLayout1 = new BorderLayout();\r
- BorderLayout borderLayout2 = new BorderLayout();\r
- protected JPanel titlePanel = new JPanel();\r
- BorderLayout borderLayout3 = new BorderLayout();\r
- protected JPanel buttonPanel = new JPanel();\r
- public JButton cancel = new JButton();\r
- public JButton showResultsNewFrame = new JButton();\r
- public JButton mergeResults = new JButton();\r
- GridBagLayout gridBagLayout1 = new GridBagLayout();\r
- /**\r
- * Creates a new GWebserviceInfo object.\r
- */\r
- public GWebserviceInfo()\r
- {\r
- try\r
- {\r
- jbInit();\r
- }\r
- catch (Exception e)\r
- {\r
- e.printStackTrace();\r
- }\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @throws Exception DOCUMENT ME!\r
- */\r
- private void jbInit()\r
- throws Exception\r
- {\r
- infoText.setFont(new java.awt.Font("Verdana", 0, 10));\r
- infoText.setBorder(null);\r
- infoText.setEditable(false);\r
- infoText.setText("");\r
- infoText.setLineWrap(true);\r
- infoText.setWrapStyleWord(true);\r
- this.setLayout(borderLayout1);\r
- jPanel1.setLayout(borderLayout2);\r
- titlePanel.setBackground(Color.white);\r
- titlePanel.setPreferredSize(new Dimension(0, 60));\r
- titlePanel.setLayout(borderLayout3);\r
- jScrollPane1.setBorder(null);\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
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- cancel_actionPerformed(e);\r
- }\r
- });\r
- buttonPanel.setLayout(gridBagLayout1);\r
- buttonPanel.setOpaque(false);\r
- showResultsNewFrame.setText("New Window");\r
- mergeResults.setText("Merge Results");\r
- this.setBackground(Color.white);\r
- this.add(jPanel1, BorderLayout.NORTH);\r
- jPanel1.add(jScrollPane1, BorderLayout.CENTER);\r
- jScrollPane1.getViewport().add(infoText, null);\r
- jPanel1.add(titlePanel, BorderLayout.NORTH);\r
- titlePanel.add(buttonPanel, BorderLayout.EAST);\r
- buttonPanel.add(cancel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0\r
- , GridBagConstraints.CENTER,\r
- GridBagConstraints.NONE,\r
- new Insets(19, 6, 16, 4), 0, 0));\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param e DOCUMENT ME!\r
- */\r
- protected void cancel_actionPerformed(ActionEvent e)\r
- {\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.jbgui;
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+
+/**
+ * DOCUMENT ME!
+ *
+ * @author $author$
+ * @version $Revision$
+ */
+public class GWebserviceInfo
+ extends JPanel
+{
+ protected JTextArea infoText = new JTextArea();
+ JScrollPane jScrollPane1 = new JScrollPane();
+ JPanel jPanel1 = new JPanel();
+ BorderLayout borderLayout1 = new BorderLayout();
+ BorderLayout borderLayout2 = new BorderLayout();
+ protected JPanel titlePanel = new JPanel();
+ BorderLayout borderLayout3 = new BorderLayout();
+ protected JPanel buttonPanel = new JPanel();
+ public JButton cancel = new JButton();
+ public JButton showResultsNewFrame = new JButton();
+ public JButton mergeResults = new JButton();
+ GridBagLayout gridBagLayout1 = new GridBagLayout();
+ /**
+ * Creates a new GWebserviceInfo object.
+ */
+ public GWebserviceInfo()
+ {
+ try
+ {
+ jbInit();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @throws Exception DOCUMENT ME!
+ */
+ private void jbInit()
+ throws Exception
+ {
+ infoText.setFont(new java.awt.Font("Verdana", 0, 10));
+ infoText.setBorder(null);
+ infoText.setEditable(false);
+ infoText.setText("");
+ infoText.setLineWrap(true);
+ infoText.setWrapStyleWord(true);
+ this.setLayout(borderLayout1);
+ jPanel1.setLayout(borderLayout2);
+ titlePanel.setBackground(Color.white);
+ titlePanel.setPreferredSize(new Dimension(0, 60));
+ titlePanel.setLayout(borderLayout3);
+ jScrollPane1.setBorder(null);
+ jScrollPane1.setPreferredSize(new Dimension(400, 70));
+ cancel.setFont(new java.awt.Font("Verdana", 0, 11));
+ cancel.setText("Cancel");
+ cancel.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ cancel_actionPerformed(e);
+ }
+ });
+ buttonPanel.setLayout(gridBagLayout1);
+ buttonPanel.setOpaque(false);
+ showResultsNewFrame.setText("New Window");
+ mergeResults.setText("Merge Results");
+ this.setBackground(Color.white);
+ this.add(jPanel1, BorderLayout.NORTH);
+ jPanel1.add(jScrollPane1, BorderLayout.CENTER);
+ jScrollPane1.getViewport().add(infoText, null);
+ jPanel1.add(titlePanel, BorderLayout.NORTH);
+ titlePanel.add(buttonPanel, BorderLayout.EAST);
+ buttonPanel.add(cancel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0
+ , GridBagConstraints.CENTER,
+ GridBagConstraints.NONE,
+ new Insets(19, 6, 16, 4), 0, 0));
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param e DOCUMENT ME!
+ */
+ protected void cancel_actionPerformed(ActionEvent e)
+ {
+ }
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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.math;\r
-\r
-import java.io.*;\r
-\r
-import jalview.util.*;\r
-\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
- /**\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
- /**\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
- {\r
- for (int j = 0; j < rows; j++)\r
- {\r
- out[i][j] = value[j][i];\r
- }\r
- }\r
-\r
- return new Matrix(out, cols, rows);\r
- }\r
-\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
- ps.println();\r
- }\r
- }\r
-\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
- {\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
- {\r
- tmp[i][j] += (in.value[i][k] * this.value[k][j]);\r
- }\r
- }\r
- }\r
-\r
- return new Matrix(tmp, in.rows, this.cols);\r
- }\r
-\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
- {\r
- out[i] = 0.0;\r
-\r
- for (int k = 0; k < in.length; k++)\r
- {\r
- out[i] += (value[i][k] * in[k]);\r
- }\r
- }\r
-\r
- return out;\r
- }\r
-\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
- {\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
- {\r
- out[i][j] = out[i][j] + (value[i][k] * in.value[k][j]);\r
- }\r
- }\r
- }\r
-\r
- return new Matrix(out, this.cols, in.rows);\r
- }\r
-\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
- {\r
- for (int j = 0; j < cols; j++)\r
- {\r
- newmat[i][j] = value[i][j];\r
- }\r
- }\r
-\r
- return new Matrix(newmat, rows, cols);\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- */\r
- public void tred()\r
- {\r
- int n = rows;\r
- int l;\r
- int k;\r
- int j;\r
- int i;\r
-\r
- double scale;\r
- double hh;\r
- double h;\r
- double g;\r
- double f;\r
-\r
- this.d = new double[rows];\r
- this.e = new double[rows];\r
-\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
- {\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
- {\r
- e[i - 1] = value[i - 1][l - 1];\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
- {\r
- g = -1.0 * Math.sqrt(h);\r
- }\r
- else\r
- {\r
- g = Math.sqrt(h);\r
- }\r
-\r
- e[i - 1] = scale * g;\r
- h -= (f * g);\r
- value[i - 1][l - 1] = f - g;\r
- f = 0.0;\r
-\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
- {\r
- g += (value[j - 1][k - 1] * value[i - 1][k - 1]);\r
- }\r
-\r
- for (k = j + 1; k <= l; k++)\r
- {\r
- g += (value[k - 1][j - 1] * value[i - 1][k - 1]);\r
- }\r
-\r
- e[j - 1] = g / h;\r
- f += (e[j - 1] * value[i - 1][j - 1]);\r
- }\r
-\r
- hh = f / (h + h);\r
-\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
- {\r
- value[j - 1][k - 1] -= ( (f * e[k - 1]) +\r
- (g * value[i - 1][k - 1]));\r
- }\r
- }\r
- }\r
- }\r
- else\r
- {\r
- e[i - 1] = value[i - 1][l - 1];\r
- }\r
-\r
- d[i - 1] = h;\r
- }\r
-\r
- d[0] = 0.0;\r
- e[0] = 0.0;\r
-\r
- for (i = 1; i <= n; i++)\r
- {\r
- l = i - 1;\r
-\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
- {\r
- g += (value[i - 1][k - 1] * value[k - 1][j - 1]);\r
- }\r
-\r
- for (k = 1; k <= l; k++)\r
- {\r
- value[k - 1][j - 1] -= (g * value[k - 1][i - 1]);\r
- }\r
- }\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
- {\r
- value[j - 1][i - 1] = 0.0;\r
- value[i - 1][j - 1] = 0.0;\r
- }\r
- }\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- */\r
- public void tqli()\r
- {\r
- int n = rows;\r
-\r
- int m;\r
- int l;\r
- int iter;\r
- int i;\r
- int k;\r
- double s;\r
- double r;\r
- double p;\r
- ;\r
-\r
- double g;\r
- double f;\r
- double dd;\r
- double c;\r
- double b;\r
-\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
- {\r
- iter = 0;\r
-\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
- {\r
- break;\r
- }\r
- }\r
-\r
- if (m != l)\r
- {\r
- iter++;\r
-\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
- }\r
- else\r
- {\r
- // System.out.println("Iteration " + iter);\r
- }\r
-\r
- g = (d[l] - d[l - 1]) / (2.0 * e[l - 1]);\r
- r = Math.sqrt( (g * g) + 1.0);\r
- g = d[m - 1] - d[l - 1] + (e[l - 1] / (g + sign(r, g)));\r
- c = 1.0;\r
- s = c;\r
- p = 0.0;\r
-\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
- {\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
- }\r
- else\r
- {\r
- s = f / g;\r
- r = Math.sqrt( (s * s) + 1.0);\r
- e[i] = g * r;\r
- c = 1.0 / r;\r
- s *= c;\r
- }\r
-\r
- g = d[i] - p;\r
- r = ( (d[i - 1] - g) * s) + (2.0 * c * b);\r
- p = s * r;\r
- d[i] = g + p;\r
- g = (c * r) - b;\r
-\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
- value[k - 1][i - 1] = (c * value[k - 1][i - 1]) -\r
- (s * f);\r
- }\r
- }\r
-\r
- d[l - 1] = d[l - 1] - p;\r
- e[l - 1] = g;\r
- e[m - 1] = 0.0;\r
- }\r
- }\r
- while (m != l);\r
- }\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- */\r
- public void tred2()\r
- {\r
- int n = rows;\r
- int l;\r
- int k;\r
- int j;\r
- int i;\r
-\r
- double scale;\r
- double hh;\r
- double h;\r
- double g;\r
- double f;\r
-\r
- this.d = new double[rows];\r
- this.e = new double[rows];\r
-\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
- {\r
- for (k = 0; k < l; k++)\r
- {\r
- scale += Math.abs(value[i][k]);\r
- }\r
-\r
- if (scale == 0.0)\r
- {\r
- e[i] = value[i][l];\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
- {\r
- g = -1.0 * Math.sqrt(h);\r
- }\r
- else\r
- {\r
- g = Math.sqrt(h);\r
- }\r
-\r
- e[i] = scale * g;\r
- h -= (f * g);\r
- value[i][l] = f - g;\r
- f = 0.0;\r
-\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
- {\r
- g += (value[j][k] * value[i][k]);\r
- }\r
-\r
- for (k = j; k < l; k++)\r
- {\r
- g += (value[k][j] * value[i][k]);\r
- }\r
-\r
- e[j] = g / h;\r
- f += (e[j] * value[i][j]);\r
- }\r
-\r
- hh = f / (h + h);\r
-\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
- {\r
- value[j][k] -= ( (f * e[k]) + (g * value[i][k]));\r
- }\r
- }\r
- }\r
- }\r
- else\r
- {\r
- e[i] = value[i][l];\r
- }\r
-\r
- d[i] = h;\r
- }\r
-\r
- d[0] = 0.0;\r
- e[0] = 0.0;\r
-\r
- for (i = 0; i < n; i++)\r
- {\r
- l = i - 1;\r
-\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
- {\r
- g += (value[i][k] * value[k][j]);\r
- }\r
-\r
- for (k = 0; k < l; k++)\r
- {\r
- value[k][j] -= (g * value[k][i]);\r
- }\r
- }\r
- }\r
-\r
- d[i] = value[i][i];\r
- value[i][i] = 1.0;\r
-\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
- /**\r
- * DOCUMENT ME!\r
- */\r
- public void tqli2()\r
- {\r
- int n = rows;\r
-\r
- int m;\r
- int l;\r
- int iter;\r
- int i;\r
- int k;\r
- double s;\r
- double r;\r
- double p;\r
- ;\r
-\r
- double g;\r
- double f;\r
- double dd;\r
- double c;\r
- double b;\r
-\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
- {\r
- iter = 0;\r
-\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
- {\r
- break;\r
- }\r
- }\r
-\r
- if (m != l)\r
- {\r
- iter++;\r
-\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
- }\r
- else\r
- {\r
- // System.out.println("Iteration " + iter);\r
- }\r
-\r
- g = (d[l] - d[l - 1]) / (2.0 * e[l - 1]);\r
- r = Math.sqrt( (g * g) + 1.0);\r
- g = d[m - 1] - d[l - 1] + (e[l - 1] / (g + sign(r, g)));\r
- c = 1.0;\r
- s = c;\r
- p = 0.0;\r
-\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
- {\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
- }\r
- else\r
- {\r
- s = f / g;\r
- r = Math.sqrt( (s * s) + 1.0);\r
- e[i] = g * r;\r
- c = 1.0 / r;\r
- s *= c;\r
- }\r
-\r
- g = d[i] - p;\r
- r = ( (d[i - 1] - g) * s) + (2.0 * c * b);\r
- p = s * r;\r
- d[i] = g + p;\r
- g = (c * r) - b;\r
-\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
- value[k - 1][i - 1] = (c * value[k - 1][i - 1]) -\r
- (s * f);\r
- }\r
- }\r
-\r
- d[l - 1] = d[l - 1] - p;\r
- e[l - 1] = g;\r
- e[m - 1] = 0.0;\r
- }\r
- }\r
- while (m != l);\r
- }\r
- }\r
-\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
- }\r
- else\r
- {\r
- return Math.abs(a);\r
- }\r
- }\r
-\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
- {\r
- out[i] = value[i][n];\r
- }\r
-\r
- return out;\r
- }\r
-\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
- /**\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
- /**\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
- {\r
- for (int j = 0; j < n; j++)\r
- {\r
- in[i][j] = (double) Math.random();\r
- }\r
- }\r
-\r
- Matrix origmat = new Matrix(in, n, n);\r
-\r
- // System.out.println(" --- Original matrix ---- ");\r
- /// origmat.print(System.out);\r
- //System.out.println();\r
- //System.out.println(" --- transpose matrix ---- ");\r
- Matrix trans = origmat.transpose();\r
-\r
- //trans.print(System.out);\r
- //System.out.println();\r
- //System.out.println(" --- OrigT * Orig ---- ");\r
- Matrix symm = trans.postMultiply(origmat);\r
-\r
- //symm.print(System.out);\r
- //System.out.println();\r
- // Copy the symmetric matrix for later\r
- //Matrix origsymm = symm.copy();\r
-\r
- // This produces the tridiagonal transformation matrix\r
- //long tstart = System.currentTimeMillis();\r
- symm.tred();\r
-\r
- //long tend = System.currentTimeMillis();\r
-\r
- //System.out.println("Time take for tred = " + (tend-tstart) + "ms");\r
- //System.out.println(" ---Tridiag transform matrix ---");\r
- //symm.print(System.out);\r
- //System.out.println();\r
- //System.out.println(" --- D vector ---");\r
- //symm.printD(System.out);\r
- //System.out.println();\r
- //System.out.println(" --- E vector ---");\r
- //symm.printE(System.out);\r
- //System.out.println();\r
- // Now produce the diagonalization matrix\r
- //tstart = System.currentTimeMillis();\r
- symm.tqli();\r
- //tend = System.currentTimeMillis();\r
-\r
- //System.out.println("Time take for tqli = " + (tend-tstart) + " ms");\r
- //System.out.println(" --- New diagonalization matrix ---");\r
- //symm.print(System.out);\r
- //System.out.println();\r
- //System.out.println(" --- D vector ---");\r
- //symm.printD(System.out);\r
- //System.out.println();\r
- //System.out.println(" --- E vector ---");\r
- //symm.printE(System.out);\r
- //System.out.println();\r
- //System.out.println(" --- First eigenvector --- ");\r
- //double[] eigenv = symm.getColumn(0);\r
- //for (int i=0; i < eigenv.length;i++) {\r
- // Format.print(System.out,"%15.4f",eigenv[i]);\r
- // }\r
- //System.out.println();\r
- //double[] neigenv = origsymm.vectorPostMultiply(eigenv);\r
- //for (int i=0; i < neigenv.length;i++) {\r
- // Format.print(System.out,"%15.4f",neigenv[i]/symm.d[0]);\r
- //}\r
- //System.out.println();\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.math;
+
+import java.io.*;
+
+import jalview.util.*;
+
+/**
+ * DOCUMENT ME!
+ *
+ * @author $author$
+ * @version $Revision$
+ */
+public class Matrix
+{
+ /**
+ * SMJSPUBLIC
+ */
+ public double[][] value;
+
+ /** DOCUMENT ME!! */
+ public int rows;
+
+ /** DOCUMENT ME!! */
+ public int cols;
+
+ /** DOCUMENT ME!! */
+ public double[] d; // Diagonal
+
+ /** DOCUMENT ME!! */
+ public double[] e; // off diagonal
+
+ /**
+ * Creates a new Matrix object.
+ *
+ * @param value DOCUMENT ME!
+ * @param rows DOCUMENT ME!
+ * @param cols DOCUMENT ME!
+ */
+ public Matrix(double[][] value, int rows, int cols)
+ {
+ this.rows = rows;
+ this.cols = cols;
+ this.value = value;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public Matrix transpose()
+ {
+ double[][] out = new double[cols][rows];
+
+ for (int i = 0; i < cols; i++)
+ {
+ for (int j = 0; j < rows; j++)
+ {
+ out[i][j] = value[j][i];
+ }
+ }
+
+ return new Matrix(out, cols, rows);
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param ps DOCUMENT ME!
+ */
+ public void print(PrintStream ps)
+ {
+ for (int i = 0; i < rows; i++)
+ {
+ for (int j = 0; j < cols; j++)
+ {
+ Format.print(ps, "%8.2f", value[i][j]);
+ }
+
+ ps.println();
+ }
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param in DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public Matrix preMultiply(Matrix in)
+ {
+ double[][] tmp = new double[in.rows][this.cols];
+
+ for (int i = 0; i < in.rows; i++)
+ {
+ for (int j = 0; j < this.cols; j++)
+ {
+ tmp[i][j] = 0.0;
+
+ for (int k = 0; k < in.cols; k++)
+ {
+ tmp[i][j] += (in.value[i][k] * this.value[k][j]);
+ }
+ }
+ }
+
+ return new Matrix(tmp, in.rows, this.cols);
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param in DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public double[] vectorPostMultiply(double[] in)
+ {
+ double[] out = new double[in.length];
+
+ for (int i = 0; i < in.length; i++)
+ {
+ out[i] = 0.0;
+
+ for (int k = 0; k < in.length; k++)
+ {
+ out[i] += (value[i][k] * in[k]);
+ }
+ }
+
+ return out;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param in DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public Matrix postMultiply(Matrix in)
+ {
+ double[][] out = new double[this.rows][in.cols];
+
+ for (int i = 0; i < this.rows; i++)
+ {
+ for (int j = 0; j < in.cols; j++)
+ {
+ out[i][j] = 0.0;
+
+ for (int k = 0; k < rows; k++)
+ {
+ out[i][j] = out[i][j] + (value[i][k] * in.value[k][j]);
+ }
+ }
+ }
+
+ return new Matrix(out, this.cols, in.rows);
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public Matrix copy()
+ {
+ double[][] newmat = new double[rows][cols];
+
+ for (int i = 0; i < rows; i++)
+ {
+ for (int j = 0; j < cols; j++)
+ {
+ newmat[i][j] = value[i][j];
+ }
+ }
+
+ return new Matrix(newmat, rows, cols);
+ }
+
+ /**
+ * DOCUMENT ME!
+ */
+ public void tred()
+ {
+ int n = rows;
+ int l;
+ int k;
+ int j;
+ int i;
+
+ double scale;
+ double hh;
+ double h;
+ double g;
+ double f;
+
+ this.d = new double[rows];
+ this.e = new double[rows];
+
+ for (i = n; i >= 2; i--)
+ {
+ l = i - 1;
+ h = 0.0;
+ scale = 0.0;
+
+ if (l > 1)
+ {
+ for (k = 1; k <= l; k++)
+ {
+ scale += Math.abs(value[i - 1][k - 1]);
+ }
+
+ if (scale == 0.0)
+ {
+ e[i - 1] = value[i - 1][l - 1];
+ }
+ else
+ {
+ for (k = 1; k <= l; k++)
+ {
+ value[i - 1][k - 1] /= scale;
+ h += (value[i - 1][k - 1] * value[i - 1][k - 1]);
+ }
+
+ f = value[i - 1][l - 1];
+
+ if (f > 0)
+ {
+ g = -1.0 * Math.sqrt(h);
+ }
+ else
+ {
+ g = Math.sqrt(h);
+ }
+
+ e[i - 1] = scale * g;
+ h -= (f * g);
+ value[i - 1][l - 1] = f - g;
+ f = 0.0;
+
+ for (j = 1; j <= l; j++)
+ {
+ value[j - 1][i - 1] = value[i - 1][j - 1] / h;
+ g = 0.0;
+
+ for (k = 1; k <= j; k++)
+ {
+ g += (value[j - 1][k - 1] * value[i - 1][k - 1]);
+ }
+
+ for (k = j + 1; k <= l; k++)
+ {
+ g += (value[k - 1][j - 1] * value[i - 1][k - 1]);
+ }
+
+ e[j - 1] = g / h;
+ f += (e[j - 1] * value[i - 1][j - 1]);
+ }
+
+ hh = f / (h + h);
+
+ for (j = 1; j <= l; j++)
+ {
+ f = value[i - 1][j - 1];
+ g = e[j - 1] - (hh * f);
+ e[j - 1] = g;
+
+ for (k = 1; k <= j; k++)
+ {
+ value[j - 1][k - 1] -= ( (f * e[k - 1]) +
+ (g * value[i - 1][k - 1]));
+ }
+ }
+ }
+ }
+ else
+ {
+ e[i - 1] = value[i - 1][l - 1];
+ }
+
+ d[i - 1] = h;
+ }
+
+ d[0] = 0.0;
+ e[0] = 0.0;
+
+ for (i = 1; i <= n; i++)
+ {
+ l = i - 1;
+
+ if (d[i - 1] != 0.0)
+ {
+ for (j = 1; j <= l; j++)
+ {
+ g = 0.0;
+
+ for (k = 1; k <= l; k++)
+ {
+ g += (value[i - 1][k - 1] * value[k - 1][j - 1]);
+ }
+
+ for (k = 1; k <= l; k++)
+ {
+ value[k - 1][j - 1] -= (g * value[k - 1][i - 1]);
+ }
+ }
+ }
+
+ d[i - 1] = value[i - 1][i - 1];
+ value[i - 1][i - 1] = 1.0;
+
+ for (j = 1; j <= l; j++)
+ {
+ value[j - 1][i - 1] = 0.0;
+ value[i - 1][j - 1] = 0.0;
+ }
+ }
+ }
+
+ /**
+ * DOCUMENT ME!
+ */
+ public void tqli()
+ {
+ int n = rows;
+
+ int m;
+ int l;
+ int iter;
+ int i;
+ int k;
+ double s;
+ double r;
+ double p;
+ ;
+
+ double g;
+ double f;
+ double dd;
+ double c;
+ double b;
+
+ for (i = 2; i <= n; i++)
+ {
+ e[i - 2] = e[i - 1];
+ }
+
+ e[n - 1] = 0.0;
+
+ for (l = 1; l <= n; l++)
+ {
+ iter = 0;
+
+ do
+ {
+ for (m = l; m <= (n - 1); m++)
+ {
+ dd = Math.abs(d[m - 1]) + Math.abs(d[m]);
+
+ if ( (Math.abs(e[m - 1]) + dd) == dd)
+ {
+ break;
+ }
+ }
+
+ if (m != l)
+ {
+ iter++;
+
+ if (iter == 30)
+ {
+ System.err.print("Too many iterations in tqli");
+ System.exit(0); // JBPNote - should this really be here ???
+ }
+ else
+ {
+ // System.out.println("Iteration " + iter);
+ }
+
+ g = (d[l] - d[l - 1]) / (2.0 * e[l - 1]);
+ r = Math.sqrt( (g * g) + 1.0);
+ g = d[m - 1] - d[l - 1] + (e[l - 1] / (g + sign(r, g)));
+ c = 1.0;
+ s = c;
+ p = 0.0;
+
+ for (i = m - 1; i >= l; i--)
+ {
+ f = s * e[i - 1];
+ b = c * e[i - 1];
+
+ if (Math.abs(f) >= Math.abs(g))
+ {
+ c = g / f;
+ r = Math.sqrt( (c * c) + 1.0);
+ e[i] = f * r;
+ s = 1.0 / r;
+ c *= s;
+ }
+ else
+ {
+ s = f / g;
+ r = Math.sqrt( (s * s) + 1.0);
+ e[i] = g * r;
+ c = 1.0 / r;
+ s *= c;
+ }
+
+ g = d[i] - p;
+ r = ( (d[i - 1] - g) * s) + (2.0 * c * b);
+ p = s * r;
+ d[i] = g + p;
+ g = (c * r) - b;
+
+ for (k = 1; k <= n; k++)
+ {
+ f = value[k - 1][i];
+ value[k - 1][i] = (s * value[k - 1][i - 1]) +
+ (c * f);
+ value[k - 1][i - 1] = (c * value[k - 1][i - 1]) -
+ (s * f);
+ }
+ }
+
+ d[l - 1] = d[l - 1] - p;
+ e[l - 1] = g;
+ e[m - 1] = 0.0;
+ }
+ }
+ while (m != l);
+ }
+ }
+
+ /**
+ * DOCUMENT ME!
+ */
+ public void tred2()
+ {
+ int n = rows;
+ int l;
+ int k;
+ int j;
+ int i;
+
+ double scale;
+ double hh;
+ double h;
+ double g;
+ double f;
+
+ this.d = new double[rows];
+ this.e = new double[rows];
+
+ for (i = n - 1; i >= 1; i--)
+ {
+ l = i - 1;
+ h = 0.0;
+ scale = 0.0;
+
+ if (l > 0)
+ {
+ for (k = 0; k < l; k++)
+ {
+ scale += Math.abs(value[i][k]);
+ }
+
+ if (scale == 0.0)
+ {
+ e[i] = value[i][l];
+ }
+ else
+ {
+ for (k = 0; k < l; k++)
+ {
+ value[i][k] /= scale;
+ h += (value[i][k] * value[i][k]);
+ }
+
+ f = value[i][l];
+
+ if (f > 0)
+ {
+ g = -1.0 * Math.sqrt(h);
+ }
+ else
+ {
+ g = Math.sqrt(h);
+ }
+
+ e[i] = scale * g;
+ h -= (f * g);
+ value[i][l] = f - g;
+ f = 0.0;
+
+ for (j = 0; j < l; j++)
+ {
+ value[j][i] = value[i][j] / h;
+ g = 0.0;
+
+ for (k = 0; k < j; k++)
+ {
+ g += (value[j][k] * value[i][k]);
+ }
+
+ for (k = j; k < l; k++)
+ {
+ g += (value[k][j] * value[i][k]);
+ }
+
+ e[j] = g / h;
+ f += (e[j] * value[i][j]);
+ }
+
+ hh = f / (h + h);
+
+ for (j = 0; j < l; j++)
+ {
+ f = value[i][j];
+ g = e[j] - (hh * f);
+ e[j] = g;
+
+ for (k = 0; k < j; k++)
+ {
+ value[j][k] -= ( (f * e[k]) + (g * value[i][k]));
+ }
+ }
+ }
+ }
+ else
+ {
+ e[i] = value[i][l];
+ }
+
+ d[i] = h;
+ }
+
+ d[0] = 0.0;
+ e[0] = 0.0;
+
+ for (i = 0; i < n; i++)
+ {
+ l = i - 1;
+
+ if (d[i] != 0.0)
+ {
+ for (j = 0; j < l; j++)
+ {
+ g = 0.0;
+
+ for (k = 0; k < l; k++)
+ {
+ g += (value[i][k] * value[k][j]);
+ }
+
+ for (k = 0; k < l; k++)
+ {
+ value[k][j] -= (g * value[k][i]);
+ }
+ }
+ }
+
+ d[i] = value[i][i];
+ value[i][i] = 1.0;
+
+ for (j = 0; j < l; j++)
+ {
+ value[j][i] = 0.0;
+ value[i][j] = 0.0;
+ }
+ }
+ }
+
+ /**
+ * DOCUMENT ME!
+ */
+ public void tqli2()
+ {
+ int n = rows;
+
+ int m;
+ int l;
+ int iter;
+ int i;
+ int k;
+ double s;
+ double r;
+ double p;
+ ;
+
+ double g;
+ double f;
+ double dd;
+ double c;
+ double b;
+
+ for (i = 2; i <= n; i++)
+ {
+ e[i - 2] = e[i - 1];
+ }
+
+ e[n - 1] = 0.0;
+
+ for (l = 1; l <= n; l++)
+ {
+ iter = 0;
+
+ do
+ {
+ for (m = l; m <= (n - 1); m++)
+ {
+ dd = Math.abs(d[m - 1]) + Math.abs(d[m]);
+
+ if ( (Math.abs(e[m - 1]) + dd) == dd)
+ {
+ break;
+ }
+ }
+
+ if (m != l)
+ {
+ iter++;
+
+ if (iter == 30)
+ {
+ System.err.print("Too many iterations in tqli");
+ System.exit(0); // JBPNote - same as above - not a graceful exit!
+ }
+ else
+ {
+ // System.out.println("Iteration " + iter);
+ }
+
+ g = (d[l] - d[l - 1]) / (2.0 * e[l - 1]);
+ r = Math.sqrt( (g * g) + 1.0);
+ g = d[m - 1] - d[l - 1] + (e[l - 1] / (g + sign(r, g)));
+ c = 1.0;
+ s = c;
+ p = 0.0;
+
+ for (i = m - 1; i >= l; i--)
+ {
+ f = s * e[i - 1];
+ b = c * e[i - 1];
+
+ if (Math.abs(f) >= Math.abs(g))
+ {
+ c = g / f;
+ r = Math.sqrt( (c * c) + 1.0);
+ e[i] = f * r;
+ s = 1.0 / r;
+ c *= s;
+ }
+ else
+ {
+ s = f / g;
+ r = Math.sqrt( (s * s) + 1.0);
+ e[i] = g * r;
+ c = 1.0 / r;
+ s *= c;
+ }
+
+ g = d[i] - p;
+ r = ( (d[i - 1] - g) * s) + (2.0 * c * b);
+ p = s * r;
+ d[i] = g + p;
+ g = (c * r) - b;
+
+ for (k = 1; k <= n; k++)
+ {
+ f = value[k - 1][i];
+ value[k - 1][i] = (s * value[k - 1][i - 1]) +
+ (c * f);
+ value[k - 1][i - 1] = (c * value[k - 1][i - 1]) -
+ (s * f);
+ }
+ }
+
+ d[l - 1] = d[l - 1] - p;
+ e[l - 1] = g;
+ e[m - 1] = 0.0;
+ }
+ }
+ while (m != l);
+ }
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param a DOCUMENT ME!
+ * @param b DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public double sign(double a, double b)
+ {
+ if (b < 0)
+ {
+ return -Math.abs(a);
+ }
+ else
+ {
+ return Math.abs(a);
+ }
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param n DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public double[] getColumn(int n)
+ {
+ double[] out = new double[rows];
+
+ for (int i = 0; i < rows; i++)
+ {
+ out[i] = value[i][n];
+ }
+
+ return out;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param ps DOCUMENT ME!
+ */
+ public void printD(PrintStream ps)
+ {
+ for (int j = 0; j < rows; j++)
+ {
+ Format.print(ps, "%15.4e", d[j]);
+ }
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param ps DOCUMENT ME!
+ */
+ public void printE(PrintStream ps)
+ {
+ for (int j = 0; j < rows; j++)
+ {
+ Format.print(ps, "%15.4e", e[j]);
+ }
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param args DOCUMENT ME!
+ */
+ public static void main(String[] args)
+ {
+ int n = Integer.parseInt(args[0]);
+ double[][] in = new double[n][n];
+
+ for (int i = 0; i < n; i++)
+ {
+ for (int j = 0; j < n; j++)
+ {
+ in[i][j] = (double) Math.random();
+ }
+ }
+
+ Matrix origmat = new Matrix(in, n, n);
+
+ // System.out.println(" --- Original matrix ---- ");
+ /// origmat.print(System.out);
+ //System.out.println();
+ //System.out.println(" --- transpose matrix ---- ");
+ Matrix trans = origmat.transpose();
+
+ //trans.print(System.out);
+ //System.out.println();
+ //System.out.println(" --- OrigT * Orig ---- ");
+ Matrix symm = trans.postMultiply(origmat);
+
+ //symm.print(System.out);
+ //System.out.println();
+ // Copy the symmetric matrix for later
+ //Matrix origsymm = symm.copy();
+
+ // This produces the tridiagonal transformation matrix
+ //long tstart = System.currentTimeMillis();
+ symm.tred();
+
+ //long tend = System.currentTimeMillis();
+
+ //System.out.println("Time take for tred = " + (tend-tstart) + "ms");
+ //System.out.println(" ---Tridiag transform matrix ---");
+ //symm.print(System.out);
+ //System.out.println();
+ //System.out.println(" --- D vector ---");
+ //symm.printD(System.out);
+ //System.out.println();
+ //System.out.println(" --- E vector ---");
+ //symm.printE(System.out);
+ //System.out.println();
+ // Now produce the diagonalization matrix
+ //tstart = System.currentTimeMillis();
+ symm.tqli();
+ //tend = System.currentTimeMillis();
+
+ //System.out.println("Time take for tqli = " + (tend-tstart) + " ms");
+ //System.out.println(" --- New diagonalization matrix ---");
+ //symm.print(System.out);
+ //System.out.println();
+ //System.out.println(" --- D vector ---");
+ //symm.printD(System.out);
+ //System.out.println();
+ //System.out.println(" --- E vector ---");
+ //symm.printE(System.out);
+ //System.out.println();
+ //System.out.println(" --- First eigenvector --- ");
+ //double[] eigenv = symm.getColumn(0);
+ //for (int i=0; i < eigenv.length;i++) {
+ // Format.print(System.out,"%15.4f",eigenv[i]);
+ // }
+ //System.out.println();
+ //double[] neigenv = origsymm.vectorPostMultiply(eigenv);
+ //for (int i=0; i < neigenv.length;i++) {
+ // Format.print(System.out,"%15.4f",neigenv[i]/symm.d[0]);
+ //}
+ //System.out.println();
+ }
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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.math;\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
- /**\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
-\r
- rot = new float[3][3];\r
- }\r
-\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
- /**\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
- System.out.println(matrix[1][0] + " " + matrix[1][1] + " " +\r
- matrix[1][2]);\r
-\r
- System.out.println(matrix[2][0] + " " + matrix[2][1] + " " +\r
- matrix[2][2]);\r
- }\r
-\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
- {\r
- rot[0][0] = (float) costheta;\r
-\r
- rot[0][1] = (float) - sintheta;\r
-\r
- rot[0][2] = (float) 0.0;\r
-\r
- rot[1][0] = (float) sintheta;\r
-\r
- rot[1][1] = (float) costheta;\r
-\r
- rot[1][2] = (float) 0.0;\r
-\r
- rot[2][0] = (float) 0.0;\r
-\r
- rot[2][1] = (float) 0.0;\r
-\r
- rot[2][2] = (float) 1.0;\r
-\r
- preMultiply(rot);\r
- }\r
-\r
- if (axis == 'x')\r
- {\r
- rot[0][0] = (float) 1.0;\r
-\r
- rot[0][1] = (float) 0.0;\r
-\r
- rot[0][2] = (float) 0.0;\r
-\r
- rot[1][0] = (float) 0.0;\r
-\r
- rot[1][1] = (float) costheta;\r
-\r
- rot[1][2] = (float) sintheta;\r
-\r
- rot[2][0] = (float) 0.0;\r
-\r
- rot[2][1] = (float) - sintheta;\r
-\r
- rot[2][2] = (float) costheta;\r
-\r
- preMultiply(rot);\r
- }\r
-\r
- if (axis == 'y')\r
- {\r
- rot[0][0] = (float) costheta;\r
-\r
- rot[0][1] = (float) 0.0;\r
-\r
- rot[0][2] = (float) - sintheta;\r
-\r
- rot[1][0] = (float) 0.0;\r
-\r
- rot[1][1] = (float) 1.0;\r
-\r
- rot[1][2] = (float) 0.0;\r
-\r
- rot[2][0] = (float) sintheta;\r
-\r
- rot[2][1] = (float) 0.0;\r
-\r
- rot[2][2] = (float) costheta;\r
-\r
- preMultiply(rot);\r
- }\r
- }\r
-\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
- {\r
- temp[i] = (matrix[i][0] * vect[0]) + (matrix[i][1] * vect[1]) +\r
- (matrix[i][2] * vect[2]);\r
- }\r
-\r
- vect[0] = temp[0];\r
-\r
- vect[1] = temp[1];\r
-\r
- vect[2] = temp[2];\r
-\r
- return vect;\r
- }\r
-\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
- {\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
- {\r
- for (int j = 0; j < 3; j++)\r
- {\r
- matrix[i][j] = tmp[i][j];\r
- }\r
- }\r
- }\r
-\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
- {\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
- {\r
- for (int j = 0; j < 3; j++)\r
- {\r
- matrix[i][j] = tmp[i][j];\r
- }\r
- }\r
- }\r
-\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
-\r
- m.addElement(0, 1, 0);\r
-\r
- m.addElement(0, 2, 0);\r
-\r
- m.addElement(1, 0, 0);\r
-\r
- m.addElement(1, 1, 2);\r
-\r
- m.addElement(1, 2, 0);\r
-\r
- m.addElement(2, 0, 0);\r
-\r
- m.addElement(2, 1, 0);\r
-\r
- m.addElement(2, 2, 1);\r
-\r
- m.print();\r
-\r
- RotatableMatrix n = new RotatableMatrix(3, 3);\r
-\r
- n.addElement(0, 0, 2);\r
-\r
- n.addElement(0, 1, 1);\r
-\r
- n.addElement(0, 2, 1);\r
-\r
- n.addElement(1, 0, 2);\r
-\r
- n.addElement(1, 1, 1);\r
-\r
- n.addElement(1, 2, 1);\r
-\r
- n.addElement(2, 0, 2);\r
-\r
- n.addElement(2, 1, 1);\r
-\r
- n.addElement(2, 2, 1);\r
-\r
- n.print();\r
-\r
- //m.postMultiply(n.matrix);\r
- //m.print();\r
- // m.rotate(45,'z',new RotatableMatrix(3,3));\r
- float[] vect = new float[3];\r
-\r
- vect[0] = 2;\r
-\r
- vect[1] = 4;\r
-\r
- vect[2] = 6;\r
-\r
- vect = m.vectorMultiply(vect);\r
-\r
- System.out.println(vect[0] + " " + vect[1] + " " + vect[2]);\r
- }\r
-\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
- matrix[2][2] = (float) 1.0;\r
-\r
- matrix[0][1] = (float) 0.0;\r
-\r
- matrix[0][2] = (float) 0.0;\r
-\r
- matrix[1][0] = (float) 0.0;\r
-\r
- matrix[1][2] = (float) 0.0;\r
-\r
- matrix[2][0] = (float) 0.0;\r
-\r
- matrix[2][1] = (float) 0.0;\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.math;
+
+/**
+ * DOCUMENT ME!
+ *
+ * @author $author$
+ * @version $Revision$
+ */
+public class RotatableMatrix
+{
+ float[][] matrix;
+ float[] temp;
+ float[][] rot;
+
+ /**
+ * Creates a new RotatableMatrix object.
+ *
+ * @param rows DOCUMENT ME!
+ * @param cols DOCUMENT ME!
+ */
+ public RotatableMatrix(int rows, int cols)
+ {
+ matrix = new float[rows][cols];
+
+ temp = new float[3];
+
+ rot = new float[3][3];
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param i DOCUMENT ME!
+ * @param j DOCUMENT ME!
+ * @param value DOCUMENT ME!
+ */
+ public void addElement(int i, int j, float value)
+ {
+ matrix[i][j] = value;
+ }
+
+ /**
+ * DOCUMENT ME!
+ */
+ public void print()
+ {
+ System.out.println(matrix[0][0] + " " + matrix[0][1] + " " +
+ matrix[0][2]);
+
+ System.out.println(matrix[1][0] + " " + matrix[1][1] + " " +
+ matrix[1][2]);
+
+ System.out.println(matrix[2][0] + " " + matrix[2][1] + " " +
+ matrix[2][2]);
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param degrees DOCUMENT ME!
+ * @param axis DOCUMENT ME!
+ */
+ public void rotate(float degrees, char axis)
+ {
+ float costheta = (float) Math.cos( (degrees * Math.PI) / (float) 180.0);
+
+ float sintheta = (float) Math.sin( (degrees * Math.PI) / (float) 180.0);
+
+ if (axis == 'z')
+ {
+ rot[0][0] = (float) costheta;
+
+ rot[0][1] = (float) - sintheta;
+
+ rot[0][2] = (float) 0.0;
+
+ rot[1][0] = (float) sintheta;
+
+ rot[1][1] = (float) costheta;
+
+ rot[1][2] = (float) 0.0;
+
+ rot[2][0] = (float) 0.0;
+
+ rot[2][1] = (float) 0.0;
+
+ rot[2][2] = (float) 1.0;
+
+ preMultiply(rot);
+ }
+
+ if (axis == 'x')
+ {
+ rot[0][0] = (float) 1.0;
+
+ rot[0][1] = (float) 0.0;
+
+ rot[0][2] = (float) 0.0;
+
+ rot[1][0] = (float) 0.0;
+
+ rot[1][1] = (float) costheta;
+
+ rot[1][2] = (float) sintheta;
+
+ rot[2][0] = (float) 0.0;
+
+ rot[2][1] = (float) - sintheta;
+
+ rot[2][2] = (float) costheta;
+
+ preMultiply(rot);
+ }
+
+ if (axis == 'y')
+ {
+ rot[0][0] = (float) costheta;
+
+ rot[0][1] = (float) 0.0;
+
+ rot[0][2] = (float) - sintheta;
+
+ rot[1][0] = (float) 0.0;
+
+ rot[1][1] = (float) 1.0;
+
+ rot[1][2] = (float) 0.0;
+
+ rot[2][0] = (float) sintheta;
+
+ rot[2][1] = (float) 0.0;
+
+ rot[2][2] = (float) costheta;
+
+ preMultiply(rot);
+ }
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param vect DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public float[] vectorMultiply(float[] vect)
+ {
+ temp[0] = vect[0];
+
+ temp[1] = vect[1];
+
+ temp[2] = vect[2];
+
+ for (int i = 0; i < 3; i++)
+ {
+ temp[i] = (matrix[i][0] * vect[0]) + (matrix[i][1] * vect[1]) +
+ (matrix[i][2] * vect[2]);
+ }
+
+ vect[0] = temp[0];
+
+ vect[1] = temp[1];
+
+ vect[2] = temp[2];
+
+ return vect;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param mat DOCUMENT ME!
+ */
+ public void preMultiply(float[][] mat)
+ {
+ float[][] tmp = new float[3][3];
+
+ for (int i = 0; i < 3; i++)
+ {
+ for (int j = 0; j < 3; j++)
+ {
+ tmp[i][j] = (mat[i][0] * matrix[0][j]) +
+ (mat[i][1] * matrix[1][j]) + (mat[i][2] * matrix[2][j]);
+ }
+ }
+
+ for (int i = 0; i < 3; i++)
+ {
+ for (int j = 0; j < 3; j++)
+ {
+ matrix[i][j] = tmp[i][j];
+ }
+ }
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param mat DOCUMENT ME!
+ */
+ public void postMultiply(float[][] mat)
+ {
+ float[][] tmp = new float[3][3];
+
+ for (int i = 0; i < 3; i++)
+ {
+ for (int j = 0; j < 3; j++)
+ {
+ tmp[i][j] = (matrix[i][0] * mat[0][j]) +
+ (matrix[i][1] * mat[1][j]) + (matrix[i][2] * mat[2][j]);
+ }
+ }
+
+ for (int i = 0; i < 3; i++)
+ {
+ for (int j = 0; j < 3; j++)
+ {
+ matrix[i][j] = tmp[i][j];
+ }
+ }
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param args DOCUMENT ME!
+ */
+ public static void main(String[] args)
+ {
+ RotatableMatrix m = new RotatableMatrix(3, 3);
+
+ m.addElement(0, 0, 1);
+
+ m.addElement(0, 1, 0);
+
+ m.addElement(0, 2, 0);
+
+ m.addElement(1, 0, 0);
+
+ m.addElement(1, 1, 2);
+
+ m.addElement(1, 2, 0);
+
+ m.addElement(2, 0, 0);
+
+ m.addElement(2, 1, 0);
+
+ m.addElement(2, 2, 1);
+
+ m.print();
+
+ RotatableMatrix n = new RotatableMatrix(3, 3);
+
+ n.addElement(0, 0, 2);
+
+ n.addElement(0, 1, 1);
+
+ n.addElement(0, 2, 1);
+
+ n.addElement(1, 0, 2);
+
+ n.addElement(1, 1, 1);
+
+ n.addElement(1, 2, 1);
+
+ n.addElement(2, 0, 2);
+
+ n.addElement(2, 1, 1);
+
+ n.addElement(2, 2, 1);
+
+ n.print();
+
+ //m.postMultiply(n.matrix);
+ //m.print();
+ // m.rotate(45,'z',new RotatableMatrix(3,3));
+ float[] vect = new float[3];
+
+ vect[0] = 2;
+
+ vect[1] = 4;
+
+ vect[2] = 6;
+
+ vect = m.vectorMultiply(vect);
+
+ System.out.println(vect[0] + " " + vect[1] + " " + vect[2]);
+ }
+
+ /**
+ * DOCUMENT ME!
+ */
+ public void setIdentity()
+ {
+ matrix[0][0] = (float) 1.0;
+
+ matrix[1][1] = (float) 1.0;
+
+ matrix[2][2] = (float) 1.0;
+
+ matrix[0][1] = (float) 0.0;
+
+ matrix[0][2] = (float) 0.0;
+
+ matrix[1][0] = (float) 0.0;
+
+ matrix[1][2] = (float) 0.0;
+
+ matrix[2][0] = (float) 0.0;
+
+ matrix[2][1] = (float) 0.0;
+ }
+}
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2;\r
\r
/**\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2;\r
\r
//---------------------------------/\r
/*
- * This class was automatically generated with
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
- * Schema.
- * $Id$
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.schemabinding.version2;
//---------------------------------/
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2;\r
\r
//---------------------------------/\r
/*
- * This class was automatically generated with
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
- * Schema.
- * $Id$
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.schemabinding.version2;
//---------------------------------/
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2.descriptors;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2.descriptors;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2.descriptors;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2.descriptors;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2.descriptors;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2.descriptors;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2.descriptors;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2.descriptors;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2.descriptors;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2.descriptors;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2.descriptors;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2.descriptors;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2.descriptors;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2.descriptors;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2.descriptors;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2.descriptors;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2.descriptors;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2.descriptors;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2.descriptors;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2.descriptors;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2.descriptors;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2.descriptors;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2.descriptors;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2.descriptors;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2.descriptors;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2.descriptors;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2.descriptors;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2.descriptors;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2.descriptors;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2.descriptors;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2.descriptors;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2.descriptors;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2.descriptors;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2.descriptors;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2.descriptors;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2.descriptors;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2.descriptors;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2.descriptors;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2.descriptors;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2.descriptors;\r
\r
//---------------------------------/\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package jalview.schemabinding.version2.descriptors;\r
\r
//---------------------------------/\r
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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 jalview.datamodel.*;\r
-\r
-public class AnnotationColourGradient\r
- extends ResidueColourScheme\r
-{\r
- public static int NO_THRESHOLD = -1;\r
- public static int BELOW_THRESHOLD = 0;\r
- public static int ABOVE_THRESHOLD = 1;\r
-\r
- public AlignmentAnnotation annotation;\r
- int aboveAnnotationThreshold = -1;\r
- public boolean thresholdIsMinMax = false;\r
-\r
- GraphLine annotationThreshold;\r
-\r
- float r1, g1, b1, rr, gg, bb, dr, dg, db;\r
-\r
- ColourSchemeI colourScheme;\r
-\r
- public boolean predefinedColours = false;\r
-\r
- /**\r
- * Creates a new AnnotationColourGradient object.\r
- */\r
- public AnnotationColourGradient(AlignmentAnnotation annotation,\r
- ColourSchemeI originalColour,\r
- int aboveThreshold)\r
- {\r
- if (originalColour instanceof AnnotationColourGradient)\r
- {\r
- colourScheme = ( (AnnotationColourGradient) originalColour).colourScheme;\r
- }\r
- else\r
- {\r
- colourScheme = originalColour;\r
- }\r
-\r
- this.annotation = annotation;\r
-\r
- aboveAnnotationThreshold = aboveThreshold;\r
-\r
- if (aboveThreshold != NO_THRESHOLD && annotation.threshold != null)\r
- {\r
- annotationThreshold = annotation.threshold;\r
- }\r
- }\r
-\r
- /**\r
- * Creates a new AnnotationColourGradient object.\r
- */\r
- public AnnotationColourGradient(AlignmentAnnotation annotation,\r
- Color minColour, Color maxColour,\r
- int aboveThreshold)\r
- {\r
- this.annotation = annotation;\r
-\r
- aboveAnnotationThreshold = aboveThreshold;\r
-\r
- if (aboveThreshold != NO_THRESHOLD && annotation.threshold != null)\r
- {\r
- annotationThreshold = annotation.threshold;\r
- }\r
-\r
- r1 = minColour.getRed();\r
- g1 = minColour.getGreen();\r
- b1 = minColour.getBlue();\r
-\r
- rr = maxColour.getRed() - r1;\r
- gg = maxColour.getGreen() - g1;\r
- bb = maxColour.getBlue() - b1;\r
- }\r
-\r
- public String getAnnotation()\r
- {\r
- return annotation.label;\r
- }\r
-\r
- public int getAboveThreshold()\r
- {\r
- return aboveAnnotationThreshold;\r
- }\r
-\r
- public float getAnnotationThreshold()\r
- {\r
- if (annotationThreshold == null)\r
- {\r
- return 0;\r
- }\r
- else\r
- {\r
- return annotationThreshold.value;\r
- }\r
- }\r
-\r
- public ColourSchemeI getBaseColour()\r
- {\r
- return colourScheme;\r
- }\r
-\r
- public Color getMinColour()\r
- {\r
- return new Color( (int) r1, (int) g1, (int) b1);\r
- }\r
-\r
- public Color getMaxColour()\r
- {\r
- return new Color( (int) (r1 + rr), (int) (g1 + gg), (int) (b1 + bb));\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param n DOCUMENT ME!\r
- *\r
- * @return DOCUMENT ME!\r
- */\r
- public Color findColour(char c)\r
- {\r
- return Color.red;\r
- }\r
-\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(char c, int j)\r
- {\r
- Color currentColour = Color.white;\r
-\r
- if ( (threshold == 0) || aboveThreshold(c, j))\r
- {\r
- if (j < annotation.annotations.length\r
- && annotation.annotations[j] != null\r
- && !jalview.util.Comparison.isGap(c))\r
- {\r
-\r
- if (predefinedColours)\r
- {\r
- if(annotation.annotations[j].colour != null)\r
- return annotation.annotations[j].colour;\r
- else\r
- return currentColour;\r
- }\r
-\r
- if (aboveAnnotationThreshold == NO_THRESHOLD\r
- ||\r
- (annotationThreshold != null && aboveAnnotationThreshold == ABOVE_THRESHOLD &&\r
- annotation.annotations[j].value >= annotationThreshold.value)\r
- ||\r
- (annotationThreshold != null && aboveAnnotationThreshold == BELOW_THRESHOLD &&\r
- annotation.annotations[j].value <= annotationThreshold.value))\r
- {\r
-\r
- float range=1f;\r
- if (thresholdIsMinMax\r
- && annotation.threshold != null\r
- && aboveAnnotationThreshold == ABOVE_THRESHOLD\r
- && annotation.annotations[j].value>annotation.threshold.value)\r
- {\r
- range =\r
- (annotation.annotations[j].value - annotation.threshold.value) /\r
- (annotation.graphMax - annotation.threshold.value);\r
- }\r
- else if (thresholdIsMinMax\r
- && annotation.threshold != null\r
- && aboveAnnotationThreshold == BELOW_THRESHOLD\r
- && annotation.annotations[j].value > annotation.graphMin)\r
- {\r
- range =\r
- ( annotation.annotations[j].value - annotation.graphMin ) /\r
- (annotation.threshold.value - annotation.graphMin );\r
- }\r
- else\r
- {\r
- range = (annotation.annotations[j].value -\r
- annotation.graphMin) /\r
- (annotation.graphMax - annotation.graphMin);\r
- }\r
-\r
-\r
- if (colourScheme != null)\r
- {\r
- currentColour = colourScheme.findColour(c, j);\r
- }\r
- else if (range != 0)\r
- {\r
- dr = rr * range + r1;\r
- dg = gg * range + g1;\r
- db = bb * range + b1;\r
-\r
- currentColour = new Color( (int) dr, (int) dg, (int) db);\r
- }\r
- }\r
- }\r
- }\r
-\r
- if (conservationColouring)\r
- {\r
- currentColour = applyConservation(currentColour, j);\r
- }\r
-\r
- return currentColour;\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.schemes;
+
+import java.awt.*;
+
+import jalview.datamodel.*;
+
+public class AnnotationColourGradient
+ extends ResidueColourScheme
+{
+ public static int NO_THRESHOLD = -1;
+ public static int BELOW_THRESHOLD = 0;
+ public static int ABOVE_THRESHOLD = 1;
+
+ public AlignmentAnnotation annotation;
+ int aboveAnnotationThreshold = -1;
+ public boolean thresholdIsMinMax = false;
+
+ GraphLine annotationThreshold;
+
+ float r1, g1, b1, rr, gg, bb, dr, dg, db;
+
+ ColourSchemeI colourScheme;
+
+ public boolean predefinedColours = false;
+
+ /**
+ * Creates a new AnnotationColourGradient object.
+ */
+ public AnnotationColourGradient(AlignmentAnnotation annotation,
+ ColourSchemeI originalColour,
+ int aboveThreshold)
+ {
+ if (originalColour instanceof AnnotationColourGradient)
+ {
+ colourScheme = ( (AnnotationColourGradient) originalColour).colourScheme;
+ }
+ else
+ {
+ colourScheme = originalColour;
+ }
+
+ this.annotation = annotation;
+
+ aboveAnnotationThreshold = aboveThreshold;
+
+ if (aboveThreshold != NO_THRESHOLD && annotation.threshold != null)
+ {
+ annotationThreshold = annotation.threshold;
+ }
+ }
+
+ /**
+ * Creates a new AnnotationColourGradient object.
+ */
+ public AnnotationColourGradient(AlignmentAnnotation annotation,
+ Color minColour, Color maxColour,
+ int aboveThreshold)
+ {
+ this.annotation = annotation;
+
+ aboveAnnotationThreshold = aboveThreshold;
+
+ if (aboveThreshold != NO_THRESHOLD && annotation.threshold != null)
+ {
+ annotationThreshold = annotation.threshold;
+ }
+
+ r1 = minColour.getRed();
+ g1 = minColour.getGreen();
+ b1 = minColour.getBlue();
+
+ rr = maxColour.getRed() - r1;
+ gg = maxColour.getGreen() - g1;
+ bb = maxColour.getBlue() - b1;
+ }
+
+ public String getAnnotation()
+ {
+ return annotation.label;
+ }
+
+ public int getAboveThreshold()
+ {
+ return aboveAnnotationThreshold;
+ }
+
+ public float getAnnotationThreshold()
+ {
+ if (annotationThreshold == null)
+ {
+ return 0;
+ }
+ else
+ {
+ return annotationThreshold.value;
+ }
+ }
+
+ public ColourSchemeI getBaseColour()
+ {
+ return colourScheme;
+ }
+
+ public Color getMinColour()
+ {
+ return new Color( (int) r1, (int) g1, (int) b1);
+ }
+
+ public Color getMaxColour()
+ {
+ return new Color( (int) (r1 + rr), (int) (g1 + gg), (int) (b1 + bb));
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param n DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public Color findColour(char c)
+ {
+ return Color.red;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param n DOCUMENT ME!
+ * @param j DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public Color findColour(char c, int j)
+ {
+ Color currentColour = Color.white;
+
+ if ( (threshold == 0) || aboveThreshold(c, j))
+ {
+ if (j < annotation.annotations.length
+ && annotation.annotations[j] != null
+ && !jalview.util.Comparison.isGap(c))
+ {
+
+ if (predefinedColours)
+ {
+ if(annotation.annotations[j].colour != null)
+ return annotation.annotations[j].colour;
+ else
+ return currentColour;
+ }
+
+ if (aboveAnnotationThreshold == NO_THRESHOLD
+ ||
+ (annotationThreshold != null && aboveAnnotationThreshold == ABOVE_THRESHOLD &&
+ annotation.annotations[j].value >= annotationThreshold.value)
+ ||
+ (annotationThreshold != null && aboveAnnotationThreshold == BELOW_THRESHOLD &&
+ annotation.annotations[j].value <= annotationThreshold.value))
+ {
+
+ float range=1f;
+ if (thresholdIsMinMax
+ && annotation.threshold != null
+ && aboveAnnotationThreshold == ABOVE_THRESHOLD
+ && annotation.annotations[j].value>annotation.threshold.value)
+ {
+ range =
+ (annotation.annotations[j].value - annotation.threshold.value) /
+ (annotation.graphMax - annotation.threshold.value);
+ }
+ else if (thresholdIsMinMax
+ && annotation.threshold != null
+ && aboveAnnotationThreshold == BELOW_THRESHOLD
+ && annotation.annotations[j].value > annotation.graphMin)
+ {
+ range =
+ ( annotation.annotations[j].value - annotation.graphMin ) /
+ (annotation.threshold.value - annotation.graphMin );
+ }
+ else
+ {
+ range = (annotation.annotations[j].value -
+ annotation.graphMin) /
+ (annotation.graphMax - annotation.graphMin);
+ }
+
+
+ if (colourScheme != null)
+ {
+ currentColour = colourScheme.findColour(c, j);
+ }
+ else if (range != 0)
+ {
+ dr = rr * range + r1;
+ dg = gg * range + g1;
+ db = bb * range + b1;
+
+ currentColour = new Color( (int) dr, (int) dg, (int) db);
+ }
+ }
+ }
+ }
+
+ if (conservationColouring)
+ {
+ currentColour = applyConservation(currentColour, j);
+ }
+
+ return currentColour;
+ }
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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 jalview.analysis.*;\r
-\r
-public class Blosum62ColourScheme\r
- extends ResidueColourScheme\r
-{\r
- public Blosum62ColourScheme()\r
- {\r
- super();\r
- }\r
-\r
- public Color findColour(char res, int j)\r
- {\r
- if ('a' <= res && res <= 'z')\r
- {\r
- // TO UPPERCASE !!!\r
- res -= ('a' - 'A');\r
- }\r
-\r
- if (consensus == null ||\r
- j >= consensus.length ||\r
- consensus[j] == null ||\r
- (threshold != 0 && !aboveThreshold(res, j)))\r
- {\r
- return Color.white;\r
- }\r
-\r
- Color currentColour;\r
-\r
- if (!jalview.util.Comparison.isGap(res))\r
- {\r
- String max = (String) consensus[j].get(AAFrequency.MAXRESIDUE);\r
-\r
- if (max.indexOf(res) > -1)\r
- {\r
- currentColour = 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(\r
- max.charAt(max_aa), res);\r
- }\r
- while (++max_aa < n);\r
-\r
- if (c > 0)\r
- {\r
- currentColour = new Color(204, 204, 255);\r
- }\r
- else\r
- {\r
- currentColour = Color.white;\r
- }\r
- }\r
-\r
- if (conservationColouring)\r
- {\r
- currentColour = applyConservation(currentColour, j);\r
- }\r
- }\r
- else\r
- {\r
- return Color.white;\r
- }\r
-\r
- return currentColour;\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.schemes;
+
+import java.awt.*;
+
+import jalview.analysis.*;
+
+public class Blosum62ColourScheme
+ extends ResidueColourScheme
+{
+ public Blosum62ColourScheme()
+ {
+ super();
+ }
+
+ public Color findColour(char res, int j)
+ {
+ if ('a' <= res && res <= 'z')
+ {
+ // TO UPPERCASE !!!
+ res -= ('a' - 'A');
+ }
+
+ if (consensus == null ||
+ j >= consensus.length ||
+ consensus[j] == null ||
+ (threshold != 0 && !aboveThreshold(res, j)))
+ {
+ return Color.white;
+ }
+
+ Color currentColour;
+
+ if (!jalview.util.Comparison.isGap(res))
+ {
+ String max = (String) consensus[j].get(AAFrequency.MAXRESIDUE);
+
+ if (max.indexOf(res) > -1)
+ {
+ currentColour = new Color(154, 154, 255);
+ }
+ else
+ {
+ int c = 0;
+ int max_aa = 0;
+ int n = max.length();
+
+ do
+ {
+ c += ResidueProperties.getBLOSUM62(
+ max.charAt(max_aa), res);
+ }
+ while (++max_aa < n);
+
+ if (c > 0)
+ {
+ currentColour = new Color(204, 204, 255);
+ }
+ else
+ {
+ currentColour = Color.white;
+ }
+ }
+
+ if (conservationColouring)
+ {
+ currentColour = applyConservation(currentColour, j);
+ }
+ }
+ else
+ {
+ return Color.white;
+ }
+
+ return currentColour;
+ }
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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
- * DOCUMENT ME!\r
- *\r
- * @author $author$\r
- * @version $Revision$\r
- */\r
-public class BuriedColourScheme\r
- 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
- /**\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
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.schemes;
+
+import java.awt.*;
+
+/**
+ * DOCUMENT ME!
+ *
+ * @author $author$
+ * @version $Revision$
+ */
+public class BuriedColourScheme
+ extends ScoreColourScheme
+{
+ /**
+ * Creates a new BuriedColourScheme object.
+ */
+ public BuriedColourScheme()
+ {
+ super(ResidueProperties.buried, ResidueProperties.buriedmin,
+ ResidueProperties.buriedmax);
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param c DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public Color makeColour(float c)
+ {
+ return new Color(0, (float) (1.0 - c), c);
+ }
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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 interface ColourSchemeI\r
-{\r
- public Color findColour(char c);\r
-\r
- public Color findColour(char c, int j);\r
-\r
- public void setConsensus(java.util.Hashtable[] h);\r
-\r
- public void setConservation(jalview.analysis.Conservation c);\r
-\r
- public boolean conservationApplied();\r
-\r
- public void setConservationInc(int i);\r
-\r
- public int getConservationInc();\r
-\r
- public int getThreshold();\r
-\r
- public void setThreshold(int ct, boolean ignoreGaps);\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.schemes;
+
+import java.awt.*;
+
+public interface ColourSchemeI
+{
+ public Color findColour(char c);
+
+ public Color findColour(char c, int j);
+
+ public void setConsensus(java.util.Hashtable[] h);
+
+ public void setConservation(jalview.analysis.Conservation c);
+
+ public boolean conservationApplied();
+
+ public void setConservationInc(int i);
+
+ public int getConservationInc();
+
+ public int getThreshold();
+
+ public void setThreshold(int ct, boolean ignoreGaps);
+
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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 Color makeColour(float c)\r
- {\r
- return new Color(c, (float) 1.0 - c, c);\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.schemes;
+
+import java.awt.*;
+
+public class HelixColourScheme
+ extends ScoreColourScheme
+{
+ public HelixColourScheme()
+ {
+ super(ResidueProperties.helix, ResidueProperties.helixmin,
+ ResidueProperties.helixmax);
+ }
+
+ public Color makeColour(float c)
+ {
+ return new Color(c, (float) 1.0 - c, c);
+ }
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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
- * DOCUMENT ME!\r
- *\r
- * @author $author$\r
- * @version $Revision$\r
- */\r
-public class HydrophobicColourScheme\r
- 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
- /**\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
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.schemes;
+
+import java.awt.*;
+
+/**
+ * DOCUMENT ME!
+ *
+ * @author $author$
+ * @version $Revision$
+ */
+public class HydrophobicColourScheme
+ extends ScoreColourScheme
+{
+ /**
+ * Creates a new HydrophobicColourScheme object.
+ */
+ public HydrophobicColourScheme()
+ {
+ super(ResidueProperties.hyd, ResidueProperties.hydmin,
+ ResidueProperties.hydmax);
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param c DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public Color makeColour(float c)
+ {
+ return new Color(c, (float) 0.0, (float) 1.0 - c);
+ }
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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
- * DOCUMENT ME!\r
- *\r
- * @author $author$\r
- * @version $Revision$\r
- */\r
-public class NucleotideColourScheme\r
- extends ResidueColourScheme\r
-{\r
- /**\r
- * Creates a new NucleotideColourScheme object.\r
- */\r
- public NucleotideColourScheme()\r
- {\r
- super(ResidueProperties.nucleotide, 0);\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param n DOCUMENT ME!\r
- *\r
- * @return DOCUMENT ME!\r
- */\r
- public Color findColour(char c)\r
- {\r
- // System.out.println("called"); log.debug\r
- return colors[ResidueProperties.nucleotideIndex[c]];\r
- }\r
-\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(char c, int j)\r
- {\r
- Color currentColour;\r
- if ( (threshold == 0) || aboveThreshold(c, j))\r
- {\r
- try\r
- {\r
- currentColour = colors[ResidueProperties.nucleotideIndex[c]];\r
- }\r
- catch (Exception ex)\r
- {\r
- return Color.white;\r
- }\r
- }\r
- else\r
- {\r
- return Color.white;\r
- }\r
-\r
- if (conservationColouring)\r
- {\r
- currentColour = applyConservation(currentColour, j);\r
- }\r
-\r
- return currentColour;\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.schemes;
+
+import java.awt.*;
+
+/**
+ * DOCUMENT ME!
+ *
+ * @author $author$
+ * @version $Revision$
+ */
+public class NucleotideColourScheme
+ extends ResidueColourScheme
+{
+ /**
+ * Creates a new NucleotideColourScheme object.
+ */
+ public NucleotideColourScheme()
+ {
+ super(ResidueProperties.nucleotide, 0);
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param n DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public Color findColour(char c)
+ {
+ // System.out.println("called"); log.debug
+ return colors[ResidueProperties.nucleotideIndex[c]];
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param n DOCUMENT ME!
+ * @param j DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public Color findColour(char c, int j)
+ {
+ Color currentColour;
+ if ( (threshold == 0) || aboveThreshold(c, j))
+ {
+ try
+ {
+ currentColour = colors[ResidueProperties.nucleotideIndex[c]];
+ }
+ catch (Exception ex)
+ {
+ return Color.white;
+ }
+ }
+ else
+ {
+ return Color.white;
+ }
+
+ if (conservationColouring)
+ {
+ currentColour = applyConservation(currentColour, j);
+ }
+
+ return currentColour;
+ }
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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 jalview.analysis.*;\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 PIDColourScheme()\r
- {\r
- this.pidColours = ResidueProperties.pidColours;\r
- this.thresholds = ResidueProperties.pidThresholds;\r
- }\r
-\r
- public Color findColour(char c, int j)\r
- {\r
- if ('a' <= c && c <= 'z')\r
- {\r
- c -= ('a' - 'A');\r
- }\r
-\r
- if (consensus == null\r
- || j >= consensus.length\r
- || consensus[j] == null)\r
- {\r
- return Color.white;\r
- }\r
-\r
- if ( (threshold != 0) && !aboveThreshold(c, j))\r
- {\r
- return Color.white;\r
- }\r
-\r
- Color currentColour = Color.white;\r
-\r
- double sc = 0;\r
-\r
- if (consensus.length <= j)\r
- {\r
- return Color.white;\r
- }\r
-\r
- if ( (Integer.parseInt(consensus[j].get(AAFrequency.MAXCOUNT).toString()) !=\r
- -1) &&\r
- consensus[j].contains(String.valueOf(c)))\r
- {\r
- sc = ( (Float) consensus[j].get(ignoreGaps)).floatValue();\r
-\r
- if (!jalview.util.Comparison.isGap(c))\r
- {\r
- for (int i = 0; i < thresholds.length; i++)\r
- {\r
- if (sc > thresholds[i])\r
- {\r
- currentColour = pidColours[i];\r
-\r
- break;\r
- }\r
- }\r
- }\r
- }\r
-\r
- if (conservationColouring)\r
- {\r
- currentColour = applyConservation(currentColour, j);\r
- }\r
-\r
- return currentColour;\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.schemes;
+
+import java.awt.*;
+
+import jalview.analysis.*;
+import jalview.datamodel.*;
+
+public class PIDColourScheme
+ extends ResidueColourScheme
+{
+ public Color[] pidColours;
+ public float[] thresholds;
+ SequenceGroup group;
+
+ public PIDColourScheme()
+ {
+ this.pidColours = ResidueProperties.pidColours;
+ this.thresholds = ResidueProperties.pidThresholds;
+ }
+
+ public Color findColour(char c, int j)
+ {
+ if ('a' <= c && c <= 'z')
+ {
+ c -= ('a' - 'A');
+ }
+
+ if (consensus == null
+ || j >= consensus.length
+ || consensus[j] == null)
+ {
+ return Color.white;
+ }
+
+ if ( (threshold != 0) && !aboveThreshold(c, j))
+ {
+ return Color.white;
+ }
+
+ Color currentColour = Color.white;
+
+ double sc = 0;
+
+ if (consensus.length <= j)
+ {
+ return Color.white;
+ }
+
+ if ( (Integer.parseInt(consensus[j].get(AAFrequency.MAXCOUNT).toString()) !=
+ -1) &&
+ consensus[j].contains(String.valueOf(c)))
+ {
+ sc = ( (Float) consensus[j].get(ignoreGaps)).floatValue();
+
+ if (!jalview.util.Comparison.isGap(c))
+ {
+ for (int i = 0; i < thresholds.length; i++)
+ {
+ if (sc > thresholds[i])
+ {
+ currentColour = pidColours[i];
+
+ break;
+ }
+ }
+ }
+ }
+
+ if (conservationColouring)
+ {
+ currentColour = applyConservation(currentColour, j);
+ }
+
+ return currentColour;
+ }
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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.util.*;\r
-\r
-import java.awt.*;\r
-\r
-import jalview.analysis.*;\r
-\r
-/**\r
- * DOCUMENT ME!\r
- *\r
- * @author $author$\r
- * @version $Revision$\r
- */\r
-public class ResidueColourScheme\r
- implements ColourSchemeI\r
-{\r
-\r
- boolean conservationColouring = false;\r
-\r
- Color[] colors;\r
- int threshold = 0;\r
-\r
- /* Set when threshold colouring to either pid_gaps or pid_nogaps*/\r
- protected String ignoreGaps = AAFrequency.PID_GAPS;\r
-\r
- /** Consenus as a hashtable array */\r
- Hashtable[] consensus;\r
-\r
- /** Conservation string as a char array */\r
- char[] conservation;\r
- int conservationLength=0;\r
-\r
- /** DOCUMENT ME!! */\r
- int inc = 30;\r
-\r
- /**\r
- * Creates a new ResidueColourScheme object.\r
- *\r
- * @param colors DOCUMENT ME!\r
- * @param threshold DOCUMENT ME!\r
- */\r
- public ResidueColourScheme(Color[] colours, int threshold)\r
- {\r
- this.colors = colours;\r
- this.threshold = threshold;\r
- }\r
-\r
- /**\r
- * Creates a new ResidueColourScheme object.\r
- */\r
- public ResidueColourScheme()\r
- {\r
- }\r
-\r
- /**\r
- * Find a colour without an index in a sequence\r
- */\r
- public Color findColour(char c)\r
- {\r
- return colors[ResidueProperties.aaIndex[c]];\r
- }\r
-\r
- public Color findColour(char c, int j)\r
- {\r
- Color currentColour;\r
-\r
- if ( (threshold == 0) || aboveThreshold(c, j))\r
- {\r
- currentColour = colors[ResidueProperties.aaIndex[c]];\r
- }\r
- else\r
- {\r
- currentColour = Color.white;\r
- }\r
-\r
- if (conservationColouring)\r
- {\r
- currentColour = applyConservation(currentColour, j);\r
- }\r
-\r
- return currentColour;\r
- }\r
-\r
- /**\r
- * Get the percentage threshold for this colour scheme\r
- *\r
- * @return Returns the percentage threshold\r
- */\r
- public int getThreshold()\r
- {\r
- return threshold;\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param ct DOCUMENT ME!\r
- */\r
- public void setThreshold(int ct, boolean ignoreGaps)\r
- {\r
- threshold = ct;\r
- if (ignoreGaps)\r
- {\r
- this.ignoreGaps = AAFrequency.PID_NOGAPS;\r
- }\r
- else\r
- {\r
- this.ignoreGaps = AAFrequency.PID_GAPS;\r
- }\r
- }\r
-\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(char c, int j)\r
- {\r
- if ('a' <= c && c <= 'z')\r
- {\r
- // TO UPPERCASE !!!\r
- //Faster than toUpperCase\r
- c -= ('a' - 'A');\r
- }\r
-\r
- if (consensus == null || consensus.length<j || consensus[j] == null)\r
- {\r
- return false;\r
- }\r
-\r
- if ( ( ( (Integer) consensus[j].get(AAFrequency.MAXCOUNT)).intValue() != -1) &&\r
- consensus[j].contains(String.valueOf(c)))\r
- {\r
- if ( ( (Float) consensus[j].get(ignoreGaps)).floatValue() >= threshold)\r
- {\r
- return true;\r
- }\r
- }\r
-\r
- return false;\r
- }\r
-\r
- public boolean conservationApplied()\r
- {\r
- return conservationColouring;\r
- }\r
-\r
- public void setConservationInc(int i)\r
- {\r
- inc = i;\r
- }\r
-\r
- public int getConservationInc()\r
- {\r
- return inc;\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param consensus DOCUMENT ME!\r
- */\r
- public void setConsensus(Hashtable[] consensus)\r
- {\r
- if (consensus == null)\r
- {\r
- return;\r
- }\r
-\r
- this.consensus = consensus;\r
- }\r
-\r
- public void setConservation(Conservation cons)\r
- {\r
- if (cons == null)\r
- {\r
- conservationColouring = false;\r
- conservation = null;\r
- }\r
- else\r
- {\r
- conservationColouring = true;\r
- int i, iSize = cons.getConsSequence().getLength();\r
- conservation = new char[iSize];\r
- for (i = 0; i < iSize; i++)\r
- {\r
- conservation[i] = cons.getConsSequence().getCharAt(i);\r
- }\r
- conservationLength = conservation.length;\r
- }\r
-\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param s DOCUMENT ME!\r
- * @param i DOCUMENT ME!\r
- *\r
- * @return DOCUMENT ME!\r
- */\r
-\r
- Color applyConservation(Color currentColour, int i)\r
- {\r
-\r
- if ((conservationLength>i) && (conservation[i] != '*') && (conservation[i] != '+'))\r
- {\r
- if ( jalview.util.Comparison.isGap(conservation[i]))\r
- {\r
- currentColour = Color.white;\r
- }\r
- else\r
- {\r
- float t = 11 - (conservation[i] - '0');\r
- if (t == 0)\r
- {\r
- return Color.white;\r
- }\r
-\r
- int red = currentColour.getRed();\r
- int green = currentColour.getGreen();\r
- int blue = currentColour.getBlue();\r
-\r
- int dr = 255 - red;\r
- int dg = 255 - green;\r
- int db = 255 - blue;\r
-\r
- dr *= t / 10f;\r
- dg *= t / 10f;\r
- db *= t / 10f;\r
-\r
- red += (inc / 20f) * dr;\r
- green += (inc / 20f) * dg;\r
- blue += (inc / 20f) * db;\r
-\r
- if (red > 255 || green > 255 || blue > 255)\r
- {\r
- currentColour = Color.white;\r
- }\r
- else\r
- {\r
- currentColour = new Color(red, green, blue);\r
- }\r
- }\r
- }\r
- return currentColour;\r
- }\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.schemes;
+
+import java.util.*;
+
+import java.awt.*;
+
+import jalview.analysis.*;
+
+/**
+ * DOCUMENT ME!
+ *
+ * @author $author$
+ * @version $Revision$
+ */
+public class ResidueColourScheme
+ implements ColourSchemeI
+{
+
+ boolean conservationColouring = false;
+
+ Color[] colors;
+ int threshold = 0;
+
+ /* Set when threshold colouring to either pid_gaps or pid_nogaps*/
+ protected String ignoreGaps = AAFrequency.PID_GAPS;
+
+ /** Consenus as a hashtable array */
+ Hashtable[] consensus;
+
+ /** Conservation string as a char array */
+ char[] conservation;
+ int conservationLength=0;
+
+ /** DOCUMENT ME!! */
+ int inc = 30;
+
+ /**
+ * Creates a new ResidueColourScheme object.
+ *
+ * @param colors DOCUMENT ME!
+ * @param threshold DOCUMENT ME!
+ */
+ public ResidueColourScheme(Color[] colours, int threshold)
+ {
+ this.colors = colours;
+ this.threshold = threshold;
+ }
+
+ /**
+ * Creates a new ResidueColourScheme object.
+ */
+ public ResidueColourScheme()
+ {
+ }
+
+ /**
+ * Find a colour without an index in a sequence
+ */
+ public Color findColour(char c)
+ {
+ return colors[ResidueProperties.aaIndex[c]];
+ }
+
+ public Color findColour(char c, int j)
+ {
+ Color currentColour;
+
+ if ( (threshold == 0) || aboveThreshold(c, j))
+ {
+ currentColour = colors[ResidueProperties.aaIndex[c]];
+ }
+ else
+ {
+ currentColour = Color.white;
+ }
+
+ if (conservationColouring)
+ {
+ currentColour = applyConservation(currentColour, j);
+ }
+
+ return currentColour;
+ }
+
+ /**
+ * Get the percentage threshold for this colour scheme
+ *
+ * @return Returns the percentage threshold
+ */
+ public int getThreshold()
+ {
+ return threshold;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param ct DOCUMENT ME!
+ */
+ public void setThreshold(int ct, boolean ignoreGaps)
+ {
+ threshold = ct;
+ if (ignoreGaps)
+ {
+ this.ignoreGaps = AAFrequency.PID_NOGAPS;
+ }
+ else
+ {
+ this.ignoreGaps = AAFrequency.PID_GAPS;
+ }
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param s DOCUMENT ME!
+ * @param j DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public boolean aboveThreshold(char c, int j)
+ {
+ if ('a' <= c && c <= 'z')
+ {
+ // TO UPPERCASE !!!
+ //Faster than toUpperCase
+ c -= ('a' - 'A');
+ }
+
+ if (consensus == null || consensus.length<j || consensus[j] == null)
+ {
+ return false;
+ }
+
+ if ( ( ( (Integer) consensus[j].get(AAFrequency.MAXCOUNT)).intValue() != -1) &&
+ consensus[j].contains(String.valueOf(c)))
+ {
+ if ( ( (Float) consensus[j].get(ignoreGaps)).floatValue() >= threshold)
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public boolean conservationApplied()
+ {
+ return conservationColouring;
+ }
+
+ public void setConservationInc(int i)
+ {
+ inc = i;
+ }
+
+ public int getConservationInc()
+ {
+ return inc;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param consensus DOCUMENT ME!
+ */
+ public void setConsensus(Hashtable[] consensus)
+ {
+ if (consensus == null)
+ {
+ return;
+ }
+
+ this.consensus = consensus;
+ }
+
+ public void setConservation(Conservation cons)
+ {
+ if (cons == null)
+ {
+ conservationColouring = false;
+ conservation = null;
+ }
+ else
+ {
+ conservationColouring = true;
+ int i, iSize = cons.getConsSequence().getLength();
+ conservation = new char[iSize];
+ for (i = 0; i < iSize; i++)
+ {
+ conservation[i] = cons.getConsSequence().getCharAt(i);
+ }
+ conservationLength = conservation.length;
+ }
+
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param s DOCUMENT ME!
+ * @param i DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+
+ Color applyConservation(Color currentColour, int i)
+ {
+
+ if ((conservationLength>i) && (conservation[i] != '*') && (conservation[i] != '+'))
+ {
+ if ( jalview.util.Comparison.isGap(conservation[i]))
+ {
+ currentColour = Color.white;
+ }
+ else
+ {
+ float t = 11 - (conservation[i] - '0');
+ if (t == 0)
+ {
+ return Color.white;
+ }
+
+ int red = currentColour.getRed();
+ int green = currentColour.getGreen();
+ int blue = currentColour.getBlue();
+
+ int dr = 255 - red;
+ int dg = 255 - green;
+ int db = 255 - blue;
+
+ dr *= t / 10f;
+ dg *= t / 10f;
+ db *= t / 10f;
+
+ red += (inc / 20f) * dr;
+ green += (inc / 20f) * dg;
+ blue += (inc / 20f) * db;
+
+ if (red > 255 || green > 255 || blue > 255)
+ {
+ currentColour = Color.white;
+ }
+ else
+ {
+ currentColour = new Color(red, green, blue);
+ }
+ }
+ }
+ return currentColour;
+ }
+
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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
- * DOCUMENT ME!\r
- *\r
- * @author $author$\r
- * @version $Revision$\r
- */\r
-public class ScoreColourScheme\r
- 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
- /**\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.min = min;\r
- this.max = max;\r
-\r
- // Make colours in constructor\r
- // Why wasn't this done earlier?\r
- int i, iSize = scores.length;\r
- colors = new Color[scores.length];\r
- for (i = 0; i < iSize; i++)\r
- {\r
- float red = (float) (scores[i] - (float) min) / (float) (max - min);\r
-\r
- if (red > 1.0f)\r
- {\r
- red = 1.0f;\r
- }\r
-\r
- if (red < 0.0f)\r
- {\r
- red = 0.0f;\r
- }\r
- colors[i] = makeColour(red);\r
- }\r
- }\r
-\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(char c, int j)\r
- {\r
- if (threshold > 0)\r
- {\r
- if (!aboveThreshold(c, j))\r
- {\r
- return Color.white;\r
- }\r
- }\r
-\r
- if (jalview.util.Comparison.isGap(c))\r
- {\r
- return Color.white;\r
- }\r
-\r
- Color currentColour = colors[ResidueProperties.aaIndex[c]];\r
-\r
- if (conservationColouring)\r
- {\r
- currentColour = applyConservation(currentColour, j);\r
- }\r
-\r
- return currentColour;\r
- }\r
-\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
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.schemes;
+
+import java.awt.*;
+
+/**
+ * DOCUMENT ME!
+ *
+ * @author $author$
+ * @version $Revision$
+ */
+public class ScoreColourScheme
+ extends ResidueColourScheme
+{
+ /** DOCUMENT ME!! */
+ public double min;
+
+ /** DOCUMENT ME!! */
+ public double max;
+
+ /** DOCUMENT ME!! */
+ public double[] scores;
+
+ /**
+ * Creates a new ScoreColourScheme object.
+ *
+ * @param scores DOCUMENT ME!
+ * @param min DOCUMENT ME!
+ * @param max DOCUMENT ME!
+ */
+ public ScoreColourScheme(double[] scores, double min, double max)
+ {
+ super();
+
+ this.scores = scores;
+ this.min = min;
+ this.max = max;
+
+ // Make colours in constructor
+ // Why wasn't this done earlier?
+ int i, iSize = scores.length;
+ colors = new Color[scores.length];
+ for (i = 0; i < iSize; i++)
+ {
+ float red = (float) (scores[i] - (float) min) / (float) (max - min);
+
+ if (red > 1.0f)
+ {
+ red = 1.0f;
+ }
+
+ if (red < 0.0f)
+ {
+ red = 0.0f;
+ }
+ colors[i] = makeColour(red);
+ }
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param s DOCUMENT ME!
+ * @param j DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public Color findColour(char c, int j)
+ {
+ if (threshold > 0)
+ {
+ if (!aboveThreshold(c, j))
+ {
+ return Color.white;
+ }
+ }
+
+ if (jalview.util.Comparison.isGap(c))
+ {
+ return Color.white;
+ }
+
+ Color currentColour = colors[ResidueProperties.aaIndex[c]];
+
+ if (conservationColouring)
+ {
+ currentColour = applyConservation(currentColour, j);
+ }
+
+ return currentColour;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param c DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public Color makeColour(float c)
+ {
+ return new Color(c, (float) 0.0, (float) 1.0 - c);
+ }
+}
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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 ScoreMatrix\r
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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
- * DOCUMENT ME!\r
- *\r
- * @author $author$\r
- * @version $Revision$\r
- */\r
-public class StrandColourScheme\r
- 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
- /**\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
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.schemes;
+
+import java.awt.*;
+
+/**
+ * DOCUMENT ME!
+ *
+ * @author $author$
+ * @version $Revision$
+ */
+public class StrandColourScheme
+ extends ScoreColourScheme
+{
+ /**
+ * Creates a new StrandColourScheme object.
+ */
+ public StrandColourScheme()
+ {
+ super(ResidueProperties.strand, ResidueProperties.strandmin,
+ ResidueProperties.strandmax);
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param c DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public Color makeColour(float c)
+ {
+ return new Color(c, c, (float) 1.0 - c);
+ }
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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\r
- extends ResidueColourScheme\r
-{\r
- public TaylorColourScheme()\r
- {\r
- super(ResidueProperties.taylor, 0);\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.schemes;
+
+public class TaylorColourScheme
+ extends ResidueColourScheme
+{
+ public TaylorColourScheme()
+ {
+ super(ResidueProperties.taylor, 0);
+ }
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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
- * DOCUMENT ME!\r
- *\r
- * @author $author$\r
- * @version $Revision$\r
- */\r
-public class TurnColourScheme\r
- 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
- /**\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
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.schemes;
+
+import java.awt.*;
+
+/**
+ * DOCUMENT ME!
+ *
+ * @author $author$
+ * @version $Revision$
+ */
+public class TurnColourScheme
+ extends ScoreColourScheme
+{
+ /**
+ * Creates a new TurnColourScheme object.
+ */
+ public TurnColourScheme()
+ {
+ super(ResidueProperties.turn, ResidueProperties.turnmin,
+ ResidueProperties.turnmax);
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param c DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public Color makeColour(float c)
+ {
+ return new Color(c, 1 - c, 1 - c);
+ }
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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.structure;\r
-\r
-public interface StructureListener\r
-{\r
- public String getPdbFile();\r
-\r
- public void mouseOverStructure(int atomIndex, String strInfo);\r
-\r
- public void highlightAtom(int atomIndex, int pdbResNum, String chain, String pdbId);\r
-\r
- public void updateColours(Object source);\r
-\r
- public java.awt.Color getColour(int atomIndex, int pdbResNum, String chain, String pdbId);\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.structure;
+
+public interface StructureListener
+{
+ public String getPdbFile();
+
+ public void mouseOverStructure(int atomIndex, String strInfo);
+
+ public void highlightAtom(int atomIndex, int pdbResNum, String chain, String pdbId);
+
+ public void updateColours(Object source);
+
+ public java.awt.Color getColour(int atomIndex, int pdbResNum, String chain, String pdbId);
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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
-package jalview.structure;\r
-\r
-import jalview.datamodel.*;\r
-\r
-public class StructureMapping\r
-{\r
- String mappingDetails;\r
- SequenceI sequence;\r
- String pdbfile;\r
- String pdbid;\r
- String pdbchain;\r
-\r
- //Mapping index 0 is resNum, index 1 is atomNo\r
- int[][] mapping;\r
-\r
- public StructureMapping(SequenceI seq,\r
- String pdbfile,\r
- String pdbid,\r
- String chain,\r
- int[][] mapping,\r
- String mappingDetails)\r
- {\r
- sequence = seq;\r
- this.pdbfile = pdbfile;\r
- this.pdbid = pdbid;\r
- this.pdbchain = chain;\r
- this.mapping = mapping;\r
- this.mappingDetails = mappingDetails;\r
- }\r
-\r
- public SequenceI getSequence()\r
- {\r
- return sequence;\r
- }\r
-\r
- public String getChain()\r
- {\r
- return pdbchain;\r
- }\r
-\r
- public String getPdbId()\r
- {\r
- return pdbid;\r
- }\r
-\r
- public int getAtomNum(int seqpos)\r
- {\r
- if (mapping.length > seqpos)\r
- {\r
- return mapping[seqpos][1];\r
- }\r
- else\r
- {\r
- return 0;\r
- }\r
- }\r
-\r
- public int getPDBResNum(int seqpos)\r
- {\r
- if (mapping.length > seqpos)\r
- {\r
- return mapping[seqpos][0];\r
- }\r
- else\r
- {\r
- return 0;\r
- }\r
- }\r
-\r
- public int getSeqPos(int pdbResNum)\r
- {\r
- for (int i = 0; i < mapping.length; i++)\r
- {\r
- if (mapping[i][0] == pdbResNum)\r
- {\r
- return i;\r
- }\r
- }\r
- return -1;\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.structure;
+
+import jalview.datamodel.*;
+
+public class StructureMapping
+{
+ String mappingDetails;
+ SequenceI sequence;
+ String pdbfile;
+ String pdbid;
+ String pdbchain;
+
+ //Mapping index 0 is resNum, index 1 is atomNo
+ int[][] mapping;
+
+ public StructureMapping(SequenceI seq,
+ String pdbfile,
+ String pdbid,
+ String chain,
+ int[][] mapping,
+ String mappingDetails)
+ {
+ sequence = seq;
+ this.pdbfile = pdbfile;
+ this.pdbid = pdbid;
+ this.pdbchain = chain;
+ this.mapping = mapping;
+ this.mappingDetails = mappingDetails;
+ }
+
+ public SequenceI getSequence()
+ {
+ return sequence;
+ }
+
+ public String getChain()
+ {
+ return pdbchain;
+ }
+
+ public String getPdbId()
+ {
+ return pdbid;
+ }
+
+ public int getAtomNum(int seqpos)
+ {
+ if (mapping.length > seqpos)
+ {
+ return mapping[seqpos][1];
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+ public int getPDBResNum(int seqpos)
+ {
+ if (mapping.length > seqpos)
+ {
+ return mapping[seqpos][0];
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+ public int getSeqPos(int pdbResNum)
+ {
+ for (int i = 0; i < mapping.length; i++)
+ {
+ if (mapping[i][0] == pdbResNum)
+ {
+ return i;
+ }
+ }
+ return -1;
+ }
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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.structure;\r
\r
import jalview.datamodel.SequenceI;\r
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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.*;\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
-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 browser for the system */\r
- private static Object browser;\r
-\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.mrj.MRJFileUtils class */\r
- private static Class mrjFileUtilsClass;\r
-\r
- /** The com.apple.mrj.MRJOSType class */\r
- private static Class mrjOSTypeClass;\r
-\r
- /** The com.apple.MacOS.AEDesc class */\r
- private static Class aeDescClass;\r
-\r
- /** The <init>(int) method of com.apple.MacOS.AETarget */\r
- private static Constructor aeTargetConstructor;\r
-\r
- /** The <init>(int, int, int) method of com.apple.MacOS.AppleEvent */\r
- private static Constructor appleEventConstructor;\r
-\r
- /** The <init>(String) method of com.apple.MacOS.AEDesc */\r
- private static Constructor aeDescConstructor;\r
-\r
- /** The findFolder method of com.apple.mrj.MRJFileUtils */\r
- private static Method findFolder;\r
-\r
- /** The getFileCreator method of com.apple.mrj.MRJFileUtils */\r
- private static Method getFileCreator;\r
-\r
- /** The getFileType method of com.apple.mrj.MRJFileUtils */\r
- private static Method getFileType;\r
-\r
- /** The openURL method of com.apple.mrj.MRJFileUtils */\r
- private static Method openURL;\r
-\r
- /** The makeOSType method of com.apple.MacOS.OSUtils */\r
- private static Method makeOSType;\r
-\r
- /** The putParameter method of com.apple.MacOS.AppleEvent */\r
- private static Method putParameter;\r
-\r
- /** The sendNoReply method of com.apple.MacOS.AppleEvent */\r
- private static Method sendNoReply;\r
-\r
- /** Actually an MRJOSType pointing to the System Folder on a Macintosh */\r
- private static Object kSystemFolderType;\r
-\r
- /** The keyDirectObject AppleEvent parameter type */\r
- private static Integer keyDirectObject;\r
-\r
- /** The kAutoGenerateReturnID AppleEvent code */\r
- private static Integer kAutoGenerateReturnID;\r
-\r
- /** The kAnyTransactionID AppleEvent code */\r
- private static Integer kAnyTransactionID;\r
-\r
- /** The linkage object required for JDirect 3 on Mac OS X. */\r
- private static Object linkage;\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
-\r
- /** JVM constant for MRJ 2.0 */\r
- private static final int MRJ_2_0 = 0;\r
-\r
- /** JVM constant for MRJ 2.1 or later */\r
- private static final int MRJ_2_1 = 1;\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
-\r
- /** JVM constant for MRJ 3.1 */\r
- private static final int MRJ_3_1 = 4;\r
-\r
- /** JVM constant for any Windows NT JVM */\r
- private static final int WINDOWS_NT = 5;\r
-\r
- /** JVM constant for any Windows 9x JVM */\r
- private static final int WINDOWS_9x = 6;\r
-\r
- /** JVM constant for any other platform */\r
- private static final int OTHER = -1;\r
-\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
- /**\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 name for the AppleEvent type corresponding to a GetURL event. */\r
- private static final String GURL_EVENT = "GURL";\r
-\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 second parameter for Runtime.exec() on Windows. */\r
- private static final String SECOND_WINDOWS_PARAMETER = "start";\r
-\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
- /**\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
- /**\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
- 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
- return false;\r
- }\r
- catch (NoSuchMethodException nsme)\r
- {\r
- errorMessage = nsme.getMessage();\r
-\r
- return false;\r
- }\r
- catch (NoSuchFieldException nsfe)\r
- {\r
- errorMessage = nsfe.getMessage();\r
-\r
- return false;\r
- }\r
- catch (IllegalAccessException iae)\r
- {\r
- errorMessage = iae.getMessage();\r
-\r
- return false;\r
- }\r
-\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
- return false;\r
- }\r
- catch (NoSuchFieldException nsfe)\r
- {\r
- errorMessage = nsfe.getMessage();\r
-\r
- return false;\r
- }\r
- catch (NoSuchMethodException nsme)\r
- {\r
- errorMessage = nsme.getMessage();\r
-\r
- return false;\r
- }\r
- catch (SecurityException se)\r
- {\r
- errorMessage = se.getMessage();\r
-\r
- return false;\r
- }\r
- catch (IllegalAccessException iae)\r
- {\r
- errorMessage = iae.getMessage();\r
-\r
- return false;\r
- }\r
-\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
- catch (NoSuchMethodException nsme)\r
- {\r
- errorMessage = nsme.getMessage();\r
-\r
- return false;\r
- }\r
- catch (InvocationTargetException ite)\r
- {\r
- errorMessage = ite.getMessage();\r
-\r
- return false;\r
- }\r
- catch (InstantiationException ie)\r
- {\r
- errorMessage = ie.getMessage();\r
-\r
- return false;\r
- }\r
- catch (IllegalAccessException iae)\r
- {\r
- errorMessage = iae.getMessage();\r
-\r
- return false;\r
- }\r
-\r
- break\r
- ;\r
-\r
- case MRJ_3_1:\r
-\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 false;\r
- }\r
- catch (NoSuchMethodException nsme)\r
- {\r
- errorMessage = nsme.getMessage();\r
-\r
- return false;\r
- }\r
-\r
- break\r
- ;\r
-\r
- default:\r
- break;\r
- }\r
-\r
- return true;\r
- }\r
-\r
- /**\r
- * Attempts to locate the default web browser on the local system. s 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
- 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
- }\r
- catch (InstantiationException ie)\r
- {\r
- browser = null;\r
- errorMessage = ie.getMessage();\r
-\r
- return browser;\r
- }\r
- catch (InvocationTargetException ite)\r
- {\r
- browser = null;\r
- errorMessage = ite.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
- return browser;\r
- }\r
- catch (IllegalAccessException iae)\r
- {\r
- browser = null;\r
- errorMessage = iae.getMessage();\r
-\r
- return browser;\r
- }\r
- catch (InvocationTargetException ite)\r
- {\r
- browser = null;\r
- errorMessage = ite.getTargetException().getClass() + ": " +\r
- ite.getTargetException().getMessage();\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
- {\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
- errorMessage = iare.getMessage();\r
-\r
- return null;\r
- }\r
- catch (IllegalAccessException iae)\r
- {\r
- browser = null;\r
- errorMessage = iae.getMessage();\r
-\r
- return browser;\r
- }\r
- catch (InvocationTargetException ite)\r
- {\r
- browser = null;\r
- errorMessage = ite.getTargetException().getClass() + ": " +\r
- ite.getTargetException().getMessage();\r
-\r
- return browser;\r
- }\r
- }\r
-\r
- browser = null;\r
-\r
- break;\r
-\r
- case MRJ_3_0:\r
- case MRJ_3_1:\r
- browser = ""; // Return something non-null\r
-\r
- break;\r
-\r
- case WINDOWS_NT:\r
- browser = "cmd.exe";\r
-\r
- break;\r
-\r
- case WINDOWS_9x:\r
- browser = "command.com";\r
-\r
- break;\r
-\r
- case OTHER:\r
- default:\r
- browser = jalview.bin.Cache.getDefault("DEFAULT_BROWSER", "firefox");\r
-\r
- break;\r
- }\r
-\r
- return browser;\r
- }\r
-\r
- /**\r
- * used to ensure that browser is up-to-date after a configuration\r
- * change (Unix DEFAULT_BROWSER property change).\r
- */\r
- public static void resetBrowser()\r
- {\r
- browser = null;\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
- Object browser = locateBrowser();\r
-\r
- if (browser == null)\r
- {\r
- throw new IOException("Unable to locate browser: " + errorMessage);\r
- }\r
-\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
- 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 MRJ_3_1:\r
-\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
- 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
- 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
- ;\r
-\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[]\r
- { (String) browser, url});\r
-\r
- break;\r
- }\r
- }\r
-\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
-\r
- private native static int ICLaunchURL(int instance, byte[] hint,\r
- byte[] data, int len,\r
- int[] selectionStart,\r
- int[] selectionEnd);\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.util;
+
+import java.io.*;
+import java.lang.reflect.*;
+
+/**
+ * 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)
+ */
+public class BrowserLauncher
+{
+ /**
+ * 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. */
+ private static int jvm;
+
+ /** The browser for the system */
+ private static Object browser;
+
+ /**
+ * 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.
+ */
+ private static boolean loadedWithoutErrors;
+
+ /** The com.apple.mrj.MRJFileUtils class */
+ private static Class mrjFileUtilsClass;
+
+ /** The com.apple.mrj.MRJOSType class */
+ private static Class mrjOSTypeClass;
+
+ /** The com.apple.MacOS.AEDesc class */
+ private static Class aeDescClass;
+
+ /** The <init>(int) method of com.apple.MacOS.AETarget */
+ private static Constructor aeTargetConstructor;
+
+ /** The <init>(int, int, int) method of com.apple.MacOS.AppleEvent */
+ private static Constructor appleEventConstructor;
+
+ /** The <init>(String) method of com.apple.MacOS.AEDesc */
+ private static Constructor aeDescConstructor;
+
+ /** The findFolder method of com.apple.mrj.MRJFileUtils */
+ private static Method findFolder;
+
+ /** The getFileCreator method of com.apple.mrj.MRJFileUtils */
+ private static Method getFileCreator;
+
+ /** The getFileType method of com.apple.mrj.MRJFileUtils */
+ private static Method getFileType;
+
+ /** The openURL method of com.apple.mrj.MRJFileUtils */
+ private static Method openURL;
+
+ /** The makeOSType method of com.apple.MacOS.OSUtils */
+ private static Method makeOSType;
+
+ /** The putParameter method of com.apple.MacOS.AppleEvent */
+ private static Method putParameter;
+
+ /** The sendNoReply method of com.apple.MacOS.AppleEvent */
+ private static Method sendNoReply;
+
+ /** Actually an MRJOSType pointing to the System Folder on a Macintosh */
+ private static Object kSystemFolderType;
+
+ /** The keyDirectObject AppleEvent parameter type */
+ private static Integer keyDirectObject;
+
+ /** The kAutoGenerateReturnID AppleEvent code */
+ private static Integer kAutoGenerateReturnID;
+
+ /** The kAnyTransactionID AppleEvent code */
+ private static Integer kAnyTransactionID;
+
+ /** The linkage object required for JDirect 3 on Mac OS X. */
+ private static Object linkage;
+
+ /** The framework to reference on Mac OS X */
+ private static final String JDirect_MacOSX = "/System/Library/Frameworks/Carbon.framework/Frameworks/HIToolbox.framework/HIToolbox";
+
+ /** JVM constant for MRJ 2.0 */
+ private static final int MRJ_2_0 = 0;
+
+ /** JVM constant for MRJ 2.1 or later */
+ private static final int MRJ_2_1 = 1;
+
+ /** JVM constant for Java on Mac OS X 10.0 (MRJ 3.0) */
+ private static final int MRJ_3_0 = 3;
+
+ /** JVM constant for MRJ 3.1 */
+ private static final int MRJ_3_1 = 4;
+
+ /** JVM constant for any Windows NT JVM */
+ private static final int WINDOWS_NT = 5;
+
+ /** JVM constant for any Windows 9x JVM */
+ private static final int WINDOWS_9x = 6;
+
+ /** JVM constant for any other platform */
+ private static final int OTHER = -1;
+
+ /**
+ * The file type of the Finder on a Macintosh. Hardcoding "Finder" would keep non-U.S. English
+ * systems from working properly.
+ */
+ private static final String FINDER_TYPE = "FNDR";
+
+ /**
+ * The creator code of the Finder on a Macintosh, which is needed to send AppleEvents to the
+ * application.
+ */
+ private static final String FINDER_CREATOR = "MACS";
+
+ /** The name for the AppleEvent type corresponding to a GetURL event. */
+ private static final String GURL_EVENT = "GURL";
+
+ /**
+ * The first parameter that needs to be passed into Runtime.exec() to open the default web
+ * browser on Windows.
+ */
+ private static final String FIRST_WINDOWS_PARAMETER = "/c";
+
+ /** The second parameter for Runtime.exec() on Windows. */
+ private static final String SECOND_WINDOWS_PARAMETER = "start";
+
+ /**
+ * 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.
+ */
+ private static final String THIRD_WINDOWS_PARAMETER = "\"\"";
+
+ /**
+ * The shell parameters for Netscape that opens a given URL in an already-open copy of Netscape
+ * on many command-line systems.
+ */
+ private static final String NETSCAPE_REMOTE_PARAMETER = "-remote";
+ private static final String NETSCAPE_OPEN_PARAMETER_START = "openURL(";
+ private static final String NETSCAPE_OPEN_NEW_WINDOW = ", new-window";
+ private static final String NETSCAPE_OPEN_PARAMETER_END = ")";
+
+ /**
+ * The message from any exception thrown throughout the initialization process.
+ */
+ private static String errorMessage;
+
+ /**
+ * An initialization block that determines the operating system and loads the necessary
+ * runtime data.
+ */
+ static
+ {
+ loadedWithoutErrors = true;
+
+ String osName = System.getProperty("os.name");
+
+ if (osName.startsWith("Mac OS"))
+ {
+ String mrjVersion = System.getProperty("mrj.version");
+ String majorMRJVersion = mrjVersion.substring(0, 3);
+
+ try
+ {
+ double version = Double.valueOf(majorMRJVersion).doubleValue();
+
+ if (version == 2)
+ {
+ jvm = MRJ_2_0;
+ }
+ else if ( (version >= 2.1) && (version < 3))
+ {
+ // Assume that all 2.x versions of MRJ work the same. MRJ 2.1 actually
+ // works via Runtime.exec() and 2.2 supports that but has an openURL() method
+ // as well that we currently ignore.
+ jvm = MRJ_2_1;
+ }
+ else if (version == 3.0)
+ {
+ jvm = MRJ_3_0;
+ }
+ else if (version >= 3.1)
+ {
+ // Assume that all 3.1 and later versions of MRJ work the same.
+ jvm = MRJ_3_1;
+ }
+ else
+ {
+ loadedWithoutErrors = false;
+ errorMessage = "Unsupported MRJ version: " + version;
+ }
+ }
+ catch (NumberFormatException nfe)
+ {
+ loadedWithoutErrors = false;
+ errorMessage = "Invalid MRJ version: " + mrjVersion;
+ }
+ }
+ else if (osName.startsWith("Windows"))
+ {
+ if (osName.indexOf("9") != -1)
+ {
+ jvm = WINDOWS_9x;
+ }
+ else
+ {
+ jvm = WINDOWS_NT;
+ }
+ }
+ else
+ {
+ jvm = OTHER;
+ }
+
+ if (loadedWithoutErrors)
+ { // if we haven't hit any errors yet
+ loadedWithoutErrors = loadClasses();
+ }
+ }
+
+ /**
+ * This class should be never be instantiated; this just ensures so.
+ */
+ private BrowserLauncher()
+ {
+ }
+
+ /**
+ * 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
+ */
+ private static boolean loadClasses()
+ {
+ switch (jvm)
+ {
+ case MRJ_2_0:
+
+ try
+ {
+ Class aeTargetClass = Class.forName("com.apple.MacOS.AETarget");
+ Class osUtilsClass = Class.forName("com.apple.MacOS.OSUtils");
+ Class appleEventClass = Class.forName(
+ "com.apple.MacOS.AppleEvent");
+ Class aeClass = Class.forName("com.apple.MacOS.ae");
+ aeDescClass = Class.forName("com.apple.MacOS.AEDesc");
+
+ aeTargetConstructor = aeTargetClass.getDeclaredConstructor(new Class[]
+ {
+ int.class
+ });
+ appleEventConstructor = appleEventClass.getDeclaredConstructor(new
+ Class[]
+ {
+ int.class, int.class, aeTargetClass, int.class,
+ int.class
+ });
+ aeDescConstructor = aeDescClass.getDeclaredConstructor(new Class[]
+ {
+ String.class
+ });
+
+ makeOSType = osUtilsClass.getDeclaredMethod("makeOSType",
+ new Class[]
+ {String.class});
+ putParameter = appleEventClass.getDeclaredMethod("putParameter",
+ new Class[]
+ {int.class, aeDescClass});
+ sendNoReply = appleEventClass.getDeclaredMethod("sendNoReply",
+ new Class[]
+ {});
+
+ Field keyDirectObjectField = aeClass.getDeclaredField(
+ "keyDirectObject");
+ keyDirectObject = (Integer) keyDirectObjectField.get(null);
+
+ Field autoGenerateReturnIDField = appleEventClass.getDeclaredField(
+ "kAutoGenerateReturnID");
+ kAutoGenerateReturnID = (Integer) autoGenerateReturnIDField.get(null);
+
+ Field anyTransactionIDField = appleEventClass.getDeclaredField(
+ "kAnyTransactionID");
+ kAnyTransactionID = (Integer) anyTransactionIDField.get(null);
+ }
+ catch (ClassNotFoundException cnfe)
+ {
+ errorMessage = cnfe.getMessage();
+
+ return false;
+ }
+ catch (NoSuchMethodException nsme)
+ {
+ errorMessage = nsme.getMessage();
+
+ return false;
+ }
+ catch (NoSuchFieldException nsfe)
+ {
+ errorMessage = nsfe.getMessage();
+
+ return false;
+ }
+ catch (IllegalAccessException iae)
+ {
+ errorMessage = iae.getMessage();
+
+ return false;
+ }
+
+ break
+ ;
+
+ case MRJ_2_1:
+
+ try
+ {
+ mrjFileUtilsClass = Class.forName("com.apple.mrj.MRJFileUtils");
+ mrjOSTypeClass = Class.forName("com.apple.mrj.MRJOSType");
+
+ Field systemFolderField = mrjFileUtilsClass.getDeclaredField(
+ "kSystemFolderType");
+ kSystemFolderType = systemFolderField.get(null);
+ findFolder = mrjFileUtilsClass.getDeclaredMethod("findFolder",
+ new Class[]
+ {mrjOSTypeClass});
+ getFileCreator = mrjFileUtilsClass.getDeclaredMethod("getFileCreator",
+ new Class[]
+ {File.class});
+ getFileType = mrjFileUtilsClass.getDeclaredMethod("getFileType",
+ new Class[]
+ {File.class});
+ }
+ catch (ClassNotFoundException cnfe)
+ {
+ errorMessage = cnfe.getMessage();
+
+ return false;
+ }
+ catch (NoSuchFieldException nsfe)
+ {
+ errorMessage = nsfe.getMessage();
+
+ return false;
+ }
+ catch (NoSuchMethodException nsme)
+ {
+ errorMessage = nsme.getMessage();
+
+ return false;
+ }
+ catch (SecurityException se)
+ {
+ errorMessage = se.getMessage();
+
+ return false;
+ }
+ catch (IllegalAccessException iae)
+ {
+ errorMessage = iae.getMessage();
+
+ return false;
+ }
+
+ break
+ ;
+
+ case MRJ_3_0:
+
+ try
+ {
+ Class linker = Class.forName("com.apple.mrj.jdirect.Linker");
+ Constructor constructor = linker.getConstructor(new Class[]
+ {
+ Class.class
+ });
+ linkage = constructor.newInstance(new Object[]
+ {
+ BrowserLauncher.class
+ });
+ }
+ catch (ClassNotFoundException cnfe)
+ {
+ errorMessage = cnfe.getMessage();
+
+ return false;
+ }
+ catch (NoSuchMethodException nsme)
+ {
+ errorMessage = nsme.getMessage();
+
+ return false;
+ }
+ catch (InvocationTargetException ite)
+ {
+ errorMessage = ite.getMessage();
+
+ return false;
+ }
+ catch (InstantiationException ie)
+ {
+ errorMessage = ie.getMessage();
+
+ return false;
+ }
+ catch (IllegalAccessException iae)
+ {
+ errorMessage = iae.getMessage();
+
+ return false;
+ }
+
+ break
+ ;
+
+ case MRJ_3_1:
+
+ try
+ {
+ mrjFileUtilsClass = Class.forName("com.apple.mrj.MRJFileUtils");
+ openURL = mrjFileUtilsClass.getDeclaredMethod("openURL",
+ new Class[]
+ {String.class});
+ }
+ catch (ClassNotFoundException cnfe)
+ {
+ errorMessage = cnfe.getMessage();
+
+ return false;
+ }
+ catch (NoSuchMethodException nsme)
+ {
+ errorMessage = nsme.getMessage();
+
+ return false;
+ }
+
+ break
+ ;
+
+ default:
+ break;
+ }
+
+ return true;
+ }
+
+ /**
+ * Attempts to locate the default web browser on the local system. s 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.
+ */
+ private static Object locateBrowser()
+ {
+ if (browser != null)
+ {
+ return browser;
+ }
+
+ switch (jvm)
+ {
+ case MRJ_2_0:
+
+ try
+ {
+ Integer finderCreatorCode = (Integer) makeOSType.invoke(null,
+ new Object[]
+ {FINDER_CREATOR});
+ Object aeTarget = aeTargetConstructor.newInstance(new Object[]
+ {
+ finderCreatorCode
+ });
+ Integer gurlType = (Integer) makeOSType.invoke(null,
+ new Object[]
+ {GURL_EVENT});
+ Object appleEvent = appleEventConstructor.newInstance(new Object[]
+ {
+ gurlType, gurlType, aeTarget, kAutoGenerateReturnID,
+ kAnyTransactionID
+ });
+
+ // Don't set browser = appleEvent because then the next time we call
+ // locateBrowser(), we'll get the same AppleEvent, to which we'll already have
+ // added the relevant parameter. Instead, regenerate the AppleEvent every time.
+ // There's probably a way to do this better; if any has any ideas, please let
+ // me know.
+ return appleEvent;
+ }
+ catch (IllegalAccessException iae)
+ {
+ browser = null;
+ errorMessage = iae.getMessage();
+
+ return browser;
+ }
+ catch (InstantiationException ie)
+ {
+ browser = null;
+ errorMessage = ie.getMessage();
+
+ return browser;
+ }
+ catch (InvocationTargetException ite)
+ {
+ browser = null;
+ errorMessage = ite.getMessage();
+
+ return browser;
+ }
+
+ case MRJ_2_1:
+
+ File systemFolder;
+
+ try
+ {
+ systemFolder = (File) findFolder.invoke(null,
+ new Object[]
+ {kSystemFolderType});
+ }
+ catch (IllegalArgumentException iare)
+ {
+ browser = null;
+ errorMessage = iare.getMessage();
+
+ return browser;
+ }
+ catch (IllegalAccessException iae)
+ {
+ browser = null;
+ errorMessage = iae.getMessage();
+
+ return browser;
+ }
+ catch (InvocationTargetException ite)
+ {
+ browser = null;
+ errorMessage = ite.getTargetException().getClass() + ": " +
+ ite.getTargetException().getMessage();
+
+ return browser;
+ }
+
+ String[] systemFolderFiles = systemFolder.list();
+
+ // Avoid a FilenameFilter because that can't be stopped mid-list
+ for (int i = 0; i < systemFolderFiles.length; i++)
+ {
+ try
+ {
+ File file = new File(systemFolder, systemFolderFiles[i]);
+
+ if (!file.isFile())
+ {
+ continue;
+ }
+
+ // We're looking for a file with a creator code of 'MACS' and
+ // a type of 'FNDR'. Only requiring the type results in non-Finder
+ // applications being picked up on certain Mac OS 9 systems,
+ // especially German ones, and sending a GURL event to those
+ // applications results in a logout under Multiple Users.
+ Object fileType = getFileType.invoke(null,
+ new Object[]
+ {file});
+
+ if (FINDER_TYPE.equals(fileType.toString()))
+ {
+ Object fileCreator = getFileCreator.invoke(null,
+ new Object[]
+ {file});
+
+ if (FINDER_CREATOR.equals(fileCreator.toString()))
+ {
+ browser = file.toString(); // Actually the Finder, but that's OK
+
+ return browser;
+ }
+ }
+ }
+ catch (IllegalArgumentException iare)
+ {
+ errorMessage = iare.getMessage();
+
+ return null;
+ }
+ catch (IllegalAccessException iae)
+ {
+ browser = null;
+ errorMessage = iae.getMessage();
+
+ return browser;
+ }
+ catch (InvocationTargetException ite)
+ {
+ browser = null;
+ errorMessage = ite.getTargetException().getClass() + ": " +
+ ite.getTargetException().getMessage();
+
+ return browser;
+ }
+ }
+
+ browser = null;
+
+ break;
+
+ case MRJ_3_0:
+ case MRJ_3_1:
+ browser = ""; // Return something non-null
+
+ break;
+
+ case WINDOWS_NT:
+ browser = "cmd.exe";
+
+ break;
+
+ case WINDOWS_9x:
+ browser = "command.com";
+
+ break;
+
+ case OTHER:
+ default:
+ browser = jalview.bin.Cache.getDefault("DEFAULT_BROWSER", "firefox");
+
+ break;
+ }
+
+ return browser;
+ }
+
+ /**
+ * used to ensure that browser is up-to-date after a configuration
+ * change (Unix DEFAULT_BROWSER property change).
+ */
+ public static void resetBrowser()
+ {
+ browser = null;
+ }
+
+ /**
+ * 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
+ */
+ public static void openURL(String url)
+ throws IOException
+ {
+ if (!loadedWithoutErrors)
+ {
+ throw new IOException("Exception in finding browser: " +
+ errorMessage);
+ }
+
+ Object browser = locateBrowser();
+
+ if (browser == null)
+ {
+ throw new IOException("Unable to locate browser: " + errorMessage);
+ }
+
+ switch (jvm)
+ {
+ case MRJ_2_0:
+
+ Object aeDesc = null;
+
+ try
+ {
+ aeDesc = aeDescConstructor.newInstance(new Object[]
+ {url});
+ putParameter.invoke(browser,
+ new Object[]
+ {keyDirectObject, aeDesc});
+ sendNoReply.invoke(browser, new Object[]
+ {});
+ }
+ catch (InvocationTargetException ite)
+ {
+ throw new IOException(
+ "InvocationTargetException while creating AEDesc: " +
+ ite.getMessage());
+ }
+ catch (IllegalAccessException iae)
+ {
+ throw new IOException(
+ "IllegalAccessException while building AppleEvent: " +
+ iae.getMessage());
+ }
+ catch (InstantiationException ie)
+ {
+ throw new IOException(
+ "InstantiationException while creating AEDesc: " +
+ ie.getMessage());
+ }
+ finally
+ {
+ aeDesc = null; // Encourage it to get disposed if it was created
+ browser = null; // Ditto
+ }
+
+ break;
+
+ case MRJ_2_1:
+ Runtime.getRuntime().exec(new String[]
+ { (String) browser, url});
+
+ break;
+
+ case MRJ_3_0:
+
+ int[] instance = new int[1];
+ int result = ICStart(instance, 0);
+
+ if (result == 0)
+ {
+ int[] selectionStart = new int[]
+ {
+ 0};
+ byte[] urlBytes = url.getBytes();
+ int[] selectionEnd = new int[]
+ {
+ urlBytes.length};
+ result = ICLaunchURL(instance[0], new byte[]
+ {0}, urlBytes,
+ urlBytes.length, selectionStart, selectionEnd);
+
+ if (result == 0)
+ {
+ // Ignore the return value; the URL was launched successfully
+ // regardless of what happens here.
+ ICStop(instance);
+ }
+ else
+ {
+ throw new IOException("Unable to launch URL: " + result);
+ }
+ }
+ else
+ {
+ throw new IOException(
+ "Unable to create an Internet Config instance: " + result);
+ }
+
+ break;
+
+ case MRJ_3_1:
+
+ try
+ {
+ openURL.invoke(null, new Object[]
+ {url});
+ }
+ catch (InvocationTargetException ite)
+ {
+ throw new IOException(
+ "InvocationTargetException while calling openURL: " +
+ ite.getMessage());
+ }
+ catch (IllegalAccessException iae)
+ {
+ throw new IOException(
+ "IllegalAccessException while calling openURL: " +
+ iae.getMessage());
+ }
+
+ break
+ ;
+
+ case WINDOWS_NT:
+ case WINDOWS_9x:
+
+ // Add quotes around the URL to allow ampersands and other special
+ // characters to work.
+ Process process = Runtime.getRuntime().exec(new String[]
+ {
+ (String) browser, FIRST_WINDOWS_PARAMETER,
+ SECOND_WINDOWS_PARAMETER, THIRD_WINDOWS_PARAMETER,
+ '"' + url + '"'
+ });
+
+ // This avoids a memory leak on some versions of Java on Windows.
+ // That's hinted at in <http://developer.java.sun.com/developer/qow/archive/68/>.
+ try
+ {
+ process.waitFor();
+ process.exitValue();
+ }
+ catch (InterruptedException ie)
+ {
+ throw new IOException(
+ "InterruptedException while launching browser: " +
+ ie.getMessage());
+ }
+
+ break
+ ;
+
+ case OTHER:
+
+ // Assume that we're on Unix and that Netscape (actually Firefox) is installed
+ // First, attempt to open the URL in a currently running session of Netscape
+ // JBPNote log debug
+
+ /* System.out.println("Executing : "+browser+" "+
+ NETSCAPE_REMOTE_PARAMETER+" "+
+ NETSCAPE_OPEN_PARAMETER_START +
+ url +
+ NETSCAPE_OPEN_NEW_WINDOW +
+ NETSCAPE_OPEN_PARAMETER_END);
+ */
+ process = Runtime.getRuntime().exec(new String[]
+ {
+ (String) browser,
+ NETSCAPE_REMOTE_PARAMETER,
+
+ NETSCAPE_OPEN_PARAMETER_START + url +
+ NETSCAPE_OPEN_NEW_WINDOW +
+ NETSCAPE_OPEN_PARAMETER_END
+ });
+
+ try
+ {
+ int exitCode = process.waitFor();
+
+ if (exitCode != 0)
+ { // if Netscape was not open
+ Runtime.getRuntime().exec(new String[]
+ { (String) browser, url});
+ }
+ }
+ catch (InterruptedException ie)
+ {
+ throw new IOException(
+ "InterruptedException while launching browser: " +
+ ie.getMessage());
+ }
+
+ break
+ ;
+
+ default:
+
+ // This should never occur, but if it does, we'll try the simplest thing possible
+ Runtime.getRuntime().exec(new String[]
+ { (String) browser, url});
+
+ break;
+ }
+ }
+
+ /**
+ * Methods required for Mac OS X. The presence of native methods does not cause
+ * any problems on other platforms.
+ */
+ private native static int ICStart(int[] instance, int signature);
+
+ private native static int ICStop(int[] instance);
+
+ private native static int ICLaunchURL(int instance, byte[] hint,
+ byte[] data, int len,
+ int[] selectionStart,
+ int[] selectionEnd);
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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 jalview.datamodel.*;\r
-\r
-/**\r
- * DOCUMENT ME!\r
- *\r
- * @author $author$\r
- * @version $Revision$\r
- */\r
-public class Comparison\r
-{\r
- /** DOCUMENT ME!! */\r
- public static final String GapChars = " .-";\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param ii DOCUMENT ME!\r
- * @param jj DOCUMENT ME!\r
- *\r
- * @return DOCUMENT ME!\r
- */\r
- public static final float compare(SequenceI ii, SequenceI jj)\r
- {\r
- return Comparison.compare(ii, jj, 0, ii.getLength() - 1);\r
- }\r
-\r
- /**\r
- * this was supposed to be an ungapped pid calculation\r
- * @param ii SequenceI\r
- * @param jj SequenceI\r
- * @param start int\r
- * @param end int\r
- * @return float\r
- */\r
- public static float compare(SequenceI ii, SequenceI jj, int start, int end)\r
- {\r
- String si = ii.getSequenceAsString();\r
- String sj = jj.getSequenceAsString();\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
- {\r
- ilen--;\r
- }\r
-\r
- while (jalview.util.Comparison.isGap(sj.charAt(start + jlen)))\r
- {\r
- jlen--;\r
- }\r
-\r
- int count = 0;\r
- int match = 0;\r
- float pid = -1;\r
-\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
- {\r
- match++;\r
- }\r
-\r
- count++;\r
- }\r
-\r
- pid = (float) match / (float) ilen * 100;\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
- {\r
- match++;\r
- }\r
-\r
- count++;\r
- }\r
-\r
- pid = (float) match / (float) jlen * 100;\r
- }\r
-\r
- return pid;\r
- }\r
-\r
- /**\r
- * this is a gapped PID calculation\r
- *\r
- * @param s1 SequenceI\r
- * @param s2 SequenceI\r
- * @return float\r
- */\r
- public final static float PID(String seq1, String seq2)\r
- {\r
- return PID(seq1, seq2, 0, seq1.length());\r
- }\r
-\r
- static final int caseShift = 'a' - 'A';\r
-\r
- // Another pid with region specification\r
- public final static float PID(String seq1, String seq2, int start, int end)\r
- {\r
-\r
- int s1len = seq1.length();\r
- int s2len = seq2.length();\r
-\r
- int len = Math.min(s1len, s2len);\r
-\r
- if (end < len)\r
- {\r
- len = end;\r
- }\r
-\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
- char chr1;\r
- char chr2;\r
-\r
- for (int i = start; i < len; i++)\r
- {\r
- chr1 = seq1.charAt(i);\r
-\r
- chr2 = seq2.charAt(i);\r
-\r
- if ('a' <= chr1 && chr1 <= 'z')\r
- {\r
- // TO UPPERCASE !!!\r
- //Faster than toUpperCase\r
- chr1 -= caseShift;\r
- }\r
- if ('a' <= chr2 && chr2 <= 'z')\r
- {\r
- // TO UPPERCASE !!!\r
- //Faster than toUpperCase\r
- chr2 -= caseShift;\r
- }\r
-\r
- if (chr1 != chr2 && !isGap(chr1) && !isGap(chr2))\r
- {\r
- bad++;\r
- }\r
- }\r
-\r
- return ( (float) 100 * (len - bad)) / len;\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param c DOCUMENT ME!\r
- *\r
- * @return DOCUMENT ME!\r
- */\r
- public static final boolean isGap(char c)\r
- {\r
- return (c == '-' || c == '.' || c == ' ') ? true : false;\r
- }\r
-\r
- public static final boolean isNucleotide(SequenceI[] seqs)\r
- {\r
- int i = 0, iSize = seqs.length, j, jSize;\r
- float nt = 0, aa = 0;\r
- char c;\r
- while (i < iSize)\r
- {\r
- jSize = seqs[i].getLength();\r
- for (j = 0; j < jSize; j++)\r
- {\r
- c = seqs[i].getCharAt(j);\r
- if ('a' <= c && c <= 'z')\r
- {\r
- c -= ('a' - 'A');\r
- }\r
-\r
- if (c == 'A' || c == 'G' || c == 'C' || c == 'T' || c == 'U')\r
- {\r
- nt++;\r
- }\r
- else if (!jalview.util.Comparison.isGap(seqs[i].getCharAt(j)))\r
- {\r
- aa++;\r
- }\r
- }\r
- i++;\r
- }\r
-\r
- if ( (nt / (nt + aa)) > 0.85f)\r
- {\r
- return true;\r
- }\r
- else\r
- {\r
- return false;\r
- }\r
-\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.util;
+
+import jalview.datamodel.*;
+
+/**
+ * DOCUMENT ME!
+ *
+ * @author $author$
+ * @version $Revision$
+ */
+public class Comparison
+{
+ /** DOCUMENT ME!! */
+ public static final String GapChars = " .-";
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param ii DOCUMENT ME!
+ * @param jj DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public static final float compare(SequenceI ii, SequenceI jj)
+ {
+ return Comparison.compare(ii, jj, 0, ii.getLength() - 1);
+ }
+
+ /**
+ * this was supposed to be an ungapped pid calculation
+ * @param ii SequenceI
+ * @param jj SequenceI
+ * @param start int
+ * @param end int
+ * @return float
+ */
+ public static float compare(SequenceI ii, SequenceI jj, int start, int end)
+ {
+ String si = ii.getSequenceAsString();
+ String sj = jj.getSequenceAsString();
+
+ int ilen = si.length() - 1;
+ int jlen = sj.length() - 1;
+
+ while (jalview.util.Comparison.isGap(si.charAt(start + ilen)))
+ {
+ ilen--;
+ }
+
+ while (jalview.util.Comparison.isGap(sj.charAt(start + jlen)))
+ {
+ jlen--;
+ }
+
+ int count = 0;
+ int match = 0;
+ float pid = -1;
+
+ if (ilen > jlen)
+ {
+ for (int j = 0; j < jlen; j++)
+ {
+ if (si.substring(start + j, start + j + 1).equals(sj.substring(start +
+ j, start + j + 1)))
+ {
+ match++;
+ }
+
+ count++;
+ }
+
+ pid = (float) match / (float) ilen * 100;
+ }
+ else
+ {
+ for (int j = 0; j < jlen; j++)
+ {
+ if (si.substring(start + j, start + j + 1).equals(sj.substring(start +
+ j, start + j + 1)))
+ {
+ match++;
+ }
+
+ count++;
+ }
+
+ pid = (float) match / (float) jlen * 100;
+ }
+
+ return pid;
+ }
+
+ /**
+ * this is a gapped PID calculation
+ *
+ * @param s1 SequenceI
+ * @param s2 SequenceI
+ * @return float
+ */
+ public final static float PID(String seq1, String seq2)
+ {
+ return PID(seq1, seq2, 0, seq1.length());
+ }
+
+ static final int caseShift = 'a' - 'A';
+
+ // Another pid with region specification
+ public final static float PID(String seq1, String seq2, int start, int end)
+ {
+
+ int s1len = seq1.length();
+ int s2len = seq2.length();
+
+ int len = Math.min(s1len, s2len);
+
+ if (end < len)
+ {
+ len = end;
+ }
+
+ if (len < start)
+ {
+ start = len - 1; // we just use a single residue for the difference
+ }
+
+ int bad = 0;
+ char chr1;
+ char chr2;
+
+ for (int i = start; i < len; i++)
+ {
+ chr1 = seq1.charAt(i);
+
+ chr2 = seq2.charAt(i);
+
+ if ('a' <= chr1 && chr1 <= 'z')
+ {
+ // TO UPPERCASE !!!
+ //Faster than toUpperCase
+ chr1 -= caseShift;
+ }
+ if ('a' <= chr2 && chr2 <= 'z')
+ {
+ // TO UPPERCASE !!!
+ //Faster than toUpperCase
+ chr2 -= caseShift;
+ }
+
+ if (chr1 != chr2 && !isGap(chr1) && !isGap(chr2))
+ {
+ bad++;
+ }
+ }
+
+ return ( (float) 100 * (len - bad)) / len;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param c DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public static final boolean isGap(char c)
+ {
+ return (c == '-' || c == '.' || c == ' ') ? true : false;
+ }
+
+ public static final boolean isNucleotide(SequenceI[] seqs)
+ {
+ int i = 0, iSize = seqs.length, j, jSize;
+ float nt = 0, aa = 0;
+ char c;
+ while (i < iSize)
+ {
+ jSize = seqs[i].getLength();
+ for (j = 0; j < jSize; j++)
+ {
+ c = seqs[i].getCharAt(j);
+ if ('a' <= c && c <= 'z')
+ {
+ c -= ('a' - 'A');
+ }
+
+ if (c == 'A' || c == 'G' || c == 'C' || c == 'T' || c == 'U')
+ {
+ nt++;
+ }
+ else if (!jalview.util.Comparison.isGap(seqs[i].getCharAt(j)))
+ {
+ aa++;
+ }
+ }
+ i++;
+ }
+
+ if ( (nt / (nt + aa)) > 0.85f)
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+
+ }
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
- * Cay S. Horstmann & Gary Cornell, Core Java\r
- * Published By Sun Microsystems Press/Prentice-Hall\r
- * Copyright (C) 1997 Sun Microsystems Inc.\r
- * All Rights Reserved.\r
- *\r
- * Permission to use, copy, modify, and distribute this\r
- * software and its documentation for NON-COMMERCIAL purposes\r
- * and without fee is hereby granted provided that this\r
- * copyright notice appears in all copies.\r
- *\r
- * THE AUTHORS AND PUBLISHER MAKE NO REPRESENTATIONS OR\r
- * WARRANTIES ABOUT THE SUITABILITY OF THE SOFTWARE, EITHER\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE\r
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\r
- * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. THE AUTHORS\r
- * AND PUBLISHER SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED\r
- * BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING\r
- * THIS SOFTWARE OR ITS DERIVATIVES.\r
- */\r
-\r
-/**\r
- * A class for formatting numbers that follows printf conventions.\r
- * Also implements C-like atoi and atof functions\r
- * @version 1.03 25 Oct 1997\r
- * @author Cay Horstmann\r
- */\r
-package jalview.util;\r
-\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 String post;\r
- private boolean leading_zeroes;\r
- private boolean show_plus;\r
- private boolean alternate;\r
- private boolean show_space;\r
- private boolean left_align;\r
- private char fmt; // one of cdeEfgGiosxXos\r
-\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
- post = "";\r
- leading_zeroes = false;\r
- show_plus = false;\r
- alternate = false;\r
- show_space = false;\r
- left_align = false;\r
- fmt = ' ';\r
-\r
- int length = s.length();\r
- int parse_state = 0;\r
-\r
- // 0 = prefix, 1 = flags, 2 = width, 3 = precision,\r
- // 4 = format, 5 = end\r
- int i = 0;\r
-\r
- while (parse_state == 0)\r
- {\r
- if (i >= length)\r
- {\r
- parse_state = 5;\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
- }\r
- else\r
- {\r
- parse_state = 1;\r
- }\r
- }\r
- else\r
- {\r
- throw new java.lang.IllegalArgumentException();\r
- }\r
- }\r
- else\r
- {\r
- pre = pre + s.charAt(i);\r
- }\r
-\r
- i++;\r
- }\r
-\r
- while (parse_state == 1)\r
- {\r
- if (i >= length)\r
- {\r
- parse_state = 5;\r
- }\r
- else if (s.charAt(i) == ' ')\r
- {\r
- show_space = true;\r
- }\r
- else if (s.charAt(i) == '-')\r
- {\r
- left_align = true;\r
- }\r
- else if (s.charAt(i) == '+')\r
- {\r
- show_plus = true;\r
- }\r
- else if (s.charAt(i) == '0')\r
- {\r
- leading_zeroes = true;\r
- }\r
- else if (s.charAt(i) == '#')\r
- {\r
- alternate = true;\r
- }\r
- else\r
- {\r
- parse_state = 2;\r
- i--;\r
- }\r
-\r
- i++;\r
- }\r
-\r
- while (parse_state == 2)\r
- {\r
- if (i >= length)\r
- {\r
- parse_state = 5;\r
- }\r
- else if ( ('0' <= s.charAt(i)) && (s.charAt(i) <= '9'))\r
- {\r
- width = ( (width * 10) + s.charAt(i)) - '0';\r
- i++;\r
- }\r
- else if (s.charAt(i) == '.')\r
- {\r
- parse_state = 3;\r
- precision = 0;\r
- i++;\r
- }\r
- else\r
- {\r
- parse_state = 4;\r
- }\r
- }\r
-\r
- while (parse_state == 3)\r
- {\r
- if (i >= length)\r
- {\r
- parse_state = 5;\r
- }\r
- else if ( ('0' <= s.charAt(i)) && (s.charAt(i) <= '9'))\r
- {\r
- precision = ( (precision * 10) + s.charAt(i)) - '0';\r
- i++;\r
- }\r
- else\r
- {\r
- parse_state = 4;\r
- }\r
- }\r
-\r
- if (parse_state == 4)\r
- {\r
- if (i >= length)\r
- {\r
- parse_state = 5;\r
- }\r
- else\r
- {\r
- fmt = s.charAt(i);\r
- }\r
-\r
- i++;\r
- }\r
-\r
- if (i < length)\r
- {\r
- post = s.substring(i, length);\r
- }\r
- }\r
-\r
- /**\r
- * Formats the number following printf conventions.\r
- * Main limitation: Can only handle one format parameter at a time\r
- * Use multiple Format objects to format more than one number\r
- * @param s the format string following printf conventions\r
- * The string has a prefix, a format code and a suffix. The prefix and suffix\r
- * become part of the formatted output. The format code directs the\r
- * formatting of the (single) parameter to be formatted. The code has the\r
- * following structure\r
- * <ul>\r
- * <li> a % (required)\r
- * <li> a modifier (optional)\r
- * <dl>\r
- * <dt> + <dd> forces display of + for positive numbers\r
- * <dt> 0 <dd> show leading zeroes\r
- * <dt> - <dd> align left in the field\r
- * <dt> space <dd> prepend a space in front of positive numbers\r
- * <dt> # <dd> use "alternate" format. Add 0 or 0x for octal or hexadecimal numbers. Don't suppress trailing zeroes in general floating point format.\r
- * </dl>\r
- * <li> an integer denoting field width (optional)\r
- * <li> a period followed by an integer denoting precision (optional)\r
- * <li> a format descriptor (required)\r
- * <dl>\r
- * <dt>f <dd> floating point number in fixed format\r
- * <dt>e, E <dd> floating point number in exponential notation (scientific format). The E format results in an uppercase E for the exponent (1.14130E+003), the e format in a lowercase e.\r
- * <dt>g, G <dd> floating point number in general format (fixed format for small numbers, exponential format for large numbers). Trailing zeroes are suppressed. The G format results in an uppercase E for the exponent (if any), the g format in a lowercase e.\r
- * <dt>d, i <dd> integer in decimal\r
- * <dt>x <dd> integer in hexadecimal\r
- * <dt>o <dd> integer in octal\r
- * <dt>s <dd> string\r
- * <dt>c <dd> character\r
- * </dl>\r
- * </ul>\r
- * @exception IllegalArgumentException if bad format\r
- *\r
- */\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
- {\r
- r = "0" + r;\r
- }\r
-\r
- g = Integer.toHexString(color.getGreen());\r
-\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
- {\r
- b = "0" + b;\r
- }\r
-\r
- return r + g + b;\r
- }\r
-\r
- /**\r
- * prints a formatted number following printf conventions\r
- * @param s a PrintStream\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
- {\r
- s.print(new Format(fmt).form(x));\r
- }\r
-\r
- /**\r
- * prints a formatted number following printf conventions\r
- * @param s a PrintStream\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
- {\r
- s.print(new Format(fmt).form(x));\r
- }\r
-\r
- /**\r
- * prints a formatted number following printf conventions\r
- * @param s a PrintStream\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
- {\r
- s.print(new Format(fmt).form(x));\r
- }\r
-\r
- /**\r
- * prints a formatted number following printf conventions\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
- {\r
- s.print(new Format(fmt).form(x));\r
- }\r
-\r
- /**\r
- * Converts a string of digits (decimal, octal or hex) to an integer\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
- {\r
- return (int) atol(s);\r
- }\r
-\r
- /**\r
- * Converts a string of digits (decimal, octal or hex) to a long integer\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
- {\r
- int i = 0;\r
-\r
- while ( (i < s.length()) && Character.isWhitespace(s.charAt(i)))\r
- {\r
- i++;\r
- }\r
-\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
- {\r
- return parseLong(s.substring(i + 2), 16);\r
- }\r
- else\r
- {\r
- return parseLong(s, 8);\r
- }\r
- }\r
- else\r
- {\r
- return parseLong(s, 10);\r
- }\r
- }\r
-\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
-\r
- while ( (i < s.length()) && Character.isWhitespace(s.charAt(i)))\r
- {\r
- i++;\r
- }\r
-\r
- if ( (i < s.length()) && (s.charAt(i) == '-'))\r
- {\r
- sign = -1;\r
- i++;\r
- }\r
- else if ( (i < s.length()) && (s.charAt(i) == '+'))\r
- {\r
- i++;\r
- }\r
-\r
- while (i < s.length())\r
- {\r
- char ch = s.charAt(i);\r
-\r
- if ( ('0' <= ch) && (ch < ('0' + base)))\r
- {\r
- r = ( (r * base) + ch) - '0';\r
- }\r
- else if ( ('A' <= ch) && (ch < ( ('A' + base) - 10)))\r
- {\r
- r = ( (r * base) + ch) - 'A' + 10;\r
- }\r
- else if ( ('a' <= ch) && (ch < ( ('a' + base) - 10)))\r
- {\r
- r = ( (r * base) + ch) - 'a' + 10;\r
- }\r
- else\r
- {\r
- return r * sign;\r
- }\r
-\r
- i++;\r
- }\r
-\r
- return r * sign;\r
- }\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
- {\r
- int i = 0;\r
- int sign = 1;\r
- double r = 0; // integer part\r
- //double f = 0; // fractional part\r
- double p = 1; // exponent of fractional part\r
- int state = 0; // 0 = int part, 1 = frac part\r
-\r
- while ( (i < s.length()) && Character.isWhitespace(s.charAt(i)))\r
- {\r
- i++;\r
- }\r
-\r
- if ( (i < s.length()) && (s.charAt(i) == '-'))\r
- {\r
- sign = -1;\r
- i++;\r
- }\r
- else if ( (i < s.length()) && (s.charAt(i) == '+'))\r
- {\r
- i++;\r
- }\r
-\r
- while (i < s.length())\r
- {\r
- char ch = s.charAt(i);\r
-\r
- if ( ('0' <= ch) && (ch <= '9'))\r
- {\r
- if (state == 0)\r
- {\r
- r = ( (r * 10) + ch) - '0';\r
- }\r
- else if (state == 1)\r
- {\r
- p = p / 10;\r
- r = r + (p * (ch - '0'));\r
- }\r
- }\r
- else if (ch == '.')\r
- {\r
- if (state == 0)\r
- {\r
- state = 1;\r
- }\r
- else\r
- {\r
- return sign * r;\r
- }\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
- }\r
- else\r
- {\r
- return sign * r;\r
- }\r
-\r
- i++;\r
- }\r
-\r
- return sign * r;\r
- }\r
-\r
- /**\r
- * Formats a double into a string (like sprintf in C)\r
- * @param x the number to format\r
- * @return the formatted string\r
- * @exception IllegalArgumentException if bad argument\r
- */\r
- public String form(double x)\r
- {\r
- String r;\r
-\r
- if (precision < 0)\r
- {\r
- precision = 6;\r
- }\r
-\r
- int s = 1;\r
-\r
- if (x < 0)\r
- {\r
- x = -x;\r
- s = -1;\r
- }\r
-\r
- if (fmt == 'f')\r
- {\r
- r = fixed_format(x);\r
- }\r
- else if ( (fmt == 'e') || (fmt == 'E') || (fmt == 'g') || (fmt == 'G'))\r
- {\r
- r = exp_format(x);\r
- }\r
- else\r
- {\r
- throw new java.lang.IllegalArgumentException();\r
- }\r
-\r
- return pad(sign(s, r));\r
- }\r
-\r
- /**\r
- * Formats a long integer into a string (like sprintf in C)\r
- * @param x the number to format\r
- * @return the formatted string\r
- */\r
- public String form(long x)\r
- {\r
- String r;\r
- int s = 0;\r
-\r
- if ( (fmt == 'd') || (fmt == 'i'))\r
- {\r
- if (x < 0)\r
- {\r
- r = ("" + x).substring(1);\r
- s = -1;\r
- }\r
- else\r
- {\r
- r = "" + x;\r
- s = 1;\r
- }\r
- }\r
- else if (fmt == 'o')\r
- {\r
- r = convert(x, 3, 7, "01234567");\r
- }\r
- else if (fmt == 'x')\r
- {\r
- r = convert(x, 4, 15, "0123456789abcdef");\r
- }\r
- else if (fmt == 'X')\r
- {\r
- r = convert(x, 4, 15, "0123456789ABCDEF");\r
- }\r
- else\r
- {\r
- throw new java.lang.IllegalArgumentException();\r
- }\r
-\r
- return pad(sign(s, r));\r
- }\r
-\r
- /**\r
- * Formats a character into a string (like sprintf in C)\r
- * @param x the value to format\r
- * @return the formatted string\r
- */\r
- public String form(char c)\r
- {\r
- if (fmt != 'c')\r
- {\r
- throw new java.lang.IllegalArgumentException();\r
- }\r
-\r
- String r = "" + c;\r
-\r
- return pad(r);\r
- }\r
-\r
- /**\r
- * Formats a string into a larger string (like sprintf in C)\r
- * @param x the value to format\r
- * @return the formatted string\r
- */\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
- {\r
- s = s.substring(0, precision);\r
- }\r
-\r
- return pad(s);\r
- }\r
-\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
- StringBuffer s = new StringBuffer(n);\r
-\r
- for (int i = 0; i < n; i++)\r
- {\r
- s.append(c);\r
- }\r
-\r
- return s.toString();\r
- }\r
-\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
- {\r
- r = d.charAt( (int) (x & m)) + r;\r
- x = x >>> n;\r
- }\r
-\r
- return r;\r
- }\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
- {\r
- return pre + r + p + post;\r
- }\r
- else\r
- {\r
- return pre + p + r + post;\r
- }\r
- }\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
- {\r
- p = "-";\r
- }\r
- else if (s > 0)\r
- {\r
- if (show_plus)\r
- {\r
- p = "+";\r
- }\r
- else if (show_space)\r
- {\r
- p = " ";\r
- }\r
- }\r
- else\r
- {\r
- if ( (fmt == 'o') && alternate && (r.length() > 0) &&\r
- (r.charAt(0) != '0'))\r
- {\r
- p = "0";\r
- }\r
- else if ( (fmt == 'x') && alternate)\r
- {\r
- p = "0x";\r
- }\r
- else if ( (fmt == 'X') && alternate)\r
- {\r
- p = "0X";\r
- }\r
- }\r
-\r
- int w = 0;\r
-\r
- if (leading_zeroes)\r
- {\r
- w = width;\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
- /**\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
- {\r
- return exp_format(d);\r
- }\r
-\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
- {\r
- return exp_format(d);\r
- }\r
-\r
- double factor = 1;\r
- String leading_zeroes = "";\r
-\r
- for (int i = 1; (i <= precision) && (factor <= 0x7FFFFFFFFFFFFFFFL);\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
- {\r
- l = 0;\r
- whole++;\r
- }\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
- {\r
- int t = z.length() - 1;\r
-\r
- while ( (t >= 0) && (z.charAt(t) == '0'))\r
- {\r
- t--;\r
- }\r
-\r
- if ( (t >= 0) && (z.charAt(t) == '.'))\r
- {\r
- t--;\r
- }\r
-\r
- z = z.substring(0, t + 1);\r
- }\r
-\r
- return whole + z;\r
- }\r
-\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
- {\r
- while (dd > 10)\r
- {\r
- e++;\r
- factor /= 10;\r
- dd = dd / 10;\r
- }\r
-\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
- {\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
- {\r
- f = f + "e";\r
- }\r
- else\r
- {\r
- f = f + "E";\r
- }\r
-\r
- String p = "000";\r
-\r
- if (e >= 0)\r
- {\r
- f = f + "+";\r
- p = p + e;\r
- }\r
- else\r
- {\r
- f = f + "-";\r
- p = p + ( -e);\r
- }\r
-\r
- return f + p.substring(p.length() - 3, p.length());\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
+ */
+/**
+ * A class for formatting numbers that follows printf conventions.
+ * Also implements C-like atoi and atof functions
+ * @version 1.03 25 Oct 1997
+ * @author Cay Horstmann
+ */
+package jalview.util;
+
+/**
+ * DOCUMENT ME!
+ *
+ * @author $author$
+ * @version $Revision$
+ */
+public class Format
+{
+ private int width;
+ private int precision;
+ private String pre;
+ private String post;
+ private boolean leading_zeroes;
+ private boolean show_plus;
+ private boolean alternate;
+ private boolean show_space;
+ private boolean left_align;
+ private char fmt; // one of cdeEfgGiosxXos
+
+ /**
+ * Creates a new Format object.
+ *
+ * @param s DOCUMENT ME!
+ */
+ public Format(String s)
+ {
+ width = 0;
+ precision = -1;
+ pre = "";
+ post = "";
+ leading_zeroes = false;
+ show_plus = false;
+ alternate = false;
+ show_space = false;
+ left_align = false;
+ fmt = ' ';
+
+ int length = s.length();
+ int parse_state = 0;
+
+ // 0 = prefix, 1 = flags, 2 = width, 3 = precision,
+ // 4 = format, 5 = end
+ int i = 0;
+
+ while (parse_state == 0)
+ {
+ if (i >= length)
+ {
+ parse_state = 5;
+ }
+ else if (s.charAt(i) == '%')
+ {
+ if (i < (length - 1))
+ {
+ if (s.charAt(i + 1) == '%')
+ {
+ pre = pre + '%';
+ i++;
+ }
+ else
+ {
+ parse_state = 1;
+ }
+ }
+ else
+ {
+ throw new java.lang.IllegalArgumentException();
+ }
+ }
+ else
+ {
+ pre = pre + s.charAt(i);
+ }
+
+ i++;
+ }
+
+ while (parse_state == 1)
+ {
+ if (i >= length)
+ {
+ parse_state = 5;
+ }
+ else if (s.charAt(i) == ' ')
+ {
+ show_space = true;
+ }
+ else if (s.charAt(i) == '-')
+ {
+ left_align = true;
+ }
+ else if (s.charAt(i) == '+')
+ {
+ show_plus = true;
+ }
+ else if (s.charAt(i) == '0')
+ {
+ leading_zeroes = true;
+ }
+ else if (s.charAt(i) == '#')
+ {
+ alternate = true;
+ }
+ else
+ {
+ parse_state = 2;
+ i--;
+ }
+
+ i++;
+ }
+
+ while (parse_state == 2)
+ {
+ if (i >= length)
+ {
+ parse_state = 5;
+ }
+ else if ( ('0' <= s.charAt(i)) && (s.charAt(i) <= '9'))
+ {
+ width = ( (width * 10) + s.charAt(i)) - '0';
+ i++;
+ }
+ else if (s.charAt(i) == '.')
+ {
+ parse_state = 3;
+ precision = 0;
+ i++;
+ }
+ else
+ {
+ parse_state = 4;
+ }
+ }
+
+ while (parse_state == 3)
+ {
+ if (i >= length)
+ {
+ parse_state = 5;
+ }
+ else if ( ('0' <= s.charAt(i)) && (s.charAt(i) <= '9'))
+ {
+ precision = ( (precision * 10) + s.charAt(i)) - '0';
+ i++;
+ }
+ else
+ {
+ parse_state = 4;
+ }
+ }
+
+ if (parse_state == 4)
+ {
+ if (i >= length)
+ {
+ parse_state = 5;
+ }
+ else
+ {
+ fmt = s.charAt(i);
+ }
+
+ i++;
+ }
+
+ if (i < length)
+ {
+ post = s.substring(i, length);
+ }
+ }
+
+ /**
+ * Formats the number following printf conventions.
+ * Main limitation: Can only handle one format parameter at a time
+ * Use multiple Format objects to format more than one number
+ * @param s the format string following printf conventions
+ * The string has a prefix, a format code and a suffix. The prefix and suffix
+ * become part of the formatted output. The format code directs the
+ * formatting of the (single) parameter to be formatted. The code has the
+ * following structure
+ * <ul>
+ * <li> a % (required)
+ * <li> a modifier (optional)
+ * <dl>
+ * <dt> + <dd> forces display of + for positive numbers
+ * <dt> 0 <dd> show leading zeroes
+ * <dt> - <dd> align left in the field
+ * <dt> space <dd> prepend a space in front of positive numbers
+ * <dt> # <dd> use "alternate" format. Add 0 or 0x for octal or hexadecimal numbers. Don't suppress trailing zeroes in general floating point format.
+ * </dl>
+ * <li> an integer denoting field width (optional)
+ * <li> a period followed by an integer denoting precision (optional)
+ * <li> a format descriptor (required)
+ * <dl>
+ * <dt>f <dd> floating point number in fixed format
+ * <dt>e, E <dd> floating point number in exponential notation (scientific format). The E format results in an uppercase E for the exponent (1.14130E+003), the e format in a lowercase e.
+ * <dt>g, G <dd> floating point number in general format (fixed format for small numbers, exponential format for large numbers). Trailing zeroes are suppressed. The G format results in an uppercase E for the exponent (if any), the g format in a lowercase e.
+ * <dt>d, i <dd> integer in decimal
+ * <dt>x <dd> integer in hexadecimal
+ * <dt>o <dd> integer in octal
+ * <dt>s <dd> string
+ * <dt>c <dd> character
+ * </dl>
+ * </ul>
+ * @exception IllegalArgumentException if bad format
+ *
+ */
+ public static String getHexString(java.awt.Color color)
+ {
+ String r;
+ String g;
+ String b;
+ r = Integer.toHexString(color.getRed());
+
+ if (r.length() < 2)
+ {
+ r = "0" + r;
+ }
+
+ g = Integer.toHexString(color.getGreen());
+
+ if (g.length() < 2)
+ {
+ g = "0" + g;
+ }
+
+ b = Integer.toHexString(color.getBlue());
+
+ if (b.length() < 2)
+ {
+ b = "0" + b;
+ }
+
+ return r + g + b;
+ }
+
+ /**
+ * prints a formatted number following printf conventions
+ * @param s a PrintStream
+ * @param fmt the format string
+ * @param x the double to print
+ */
+ public static void print(java.io.PrintStream s, String fmt, double x)
+ {
+ s.print(new Format(fmt).form(x));
+ }
+
+ /**
+ * prints a formatted number following printf conventions
+ * @param s a PrintStream
+ * @param fmt the format string
+ * @param x the long to print
+ */
+ public static void print(java.io.PrintStream s, String fmt, long x)
+ {
+ s.print(new Format(fmt).form(x));
+ }
+
+ /**
+ * prints a formatted number following printf conventions
+ * @param s a PrintStream
+ * @param fmt the format string
+ * @param x the character to
+ */
+ public static void print(java.io.PrintStream s, String fmt, char x)
+ {
+ s.print(new Format(fmt).form(x));
+ }
+
+ /**
+ * prints a formatted number following printf conventions
+ * @param s a PrintStream, fmt the format string
+ * @param x a string that represents the digits to print
+ */
+ public static void print(java.io.PrintStream s, String fmt, String x)
+ {
+ s.print(new Format(fmt).form(x));
+ }
+
+ /**
+ * Converts a string of digits (decimal, octal or hex) to an integer
+ * @param s a string
+ * @return the numeric value of the prefix of s representing a base 10 integer
+ */
+ public static int atoi(String s)
+ {
+ return (int) atol(s);
+ }
+
+ /**
+ * Converts a string of digits (decimal, octal or hex) to a long integer
+ * @param s a string
+ * @return the numeric value of the prefix of s representing a base 10 integer
+ */
+ public static long atol(String s)
+ {
+ int i = 0;
+
+ while ( (i < s.length()) && Character.isWhitespace(s.charAt(i)))
+ {
+ i++;
+ }
+
+ if ( (i < s.length()) && (s.charAt(i) == '0'))
+ {
+ if ( ( (i + 1) < s.length()) &&
+ ( (s.charAt(i + 1) == 'x') || (s.charAt(i + 1) == 'X')))
+ {
+ return parseLong(s.substring(i + 2), 16);
+ }
+ else
+ {
+ return parseLong(s, 8);
+ }
+ }
+ else
+ {
+ return parseLong(s, 10);
+ }
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param s DOCUMENT ME!
+ * @param base DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ private static long parseLong(String s, int base)
+ {
+ int i = 0;
+ int sign = 1;
+ long r = 0;
+
+ while ( (i < s.length()) && Character.isWhitespace(s.charAt(i)))
+ {
+ i++;
+ }
+
+ if ( (i < s.length()) && (s.charAt(i) == '-'))
+ {
+ sign = -1;
+ i++;
+ }
+ else if ( (i < s.length()) && (s.charAt(i) == '+'))
+ {
+ i++;
+ }
+
+ while (i < s.length())
+ {
+ char ch = s.charAt(i);
+
+ if ( ('0' <= ch) && (ch < ('0' + base)))
+ {
+ r = ( (r * base) + ch) - '0';
+ }
+ else if ( ('A' <= ch) && (ch < ( ('A' + base) - 10)))
+ {
+ r = ( (r * base) + ch) - 'A' + 10;
+ }
+ else if ( ('a' <= ch) && (ch < ( ('a' + base) - 10)))
+ {
+ r = ( (r * base) + ch) - 'a' + 10;
+ }
+ else
+ {
+ return r * sign;
+ }
+
+ i++;
+ }
+
+ return r * sign;
+ }
+
+ /**
+ * Converts a string of digits to an double
+ * @param s a string
+ */
+ public static double atof(String s)
+ {
+ int i = 0;
+ int sign = 1;
+ double r = 0; // integer part
+ //double f = 0; // fractional part
+ double p = 1; // exponent of fractional part
+ int state = 0; // 0 = int part, 1 = frac part
+
+ while ( (i < s.length()) && Character.isWhitespace(s.charAt(i)))
+ {
+ i++;
+ }
+
+ if ( (i < s.length()) && (s.charAt(i) == '-'))
+ {
+ sign = -1;
+ i++;
+ }
+ else if ( (i < s.length()) && (s.charAt(i) == '+'))
+ {
+ i++;
+ }
+
+ while (i < s.length())
+ {
+ char ch = s.charAt(i);
+
+ if ( ('0' <= ch) && (ch <= '9'))
+ {
+ if (state == 0)
+ {
+ r = ( (r * 10) + ch) - '0';
+ }
+ else if (state == 1)
+ {
+ p = p / 10;
+ r = r + (p * (ch - '0'));
+ }
+ }
+ else if (ch == '.')
+ {
+ if (state == 0)
+ {
+ state = 1;
+ }
+ else
+ {
+ return sign * r;
+ }
+ }
+ else if ( (ch == 'e') || (ch == 'E'))
+ {
+ long e = (int) parseLong(s.substring(i + 1), 10);
+
+ return sign * r * Math.pow(10, e);
+ }
+ else
+ {
+ return sign * r;
+ }
+
+ i++;
+ }
+
+ return sign * r;
+ }
+
+ /**
+ * Formats a double into a string (like sprintf in C)
+ * @param x the number to format
+ * @return the formatted string
+ * @exception IllegalArgumentException if bad argument
+ */
+ public String form(double x)
+ {
+ String r;
+
+ if (precision < 0)
+ {
+ precision = 6;
+ }
+
+ int s = 1;
+
+ if (x < 0)
+ {
+ x = -x;
+ s = -1;
+ }
+
+ if (fmt == 'f')
+ {
+ r = fixed_format(x);
+ }
+ else if ( (fmt == 'e') || (fmt == 'E') || (fmt == 'g') || (fmt == 'G'))
+ {
+ r = exp_format(x);
+ }
+ else
+ {
+ throw new java.lang.IllegalArgumentException();
+ }
+
+ return pad(sign(s, r));
+ }
+
+ /**
+ * Formats a long integer into a string (like sprintf in C)
+ * @param x the number to format
+ * @return the formatted string
+ */
+ public String form(long x)
+ {
+ String r;
+ int s = 0;
+
+ if ( (fmt == 'd') || (fmt == 'i'))
+ {
+ if (x < 0)
+ {
+ r = ("" + x).substring(1);
+ s = -1;
+ }
+ else
+ {
+ r = "" + x;
+ s = 1;
+ }
+ }
+ else if (fmt == 'o')
+ {
+ r = convert(x, 3, 7, "01234567");
+ }
+ else if (fmt == 'x')
+ {
+ r = convert(x, 4, 15, "0123456789abcdef");
+ }
+ else if (fmt == 'X')
+ {
+ r = convert(x, 4, 15, "0123456789ABCDEF");
+ }
+ else
+ {
+ throw new java.lang.IllegalArgumentException();
+ }
+
+ return pad(sign(s, r));
+ }
+
+ /**
+ * Formats a character into a string (like sprintf in C)
+ * @param x the value to format
+ * @return the formatted string
+ */
+ public String form(char c)
+ {
+ if (fmt != 'c')
+ {
+ throw new java.lang.IllegalArgumentException();
+ }
+
+ String r = "" + c;
+
+ return pad(r);
+ }
+
+ /**
+ * Formats a string into a larger string (like sprintf in C)
+ * @param x the value to format
+ * @return the formatted string
+ */
+ public String form(String s)
+ {
+ if (fmt != 's')
+ {
+ throw new java.lang.IllegalArgumentException();
+ }
+
+ if (precision >= 0)
+ {
+ s = s.substring(0, precision);
+ }
+
+ return pad(s);
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param c DOCUMENT ME!
+ * @param n DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ private static String repeat(char c, int n)
+ {
+ if (n <= 0)
+ {
+ return "";
+ }
+
+ StringBuffer s = new StringBuffer(n);
+
+ for (int i = 0; i < n; i++)
+ {
+ s.append(c);
+ }
+
+ return s.toString();
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param x DOCUMENT ME!
+ * @param n DOCUMENT ME!
+ * @param m DOCUMENT ME!
+ * @param d DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ private static String convert(long x, int n, int m, String d)
+ {
+ if (x == 0)
+ {
+ return "0";
+ }
+
+ String r = "";
+
+ while (x != 0)
+ {
+ r = d.charAt( (int) (x & m)) + r;
+ x = x >>> n;
+ }
+
+ return r;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param r DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ private String pad(String r)
+ {
+ String p = repeat(' ', width - r.length());
+
+ if (left_align)
+ {
+ return pre + r + p + post;
+ }
+ else
+ {
+ return pre + p + r + post;
+ }
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param s DOCUMENT ME!
+ * @param r DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ private String sign(int s, String r)
+ {
+ String p = "";
+
+ if (s < 0)
+ {
+ p = "-";
+ }
+ else if (s > 0)
+ {
+ if (show_plus)
+ {
+ p = "+";
+ }
+ else if (show_space)
+ {
+ p = " ";
+ }
+ }
+ else
+ {
+ if ( (fmt == 'o') && alternate && (r.length() > 0) &&
+ (r.charAt(0) != '0'))
+ {
+ p = "0";
+ }
+ else if ( (fmt == 'x') && alternate)
+ {
+ p = "0x";
+ }
+ else if ( (fmt == 'X') && alternate)
+ {
+ p = "0X";
+ }
+ }
+
+ int w = 0;
+
+ if (leading_zeroes)
+ {
+ w = width;
+ }
+ else if ( ( (fmt == 'd') || (fmt == 'i') || (fmt == 'x') || (fmt == 'X') ||
+ (fmt == 'o')) && (precision > 0))
+ {
+ w = precision;
+ }
+
+ return p + repeat('0', w - p.length() - r.length()) + r;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param d DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ private String fixed_format(double d)
+ {
+ boolean removeTrailing = ( (fmt == 'G') || (fmt == 'g')) && !alternate;
+
+ // remove trailing zeroes and decimal point
+ if (d > 0x7FFFFFFFFFFFFFFFL)
+ {
+ return exp_format(d);
+ }
+
+ if (precision == 0)
+ {
+ return (long) (d + 0.5) + (removeTrailing ? "" : ".");
+ }
+
+ long whole = (long) d;
+ double fr = d - whole; // fractional part
+
+ if ( (fr >= 1) || (fr < 0))
+ {
+ return exp_format(d);
+ }
+
+ double factor = 1;
+ String leading_zeroes = "";
+
+ for (int i = 1; (i <= precision) && (factor <= 0x7FFFFFFFFFFFFFFFL);
+ i++)
+ {
+ factor *= 10;
+ leading_zeroes = leading_zeroes + "0";
+ }
+
+ long l = (long) ( (factor * fr) + 0.5);
+
+ if (l >= factor)
+ {
+ l = 0;
+ whole++;
+ }
+
+ // CSH 10-25-97
+ String z = leading_zeroes + l;
+ z = "." + z.substring(z.length() - precision, z.length());
+
+ if (removeTrailing)
+ {
+ int t = z.length() - 1;
+
+ while ( (t >= 0) && (z.charAt(t) == '0'))
+ {
+ t--;
+ }
+
+ if ( (t >= 0) && (z.charAt(t) == '.'))
+ {
+ t--;
+ }
+
+ z = z.substring(0, t + 1);
+ }
+
+ return whole + z;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param d DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ private String exp_format(double d)
+ {
+ String f = "";
+ int e = 0;
+ double dd = d;
+ double factor = 1;
+
+ if (d != 0)
+ {
+ while (dd > 10)
+ {
+ e++;
+ factor /= 10;
+ dd = dd / 10;
+ }
+
+ while (dd < 1)
+ {
+ e--;
+ factor *= 10;
+ dd = dd * 10;
+ }
+ }
+
+ if ( ( (fmt == 'g') || (fmt == 'G')) && (e >= -4) && (e < precision))
+ {
+ return fixed_format(d);
+ }
+
+ d = d * factor;
+ f = f + fixed_format(d);
+
+ if ( (fmt == 'e') || (fmt == 'g'))
+ {
+ f = f + "e";
+ }
+ else
+ {
+ f = f + "E";
+ }
+
+ String p = "000";
+
+ if (e >= 0)
+ {
+ f = f + "+";
+ p = p + e;
+ }
+ else
+ {
+ f = f + "-";
+ p = p + ( -e);
+ }
+
+ return f + p.substring(p.length() - 3, p.length());
+ }
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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.*;\r
-import javax.imageio.*;\r
-\r
-import java.awt.*;\r
-import java.awt.image.*;\r
-\r
-import org.jibble.epsgraphics.*;\r
-import jalview.gui.*;\r
-import jalview.io.*;\r
-\r
-public class ImageMaker\r
-{\r
- public static final int EPS = 0;\r
- public static final int PNG = 1;\r
- int type = -1;\r
-\r
- EpsGraphics2D pg;\r
- Graphics graphics;\r
- FileOutputStream out;\r
- BufferedImage bi;\r
-\r
- public ImageMaker(Component parent, int type, String title,\r
- int width, int height, File file, String EPStitle)\r
- {\r
- this.type = type;\r
-\r
- if (file == null)\r
- {\r
- JalviewFileChooser chooser;\r
- chooser = type == EPS ? getEPSChooser() : getPNGChooser();\r
-\r
- chooser.setFileView(new jalview.io.JalviewFileView());\r
- chooser.setDialogTitle(title);\r
- chooser.setToolTipText("Save");\r
-\r
- int value = chooser.showSaveDialog(parent);\r
-\r
- if (value == jalview.io.JalviewFileChooser.APPROVE_OPTION)\r
- {\r
- jalview.bin.Cache.setProperty("LAST_DIRECTORY",\r
- chooser.getSelectedFile().getParent());\r
-\r
- file = chooser.getSelectedFile();\r
- }\r
- }\r
-\r
- if (file != null)\r
- {\r
- try\r
- {\r
- out = new FileOutputStream(file);\r
-\r
- if (type == EPS)\r
- {\r
- setupEPS(width, height, EPStitle);\r
- }\r
- else\r
- {\r
- setupPNG(width, height);\r
- }\r
- }\r
- catch (Exception ex)\r
- {\r
- System.out.println("Error creating " + (type == EPS ? "EPS" : "PNG") +\r
- " file.");\r
- }\r
- }\r
- }\r
-\r
- public Graphics getGraphics()\r
- {\r
- return graphics;\r
- }\r
-\r
- void setupPNG(int width, int height)\r
- {\r
- bi = new BufferedImage(width, height,\r
- BufferedImage.TYPE_INT_RGB);\r
- graphics = bi.getGraphics();\r
- Graphics2D ig2 = (Graphics2D) graphics;\r
- ig2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,\r
- RenderingHints.VALUE_ANTIALIAS_ON);\r
- }\r
-\r
- public void writeImage()\r
- {\r
- try\r
- {\r
- switch (type)\r
- {\r
- case EPS:\r
- pg.flush();\r
- pg.close();\r
- break;\r
- case PNG:\r
- ImageIO.write(bi, "png", out);\r
- out.close();\r
- break;\r
- }\r
- }\r
- catch (Exception ex)\r
- {\r
- ex.printStackTrace();\r
- }\r
- }\r
-\r
- void setupEPS(int width, int height, String title)\r
- {\r
- boolean accurateText = true;\r
-\r
- String renderStyle = jalview.bin.Cache.getDefault("EPS_RENDERING",\r
- "Prompt each time");\r
-\r
- // If we need to prompt, and if the GUI is visible then\r
- // Prompt for EPS rendering style\r
- if (renderStyle.equalsIgnoreCase("Prompt each time")\r
- && !\r
- (System.getProperty("java.awt.headless") != null\r
- && System.getProperty("java.awt.headless").equals("true")))\r
- {\r
- EPSOptions eps = new EPSOptions();\r
- renderStyle = eps.getValue();\r
-\r
- if (renderStyle == null || eps.cancelled)\r
- {\r
- return;\r
- }\r
- }\r
-\r
- if (renderStyle.equalsIgnoreCase("text"))\r
- {\r
- accurateText = false;\r
- }\r
-\r
- try\r
- {\r
- pg = new EpsGraphics2D(title, out, 0, 0, width,\r
- height);\r
- Graphics2D ig2 = (Graphics2D) pg;\r
- ig2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,\r
- RenderingHints.VALUE_ANTIALIAS_ON);\r
-\r
- pg.setAccurateTextMode(accurateText);\r
-\r
- graphics = pg;\r
- }\r
- catch (Exception ex)\r
- {}\r
- }\r
-\r
- JalviewFileChooser getPNGChooser()\r
- {\r
- return new jalview.io.JalviewFileChooser(jalview.bin.Cache.getProperty(\r
- "LAST_DIRECTORY"), new String[]\r
- {"png"},\r
- new String[]\r
- {"Portable network graphics"},\r
- "Portable network graphics");\r
- }\r
-\r
- JalviewFileChooser getEPSChooser()\r
- {\r
- return new jalview.io.JalviewFileChooser(jalview.bin.Cache.getProperty(\r
- "LAST_DIRECTORY"), new String[]\r
- {"eps"},\r
- new String[]\r
- {"Encapsulated Postscript"},\r
- "Encapsulated Postscript");\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.util;
+
+import java.io.*;
+import javax.imageio.*;
+
+import java.awt.*;
+import java.awt.image.*;
+
+import org.jibble.epsgraphics.*;
+import jalview.gui.*;
+import jalview.io.*;
+
+public class ImageMaker
+{
+ public static final int EPS = 0;
+ public static final int PNG = 1;
+ int type = -1;
+
+ EpsGraphics2D pg;
+ Graphics graphics;
+ FileOutputStream out;
+ BufferedImage bi;
+
+ public ImageMaker(Component parent, int type, String title,
+ int width, int height, File file, String EPStitle)
+ {
+ this.type = type;
+
+ if (file == null)
+ {
+ JalviewFileChooser chooser;
+ chooser = type == EPS ? getEPSChooser() : getPNGChooser();
+
+ chooser.setFileView(new jalview.io.JalviewFileView());
+ chooser.setDialogTitle(title);
+ chooser.setToolTipText("Save");
+
+ int value = chooser.showSaveDialog(parent);
+
+ if (value == jalview.io.JalviewFileChooser.APPROVE_OPTION)
+ {
+ jalview.bin.Cache.setProperty("LAST_DIRECTORY",
+ chooser.getSelectedFile().getParent());
+
+ file = chooser.getSelectedFile();
+ }
+ }
+
+ if (file != null)
+ {
+ try
+ {
+ out = new FileOutputStream(file);
+
+ if (type == EPS)
+ {
+ setupEPS(width, height, EPStitle);
+ }
+ else
+ {
+ setupPNG(width, height);
+ }
+ }
+ catch (Exception ex)
+ {
+ System.out.println("Error creating " + (type == EPS ? "EPS" : "PNG") +
+ " file.");
+ }
+ }
+ }
+
+ public Graphics getGraphics()
+ {
+ return graphics;
+ }
+
+ void setupPNG(int width, int height)
+ {
+ bi = new BufferedImage(width, height,
+ BufferedImage.TYPE_INT_RGB);
+ graphics = bi.getGraphics();
+ Graphics2D ig2 = (Graphics2D) graphics;
+ ig2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+ RenderingHints.VALUE_ANTIALIAS_ON);
+ }
+
+ public void writeImage()
+ {
+ try
+ {
+ switch (type)
+ {
+ case EPS:
+ pg.flush();
+ pg.close();
+ break;
+ case PNG:
+ ImageIO.write(bi, "png", out);
+ out.close();
+ break;
+ }
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ void setupEPS(int width, int height, String title)
+ {
+ boolean accurateText = true;
+
+ String renderStyle = jalview.bin.Cache.getDefault("EPS_RENDERING",
+ "Prompt each time");
+
+ // If we need to prompt, and if the GUI is visible then
+ // Prompt for EPS rendering style
+ if (renderStyle.equalsIgnoreCase("Prompt each time")
+ && !
+ (System.getProperty("java.awt.headless") != null
+ && System.getProperty("java.awt.headless").equals("true")))
+ {
+ EPSOptions eps = new EPSOptions();
+ renderStyle = eps.getValue();
+
+ if (renderStyle == null || eps.cancelled)
+ {
+ return;
+ }
+ }
+
+ if (renderStyle.equalsIgnoreCase("text"))
+ {
+ accurateText = false;
+ }
+
+ try
+ {
+ pg = new EpsGraphics2D(title, out, 0, 0, width,
+ height);
+ Graphics2D ig2 = (Graphics2D) pg;
+ ig2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+ RenderingHints.VALUE_ANTIALIAS_ON);
+
+ pg.setAccurateTextMode(accurateText);
+
+ graphics = pg;
+ }
+ catch (Exception ex)
+ {}
+ }
+
+ JalviewFileChooser getPNGChooser()
+ {
+ return new jalview.io.JalviewFileChooser(jalview.bin.Cache.getProperty(
+ "LAST_DIRECTORY"), new String[]
+ {"png"},
+ new String[]
+ {"Portable network graphics"},
+ "Portable network graphics");
+ }
+
+ JalviewFileChooser getEPSChooser()
+ {
+ return new jalview.io.JalviewFileChooser(jalview.bin.Cache.getProperty(
+ "LAST_DIRECTORY"), new String[]
+ {"eps"},
+ new String[]
+ {"Encapsulated Postscript"},
+ "Encapsulated Postscript");
+ }
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
/**\r
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
- *\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
+ * \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
+ * \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) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
- *\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
+ * \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
+ * \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 (Version 2.4)\r
+ * Copyright (C) 2008 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.util.Vector;\r
/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
- *\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
+ * \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
+ * \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) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
- *\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
+ * \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
+ * \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
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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 java.util.*;\r
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
-/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 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;
-
-import java.util.*;
-
-import jalview.analysis.*;
-import jalview.bin.*;
-import jalview.datamodel.*;
-import jalview.datamodel.Alignment;
-import jalview.gui.*;
-import vamsas.objects.simple.MsaResult;
-
-/**
- * <p>
- * Title:
- * </p>
- *
- * <p>
- * Description:
- * </p>
- *
- * <p>
- * Copyright: Copyright (c) 2004
- * </p>
- *
- * <p>
- * Company: Dundee University
- * </p>
- *
- * @author not attributable
- * @version 1.0
- */
-class MsaWSThread
- extends WSThread implements WSClientI
-{
- boolean submitGaps = false; // pass sequences including gaps to alignment
-
- // service
-
- boolean preserveOrder = true; // and always store and recover sequence
-
- // order
-
- class MsaWSJob
- extends WSThread.WSJob
- {
- // hold special input for this
- vamsas.objects.simple.SequenceSet seqs = new vamsas.objects.simple.
- SequenceSet();
-
- /**
- * MsaWSJob
- *
- * @param jobNum
- * int
- * @param jobId
- * String
- */
- public MsaWSJob(int jobNum, SequenceI[] inSeqs)
- {
- this.jobnum = jobNum;
- if (!prepareInput(inSeqs, 2))
- {
- submitted = true;
- subjobComplete = true;
- result = new MsaResult();
- result.setFinished(true);
- result.setStatus("Job never ran - input returned to user.");
- }
-
- }
-
- Hashtable SeqNames = new Hashtable();
- Vector emptySeqs = new Vector();
- /**
- * prepare input sequences for MsaWS service
- * @param seqs jalview sequences to be prepared
- * @param minlen minimum number of residues required for this MsaWS service
- * @return true if seqs contains sequences to be submitted to service.
- */
- private boolean prepareInput(SequenceI[] seqs, int minlen)
- {
- int nseqs = 0;
- if (minlen < 0)
- {
- throw new Error("Implementation error: minlen must be zero or more.");
- }
- for (int i = 0; i < seqs.length; i++)
- {
- if (seqs[i].getEnd() - seqs[i].getStart() > minlen - 1)
- {
- nseqs++;
- }
- }
- boolean valid = nseqs > 1; // need at least two seqs
- vamsas.objects.simple.Sequence[] seqarray =
- (valid)
- ? new vamsas.objects.simple.Sequence[nseqs]
- : null;
- for (int i = 0, n = 0; i < seqs.length; i++)
- {
-
- String newname = jalview.analysis.SeqsetUtils.unique_name(i); // same
- // for
- // any
- // subjob
- SeqNames.put(newname, jalview.analysis.SeqsetUtils
- .SeqCharacterHash(seqs[i]));
- if (valid && seqs[i].getEnd() - seqs[i].getStart() > minlen - 1)
- {
- seqarray[n] = new vamsas.objects.simple.Sequence();
- seqarray[n].setId(newname);
- seqarray[n++].setSeq( (submitGaps) ? seqs[i].getSequenceAsString()
- : AlignSeq.extractGaps(
- jalview.util.Comparison.GapChars, seqs[i]
- .getSequenceAsString()));
- }
- else
- {
- String empty = null;
- if (seqs[i].getEnd() >= seqs[i].getStart())
- {
- empty = (submitGaps) ? seqs[i].getSequenceAsString()
- : AlignSeq.extractGaps(
- jalview.util.Comparison.GapChars, seqs[i]
- .getSequenceAsString());
- }
- emptySeqs.add(new String[]
- {newname, empty});
- }
- }
- this.seqs = new vamsas.objects.simple.SequenceSet();
- this.seqs.setSeqs(seqarray);
- return valid;
- }
-
- /**
- *
- * @return true if getAlignment will return a valid alignment result.
- */
- public boolean hasResults()
- {
- if (subjobComplete && result != null && result.isFinished()
- && ( (MsaResult) result).getMsa() != null &&
- ( (MsaResult) result).getMsa().getSeqs() != null)
- {
- return true;
- }
- return false;
- }
-
- public Object[] getAlignment()
- {
-
- if (result != null && result.isFinished())
- {
- SequenceI[] alseqs = null;
- char alseq_gapchar = '-';
- int alseq_l = 0;
- if ( ( (MsaResult) result).getMsa() != null)
- {
- alseqs = getVamsasAlignment( ( (MsaResult) result).getMsa());
- alseq_gapchar = ( (MsaResult) result).getMsa().getGapchar().charAt(0);
- alseq_l = alseqs.length;
- }
- if (emptySeqs.size() > 0)
- {
- SequenceI[] t_alseqs = new SequenceI[alseq_l + emptySeqs.size()];
- // get width
- int i, w = 0;
- if (alseq_l > 0)
- {
- for (i = 0, w = alseqs[0].getLength(); i < alseq_l; i++)
- {
- if (w < alseqs[i].getLength())
- {
- w = alseqs[i].getLength();
- }
- t_alseqs[i] = alseqs[i];
- alseqs[i] = null;
- }
- }
- // check that aligned width is at least as wide as emptySeqs width.
- int ow = w, nw = w;
- for (i = 0, w = emptySeqs.size(); i < w; i++)
- {
- String[] es = (String[]) emptySeqs.get(i);
- if (es != null && es[1] != null)
- {
- int sw = es[1].length();
- if (nw < sw)
- {
- nw = sw;
- }
- }
- }
- // make a gapped string.
- StringBuffer insbuff = new StringBuffer(w);
- for (i = 0; i < nw; i++)
- {
- insbuff.append(alseq_gapchar);
- }
- if (ow < nw)
- {
- for (i = 0; i < alseq_l; i++)
- {
- int sw = t_alseqs[i].getLength();
- if (nw > sw)
- {
- // pad at end
- alseqs[i].setSequence(t_alseqs[i].getSequenceAsString() +
- insbuff.substring(0, sw - nw));
- }
- }
- }
- for (i = 0, w = emptySeqs.size(); i < w; i++)
- {
- String[] es = (String[]) emptySeqs.get(i);
- if (es[1] == null)
- {
- t_alseqs[i +
- alseq_l] = new jalview.datamodel.Sequence(es[0],
- insbuff.toString(), 1, 0);
- }
- else
- {
- if (es[1].length() < nw)
- {
- t_alseqs[i +
- alseq_l] = new jalview.datamodel.Sequence(es[0],
- es[1] + insbuff.substring(0, nw - es[1].length()), 1,
- 1 + es[1].length());
- }
- else
- {
- t_alseqs[i +
- alseq_l] = new jalview.datamodel.Sequence(es[0], es[1]);
- }
- }
- }
- alseqs = t_alseqs;
- }
- AlignmentOrder msaorder = new AlignmentOrder(alseqs);
- // always recover the order - makes parseResult()'s life easier.
- jalview.analysis.AlignmentSorter.recoverOrder(alseqs);
- // account for any missing sequences
- jalview.analysis.SeqsetUtils.deuniquify(SeqNames, alseqs);
- return new Object[]
- {
- alseqs, msaorder};
- }
- return null;
- }
-
- /**
- * mark subjob as cancelled and set result object appropriatly
- */
- void cancel()
- {
- cancelled = true;
- subjobComplete = true;
- result = null;
- }
-
- /**
- *
- * @return boolean true if job can be submitted.
- */
- boolean hasValidInput()
- {
- if (seqs.getSeqs() != null)
- {
- return true;
- }
- return false;
- }
- }
-
- String alTitle; // name which will be used to form new alignment window.
- Alignment dataset; // dataset to which the new alignment will be
-
- // associated.
-
- ext.vamsas.MuscleWS server = null;
- /**
- * set basic options for this (group) of Msa jobs
- *
- * @param subgaps
- * boolean
- * @param presorder
- * boolean
- */
- MsaWSThread(ext.vamsas.MuscleWS server, String wsUrl,
- WebserviceInfo wsinfo, jalview.gui.AlignFrame alFrame,
- AlignmentView alview,
- String wsname, boolean subgaps, boolean presorder)
- {
- super(alFrame, wsinfo, alview, wsname, wsUrl);
- this.server = server;
- this.submitGaps = subgaps;
- this.preserveOrder = presorder;
- }
-
- /**
- * create one or more Msa jobs to align visible seuqences in _msa
- *
- * @param title
- * String
- * @param _msa
- * AlignmentView
- * @param subgaps
- * boolean
- * @param presorder
- * boolean
- * @param seqset
- * Alignment
- */
- MsaWSThread(ext.vamsas.MuscleWS server, String wsUrl,
- WebserviceInfo wsinfo, jalview.gui.AlignFrame alFrame,
- String wsname, String title, AlignmentView _msa, boolean subgaps,
- boolean presorder, Alignment seqset)
- {
- this(server, wsUrl, wsinfo, alFrame, _msa, wsname, subgaps, presorder);
- OutputHeader = wsInfo.getProgressText();
- alTitle = title;
- dataset = seqset;
-
- SequenceI[][] conmsa = _msa.getVisibleContigs('-');
- if (conmsa != null)
- {
- int njobs = conmsa.length;
- jobs = new MsaWSJob[njobs];
- for (int j = 0; j < njobs; j++)
- {
- if (j != 0)
- {
- jobs[j] = new MsaWSJob(wsinfo.addJobPane(), conmsa[j]);
- }
- else
- {
- jobs[j] = new MsaWSJob(0, conmsa[j]);
- }
- if (njobs > 0)
- {
- wsinfo.setProgressName("region " + jobs[j].jobnum, jobs[j].jobnum);
- }
- wsinfo.setProgressText(jobs[j].jobnum, OutputHeader);
- }
- }
- }
-
- public boolean isCancellable()
- {
- return true;
- }
-
- public void cancelJob()
- {
- if (!jobComplete && jobs != null)
- {
- boolean cancelled = true;
- for (int job = 0; job < jobs.length; job++)
- {
- if (jobs[job].submitted && !jobs[job].subjobComplete)
- {
- String cancelledMessage = "";
- try
- {
- vamsas.objects.simple.WsJobId cancelledJob = server
- .cancel(jobs[job].jobId);
- if (cancelledJob.getStatus() == 2)
- {
- // CANCELLED_JOB
- cancelledMessage = "Job cancelled.";
- ( (MsaWSJob) jobs[job]).cancel();
- wsInfo.setStatus(jobs[job].jobnum,
- WebserviceInfo.STATE_CANCELLED_OK);
- }
- else if (cancelledJob.getStatus() == 3)
- {
- // VALID UNSTOPPABLE JOB
- cancelledMessage +=
- "Server cannot cancel this job. just close the window.\n";
- cancelled = false;
- // wsInfo.setStatus(jobs[job].jobnum,
- // WebserviceInfo.STATE_RUNNING);
- }
-
- if (cancelledJob.getJobId() != null)
- {
- cancelledMessage += ("[" + cancelledJob.getJobId() + "]");
- }
-
- cancelledMessage += "\n";
- }
- catch (Exception exc)
- {
- cancelledMessage +=
- ("\nProblems cancelling the job : Exception received...\n"
- + exc + "\n");
- Cache.log.warn("Exception whilst cancelling " + jobs[job].jobId,
- exc);
- }
- wsInfo.setProgressText(jobs[job].jobnum, OutputHeader
- + cancelledMessage + "\n");
- }
- }
- if (cancelled)
- {
- wsInfo.setStatus(WebserviceInfo.STATE_CANCELLED_OK);
- jobComplete = true;
- }
- this.interrupt(); // kick thread to update job states.
- }
- else
- {
- if (!jobComplete)
- {
- wsInfo
- .setProgressText(OutputHeader
- + "Server cannot cancel this job because it has not been submitted properly. just close the window.\n");
- }
- }
- }
-
- void pollJob(WSJob job)
- throws Exception
- {
- ( (MsaWSJob) job).result = server.getResult( ( (MsaWSJob) job).jobId);
- }
-
- void StartJob(WSJob job)
- {
- if (! (job instanceof MsaWSJob))
- {
- throw new Error("StartJob(MsaWSJob) called on a WSJobInstance " +
- job.getClass());
- }
- MsaWSJob j = (MsaWSJob) job;
- if (j.submitted)
- {
- if (Cache.log.isDebugEnabled())
- {
- Cache.log.debug("Tried to submit an already submitted job " + j.jobId);
- }
- return;
- }
- if (j.seqs.getSeqs() == null)
- {
- // special case - selection consisted entirely of empty sequences...
- j.submitted = true;
- j.result = new MsaResult();
- j.result.setFinished(true);
- j.result.setStatus("Empty Alignment Job");
- ( (MsaResult) j.result).setMsa(null);
- }
- try
- {
- vamsas.objects.simple.WsJobId jobsubmit = server.align(j.seqs);
-
- if ( (jobsubmit != null) && (jobsubmit.getStatus() == 1))
- {
- j.jobId = jobsubmit.getJobId();
- j.submitted = true;
- j.subjobComplete = false;
- // System.out.println(WsURL + " Job Id '" + jobId + "'");
- }
- else
- {
- if (jobsubmit == null)
- {
- throw new Exception(
- "Server at "
- + WsUrl
- +
- " returned null object, it probably cannot be contacted. Try again later ?");
- }
-
- throw new Exception(jobsubmit.getJobId());
- }
- }
- catch (Exception e)
- {
- // TODO: JBPNote catch timeout or other fault types explicitly
- // For unexpected errors
- System.err
- .println(WebServiceName
- + "Client: Failed to submit the sequences for alignment (probably a server side problem)\n"
- + "When contacting Server:" + WsUrl + "\n"
- + e.toString() + "\n");
- j.allowedServerExceptions = 0;
- wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_SERVERERROR);
- wsInfo.setStatus(j.jobnum, WebserviceInfo.STATE_STOPPED_SERVERERROR);
- wsInfo
- .appendProgressText(
- j.jobnum,
- "Failed to submit sequences for alignment.\n"
- + "It is most likely that there is a problem with the server.\n"
- + "Just close the window\n");
-
- // e.printStackTrace(); // TODO: JBPNote DEBUG
- }
- }
-
- private jalview.datamodel.Sequence[] getVamsasAlignment(
- vamsas.objects.simple.Alignment valign)
- {
- // TODO: refactor to helper class for vamsas.objects.simple objects
- vamsas.objects.simple.Sequence[] seqs = valign.getSeqs().getSeqs();
- jalview.datamodel.Sequence[] msa = new jalview.datamodel.Sequence[seqs.
- length];
-
- for (int i = 0, j = seqs.length; i < j; i++)
- {
- msa[i] = new jalview.datamodel.Sequence(seqs[i].getId(), seqs[i]
- .getSeq());
- }
-
- return msa;
- }
-
- void parseResult()
- {
- int results = 0; // number of result sets received
- JobStateSummary finalState = new JobStateSummary();
- try
- {
- for (int j = 0; j < jobs.length; j++)
- {
- finalState.updateJobPanelState(wsInfo, OutputHeader, jobs[j]);
- if (jobs[j].submitted && jobs[j].subjobComplete && jobs[j].hasResults())
- {
- results++;
- vamsas.objects.simple.Alignment valign = ( (MsaResult) jobs[j].result).
- getMsa();
- if (valign != null)
- {
- wsInfo.appendProgressText(jobs[j].jobnum,
- "\nAlignment Object Method Notes\n");
- String[] lines = valign.getMethod();
- for (int line = 0; line < lines.length; line++)
- {
- wsInfo.appendProgressText(jobs[j].jobnum, lines[line] + "\n");
- }
- // JBPNote The returned files from a webservice could be
- // hidden behind icons in the monitor window that,
- // when clicked, pop up their corresponding data
- }
- }
- }
- }
- catch (Exception ex)
- {
-
- Cache.log.error("Unexpected exception when processing results for " +
- alTitle, ex);
- wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR);
- }
- if (results > 0)
- {
- wsInfo.showResultsNewFrame
- .addActionListener(new java.awt.event.ActionListener()
- {
- public void actionPerformed(
- java.awt.event.ActionEvent evt)
- {
- displayResults(true);
- }
- });
- wsInfo.mergeResults
- .addActionListener(new java.awt.event.ActionListener()
- {
- public void actionPerformed(
- java.awt.event.ActionEvent evt)
- {
- displayResults(false);
- }
- });
- wsInfo.setResultsReady();
- }
- else
- {
- wsInfo.setFinishedNoResults();
- }
- }
-
- void displayResults(boolean newFrame)
- {
- // view input or result data for each block
- Vector alorders = new Vector();
- SequenceI[][] results = new SequenceI[jobs.length][];
- AlignmentOrder[] orders = new AlignmentOrder[jobs.length];
- for (int j = 0; j < jobs.length; j++)
- {
- if (jobs[j].hasResults())
- {
- Object[] res = ( (MsaWSJob) jobs[j]).getAlignment();
- alorders.add(res[1]);
- results[j] = (SequenceI[]) res[0];
- orders[j] = (AlignmentOrder) res[1];
-
-// SequenceI[] alignment = input.getUpdated
- }
- else
- {
- results[j] = null;
- }
- }
- Object[] newview = input.getUpdatedView(results, orders, getGapChar());
- // trash references to original result data
- for (int j = 0; j < jobs.length; j++)
- {
- results[j] = null;
- orders[j] = null;
- }
- SequenceI[] alignment = (SequenceI[]) newview[0];
- ColumnSelection columnselection = (ColumnSelection) newview[1];
- Alignment al = new Alignment(alignment);
- // TODO: add 'provenance' property to alignment from the method notes accompanying each subjob
- if (dataset != null)
- {
- al.setDataset(dataset);
- }
-
- propagateDatasetMappings(al);
- // JBNote- TODO: warn user if a block is input rather than aligned data ?
-
- if (newFrame)
- {
- AlignFrame af = new AlignFrame(al, columnselection,
- AlignFrame.DEFAULT_WIDTH,
- AlignFrame.DEFAULT_HEIGHT);
-
- // initialise with same renderer settings as in parent alignframe.
- af.getFeatureRenderer().transferSettings(
- this.featureSettings);
- // update orders
- if (alorders.size() > 0)
- {
- if (alorders.size() == 1)
- {
- af.addSortByOrderMenuItem(WebServiceName + " Ordering",
- (AlignmentOrder) alorders.get(0));
- }
- else
- {
- // construct a non-redundant ordering set
- Vector names = new Vector();
- for (int i = 0, l = alorders.size(); i < l; i++)
- {
- String orderName = new String(" Region " + i);
- int j = i + 1;
-
- while (j < l)
- {
- if ( ( (AlignmentOrder) alorders.get(i)).equals( ( (
- AlignmentOrder) alorders.get(j))))
- {
- alorders.remove(j);
- l--;
- orderName += "," + j;
- }
- else
- {
- j++;
- }
- }
-
- if (i == 0 && j == 1)
- {
- names.add(new String(""));
- }
- else
- {
- names.add(orderName);
- }
- }
- for (int i = 0, l = alorders.size(); i < l; i++)
- {
- af.addSortByOrderMenuItem(WebServiceName
- + ( (String) names.get(i)) +
- " Ordering",
- (AlignmentOrder) alorders.get(i));
- }
- }
- }
-
- Desktop.addInternalFrame(af, alTitle,
- AlignFrame.DEFAULT_WIDTH,
- AlignFrame.DEFAULT_HEIGHT);
-
- }
- else
- {
- System.out.println("MERGE WITH OLD FRAME");
- // TODO: modify alignment in original frame, replacing old for new alignment using the commands.EditCommand model to ensure the update can be undone
- }
- }
-
- public boolean canMergeResults()
- {
- return false;
- }
-}
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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 java.util.*;\r
+\r
+import jalview.analysis.*;\r
+import jalview.bin.*;\r
+import jalview.datamodel.*;\r
+import jalview.datamodel.Alignment;\r
+import jalview.gui.*;\r
+import vamsas.objects.simple.MsaResult;\r
+\r
+/**\r
+ * <p>\r
+ * Title:\r
+ * </p>\r
+ *\r
+ * <p>\r
+ * Description:\r
+ * </p>\r
+ *\r
+ * <p>\r
+ * Copyright: Copyright (c) 2004\r
+ * </p>\r
+ *\r
+ * <p>\r
+ * Company: Dundee University\r
+ * </p>\r
+ *\r
+ * @author not attributable\r
+ * @version 1.0\r
+ */\r
+class MsaWSThread\r
+ extends WSThread implements WSClientI\r
+{\r
+ boolean submitGaps = false; // pass sequences including gaps to alignment\r
+\r
+ // service\r
+\r
+ boolean preserveOrder = true; // and always store and recover sequence\r
+\r
+ // order\r
+\r
+ class MsaWSJob\r
+ extends WSThread.WSJob\r
+ {\r
+ // hold special input for this\r
+ vamsas.objects.simple.SequenceSet seqs = new vamsas.objects.simple.\r
+ SequenceSet();\r
+\r
+ /**\r
+ * MsaWSJob\r
+ *\r
+ * @param jobNum\r
+ * int\r
+ * @param jobId\r
+ * String\r
+ */\r
+ public MsaWSJob(int jobNum, SequenceI[] inSeqs)\r
+ {\r
+ this.jobnum = jobNum;\r
+ if (!prepareInput(inSeqs, 2))\r
+ {\r
+ submitted = true;\r
+ subjobComplete = true;\r
+ result = new MsaResult();\r
+ result.setFinished(true);\r
+ result.setStatus("Job never ran - input returned to user.");\r
+ }\r
+\r
+ }\r
+\r
+ Hashtable SeqNames = new Hashtable();\r
+ Vector emptySeqs = new Vector();\r
+ /**\r
+ * prepare input sequences for MsaWS service\r
+ * @param seqs jalview sequences to be prepared\r
+ * @param minlen minimum number of residues required for this MsaWS service\r
+ * @return true if seqs contains sequences to be submitted to service.\r
+ */\r
+ private boolean prepareInput(SequenceI[] seqs, int minlen)\r
+ {\r
+ int nseqs = 0;\r
+ if (minlen < 0)\r
+ {\r
+ throw new Error("Implementation error: minlen must be zero or more.");\r
+ }\r
+ for (int i = 0; i < seqs.length; i++)\r
+ {\r
+ if (seqs[i].getEnd() - seqs[i].getStart() > minlen - 1)\r
+ {\r
+ nseqs++;\r
+ }\r
+ }\r
+ boolean valid = nseqs > 1; // need at least two seqs\r
+ vamsas.objects.simple.Sequence[] seqarray =\r
+ (valid)\r
+ ? new vamsas.objects.simple.Sequence[nseqs]\r
+ : null;\r
+ for (int i = 0, n = 0; i < seqs.length; i++)\r
+ {\r
+\r
+ String newname = jalview.analysis.SeqsetUtils.unique_name(i); // same\r
+ // for\r
+ // any\r
+ // subjob\r
+ SeqNames.put(newname, jalview.analysis.SeqsetUtils\r
+ .SeqCharacterHash(seqs[i]));\r
+ if (valid && seqs[i].getEnd() - seqs[i].getStart() > minlen - 1)\r
+ {\r
+ seqarray[n] = new vamsas.objects.simple.Sequence();\r
+ seqarray[n].setId(newname);\r
+ seqarray[n++].setSeq( (submitGaps) ? seqs[i].getSequenceAsString()\r
+ : AlignSeq.extractGaps(\r
+ jalview.util.Comparison.GapChars, seqs[i]\r
+ .getSequenceAsString()));\r
+ }\r
+ else\r
+ {\r
+ String empty = null;\r
+ if (seqs[i].getEnd() >= seqs[i].getStart())\r
+ {\r
+ empty = (submitGaps) ? seqs[i].getSequenceAsString()\r
+ : AlignSeq.extractGaps(\r
+ jalview.util.Comparison.GapChars, seqs[i]\r
+ .getSequenceAsString());\r
+ }\r
+ emptySeqs.add(new String[]\r
+ {newname, empty});\r
+ }\r
+ }\r
+ this.seqs = new vamsas.objects.simple.SequenceSet();\r
+ this.seqs.setSeqs(seqarray);\r
+ return valid;\r
+ }\r
+\r
+ /**\r
+ *\r
+ * @return true if getAlignment will return a valid alignment result.\r
+ */\r
+ public boolean hasResults()\r
+ {\r
+ if (subjobComplete && result != null && result.isFinished()\r
+ && ( (MsaResult) result).getMsa() != null &&\r
+ ( (MsaResult) result).getMsa().getSeqs() != null)\r
+ {\r
+ return true;\r
+ }\r
+ return false;\r
+ }\r
+\r
+ public Object[] getAlignment()\r
+ {\r
+\r
+ if (result != null && result.isFinished())\r
+ {\r
+ SequenceI[] alseqs = null;\r
+ char alseq_gapchar = '-';\r
+ int alseq_l = 0;\r
+ if ( ( (MsaResult) result).getMsa() != null)\r
+ {\r
+ alseqs = getVamsasAlignment( ( (MsaResult) result).getMsa());\r
+ alseq_gapchar = ( (MsaResult) result).getMsa().getGapchar().charAt(0);\r
+ alseq_l = alseqs.length;\r
+ }\r
+ if (emptySeqs.size() > 0)\r
+ {\r
+ SequenceI[] t_alseqs = new SequenceI[alseq_l + emptySeqs.size()];\r
+ // get width\r
+ int i, w = 0;\r
+ if (alseq_l > 0)\r
+ {\r
+ for (i = 0, w = alseqs[0].getLength(); i < alseq_l; i++)\r
+ {\r
+ if (w < alseqs[i].getLength())\r
+ {\r
+ w = alseqs[i].getLength();\r
+ }\r
+ t_alseqs[i] = alseqs[i];\r
+ alseqs[i] = null;\r
+ }\r
+ }\r
+ // check that aligned width is at least as wide as emptySeqs width.\r
+ int ow = w, nw = w;\r
+ for (i = 0, w = emptySeqs.size(); i < w; i++)\r
+ {\r
+ String[] es = (String[]) emptySeqs.get(i);\r
+ if (es != null && es[1] != null)\r
+ {\r
+ int sw = es[1].length();\r
+ if (nw < sw)\r
+ {\r
+ nw = sw;\r
+ }\r
+ }\r
+ }\r
+ // make a gapped string.\r
+ StringBuffer insbuff = new StringBuffer(w);\r
+ for (i = 0; i < nw; i++)\r
+ {\r
+ insbuff.append(alseq_gapchar);\r
+ }\r
+ if (ow < nw)\r
+ {\r
+ for (i = 0; i < alseq_l; i++)\r
+ {\r
+ int sw = t_alseqs[i].getLength();\r
+ if (nw > sw)\r
+ {\r
+ // pad at end\r
+ alseqs[i].setSequence(t_alseqs[i].getSequenceAsString() +\r
+ insbuff.substring(0, sw - nw));\r
+ }\r
+ }\r
+ }\r
+ for (i = 0, w = emptySeqs.size(); i < w; i++)\r
+ {\r
+ String[] es = (String[]) emptySeqs.get(i);\r
+ if (es[1] == null)\r
+ {\r
+ t_alseqs[i +\r
+ alseq_l] = new jalview.datamodel.Sequence(es[0],\r
+ insbuff.toString(), 1, 0);\r
+ }\r
+ else\r
+ {\r
+ if (es[1].length() < nw)\r
+ {\r
+ t_alseqs[i +\r
+ alseq_l] = new jalview.datamodel.Sequence(es[0],\r
+ es[1] + insbuff.substring(0, nw - es[1].length()), 1,\r
+ 1 + es[1].length());\r
+ }\r
+ else\r
+ {\r
+ t_alseqs[i +\r
+ alseq_l] = new jalview.datamodel.Sequence(es[0], es[1]);\r
+ }\r
+ }\r
+ }\r
+ alseqs = t_alseqs;\r
+ }\r
+ AlignmentOrder msaorder = new AlignmentOrder(alseqs);\r
+ // always recover the order - makes parseResult()'s life easier.\r
+ jalview.analysis.AlignmentSorter.recoverOrder(alseqs);\r
+ // account for any missing sequences\r
+ jalview.analysis.SeqsetUtils.deuniquify(SeqNames, alseqs);\r
+ return new Object[]\r
+ {\r
+ alseqs, msaorder};\r
+ }\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * mark subjob as cancelled and set result object appropriatly\r
+ */\r
+ void cancel()\r
+ {\r
+ cancelled = true;\r
+ subjobComplete = true;\r
+ result = null;\r
+ }\r
+\r
+ /**\r
+ *\r
+ * @return boolean true if job can be submitted.\r
+ */\r
+ boolean hasValidInput()\r
+ {\r
+ if (seqs.getSeqs() != null)\r
+ {\r
+ return true;\r
+ }\r
+ return false;\r
+ }\r
+ }\r
+\r
+ String alTitle; // name which will be used to form new alignment window.\r
+ Alignment dataset; // dataset to which the new alignment will be\r
+\r
+ // associated.\r
+\r
+ ext.vamsas.MuscleWS server = null;\r
+ /**\r
+ * set basic options for this (group) of Msa jobs\r
+ *\r
+ * @param subgaps\r
+ * boolean\r
+ * @param presorder\r
+ * boolean\r
+ */\r
+ MsaWSThread(ext.vamsas.MuscleWS server, String wsUrl,\r
+ WebserviceInfo wsinfo, jalview.gui.AlignFrame alFrame,\r
+ AlignmentView alview,\r
+ String wsname, boolean subgaps, boolean presorder)\r
+ {\r
+ super(alFrame, wsinfo, alview, wsname, wsUrl);\r
+ this.server = server;\r
+ this.submitGaps = subgaps;\r
+ this.preserveOrder = presorder;\r
+ }\r
+\r
+ /**\r
+ * create one or more Msa jobs to align visible seuqences in _msa\r
+ *\r
+ * @param title\r
+ * String\r
+ * @param _msa\r
+ * AlignmentView\r
+ * @param subgaps\r
+ * boolean\r
+ * @param presorder\r
+ * boolean\r
+ * @param seqset\r
+ * Alignment\r
+ */\r
+ MsaWSThread(ext.vamsas.MuscleWS server, String wsUrl,\r
+ WebserviceInfo wsinfo, jalview.gui.AlignFrame alFrame,\r
+ String wsname, String title, AlignmentView _msa, boolean subgaps,\r
+ boolean presorder, Alignment seqset)\r
+ {\r
+ this(server, wsUrl, wsinfo, alFrame, _msa, wsname, subgaps, presorder);\r
+ OutputHeader = wsInfo.getProgressText();\r
+ alTitle = title;\r
+ dataset = seqset;\r
+\r
+ SequenceI[][] conmsa = _msa.getVisibleContigs('-');\r
+ if (conmsa != null)\r
+ {\r
+ int njobs = conmsa.length;\r
+ jobs = new MsaWSJob[njobs];\r
+ for (int j = 0; j < njobs; j++)\r
+ {\r
+ if (j != 0)\r
+ {\r
+ jobs[j] = new MsaWSJob(wsinfo.addJobPane(), conmsa[j]);\r
+ }\r
+ else\r
+ {\r
+ jobs[j] = new MsaWSJob(0, conmsa[j]);\r
+ }\r
+ if (njobs > 0)\r
+ {\r
+ wsinfo.setProgressName("region " + jobs[j].jobnum, jobs[j].jobnum);\r
+ }\r
+ wsinfo.setProgressText(jobs[j].jobnum, OutputHeader);\r
+ }\r
+ }\r
+ }\r
+\r
+ public boolean isCancellable()\r
+ {\r
+ return true;\r
+ }\r
+\r
+ public void cancelJob()\r
+ {\r
+ if (!jobComplete && jobs != null)\r
+ {\r
+ boolean cancelled = true;\r
+ for (int job = 0; job < jobs.length; job++)\r
+ {\r
+ if (jobs[job].submitted && !jobs[job].subjobComplete)\r
+ {\r
+ String cancelledMessage = "";\r
+ try\r
+ {\r
+ vamsas.objects.simple.WsJobId cancelledJob = server\r
+ .cancel(jobs[job].jobId);\r
+ if (cancelledJob.getStatus() == 2)\r
+ {\r
+ // CANCELLED_JOB\r
+ cancelledMessage = "Job cancelled.";\r
+ ( (MsaWSJob) jobs[job]).cancel();\r
+ wsInfo.setStatus(jobs[job].jobnum,\r
+ WebserviceInfo.STATE_CANCELLED_OK);\r
+ }\r
+ else if (cancelledJob.getStatus() == 3)\r
+ {\r
+ // VALID UNSTOPPABLE JOB\r
+ cancelledMessage +=\r
+ "Server cannot cancel this job. just close the window.\n";\r
+ cancelled = false;\r
+ // wsInfo.setStatus(jobs[job].jobnum,\r
+ // WebserviceInfo.STATE_RUNNING);\r
+ }\r
+\r
+ if (cancelledJob.getJobId() != null)\r
+ {\r
+ cancelledMessage += ("[" + cancelledJob.getJobId() + "]");\r
+ }\r
+\r
+ cancelledMessage += "\n";\r
+ }\r
+ catch (Exception exc)\r
+ {\r
+ cancelledMessage +=\r
+ ("\nProblems cancelling the job : Exception received...\n"\r
+ + exc + "\n");\r
+ Cache.log.warn("Exception whilst cancelling " + jobs[job].jobId,\r
+ exc);\r
+ }\r
+ wsInfo.setProgressText(jobs[job].jobnum, OutputHeader\r
+ + cancelledMessage + "\n");\r
+ }\r
+ }\r
+ if (cancelled)\r
+ {\r
+ wsInfo.setStatus(WebserviceInfo.STATE_CANCELLED_OK);\r
+ jobComplete = true;\r
+ }\r
+ this.interrupt(); // kick thread to update job states.\r
+ }\r
+ else\r
+ {\r
+ if (!jobComplete)\r
+ {\r
+ wsInfo\r
+ .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
+ void pollJob(WSJob job)\r
+ throws Exception\r
+ {\r
+ ( (MsaWSJob) job).result = server.getResult( ( (MsaWSJob) job).jobId);\r
+ }\r
+\r
+ void StartJob(WSJob job)\r
+ {\r
+ if (! (job instanceof MsaWSJob))\r
+ {\r
+ throw new Error("StartJob(MsaWSJob) called on a WSJobInstance " +\r
+ job.getClass());\r
+ }\r
+ MsaWSJob j = (MsaWSJob) job;\r
+ if (j.submitted)\r
+ {\r
+ if (Cache.log.isDebugEnabled())\r
+ {\r
+ Cache.log.debug("Tried to submit an already submitted job " + j.jobId);\r
+ }\r
+ return;\r
+ }\r
+ if (j.seqs.getSeqs() == null)\r
+ {\r
+ // special case - selection consisted entirely of empty sequences...\r
+ j.submitted = true;\r
+ j.result = new MsaResult();\r
+ j.result.setFinished(true);\r
+ j.result.setStatus("Empty Alignment Job");\r
+ ( (MsaResult) j.result).setMsa(null);\r
+ }\r
+ try\r
+ {\r
+ vamsas.objects.simple.WsJobId jobsubmit = server.align(j.seqs);\r
+\r
+ if ( (jobsubmit != null) && (jobsubmit.getStatus() == 1))\r
+ {\r
+ j.jobId = jobsubmit.getJobId();\r
+ j.submitted = true;\r
+ j.subjobComplete = false;\r
+ // System.out.println(WsURL + " Job Id '" + jobId + "'");\r
+ }\r
+ else\r
+ {\r
+ if (jobsubmit == null)\r
+ {\r
+ throw new Exception(\r
+ "Server at "\r
+ + WsUrl\r
+ +\r
+ " returned null object, it probably cannot be contacted. Try again later ?");\r
+ }\r
+\r
+ throw new Exception(jobsubmit.getJobId());\r
+ }\r
+ }\r
+ catch (Exception e)\r
+ {\r
+ // TODO: JBPNote catch timeout or other fault types explicitly\r
+ // For unexpected errors\r
+ System.err\r
+ .println(WebServiceName\r
+ + "Client: Failed to submit the sequences for alignment (probably a server side problem)\n"\r
+ + "When contacting Server:" + WsUrl + "\n"\r
+ + e.toString() + "\n");\r
+ j.allowedServerExceptions = 0;\r
+ wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_SERVERERROR);\r
+ wsInfo.setStatus(j.jobnum, WebserviceInfo.STATE_STOPPED_SERVERERROR);\r
+ wsInfo\r
+ .appendProgressText(\r
+ j.jobnum,\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
+\r
+ private jalview.datamodel.Sequence[] getVamsasAlignment(\r
+ vamsas.objects.simple.Alignment valign)\r
+ {\r
+ // TODO: refactor to helper class for vamsas.objects.simple objects\r
+ vamsas.objects.simple.Sequence[] seqs = valign.getSeqs().getSeqs();\r
+ jalview.datamodel.Sequence[] msa = new jalview.datamodel.Sequence[seqs.\r
+ length];\r
+\r
+ for (int i = 0, j = seqs.length; i < j; i++)\r
+ {\r
+ msa[i] = new jalview.datamodel.Sequence(seqs[i].getId(), seqs[i]\r
+ .getSeq());\r
+ }\r
+\r
+ return msa;\r
+ }\r
+\r
+ void parseResult()\r
+ {\r
+ int results = 0; // number of result sets received\r
+ JobStateSummary finalState = new JobStateSummary();\r
+ try\r
+ {\r
+ for (int j = 0; j < jobs.length; j++)\r
+ {\r
+ finalState.updateJobPanelState(wsInfo, OutputHeader, jobs[j]);\r
+ if (jobs[j].submitted && jobs[j].subjobComplete && jobs[j].hasResults())\r
+ {\r
+ results++;\r
+ vamsas.objects.simple.Alignment valign = ( (MsaResult) jobs[j].result).\r
+ getMsa();\r
+ if (valign != null)\r
+ {\r
+ wsInfo.appendProgressText(jobs[j].jobnum,\r
+ "\nAlignment Object Method Notes\n");\r
+ String[] lines = valign.getMethod();\r
+ for (int line = 0; line < lines.length; line++)\r
+ {\r
+ wsInfo.appendProgressText(jobs[j].jobnum, lines[line] + "\n");\r
+ }\r
+ // JBPNote The returned files from a webservice could be\r
+ // hidden behind icons in the monitor window that,\r
+ // when clicked, pop up their corresponding data\r
+ }\r
+ }\r
+ }\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+\r
+ Cache.log.error("Unexpected exception when processing results for " +\r
+ alTitle, ex);\r
+ wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR);\r
+ }\r
+ if (results > 0)\r
+ {\r
+ wsInfo.showResultsNewFrame\r
+ .addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(\r
+ java.awt.event.ActionEvent evt)\r
+ {\r
+ displayResults(true);\r
+ }\r
+ });\r
+ wsInfo.mergeResults\r
+ .addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(\r
+ java.awt.event.ActionEvent evt)\r
+ {\r
+ displayResults(false);\r
+ }\r
+ });\r
+ wsInfo.setResultsReady();\r
+ }\r
+ else\r
+ {\r
+ wsInfo.setFinishedNoResults();\r
+ }\r
+ }\r
+\r
+ void displayResults(boolean newFrame)\r
+ {\r
+ // view input or result data for each block\r
+ Vector alorders = new Vector();\r
+ SequenceI[][] results = new SequenceI[jobs.length][];\r
+ AlignmentOrder[] orders = new AlignmentOrder[jobs.length];\r
+ for (int j = 0; j < jobs.length; j++)\r
+ {\r
+ if (jobs[j].hasResults())\r
+ {\r
+ Object[] res = ( (MsaWSJob) jobs[j]).getAlignment();\r
+ alorders.add(res[1]);\r
+ results[j] = (SequenceI[]) res[0];\r
+ orders[j] = (AlignmentOrder) res[1];\r
+ \r
+// SequenceI[] alignment = input.getUpdated\r
+ }\r
+ else\r
+ {\r
+ results[j] = null;\r
+ }\r
+ }\r
+ Object[] newview = input.getUpdatedView(results, orders, getGapChar());\r
+ // trash references to original result data\r
+ for (int j = 0; j < jobs.length; j++)\r
+ {\r
+ results[j] = null;\r
+ orders[j] = null;\r
+ }\r
+ SequenceI[] alignment = (SequenceI[]) newview[0];\r
+ ColumnSelection columnselection = (ColumnSelection) newview[1];\r
+ Alignment al = new Alignment(alignment);\r
+ // TODO: add 'provenance' property to alignment from the method notes accompanying each subjob\r
+ if (dataset != null)\r
+ {\r
+ al.setDataset(dataset);\r
+ }\r
+\r
+ propagateDatasetMappings(al);\r
+ // JBNote- TODO: warn user if a block is input rather than aligned data ?\r
+\r
+ if (newFrame)\r
+ {\r
+ AlignFrame af = new AlignFrame(al, columnselection,\r
+ AlignFrame.DEFAULT_WIDTH,\r
+ AlignFrame.DEFAULT_HEIGHT);\r
+\r
+ // initialise with same renderer settings as in parent alignframe.\r
+ af.getFeatureRenderer().transferSettings(\r
+ this.featureSettings);\r
+ // update orders\r
+ if (alorders.size() > 0)\r
+ {\r
+ if (alorders.size() == 1)\r
+ {\r
+ af.addSortByOrderMenuItem(WebServiceName + " Ordering",\r
+ (AlignmentOrder) alorders.get(0));\r
+ }\r
+ else\r
+ {\r
+ // construct a non-redundant ordering set\r
+ Vector names = new Vector();\r
+ for (int i = 0, l = alorders.size(); i < l; i++)\r
+ {\r
+ String orderName = new String(" Region " + i);\r
+ int j = i + 1;\r
+\r
+ while (j < l)\r
+ {\r
+ if ( ( (AlignmentOrder) alorders.get(i)).equals( ( (\r
+ AlignmentOrder) alorders.get(j))))\r
+ {\r
+ alorders.remove(j);\r
+ l--;\r
+ orderName += "," + j;\r
+ }\r
+ else\r
+ {\r
+ j++;\r
+ }\r
+ }\r
+\r
+ if (i == 0 && j == 1)\r
+ {\r
+ names.add(new String(""));\r
+ }\r
+ else\r
+ {\r
+ names.add(orderName);\r
+ }\r
+ }\r
+ for (int i = 0, l = alorders.size(); i < l; i++)\r
+ {\r
+ af.addSortByOrderMenuItem(WebServiceName\r
+ + ( (String) names.get(i)) +\r
+ " Ordering",\r
+ (AlignmentOrder) alorders.get(i));\r
+ }\r
+ }\r
+ }\r
+\r
+ Desktop.addInternalFrame(af, alTitle,\r
+ AlignFrame.DEFAULT_WIDTH,\r
+ AlignFrame.DEFAULT_HEIGHT);\r
+\r
+ }\r
+ else\r
+ {\r
+ System.out.println("MERGE WITH OLD FRAME");\r
+ // TODO: modify alignment in original frame, replacing old for new alignment using the commands.EditCommand model to ensure the update can be undone\r
+ }\r
+ }\r
+\r
+ public boolean canMergeResults()\r
+ {\r
+ return false;\r
+ }\r
+}\r
-/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 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;
-
-import java.awt.Component;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.StringTokenizer;
-import java.util.Vector;
-
-import javax.swing.*;
-
-import ext.vamsas.*;
-import jalview.datamodel.*;
-import jalview.gui.*;
-
-/**
- * DOCUMENT ME!
- *
- * @author $author$
- * @version $Revision$
- */
-public class SeqSearchWSClient
- extends WSClient
-{
- /**
- * server is a WSDL2Java generated stub for an archetypal MsaWSI service.
- */
- ext.vamsas.SeqSearchI server;
- AlignFrame alignFrame;
-
- /**
- * Creates a new MsaWSClient object that uses a service
- * given by an externally retrieved ServiceHandle
- *
- * @param sh service handle of type AbstractName(MsaWS)
- * @param altitle DOCUMENT ME!
- * @param msa DOCUMENT ME!
- * @param submitGaps DOCUMENT ME!
- * @param preserveOrder DOCUMENT ME!
- */
-
- public SeqSearchWSClient(ext.vamsas.ServiceHandle sh, String altitle,
- jalview.datamodel.AlignmentView msa, String db,
- Alignment seqdataset,
- AlignFrame _alignFrame)
- {
- super();
- alignFrame = _alignFrame;
- // can generalise the two errors below for metadata mapping from interface name to service client name
- if (!sh.getAbstractName().equals(this.getServiceActionKey()))
- {
- JOptionPane.showMessageDialog(Desktop.desktop,
- "The Service called \n" + sh.getName() +
- "\nis not a \nSequence Search Service !",
- "Internal Jalview Error",
- JOptionPane.WARNING_MESSAGE);
-
- return;
- }
-
- if ( (wsInfo = setWebService(sh)) == null)
- {
- JOptionPane.showMessageDialog(Desktop.desktop,
- "The Sequence Search Service named " +
- sh.getName() +
- " is unknown", "Internal Jalview Error",
- JOptionPane.WARNING_MESSAGE);
-
- return;
- }
- startSeqSearchClient(altitle, msa, db, seqdataset);
-
- }
- /**
- * non-process web service interaction - use this for calling HEADLESS synchronous service methods
- * @param sh
- */
- public SeqSearchWSClient(ServiceHandle sh)
- {
- setWebService(sh, true);
- }
-
- public SeqSearchWSClient()
- {
-
- super();
- // add a class reference to the list
- }
- private void startSeqSearchClient(String altitle, AlignmentView msa,
- String db,
- Alignment seqdataset)
- {
- if (!locateWebService())
- {
- return;
- }
- String visdb = (db==null || db == "") ? "default" : db; // need a visible name for a sequence db
- boolean profileSearch = msa.getSequences().length>2 ? true : false;
- // single sequence or profile from alignment view
- wsInfo.setProgressText( "Searching "+visdb+(!profileSearch ? " with sequence "+msa.getSequences()[0].getRefSeq().getName()
- : " with profile") +
- " from " + altitle + "\nJob details\n");
-
- String jobtitle = WebServiceName+((WebServiceName.indexOf("earch")>-1) ? " " : " search ")+" of "+visdb+(!profileSearch ? " with sequence "+msa.getSequences()[0].getRefSeq().getName()
- : " with profile") +
- " from " + altitle;
- SeqSearchWSThread ssthread = new SeqSearchWSThread(server, WsURL, wsInfo, alignFrame,
- WebServiceName,
- jobtitle,
- msa,
- db,
- seqdataset);
- wsInfo.setthisService(ssthread);
- ssthread.start();
- }
-
- /**
- * Initializes the server field with a valid service implementation.
- *
- * @return true if service was located.
- */
- private boolean locateWebService()
- {
- // this can be abstracted using reflection
- // TODO: MuscleWS transmuted to generic MsaWS client
- SeqSearchServiceLocator loc = new SeqSearchServiceLocator(); // Default
-
- try
- {
- this.server = (SeqSearchI) loc.getSeqSearchService(new java.net.URL(WsURL));
- ( (SeqSearchServiceSoapBindingStub)this.server).setTimeout(60000); // One minute timeout
- }
- catch (Exception ex)
- {
- wsInfo.setProgressText("Serious! " + WebServiceName +
- " Service location failed\nfor URL :" + WsURL +
- "\n" +
- ex.getMessage());
- wsInfo.setStatus(WebserviceInfo.ERROR);
- ex.printStackTrace();
-
- return false;
- }
-
- loc.getEngine().setOption("axis", "1");
-
- return true;
- }
-
- protected String getServiceActionKey()
- {
- return "SeqSearch";
- }
-
- protected String getServiceActionDescription()
- {
- return "Sequence Database Search";
- }
- // simple caching of db parameters for each service endpoint
- private static Hashtable dbParamsForEndpoint;
- static {
- dbParamsForEndpoint = new Hashtable();
- }
- public String[] getSupportedDatabases() throws Exception
- {
-
- // check that we haven't already been to this service endpoint
- if (dbParamsForEndpoint.containsKey(WsURL))
- {
- return (String[]) dbParamsForEndpoint.get(WsURL);
- }
- if (!locateWebService())
- {
- throw new Exception("Cannot contact service endpoint at "+WsURL);
- }
- String database = server.getDatabase();
- if (database==null)
- {
- dbParamsForEndpoint.put(WsURL, new String[] {});
- return null;
- }
- StringTokenizer en = new StringTokenizer(database.trim(), ",| ");
- String[] dbs = new String[en.countTokens()];
- for (int i=0; i<dbs.length; i++)
- {
- dbs[i++] = en.nextToken().trim();
- }
- dbParamsForEndpoint.put(WsURL, dbs);
- return dbs;
- }
- public void attachWSMenuEntry(JMenu wsmenu, final ServiceHandle sh,
- final AlignFrame af)
- {
- // look for existing database service submenus on wsmenu
- Hashtable dbsrchs = new Hashtable();
- Vector newdbsrch = new Vector();
- Component entries[] = wsmenu.getComponents();
- for (int i = 0; entries!=null && i<entries.length; i++)
- {
- if (entries[i] instanceof JMenu)
- {
- dbsrchs.put(entries[i].getName(), entries[i]);
- }
- }
- JMenu defmenu=(JMenu) dbsrchs.get("Default Database");
- if (defmenu==null)
- {
- dbsrchs.put("Default Database", defmenu = new JMenu("Default Database"));
- newdbsrch.addElement(defmenu);
- }
-
- String dbs[] = null;
- try {
- dbs = new jalview.ws.SeqSearchWSClient(sh).getSupportedDatabases();
- } catch (Exception e)
- {
- jalview.bin.Cache.log.warn("Database list request failed, so disabling SeqSearch Service client "+sh.getName()+" at "+sh.getEndpointURL(), e);
- return;
- }
- JMenuItem method;
- // do default entry
- defmenu.add(method = new JMenuItem(sh.getName()));
- method.setToolTipText(sh.getEndpointURL());
- method.addActionListener(new ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- // use same input gatherer as for secondary structure prediction
- // we could actually parameterise the gatherer method here...
- AlignmentView msa = af.gatherSeqOrMsaForSecStrPrediction();
- new jalview.ws.SeqSearchWSClient(sh, af.getTitle(), msa, null,
- af.getViewport().getAlignment().getDataset(),
- af);
- }
- }
- );
- // add entry for each database the service supports
- for (int db=0; dbs!=null && db<dbs.length; db++)
- {
- JMenu dbmenu = (JMenu) dbsrchs.get(dbs[db]);
- if (dbmenu==null)
- {
- dbsrchs.put(dbs[db], dbmenu = new JMenu(dbs[db]));
- newdbsrch.addElement(dbmenu);
- }
- // add the client handler code for this service
- dbmenu.add(method = new JMenuItem(sh.getName()));
- method.setToolTipText(sh.getEndpointURL());
- final String searchdb = dbs[db];
- method.addActionListener(new ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- AlignmentView msa = af.gatherSeqOrMsaForSecStrPrediction();
- new jalview.ws.SeqSearchWSClient(sh, af.getTitle(), msa, searchdb,
- af.getViewport().getAlignment().getDataset(),
- af);
- }
- });
- }
- // add the databases onto the seqsearch menu
- Enumeration e = newdbsrch.elements();
- while (e.hasMoreElements())
- {
- Object el = e.nextElement();
- if (el instanceof JMenu)
- {
- wsmenu.add((JMenu) el);
- } else {
- wsmenu.add((JMenuItem) el);
- }
- }
-
- }
-}
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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 java.awt.Component;\r
+import java.awt.event.ActionEvent;\r
+import java.awt.event.ActionListener;\r
+import java.util.Enumeration;\r
+import java.util.Hashtable;\r
+import java.util.StringTokenizer;\r
+import java.util.Vector;\r
+\r
+import javax.swing.*;\r
+\r
+import ext.vamsas.*;\r
+import jalview.datamodel.*;\r
+import jalview.gui.*;\r
+\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class SeqSearchWSClient\r
+ extends WSClient\r
+{\r
+ /**\r
+ * server is a WSDL2Java generated stub for an archetypal MsaWSI service.\r
+ */\r
+ ext.vamsas.SeqSearchI server;\r
+ AlignFrame alignFrame;\r
+\r
+ /**\r
+ * Creates a new MsaWSClient object that uses a service\r
+ * given by an externally retrieved ServiceHandle\r
+ *\r
+ * @param sh service handle of type AbstractName(MsaWS)\r
+ * @param altitle DOCUMENT ME!\r
+ * @param msa DOCUMENT ME!\r
+ * @param submitGaps DOCUMENT ME!\r
+ * @param preserveOrder DOCUMENT ME!\r
+ */\r
+\r
+ public SeqSearchWSClient(ext.vamsas.ServiceHandle sh, String altitle,\r
+ jalview.datamodel.AlignmentView msa, String db,\r
+ Alignment seqdataset,\r
+ AlignFrame _alignFrame)\r
+ {\r
+ super();\r
+ alignFrame = _alignFrame;\r
+ // can generalise the two errors below for metadata mapping from interface name to service client name\r
+ if (!sh.getAbstractName().equals(this.getServiceActionKey()))\r
+ {\r
+ JOptionPane.showMessageDialog(Desktop.desktop,\r
+ "The Service called \n" + sh.getName() +\r
+ "\nis not a \nSequence Search Service !",\r
+ "Internal Jalview Error",\r
+ JOptionPane.WARNING_MESSAGE);\r
+\r
+ return;\r
+ }\r
+\r
+ if ( (wsInfo = setWebService(sh)) == null)\r
+ {\r
+ JOptionPane.showMessageDialog(Desktop.desktop,\r
+ "The Sequence Search Service named " +\r
+ sh.getName() +\r
+ " is unknown", "Internal Jalview Error",\r
+ JOptionPane.WARNING_MESSAGE);\r
+\r
+ return;\r
+ }\r
+ startSeqSearchClient(altitle, msa, db, seqdataset);\r
+\r
+ }\r
+ /**\r
+ * non-process web service interaction - use this for calling HEADLESS synchronous service methods\r
+ * @param sh\r
+ */\r
+ public SeqSearchWSClient(ServiceHandle sh)\r
+ {\r
+ setWebService(sh, true);\r
+ }\r
+\r
+ public SeqSearchWSClient()\r
+ {\r
+\r
+ super();\r
+ // add a class reference to the list\r
+ }\r
+ private void startSeqSearchClient(String altitle, AlignmentView msa,\r
+ String db,\r
+ Alignment seqdataset)\r
+ {\r
+ if (!locateWebService())\r
+ {\r
+ return;\r
+ }\r
+ String visdb = (db==null || db == "") ? "default" : db; // need a visible name for a sequence db\r
+ boolean profileSearch = msa.getSequences().length>2 ? true : false;\r
+ // single sequence or profile from alignment view\r
+ wsInfo.setProgressText( "Searching "+visdb+(!profileSearch ? " with sequence "+msa.getSequences()[0].getRefSeq().getName()\r
+ : " with profile") +\r
+ " from " + altitle + "\nJob details\n");\r
+ \r
+ String jobtitle = WebServiceName+((WebServiceName.indexOf("earch")>-1) ? " " : " search ")+" of "+visdb+(!profileSearch ? " with sequence "+msa.getSequences()[0].getRefSeq().getName()\r
+ : " with profile") +\r
+ " from " + altitle;\r
+ SeqSearchWSThread ssthread = new SeqSearchWSThread(server, WsURL, wsInfo, alignFrame,\r
+ WebServiceName,\r
+ jobtitle,\r
+ msa,\r
+ db,\r
+ seqdataset);\r
+ wsInfo.setthisService(ssthread);\r
+ ssthread.start();\r
+ }\r
+\r
+ /**\r
+ * Initializes the server field with a valid service implementation.\r
+ *\r
+ * @return true if service was located.\r
+ */\r
+ private boolean locateWebService()\r
+ {\r
+ // this can be abstracted using reflection\r
+ // TODO: MuscleWS transmuted to generic MsaWS client\r
+ SeqSearchServiceLocator loc = new SeqSearchServiceLocator(); // Default\r
+\r
+ try\r
+ {\r
+ this.server = (SeqSearchI) loc.getSeqSearchService(new java.net.URL(WsURL));\r
+ ( (SeqSearchServiceSoapBindingStub)this.server).setTimeout(60000); // One minute timeout\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ wsInfo.setProgressText("Serious! " + WebServiceName +\r
+ " Service location failed\nfor URL :" + WsURL +\r
+ "\n" +\r
+ ex.getMessage());\r
+ wsInfo.setStatus(WebserviceInfo.ERROR);\r
+ ex.printStackTrace();\r
+\r
+ return false;\r
+ }\r
+\r
+ loc.getEngine().setOption("axis", "1");\r
+\r
+ return true;\r
+ }\r
+\r
+ protected String getServiceActionKey()\r
+ {\r
+ return "SeqSearch";\r
+ }\r
+\r
+ protected String getServiceActionDescription()\r
+ {\r
+ return "Sequence Database Search";\r
+ }\r
+ // simple caching of db parameters for each service endpoint\r
+ private static Hashtable dbParamsForEndpoint;\r
+ static { \r
+ dbParamsForEndpoint = new Hashtable();\r
+ }\r
+ public String[] getSupportedDatabases() throws Exception\r
+ {\r
+ \r
+ // check that we haven't already been to this service endpoint\r
+ if (dbParamsForEndpoint.containsKey(WsURL))\r
+ {\r
+ return (String[]) dbParamsForEndpoint.get(WsURL);\r
+ }\r
+ if (!locateWebService())\r
+ {\r
+ throw new Exception("Cannot contact service endpoint at "+WsURL); \r
+ }\r
+ String database = server.getDatabase();\r
+ if (database==null)\r
+ {\r
+ dbParamsForEndpoint.put(WsURL, new String[] {});\r
+ return null;\r
+ }\r
+ StringTokenizer en = new StringTokenizer(database.trim(), ",| ");\r
+ String[] dbs = new String[en.countTokens()];\r
+ for (int i=0; i<dbs.length; i++)\r
+ {\r
+ dbs[i++] = en.nextToken().trim();\r
+ }\r
+ dbParamsForEndpoint.put(WsURL, dbs);\r
+ return dbs;\r
+ }\r
+ public void attachWSMenuEntry(JMenu wsmenu, final ServiceHandle sh,\r
+ final AlignFrame af)\r
+ {\r
+ // look for existing database service submenus on wsmenu\r
+ Hashtable dbsrchs = new Hashtable();\r
+ Vector newdbsrch = new Vector();\r
+ Component entries[] = wsmenu.getComponents();\r
+ for (int i = 0; entries!=null && i<entries.length; i++)\r
+ {\r
+ if (entries[i] instanceof JMenu)\r
+ {\r
+ dbsrchs.put(entries[i].getName(), entries[i]);\r
+ }\r
+ }\r
+ JMenu defmenu=(JMenu) dbsrchs.get("Default Database");\r
+ if (defmenu==null)\r
+ {\r
+ dbsrchs.put("Default Database", defmenu = new JMenu("Default Database"));\r
+ newdbsrch.addElement(defmenu);\r
+ }\r
+ \r
+ String dbs[] = null;\r
+ try {\r
+ dbs = new jalview.ws.SeqSearchWSClient(sh).getSupportedDatabases();\r
+ } catch (Exception e)\r
+ {\r
+ jalview.bin.Cache.log.warn("Database list request failed, so disabling SeqSearch Service client "+sh.getName()+" at "+sh.getEndpointURL(), e);\r
+ return;\r
+ }\r
+ JMenuItem method;\r
+ // do default entry\r
+ defmenu.add(method = new JMenuItem(sh.getName()));\r
+ method.setToolTipText(sh.getEndpointURL());\r
+ method.addActionListener(new ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ // use same input gatherer as for secondary structure prediction\r
+ // we could actually parameterise the gatherer method here...\r
+ AlignmentView msa = af.gatherSeqOrMsaForSecStrPrediction();\r
+ new jalview.ws.SeqSearchWSClient(sh, af.getTitle(), msa, null, \r
+ af.getViewport().getAlignment().getDataset(),\r
+ af);\r
+ }\r
+ }\r
+ );\r
+ // add entry for each database the service supports\r
+ for (int db=0; dbs!=null && db<dbs.length; db++)\r
+ {\r
+ JMenu dbmenu = (JMenu) dbsrchs.get(dbs[db]);\r
+ if (dbmenu==null)\r
+ {\r
+ dbsrchs.put(dbs[db], dbmenu = new JMenu(dbs[db]));\r
+ newdbsrch.addElement(dbmenu);\r
+ }\r
+ // add the client handler code for this service\r
+ dbmenu.add(method = new JMenuItem(sh.getName()));\r
+ method.setToolTipText(sh.getEndpointURL());\r
+ final String searchdb = dbs[db];\r
+ method.addActionListener(new ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ AlignmentView msa = af.gatherSeqOrMsaForSecStrPrediction();\r
+ new jalview.ws.SeqSearchWSClient(sh, af.getTitle(), msa, searchdb, \r
+ af.getViewport().getAlignment().getDataset(),\r
+ af);\r
+ }\r
+ });\r
+ }\r
+ // add the databases onto the seqsearch menu\r
+ Enumeration e = newdbsrch.elements();\r
+ while (e.hasMoreElements())\r
+ {\r
+ Object el = e.nextElement();\r
+ if (el instanceof JMenu)\r
+ {\r
+ wsmenu.add((JMenu) el);\r
+ } else {\r
+ wsmenu.add((JMenuItem) el);\r
+ }\r
+ }\r
+ \r
+ }\r
+}\r
-/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 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;
-
-import java.util.*;
-
-import jalview.analysis.*;
-import jalview.bin.*;
-import jalview.datamodel.*;
-import jalview.gui.*;
-import jalview.io.NewickFile;
-import vamsas.objects.simple.MsaResult;
-import vamsas.objects.simple.SeqSearchResult;
-
-/**
- * <p>
- * Title:
- * </p>
- *
- * <p>
- * Description:
- * </p>
- *
- * <p>
- * Copyright: Copyright (c) 2004
- * </p>
- *
- * <p>
- * Company: Dundee University
- * </p>
- *
- * @author not attributable
- * @version 1.0
- */
-class SeqSearchWSThread
- extends WSThread implements WSClientI
-{
- String dbs=null;
- boolean profile=false;
-
- class SeqSearchWSJob
- extends WSThread.WSJob
- {
- // hold special input for this
- vamsas.objects.simple.SequenceSet seqs = new vamsas.objects.simple.
- SequenceSet();
-
- /**
- * MsaWSJob
- *
- * @param jobNum
- * int
- * @param jobId
- * String
- */
- public SeqSearchWSJob(int jobNum, SequenceI[] inSeqs)
- {
- this.jobnum = jobNum;
- if (!prepareInput(inSeqs, 2))
- {
- submitted = true;
- subjobComplete = true;
- result = new MsaResult();
- result.setFinished(true);
- result.setStatus("Job never ran - input returned to user.");
- }
-
- }
-
- Hashtable SeqNames = new Hashtable();
- Vector emptySeqs = new Vector();
- /**
- * prepare input sequences for service
- * @param seqs jalview sequences to be prepared
- * @param minlen minimum number of residues required for this MsaWS service
- * @return true if seqs contains sequences to be submitted to service.
- */
- private boolean prepareInput(SequenceI[] seqs, int minlen)
- {
- int nseqs = 0;
- if (minlen < 0)
- {
- throw new Error("Implementation error: minlen must be zero or more.");
- }
- for (int i = 0; i < seqs.length; i++)
- {
- if (seqs[i].getEnd() - seqs[i].getStart() > minlen - 1)
- {
- nseqs++;
- }
- }
- boolean valid = nseqs >= 1; // need at least one sequence for valid input TODO: generalise
- vamsas.objects.simple.Sequence[] seqarray =
- (valid)
- ? new vamsas.objects.simple.Sequence[nseqs]
- : null;
- boolean submitGaps = (nseqs==1) ? false : true; // profile is submitted with gaps
- for (int i = 0, n = 0; i < seqs.length; i++)
- {
-
- String newname = jalview.analysis.SeqsetUtils.unique_name(i); // same
- // for
- // any
- // subjob
- SeqNames.put(newname, jalview.analysis.SeqsetUtils
- .SeqCharacterHash(seqs[i]));
- if (valid && seqs[i].getEnd() - seqs[i].getStart() > minlen - 1)
- {
- seqarray[n] = new vamsas.objects.simple.Sequence();
- seqarray[n].setId(newname);
- seqarray[n++].setSeq( (submitGaps) ? seqs[i].getSequenceAsString()
- : AlignSeq.extractGaps(
- jalview.util.Comparison.GapChars, seqs[i]
- .getSequenceAsString()));
- }
- else
- {
- String empty = null;
- if (seqs[i].getEnd() >= seqs[i].getStart())
- {
- empty = (submitGaps) ? seqs[i].getSequenceAsString()
- : AlignSeq.extractGaps(
- jalview.util.Comparison.GapChars, seqs[i]
- .getSequenceAsString());
- }
- emptySeqs.add(new String[]
- {newname, empty});
- }
- }
- if (submitGaps)
- {
- // almost certainly have to remove gapped columns here
- }
- this.seqs = new vamsas.objects.simple.SequenceSet();
- this.seqs.setSeqs(seqarray);
- return valid;
- }
-
- /**
- *
- * @return true if getAlignment will return a valid alignment result.
- */
- public boolean hasResults()
- {
- if (subjobComplete && result != null && result.isFinished()
- && ( (SeqSearchResult) result).getAlignment() != null &&
- ( (SeqSearchResult) result).getAlignment().getSeqs() != null)
- {
- return true;
- }
- return false;
- }
-
- /**
- * return sequence search results for display
- * @return null or { Alignment(+features and annotation), NewickFile)}
- */
- public Object[] getAlignment(Alignment dataset, Hashtable featureColours)
- {
-
- if (result != null && result.isFinished())
- {
- SequenceI[] alseqs = null;
- //char alseq_gapchar = '-';
- //int alseq_l = 0;
- if ( ( (SeqSearchResult) result).getAlignment() != null)
- {
- alseqs = getVamsasAlignment( ( (SeqSearchResult) result).getAlignment());
- //alseq_gapchar = ( (SeqSearchResult) result).getAlignment().getGapchar().charAt(0);
- //alseq_l = alseqs.length;
- }
- /**
- * what has to be done. 1 - annotate returned alignment with annotation file and sequence features file, and associate any tree-nodes.
- * 2. connect alignment back to any associated dataset: 2.a. deuniquify recovers sequence information - but additionally,
- * relocations must be made from the returned aligned sequence back to the dataset.
- */
- // construct annotated alignment as it would be done by the jalview applet
- jalview.datamodel.Alignment al = new Alignment(alseqs);
- // al.setDataset(dataset);
- // make dataset
- String inFile=null;
- try {
- inFile = ((SeqSearchResult) result).getAnnotation();
- if (inFile!=null && inFile.length()>0)
- {
- new jalview.io.AnnotationFile().readAnnotationFile(al, inFile, jalview.io.AppletFormatAdapter.PASTE);
- }
- }
- catch (Exception e)
- {
- System.err.println("Failed to parse the annotation file associated with the alignment.");
- System.err.println(">>>EOF"+inFile+"\n<<<EOF\n");
- e.printStackTrace(System.err);
- }
-
- try {
- inFile = ((SeqSearchResult) result).getFeatures();
- if (inFile!=null && inFile.length()>0)
- {
- jalview.io.FeaturesFile ff = new jalview.io.FeaturesFile(inFile, jalview.io.AppletFormatAdapter.PASTE);
- ff.parse(al, featureColours, false);
- }
- }
- catch (Exception e)
- {
- System.err.println("Failed to parse the Features file associated with the alignment.");
- System.err.println(">>>EOF"+inFile+"\n<<<EOF\n");
- e.printStackTrace(System.err);
- }
- jalview.io.NewickFile nf=null;
- try {
- inFile = ((SeqSearchResult) result).getNewickTree();
- if (inFile!=null && inFile.length()>0)
- {
- nf = new jalview.io.NewickFile(inFile, jalview.io.AppletFormatAdapter.PASTE);
- if (!nf.isValid()) {
- nf.close();
- nf = null;
- }
- }
- }
- catch (Exception e)
- {
- System.err.println("Failed to parse the treeFile associated with the alignment.");
- System.err.println(">>>EOF"+inFile+"\n<<<EOF\n");
- e.printStackTrace(System.err);
- }
-
- /* TODO: housekeeping w.r.t. recovery of dataset and annotation references for input sequences, and then dataset sequence creation for new sequences retrieved from service
- * // finally, attempt to de-uniquify to recover input sequence identity, and try to map back onto dataset
- Note: this
- jalview.analysis.SeqsetUtils.deuniquify(SeqNames, alseqs, true);
- will NOT WORK - the returned alignment may contain multiple versions of the input sequence, each being a subsequence of the original.
- deuniquify also removes existing annotation and features added in the previous step...
- al.setDataset(dataset);
- // add in new sequences retrieved from sequence search which are not already in dataset.
- // trigger a 'fetchDBids' to annotate sequences with database ids...
- */
-
- return new Object[]
- {
- al, nf};
- }
- return null;
- }
-
- /**
- * mark subjob as cancelled and set result object appropriatly
- */
- void cancel()
- {
- cancelled = true;
- subjobComplete = true;
- result = null;
- }
-
- /**
- *
- * @return boolean true if job can be submitted.
- */
- boolean hasValidInput()
- {
- if (seqs.getSeqs() != null)
- {
- return true;
- }
- return false;
- }
- }
-
- String alTitle; // name which will be used to form new alignment window.
- Alignment dataset; // dataset to which the new alignment will be
-
- // associated.
-
- ext.vamsas.SeqSearchI server = null;
-
- private String dbArg;
- /**
- * set basic options for this (group) of Msa jobs
- *
- * @param subgaps
- * boolean
- * @param presorder
- * boolean
- */
- SeqSearchWSThread(ext.vamsas.SeqSearchI server, String wsUrl,
- WebserviceInfo wsinfo, jalview.gui.AlignFrame alFrame,
- AlignmentView alview,
- String wsname, String db)
- {
- super(alFrame, wsinfo, alview, wsname, wsUrl);
- this.server = server;
- this.dbArg = db;
- }
-
- /**
- * create one or more Msa jobs to align visible seuqences in _msa
- *
- * @param title
- * String
- * @param _msa
- * AlignmentView
- * @param subgaps
- * boolean
- * @param presorder
- * boolean
- * @param seqset
- * Alignment
- */
- SeqSearchWSThread(ext.vamsas.SeqSearchI server, String wsUrl,
- WebserviceInfo wsinfo, jalview.gui.AlignFrame alFrame,
- String wsname, String title, AlignmentView _msa, String db, Alignment seqset)
- {
- this(server, wsUrl, wsinfo, alFrame, _msa, wsname, db);
- OutputHeader = wsInfo.getProgressText();
- alTitle = title;
- dataset = seqset;
-
- SequenceI[][] conmsa = _msa.getVisibleContigs('-');
- if (conmsa != null)
- {
- int njobs = conmsa.length;
- jobs = new SeqSearchWSJob[njobs];
- for (int j = 0; j < njobs; j++)
- {
- if (j != 0)
- {
- jobs[j] = new SeqSearchWSJob(wsinfo.addJobPane(), conmsa[j]);
- }
- else
- {
- jobs[j] = new SeqSearchWSJob(0, conmsa[j]);
- }
- if (njobs > 0)
- {
- wsinfo.setProgressName("region " + jobs[j].jobnum, jobs[j].jobnum);
- }
- wsinfo.setProgressText(jobs[j].jobnum, OutputHeader);
- }
- }
- }
-
- public boolean isCancellable()
- {
- return true;
- }
-
- public void cancelJob()
- {
- if (!jobComplete && jobs != null)
- {
- boolean cancelled = true;
- for (int job = 0; job < jobs.length; job++)
- {
- if (jobs[job].submitted && !jobs[job].subjobComplete)
- {
- String cancelledMessage = "";
- try
- {
- vamsas.objects.simple.WsJobId cancelledJob = server
- .cancel(jobs[job].jobId);
- if (cancelledJob.getStatus() == 2)
- {
- // CANCELLED_JOB
- cancelledMessage = "Job cancelled.";
- ( (SeqSearchWSJob) jobs[job]).cancel();
- wsInfo.setStatus(jobs[job].jobnum,
- WebserviceInfo.STATE_CANCELLED_OK);
- }
- else if (cancelledJob.getStatus() == 3)
- {
- // VALID UNSTOPPABLE JOB
- cancelledMessage +=
- "Server cannot cancel this job. just close the window.\n";
- cancelled = false;
- // wsInfo.setStatus(jobs[job].jobnum,
- // WebserviceInfo.STATE_RUNNING);
- }
-
- if (cancelledJob.getJobId() != null)
- {
- cancelledMessage += ("[" + cancelledJob.getJobId() + "]");
- }
-
- cancelledMessage += "\n";
- }
- catch (Exception exc)
- {
- cancelledMessage +=
- ("\nProblems cancelling the job : Exception received...\n"
- + exc + "\n");
- Cache.log.warn("Exception whilst cancelling " + jobs[job].jobId,
- exc);
- }
- wsInfo.setProgressText(jobs[job].jobnum, OutputHeader
- + cancelledMessage + "\n");
- }
- }
- if (cancelled)
- {
- wsInfo.setStatus(WebserviceInfo.STATE_CANCELLED_OK);
- jobComplete = true;
- }
- this.interrupt(); // kick thread to update job states.
- }
- else
- {
- if (!jobComplete)
- {
- wsInfo
- .setProgressText(OutputHeader
- + "Server cannot cancel this job because it has not been submitted properly. just close the window.\n");
- }
- }
- }
-
- void pollJob(WSJob job)
- throws Exception
- {
- ( (SeqSearchWSJob) job).result = server.getResult( ( (SeqSearchWSJob) job).jobId);
- }
-
- void StartJob(WSJob job)
- {
- if (! (job instanceof SeqSearchWSJob))
- {
- throw new Error("StartJob(MsaWSJob) called on a WSJobInstance " +
- job.getClass());
- }
- SeqSearchWSJob j = (SeqSearchWSJob) job;
- if (j.submitted)
- {
- if (Cache.log.isDebugEnabled())
- {
- Cache.log.debug("Tried to submit an already submitted job " + j.jobId);
- }
- return;
- }
- if (j.seqs.getSeqs() == null)
- {
- // special case - selection consisted entirely of empty sequences...
- j.submitted = true;
- j.result = new MsaResult();
- j.result.setFinished(true);
- j.result.setStatus("Empty Alignment Job");
- ( (MsaResult) j.result).setMsa(null);
- }
- try
- {
- vamsas.objects.simple.WsJobId jobsubmit = server.search(j.seqs.getSeqs()[0], dbArg);
-
- if ( (jobsubmit != null) && (jobsubmit.getStatus() == 1))
- {
- j.jobId = jobsubmit.getJobId();
- j.submitted = true;
- j.subjobComplete = false;
- // System.out.println(WsURL + " Job Id '" + jobId + "'");
- }
- else
- {
- if (jobsubmit == null)
- {
- throw new Exception(
- "Server at "
- + WsUrl
- +
- " returned null object, it probably cannot be contacted. Try again later ?");
- }
-
- throw new Exception(jobsubmit.getJobId());
- }
- }
- catch (Exception e)
- {
- // TODO: JBPNote catch timeout or other fault types explicitly
- // For unexpected errors
- System.err
- .println(WebServiceName
- + "Client: Failed to submit the sequences for alignment (probably a server side problem)\n"
- + "When contacting Server:" + WsUrl + "\n"
- + e.toString() + "\n");
- j.allowedServerExceptions = 0;
- wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_SERVERERROR);
- wsInfo.setStatus(j.jobnum, WebserviceInfo.STATE_STOPPED_SERVERERROR);
- wsInfo
- .appendProgressText(
- j.jobnum,
- "Failed to submit sequences for alignment.\n"
- + "It is most likely that there is a problem with the server.\n"
- + "Just close the window\n");
-
- // e.printStackTrace(); // TODO: JBPNote DEBUG
- }
- }
-
- private jalview.datamodel.Sequence[] getVamsasAlignment(
- vamsas.objects.simple.Alignment valign)
- {
- vamsas.objects.simple.Sequence[] seqs = valign.getSeqs().getSeqs();
- jalview.datamodel.Sequence[] msa = new jalview.datamodel.Sequence[seqs.
- length];
-
- for (int i = 0, j = seqs.length; i < j; i++)
- {
- msa[i] = new jalview.datamodel.Sequence(seqs[i].getId(), seqs[i]
- .getSeq());
- }
-
- return msa;
- }
-
- void parseResult()
- {
- int results = 0; // number of result sets received
- JobStateSummary finalState = new JobStateSummary();
- try
- {
- for (int j = 0; j < jobs.length; j++)
- {
- finalState.updateJobPanelState(wsInfo, OutputHeader, jobs[j]);
- if (jobs[j].submitted && jobs[j].subjobComplete && jobs[j].hasResults())
- {
- results++;
- vamsas.objects.simple.Alignment valign = ( (SeqSearchResult) jobs[j].result).
- getAlignment();
- if (valign != null)
- {
- wsInfo.appendProgressText(jobs[j].jobnum,
- "\nAlignment Object Method Notes\n");
- String[] lines = valign.getMethod();
- for (int line = 0; line < lines.length; line++)
- {
- wsInfo.appendProgressText(jobs[j].jobnum, lines[line] + "\n");
- }
- // JBPNote The returned files from a webservice could be
- // hidden behind icons in the monitor window that,
- // when clicked, pop up their corresponding data
- }
- }
- }
- }
- catch (Exception ex)
- {
-
- Cache.log.error("Unexpected exception when processing results for " +
- alTitle, ex);
- wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR);
- }
- if (results > 0)
- {
- wsInfo.showResultsNewFrame
- .addActionListener(new java.awt.event.ActionListener()
- {
- public void actionPerformed(
- java.awt.event.ActionEvent evt)
- {
- displayResults(true);
- }
- });
- wsInfo.mergeResults
- .addActionListener(new java.awt.event.ActionListener()
- {
- public void actionPerformed(
- java.awt.event.ActionEvent evt)
- {
- displayResults(false);
- }
- });
- wsInfo.setResultsReady();
- }
- else
- {
- wsInfo.setFinishedNoResults();
- }
- }
-
- void displayResults(boolean newFrame)
- {
- if (!newFrame)
- {
- System.err.println("MERGE WITH OLD FRAME NOT IMPLEMENTED");
- return;
- }
- // each subjob is an independent alignment for the moment
- //Alignment al[] = new Alignment[jobs.length];
- //NewickFile nf[] = new NewickFile[jobs.length];
- for (int j = 0; j < jobs.length; j++)
- {
- Hashtable featureColours = new Hashtable();
- Alignment al=null;
- NewickFile nf = null;
- if (jobs[j].hasResults())
- {
- Object[] res = ( (SeqSearchWSJob) jobs[j]).getAlignment(dataset, featureColours);
- if (res==null) { continue; };
- al = (Alignment) res[0];
- nf = (NewickFile) res[1];
- }
- else
- {
- al = null;
- nf = null;
- continue;
- }
- /*
- * We can't map new alignment back with insertions from input's hidden regions until dataset mapping is sorted out...
- * but basically it goes like this:
- 1. Merge each domain hit back onto the visible segments in the same way as a Jnet prediction is mapped back
-
- Object[] newview = input.getUpdatedView(results, orders, getGapChar());
- // trash references to original result data
- for (int j = 0; j < jobs.length; j++)
- {
- results[j] = null;
- orders[j] = null;
- }
- SequenceI[] alignment = (SequenceI[]) newview[0];
- ColumnSelection columnselection = (ColumnSelection) newview[1];
- Alignment al = new Alignment(alignment);
-
- if (dataset != null)
- {
- al.setDataset(dataset);
- }
-
- propagateDatasetMappings(al);
- }
- */
-
- AlignFrame af = new AlignFrame(al,// columnselection,
- AlignFrame.DEFAULT_WIDTH,
- AlignFrame.DEFAULT_HEIGHT);
- if (nf!=null)
- {
- af.ShowNewickTree(nf, "Tree from "+this.alTitle);
- }
- // initialise with same renderer settings as in parent alignframe.
- af.getFeatureRenderer().transferSettings(
- this.featureSettings);
- Desktop.addInternalFrame(af, alTitle,
- AlignFrame.DEFAULT_WIDTH,
- AlignFrame.DEFAULT_HEIGHT);
- }
- }
-
- public boolean canMergeResults()
- {
- return false;
- }
-}
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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 java.util.*;\r
+\r
+import jalview.analysis.*;\r
+import jalview.bin.*;\r
+import jalview.datamodel.*;\r
+import jalview.gui.*;\r
+import jalview.io.NewickFile;\r
+import vamsas.objects.simple.MsaResult;\r
+import vamsas.objects.simple.SeqSearchResult;\r
+\r
+/**\r
+ * <p>\r
+ * Title:\r
+ * </p>\r
+ *\r
+ * <p>\r
+ * Description:\r
+ * </p>\r
+ *\r
+ * <p>\r
+ * Copyright: Copyright (c) 2004\r
+ * </p>\r
+ *\r
+ * <p>\r
+ * Company: Dundee University\r
+ * </p>\r
+ *\r
+ * @author not attributable\r
+ * @version 1.0\r
+ */\r
+class SeqSearchWSThread\r
+ extends WSThread implements WSClientI\r
+{\r
+ String dbs=null;\r
+ boolean profile=false;\r
+\r
+ class SeqSearchWSJob\r
+ extends WSThread.WSJob\r
+ {\r
+ // hold special input for this\r
+ vamsas.objects.simple.SequenceSet seqs = new vamsas.objects.simple.\r
+ SequenceSet();\r
+\r
+ /**\r
+ * MsaWSJob\r
+ *\r
+ * @param jobNum\r
+ * int\r
+ * @param jobId\r
+ * String\r
+ */\r
+ public SeqSearchWSJob(int jobNum, SequenceI[] inSeqs)\r
+ {\r
+ this.jobnum = jobNum;\r
+ if (!prepareInput(inSeqs, 2))\r
+ {\r
+ submitted = true;\r
+ subjobComplete = true;\r
+ result = new MsaResult();\r
+ result.setFinished(true);\r
+ result.setStatus("Job never ran - input returned to user.");\r
+ }\r
+\r
+ }\r
+\r
+ Hashtable SeqNames = new Hashtable();\r
+ Vector emptySeqs = new Vector();\r
+ /**\r
+ * prepare input sequences for service\r
+ * @param seqs jalview sequences to be prepared\r
+ * @param minlen minimum number of residues required for this MsaWS service\r
+ * @return true if seqs contains sequences to be submitted to service.\r
+ */\r
+ private boolean prepareInput(SequenceI[] seqs, int minlen)\r
+ {\r
+ int nseqs = 0;\r
+ if (minlen < 0)\r
+ {\r
+ throw new Error("Implementation error: minlen must be zero or more.");\r
+ }\r
+ for (int i = 0; i < seqs.length; i++)\r
+ {\r
+ if (seqs[i].getEnd() - seqs[i].getStart() > minlen - 1)\r
+ {\r
+ nseqs++;\r
+ }\r
+ }\r
+ boolean valid = nseqs >= 1; // need at least one sequence for valid input TODO: generalise\r
+ vamsas.objects.simple.Sequence[] seqarray =\r
+ (valid)\r
+ ? new vamsas.objects.simple.Sequence[nseqs]\r
+ : null;\r
+ boolean submitGaps = (nseqs==1) ? false : true; // profile is submitted with gaps \r
+ for (int i = 0, n = 0; i < seqs.length; i++)\r
+ {\r
+\r
+ String newname = jalview.analysis.SeqsetUtils.unique_name(i); // same\r
+ // for\r
+ // any\r
+ // subjob\r
+ SeqNames.put(newname, jalview.analysis.SeqsetUtils\r
+ .SeqCharacterHash(seqs[i]));\r
+ if (valid && seqs[i].getEnd() - seqs[i].getStart() > minlen - 1)\r
+ {\r
+ seqarray[n] = new vamsas.objects.simple.Sequence();\r
+ seqarray[n].setId(newname);\r
+ seqarray[n++].setSeq( (submitGaps) ? seqs[i].getSequenceAsString()\r
+ : AlignSeq.extractGaps(\r
+ jalview.util.Comparison.GapChars, seqs[i]\r
+ .getSequenceAsString()));\r
+ }\r
+ else\r
+ {\r
+ String empty = null;\r
+ if (seqs[i].getEnd() >= seqs[i].getStart())\r
+ {\r
+ empty = (submitGaps) ? seqs[i].getSequenceAsString()\r
+ : AlignSeq.extractGaps(\r
+ jalview.util.Comparison.GapChars, seqs[i]\r
+ .getSequenceAsString());\r
+ }\r
+ emptySeqs.add(new String[]\r
+ {newname, empty});\r
+ }\r
+ }\r
+ if (submitGaps)\r
+ {\r
+ // almost certainly have to remove gapped columns here\r
+ }\r
+ this.seqs = new vamsas.objects.simple.SequenceSet();\r
+ this.seqs.setSeqs(seqarray);\r
+ return valid;\r
+ }\r
+\r
+ /**\r
+ *\r
+ * @return true if getAlignment will return a valid alignment result.\r
+ */\r
+ public boolean hasResults()\r
+ {\r
+ if (subjobComplete && result != null && result.isFinished()\r
+ && ( (SeqSearchResult) result).getAlignment() != null &&\r
+ ( (SeqSearchResult) result).getAlignment().getSeqs() != null)\r
+ {\r
+ return true;\r
+ }\r
+ return false;\r
+ }\r
+\r
+ /**\r
+ * return sequence search results for display\r
+ * @return null or { Alignment(+features and annotation), NewickFile)}\r
+ */\r
+ public Object[] getAlignment(Alignment dataset, Hashtable featureColours)\r
+ {\r
+\r
+ if (result != null && result.isFinished())\r
+ {\r
+ SequenceI[] alseqs = null;\r
+ //char alseq_gapchar = '-';\r
+ //int alseq_l = 0;\r
+ if ( ( (SeqSearchResult) result).getAlignment() != null)\r
+ {\r
+ alseqs = getVamsasAlignment( ( (SeqSearchResult) result).getAlignment());\r
+ //alseq_gapchar = ( (SeqSearchResult) result).getAlignment().getGapchar().charAt(0);\r
+ //alseq_l = alseqs.length;\r
+ }\r
+ /**\r
+ * what has to be done. 1 - annotate returned alignment with annotation file and sequence features file, and associate any tree-nodes.\r
+ * 2. connect alignment back to any associated dataset: 2.a. deuniquify recovers sequence information - but additionally, \r
+ * relocations must be made from the returned aligned sequence back to the dataset.\r
+ */\r
+ // construct annotated alignment as it would be done by the jalview applet\r
+ jalview.datamodel.Alignment al = new Alignment(alseqs);\r
+ // al.setDataset(dataset);\r
+ // make dataset\r
+ String inFile=null;\r
+ try {\r
+ inFile = ((SeqSearchResult) result).getAnnotation();\r
+ if (inFile!=null && inFile.length()>0)\r
+ {\r
+ new jalview.io.AnnotationFile().readAnnotationFile(al, inFile, jalview.io.AppletFormatAdapter.PASTE);\r
+ }\r
+ }\r
+ catch (Exception e)\r
+ {\r
+ System.err.println("Failed to parse the annotation file associated with the alignment.");\r
+ System.err.println(">>>EOF"+inFile+"\n<<<EOF\n");\r
+ e.printStackTrace(System.err);\r
+ }\r
+ \r
+ try {\r
+ inFile = ((SeqSearchResult) result).getFeatures();\r
+ if (inFile!=null && inFile.length()>0)\r
+ {\r
+ jalview.io.FeaturesFile ff = new jalview.io.FeaturesFile(inFile, jalview.io.AppletFormatAdapter.PASTE);\r
+ ff.parse(al, featureColours, false);\r
+ }\r
+ }\r
+ catch (Exception e)\r
+ {\r
+ System.err.println("Failed to parse the Features file associated with the alignment.");\r
+ System.err.println(">>>EOF"+inFile+"\n<<<EOF\n");\r
+ e.printStackTrace(System.err);\r
+ }\r
+ jalview.io.NewickFile nf=null;\r
+ try {\r
+ inFile = ((SeqSearchResult) result).getNewickTree();\r
+ if (inFile!=null && inFile.length()>0)\r
+ {\r
+ nf = new jalview.io.NewickFile(inFile, jalview.io.AppletFormatAdapter.PASTE);\r
+ if (!nf.isValid()) {\r
+ nf.close();\r
+ nf = null;\r
+ }\r
+ }\r
+ }\r
+ catch (Exception e)\r
+ {\r
+ System.err.println("Failed to parse the treeFile associated with the alignment.");\r
+ System.err.println(">>>EOF"+inFile+"\n<<<EOF\n");\r
+ e.printStackTrace(System.err);\r
+ }\r
+ \r
+ /* TODO: housekeeping w.r.t. recovery of dataset and annotation references for input sequences, and then dataset sequence creation for new sequences retrieved from service\r
+ * // finally, attempt to de-uniquify to recover input sequence identity, and try to map back onto dataset\r
+ Note: this\r
+ jalview.analysis.SeqsetUtils.deuniquify(SeqNames, alseqs, true);\r
+ will NOT WORK - the returned alignment may contain multiple versions of the input sequence, each being a subsequence of the original.\r
+ deuniquify also removes existing annotation and features added in the previous step...\r
+ al.setDataset(dataset);\r
+ // add in new sequences retrieved from sequence search which are not already in dataset.\r
+ // trigger a 'fetchDBids' to annotate sequences with database ids...\r
+ */\r
+\r
+ return new Object[]\r
+ {\r
+ al, nf};\r
+ }\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * mark subjob as cancelled and set result object appropriatly\r
+ */\r
+ void cancel()\r
+ {\r
+ cancelled = true;\r
+ subjobComplete = true;\r
+ result = null;\r
+ }\r
+\r
+ /**\r
+ *\r
+ * @return boolean true if job can be submitted.\r
+ */\r
+ boolean hasValidInput()\r
+ {\r
+ if (seqs.getSeqs() != null)\r
+ {\r
+ return true;\r
+ }\r
+ return false;\r
+ }\r
+ }\r
+\r
+ String alTitle; // name which will be used to form new alignment window.\r
+ Alignment dataset; // dataset to which the new alignment will be\r
+\r
+ // associated.\r
+\r
+ ext.vamsas.SeqSearchI server = null;\r
+\r
+ private String dbArg;\r
+ /**\r
+ * set basic options for this (group) of Msa jobs\r
+ *\r
+ * @param subgaps\r
+ * boolean\r
+ * @param presorder\r
+ * boolean\r
+ */\r
+ SeqSearchWSThread(ext.vamsas.SeqSearchI server, String wsUrl,\r
+ WebserviceInfo wsinfo, jalview.gui.AlignFrame alFrame,\r
+ AlignmentView alview,\r
+ String wsname, String db)\r
+ {\r
+ super(alFrame, wsinfo, alview, wsname, wsUrl);\r
+ this.server = server;\r
+ this.dbArg = db;\r
+ }\r
+\r
+ /**\r
+ * create one or more Msa jobs to align visible seuqences in _msa\r
+ *\r
+ * @param title\r
+ * String\r
+ * @param _msa\r
+ * AlignmentView\r
+ * @param subgaps\r
+ * boolean\r
+ * @param presorder\r
+ * boolean\r
+ * @param seqset\r
+ * Alignment\r
+ */\r
+ SeqSearchWSThread(ext.vamsas.SeqSearchI server, String wsUrl,\r
+ WebserviceInfo wsinfo, jalview.gui.AlignFrame alFrame,\r
+ String wsname, String title, AlignmentView _msa, String db, Alignment seqset)\r
+ {\r
+ this(server, wsUrl, wsinfo, alFrame, _msa, wsname, db);\r
+ OutputHeader = wsInfo.getProgressText();\r
+ alTitle = title;\r
+ dataset = seqset;\r
+\r
+ SequenceI[][] conmsa = _msa.getVisibleContigs('-');\r
+ if (conmsa != null)\r
+ {\r
+ int njobs = conmsa.length;\r
+ jobs = new SeqSearchWSJob[njobs];\r
+ for (int j = 0; j < njobs; j++)\r
+ {\r
+ if (j != 0)\r
+ {\r
+ jobs[j] = new SeqSearchWSJob(wsinfo.addJobPane(), conmsa[j]);\r
+ }\r
+ else\r
+ {\r
+ jobs[j] = new SeqSearchWSJob(0, conmsa[j]);\r
+ }\r
+ if (njobs > 0)\r
+ {\r
+ wsinfo.setProgressName("region " + jobs[j].jobnum, jobs[j].jobnum);\r
+ }\r
+ wsinfo.setProgressText(jobs[j].jobnum, OutputHeader);\r
+ }\r
+ }\r
+ }\r
+\r
+ public boolean isCancellable()\r
+ {\r
+ return true;\r
+ }\r
+\r
+ public void cancelJob()\r
+ {\r
+ if (!jobComplete && jobs != null)\r
+ {\r
+ boolean cancelled = true;\r
+ for (int job = 0; job < jobs.length; job++)\r
+ {\r
+ if (jobs[job].submitted && !jobs[job].subjobComplete)\r
+ {\r
+ String cancelledMessage = "";\r
+ try\r
+ {\r
+ vamsas.objects.simple.WsJobId cancelledJob = server\r
+ .cancel(jobs[job].jobId);\r
+ if (cancelledJob.getStatus() == 2)\r
+ {\r
+ // CANCELLED_JOB\r
+ cancelledMessage = "Job cancelled.";\r
+ ( (SeqSearchWSJob) jobs[job]).cancel();\r
+ wsInfo.setStatus(jobs[job].jobnum,\r
+ WebserviceInfo.STATE_CANCELLED_OK);\r
+ }\r
+ else if (cancelledJob.getStatus() == 3)\r
+ {\r
+ // VALID UNSTOPPABLE JOB\r
+ cancelledMessage +=\r
+ "Server cannot cancel this job. just close the window.\n";\r
+ cancelled = false;\r
+ // wsInfo.setStatus(jobs[job].jobnum,\r
+ // WebserviceInfo.STATE_RUNNING);\r
+ }\r
+\r
+ if (cancelledJob.getJobId() != null)\r
+ {\r
+ cancelledMessage += ("[" + cancelledJob.getJobId() + "]");\r
+ }\r
+\r
+ cancelledMessage += "\n";\r
+ }\r
+ catch (Exception exc)\r
+ {\r
+ cancelledMessage +=\r
+ ("\nProblems cancelling the job : Exception received...\n"\r
+ + exc + "\n");\r
+ Cache.log.warn("Exception whilst cancelling " + jobs[job].jobId,\r
+ exc);\r
+ }\r
+ wsInfo.setProgressText(jobs[job].jobnum, OutputHeader\r
+ + cancelledMessage + "\n");\r
+ }\r
+ }\r
+ if (cancelled)\r
+ {\r
+ wsInfo.setStatus(WebserviceInfo.STATE_CANCELLED_OK);\r
+ jobComplete = true;\r
+ }\r
+ this.interrupt(); // kick thread to update job states.\r
+ }\r
+ else\r
+ {\r
+ if (!jobComplete)\r
+ {\r
+ wsInfo\r
+ .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
+ void pollJob(WSJob job)\r
+ throws Exception\r
+ {\r
+ ( (SeqSearchWSJob) job).result = server.getResult( ( (SeqSearchWSJob) job).jobId);\r
+ }\r
+\r
+ void StartJob(WSJob job)\r
+ {\r
+ if (! (job instanceof SeqSearchWSJob))\r
+ {\r
+ throw new Error("StartJob(MsaWSJob) called on a WSJobInstance " +\r
+ job.getClass());\r
+ }\r
+ SeqSearchWSJob j = (SeqSearchWSJob) job;\r
+ if (j.submitted)\r
+ {\r
+ if (Cache.log.isDebugEnabled())\r
+ {\r
+ Cache.log.debug("Tried to submit an already submitted job " + j.jobId);\r
+ }\r
+ return;\r
+ }\r
+ if (j.seqs.getSeqs() == null)\r
+ {\r
+ // special case - selection consisted entirely of empty sequences...\r
+ j.submitted = true;\r
+ j.result = new MsaResult();\r
+ j.result.setFinished(true);\r
+ j.result.setStatus("Empty Alignment Job");\r
+ ( (MsaResult) j.result).setMsa(null);\r
+ }\r
+ try\r
+ {\r
+ vamsas.objects.simple.WsJobId jobsubmit = server.search(j.seqs.getSeqs()[0], dbArg);\r
+\r
+ if ( (jobsubmit != null) && (jobsubmit.getStatus() == 1))\r
+ {\r
+ j.jobId = jobsubmit.getJobId();\r
+ j.submitted = true;\r
+ j.subjobComplete = false;\r
+ // System.out.println(WsURL + " Job Id '" + jobId + "'");\r
+ }\r
+ else\r
+ {\r
+ if (jobsubmit == null)\r
+ {\r
+ throw new Exception(\r
+ "Server at "\r
+ + WsUrl\r
+ +\r
+ " returned null object, it probably cannot be contacted. Try again later ?");\r
+ }\r
+\r
+ throw new Exception(jobsubmit.getJobId());\r
+ }\r
+ }\r
+ catch (Exception e)\r
+ {\r
+ // TODO: JBPNote catch timeout or other fault types explicitly\r
+ // For unexpected errors\r
+ System.err\r
+ .println(WebServiceName\r
+ + "Client: Failed to submit the sequences for alignment (probably a server side problem)\n"\r
+ + "When contacting Server:" + WsUrl + "\n"\r
+ + e.toString() + "\n");\r
+ j.allowedServerExceptions = 0;\r
+ wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_SERVERERROR);\r
+ wsInfo.setStatus(j.jobnum, WebserviceInfo.STATE_STOPPED_SERVERERROR);\r
+ wsInfo\r
+ .appendProgressText(\r
+ j.jobnum,\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
+\r
+ private jalview.datamodel.Sequence[] getVamsasAlignment(\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.\r
+ length];\r
+\r
+ for (int i = 0, j = seqs.length; i < j; i++)\r
+ {\r
+ msa[i] = new jalview.datamodel.Sequence(seqs[i].getId(), seqs[i]\r
+ .getSeq());\r
+ }\r
+\r
+ return msa;\r
+ }\r
+\r
+ void parseResult()\r
+ {\r
+ int results = 0; // number of result sets received\r
+ JobStateSummary finalState = new JobStateSummary();\r
+ try\r
+ {\r
+ for (int j = 0; j < jobs.length; j++)\r
+ {\r
+ finalState.updateJobPanelState(wsInfo, OutputHeader, jobs[j]);\r
+ if (jobs[j].submitted && jobs[j].subjobComplete && jobs[j].hasResults())\r
+ {\r
+ results++;\r
+ vamsas.objects.simple.Alignment valign = ( (SeqSearchResult) jobs[j].result).\r
+ getAlignment();\r
+ if (valign != null)\r
+ {\r
+ wsInfo.appendProgressText(jobs[j].jobnum,\r
+ "\nAlignment Object Method Notes\n");\r
+ String[] lines = valign.getMethod();\r
+ for (int line = 0; line < lines.length; line++)\r
+ {\r
+ wsInfo.appendProgressText(jobs[j].jobnum, lines[line] + "\n");\r
+ }\r
+ // JBPNote The returned files from a webservice could be\r
+ // hidden behind icons in the monitor window that,\r
+ // when clicked, pop up their corresponding data\r
+ }\r
+ }\r
+ }\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+\r
+ Cache.log.error("Unexpected exception when processing results for " +\r
+ alTitle, ex);\r
+ wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR);\r
+ }\r
+ if (results > 0)\r
+ {\r
+ wsInfo.showResultsNewFrame\r
+ .addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(\r
+ java.awt.event.ActionEvent evt)\r
+ {\r
+ displayResults(true);\r
+ }\r
+ });\r
+ wsInfo.mergeResults\r
+ .addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(\r
+ java.awt.event.ActionEvent evt)\r
+ {\r
+ displayResults(false);\r
+ }\r
+ });\r
+ wsInfo.setResultsReady();\r
+ }\r
+ else\r
+ {\r
+ wsInfo.setFinishedNoResults();\r
+ }\r
+ }\r
+\r
+ void displayResults(boolean newFrame)\r
+ {\r
+ if (!newFrame)\r
+ {\r
+ System.err.println("MERGE WITH OLD FRAME NOT IMPLEMENTED");\r
+ return;\r
+ }\r
+ // each subjob is an independent alignment for the moment\r
+ //Alignment al[] = new Alignment[jobs.length];\r
+ //NewickFile nf[] = new NewickFile[jobs.length];\r
+ for (int j = 0; j < jobs.length; j++)\r
+ {\r
+ Hashtable featureColours = new Hashtable();\r
+ Alignment al=null;\r
+ NewickFile nf = null;\r
+ if (jobs[j].hasResults())\r
+ {\r
+ Object[] res = ( (SeqSearchWSJob) jobs[j]).getAlignment(dataset, featureColours);\r
+ if (res==null) { continue; };\r
+ al = (Alignment) res[0];\r
+ nf = (NewickFile) res[1];\r
+ }\r
+ else\r
+ {\r
+ al = null;\r
+ nf = null;\r
+ continue;\r
+ }\r
+ /*\r
+ * We can't map new alignment back with insertions from input's hidden regions until dataset mapping is sorted out...\r
+ * but basically it goes like this:\r
+ 1. Merge each domain hit back onto the visible segments in the same way as a Jnet prediction is mapped back\r
+ \r
+ Object[] newview = input.getUpdatedView(results, orders, getGapChar());\r
+ // trash references to original result data\r
+ for (int j = 0; j < jobs.length; j++)\r
+ {\r
+ results[j] = null;\r
+ orders[j] = null;\r
+ }\r
+ SequenceI[] alignment = (SequenceI[]) newview[0];\r
+ ColumnSelection columnselection = (ColumnSelection) newview[1];\r
+ Alignment al = new Alignment(alignment);\r
+\r
+ if (dataset != null)\r
+ {\r
+ al.setDataset(dataset);\r
+ }\r
+\r
+ propagateDatasetMappings(al);\r
+ }\r
+ */\r
+ \r
+ AlignFrame af = new AlignFrame(al,// columnselection,\r
+ AlignFrame.DEFAULT_WIDTH,\r
+ AlignFrame.DEFAULT_HEIGHT);\r
+ if (nf!=null)\r
+ {\r
+ af.ShowNewickTree(nf, "Tree from "+this.alTitle);\r
+ }\r
+ // initialise with same renderer settings as in parent alignframe.\r
+ af.getFeatureRenderer().transferSettings(\r
+ this.featureSettings);\r
+ Desktop.addInternalFrame(af, alTitle,\r
+ AlignFrame.DEFAULT_WIDTH,\r
+ AlignFrame.DEFAULT_HEIGHT);\r
+ }\r
+ }\r
+\r
+ public boolean canMergeResults()\r
+ {\r
+ return false;\r
+ }\r
+}\r
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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 java.util.ArrayList;\r
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
-/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 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;
-
-import javax.swing.*;
-
-import jalview.bin.*;
-import jalview.datamodel.*;
-import jalview.gui.*;
-import jalview.gui.FeatureRenderer.FeatureRendererSettings;
-
-public abstract class WSThread
- extends Thread
-{
- /**
- * Generic properties for Web Service Client threads.
- */
- /**
- * view that this job was associated with
- */
- AlignmentI currentView = null;
- /**
- * feature settings from view that job was associated with
- */
- FeatureRendererSettings featureSettings = null;
- /**
- * metadata about this web service
- */
- WebserviceInfo wsInfo = null;
- /**
- * original input data for this job
- */
- AlignmentView input = null;
- /**
- * dataset sequence relationships to be propagated onto new results
- */
- AlignedCodonFrame[] codonframe = null;
- /**
- * are there jobs still running in this thread.
- */
- boolean jobComplete = false;
-
- abstract class WSJob
- {
- /**
- * Generic properties for an individual job within a Web Service Client thread
- */
- int jobnum = 0; // WebServiceInfo pane for this job
- String jobId; // ws job ticket
- /**
- * has job been cancelled
- */
- boolean cancelled = false;
- /**
- * number of exceptions left before job dies
- */
- int allowedServerExceptions = 3;
- /**
- * has job been submitted
- */
- boolean submitted = false;
- /**
- * are all sub-jobs complete
- */
- boolean subjobComplete = false;
- /**
- *
- * @return true if job has completed and valid results are available
- */
- abstract boolean hasResults();
-
- /**
- *
- * @return boolean true if job can be submitted.
- */
- abstract boolean hasValidInput();
-
- /**
- * The last result object returned by the service.
- */
- vamsas.objects.simple.Result result;
- }
-
- class JobStateSummary
- {
- /**
- * number of jobs running
- */
- int running = 0;
- /**
- * number of jobs queued
- */
- int queuing = 0;
- /**
- * number of jobs finished
- */
- int finished = 0;
- /**
- * number of jobs failed
- */
- int error = 0;
- /**
- * number of jobs stopped due to server error
- */
- int serror = 0;
- /**
- * number of jobs cancelled
- */
- int cancelled = 0;
- /**
- * number of jobs finished with results
- */
- int results = 0;
- /**
- * processes WSJob and updates job status counters and WebService status displays
- * @param wsInfo
- * @param OutputHeader
- * @param j
- */
- void updateJobPanelState(WebserviceInfo wsInfo, String OutputHeader,
- WSJob j)
- {
- if (j.result != null)
- {
- String progheader = "";
- // Parse state of job[j]
- if (j.result.isRunning())
- {
- running++;
- wsInfo.setStatus(j.jobnum, WebserviceInfo.STATE_RUNNING);
- }
- else if (j.result.isQueued())
- {
- queuing++;
- wsInfo.setStatus(j.jobnum, WebserviceInfo.STATE_QUEUING);
- }
- else if (j.result.isFinished())
- {
- finished++;
- j.subjobComplete = true;
- if (j.hasResults())
- {
- results++;
- }
- wsInfo.setStatus(j.jobnum, WebserviceInfo.STATE_STOPPED_OK);
- }
- else if (j.result.isFailed())
- {
- progheader += "Job failed.\n";
- j.subjobComplete = true;
- wsInfo.setStatus(j.jobnum, WebserviceInfo.STATE_STOPPED_ERROR);
- error++;
- }
- else if (j.result.isServerError())
- {
- serror++;
- j.subjobComplete = true;
- wsInfo.setStatus(j.jobnum,
- WebserviceInfo.STATE_STOPPED_SERVERERROR);
- }
- else if (j.result.isBroken() || j.result.isFailed())
- {
- error++;
- j.subjobComplete = true;
- wsInfo.setStatus(j.jobnum, WebserviceInfo.STATE_STOPPED_ERROR);
- }
- // and pass on any sub-job messages to the user
- wsInfo.setProgressText(j.jobnum, OutputHeader);
- wsInfo.appendProgressText(j.jobnum, progheader);
- if (j.result.getStatus() != null)
- {
- wsInfo.appendProgressText(j.jobnum, j.result.getStatus());
- }
- }
- else
- {
- if (j.submitted && j.subjobComplete)
- {
- if (j.allowedServerExceptions == 0)
- {
- serror++;
- }
- else if (j.result == null)
- {
- error++;
- }
- }
- }
- }
- }
- /**
- * one or more jobs being managed by this thread.
- */
- WSJob jobs[] = null;
- /**
- * full name of service
- */
- String WebServiceName = null;
- String OutputHeader;
- String WsUrl = null;
- /**
- * query web service for status of job.
- * on return, job.result must not be null - if it is then it will be
- * assumed that the job status query timed out and a server exception
- * will be logged.
- * @param job
- * @throws Exception will be logged as a server exception for this job
- */
- abstract void pollJob(WSJob job)
- throws Exception;
-
- public void run()
- {
- JobStateSummary jstate = null;
- if (jobs == null)
- {
- jobComplete = true;
- }
- while (!jobComplete)
- {
- jstate = new JobStateSummary();
- for (int j = 0; j < jobs.length; j++)
- {
-
- if (!jobs[j].submitted && jobs[j].hasValidInput())
- {
- StartJob(jobs[j]);
- }
-
- if (jobs[j].submitted && !jobs[j].subjobComplete)
- {
- try
- {
- pollJob(jobs[j]);
- if (jobs[j].result == null)
- {
- throw (new Exception(
- "Timed out when communicating with server\nTry again later.\n"));
- }
- jalview.bin.Cache.log.debug("Job " + j + " Result state " +
- jobs[j].result.getState()
- + "(ServerError=" +
- jobs[j].result.isServerError() + ")");
- }
- catch (Exception ex)
- {
- // Deal with Transaction exceptions
- wsInfo.appendProgressText(jobs[j].jobnum, "\n" + WebServiceName
- + " Server exception!\n" + ex.getMessage());
- Cache.log.warn(WebServiceName + " job(" + jobs[j].jobnum
- + ") Server exception: " + ex.getMessage());
-
- if (jobs[j].allowedServerExceptions > 0)
- {
- jobs[j].allowedServerExceptions--;
- Cache.log.debug("Sleeping after a server exception.");
- try
- {
- Thread.sleep(5000);
- }
- catch (InterruptedException ex1)
- {
- }
- }
- else
- {
- Cache.log.warn("Dropping job " + j + " " + jobs[j].jobId);
- jobs[j].subjobComplete = true;
- wsInfo.setStatus(jobs[j].jobnum,
- WebserviceInfo.STATE_STOPPED_SERVERERROR);
- }
- }
- catch (OutOfMemoryError er)
- {
- jobComplete = true;
- jobs[j].subjobComplete = true;
- jobs[j].result = null; // may contain out of date result object
- wsInfo.setStatus(jobs[j].jobnum,
- WebserviceInfo.STATE_STOPPED_ERROR);
- JOptionPane
- .showInternalMessageDialog(
- Desktop.desktop,
- "Out of memory handling result for job !!"
- +
- "\nSee help files for increasing Java Virtual Machine memory.",
- "Out of memory", JOptionPane.WARNING_MESSAGE);
- Cache.log.error("Out of memory when retrieving Job " + j + " id:" +
- WsUrl + "/" + jobs[j].jobId, er);
- System.gc();
- }
- }
- jstate.updateJobPanelState(wsInfo, OutputHeader, jobs[j]);
- }
- // Decide on overall state based on collected jobs[] states
- if (jstate.running > 0)
- {
- wsInfo.setStatus(WebserviceInfo.STATE_RUNNING);
- }
- else if (jstate.queuing > 0)
- {
- wsInfo.setStatus(WebserviceInfo.STATE_QUEUING);
- }
- else
- {
- jobComplete = true;
- if (jstate.finished > 0)
- {
- wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_OK);
- }
- else if (jstate.error > 0)
- {
- wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR);
- }
- else if (jstate.serror > 0)
- {
- wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_SERVERERROR);
- }
- }
- if (!jobComplete)
- {
- try
- {
- Thread.sleep(5000);
- }
- catch (InterruptedException e)
- {
- Cache.log.debug("Interrupted sleep waiting for next job poll.", e);
- }
- // System.out.println("I'm alive "+alTitle);
- }
- }
- if (jobComplete && jobs != null)
- {
- parseResult(); // tidy up and make results available to user
- }
- else
- {
- Cache.log.debug("WebServiceJob poll loop finished with no jobs created.");
- wsInfo.setFinishedNoResults();
- }
- }
-
- /**
- * submit job to web service
- * @param job
- */
- abstract void StartJob(WSJob job);
-
- /**
- * process the set of WSJob objects into a set of results, and tidy up.
- */
- abstract void parseResult();
-
- /**
- * helper function to conserve dataset references to sequence objects returned from web services
- * 1. Propagates AlCodonFrame data from <code>codonframe</code> to <code>al</code>
- * @param al
- */
- protected void propagateDatasetMappings(Alignment al)
- {
- if (codonframe!=null)
- {
- SequenceI[] alignment = al.getSequencesArray();
- for (int sq = 0; sq<alignment.length; sq++)
- {
- for (int i=0; i<codonframe.length; i++)
- {
- if (codonframe[i]!=null &&
- codonframe[i].involvesSequence(alignment[sq]))
- {
- al.addCodonFrame(codonframe[i]);
- codonframe[i] = null;
- break;
- }
- }
- }
- }
- }
-
- /**
- *
- * @param alignFrame reference for copying mappings across
- * @param wsInfo gui attachment point
- * @param input input data for the calculation
- * @param webServiceName name of service
- * @param wsUrl url of the service being invoked
- */
- public WSThread(AlignFrame alignFrame, WebserviceInfo wsinfo,
- AlignmentView input, String webServiceName,
- String wsUrl)
- {
- this(alignFrame, wsinfo, input, wsUrl);
- WebServiceName = webServiceName;
- }
- char defGapChar = '-';
- /**
- *
- * @return gap character to use for any alignment generation
- */
- public char getGapChar()
- {
- return defGapChar;
- }
-
- /**
- *
- * @param alframe - reference for copying mappings and display styles across
- * @param wsinfo2 - gui attachment point
- * @param alview - input data for the calculation
- * @param wsurl2 - url of the service being invoked
- */
- public WSThread(AlignFrame alframe, WebserviceInfo wsinfo2,
- AlignmentView alview, String wsurl2)
- {
- super();
- // this.alignFrame = alframe;
- currentView = alframe.getCurrentView().getAlignment();
- featureSettings = alframe.getFeatureRenderer().getSettings();
- defGapChar = alframe.getViewport().getGapCharacter();
- this.wsInfo = wsinfo2;
- this.input = alview;
- WsUrl = wsurl2;
- if (alframe!=null)
- {
- AlignedCodonFrame[] cf = alframe.getViewport().getAlignment().getCodonFrames();
- if (cf!=null)
- {
- codonframe = new AlignedCodonFrame[cf.length];
- System.arraycopy(cf, 0, codonframe, 0, cf.length);
- }
- }
- }
-}
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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 javax.swing.*;\r
+\r
+import jalview.bin.*;\r
+import jalview.datamodel.*;\r
+import jalview.gui.*;\r
+import jalview.gui.FeatureRenderer.FeatureRendererSettings;\r
+\r
+public abstract class WSThread\r
+ extends Thread\r
+{\r
+ /**\r
+ * Generic properties for Web Service Client threads.\r
+ */\r
+ /**\r
+ * view that this job was associated with\r
+ */\r
+ AlignmentI currentView = null;\r
+ /**\r
+ * feature settings from view that job was associated with\r
+ */\r
+ FeatureRendererSettings featureSettings = null;\r
+ /**\r
+ * metadata about this web service\r
+ */\r
+ WebserviceInfo wsInfo = null;\r
+ /**\r
+ * original input data for this job\r
+ */\r
+ AlignmentView input = null;\r
+ /**\r
+ * dataset sequence relationships to be propagated onto new results\r
+ */\r
+ AlignedCodonFrame[] codonframe = null;\r
+ /**\r
+ * are there jobs still running in this thread.\r
+ */\r
+ boolean jobComplete = false;\r
+ \r
+ abstract class WSJob\r
+ {\r
+ /**\r
+ * Generic properties for an individual job within a Web Service Client thread\r
+ */\r
+ int jobnum = 0; // WebServiceInfo pane for this job\r
+ String jobId; // ws job ticket\r
+ /**\r
+ * has job been cancelled\r
+ */\r
+ boolean cancelled = false;\r
+ /**\r
+ * number of exceptions left before job dies\r
+ */\r
+ int allowedServerExceptions = 3;\r
+ /**\r
+ * has job been submitted\r
+ */\r
+ boolean submitted = false;\r
+ /**\r
+ * are all sub-jobs complete\r
+ */\r
+ boolean subjobComplete = false;\r
+ /**\r
+ *\r
+ * @return true if job has completed and valid results are available\r
+ */\r
+ abstract boolean hasResults();\r
+\r
+ /**\r
+ *\r
+ * @return boolean true if job can be submitted.\r
+ */\r
+ abstract boolean hasValidInput();\r
+\r
+ /**\r
+ * The last result object returned by the service.\r
+ */\r
+ vamsas.objects.simple.Result result;\r
+ }\r
+\r
+ class JobStateSummary\r
+ {\r
+ /**\r
+ * number of jobs running\r
+ */\r
+ int running = 0;\r
+ /**\r
+ * number of jobs queued\r
+ */\r
+ int queuing = 0;\r
+ /**\r
+ * number of jobs finished\r
+ */\r
+ int finished = 0;\r
+ /**\r
+ * number of jobs failed\r
+ */\r
+ int error = 0;\r
+ /**\r
+ * number of jobs stopped due to server error\r
+ */\r
+ int serror = 0;\r
+ /**\r
+ * number of jobs cancelled\r
+ */\r
+ int cancelled = 0;\r
+ /**\r
+ * number of jobs finished with results\r
+ */\r
+ int results = 0;\r
+ /**\r
+ * processes WSJob and updates job status counters and WebService status displays\r
+ * @param wsInfo\r
+ * @param OutputHeader\r
+ * @param j\r
+ */\r
+ void updateJobPanelState(WebserviceInfo wsInfo, String OutputHeader,\r
+ WSJob j)\r
+ {\r
+ if (j.result != null)\r
+ {\r
+ String progheader = "";\r
+ // Parse state of job[j]\r
+ if (j.result.isRunning())\r
+ {\r
+ running++;\r
+ wsInfo.setStatus(j.jobnum, WebserviceInfo.STATE_RUNNING);\r
+ }\r
+ else if (j.result.isQueued())\r
+ {\r
+ queuing++;\r
+ wsInfo.setStatus(j.jobnum, WebserviceInfo.STATE_QUEUING);\r
+ }\r
+ else if (j.result.isFinished())\r
+ {\r
+ finished++;\r
+ j.subjobComplete = true;\r
+ if (j.hasResults())\r
+ {\r
+ results++;\r
+ }\r
+ wsInfo.setStatus(j.jobnum, WebserviceInfo.STATE_STOPPED_OK);\r
+ }\r
+ else if (j.result.isFailed())\r
+ {\r
+ progheader += "Job failed.\n";\r
+ j.subjobComplete = true;\r
+ wsInfo.setStatus(j.jobnum, WebserviceInfo.STATE_STOPPED_ERROR);\r
+ error++;\r
+ }\r
+ else if (j.result.isServerError())\r
+ {\r
+ serror++;\r
+ j.subjobComplete = true;\r
+ wsInfo.setStatus(j.jobnum,\r
+ WebserviceInfo.STATE_STOPPED_SERVERERROR);\r
+ }\r
+ else if (j.result.isBroken() || j.result.isFailed())\r
+ {\r
+ error++;\r
+ j.subjobComplete = true;\r
+ wsInfo.setStatus(j.jobnum, WebserviceInfo.STATE_STOPPED_ERROR);\r
+ }\r
+ // and pass on any sub-job messages to the user\r
+ wsInfo.setProgressText(j.jobnum, OutputHeader);\r
+ wsInfo.appendProgressText(j.jobnum, progheader);\r
+ if (j.result.getStatus() != null)\r
+ {\r
+ wsInfo.appendProgressText(j.jobnum, j.result.getStatus());\r
+ }\r
+ }\r
+ else\r
+ {\r
+ if (j.submitted && j.subjobComplete)\r
+ {\r
+ if (j.allowedServerExceptions == 0)\r
+ {\r
+ serror++;\r
+ }\r
+ else if (j.result == null)\r
+ {\r
+ error++;\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+ /**\r
+ * one or more jobs being managed by this thread.\r
+ */\r
+ WSJob jobs[] = null;\r
+ /**\r
+ * full name of service\r
+ */\r
+ String WebServiceName = null;\r
+ String OutputHeader;\r
+ String WsUrl = null;\r
+ /**\r
+ * query web service for status of job.\r
+ * on return, job.result must not be null - if it is then it will be\r
+ * assumed that the job status query timed out and a server exception\r
+ * will be logged.\r
+ * @param job\r
+ * @throws Exception will be logged as a server exception for this job\r
+ */\r
+ abstract void pollJob(WSJob job)\r
+ throws Exception;\r
+\r
+ public void run()\r
+ {\r
+ JobStateSummary jstate = null;\r
+ if (jobs == null)\r
+ {\r
+ jobComplete = true;\r
+ }\r
+ while (!jobComplete)\r
+ {\r
+ jstate = new JobStateSummary();\r
+ for (int j = 0; j < jobs.length; j++)\r
+ {\r
+\r
+ if (!jobs[j].submitted && jobs[j].hasValidInput())\r
+ {\r
+ StartJob(jobs[j]);\r
+ }\r
+\r
+ if (jobs[j].submitted && !jobs[j].subjobComplete)\r
+ {\r
+ try\r
+ {\r
+ pollJob(jobs[j]);\r
+ if (jobs[j].result == null)\r
+ {\r
+ throw (new Exception(\r
+ "Timed out when communicating with server\nTry again later.\n"));\r
+ }\r
+ jalview.bin.Cache.log.debug("Job " + j + " Result state " +\r
+ jobs[j].result.getState()\r
+ + "(ServerError=" +\r
+ jobs[j].result.isServerError() + ")");\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ // Deal with Transaction exceptions\r
+ wsInfo.appendProgressText(jobs[j].jobnum, "\n" + WebServiceName\r
+ + " Server exception!\n" + ex.getMessage());\r
+ Cache.log.warn(WebServiceName + " job(" + jobs[j].jobnum\r
+ + ") Server exception: " + ex.getMessage());\r
+\r
+ if (jobs[j].allowedServerExceptions > 0)\r
+ {\r
+ jobs[j].allowedServerExceptions--;\r
+ Cache.log.debug("Sleeping after a server exception.");\r
+ try\r
+ {\r
+ Thread.sleep(5000);\r
+ }\r
+ catch (InterruptedException ex1)\r
+ {\r
+ }\r
+ }\r
+ else\r
+ {\r
+ Cache.log.warn("Dropping job " + j + " " + jobs[j].jobId);\r
+ jobs[j].subjobComplete = true;\r
+ wsInfo.setStatus(jobs[j].jobnum,\r
+ WebserviceInfo.STATE_STOPPED_SERVERERROR);\r
+ }\r
+ }\r
+ catch (OutOfMemoryError er)\r
+ {\r
+ jobComplete = true;\r
+ jobs[j].subjobComplete = true;\r
+ jobs[j].result = null; // may contain out of date result object\r
+ wsInfo.setStatus(jobs[j].jobnum,\r
+ WebserviceInfo.STATE_STOPPED_ERROR);\r
+ JOptionPane\r
+ .showInternalMessageDialog(\r
+ Desktop.desktop,\r
+ "Out of memory handling result for job !!"\r
+ +\r
+ "\nSee help files for increasing Java Virtual Machine memory.",\r
+ "Out of memory", JOptionPane.WARNING_MESSAGE);\r
+ Cache.log.error("Out of memory when retrieving Job " + j + " id:" +\r
+ WsUrl + "/" + jobs[j].jobId, er);\r
+ System.gc();\r
+ }\r
+ }\r
+ jstate.updateJobPanelState(wsInfo, OutputHeader, jobs[j]);\r
+ }\r
+ // Decide on overall state based on collected jobs[] states\r
+ if (jstate.running > 0)\r
+ {\r
+ wsInfo.setStatus(WebserviceInfo.STATE_RUNNING);\r
+ }\r
+ else if (jstate.queuing > 0)\r
+ {\r
+ wsInfo.setStatus(WebserviceInfo.STATE_QUEUING);\r
+ }\r
+ else\r
+ {\r
+ jobComplete = true;\r
+ if (jstate.finished > 0)\r
+ {\r
+ wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_OK);\r
+ }\r
+ else if (jstate.error > 0)\r
+ {\r
+ wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR);\r
+ }\r
+ else if (jstate.serror > 0)\r
+ {\r
+ wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_SERVERERROR);\r
+ }\r
+ }\r
+ if (!jobComplete)\r
+ {\r
+ try\r
+ {\r
+ Thread.sleep(5000);\r
+ }\r
+ catch (InterruptedException e)\r
+ {\r
+ Cache.log.debug("Interrupted sleep waiting for next job poll.", e);\r
+ }\r
+ // System.out.println("I'm alive "+alTitle);\r
+ }\r
+ }\r
+ if (jobComplete && jobs != null)\r
+ {\r
+ parseResult(); // tidy up and make results available to user\r
+ }\r
+ else\r
+ {\r
+ Cache.log.debug("WebServiceJob poll loop finished with no jobs created.");\r
+ wsInfo.setFinishedNoResults();\r
+ }\r
+ }\r
+\r
+ /**\r
+ * submit job to web service\r
+ * @param job\r
+ */\r
+ abstract void StartJob(WSJob job);\r
+\r
+ /**\r
+ * process the set of WSJob objects into a set of results, and tidy up.\r
+ */\r
+ abstract void parseResult();\r
+\r
+ /**\r
+ * helper function to conserve dataset references to sequence objects returned from web services\r
+ * 1. Propagates AlCodonFrame data from <code>codonframe</code> to <code>al</code>\r
+ * @param al\r
+ */\r
+ protected void propagateDatasetMappings(Alignment al)\r
+ {\r
+ if (codonframe!=null)\r
+ {\r
+ SequenceI[] alignment = al.getSequencesArray();\r
+ for (int sq = 0; sq<alignment.length; sq++)\r
+ {\r
+ for (int i=0; i<codonframe.length; i++)\r
+ {\r
+ if (codonframe[i]!=null &&\r
+ codonframe[i].involvesSequence(alignment[sq]))\r
+ {\r
+ al.addCodonFrame(codonframe[i]);\r
+ codonframe[i] = null;\r
+ break;\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ /**\r
+ * \r
+ * @param alignFrame reference for copying mappings across\r
+ * @param wsInfo gui attachment point\r
+ * @param input input data for the calculation\r
+ * @param webServiceName name of service\r
+ * @param wsUrl url of the service being invoked\r
+ */\r
+ public WSThread(AlignFrame alignFrame, WebserviceInfo wsinfo,\r
+ AlignmentView input, String webServiceName,\r
+ String wsUrl)\r
+ {\r
+ this(alignFrame, wsinfo, input, wsUrl);\r
+ WebServiceName = webServiceName;\r
+ }\r
+ char defGapChar = '-';\r
+ /**\r
+ * \r
+ * @return gap character to use for any alignment generation\r
+ */\r
+ public char getGapChar()\r
+ {\r
+ return defGapChar;\r
+ }\r
+\r
+ /**\r
+ * \r
+ * @param alframe - reference for copying mappings and display styles across\r
+ * @param wsinfo2 - gui attachment point\r
+ * @param alview - input data for the calculation\r
+ * @param wsurl2 - url of the service being invoked\r
+ */\r
+ public WSThread(AlignFrame alframe, WebserviceInfo wsinfo2,\r
+ AlignmentView alview, String wsurl2)\r
+ {\r
+ super();\r
+ // this.alignFrame = alframe;\r
+ currentView = alframe.getCurrentView().getAlignment();\r
+ featureSettings = alframe.getFeatureRenderer().getSettings();\r
+ defGapChar = alframe.getViewport().getGapCharacter();\r
+ this.wsInfo = wsinfo2;\r
+ this.input = alview;\r
+ WsUrl = wsurl2;\r
+ if (alframe!=null)\r
+ {\r
+ AlignedCodonFrame[] cf = alframe.getViewport().getAlignment().getCodonFrames();\r
+ if (cf!=null)\r
+ {\r
+ codonframe = new AlignedCodonFrame[cf.length];\r
+ System.arraycopy(cf, 0, codonframe, 0, cf.length);\r
+ }\r
+ }\r
+ }\r
+}\r
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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.dbsources;\r
\r
import java.util.Hashtable;\r
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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.dbsources;\r
\r
import java.io.BufferedReader;\r
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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.dbsources;\r
\r
import java.util.Hashtable;\r
-/**\r
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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.dbsources;\r
\r
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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.dbsources;\r
\r
import jalview.datamodel.Alignment;\r
return al;\r
}\r
\r
-}
\ No newline at end of file
+}\r
-/**\r
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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.dbsources;\r
\r
-/**\r
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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.dbsources;\r
\r
-/**\r
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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.dbsources;\r
\r
-/**\r
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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.dbsources;\r
\r
-/**\r
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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.dbsources;\r
\r
-/**
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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.dbsources;
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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.dbsources;\r
\r
/**\r
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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.dbsources.das;\r
\r
import jalview.datamodel.AlignmentI;\r
-/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 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.ebi;
-
-import java.io.*;
-import java.util.*;
-import javax.xml.namespace.*;
-import javax.xml.rpc.*;
-
-import org.apache.axis.client.Call;
-import org.apache.axis.client.Service;
-import org.apache.axis.encoding.*;
-
-/**
- * DOCUMENT ME!
- *
- * @author $author$
- * @version $Revision$
- */
-public class EBIFetchClient
-{
- Call call;
- String format = "default";
- String style = "raw";
-
- /**
- * Creates a new EBIFetchClient object.
- */
- public EBIFetchClient()
- {
- try
- {
- call = (Call)new Service().createCall();
- call.setTargetEndpointAddress(new java.net.URL(
- "http://www.ebi.ac.uk/ws/services/Dbfetch"));
- }
- catch (Exception ex)
- {
- }
- }
-
- /**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
- public String[] getSupportedDBs()
- {
- try
- {
- call.setOperationName(new QName("urn:Dbfetch", "getSupportedDBs"));
- call.setReturnType(XMLType.SOAP_ARRAY);
-
- return (String[]) call.invoke(new Object[]
- {});
- }
- catch (Exception ex)
- {
- return null;
- }
- }
-
- /**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
- public String[] getSupportedFormats()
- {
- try
- {
- call.setOperationName(new QName("urn:Dbfetch", "getSupportedFormats"));
- call.setReturnType(XMLType.SOAP_ARRAY);
-
- return (String[]) call.invoke(new Object[]
- {});
- }
- catch (Exception ex)
- {
- return null;
- }
- }
-
- /**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
- public String[] getSupportedStyles()
- {
- try
- {
- call.setOperationName(new QName("urn:Dbfetch", "getSupportedStyles"));
- call.setReturnType(XMLType.SOAP_ARRAY);
-
- return (String[]) call.invoke(new Object[]
- {});
- }
- catch (Exception ex)
- {
- return null;
- }
- }
-
-
- public File fetchDataAsFile(String ids, String f, String s)
- {
- String[] data = fetchData(ids, f, s);
- File outFile = null;
- try
- {
- outFile = File.createTempFile("jalview", ".xml");
- outFile.deleteOnExit();
- PrintWriter out = new PrintWriter(new FileOutputStream(outFile));
- int index = 0;
- while (index < data.length)
- {
- out.println(data[index]);
- index++;
- }
- out.close();
- }
- catch (Exception ex)
- {}
- return outFile;
- }
-
- /**
- * Single DB multiple record retrieval
- *
- * @param ids db:query1;query2;query3
- * @param f raw/xml
- * @param s ?
- *
- * @return Raw string array result of query set
- */
- public String[] fetchData(String ids, String f, String s)
- {
- // Need to split
- // ids of the form uniprot:25KD_SARPE;ADHR_DROPS;
- StringTokenizer queries = new StringTokenizer(ids, ";");
- String db = null;
- StringBuffer querystring = null;
- while (queries.hasMoreTokens())
- {
- String query = queries.nextToken();
- int p;
- if ( (p = query.indexOf(':')) > -1)
- {
- db = query.substring(0, p);
- query = query.substring(p + 1);
- }
- if (querystring == null)
- {
- querystring = new StringBuffer(query);
- }
- else
- {
- querystring.append("," + query);
- }
- }
- if (db == null)
- {
- System.err.println("Invalid Query string : '" + ids +
- "'\nShould be of form 'dbname:q1;q2;q3;q4'");
- }
- return fetchBatch(querystring.toString(), db, f, s);
- }
-
- public String[] fetchBatch(String ids, String db, String f, String s)
- {
- // max 50 ids can be added at one time
- try
- {
- //call.setOperationName(new QName("urn:Dbfetch", "fetchData"));
- call.setOperationName(new QName("urn:Dbfetch", "fetchBatch"));
- call.addParameter("ids", XMLType.XSD_STRING, ParameterMode.IN);
- call.addParameter("db", XMLType.XSD_STRING, ParameterMode.IN);
- call.addParameter("format", XMLType.XSD_STRING, ParameterMode.IN);
- call.addParameter("style", XMLType.XSD_STRING, ParameterMode.IN);
- call.setReturnType(XMLType.SOAP_ARRAY);
-
- if (f != null)
- {
- format = f;
- }
-
- if (s != null)
- {
- style = s;
- }
-
- try
- {
- return (String[]) call.invoke(new Object[]
- {ids.toLowerCase(), db.toLowerCase(),
- format, style});
- }
- catch (OutOfMemoryError er)
- {
- System.out.println("OUT OF MEMORY DOWNLOADING QUERY FROM " + db + ":\n" +
- ids);
- }
- return null;
- }
- catch (Exception ex)
- {
- if (ex.getMessage().startsWith(
- "uk.ac.ebi.jdbfetch.exceptions.DbfNoEntryFoundException"))
- {
- return null;
- }
- System.err.println("Unexpected exception when retrieving from " + db +
- "\nQuery was : '" + ids + "'");
- ex.printStackTrace(System.err);
- return null;
- }
- }
-}
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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.ebi;\r
+\r
+import java.io.*;\r
+import java.util.*;\r
+import javax.xml.namespace.*;\r
+import javax.xml.rpc.*;\r
+\r
+import org.apache.axis.client.Call;\r
+import org.apache.axis.client.Service;\r
+import org.apache.axis.encoding.*;\r
+\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
+ /**\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
+ }\r
+ catch (Exception ex)\r
+ {\r
+ }\r
+ }\r
+\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
+ {});\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ return null;\r
+ }\r
+ }\r
+\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
+ {});\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ return null;\r
+ }\r
+ }\r
+\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
+ {});\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ return null;\r
+ }\r
+ }\r
+\r
+\r
+ public File fetchDataAsFile(String ids, String f, String s)\r
+ {\r
+ String[] data = fetchData(ids, f, s);\r
+ File outFile = null;\r
+ try\r
+ {\r
+ outFile = File.createTempFile("jalview", ".xml");\r
+ outFile.deleteOnExit();\r
+ PrintWriter out = new PrintWriter(new FileOutputStream(outFile));\r
+ int index = 0;\r
+ while (index < data.length)\r
+ {\r
+ out.println(data[index]);\r
+ index++;\r
+ }\r
+ out.close();\r
+ }\r
+ catch (Exception ex)\r
+ {}\r
+ return outFile;\r
+ }\r
+\r
+ /**\r
+ * Single DB multiple record retrieval\r
+ *\r
+ * @param ids db:query1;query2;query3\r
+ * @param f raw/xml\r
+ * @param s ?\r
+ *\r
+ * @return Raw string array result of query set\r
+ */\r
+ public String[] fetchData(String ids, String f, String s)\r
+ {\r
+ // Need to split\r
+ // ids of the form uniprot:25KD_SARPE;ADHR_DROPS;\r
+ StringTokenizer queries = new StringTokenizer(ids, ";");\r
+ String db = null;\r
+ StringBuffer querystring = null;\r
+ while (queries.hasMoreTokens())\r
+ {\r
+ String query = queries.nextToken();\r
+ int p;\r
+ if ( (p = query.indexOf(':')) > -1)\r
+ {\r
+ db = query.substring(0, p);\r
+ query = query.substring(p + 1);\r
+ }\r
+ if (querystring == null)\r
+ {\r
+ querystring = new StringBuffer(query);\r
+ }\r
+ else\r
+ {\r
+ querystring.append("," + query);\r
+ }\r
+ }\r
+ if (db == null)\r
+ {\r
+ System.err.println("Invalid Query string : '" + ids +\r
+ "'\nShould be of form 'dbname:q1;q2;q3;q4'");\r
+ }\r
+ return fetchBatch(querystring.toString(), db, f, s);\r
+ }\r
+\r
+ public String[] fetchBatch(String ids, String db, String f, String s)\r
+ {\r
+ // max 50 ids can be added at one time\r
+ try\r
+ {\r
+ //call.setOperationName(new QName("urn:Dbfetch", "fetchData"));\r
+ call.setOperationName(new QName("urn:Dbfetch", "fetchBatch"));\r
+ call.addParameter("ids", XMLType.XSD_STRING, ParameterMode.IN);\r
+ call.addParameter("db", 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
+ {\r
+ format = f;\r
+ }\r
+\r
+ if (s != null)\r
+ {\r
+ style = s;\r
+ }\r
+\r
+ try\r
+ {\r
+ return (String[]) call.invoke(new Object[]\r
+ {ids.toLowerCase(), db.toLowerCase(),\r
+ format, style});\r
+ }\r
+ catch (OutOfMemoryError er)\r
+ {\r
+ System.out.println("OUT OF MEMORY DOWNLOADING QUERY FROM " + db + ":\n" +\r
+ ids);\r
+ }\r
+ return null;\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ if (ex.getMessage().startsWith(\r
+ "uk.ac.ebi.jdbfetch.exceptions.DbfNoEntryFoundException"))\r
+ {\r
+ return null;\r
+ }\r
+ System.err.println("Unexpected exception when retrieving from " + db +\r
+ "\nQuery was : '" + ids + "'");\r
+ ex.printStackTrace(System.err);\r
+ return null;\r
+ }\r
+ }\r
+}\r
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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.seqfetcher;\r
\r
import jalview.datamodel.AlignmentI;\r
return false;\r
}\r
\r
-}
\ No newline at end of file
+}\r
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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.seqfetcher;\r
\r
import jalview.datamodel.AlignmentI;\r
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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.seqfetcher;\r
\r
import jalview.datamodel.Alignment;\r
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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 vamsas;
import vamsas.objects.simple.*;
-/**
- * Alignment.java
- *
- * This file was auto-generated from WSDL
- * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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 vamsas.objects.simple;
public class Alignment extends vamsas.objects.simple.Object implements java.io.Serializable {
-/**
- * Alignment_Helper.java
- *
- * This file was auto-generated from WSDL
- * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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 vamsas.objects.simple;
public class Alignment_Helper {
-/**
- * JpredResult.java
- *
- * This file was auto-generated from WSDL
- * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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 vamsas.objects.simple;
public class JpredResult
-/**
- * JpredResult_Helper.java
- *
- * This file was auto-generated from WSDL
- * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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 vamsas.objects.simple;
public class JpredResult_Helper
-/**\r
- * MsaResult.java\r
- *\r
- * This file was auto-generated from WSDL\r
- * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.\r
- */\r
-\r
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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 vamsas.objects.simple;\r
-\r
-public class MsaResult\r
- extends vamsas.objects.simple.Result implements java.io.Serializable\r
-{\r
- private vamsas.objects.simple.Alignment msa;\r
- private java.lang.Object __equalsCalc = null;\r
- private boolean __hashCodeCalc = false;\r
-\r
- public MsaResult()\r
- {\r
- }\r
-\r
- public MsaResult(vamsas.objects.simple.Alignment msa)\r
- {\r
- this.msa = msa;\r
- }\r
-\r
- /**\r
- * Gets the msa value for this MsaResult.\r
- *\r
- * @return msa\r
- */\r
- public vamsas.objects.simple.Alignment getMsa()\r
- {\r
- return msa;\r
- }\r
-\r
- /**\r
- * Sets the msa value for this MsaResult.\r
- *\r
- * @param msa\r
- */\r
- public void setMsa(vamsas.objects.simple.Alignment msa)\r
- {\r
- this.msa = msa;\r
- }\r
-\r
- public synchronized boolean equals(java.lang.Object obj)\r
- {\r
- if (! (obj instanceof MsaResult))\r
- {\r
- return false;\r
- }\r
-\r
- MsaResult other = (MsaResult) obj;\r
-\r
- if (obj == null)\r
- {\r
- return false;\r
- }\r
-\r
- if (this == obj)\r
- {\r
- return true;\r
- }\r
-\r
- if (__equalsCalc != null)\r
- {\r
- return (__equalsCalc == obj);\r
- }\r
-\r
- __equalsCalc = obj;\r
-\r
- boolean _equals;\r
- _equals = super.equals(obj) &&\r
- ( ( (this.msa == null) && (other.getMsa() == null)) ||\r
- ( (this.msa != null) && this.msa.equals(other.getMsa())));\r
- __equalsCalc = null;\r
-\r
- return _equals;\r
- }\r
-\r
- public synchronized int hashCode()\r
- {\r
- if (__hashCodeCalc)\r
- {\r
- return 0;\r
- }\r
-\r
- __hashCodeCalc = true;\r
-\r
- int _hashCode = super.hashCode();\r
-\r
- if (getMsa() != null)\r
- {\r
- _hashCode += getMsa().hashCode();\r
- }\r
-\r
- __hashCodeCalc = false;\r
-\r
- return _hashCode;\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
+ */
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer
+ * Copyright (C) 2007 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 vamsas.objects.simple;
+
+public class MsaResult
+ extends vamsas.objects.simple.Result implements java.io.Serializable
+{
+ private vamsas.objects.simple.Alignment msa;
+ private java.lang.Object __equalsCalc = null;
+ private boolean __hashCodeCalc = false;
+
+ public MsaResult()
+ {
+ }
+
+ public MsaResult(vamsas.objects.simple.Alignment msa)
+ {
+ this.msa = msa;
+ }
+
+ /**
+ * Gets the msa value for this MsaResult.
+ *
+ * @return msa
+ */
+ public vamsas.objects.simple.Alignment getMsa()
+ {
+ return msa;
+ }
+
+ /**
+ * Sets the msa value for this MsaResult.
+ *
+ * @param msa
+ */
+ public void setMsa(vamsas.objects.simple.Alignment msa)
+ {
+ this.msa = msa;
+ }
+
+ public synchronized boolean equals(java.lang.Object obj)
+ {
+ if (! (obj instanceof MsaResult))
+ {
+ return false;
+ }
+
+ MsaResult other = (MsaResult) obj;
+
+ if (obj == null)
+ {
+ return false;
+ }
+
+ if (this == obj)
+ {
+ return true;
+ }
+
+ if (__equalsCalc != null)
+ {
+ return (__equalsCalc == obj);
+ }
+
+ __equalsCalc = obj;
+
+ boolean _equals;
+ _equals = super.equals(obj) &&
+ ( ( (this.msa == null) && (other.getMsa() == null)) ||
+ ( (this.msa != null) && this.msa.equals(other.getMsa())));
+ __equalsCalc = null;
+
+ return _equals;
+ }
+
+ public synchronized int hashCode()
+ {
+ if (__hashCodeCalc)
+ {
+ return 0;
+ }
+
+ __hashCodeCalc = true;
+
+ int _hashCode = super.hashCode();
+
+ if (getMsa() != null)
+ {
+ _hashCode += getMsa().hashCode();
+ }
+
+ __hashCodeCalc = false;
+
+ return _hashCode;
+ }
+}
-/**\r
- * MsaResult_Helper.java\r
- *\r
- * This file was auto-generated from WSDL\r
- * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.\r
- */\r
-\r
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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 vamsas.objects.simple;\r
-\r
-public class MsaResult_Helper\r
-{\r
- // Type metadata\r
- private static org.apache.axis.description.TypeDesc typeDesc = new org.apache.\r
- axis.description.TypeDesc(MsaResult.class,\r
- true);\r
-\r
- static\r
- {\r
- typeDesc.setXmlType(new javax.xml.namespace.QName(\r
- "simple.objects.vamsas", "MsaResult"));\r
-\r
- org.apache.axis.description.ElementDesc elemField = new org.apache.axis.\r
- description.ElementDesc();\r
- elemField.setFieldName("msa");\r
- elemField.setXmlName(new javax.xml.namespace.QName("", "msa"));\r
- elemField.setXmlType(new javax.xml.namespace.QName(\r
- "simple.objects.vamsas", "Alignment"));\r
- typeDesc.addFieldDesc(elemField);\r
- }\r
-\r
- /**\r
- * Return type metadata object\r
- */\r
- public static org.apache.axis.description.TypeDesc getTypeDesc()\r
- {\r
- return typeDesc;\r
- }\r
-\r
- /**\r
- * Get Custom Serializer\r
- */\r
- public static org.apache.axis.encoding.Serializer getSerializer(\r
- java.lang.String mechType, java.lang.Class _javaType,\r
- javax.xml.namespace.QName _xmlType)\r
- {\r
- return new org.apache.axis.encoding.ser.BeanSerializer(_javaType,\r
- _xmlType, typeDesc);\r
- }\r
-\r
- /**\r
- * Get Custom Deserializer\r
- */\r
- public static org.apache.axis.encoding.Deserializer getDeserializer(\r
- java.lang.String mechType, java.lang.Class _javaType,\r
- javax.xml.namespace.QName _xmlType)\r
- {\r
- return new org.apache.axis.encoding.ser.BeanDeserializer(_javaType,\r
- _xmlType, typeDesc);\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
+ */
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer
+ * Copyright (C) 2007 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 vamsas.objects.simple;
+
+public class MsaResult_Helper
+{
+ // Type metadata
+ private static org.apache.axis.description.TypeDesc typeDesc = new org.apache.
+ axis.description.TypeDesc(MsaResult.class,
+ true);
+
+ static
+ {
+ typeDesc.setXmlType(new javax.xml.namespace.QName(
+ "simple.objects.vamsas", "MsaResult"));
+
+ org.apache.axis.description.ElementDesc elemField = new org.apache.axis.
+ description.ElementDesc();
+ elemField.setFieldName("msa");
+ elemField.setXmlName(new javax.xml.namespace.QName("", "msa"));
+ elemField.setXmlType(new javax.xml.namespace.QName(
+ "simple.objects.vamsas", "Alignment"));
+ typeDesc.addFieldDesc(elemField);
+ }
+
+ /**
+ * Return type metadata object
+ */
+ public static org.apache.axis.description.TypeDesc getTypeDesc()
+ {
+ return typeDesc;
+ }
+
+ /**
+ * Get Custom Serializer
+ */
+ public static org.apache.axis.encoding.Serializer getSerializer(
+ java.lang.String mechType, java.lang.Class _javaType,
+ javax.xml.namespace.QName _xmlType)
+ {
+ return new org.apache.axis.encoding.ser.BeanSerializer(_javaType,
+ _xmlType, typeDesc);
+ }
+
+ /**
+ * Get Custom Deserializer
+ */
+ public static org.apache.axis.encoding.Deserializer getDeserializer(
+ java.lang.String mechType, java.lang.Class _javaType,
+ javax.xml.namespace.QName _xmlType)
+ {
+ return new org.apache.axis.encoding.ser.BeanDeserializer(_javaType,
+ _xmlType, typeDesc);
+ }
+}
-/**
- * Msfalignment.java
- *
- * This file was auto-generated from WSDL
- * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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 vamsas.objects.simple;
public class Msfalignment
-/**
- * Msfalignment_Helper.java
- *
- * This file was auto-generated from WSDL
- * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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 vamsas.objects.simple;
public class Msfalignment_Helper
-/**
- * Object.java
- *
- * This file was auto-generated from WSDL
- * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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 vamsas.objects.simple;
public abstract class Object implements java.io.Serializable {
-/**
- * Object_Helper.java
- *
- * This file was auto-generated from WSDL
- * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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 vamsas.objects.simple;
public class Object_Helper {
-/**
- * Result.java
- *
- * This file was auto-generated from WSDL
- * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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 vamsas.objects.simple;
public class Result implements java.io.Serializable {
-/**
- * Result_Helper.java
- *
- * This file was auto-generated from WSDL
- * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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 vamsas.objects.simple;
public class Result_Helper {
-/**
- * Secstructpred.java
- *
- * This file was auto-generated from WSDL
- * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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 vamsas.objects.simple;
public class Secstructpred
-/**
- * Secstructpred_Helper.java
- *
- * This file was auto-generated from WSDL
- * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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 vamsas.objects.simple;
public class Secstructpred_Helper
-/**\r
- * SeqSearchResult.java\r
- *\r
- * This file was auto-generated from WSDL\r
- * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.\r
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package vamsas.objects.simple;\r
\r
public class SeqSearchResult extends vamsas.objects.simple.Result implements java.io.Serializable {\r
-/**\r
- * SeqSearchResult_Helper.java\r
- *\r
- * This file was auto-generated from WSDL\r
- * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.\r
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 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
package vamsas.objects.simple;\r
\r
public class SeqSearchResult_Helper {\r
-/**
- * Sequence.java
- *
- * This file was auto-generated from WSDL
- * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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 vamsas.objects.simple;
public class Sequence implements java.io.Serializable {
-/**
- * SequenceSet.java
- *
- * This file was auto-generated from WSDL
- * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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 vamsas.objects.simple;
public class SequenceSet implements java.io.Serializable {
-/**
- * SequenceSet_Helper.java
- *
- * This file was auto-generated from WSDL
- * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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 vamsas.objects.simple;
public class SequenceSet_Helper {
-/**
- * Sequence_Helper.java
- *
- * This file was auto-generated from WSDL
- * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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 vamsas.objects.simple;
public class Sequence_Helper {
-/**
- * WsJobId.java
- *
- * This file was auto-generated from WSDL
- * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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 vamsas.objects.simple;
public class WsJobId implements java.io.Serializable {
-/**
- * WsJobId_Helper.java
- *
- * This file was auto-generated from WSDL
- * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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 vamsas.objects.simple;
public class WsJobId_Helper {
-import java.io.*;\r
-import java.util.*;\r
-\r
-public class help2Website\r
-{\r
-\r
- public static void main(String [] args)\r
- {\r
- String line = "";\r
- try{\r
- Hashtable targets = new Hashtable();\r
-\r
- File toc = new File("helpTOC.xml");\r
- File jhm = new File("help.jhm");\r
-\r
- BufferedReader in = new BufferedReader(new FileReader(jhm));\r
-\r
- PrintWriter out = new PrintWriter(new FileWriter("helpTOC.html"));\r
- out.println("<html><head><title>Jalview - Help </title></head>\n"\r
- +"<body bgcolor=#F1F1F1>\n"\r
- +"<p><center><strong>Contents</strong></center></p>\n");\r
-\r
-\r
- StringTokenizer st;\r
- StringBuffer indent = new StringBuffer();\r
- String target, url, text;\r
- while( (line = in.readLine()) != null)\r
- {\r
- if(line.indexOf("target")==-1)\r
- continue;\r
-\r
-\r
- st = new StringTokenizer(line, "\"");\r
- st.nextToken(); //<mapID target="\r
-\r
- target = st.nextToken();\r
- st.nextToken(); //" url="\r
-\r
- url = st.nextToken();\r
- targets.put(target, url);\r
- }\r
-\r
- in = new BufferedReader(new FileReader(toc));\r
- while( (line = in.readLine()) != null)\r
- {\r
- if(line.indexOf("</tocitem>")!=-1)\r
- indent.setLength(indent.length()-18);\r
-\r
- if(line.indexOf("<tocitem")==-1)\r
- continue;\r
-\r
- st = new StringTokenizer(line, "\"");\r
- st.nextToken();\r
-\r
- text = st.nextToken();\r
- st.nextToken();\r
-\r
- target = st.nextToken();\r
-\r
- if(targets.get(target)!=null)\r
- out.println("<br>"+indent+"<a href=\""\r
- + targets.get(target)\r
- +"\" target=bodyframe>"\r
- +text\r
- +"</a>");\r
- else\r
- out.println("<br>"+indent+text);\r
-\r
-\r
- if(line.indexOf("/>")==-1)\r
- indent.append(" ");\r
-\r
- }\r
-\r
- out.println("</body>\n</html>");\r
-\r
-\r
- out.close();\r
-\r
- }\r
-\r
- catch(Exception ex)\r
- {\r
-\r
- ex.printStackTrace();\r
-\r
- System.out.println("\n"+line+"\n");\r
-\r
- System.out.println("Usage: move to Help directory. help2Website will read"\r
- +"\nhelpTOC.xml and help.jhm producing output helpTOC.html");\r
- }\r
- }\r
-\r
-\r
-}
\ No newline at end of file
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
+ */
+import java.io.*;
+import java.util.*;
+
+public class help2Website
+{
+
+ public static void main(String [] args)
+ {
+ String line = "";
+ try{
+ Hashtable targets = new Hashtable();
+
+ File toc = new File("helpTOC.xml");
+ File jhm = new File("help.jhm");
+
+ BufferedReader in = new BufferedReader(new FileReader(jhm));
+
+ PrintWriter out = new PrintWriter(new FileWriter("helpTOC.html"));
+ out.println("<html><head><title>Jalview - Help </title></head>\n"
+ +"<body bgcolor=#F1F1F1>\n"
+ +"<p><center><strong>Contents</strong></center></p>\n");
+
+
+ StringTokenizer st;
+ StringBuffer indent = new StringBuffer();
+ String target, url, text;
+ while( (line = in.readLine()) != null)
+ {
+ if(line.indexOf("target")==-1)
+ continue;
+
+
+ st = new StringTokenizer(line, "\"");
+ st.nextToken(); //<mapID target="
+
+ target = st.nextToken();
+ st.nextToken(); //" url="
+
+ url = st.nextToken();
+ targets.put(target, url);
+ }
+
+ in = new BufferedReader(new FileReader(toc));
+ while( (line = in.readLine()) != null)
+ {
+ if(line.indexOf("</tocitem>")!=-1)
+ indent.setLength(indent.length()-18);
+
+ if(line.indexOf("<tocitem")==-1)
+ continue;
+
+ st = new StringTokenizer(line, "\"");
+ st.nextToken();
+
+ text = st.nextToken();
+ st.nextToken();
+
+ target = st.nextToken();
+
+ if(targets.get(target)!=null)
+ out.println("<br>"+indent+"<a href=\""
+ + targets.get(target)
+ +"\" target=bodyframe>"
+ +text
+ +"</a>");
+ else
+ out.println("<br>"+indent+text);
+
+
+ if(line.indexOf("/>")==-1)
+ indent.append(" ");
+
+ }
+
+ out.println("</body>\n</html>");
+
+
+ out.close();
+
+ }
+
+ catch(Exception ex)
+ {
+
+ ex.printStackTrace();
+
+ System.out.println("\n"+line+"\n");
+
+ System.out.println("Usage: move to Help directory. help2Website will read"
+ +"\nhelpTOC.xml and help.jhm producing output helpTOC.html");
+ }
+ }
+
+
+}