<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-<!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r
-<!--\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
--->\r
-<html xmlns="http://www.w3.org/1999/xhtml">\r
- <head>Developing Jalview</head>\r
- <body>\r
-<p><h1>Developing Jalview</h1>\r
-</p>\r
-<ul>\r
-<li>Basic Source Structure Guidelines</li>\r
-<li>The Applet and The Application - whats the difference ?</li>\r
-<li>Package Architecture<br>\r
-</li>\r
-<li>Specific Development Guidelines\r
-<ul>\r
-<li><a href="newdmobj.html">Adding new datamodel objects to Jalview</a></li>\r
-<li>Adding new IO capabilities to Jalview</li>\r
-<li>Adding new database types to Jalview</li>\r
-<li>Working with the Jalview DAS annotation fetcher</li>\r
-<li>Adding new analysis methods to jalview</li>\r
-<li>Adding new web service functionality to jalview</li>\r
-</ul>\r
-</li>\r
-</ul>\r
-</body>\r
-</html>\r
+<!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>Developing Jalview</head>
+ <body>
+<p><h1>Developing Jalview</h1>
+</p>
+<ul>
+<li>Basic Source Structure Guidelines</li>
+<li>The Applet and The Application - whats the difference ?</li>
+<li>Package Architecture<br>
+</li>
+<li>Specific Development Guidelines
+<ul>
+<li><a href="newdmobj.html">Adding new datamodel objects to Jalview</a></li>
+<li>Adding new IO capabilities to Jalview</li>
+<li>Adding new database types to Jalview</li>
+<li>Working with the Jalview DAS annotation fetcher</li>
+<li>Adding new analysis methods to jalview</li>
+<li>Adding new web service functionality to jalview</li>
+</ul>
+</li>
+</ul>
+</body>
+</html>
-<!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r
-<!--\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
--->\r
-<html xmlns="http://www.w3.org/1999/xhtml">\r
-<head>\r
-Jalview Source Documentation\r
-</head>\r
-<body>\r
-<h1>Jalview Source Documentation</h1>\r
-<p>The file structure of the Jalview Source tree is as follows:\r
-<ul>\r
- <li>README - basic info for getting started with the source tree.</li>\r
- <li>LICENCE - the GPL Licence</li>\r
- <li>RELEASE - contains the name of the tag for the latest\r
- 'official' Jalview release associated with the source.</li>\r
- <li>build.xml - ant build for jalview - the 'help' task gives\r
- information about each task, and there's lots of comments too.</li>\r
- <li></li>\r
- <li>src - all jalview source packages, including any specially\r
- adapted code from other GPL programs. See <a href="developing.html">Jalview\r
- Development</a> for more info.</li>\r
- <li>lib - All the libraries that Jalview depends on. Every jar\r
- file in this directory should be added to the classpath when building\r
- or running the jalview application.</li>\r
- <li>appletlib - Any libraries that are specifically required for compiling and/or running the jalviewLite applet (e.g. an applet build of Jmol).\r
- <li>help - the jalview JavaHelp documents<br>\r
- <ul>\r
- <li>help.hs - the main index page. This is generated by the\r
- jhindexer program run by the 'buildindices' task in build.xml</li>\r
- <li>help.jhm - helpTOC map - an XML document listing simple names\r
- for each html page that is linked to in the help contents structure.</li>\r
- <li>helpTOC.xml - the table of contents presented to the user\r
- when the help is opened.</li>\r
- <li>icons - widgets needed for the help system GUI</li>\r
- <li>html - the help documentation. It loosely follows the\r
- following structure: <br>\r
- <ul>\r
- <li>calculations - pages concerning the calculations menu</li>\r
- <li>webServices - pages describing web services</li>\r
- <li>colourSchemes - the ways amino acids can be coloured and the\r
- user interface for defining them</li>\r
- <li>editing - mechanisms and interfaces for editing alignments</li>\r
- <li>features - used to be the sequence features documentation,\r
- but now contains all sorts of jalview 'features'.</li>\r
- <li>io - getting data in and out of jalview</li>\r
- <li>menus - all the menus in Jalview (and the applet)</li>\r
- <li>misc - useful info</li>\r
- <li>By convention, we try to maintain the whatsNew.html document\r
- with each release and complete the releases.html matrix to detail\r
- what has changed from one version to another.</li>\r
- <li>keys.html contains all the keystrokes in Jalview - please\r
- keep this up to date.</li>\r
- </ul>\r
- </li>\r
- </ul>\r
- </li>\r
- <li>resources - files needed at run-time for jalview execution.<br>\r
- <ul>\r
- <li>images - icons used by jalview</li>\r
- <li>log4j and commons-logging.properties - configure default\r
- appenders and logging for Jalview, castor.</li>\r
- <li>embl_mapping.xml - castor mapping file for the EMBL XML\r
- Schema.</li>\r
- .\r
- <li>uniprot_mapping.xml - castor mapping file for the Uniprot XML\r
- Schema.</li>\r
- </ul>\r
- </li>\r
- <li>schemas - XML schema definitions used or understood by\r
- Jalview.<br>\r
- Jalview uses castor to bind java to XML - either using mapping files\r
- hand-crafted from a schema in this directory, or from java objects\r
- generated from the schema and an associated set of properties. <br>\r
- See the castorbinding task in the ant build.xml file for more info.\r
- <ul>\r
- <li>Jalview Project Archive XML Version 1<br>\r
- vamsasJvV1.xsd<br>\r
- jalviewJvV1.xsd<br>\r
- jalview.nodesc.properties - sourcegenerator properties file</li>\r
- <li>jalview Project Archive XML Version 2<br>\r
- Jalview works out which version a project is by first trying\r
- to parse XML with these schema definitions, and then if there are\r
- problems, falls back to the V1 schema classes.\r
- <ul>\r
- <li>vamsas.xsd<br>\r
- jalview.xsd<br>\r
- jalview.properties - sourcegenerator properties file</li>\r
- </ul></li>\r
- <li>JalviewUserColours.xsd is used by both V1 and V2 project XML\r
- definitions. This schema is also used to store user colour schemes\r
- externally from the project file.</li>\r
- </ul>\r
- </li>\r
- <li>utils - various resources needed when building or deploying\r
- jalview.\r
- <ul>\r
- <li>InstallAnywhere\r
- <ul>\r
- <li>Jalview.iap_xml is the InstallAnywhere XML project used to\r
- create the Jalview InstallAnywhere distribution.</li>\r
- <li>All the other files are bundled into this for installer\r
- displays. The README_IA appears in the installation directory.</li>\r
- </ul>\r
- <li>jalopy<br>\r
- This is a legacy directory - we intended to use jalopy for\r
- standardising the jalview source formatting, but found it had a number\r
- of bugs.</li>\r
- <li>axis-ant.jar - tasks for constructing client skeletons from\r
- WSDL documents.</li>\r
- <li>roxes-ant-tasks-1.2-2004-01-30.jar - conditionals and other\r
- useful ant tasks.</li>\r
- <li>castor-*-codegen.jar and castor-*-anttask.jar - codegenerator\r
- task and library for regenerating the Java classes from schemas. It is\r
- important to update these and rebuild the source if the version of\r
- castor that Jalview uses is updated.</li>\r
- <li>gff2annot.pl - useful script to translate gff to jalview\r
- features file format - although its not needed since Jalview can parse\r
- GFF natively (normally at least).</li>\r
- <li>jhall.jar, jhindexer.jar - the java help system and indexer\r
- code to build the jalview help in the help directory.</li>\r
- <li>proguard.jar - obfuscator used when creating\r
- jalviewApplet.jar. See the build.xml file and the building jalview\r
- documentation.</li>\r
- </ul>\r
- </li>\r
- <li>installAnywhere - where the installAnywhere build is generated</li>\r
- <li><em>keys</em> - you might not have this - see <a\r
- href="building.html">building</a> for info on how to create it.</li>\r
-<li>dist - where the Jars and JNLP file for the java webstart distribution is generated, and where a copy of the examples directory is created complete with jalviewApplet.jar and the contents of appletlib/*.jar.</li>\r
-<li>examples - a set of example jalview projects and web pages demonstrating the jalviewLite applet. This is essentially mirrors the <a href="http://www.jalview.org/examples/">www.jalview.org/examples</a> directory on Jalview's website.</li>\r
-<li>nbbuild.xml - custom config used by the vanilla netbeans project in nbproject</li>\r
-<li>nbproject - vanilla netbeans project</li>\r
-<li>JalviewApplet.jpx, JalviewX.jpx - old JBuilder project files</li>\r
-<li>.project - eclipse .project definition</li>\r
-</ul>\r
-\r
-</body>\r
-</html>\r
+<!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+Jalview Source Documentation
+</head>
+<body>
+<h1>Jalview Source Documentation</h1>
+<p>The file structure of the Jalview Source tree is as follows:
+<ul>
+ <li>README - basic info for getting started with the source tree.</li>
+ <li>LICENCE - the GPL Licence</li>
+ <li>RELEASE - contains the name of the tag for the latest
+ 'official' Jalview release associated with the source.</li>
+ <li>build.xml - ant build for jalview - the 'help' task gives
+ information about each task, and there's lots of comments too.</li>
+ <li></li>
+ <li>src - all jalview source packages, including any specially
+ adapted code from other GPL programs. See <a href="developing.html">Jalview
+ Development</a> for more info.</li>
+ <li>lib - All the libraries that Jalview depends on. Every jar
+ file in this directory should be added to the classpath when building
+ or running the jalview application.</li>
+ <li>appletlib - Any libraries that are specifically required for compiling and/or running the jalviewLite applet (e.g. an applet build of Jmol).
+ <li>help - the jalview JavaHelp documents<br>
+ <ul>
+ <li>help.hs - the main index page. This is generated by the
+ jhindexer program run by the 'buildindices' task in build.xml</li>
+ <li>help.jhm - helpTOC map - an XML document listing simple names
+ for each html page that is linked to in the help contents structure.</li>
+ <li>helpTOC.xml - the table of contents presented to the user
+ when the help is opened.</li>
+ <li>icons - widgets needed for the help system GUI</li>
+ <li>html - the help documentation. It loosely follows the
+ following structure: <br>
+ <ul>
+ <li>calculations - pages concerning the calculations menu</li>
+ <li>webServices - pages describing web services</li>
+ <li>colourSchemes - the ways amino acids can be coloured and the
+ user interface for defining them</li>
+ <li>editing - mechanisms and interfaces for editing alignments</li>
+ <li>features - used to be the sequence features documentation,
+ but now contains all sorts of jalview 'features'.</li>
+ <li>io - getting data in and out of jalview</li>
+ <li>menus - all the menus in Jalview (and the applet)</li>
+ <li>misc - useful info</li>
+ <li>By convention, we try to maintain the whatsNew.html document
+ with each release and complete the releases.html matrix to detail
+ what has changed from one version to another.</li>
+ <li>keys.html contains all the keystrokes in Jalview - please
+ keep this up to date.</li>
+ </ul>
+ </li>
+ </ul>
+ </li>
+ <li>resources - files needed at run-time for jalview execution.<br>
+ <ul>
+ <li>images - icons used by jalview</li>
+ <li>log4j and commons-logging.properties - configure default
+ appenders and logging for Jalview, castor.</li>
+ <li>embl_mapping.xml - castor mapping file for the EMBL XML
+ Schema.</li>
+ .
+ <li>uniprot_mapping.xml - castor mapping file for the Uniprot XML
+ Schema.</li>
+ </ul>
+ </li>
+ <li>schemas - XML schema definitions used or understood by
+ Jalview.<br>
+ Jalview uses castor to bind java to XML - either using mapping files
+ hand-crafted from a schema in this directory, or from java objects
+ generated from the schema and an associated set of properties. <br>
+ See the castorbinding task in the ant build.xml file for more info.
+ <ul>
+ <li>Jalview Project Archive XML Version 1<br>
+ vamsasJvV1.xsd<br>
+ jalviewJvV1.xsd<br>
+ jalview.nodesc.properties - sourcegenerator properties file</li>
+ <li>jalview Project Archive XML Version 2<br>
+ Jalview works out which version a project is by first trying
+ to parse XML with these schema definitions, and then if there are
+ problems, falls back to the V1 schema classes.
+ <ul>
+ <li>vamsas.xsd<br>
+ jalview.xsd<br>
+ jalview.properties - sourcegenerator properties file</li>
+ </ul></li>
+ <li>JalviewUserColours.xsd is used by both V1 and V2 project XML
+ definitions. This schema is also used to store user colour schemes
+ externally from the project file.</li>
+ </ul>
+ </li>
+ <li>utils - various resources needed when building or deploying
+ jalview.
+ <ul>
+ <li>InstallAnywhere
+ <ul>
+ <li>Jalview.iap_xml is the InstallAnywhere XML project used to
+ create the Jalview InstallAnywhere distribution.</li>
+ <li>All the other files are bundled into this for installer
+ displays. The README_IA appears in the installation directory.</li>
+ </ul>
+ <li>jalopy<br>
+ This is a legacy directory - we intended to use jalopy for
+ standardising the jalview source formatting, but found it had a number
+ of bugs.</li>
+ <li>axis-ant.jar - tasks for constructing client skeletons from
+ WSDL documents.</li>
+ <li>roxes-ant-tasks-1.2-2004-01-30.jar - conditionals and other
+ useful ant tasks.</li>
+ <li>castor-*-codegen.jar and castor-*-anttask.jar - codegenerator
+ task and library for regenerating the Java classes from schemas. It is
+ important to update these and rebuild the source if the version of
+ castor that Jalview uses is updated.</li>
+ <li>gff2annot.pl - useful script to translate gff to jalview
+ features file format - although its not needed since Jalview can parse
+ GFF natively (normally at least).</li>
+ <li>jhall.jar, jhindexer.jar - the java help system and indexer
+ code to build the jalview help in the help directory.</li>
+ <li>proguard.jar - obfuscator used when creating
+ jalviewApplet.jar. See the build.xml file and the building jalview
+ documentation.</li>
+ </ul>
+ </li>
+ <li>installAnywhere - where the installAnywhere build is generated</li>
+ <li><em>keys</em> - you might not have this - see <a
+ href="building.html">building</a> for info on how to create it.</li>
+<li>dist - where the Jars and JNLP file for the java webstart distribution is generated, and where a copy of the examples directory is created complete with jalviewApplet.jar and the contents of appletlib/*.jar.</li>
+<li>examples - a set of example jalview projects and web pages demonstrating the jalviewLite applet. This is essentially mirrors the <a href="http://www.jalview.org/examples/">www.jalview.org/examples</a> directory on Jalview's website.</li>
+<li>nbbuild.xml - custom config used by the vanilla netbeans project in nbproject</li>
+<li>nbproject - vanilla netbeans project</li>
+<li>JalviewApplet.jpx, JalviewX.jpx - old JBuilder project files</li>
+<li>.project - eclipse .project definition</li>
+</ul>
+
+</body>
+</html>
-<html>\r
-<!--\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
--->\r
-<head>\r
-<title>Adding New Datamodel Objects To Jalview</title>\r
-</head>\r
-<body>\r
-<h1>Adding New Datamodel Objects To Jalview</h1>\r
-<p>There are some basic requirements for all Jalview datamodel objects. None of them are mandatory, but each one makes it easier to integrate a new datamodel object into Jalview.</p>\r
-<p>The primary requirement of classes within jalview.datamodel is that all class implementations must be byte-code compatible with a java 1.1 runtime environment. This is an imposition from the Jalview applet, which is dependent on the core jalview.datamodel package. It is possible to include dependencies to objects which are not available to the JRE1.1 environment, providing you ensure that a test is made at run-time to decide if these dependencies are followed within any particular method. But generally, it is best to stick to 1.1 coding style - that is no generics, no fancy Iterators or use of specific JRE object methods and interfaces introduced after 1.1 (such as the get method for java.util.Vector).</p>\r
-<p><h3>Steps for integrating a new class into the datamodel</h3>\r
-<ol><li>Implement in Java 1.1 compatible source.</li>\r
-<li>Implement copy constructors for the benefit of any datamodel classes that reference it:\r
-<ul>\r
-<li>If it is referenced by AlignmentI or SequenceI<br>\r
-The jalview cut and paste mechanism relies on copy constructors and a 'pseudo-copy constructor' method to make new versions of datamodel objects which correctly inherit references to a subset of attributes referenced by the original objects, and otherwise contain complete duplicates of data (sequence characters, annotation and sequence features) local to that object.\r
-</li>\r
-</ul></li>\r
-<li>\r
-</body>\r
-</html>\r
+<html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+-->
+<head>
+<title>Adding New Datamodel Objects To Jalview</title>
+</head>
+<body>
+<h1>Adding New Datamodel Objects To Jalview</h1>
+<p>There are some basic requirements for all Jalview datamodel objects. None of them are mandatory, but each one makes it easier to integrate a new datamodel object into Jalview.</p>
+<p>The primary requirement of classes within jalview.datamodel is that all class implementations must be byte-code compatible with a java 1.1 runtime environment. This is an imposition from the Jalview applet, which is dependent on the core jalview.datamodel package. It is possible to include dependencies to objects which are not available to the JRE1.1 environment, providing you ensure that a test is made at run-time to decide if these dependencies are followed within any particular method. But generally, it is best to stick to 1.1 coding style - that is no generics, no fancy Iterators or use of specific JRE object methods and interfaces introduced after 1.1 (such as the get method for java.util.Vector).</p>
+<p><h3>Steps for integrating a new class into the datamodel</h3>
+<ol><li>Implement in Java 1.1 compatible source.</li>
+<li>Implement copy constructors for the benefit of any datamodel classes that reference it:
+<ul>
+<li>If it is referenced by AlignmentI or SequenceI<br>
+The jalview cut and paste mechanism relies on copy constructors and a 'pseudo-copy constructor' method to make new versions of datamodel objects which correctly inherit references to a subset of attributes referenced by the original objects, and otherwise contain complete duplicates of data (sequence characters, annotation and sequence features) local to that object.
+</li>
+</ul></li>
+<li>
+</body>
+</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+-->
<html><!-- InstanceBegin template="/Templates/jtemplate.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
-<!-- InstanceBeginEditable name="doctitle" -->\r
-<TITLE>Applet Parameters</TITLE>\r
+<!-- InstanceBeginEditable name="doctitle" -->
+<TITLE>Applet Parameters</TITLE>
<!-- InstanceEndEditable -->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><meta http-equiv="keywords" content="jalview,multiple,sequence,alignment,editor,viewer,java,download,barton group,protein,dna,das,distributed annotation system">
<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
<img src="../bbsrc-new.gif" width="179" height="64" border="1"></a>
</div>
</td>
- <td valign="top" width="587" bgcolor="#F2F2FF"><!-- InstanceBeginEditable name="Contents" --> \r
+ <td valign="top" width="587" bgcolor="#F2F2FF"><!-- InstanceBeginEditable name="Contents" -->
<p>
<strong>Quick Links:<ul><li>Download the applet jar file from <a
href="jalviewApplet.jar">here</a>
</font></li>
<li> Use Jalview for input to a HTML form. For an example of how to
code this using Javascript, click <a href="formComplete.html">here</a>.
- <br>\r
- </li>\r
+ <br>
+ </li>
<li>Embed Jalview into the web page, without the "Start Jalview"
button by setting the embed parameter to true;<br>
<param name="embedded"
<font size="2"><param name="PDBFile3" value="Third.pdb
D=SeqX B=SeqY C=SeqZ"> </font> <br>
</li>
- <li>Note parameter "PDBSeq" is no longer required.<br>\r
+ <li>Note parameter "PDBSeq" is no longer required.<br>
</li>
<li>Jalview 2.3 was updated to work with Jmol 11. See the <a href="../versions.html">versions archive if you want to download the old Jmol applet</a>.</li>
<p> </p>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">\r<html><!-- InstanceBegin template="/Templates/jtemplate.dwt" codeOutsideHTMLIsLocked="false" -->\r<head>\r<!-- InstanceBeginEditable name="doctitle" -->
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+-->
+<html><!-- InstanceBegin template="/Templates/jtemplate.dwt" codeOutsideHTMLIsLocked="false" -->
+<head>
+<!-- InstanceBeginEditable name="doctitle" -->
<TITLE>Jalview - Applets</TITLE>
-<!-- InstanceEndEditable --> \r<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><meta http-equiv="keywords" content="jalview,multiple,sequence,alignment,editor,viewer,java,download,barton group,protein,dna,das,distributed annotation system">\r<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable --> \r<style type="text/css">\r<!--\rtd {\r font-family: Geneva, Arial, Helvetica, sans-serif;\r font-size: 12px;\r}\r.plain {\r font-family: Verdana, Arial, Helvetica, sans-serif;\r font-size: 14px;\r text-decoration: none;\r}\r.plain:hover{\r background-color:#000000; color: #F2F2FF;\r}\r \r-->\r</style>\r\r<script language="JavaScript">\rfunction genHref()\r{\rvar s1 = "ml:ljvwr", s2 = "athpai.g", s3 = "ioe@leo ", href="";\rfor(i=0; i<8; i++)\r{href = href + s1.charAt(i) + s2.charAt(i) + s3.charAt(i); }\rwindow.location=href;\r}\rfunction getEventTarget(e)\r{\rif(!e)\re = window.event;\rif(e.target)\rreturn e.target;\rreturn e.srcElement;\r}\r\r</script>\r</head>\r\r<body alink="#000000" vlink="#000000" link="#000000">\r<script type="text/javascript">\rvar gaJsHost = (("https:" == document.location.protocol) ? \r"https://ssl." : "http://www.");\rdocument.write(unescape("%3Cscript src='" + gaJsHost + \r"google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));\r</script>\r<script type="text/javascript">\rtry{\rvar pageTracker = _gat._getTracker("UA-9060947-1");\rpageTracker._trackPageview();\r} catch(err) {}\r</script>\r<div align="left"> \r <table width="805" height="100" cellpadding="5">\r <tr>\r <td background="../jalview.gif"> <a href="http://www.compbio.dundee.ac.uk" target="NEW"><img src="../uodc_r1_c1.gif" width="143" height="101" border="1"></a></td>\r </tr>\r </table>\r <table width="805" border="0" cellpadding="5" cellspacing="5">\r <tr> \r <td width="183" valign="top" bgcolor="#F2F2FF" border="5"> \r \r <div align="center">\r <table width="182" height="386" border="0" cellpadding="0" cellspacing="0">\r <tr> \r <td align="left" valign="middle"><a href="../index.html" class="plain">Home</a></td>\r </tr>\r <tr> \r <td align="left" valign="middle"><a href="../overview.html" class="plain">Overview</a></td>\r </tr>\r <tr> \r <td align="left" valign="middle"><a href="../download.html" class="plain">Download</a></td>\r </tr>\r <tr> \r <td align="left" valign="middle"><a href="applets.html" class="plain">Applet \r Version</a></td>\r </tr>\r <tr> \r <td align="left" valign="middle"><a href="examples.html" class="plain">Screenshots</a></td>\r </tr>\r <tr> \r <td align="left" valign="middle"><a href="../faq.html" class="plain">FAQ</a></td>\r </tr>\r <tr> \r <td align="left" valign="middle"><a href="../documentList.html" class="plain">Documentation</a></td>\r </tr>\r <tr>\r <td align="left" valign="middle" ><a href="../releaseHistory.html" class="plain">Release \r history</a></td>\r </tr>\r <tr> \r <td align="left" valign="middle"><a href="../source/source.html" class="plain">Source \r Code</a></td>\r </tr>\r <tr> \r <td align="left" valign="middle"><a href="../versions.html" class="plain">Development Version</a></td>\r </tr>\r <tr> \r <td align="left" valign="middle"><a href="../links.html" class="plain">Links</a></td>\r </tr>\r <tr> \r <td align="left" valign="middle"><a href="http://www.jalview.org/mailman/listinfo/jalview-announce" class="plain" target="NEW">News \r Mailing List</a></td>\r </tr>\r <tr>\r <td align="left" valign="middle"><a\r href="http://www.jalview.org/mailman/listinfo/jalview-discuss"\r class="plain" target="NEW">Discussion Mailing List</a><br><br><em>Please send problems<br>and\r bug reports to the discussion list.</em></td>\r </tr>\r <tr></tr>\r <tr>\r <!--<td align="left" valign="middle"><br>\r Please send problems<br>and\r bug reports to:<br><a href="#" onClick="javascript:genHref();"><img src="../help.gif" width="123" height="19" border="0"></a></td>-->\r </tr>\r </table>\r\r </div>\r\r <div align="center"> <a href="http://www.bbsrc.ac.uk/" target="NEW"><br>\r <img src="../bbsrc-new.gif" width="179" height="64" border="1"></a> \r </div>\r </td>\r <td valign="top" width="587" bgcolor="#F2F2FF"><!-- InstanceBeginEditable name="Contents" -->
+<!-- InstanceEndEditable -->
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><meta http-equiv="keywords" content="jalview,multiple,sequence,alignment,editor,viewer,java,download,barton group,protein,dna,das,distributed annotation system">
+<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
+<style type="text/css">
+<!--
+td {
+ font-family: Geneva, Arial, Helvetica, sans-serif;
+ font-size: 12px;
+}
+.plain {
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size: 14px;
+ text-decoration: none;
+}
+.plain:hover{
+ background-color:#000000; color: #F2F2FF;
+}
+
+-->
+</style>
+
+<script language="JavaScript">
+function genHref()
+{
+var s1 = "ml:ljvwr", s2 = "athpai.g", s3 = "ioe@leo ", href="";
+for(i=0; i<8; i++)
+{href = href + s1.charAt(i) + s2.charAt(i) + s3.charAt(i); }
+window.location=href;
+}
+function getEventTarget(e)
+{
+if(!e)
+e = window.event;
+if(e.target)
+return e.target;
+return e.srcElement;
+}
+
+</script>
+</head>
+
+<body alink="#000000" vlink="#000000" link="#000000">
+<script type="text/javascript">
+var gaJsHost = (("https:" == document.location.protocol) ?
+"https://ssl." : "http://www.");
+document.write(unescape("%3Cscript src='" + gaJsHost +
+"google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
+</script>
+<script type="text/javascript">
+try{
+var pageTracker = _gat._getTracker("UA-9060947-1");
+pageTracker._trackPageview();
+} catch(err) {}
+</script>
+<div align="left">
+ <table width="805" height="100" cellpadding="5">
+ <tr>
+ <td background="../jalview.gif"> <a href="http://www.compbio.dundee.ac.uk" target="NEW"><img src="../uodc_r1_c1.gif" width="143" height="101" border="1"></a></td>
+ </tr>
+ </table>
+ <table width="805" border="0" cellpadding="5" cellspacing="5">
+ <tr>
+ <td width="183" valign="top" bgcolor="#F2F2FF" border="5">
+
+ <div align="center">
+ <table width="182" height="386" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td align="left" valign="middle"><a href="../index.html" class="plain">Home</a></td>
+ </tr>
+ <tr>
+ <td align="left" valign="middle"><a href="../overview.html" class="plain">Overview</a></td>
+ </tr>
+ <tr>
+ <td align="left" valign="middle"><a href="../download.html" class="plain">Download</a></td>
+ </tr>
+ <tr>
+ <td align="left" valign="middle"><a href="applets.html" class="plain">Applet
+ Version</a></td>
+ </tr>
+ <tr>
+ <td align="left" valign="middle"><a href="examples.html" class="plain">Screenshots</a></td>
+ </tr>
+ <tr>
+ <td align="left" valign="middle"><a href="../faq.html" class="plain">FAQ</a></td>
+ </tr>
+ <tr>
+ <td align="left" valign="middle"><a href="../documentList.html" class="plain">Documentation</a></td>
+ </tr>
+ <tr>
+ <td align="left" valign="middle" ><a href="../releaseHistory.html" class="plain">Release
+ history</a></td>
+ </tr>
+ <tr>
+ <td align="left" valign="middle"><a href="../source/source.html" class="plain">Source
+ Code</a></td>
+ </tr>
+ <tr>
+ <td align="left" valign="middle"><a href="../versions.html" class="plain">Development Version</a></td>
+ </tr>
+ <tr>
+ <td align="left" valign="middle"><a href="../links.html" class="plain">Links</a></td>
+ </tr>
+ <tr>
+ <td align="left" valign="middle"><a href="http://www.jalview.org/mailman/listinfo/jalview-announce" class="plain" target="NEW">News
+ Mailing List</a></td>
+ </tr>
+ <tr>
+ <td align="left" valign="middle"><a
+ href="http://www.jalview.org/mailman/listinfo/jalview-discuss"
+ class="plain" target="NEW">Discussion Mailing List</a><br><br><em>Please send problems<br>and
+ bug reports to the discussion list.</em></td>
+ </tr>
+ <tr></tr>
+ <tr>
+ <!--<td align="left" valign="middle"><br>
+ Please send problems<br>and
+ bug reports to:<br><a href="#" onClick="javascript:genHref();"><img src="../help.gif" width="123" height="19" border="0"></a></td>-->
+ </tr>
+ </table>
+
+ </div>
+
+ <div align="center"> <a href="http://www.bbsrc.ac.uk/" target="NEW"><br>
+ <img src="../bbsrc-new.gif" width="179" height="64" border="1"></a>
+ </div>
+ </td>
+ <td valign="top" width="587" bgcolor="#F2F2FF"><!-- InstanceBeginEditable name="Contents" -->
<p>Jalview comes in two distinct flavours.<br>
<br>
The main application allows connection to multiple web services provided
<td width="100"> <applet code="jalview.bin.JalviewLite"
width="140" height="35"
archive="jalviewApplet.jar">
- <param name="file" value="uniref50.fa">\r <param name="treeFile" value="ferredoxin.nw">
+ <param name="file" value="uniref50.fa">
+ <param name="treeFile" value="ferredoxin.nw">
<param name="userDefinedColour" value="C=yellow; R,K,H=FF5555; D,E=5555FF">
<param name="showFullId" value="false">
- <param name="RGB" value="F2F2FF">\r <param name="sortByTree" value="True">\r <param name="showSequenceLogo" value="true">\r <param name="showGroupConsensus" value="true">\r <param name="linkLabel_1" value="SRS">
+ <param name="RGB" value="F2F2FF">
+ <param name="sortByTree" value="True">
+ <param name="showSequenceLogo" value="true">
+ <param name="showGroupConsensus" value="true">
+ <param name="linkLabel_1" value="SRS">
<param name="linkUrl_1" value="http://srs.ebi.ac.uk/srs7bin/cgi-bin/wgetz?-e+[uniprot-all:$SEQUENCE_ID$]+-vn+2">
<param name="linkLabel_2" value="Uniprot">
<param name="linkUrl_2" value="http://us.expasy.org/cgi-bin/niceprot.pl?$SEQUENCE_ID$">
<td width="100"> <applet code="jalview.bin.JalviewLite"
width="140" height="35"
archive="jalviewApplet.jar,JmolApplet-12.2.4.jar">
- <param name="file" value="uniref50.fa">\r <!-- <param name="debug" value="true">
- -->\r <param name="defaultColour" value="Strand Propensity">
+ <param name="file" value="uniref50.fa">
+ <!-- <param name="debug" value="true">
+ -->
+ <param name="defaultColour" value="Strand Propensity">
<param name="wrap" value="true">
<param name="showAnnotation" value="false">
<param name="windowHeight" value="500">
</table></td>
</tr>
</table>
- <p> </p>\r <table width="300" border="1" cellspacing="0" cellpadding="0">\r <tr>\r <td><table width="300" border="0" cellspacing="0"\r cellpadding="0">\r <tr>\r <td width="100"><applet code="jalview.bin.JalviewLite"\r width="140" height="35" archive="jalviewApplet.jar">\r <param name="file" value="jpred_msa.fasta">\r <param name="jnetfile" value="jpred_msa.seq.concise">\r <param name="defaultColour" value="Clustal">\r <param name="showAnnotation" value="true">\r <param name="windowHeight" value="515">\r <param name="windowWidth" value="650">\r <param name="showConservation" value="false">\r <param name="showQuality" value="false">\r <param name="showConsensus" value="false">\r <param name="showFullId" value="false">\r <param name="RGB" value="F2F2FF">\r <param name="linkLabel_1" value="SRS">\r <param name="linkUrl_1"\r value="http://srs.ebi.ac.uk/srs7bin/cgi-bin/wgetz?-e+[uniprot-all:$SEQUENCE_ID$]+-vn+2">\r <param name="linkLabel_2" value="Uniprot">\r <param name="linkUrl_2"\r value="http://us.expasy.org/cgi-bin/niceprot.pl?$SEQUENCE_ID$">\r <param name="APPLICATION_URL"\r value="http://www.jalview.org/services/launchApp">\r </applet></td>\r <td width="165">Displays a Multiple Sequence Alignment\r Based JNet Prediction for a Sequence</td>\r </tr>\r </table></td>\r </tr>\r </table>\r <p> </p>\r <table width="300" border="1" cellspacing="0" cellpadding="0">\r <tr>\r <td><table width="300" border="0" cellspacing="0" cellpadding="0">\r <tr>\r <td width="100"> <applet code="jalview.bin.JalviewLite"\r width="140" height="35"\r archive="jalviewApplet.jar">\r <param name="file" value="RF00031_folded.stk">\r <param name="defaultColour" value="Purine/Pyrimidine">\r <param name="showAnnotation" value="true">\r <param name="windowHeight" value="515">\r <param name="windowWidth" value="650">\r <param name="showConservation" value="false">\r <param name="showQuality" value="false">\r <param name="showConsensus" value="true">\r <param name="showFullId" value="false">\r <param name="RGB" value="F2F2FF">\r <param name="APPLICATION_URL" value="http://www.jalview.org/services/launchApp">\r </applet> </td>\r <td width="165">Displays an RFAM RNA fold family with secondary structure annotation</td>\r </tr>\r </table></td>\r </tr>\r </table>\r </div>\r <p> </p>\r <p>For more JalviewLite examples, follow the links below.\r <ul>\r <li><a href="embedded.html">JalviewLite embedded in the web page</a></li>\r <li><a href="formComplete.html">use Javascript to control and get data from JalviewLite</a></li>\r <li><a href="linkedapplets_ng.html">use Javascript to make two jalviewLite instances talk to each other</a></li>\r <li><a href="embeddedWJmol.html">configure JalviewLite to talk to a Jmol applet on the page.</a></li>\r </ul>
- <!-- InstanceEndEditable --></td>\r </tr>\r </table>\r</div>\r</body>\r<!-- InstanceEnd --></html>\r
\ No newline at end of file
+ <p> </p>
+ <table width="300" border="1" cellspacing="0" cellpadding="0">
+ <tr>
+ <td><table width="300" border="0" cellspacing="0"
+ cellpadding="0">
+ <tr>
+ <td width="100"><applet code="jalview.bin.JalviewLite"
+ width="140" height="35" archive="jalviewApplet.jar">
+ <param name="file" value="jpred_msa.fasta">
+ <param name="jnetfile" value="jpred_msa.seq.concise">
+ <param name="defaultColour" value="Clustal">
+ <param name="showAnnotation" value="true">
+ <param name="windowHeight" value="515">
+ <param name="windowWidth" value="650">
+ <param name="showConservation" value="false">
+ <param name="showQuality" value="false">
+ <param name="showConsensus" value="false">
+ <param name="showFullId" value="false">
+ <param name="RGB" value="F2F2FF">
+ <param name="linkLabel_1" value="SRS">
+ <param name="linkUrl_1"
+ value="http://srs.ebi.ac.uk/srs7bin/cgi-bin/wgetz?-e+[uniprot-all:$SEQUENCE_ID$]+-vn+2">
+ <param name="linkLabel_2" value="Uniprot">
+ <param name="linkUrl_2"
+ value="http://us.expasy.org/cgi-bin/niceprot.pl?$SEQUENCE_ID$">
+ <param name="APPLICATION_URL"
+ value="http://www.jalview.org/services/launchApp">
+ </applet></td>
+ <td width="165">Displays a Multiple Sequence Alignment
+ Based JNet Prediction for a Sequence</td>
+ </tr>
+ </table></td>
+ </tr>
+ </table>
+ <p> </p>
+ <table width="300" border="1" cellspacing="0" cellpadding="0">
+ <tr>
+ <td><table width="300" border="0" cellspacing="0" cellpadding="0">
+ <tr>
+ <td width="100"> <applet code="jalview.bin.JalviewLite"
+ width="140" height="35"
+ archive="jalviewApplet.jar">
+ <param name="file" value="RF00031_folded.stk">
+ <param name="defaultColour" value="Purine/Pyrimidine">
+ <param name="showAnnotation" value="true">
+ <param name="windowHeight" value="515">
+ <param name="windowWidth" value="650">
+ <param name="showConservation" value="false">
+ <param name="showQuality" value="false">
+ <param name="showConsensus" value="true">
+ <param name="showFullId" value="false">
+ <param name="RGB" value="F2F2FF">
+ <param name="APPLICATION_URL" value="http://www.jalview.org/services/launchApp">
+ </applet> </td>
+ <td width="165">Displays an RFAM RNA fold family with secondary structure annotation</td>
+ </tr>
+ </table></td>
+ </tr>
+ </table>
+ </div>
+ <p> </p>
+ <p>For more JalviewLite examples, follow the links below.
+ <ul>
+ <li><a href="embedded.html">JalviewLite embedded in the web page</a></li>
+ <li><a href="formComplete.html">use Javascript to control and get data from JalviewLite</a></li>
+ <li><a href="linkedapplets_ng.html">use Javascript to make two jalviewLite instances talk to each other</a></li>
+ <li><a href="embeddedWJmol.html">configure JalviewLite to talk to a Jmol applet on the page.</a></li>
+ </ul>
+ <!-- InstanceEndEditable --></td>
+ </tr>
+ </table>
+</div>
+</body>
+<!-- InstanceEnd --></html>
-<!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r
-<html xmlns="http://www.w3.org/1999/xhtml">\r
-<title>\r
-Embedded viewing of Alignments\r
-</title>\r
-<body>\r
-<h1>Embedded viewing of Alignments</h1>\r
-<p>The alignment below was generated from the following files:\r
-<ul>\r
- <li><a href="plantfdx.fa">plantfdx.fa</a> - Alignment file in\r
- FASTA format</li>\r
- <li><a href="plantfdx.features">plantfdx.features</a> - Jalview\r
- Format Sequence Features file</li>\r
- <li><a href="plantfdx.annotations">plantfdx.annotations</a> -\r
- Jalview Alignment Annotations File</li>\r
-</ul>\r
-<applet code="jalview.bin.JalviewLite"\r
- width="756" height="560" archive="jalviewApplet.jar">\r
- <param name="file" value="plantfdx.fa">\r
- <param name="annotations" value="plantfdx.annotations">\r
- <param name="features" value="plantfdx.features">\r
- <param name="embedded" value="true">\r
- <param name="userDefinedColour"\r
- value="C=yellow; R,K,H=FF5555; D,E=5555FF">\r
- <param name="showFullId" value="false">\r
- <param name="RGB" value="F2F2FF">\r
- <param name="linkLabel_1" value="SRS">\r
- <param name="linkUrl_1"\r
- value="http://srs.ebi.ac.uk/srs7bin/cgi-bin/wgetz?-e+[uniprot-all:$SEQUENCE_ID$]+-vn+2">\r
- <param name="linkLabel_2" value="Uniprot">\r
- <param name="linkUrl_2"\r
- value="http://us.expasy.org/cgi-bin/niceprot.pl?$SEQUENCE_ID$">\r
- <param name="APPLICATION_URL"\r
- value="http://www.jalview.org/services/launchApp">\r
- </applet>\r
-</p>\r
-</body>\r
-</html>\r
+<!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml">
+<title>
+Embedded viewing of Alignments
+</title>
+<body>
+<h1>Embedded viewing of Alignments</h1>
+<p>The alignment below was generated from the following files:
+<ul>
+ <li><a href="plantfdx.fa">plantfdx.fa</a> - Alignment file in
+ FASTA format</li>
+ <li><a href="plantfdx.features">plantfdx.features</a> - Jalview
+ Format Sequence Features file</li>
+ <li><a href="plantfdx.annotations">plantfdx.annotations</a> -
+ Jalview Alignment Annotations File</li>
+</ul>
+<applet code="jalview.bin.JalviewLite"
+ width="756" height="560" archive="jalviewApplet.jar">
+ <param name="file" value="plantfdx.fa">
+ <param name="annotations" value="plantfdx.annotations">
+ <param name="features" value="plantfdx.features">
+ <param name="embedded" value="true">
+ <param name="userDefinedColour"
+ value="C=yellow; R,K,H=FF5555; D,E=5555FF">
+ <param name="showFullId" value="false">
+ <param name="RGB" value="F2F2FF">
+ <param name="linkLabel_1" value="SRS">
+ <param name="linkUrl_1"
+ value="http://srs.ebi.ac.uk/srs7bin/cgi-bin/wgetz?-e+[uniprot-all:$SEQUENCE_ID$]+-vn+2">
+ <param name="linkLabel_2" value="Uniprot">
+ <param name="linkUrl_2"
+ value="http://us.expasy.org/cgi-bin/niceprot.pl?$SEQUENCE_ID$">
+ <param name="APPLICATION_URL"
+ value="http://www.jalview.org/services/launchApp">
+ </applet>
+</p>
+</body>
+</html>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">\r
-<html><!-- InstanceBegin template="/Templates/jtemplate.dwt" codeOutsideHTMLIsLocked="false" -->\r
-<head>\r
-<!-- InstanceBeginEditable name="doctitle" -->\r
-<TITLE>Embedded JalviewLite talking to externally managed Jmol</TITLE>\r
-<!-- InstanceEndEditable --> \r
-<meta http-equiv="content-type" content="text/html; charset=UTF-8">\r
-<meta http-equiv="keywords" content="protein,interaction,domain,alignment,barton group,structure,interface">\r
-<!-- InstanceBeginEditable name="head" -->\r
-<script src="javascript/deployJava.js"></script>\r
-<script src="jmol/Jmol.js"></script>\r
-<script src="javascript/jquery-1.4.4.min.js"></script>\r
-<script src="javascript/jquery.timer.js"></script>\r
-<script src="javascript/jquery.blockUI.js"></script>\r
-<script src="javascript/jshashtable-2.1.js" language="javascript"></script>\r
-<!-- <script src="archive-min.js" language="javascript"></script>\r
--->\r
-<script src="javascript/jalview.js" language="javascript"></script>\r
-<script language="JavaScript">\r
-// instead of this, we use a custom JmolApplet spec\r
-// jmolInitialize('jmol');\r
-jmolInitialize("","JmolApplet-12.2.4.jar");\r
-function genHref()\r
-{\r
- var s1 = "ml:i@midd..", s2 = "atelcpoueau", s3 = "iomyob.neck", href="";\r
- for(i=0; i<11; i++)\r
- { href = href + s1.charAt(i) + s2.charAt(i) + s3.charAt(i); \r
- }\r
- window.location=href;\r
-}\r
-</script>\r
-<script>\r
- var loglevel=1;\r
- function dbg(lvl,string) {\r
- if (_console && lvl<=loglevel) {_console.value += string + "\n";}\r
- }\r
- var _lastTime=new Date();\r
- var _path;\r
- var _datazip;\r
- var _zip;\r
- var alignA;\r
- var alignB;\r
- var featuresA;\r
- var featuresB;\r
- var pairs;\r
- var atompairs;\r
- var structdata;\r
- var jmolview;\r
- var jvstructassoc;\r
- var modeltofiles = new Array();\r
-\r
- function lJvA() {\r
- jvfollower = document.getElementById("jvA");\r
- setConsole(document.getElementById("stdout"));\r
- \r
- sep = jvfollower.getSeparator();\r
- //jvapp.setSeparator(""+jvapp.getSeparator());\r
- linkJvJmol(jvfollower, "jmolView", modeltofiles);\r
- };\r
-\r
- var _jvA=new Object();\r
- _jvA.attributes = {\r
- code : 'jalview.bin.JalviewLite',\r
- archive : 'jalviewApplet.jar',\r
- width : '500',\r
- height : '350',\r
- mayscript : 'True',\r
- scriptable: 'True',\r
- id : 'jvA'\r
- };\r
- _jvA.parameters = {\r
- java_arguments : "-Xmx256m",\r
- externalstructureviewer : "true",\r
- oninit : "lJvA",\r
- automaticScrolling : "true",\r
-// <!-- defaultColour : "Strand Propensity", -->\r
- file : "uniref50_mz.fa",\r
- \r
- relaxedidmatch : "true",\r
- debug : "true",\r
- wrap : "false",\r
- // separator : "^",\r
- showAnnotation : "false",\r
- embedded : "true",\r
- showFullId : "false",\r
- RGB : "F2F2FF",\r
- linkLabel_1 : "SRS",\r
- linkUrl_1 : "http://srs.ebi.ac.uk/srs7bin/cgi-bin/wgetz?-e+[uniprot-all:$SEQUENCE_ID$]+-vn+2"\r
- ,\r
- linkLabel_2 : "Uniprot"\r
- ,\r
- linkUrl_2 : "http://us.expasy.org/cgi-bin/niceprot.pl?$SEQUENCE_ID$",\r
- APPLICATION_URL : "http://www.jalview.org/services/launchApp",\r
- PDBfile : "1gaq.txt FER1_MAIZE"\r
- };\r
- jmolSetCallback("hoverCallback","_jmolhover");\r
- jmolSetCallback("pickCallback","_jmolpick");\r
- modeltofiles+="1gaq.txt";\r
-</script>\r
-<!-- InstanceEndEditable --> \r
-<style type="text/css">\r
-<!--\r
-td {\r
- font-family: Geneva, Arial, Helvetica, sans-serif;\r
- font-size: 12px;\r
-}\r
-.plain {\r
- font-family: Verdana, Arial, Helvetica, sans-serif;\r
- font-size: 14px;\r
- text-decoration: none;\r
-}\r
-.plain:hover{\r
- background-color:#000000; color: #F2F2FF;\r
-}\r
- \r
--->\r
-</style>\r
-<script language="JavaScript">\r
-function genHref()\r
-{\r
-var s1 = "ml:ljvwr", s2 = "athpai.g", s3 = "ioe@leo ", href="";\r
-for(i=0; i<8; i++)\r
-{href = href + s1.charAt(i) + s2.charAt(i) + s3.charAt(i); }\r
-window.location=href;\r
-}\r
-function getEventTarget(e)\r
-{\r
-if(!e)\r
-e = window.event;\r
-if(e.target)\r
-return e.target;\r
-return e.srcElement;\r
-}\r
-</script>\r
-</head>\r
-<body alink="#000000" vlink="#000000" link="#000000">\r
-<script type="text/javascript">\r
-var gaJsHost = (("https:" == document.location.protocol) ? \r
-"https://ssl." : "http://www.");\r
-document.write(unescape("%3Cscript src='" + gaJsHost + \r
-"google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));\r
-</script>\r
-<script type="text/javascript">\r
-try{\r
-var pageTracker = _gat._getTracker("UA-9060947-1");\r
-pageTracker._trackPageview();\r
-} catch(err) {}\r
-</script>\r
-<div align="left"> \r
- <table width="805" height="100" cellpadding="5">\r
- <tr>\r
- <td background="../jalview.gif"> <a href="http://www.compbio.dundee.ac.uk" target="NEW"><img src="../uodc_r1_c1.gif" width="143" height="101" border="1"></a></td>\r
- </tr>\r
- </table>\r
- <table width="805" border="0" cellpadding="5" cellspacing="5">\r
- <tr> \r
- <td width="183" valign="top" bgcolor="#F2F2FF" border="5"> \r
- \r
- <div align="center">\r
- <table width="182" height="386" border="0" cellpadding="0" cellspacing="0">\r
- <tr> \r
- <td align="left" valign="middle"><a href="../index.html" class="plain">Home</a></td>\r
- </tr>\r
- <tr> \r
- <td align="left" valign="middle"><a href="../overview.html" class="plain">Overview</a></td>\r
- </tr>\r
- <tr> \r
- <td align="left" valign="middle"><a href="../download.html" class="plain">Download</a></td>\r
- </tr>\r
- <tr> \r
- <td align="left" valign="middle"><a href="applets.html" class="plain">Applet \r
- Version</a></td>\r
- </tr>\r
- <tr> \r
- <td align="left" valign="middle"><a href="examples.html" class="plain">Screenshots</a></td>\r
- </tr>\r
- <tr> \r
- <td align="left" valign="middle"><a href="../faq.html" class="plain">FAQ</a></td>\r
- </tr>\r
- <tr> \r
- <td align="left" valign="middle"><a href="../documentList.html" class="plain">Documentation</a></td>\r
- </tr>\r
- <tr>\r
- <td align="left" valign="middle" ><a href="../releaseHistory.html" class="plain">Release \r
- history</a></td>\r
- </tr>\r
- <tr> \r
- <td align="left" valign="middle"><a href="../source/source.html" class="plain">Source \r
- Code</a></td>\r
- </tr>\r
- <tr> \r
- <td align="left" valign="middle"><a href="../versions.html" class="plain">Development Version</a></td>\r
- </tr>\r
- <tr> \r
- <td align="left" valign="middle"><a href="../links.html" class="plain">Links</a></td>\r
- </tr>\r
- <tr> \r
- <td align="left" valign="middle"><a href="http://www.jalview.org/mailman/listinfo/jalview-announce" class="plain" target="NEW">News \r
- Mailing List</a></td>\r
- </tr>\r
- <tr>\r
- <td align="left" valign="middle"><a\r
- href="http://www.jalview.org/mailman/listinfo/jalview-discuss"\r
- class="plain" target="NEW">Discussion Mailing List</a><br><br><em>Please send problems<br>and\r
- bug reports to the discussion list.</em></td>\r
- </tr>\r
- <tr></tr>\r
- <tr>\r
- <!--<td align="left" valign="middle"><br>\r
- Please send problems<br>and\r
- bug reports to:<br><a href="#" onClick="javascript:genHref();"><img src="../help.gif" width="123" height="19" border="0"></a></td>-->\r
- </tr>\r
- </table>\r
- </div>\r
- <div align="center"> <a href="http://www.bbsrc.ac.uk/" target="NEW"><br>\r
- <img src="../bbsrc-new.gif" width="179" height="64" border="1"></a> \r
- </div>\r
- </td>\r
- <td valign="top" width="587" bgcolor="#F2F2FF"><!-- InstanceBeginEditable name="Contents" -->\r
-<!-- <a onclick="colourStructs();">Colour from jalviews</a>\r
- -->\r
- <center>\r
- <script>\r
- jmolApplet("500x500","zap; load FILE '1gaq.txt'; frame 0; select all; wireframe off; spacefill off; cartoons; restrict; center *; set selectionhalos true;select 0","jmolView");\r
-</script>\r
- <script>\r
- deployJava.runApplet(_jvA.attributes, _jvA.parameters, '1.4');\r
- </script>\r
- </center>\r
- </td>\r
- </tr>\r
- </table>\r
-<!-- <form name="console" id="console">\r
- <textarea name="output" id="stdout" rows="3" cols="80"\r
- >Messages will appear here.</textarea></form>\r
- --></div>\r
- <!-- InstanceEndEditable --></td>\r
- </tr>\r
- </table>\r
-</div>\r
-</body>\r
-<!-- InstanceEnd --></html>\r
-
\ No newline at end of file
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+-->
+<html><!-- InstanceBegin template="/Templates/jtemplate.dwt" codeOutsideHTMLIsLocked="false" -->
+<head>
+<!-- InstanceBeginEditable name="doctitle" -->
+<TITLE>Embedded JalviewLite talking to externally managed Jmol</TITLE>
+<!-- InstanceEndEditable -->
+<meta http-equiv="content-type" content="text/html; charset=UTF-8">
+<meta http-equiv="keywords" content="protein,interaction,domain,alignment,barton group,structure,interface">
+<!-- InstanceBeginEditable name="head" -->
+<script src="javascript/deployJava.js"></script>
+<script src="jmol/Jmol.js"></script>
+<script src="javascript/jquery-1.4.4.min.js"></script>
+<script src="javascript/jquery.timer.js"></script>
+<script src="javascript/jquery.blockUI.js"></script>
+<script src="javascript/jshashtable-2.1.js" language="javascript"></script>
+<!-- <script src="archive-min.js" language="javascript"></script>
+-->
+<script src="javascript/jalview.js" language="javascript"></script>
+<script language="JavaScript">
+// instead of this, we use a custom JmolApplet spec
+// jmolInitialize('jmol');
+jmolInitialize("","JmolApplet-12.2.4.jar");
+function genHref()
+{
+ var s1 = "ml:i@midd..", s2 = "atelcpoueau", s3 = "iomyob.neck", href="";
+ for(i=0; i<11; i++)
+ { href = href + s1.charAt(i) + s2.charAt(i) + s3.charAt(i);
+ }
+ window.location=href;
+}
+</script>
+<script>
+ var loglevel=1;
+ function dbg(lvl,string) {
+ if (_console && lvl<=loglevel) {_console.value += string + "\n";}
+ }
+ var _lastTime=new Date();
+ var _path;
+ var _datazip;
+ var _zip;
+ var alignA;
+ var alignB;
+ var featuresA;
+ var featuresB;
+ var pairs;
+ var atompairs;
+ var structdata;
+ var jmolview;
+ var jvstructassoc;
+ var modeltofiles = new Array();
+
+ function lJvA() {
+ jvfollower = document.getElementById("jvA");
+ setConsole(document.getElementById("stdout"));
+
+ sep = jvfollower.getSeparator();
+ //jvapp.setSeparator(""+jvapp.getSeparator());
+ linkJvJmol(jvfollower, "jmolView", modeltofiles);
+ };
+
+ var _jvA=new Object();
+ _jvA.attributes = {
+ code : 'jalview.bin.JalviewLite',
+ archive : 'jalviewApplet.jar',
+ width : '500',
+ height : '350',
+ mayscript : 'True',
+ scriptable: 'True',
+ id : 'jvA'
+ };
+ _jvA.parameters = {
+ java_arguments : "-Xmx256m",
+ externalstructureviewer : "true",
+ oninit : "lJvA",
+ automaticScrolling : "true",
+// <!-- defaultColour : "Strand Propensity", -->
+ file : "uniref50_mz.fa",
+
+ relaxedidmatch : "true",
+ debug : "true",
+ wrap : "false",
+ // separator : "^",
+ showAnnotation : "false",
+ embedded : "true",
+ showFullId : "false",
+ RGB : "F2F2FF",
+ linkLabel_1 : "SRS",
+ linkUrl_1 : "http://srs.ebi.ac.uk/srs7bin/cgi-bin/wgetz?-e+[uniprot-all:$SEQUENCE_ID$]+-vn+2"
+ ,
+ linkLabel_2 : "Uniprot"
+ ,
+ linkUrl_2 : "http://us.expasy.org/cgi-bin/niceprot.pl?$SEQUENCE_ID$",
+ APPLICATION_URL : "http://www.jalview.org/services/launchApp",
+ PDBfile : "1gaq.txt FER1_MAIZE"
+ };
+ jmolSetCallback("hoverCallback","_jmolhover");
+ jmolSetCallback("pickCallback","_jmolpick");
+ modeltofiles+="1gaq.txt";
+</script>
+<!-- InstanceEndEditable -->
+<style type="text/css">
+<!--
+td {
+ font-family: Geneva, Arial, Helvetica, sans-serif;
+ font-size: 12px;
+}
+.plain {
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size: 14px;
+ text-decoration: none;
+}
+.plain:hover{
+ background-color:#000000; color: #F2F2FF;
+}
+
+-->
+</style>
+<script language="JavaScript">
+function genHref()
+{
+var s1 = "ml:ljvwr", s2 = "athpai.g", s3 = "ioe@leo ", href="";
+for(i=0; i<8; i++)
+{href = href + s1.charAt(i) + s2.charAt(i) + s3.charAt(i); }
+window.location=href;
+}
+function getEventTarget(e)
+{
+if(!e)
+e = window.event;
+if(e.target)
+return e.target;
+return e.srcElement;
+}
+</script>
+</head>
+<body alink="#000000" vlink="#000000" link="#000000">
+<script type="text/javascript">
+var gaJsHost = (("https:" == document.location.protocol) ?
+"https://ssl." : "http://www.");
+document.write(unescape("%3Cscript src='" + gaJsHost +
+"google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
+</script>
+<script type="text/javascript">
+try{
+var pageTracker = _gat._getTracker("UA-9060947-1");
+pageTracker._trackPageview();
+} catch(err) {}
+</script>
+<div align="left">
+ <table width="805" height="100" cellpadding="5">
+ <tr>
+ <td background="../jalview.gif"> <a href="http://www.compbio.dundee.ac.uk" target="NEW"><img src="../uodc_r1_c1.gif" width="143" height="101" border="1"></a></td>
+ </tr>
+ </table>
+ <table width="805" border="0" cellpadding="5" cellspacing="5">
+ <tr>
+ <td width="183" valign="top" bgcolor="#F2F2FF" border="5">
+
+ <div align="center">
+ <table width="182" height="386" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td align="left" valign="middle"><a href="../index.html" class="plain">Home</a></td>
+ </tr>
+ <tr>
+ <td align="left" valign="middle"><a href="../overview.html" class="plain">Overview</a></td>
+ </tr>
+ <tr>
+ <td align="left" valign="middle"><a href="../download.html" class="plain">Download</a></td>
+ </tr>
+ <tr>
+ <td align="left" valign="middle"><a href="applets.html" class="plain">Applet
+ Version</a></td>
+ </tr>
+ <tr>
+ <td align="left" valign="middle"><a href="examples.html" class="plain">Screenshots</a></td>
+ </tr>
+ <tr>
+ <td align="left" valign="middle"><a href="../faq.html" class="plain">FAQ</a></td>
+ </tr>
+ <tr>
+ <td align="left" valign="middle"><a href="../documentList.html" class="plain">Documentation</a></td>
+ </tr>
+ <tr>
+ <td align="left" valign="middle" ><a href="../releaseHistory.html" class="plain">Release
+ history</a></td>
+ </tr>
+ <tr>
+ <td align="left" valign="middle"><a href="../source/source.html" class="plain">Source
+ Code</a></td>
+ </tr>
+ <tr>
+ <td align="left" valign="middle"><a href="../versions.html" class="plain">Development Version</a></td>
+ </tr>
+ <tr>
+ <td align="left" valign="middle"><a href="../links.html" class="plain">Links</a></td>
+ </tr>
+ <tr>
+ <td align="left" valign="middle"><a href="http://www.jalview.org/mailman/listinfo/jalview-announce" class="plain" target="NEW">News
+ Mailing List</a></td>
+ </tr>
+ <tr>
+ <td align="left" valign="middle"><a
+ href="http://www.jalview.org/mailman/listinfo/jalview-discuss"
+ class="plain" target="NEW">Discussion Mailing List</a><br><br><em>Please send problems<br>and
+ bug reports to the discussion list.</em></td>
+ </tr>
+ <tr></tr>
+ <tr>
+ <!--<td align="left" valign="middle"><br>
+ Please send problems<br>and
+ bug reports to:<br><a href="#" onClick="javascript:genHref();"><img src="../help.gif" width="123" height="19" border="0"></a></td>-->
+ </tr>
+ </table>
+ </div>
+ <div align="center"> <a href="http://www.bbsrc.ac.uk/" target="NEW"><br>
+ <img src="../bbsrc-new.gif" width="179" height="64" border="1"></a>
+ </div>
+ </td>
+ <td valign="top" width="587" bgcolor="#F2F2FF"><!-- InstanceBeginEditable name="Contents" -->
+<!-- <a onclick="colourStructs();">Colour from jalviews</a>
+ -->
+ <center>
+ <script>
+ jmolApplet("500x500","zap; load FILE '1gaq.txt'; frame 0; select all; wireframe off; spacefill off; cartoons; restrict; center *; set selectionhalos true;select 0","jmolView");
+</script>
+ <script>
+ deployJava.runApplet(_jvA.attributes, _jvA.parameters, '1.4');
+ </script>
+ </center>
+ </td>
+ </tr>
+ </table>
+<!-- <form name="console" id="console">
+ <textarea name="output" id="stdout" rows="3" cols="80"
+ >Messages will appear here.</textarea></form>
+ --></div>
+ <!-- InstanceEndEditable --></td>
+ </tr>
+ </table>
+</div>
+</body>
+<!-- InstanceEnd --></html>
+
-ST-TURN-IIL 705b23\r
-GAMMA-TURN-CLASSIC 788763\r
-BETA-TURN-IR 9a6a94\r
-BETA-TURN-IL d6a6ca\r
-BETA-BULGE 1dc451\r
-Pfam dc206a\r
-PHOSPHORYLATION (S) b974a5\r
-PHOSPHORYLATION (Y) 7d3881\r
-Cath 93b1d2\r
-ASX-TURN-IR 4ccc6e\r
-BETA-BULGE-LOOP-5 4066da\r
-CATMAT-4 4dc465\r
-CATMAT-3 3eb555\r
-GAMMA-TURN-INVERSE 7881c7\r
-SCHELLMANN-LOOP-6 a28bbb\r
-METAL cc9900\r
-ALPHA-BETA-MOTIF 7bd649\r
-ASX-MOTIF 6addbb\r
-NEST-LR 3e16d0\r
-ASX-TURN-IIR 6a4062\r
-NEST-RL 3e16b2\r
-ASX-TURN-IIL a67c98\r
-BETA-TURN-IIR c79792\r
-PHOSPHORYLATION (T) c88395\r
-BETA-TURN-IIL 8b5b50\r
-ST-MOTIF ac25a1\r
-\r
-STARTGROUP uniprot\r
-Iron-sulfur (2Fe-2S) FER_CAPAA -1 39 39 METAL\r
-Iron-sulfur (2Fe-2S) FER_CAPAA -1 44 44 METAL\r
-Iron-sulfur (2Fe-2S) FER_CAPAA -1 47 47 METAL\r
-Iron-sulfur (2Fe-2S) FER_CAPAA -1 77 77 METAL\r
-<html>Fer2 Status: True Positive <a href="http://pfam.sanger.ac.uk/family/PF00111">Pfam 8_8</a></html> FER_CAPAA -1 8 83 Pfam\r
-Ferredoxin_fold Status: True Positive FER_CAPAA -1 3 93 Cath\r
-Iron-sulfur (2Fe-2S) FER_CAPAN -1 86 86 METAL\r
-Iron-sulfur (2Fe-2S) FER_CAPAN -1 91 91 METAL\r
-Iron-sulfur (2Fe-2S) FER_CAPAN -1 94 94 METAL\r
-Iron-sulfur (2Fe-2S) FER_CAPAN -1 124 124 METAL\r
-<html>Fer2 Status: True Positive <a href="http://pfam.sanger.ac.uk/family/PF00111">Pfam 55_13</a></html> FER_CAPAN -1 55 130 Pfam\r
-Ferredoxin_fold Status: True Positive FER_CAPAN -1 45 140 Cath\r
-Iron-sulfur (2Fe-2S) FER1_SOLLC -1 86 86 METAL\r
-Iron-sulfur (2Fe-2S) FER1_SOLLC -1 91 91 METAL\r
-Iron-sulfur (2Fe-2S) FER1_SOLLC -1 94 94 METAL\r
-Iron-sulfur (2Fe-2S) FER1_SOLLC -1 124 124 METAL\r
-<html>Fer2 Status: True Positive <a href="http://pfam.sanger.ac.uk/family/PF00111">Pfam 55_13</a></html> FER1_SOLLC -1 55 130 Pfam\r
-Ferredoxin_fold Status: True Positive FER1_SOLLC -1 45 140 Cath\r
-<html>Fer2 Status: True Positive <a href="http://pfam.sanger.ac.uk/family/PF00111">Pfam 55_13</a></html> Q93XJ9_SOLTU -1 55 130 Pfam\r
-Ferredoxin_fold Status: True Positive Q93XJ9_SOLTU -1 45 140 Cath\r
-Iron-sulfur (2Fe-2S) FER1_PEA -1 91 91 METAL\r
-Iron-sulfur (2Fe-2S) FER1_PEA -1 96 96 METAL\r
-Iron-sulfur (2Fe-2S) FER1_PEA -1 99 99 METAL\r
-Iron-sulfur (2Fe-2S) FER1_PEA -1 129 129 METAL\r
-<html>Fer2 Status: True Positive <a href="http://pfam.sanger.ac.uk/family/PF00111">Pfam 60_13</a></html> FER1_PEA -1 60 135 Pfam\r
-Ferredoxin_fold Status: True Positive FER1_PEA -1 50 145 Cath\r
-<html>Fer2 Status: True Positive <a href="http://pfam.sanger.ac.uk/family/PF00111">Pfam 63_13</a></html> Q7XA98_TRIPR -1 63 138 Pfam\r
-Ferredoxin_fold Status: True Positive Q7XA98_TRIPR -1 53 148 Cath\r
-Iron-sulfur (2Fe-2S) FER1_MESCR -1 90 90 METAL\r
-Iron-sulfur (2Fe-2S) FER1_MESCR -1 95 95 METAL\r
-Iron-sulfur (2Fe-2S) FER1_MESCR -1 98 98 METAL\r
-Iron-sulfur (2Fe-2S) FER1_MESCR -1 128 128 METAL\r
-<html>Fer2 Status: True Positive <a href="http://pfam.sanger.ac.uk/family/PF00111">Pfam 59_13</a></html> FER1_MESCR -1 59 134 Pfam\r
-Ferredoxin_fold Status: True Positive FER1_MESCR -1 49 144 Cath\r
-Iron-sulfur (2Fe-2S) FER1_SPIOL -1 89 89 METAL\r
-Iron-sulfur (2Fe-2S) FER1_SPIOL -1 94 94 METAL\r
-Iron-sulfur (2Fe-2S) FER1_SPIOL -1 97 97 METAL\r
-Iron-sulfur (2Fe-2S) FER1_SPIOL -1 127 127 METAL\r
-<html>Fer2 Status: True Positive <a href="http://pfam.sanger.ac.uk/family/PF00111">Pfam 58_13</a></html> FER1_SPIOL -1 58 133 Pfam\r
-Ferredoxin_fold Status: True Positive FER1_SPIOL -1 48 143 Cath\r
-Iron-sulfur (2Fe-2S) FER3_RAPSA -1 39 39 METAL\r
-Iron-sulfur (2Fe-2S) FER3_RAPSA -1 44 44 METAL\r
-Iron-sulfur (2Fe-2S) FER3_RAPSA -1 47 47 METAL\r
-Iron-sulfur (2Fe-2S) FER3_RAPSA -1 77 77 METAL\r
-<html>Fer2 Status: True Positive <a href="http://pfam.sanger.ac.uk/family/PF00111">Pfam 8_8</a></html> FER3_RAPSA -1 8 83 Pfam\r
-Ferredoxin_fold Status: True Positive FER3_RAPSA -1 3 93 Cath\r
-Iron-sulfur (2Fe-2S) FER_BRANA -1 39 39 METAL\r
-Iron-sulfur (2Fe-2S) FER_BRANA -1 44 44 METAL\r
-Iron-sulfur (2Fe-2S) FER_BRANA -1 47 47 METAL\r
-Iron-sulfur (2Fe-2S) FER_BRANA -1 77 77 METAL\r
-<html>Fer2 Status: True Positive <a href="http://pfam.sanger.ac.uk/family/PF00111">Pfam 8_8</a></html> FER_BRANA -1 8 83 Pfam\r
-Ferredoxin_fold Status: True Positive FER_BRANA -1 2 96 Cath\r
-Iron-sulfur (2Fe-2S) FER2_ARATH -1 91 91 METAL\r
-Iron-sulfur (2Fe-2S) FER2_ARATH -1 96 96 METAL\r
-Iron-sulfur (2Fe-2S) FER2_ARATH -1 99 99 METAL\r
-Iron-sulfur (2Fe-2S) FER2_ARATH -1 129 129 METAL\r
-<html>Fer2 Status: True Positive <a href="http://pfam.sanger.ac.uk/family/PF00111">Pfam 60_13</a></html> FER2_ARATH -1 60 135 Pfam\r
-Ferredoxin_fold Status: True Positive FER2_ARATH -1 50 145 Cath\r
-<html>Fer2 Status: True Positive <a href="http://pfam.sanger.ac.uk/family/PF00111">Pfam 60_11</a></html> Q93Z60_ARATH -1 60 118 Pfam\r
-Ferredoxin_fold Status: True Positive Q93Z60_ARATH -1 52 118 Cath\r
-Iron-sulfur (2Fe-2S) FER1_MAIZE -1 91 91 METAL\r
-Iron-sulfur (2Fe-2S) FER1_MAIZE -1 96 96 METAL\r
-Iron-sulfur (2Fe-2S) FER1_MAIZE -1 99 99 METAL\r
-Iron-sulfur (2Fe-2S) FER1_MAIZE -1 129 129 METAL\r
-<html>Fer2 Status: True Positive <a href="http://pfam.sanger.ac.uk/family/PF00111">Pfam 60_13</a></html> FER1_MAIZE -1 60 135 Pfam\r
-Ferredoxin_fold Status: True Positive FER1_MAIZE -1 50 145 Cath\r
-<html>Fer2 Status: True Positive <a href="http://pfam.sanger.ac.uk/family/PF00111">Pfam 52_12</a></html> O80429_MAIZE -1 52 127 Pfam\r
-Ferredoxin_fold Status: True Positive O80429_MAIZE -1 42 137 Cath\r
-ENDGROUP uniprot\r
-\r
-\r
-STARTGROUP netphos\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P83527&service=NetPhos-2.0">PHOSPHORYLATION (T) 89_8</a></html> FER_CAPAA -1 89 89 PHOSPHORYLATION (T)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=Q43517&service=NetPhos-2.0">PHOSPHORYLATION (S) 22_2</a></html> FER1_SOLLC -1 22 22 PHOSPHORYLATION (S)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=Q43517&service=NetPhos-2.0">PHOSPHORYLATION (S) 38_3</a></html> FER1_SOLLC -1 38 38 PHOSPHORYLATION (S)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=Q43517&service=NetPhos-2.0">PHOSPHORYLATION (S) 102_10</a></html> FER1_SOLLC -1 102 102 PHOSPHORYLATION (S)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=Q43517&service=NetPhos-2.0">PHOSPHORYLATION (T) 136_13</a></html> FER1_SOLLC -1 136 136 PHOSPHORYLATION (T)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=Q93XJ9&service=NetPhos-2.0">PHOSPHORYLATION (T) 136_13</a></html> Q93XJ9_SOLTU -1 136 136 PHOSPHORYLATION (T)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=Q93XJ9&service=NetPhos-2.0">PHOSPHORYLATION (S) 22_2</a></html> Q93XJ9_SOLTU -1 22 22 PHOSPHORYLATION (S)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=Q93XJ9&service=NetPhos-2.0">PHOSPHORYLATION (S) 38_3</a></html> Q93XJ9_SOLTU -1 38 38 PHOSPHORYLATION (S)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P09911&service=NetPhos-2.0">PHOSPHORYLATION (S) 33_3</a></html> FER1_PEA -1 33 33 PHOSPHORYLATION (S)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P09911&service=NetPhos-2.0">PHOSPHORYLATION (S) 42_4</a></html> FER1_PEA -1 42 42 PHOSPHORYLATION (S)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P09911&service=NetPhos-2.0">PHOSPHORYLATION (S) 90_9</a></html> FER1_PEA -1 90 90 PHOSPHORYLATION (S)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P09911&service=NetPhos-2.0">PHOSPHORYLATION (S) 114_11</a></html> FER1_PEA -1 114 114 PHOSPHORYLATION (S)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P09911&service=NetPhos-2.0">PHOSPHORYLATION (T) 4_</a></html> FER1_PEA -1 4 4 PHOSPHORYLATION (T)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P09911&service=NetPhos-2.0">PHOSPHORYLATION (T) 28_2</a></html> FER1_PEA -1 28 28 PHOSPHORYLATION (T)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P09911&service=NetPhos-2.0">PHOSPHORYLATION (T) 141_14</a></html> FER1_PEA -1 141 141 PHOSPHORYLATION (T)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=Q7XA98&service=NetPhos-2.0">PHOSPHORYLATION (S) 117_11</a></html> Q7XA98_TRIPR -1 117 117 PHOSPHORYLATION (S)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=Q7XA98&service=NetPhos-2.0">PHOSPHORYLATION (T) 137_13</a></html> Q7XA98_TRIPR -1 137 137 PHOSPHORYLATION (T)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=Q7XA98&service=NetPhos-2.0">PHOSPHORYLATION (T) 144_14</a></html> Q7XA98_TRIPR -1 144 144 PHOSPHORYLATION (T)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=Q7XA98&service=NetPhos-2.0">PHOSPHORYLATION (T) 30_3</a></html> Q7XA98_TRIPR -1 30 30 PHOSPHORYLATION (T)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=Q7XA98&service=NetPhos-2.0">PHOSPHORYLATION (T) 31_3</a></html> Q7XA98_TRIPR -1 31 31 PHOSPHORYLATION (T)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=Q7XA98&service=NetPhos-2.0">PHOSPHORYLATION (T) 4_</a></html> Q7XA98_TRIPR -1 4 4 PHOSPHORYLATION (T)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=Q7XA98&service=NetPhos-2.0">PHOSPHORYLATION (S) 45_4</a></html> Q7XA98_TRIPR -1 45 45 PHOSPHORYLATION (S)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=Q7XA98&service=NetPhos-2.0">PHOSPHORYLATION (T) 46_4</a></html> Q7XA98_TRIPR -1 46 46 PHOSPHORYLATION (T)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=Q7XA98&service=NetPhos-2.0">PHOSPHORYLATION (S) 93_9</a></html> Q7XA98_TRIPR -1 93 93 PHOSPHORYLATION (S)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P00221&service=NetPhos-2.0">PHOSPHORYLATION (S) 88_8</a></html> FER1_SPIOL -1 88 88 PHOSPHORYLATION (S)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P00221&service=NetPhos-2.0">PHOSPHORYLATION (S) 112_11</a></html> FER1_SPIOL -1 112 112 PHOSPHORYLATION (S)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P00221&service=NetPhos-2.0">PHOSPHORYLATION (T) 139_13</a></html> FER1_SPIOL -1 139 139 PHOSPHORYLATION (T)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P00221&service=NetPhos-2.0">PHOSPHORYLATION (Y) 73_7</a></html> FER1_SPIOL -1 73 73 PHOSPHORYLATION (Y)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=FER1_ARATH&service=NetPhos-2.0">PHOSPHORYLATION (S) 19_1</a></html> FER1_ARATH -1 19 19 PHOSPHORYLATION (S)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=FER1_ARATH&service=NetPhos-2.0">PHOSPHORYLATION (S) 24_2</a></html> FER1_ARATH -1 24 24 PHOSPHORYLATION (S)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=FER1_ARATH&service=NetPhos-2.0">PHOSPHORYLATION (S) 90_9</a></html> FER1_ARATH -1 90 90 PHOSPHORYLATION (S)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=FER1_ARATH&service=NetPhos-2.0">PHOSPHORYLATION (S) 107_10</a></html> FER1_ARATH -1 107 107 PHOSPHORYLATION (S)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=FER1_ARATH&service=NetPhos-2.0">PHOSPHORYLATION (S) 114_11</a></html> FER1_ARATH -1 114 114 PHOSPHORYLATION (S)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=FER1_ARATH&service=NetPhos-2.0">PHOSPHORYLATION (T) 141_14</a></html> FER1_ARATH -1 141 141 PHOSPHORYLATION (T)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=FER1_ARATH&service=NetPhos-2.0">PHOSPHORYLATION (Y) 75_7</a></html> FER1_ARATH -1 75 75 PHOSPHORYLATION (Y)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P00227&service=NetPhos-2.0">PHOSPHORYLATION (S) 38_3</a></html> FER_BRANA -1 38 38 PHOSPHORYLATION (S)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P00227&service=NetPhos-2.0">PHOSPHORYLATION (S) 62_6</a></html> FER_BRANA -1 62 62 PHOSPHORYLATION (S)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P00227&service=NetPhos-2.0">PHOSPHORYLATION (T) 89_8</a></html> FER_BRANA -1 89 89 PHOSPHORYLATION (T)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P00227&service=NetPhos-2.0">PHOSPHORYLATION (Y) 23_2</a></html> FER_BRANA -1 23 23 PHOSPHORYLATION (Y)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=Q93Z60&service=NetPhos-2.0">PHOSPHORYLATION (S) 107_10</a></html> Q93Z60_ARATH -1 107 107 PHOSPHORYLATION (S)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=Q93Z60&service=NetPhos-2.0">PHOSPHORYLATION (S) 114_11</a></html> Q93Z60_ARATH -1 114 114 PHOSPHORYLATION (S)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=Q93Z60&service=NetPhos-2.0">PHOSPHORYLATION (T) 21_2</a></html> Q93Z60_ARATH -1 21 21 PHOSPHORYLATION (T)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=Q93Z60&service=NetPhos-2.0">PHOSPHORYLATION (S) 24_2</a></html> Q93Z60_ARATH -1 24 24 PHOSPHORYLATION (S)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=Q93Z60&service=NetPhos-2.0">PHOSPHORYLATION (Y) 75_7</a></html> Q93Z60_ARATH -1 75 75 PHOSPHORYLATION (Y)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P27787&service=NetPhos-2.0">PHOSPHORYLATION (S) 7_</a></html> FER1_MAIZE -1 7 7 PHOSPHORYLATION (S)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P27787&service=NetPhos-2.0">PHOSPHORYLATION (S) 19_1</a></html> FER1_MAIZE -1 19 19 PHOSPHORYLATION (S)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P27787&service=NetPhos-2.0">PHOSPHORYLATION (S) 44_4</a></html> FER1_MAIZE -1 44 44 PHOSPHORYLATION (S)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P27787&service=NetPhos-2.0">PHOSPHORYLATION (S) 45_4</a></html> FER1_MAIZE -1 45 45 PHOSPHORYLATION (S)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P27787&service=NetPhos-2.0">PHOSPHORYLATION (S) 90_9</a></html> FER1_MAIZE -1 90 90 PHOSPHORYLATION (S)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P27787&service=NetPhos-2.0">PHOSPHORYLATION (S) 107_10</a></html> FER1_MAIZE -1 107 107 PHOSPHORYLATION (S)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P27787&service=NetPhos-2.0">PHOSPHORYLATION (S) 114_11</a></html> FER1_MAIZE -1 114 114 PHOSPHORYLATION (S)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P27787&service=NetPhos-2.0">PHOSPHORYLATION (T) 134_13</a></html> FER1_MAIZE -1 134 134 PHOSPHORYLATION (T)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P27787&service=NetPhos-2.0">PHOSPHORYLATION (T) 141_14</a></html> FER1_MAIZE -1 141 141 PHOSPHORYLATION (T)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P27787&service=NetPhos-2.0">PHOSPHORYLATION (Y) 115_11</a></html> FER1_MAIZE -1 115 115 PHOSPHORYLATION (Y)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=O80429&service=NetPhos-2.0">PHOSPHORYLATION (T) 133_13</a></html> O80429_MAIZE -1 133 133 PHOSPHORYLATION (T)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=O80429&service=NetPhos-2.0">PHOSPHORYLATION (S) 82_8</a></html> O80429_MAIZE -1 82 82 PHOSPHORYLATION (S)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=O80429&service=NetPhos-2.0">PHOSPHORYLATION (S) 9_</a></html> O80429_MAIZE -1 9 9 PHOSPHORYLATION (S)\r
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=O80429&service=NetPhos-2.0">PHOSPHORYLATION (S) 99_9</a></html> O80429_MAIZE -1 99 99 PHOSPHORYLATION (S)\r
-ENDGROUP netphos\r
-\r
-STARTGROUP s3dm\r
-<html>Found in PDBs: 1a70.,1a70. <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/alphabetamotif?gzip=false">ALPHA-BETA-MOTIF 115_11</a></html> FER1_SPIOL -1 115 119 ALPHA-BETA-MOTIF\r
-<html>Found in PDBs: 1a70. <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/asxturniil?gzip=false">ASX-TURN-IIL 107_10</a></html> FER1_SPIOL -1 107 109 ASX-TURN-IIL\r
-<html>Found in PDBs: 1a70. <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/asxturnir?gzip=false">ASX-TURN-IR 115_11</a></html> FER1_SPIOL -1 115 117 ASX-TURN-IR\r
-<html>Found in PDBs: 1a70. <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/betabulge?gzip=false">BETA-BULGE 102_10</a></html> FER1_SPIOL -1 102 103 BETA-BULGE\r
-<html>Found in PDBs: 1a70. <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/betaturnir?gzip=false">BETA-TURN-IR 59_6</a></html> FER1_SPIOL -1 59 62 BETA-TURN-IR\r
-<html>Found in PDBs: 1a70. <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/betaturnir?gzip=false">BETA-TURN-IR 69_7</a></html> FER1_SPIOL -1 69 72 BETA-TURN-IR\r
-<html>Found in PDBs: 1a70. <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/betaturnir?gzip=false">BETA-TURN-IR 95_9</a></html> FER1_SPIOL -1 95 98 BETA-TURN-IR\r
-<html>Found in PDBs: 1a70. <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/betaturnir?gzip=false">BETA-TURN-IR 108_11</a></html> FER1_SPIOL -1 108 111 BETA-TURN-IR\r
-<html>Found in PDBs: 1a70. <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/betaturnir?gzip=false">BETA-TURN-IR 125_12</a></html> FER1_SPIOL -1 125 128 BETA-TURN-IR\r
-<html>Found in PDBs: 1a70. <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/betaturnir?gzip=false">BETA-TURN-IR 141_14</a></html> FER1_SPIOL -1 141 144 BETA-TURN-IR\r
-<html>Found in PDBs: 1a70. <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/nestlr?gzip=false">NEST-LR 90_9</a></html> FER1_SPIOL -1 90 92 NEST-LR\r
-<html>Found in PDBs: 1a70. <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/nestlr?gzip=false">NEST-LR 92_9</a></html> FER1_SPIOL -1 92 94 NEST-LR\r
-<html>Found in PDBs: 1a70. <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/nestlr?gzip=false">NEST-LR 140_14</a></html> FER1_SPIOL -1 140 142 NEST-LR\r
-<html>Found in PDBs: 1a70. <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/nestrl?gzip=false">NEST-RL 81_8</a></html> FER1_SPIOL -1 81 83 NEST-RL\r
-<html>Found in PDBs: 1a70. <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/nestrl?gzip=false">NEST-RL 89_9</a></html> FER1_SPIOL -1 89 91 NEST-RL\r
-<html>Found in PDBs: 1a70. <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/nestrl?gzip=false">NEST-RL 91_9</a></html> FER1_SPIOL -1 91 93 NEST-RL\r
-<html>Found in PDBs: 1a70. <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/nestrl?gzip=false">NEST-RL 121_12</a></html> FER1_SPIOL -1 121 123 NEST-RL\r
-<html>Found in PDBs: 1a70. <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/schellmannloop6?gzip=false">SCHELLMANN-LOOP-6 78_8</a></html> FER1_SPIOL -1 78 83 SCHELLMANN-LOOP-6\r
-<html>Found in PDBs: 1a70. <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/schellmannloop6?gzip=false">SCHELLMANN-LOOP-6 118_12</a></html> FER1_SPIOL -1 118 123 SCHELLMANN-LOOP-6\r
-<html>Found in PDBs: 1a70. <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/stmotif?gzip=false">ST-MOTIF 59_6</a></html> FER1_SPIOL -1 59 63 ST-MOTIF\r
-ALPHA-BETA-MOTIF FER1_SPIOL -1 65 69 ALPHA-BETA-MOTIF\r
-ASX-MOTIF FER1_SPIOL -1 65 69 ASX-MOTIF\r
-ASX-TURN-IIL FER1_SPIOL -1 57 59 ASX-TURN-IIL\r
-ASX-TURN-IR FER1_SPIOL -1 65 67 ASX-TURN-IR\r
-BETA-BULGE FER1_SPIOL -1 52 53 BETA-BULGE\r
-BETA-TURN-IR FER1_SPIOL -1 9 12 BETA-TURN-IR\r
-BETA-TURN-IR FER1_SPIOL -1 19 22 BETA-TURN-IR\r
-BETA-TURN-IR FER1_SPIOL -1 45 48 BETA-TURN-IR\r
-BETA-TURN-IR FER1_SPIOL -1 58 61 BETA-TURN-IR\r
-BETA-TURN-IR FER1_SPIOL -1 75 78 BETA-TURN-IR\r
-BETA-TURN-IR FER1_SPIOL -1 91 94 BETA-TURN-IR\r
-NEST-LR FER1_SPIOL -1 40 42 NEST-LR\r
-NEST-LR FER1_SPIOL -1 42 44 NEST-LR\r
-NEST-LR FER1_SPIOL -1 90 92 NEST-LR\r
-NEST-RL FER1_SPIOL -1 31 33 NEST-RL\r
-NEST-RL FER1_SPIOL -1 39 41 NEST-RL\r
-NEST-RL FER1_SPIOL -1 41 43 NEST-RL\r
-NEST-RL FER1_SPIOL -1 71 73 NEST-RL\r
-SCHELLMANN-LOOP-6 FER1_SPIOL -1 28 33 SCHELLMANN-LOOP-6\r
-SCHELLMANN-LOOP-6 FER1_SPIOL -1 68 73 SCHELLMANN-LOOP-6\r
-ST-MOTIF FER1_SPIOL -1 9 13 ST-MOTIF\r
-<html>Found in PDBs: 1gaq.B <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/alphabetamotif?gzip=false">ALPHA-BETA-MOTIF 76_8</a></html> FER1_MAIZE -1 76 80 ALPHA-BETA-MOTIF\r
-<html>Found in PDBs: 1gaq.B <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/alphabetamotif?gzip=false">ALPHA-BETA-MOTIF 77_8</a></html> FER1_MAIZE -1 77 81 ALPHA-BETA-MOTIF\r
-<html>Found in PDBs: 1gaq.B <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/betaturnir?gzip=false">BETA-TURN-IR 127_13</a></html> FER1_MAIZE -1 127 130 BETA-TURN-IR\r
-<html>Found in PDBs: 1gaq.B <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/gammaturnclassic?gzip=false">GAMMA-TURN-CLASSIC 113_11</a></html> FER1_MAIZE -1 113 115 GAMMA-TURN-CLASSIC\r
-<html>Found in PDBs: 1gaq.B <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/gammaturninverse?gzip=false">GAMMA-TURN-INVERSE 59_6</a></html> FER1_MAIZE -1 59 61 GAMMA-TURN-INVERSE\r
-<html>Found in PDBs: 1gaq.B <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/gammaturninverse?gzip=false">GAMMA-TURN-INVERSE 104_10</a></html> FER1_MAIZE -1 104 106 GAMMA-TURN-INVERSE\r
-<html>Found in PDBs: 1gaq.B <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/nestlr?gzip=false">NEST-LR 92_9</a></html> FER1_MAIZE -1 92 94 NEST-LR\r
-<html>Found in PDBs: 1gaq.B <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/nestlr?gzip=false">NEST-LR 94_9</a></html> FER1_MAIZE -1 94 96 NEST-LR\r
-<html>Found in PDBs: 1gaq.B <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/nestrl?gzip=false">NEST-RL 83_8</a></html> FER1_MAIZE -1 83 85 NEST-RL\r
-<html>Found in PDBs: 1gaq.B <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/nestrl?gzip=false">NEST-RL 91_9</a></html> FER1_MAIZE -1 91 93 NEST-RL\r
-<html>Found in PDBs: 1gaq.B <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/nestrl?gzip=false">NEST-RL 93_9</a></html> FER1_MAIZE -1 93 95 NEST-RL\r
-<html>Found in PDBs: 1gaq.B <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/nestrl?gzip=false">NEST-RL 123_12</a></html> FER1_MAIZE -1 123 125 NEST-RL\r
-ALPHA-BETA-MOTIF FER1_MAIZE -1 132 136 ALPHA-BETA-MOTIF\r
-ALPHA-BETA-MOTIF FER1_MAIZE -1 174 178 ALPHA-BETA-MOTIF\r
-ALPHA-BETA-MOTIF FER1_MAIZE -1 175 179 ALPHA-BETA-MOTIF\r
-ALPHA-BETA-MOTIF FER1_MAIZE -1 180 184 ALPHA-BETA-MOTIF\r
-ALPHA-BETA-MOTIF FER1_MAIZE -1 181 185 ALPHA-BETA-MOTIF\r
-ALPHA-BETA-MOTIF FER1_MAIZE -1 214 218 ALPHA-BETA-MOTIF\r
-ALPHA-BETA-MOTIF FER1_MAIZE -1 215 219 ALPHA-BETA-MOTIF\r
-ALPHA-BETA-MOTIF FER1_MAIZE -1 218 222 ALPHA-BETA-MOTIF\r
-ALPHA-BETA-MOTIF FER1_MAIZE -1 223 227 ALPHA-BETA-MOTIF\r
-ALPHA-BETA-MOTIF FER1_MAIZE -1 246 250 ALPHA-BETA-MOTIF\r
-ALPHA-BETA-MOTIF FER1_MAIZE -1 251 255 ALPHA-BETA-MOTIF\r
-ALPHA-BETA-MOTIF FER1_MAIZE -1 254 258 ALPHA-BETA-MOTIF\r
-ALPHA-BETA-MOTIF FER1_MAIZE -1 258 262 ALPHA-BETA-MOTIF\r
-ALPHA-BETA-MOTIF FER1_MAIZE -1 279 283 ALPHA-BETA-MOTIF\r
-ALPHA-BETA-MOTIF FER1_MAIZE -1 280 284 ALPHA-BETA-MOTIF\r
-ALPHA-BETA-MOTIF FER1_MAIZE -1 289 293 ALPHA-BETA-MOTIF\r
-ALPHA-BETA-MOTIF FER1_MAIZE -1 296 300 ALPHA-BETA-MOTIF\r
-ALPHA-BETA-MOTIF FER1_MAIZE -1 299 303 ALPHA-BETA-MOTIF\r
-ASX-TURN-IIL FER1_MAIZE -1 160 162 ASX-TURN-IIL\r
-ASX-TURN-IIR FER1_MAIZE -1 107 109 ASX-TURN-IIR\r
-BETA-BULGE FER1_MAIZE -1 31 32 BETA-BULGE\r
-BETA-BULGE FER1_MAIZE -1 43 44 BETA-BULGE\r
-BETA-TURN-IIL FER1_MAIZE -1 170 173 BETA-TURN-IIL\r
-BETA-TURN-IIR FER1_MAIZE -1 71 74 BETA-TURN-IIR\r
-BETA-TURN-IIR FER1_MAIZE -1 140 143 BETA-TURN-IIR\r
-BETA-TURN-IIR FER1_MAIZE -1 274 277 BETA-TURN-IIR\r
-BETA-TURN-IL FER1_MAIZE -1 64 67 BETA-TURN-IL\r
-BETA-TURN-IR FER1_MAIZE -1 33 36 BETA-TURN-IR\r
-BETA-TURN-IR FER1_MAIZE -1 50 53 BETA-TURN-IR\r
-BETA-TURN-IR FER1_MAIZE -1 100 103 BETA-TURN-IR\r
-BETA-TURN-IR FER1_MAIZE -1 103 106 BETA-TURN-IR\r
-BETA-TURN-IR FER1_MAIZE -1 136 139 BETA-TURN-IR\r
-BETA-TURN-IR FER1_MAIZE -1 171 174 BETA-TURN-IR\r
-BETA-TURN-IR FER1_MAIZE -1 172 175 BETA-TURN-IR\r
-BETA-TURN-IR FER1_MAIZE -1 206 209 BETA-TURN-IR\r
-BETA-TURN-IR FER1_MAIZE -1 207 210 BETA-TURN-IR\r
-BETA-TURN-IR FER1_MAIZE -1 223 226 BETA-TURN-IR\r
-BETA-TURN-IR FER1_MAIZE -1 233 236 BETA-TURN-IR\r
-BETA-TURN-IR FER1_MAIZE -1 252 255 BETA-TURN-IR\r
-BETA-TURN-IR FER1_MAIZE -1 264 267 BETA-TURN-IR\r
-BETA-TURN-IR FER1_MAIZE -1 289 292 BETA-TURN-IR\r
-BETA-TURN-IR FER1_MAIZE -1 295 298 BETA-TURN-IR\r
-CATMAT-3 FER1_MAIZE -1 20 22 CATMAT-3\r
-CATMAT-3 FER1_MAIZE -1 47 49 CATMAT-3\r
-CATMAT-3 FER1_MAIZE -1 97 99 CATMAT-3\r
-CATMAT-4 FER1_MAIZE -1 189 192 CATMAT-4\r
-GAMMA-TURN-INVERSE FER1_MAIZE -1 68 70 GAMMA-TURN-INVERSE\r
-GAMMA-TURN-INVERSE FER1_MAIZE -1 84 86 GAMMA-TURN-INVERSE\r
-GAMMA-TURN-INVERSE FER1_MAIZE -1 232 234 GAMMA-TURN-INVERSE\r
-GAMMA-TURN-INVERSE FER1_MAIZE -1 240 242 GAMMA-TURN-INVERSE\r
-GAMMA-TURN-INVERSE FER1_MAIZE -1 244 246 GAMMA-TURN-INVERSE\r
-NEST-LR FER1_MAIZE -1 30 32 NEST-LR\r
-NEST-LR FER1_MAIZE -1 66 68 NEST-LR\r
-NEST-LR FER1_MAIZE -1 106 108 NEST-LR\r
-NEST-LR FER1_MAIZE -1 108 110 NEST-LR\r
-NEST-LR FER1_MAIZE -1 212 214 NEST-LR\r
-NEST-LR FER1_MAIZE -1 276 278 NEST-LR\r
-NEST-LR FER1_MAIZE -1 307 309 NEST-LR\r
-NEST-RL FER1_MAIZE -1 64 66 NEST-RL\r
-NEST-RL FER1_MAIZE -1 105 107 NEST-RL\r
-NEST-RL FER1_MAIZE -1 107 109 NEST-RL\r
-NEST-RL FER1_MAIZE -1 306 308 NEST-RL\r
-ST-TURN-IIL FER1_MAIZE -1 20 22 ST-TURN-IIL\r
-ALPHA-BETA-MOTIF FER1_MAIZE -1 24 28 ALPHA-BETA-MOTIF\r
-ALPHA-BETA-MOTIF FER1_MAIZE -1 25 29 ALPHA-BETA-MOTIF\r
-BETA-TURN-IR FER1_MAIZE -1 75 78 BETA-TURN-IR\r
-GAMMA-TURN-CLASSIC FER1_MAIZE -1 61 63 GAMMA-TURN-CLASSIC\r
-GAMMA-TURN-INVERSE FER1_MAIZE -1 7 9 GAMMA-TURN-INVERSE\r
-GAMMA-TURN-INVERSE FER1_MAIZE -1 52 54 GAMMA-TURN-INVERSE\r
-NEST-LR FER1_MAIZE -1 40 42 NEST-LR\r
-NEST-LR FER1_MAIZE -1 42 44 NEST-LR\r
-NEST-RL FER1_MAIZE -1 31 33 NEST-RL\r
-NEST-RL FER1_MAIZE -1 39 41 NEST-RL\r
-NEST-RL FER1_MAIZE -1 41 43 NEST-RL\r
-NEST-RL FER1_MAIZE -1 71 73 NEST-RL\r
-ALPHA-BETA-MOTIF FER1_MAIZE -1 176 180 ALPHA-BETA-MOTIF\r
-ALPHA-BETA-MOTIF FER1_MAIZE -1 233 237 ALPHA-BETA-MOTIF\r
-ALPHA-BETA-MOTIF FER1_MAIZE -1 247 251 ALPHA-BETA-MOTIF\r
-ALPHA-BETA-MOTIF FER1_MAIZE -1 278 282 ALPHA-BETA-MOTIF\r
-ALPHA-BETA-MOTIF FER1_MAIZE -1 286 290 ALPHA-BETA-MOTIF\r
-ALPHA-BETA-MOTIF FER1_MAIZE -1 295 299 ALPHA-BETA-MOTIF\r
-ASX-MOTIF FER1_MAIZE -1 122 126 ASX-MOTIF\r
-ASX-MOTIF FER1_MAIZE -1 160 164 ASX-MOTIF\r
-ASX-TURN-IR FER1_MAIZE -1 122 124 ASX-TURN-IR\r
-BETA-BULGE-LOOP-5 FER1_MAIZE -1 122 126 BETA-BULGE-LOOP-5\r
-BETA-BULGE-LOOP-5 FER1_MAIZE -1 239 243 BETA-BULGE-LOOP-5\r
-BETA-TURN-IR FER1_MAIZE -1 122 125 BETA-TURN-IR\r
-BETA-TURN-IR FER1_MAIZE -1 160 163 BETA-TURN-IR\r
-BETA-TURN-IR FER1_MAIZE -1 239 242 BETA-TURN-IR\r
-BETA-TURN-IR FER1_MAIZE -1 261 264 BETA-TURN-IR\r
-CATMAT-3 FER1_MAIZE -1 80 82 CATMAT-3\r
-CATMAT-3 FER1_MAIZE -1 87 89 CATMAT-3\r
-CATMAT-3 FER1_MAIZE -1 262 264 CATMAT-3\r
-NEST-RL FER1_MAIZE -1 124 126 NEST-RL\r
-NEST-RL FER1_MAIZE -1 241 243 NEST-RL\r
-NEST-RL FER1_MAIZE -1 292 294 NEST-RL\r
-ENDGROUP s3dm\r
+#-------------------------------------------------------------------------------
+# Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+# Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+#
+# This file is part of Jalview.
+#
+# Jalview is free software: you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+#
+# Jalview is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty
+# of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+#-------------------------------------------------------------------------------
+ST-TURN-IIL 705b23
+GAMMA-TURN-CLASSIC 788763
+BETA-TURN-IR 9a6a94
+BETA-TURN-IL d6a6ca
+BETA-BULGE 1dc451
+Pfam dc206a
+PHOSPHORYLATION (S) b974a5
+PHOSPHORYLATION (Y) 7d3881
+Cath 93b1d2
+ASX-TURN-IR 4ccc6e
+BETA-BULGE-LOOP-5 4066da
+CATMAT-4 4dc465
+CATMAT-3 3eb555
+GAMMA-TURN-INVERSE 7881c7
+SCHELLMANN-LOOP-6 a28bbb
+METAL cc9900
+ALPHA-BETA-MOTIF 7bd649
+ASX-MOTIF 6addbb
+NEST-LR 3e16d0
+ASX-TURN-IIR 6a4062
+NEST-RL 3e16b2
+ASX-TURN-IIL a67c98
+BETA-TURN-IIR c79792
+PHOSPHORYLATION (T) c88395
+BETA-TURN-IIL 8b5b50
+ST-MOTIF ac25a1
+
+STARTGROUP uniprot
+Iron-sulfur (2Fe-2S) FER_CAPAA -1 39 39 METAL
+Iron-sulfur (2Fe-2S) FER_CAPAA -1 44 44 METAL
+Iron-sulfur (2Fe-2S) FER_CAPAA -1 47 47 METAL
+Iron-sulfur (2Fe-2S) FER_CAPAA -1 77 77 METAL
+<html>Fer2 Status: True Positive <a href="http://pfam.sanger.ac.uk/family/PF00111">Pfam 8_8</a></html> FER_CAPAA -1 8 83 Pfam
+Ferredoxin_fold Status: True Positive FER_CAPAA -1 3 93 Cath
+Iron-sulfur (2Fe-2S) FER_CAPAN -1 86 86 METAL
+Iron-sulfur (2Fe-2S) FER_CAPAN -1 91 91 METAL
+Iron-sulfur (2Fe-2S) FER_CAPAN -1 94 94 METAL
+Iron-sulfur (2Fe-2S) FER_CAPAN -1 124 124 METAL
+<html>Fer2 Status: True Positive <a href="http://pfam.sanger.ac.uk/family/PF00111">Pfam 55_13</a></html> FER_CAPAN -1 55 130 Pfam
+Ferredoxin_fold Status: True Positive FER_CAPAN -1 45 140 Cath
+Iron-sulfur (2Fe-2S) FER1_SOLLC -1 86 86 METAL
+Iron-sulfur (2Fe-2S) FER1_SOLLC -1 91 91 METAL
+Iron-sulfur (2Fe-2S) FER1_SOLLC -1 94 94 METAL
+Iron-sulfur (2Fe-2S) FER1_SOLLC -1 124 124 METAL
+<html>Fer2 Status: True Positive <a href="http://pfam.sanger.ac.uk/family/PF00111">Pfam 55_13</a></html> FER1_SOLLC -1 55 130 Pfam
+Ferredoxin_fold Status: True Positive FER1_SOLLC -1 45 140 Cath
+<html>Fer2 Status: True Positive <a href="http://pfam.sanger.ac.uk/family/PF00111">Pfam 55_13</a></html> Q93XJ9_SOLTU -1 55 130 Pfam
+Ferredoxin_fold Status: True Positive Q93XJ9_SOLTU -1 45 140 Cath
+Iron-sulfur (2Fe-2S) FER1_PEA -1 91 91 METAL
+Iron-sulfur (2Fe-2S) FER1_PEA -1 96 96 METAL
+Iron-sulfur (2Fe-2S) FER1_PEA -1 99 99 METAL
+Iron-sulfur (2Fe-2S) FER1_PEA -1 129 129 METAL
+<html>Fer2 Status: True Positive <a href="http://pfam.sanger.ac.uk/family/PF00111">Pfam 60_13</a></html> FER1_PEA -1 60 135 Pfam
+Ferredoxin_fold Status: True Positive FER1_PEA -1 50 145 Cath
+<html>Fer2 Status: True Positive <a href="http://pfam.sanger.ac.uk/family/PF00111">Pfam 63_13</a></html> Q7XA98_TRIPR -1 63 138 Pfam
+Ferredoxin_fold Status: True Positive Q7XA98_TRIPR -1 53 148 Cath
+Iron-sulfur (2Fe-2S) FER1_MESCR -1 90 90 METAL
+Iron-sulfur (2Fe-2S) FER1_MESCR -1 95 95 METAL
+Iron-sulfur (2Fe-2S) FER1_MESCR -1 98 98 METAL
+Iron-sulfur (2Fe-2S) FER1_MESCR -1 128 128 METAL
+<html>Fer2 Status: True Positive <a href="http://pfam.sanger.ac.uk/family/PF00111">Pfam 59_13</a></html> FER1_MESCR -1 59 134 Pfam
+Ferredoxin_fold Status: True Positive FER1_MESCR -1 49 144 Cath
+Iron-sulfur (2Fe-2S) FER1_SPIOL -1 89 89 METAL
+Iron-sulfur (2Fe-2S) FER1_SPIOL -1 94 94 METAL
+Iron-sulfur (2Fe-2S) FER1_SPIOL -1 97 97 METAL
+Iron-sulfur (2Fe-2S) FER1_SPIOL -1 127 127 METAL
+<html>Fer2 Status: True Positive <a href="http://pfam.sanger.ac.uk/family/PF00111">Pfam 58_13</a></html> FER1_SPIOL -1 58 133 Pfam
+Ferredoxin_fold Status: True Positive FER1_SPIOL -1 48 143 Cath
+Iron-sulfur (2Fe-2S) FER3_RAPSA -1 39 39 METAL
+Iron-sulfur (2Fe-2S) FER3_RAPSA -1 44 44 METAL
+Iron-sulfur (2Fe-2S) FER3_RAPSA -1 47 47 METAL
+Iron-sulfur (2Fe-2S) FER3_RAPSA -1 77 77 METAL
+<html>Fer2 Status: True Positive <a href="http://pfam.sanger.ac.uk/family/PF00111">Pfam 8_8</a></html> FER3_RAPSA -1 8 83 Pfam
+Ferredoxin_fold Status: True Positive FER3_RAPSA -1 3 93 Cath
+Iron-sulfur (2Fe-2S) FER_BRANA -1 39 39 METAL
+Iron-sulfur (2Fe-2S) FER_BRANA -1 44 44 METAL
+Iron-sulfur (2Fe-2S) FER_BRANA -1 47 47 METAL
+Iron-sulfur (2Fe-2S) FER_BRANA -1 77 77 METAL
+<html>Fer2 Status: True Positive <a href="http://pfam.sanger.ac.uk/family/PF00111">Pfam 8_8</a></html> FER_BRANA -1 8 83 Pfam
+Ferredoxin_fold Status: True Positive FER_BRANA -1 2 96 Cath
+Iron-sulfur (2Fe-2S) FER2_ARATH -1 91 91 METAL
+Iron-sulfur (2Fe-2S) FER2_ARATH -1 96 96 METAL
+Iron-sulfur (2Fe-2S) FER2_ARATH -1 99 99 METAL
+Iron-sulfur (2Fe-2S) FER2_ARATH -1 129 129 METAL
+<html>Fer2 Status: True Positive <a href="http://pfam.sanger.ac.uk/family/PF00111">Pfam 60_13</a></html> FER2_ARATH -1 60 135 Pfam
+Ferredoxin_fold Status: True Positive FER2_ARATH -1 50 145 Cath
+<html>Fer2 Status: True Positive <a href="http://pfam.sanger.ac.uk/family/PF00111">Pfam 60_11</a></html> Q93Z60_ARATH -1 60 118 Pfam
+Ferredoxin_fold Status: True Positive Q93Z60_ARATH -1 52 118 Cath
+Iron-sulfur (2Fe-2S) FER1_MAIZE -1 91 91 METAL
+Iron-sulfur (2Fe-2S) FER1_MAIZE -1 96 96 METAL
+Iron-sulfur (2Fe-2S) FER1_MAIZE -1 99 99 METAL
+Iron-sulfur (2Fe-2S) FER1_MAIZE -1 129 129 METAL
+<html>Fer2 Status: True Positive <a href="http://pfam.sanger.ac.uk/family/PF00111">Pfam 60_13</a></html> FER1_MAIZE -1 60 135 Pfam
+Ferredoxin_fold Status: True Positive FER1_MAIZE -1 50 145 Cath
+<html>Fer2 Status: True Positive <a href="http://pfam.sanger.ac.uk/family/PF00111">Pfam 52_12</a></html> O80429_MAIZE -1 52 127 Pfam
+Ferredoxin_fold Status: True Positive O80429_MAIZE -1 42 137 Cath
+ENDGROUP uniprot
+
+
+STARTGROUP netphos
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P83527&service=NetPhos-2.0">PHOSPHORYLATION (T) 89_8</a></html> FER_CAPAA -1 89 89 PHOSPHORYLATION (T)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=Q43517&service=NetPhos-2.0">PHOSPHORYLATION (S) 22_2</a></html> FER1_SOLLC -1 22 22 PHOSPHORYLATION (S)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=Q43517&service=NetPhos-2.0">PHOSPHORYLATION (S) 38_3</a></html> FER1_SOLLC -1 38 38 PHOSPHORYLATION (S)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=Q43517&service=NetPhos-2.0">PHOSPHORYLATION (S) 102_10</a></html> FER1_SOLLC -1 102 102 PHOSPHORYLATION (S)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=Q43517&service=NetPhos-2.0">PHOSPHORYLATION (T) 136_13</a></html> FER1_SOLLC -1 136 136 PHOSPHORYLATION (T)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=Q93XJ9&service=NetPhos-2.0">PHOSPHORYLATION (T) 136_13</a></html> Q93XJ9_SOLTU -1 136 136 PHOSPHORYLATION (T)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=Q93XJ9&service=NetPhos-2.0">PHOSPHORYLATION (S) 22_2</a></html> Q93XJ9_SOLTU -1 22 22 PHOSPHORYLATION (S)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=Q93XJ9&service=NetPhos-2.0">PHOSPHORYLATION (S) 38_3</a></html> Q93XJ9_SOLTU -1 38 38 PHOSPHORYLATION (S)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P09911&service=NetPhos-2.0">PHOSPHORYLATION (S) 33_3</a></html> FER1_PEA -1 33 33 PHOSPHORYLATION (S)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P09911&service=NetPhos-2.0">PHOSPHORYLATION (S) 42_4</a></html> FER1_PEA -1 42 42 PHOSPHORYLATION (S)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P09911&service=NetPhos-2.0">PHOSPHORYLATION (S) 90_9</a></html> FER1_PEA -1 90 90 PHOSPHORYLATION (S)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P09911&service=NetPhos-2.0">PHOSPHORYLATION (S) 114_11</a></html> FER1_PEA -1 114 114 PHOSPHORYLATION (S)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P09911&service=NetPhos-2.0">PHOSPHORYLATION (T) 4_</a></html> FER1_PEA -1 4 4 PHOSPHORYLATION (T)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P09911&service=NetPhos-2.0">PHOSPHORYLATION (T) 28_2</a></html> FER1_PEA -1 28 28 PHOSPHORYLATION (T)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P09911&service=NetPhos-2.0">PHOSPHORYLATION (T) 141_14</a></html> FER1_PEA -1 141 141 PHOSPHORYLATION (T)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=Q7XA98&service=NetPhos-2.0">PHOSPHORYLATION (S) 117_11</a></html> Q7XA98_TRIPR -1 117 117 PHOSPHORYLATION (S)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=Q7XA98&service=NetPhos-2.0">PHOSPHORYLATION (T) 137_13</a></html> Q7XA98_TRIPR -1 137 137 PHOSPHORYLATION (T)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=Q7XA98&service=NetPhos-2.0">PHOSPHORYLATION (T) 144_14</a></html> Q7XA98_TRIPR -1 144 144 PHOSPHORYLATION (T)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=Q7XA98&service=NetPhos-2.0">PHOSPHORYLATION (T) 30_3</a></html> Q7XA98_TRIPR -1 30 30 PHOSPHORYLATION (T)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=Q7XA98&service=NetPhos-2.0">PHOSPHORYLATION (T) 31_3</a></html> Q7XA98_TRIPR -1 31 31 PHOSPHORYLATION (T)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=Q7XA98&service=NetPhos-2.0">PHOSPHORYLATION (T) 4_</a></html> Q7XA98_TRIPR -1 4 4 PHOSPHORYLATION (T)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=Q7XA98&service=NetPhos-2.0">PHOSPHORYLATION (S) 45_4</a></html> Q7XA98_TRIPR -1 45 45 PHOSPHORYLATION (S)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=Q7XA98&service=NetPhos-2.0">PHOSPHORYLATION (T) 46_4</a></html> Q7XA98_TRIPR -1 46 46 PHOSPHORYLATION (T)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=Q7XA98&service=NetPhos-2.0">PHOSPHORYLATION (S) 93_9</a></html> Q7XA98_TRIPR -1 93 93 PHOSPHORYLATION (S)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P00221&service=NetPhos-2.0">PHOSPHORYLATION (S) 88_8</a></html> FER1_SPIOL -1 88 88 PHOSPHORYLATION (S)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P00221&service=NetPhos-2.0">PHOSPHORYLATION (S) 112_11</a></html> FER1_SPIOL -1 112 112 PHOSPHORYLATION (S)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P00221&service=NetPhos-2.0">PHOSPHORYLATION (T) 139_13</a></html> FER1_SPIOL -1 139 139 PHOSPHORYLATION (T)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P00221&service=NetPhos-2.0">PHOSPHORYLATION (Y) 73_7</a></html> FER1_SPIOL -1 73 73 PHOSPHORYLATION (Y)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=FER1_ARATH&service=NetPhos-2.0">PHOSPHORYLATION (S) 19_1</a></html> FER1_ARATH -1 19 19 PHOSPHORYLATION (S)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=FER1_ARATH&service=NetPhos-2.0">PHOSPHORYLATION (S) 24_2</a></html> FER1_ARATH -1 24 24 PHOSPHORYLATION (S)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=FER1_ARATH&service=NetPhos-2.0">PHOSPHORYLATION (S) 90_9</a></html> FER1_ARATH -1 90 90 PHOSPHORYLATION (S)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=FER1_ARATH&service=NetPhos-2.0">PHOSPHORYLATION (S) 107_10</a></html> FER1_ARATH -1 107 107 PHOSPHORYLATION (S)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=FER1_ARATH&service=NetPhos-2.0">PHOSPHORYLATION (S) 114_11</a></html> FER1_ARATH -1 114 114 PHOSPHORYLATION (S)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=FER1_ARATH&service=NetPhos-2.0">PHOSPHORYLATION (T) 141_14</a></html> FER1_ARATH -1 141 141 PHOSPHORYLATION (T)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=FER1_ARATH&service=NetPhos-2.0">PHOSPHORYLATION (Y) 75_7</a></html> FER1_ARATH -1 75 75 PHOSPHORYLATION (Y)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P00227&service=NetPhos-2.0">PHOSPHORYLATION (S) 38_3</a></html> FER_BRANA -1 38 38 PHOSPHORYLATION (S)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P00227&service=NetPhos-2.0">PHOSPHORYLATION (S) 62_6</a></html> FER_BRANA -1 62 62 PHOSPHORYLATION (S)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P00227&service=NetPhos-2.0">PHOSPHORYLATION (T) 89_8</a></html> FER_BRANA -1 89 89 PHOSPHORYLATION (T)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P00227&service=NetPhos-2.0">PHOSPHORYLATION (Y) 23_2</a></html> FER_BRANA -1 23 23 PHOSPHORYLATION (Y)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=Q93Z60&service=NetPhos-2.0">PHOSPHORYLATION (S) 107_10</a></html> Q93Z60_ARATH -1 107 107 PHOSPHORYLATION (S)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=Q93Z60&service=NetPhos-2.0">PHOSPHORYLATION (S) 114_11</a></html> Q93Z60_ARATH -1 114 114 PHOSPHORYLATION (S)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=Q93Z60&service=NetPhos-2.0">PHOSPHORYLATION (T) 21_2</a></html> Q93Z60_ARATH -1 21 21 PHOSPHORYLATION (T)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=Q93Z60&service=NetPhos-2.0">PHOSPHORYLATION (S) 24_2</a></html> Q93Z60_ARATH -1 24 24 PHOSPHORYLATION (S)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=Q93Z60&service=NetPhos-2.0">PHOSPHORYLATION (Y) 75_7</a></html> Q93Z60_ARATH -1 75 75 PHOSPHORYLATION (Y)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P27787&service=NetPhos-2.0">PHOSPHORYLATION (S) 7_</a></html> FER1_MAIZE -1 7 7 PHOSPHORYLATION (S)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P27787&service=NetPhos-2.0">PHOSPHORYLATION (S) 19_1</a></html> FER1_MAIZE -1 19 19 PHOSPHORYLATION (S)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P27787&service=NetPhos-2.0">PHOSPHORYLATION (S) 44_4</a></html> FER1_MAIZE -1 44 44 PHOSPHORYLATION (S)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P27787&service=NetPhos-2.0">PHOSPHORYLATION (S) 45_4</a></html> FER1_MAIZE -1 45 45 PHOSPHORYLATION (S)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P27787&service=NetPhos-2.0">PHOSPHORYLATION (S) 90_9</a></html> FER1_MAIZE -1 90 90 PHOSPHORYLATION (S)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P27787&service=NetPhos-2.0">PHOSPHORYLATION (S) 107_10</a></html> FER1_MAIZE -1 107 107 PHOSPHORYLATION (S)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P27787&service=NetPhos-2.0">PHOSPHORYLATION (S) 114_11</a></html> FER1_MAIZE -1 114 114 PHOSPHORYLATION (S)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P27787&service=NetPhos-2.0">PHOSPHORYLATION (T) 134_13</a></html> FER1_MAIZE -1 134 134 PHOSPHORYLATION (T)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P27787&service=NetPhos-2.0">PHOSPHORYLATION (T) 141_14</a></html> FER1_MAIZE -1 141 141 PHOSPHORYLATION (T)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P27787&service=NetPhos-2.0">PHOSPHORYLATION (Y) 115_11</a></html> FER1_MAIZE -1 115 115 PHOSPHORYLATION (Y)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=O80429&service=NetPhos-2.0">PHOSPHORYLATION (T) 133_13</a></html> O80429_MAIZE -1 133 133 PHOSPHORYLATION (T)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=O80429&service=NetPhos-2.0">PHOSPHORYLATION (S) 82_8</a></html> O80429_MAIZE -1 82 82 PHOSPHORYLATION (S)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=O80429&service=NetPhos-2.0">PHOSPHORYLATION (S) 9_</a></html> O80429_MAIZE -1 9 9 PHOSPHORYLATION (S)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=O80429&service=NetPhos-2.0">PHOSPHORYLATION (S) 99_9</a></html> O80429_MAIZE -1 99 99 PHOSPHORYLATION (S)
+ENDGROUP netphos
+
+STARTGROUP s3dm
+<html>Found in PDBs: 1a70.,1a70. <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/alphabetamotif?gzip=false">ALPHA-BETA-MOTIF 115_11</a></html> FER1_SPIOL -1 115 119 ALPHA-BETA-MOTIF
+<html>Found in PDBs: 1a70. <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/asxturniil?gzip=false">ASX-TURN-IIL 107_10</a></html> FER1_SPIOL -1 107 109 ASX-TURN-IIL
+<html>Found in PDBs: 1a70. <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/asxturnir?gzip=false">ASX-TURN-IR 115_11</a></html> FER1_SPIOL -1 115 117 ASX-TURN-IR
+<html>Found in PDBs: 1a70. <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/betabulge?gzip=false">BETA-BULGE 102_10</a></html> FER1_SPIOL -1 102 103 BETA-BULGE
+<html>Found in PDBs: 1a70. <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/betaturnir?gzip=false">BETA-TURN-IR 59_6</a></html> FER1_SPIOL -1 59 62 BETA-TURN-IR
+<html>Found in PDBs: 1a70. <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/betaturnir?gzip=false">BETA-TURN-IR 69_7</a></html> FER1_SPIOL -1 69 72 BETA-TURN-IR
+<html>Found in PDBs: 1a70. <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/betaturnir?gzip=false">BETA-TURN-IR 95_9</a></html> FER1_SPIOL -1 95 98 BETA-TURN-IR
+<html>Found in PDBs: 1a70. <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/betaturnir?gzip=false">BETA-TURN-IR 108_11</a></html> FER1_SPIOL -1 108 111 BETA-TURN-IR
+<html>Found in PDBs: 1a70. <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/betaturnir?gzip=false">BETA-TURN-IR 125_12</a></html> FER1_SPIOL -1 125 128 BETA-TURN-IR
+<html>Found in PDBs: 1a70. <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/betaturnir?gzip=false">BETA-TURN-IR 141_14</a></html> FER1_SPIOL -1 141 144 BETA-TURN-IR
+<html>Found in PDBs: 1a70. <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/nestlr?gzip=false">NEST-LR 90_9</a></html> FER1_SPIOL -1 90 92 NEST-LR
+<html>Found in PDBs: 1a70. <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/nestlr?gzip=false">NEST-LR 92_9</a></html> FER1_SPIOL -1 92 94 NEST-LR
+<html>Found in PDBs: 1a70. <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/nestlr?gzip=false">NEST-LR 140_14</a></html> FER1_SPIOL -1 140 142 NEST-LR
+<html>Found in PDBs: 1a70. <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/nestrl?gzip=false">NEST-RL 81_8</a></html> FER1_SPIOL -1 81 83 NEST-RL
+<html>Found in PDBs: 1a70. <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/nestrl?gzip=false">NEST-RL 89_9</a></html> FER1_SPIOL -1 89 91 NEST-RL
+<html>Found in PDBs: 1a70. <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/nestrl?gzip=false">NEST-RL 91_9</a></html> FER1_SPIOL -1 91 93 NEST-RL
+<html>Found in PDBs: 1a70. <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/nestrl?gzip=false">NEST-RL 121_12</a></html> FER1_SPIOL -1 121 123 NEST-RL
+<html>Found in PDBs: 1a70. <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/schellmannloop6?gzip=false">SCHELLMANN-LOOP-6 78_8</a></html> FER1_SPIOL -1 78 83 SCHELLMANN-LOOP-6
+<html>Found in PDBs: 1a70. <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/schellmannloop6?gzip=false">SCHELLMANN-LOOP-6 118_12</a></html> FER1_SPIOL -1 118 123 SCHELLMANN-LOOP-6
+<html>Found in PDBs: 1a70. <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/stmotif?gzip=false">ST-MOTIF 59_6</a></html> FER1_SPIOL -1 59 63 ST-MOTIF
+ALPHA-BETA-MOTIF FER1_SPIOL -1 65 69 ALPHA-BETA-MOTIF
+ASX-MOTIF FER1_SPIOL -1 65 69 ASX-MOTIF
+ASX-TURN-IIL FER1_SPIOL -1 57 59 ASX-TURN-IIL
+ASX-TURN-IR FER1_SPIOL -1 65 67 ASX-TURN-IR
+BETA-BULGE FER1_SPIOL -1 52 53 BETA-BULGE
+BETA-TURN-IR FER1_SPIOL -1 9 12 BETA-TURN-IR
+BETA-TURN-IR FER1_SPIOL -1 19 22 BETA-TURN-IR
+BETA-TURN-IR FER1_SPIOL -1 45 48 BETA-TURN-IR
+BETA-TURN-IR FER1_SPIOL -1 58 61 BETA-TURN-IR
+BETA-TURN-IR FER1_SPIOL -1 75 78 BETA-TURN-IR
+BETA-TURN-IR FER1_SPIOL -1 91 94 BETA-TURN-IR
+NEST-LR FER1_SPIOL -1 40 42 NEST-LR
+NEST-LR FER1_SPIOL -1 42 44 NEST-LR
+NEST-LR FER1_SPIOL -1 90 92 NEST-LR
+NEST-RL FER1_SPIOL -1 31 33 NEST-RL
+NEST-RL FER1_SPIOL -1 39 41 NEST-RL
+NEST-RL FER1_SPIOL -1 41 43 NEST-RL
+NEST-RL FER1_SPIOL -1 71 73 NEST-RL
+SCHELLMANN-LOOP-6 FER1_SPIOL -1 28 33 SCHELLMANN-LOOP-6
+SCHELLMANN-LOOP-6 FER1_SPIOL -1 68 73 SCHELLMANN-LOOP-6
+ST-MOTIF FER1_SPIOL -1 9 13 ST-MOTIF
+<html>Found in PDBs: 1gaq.B <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/alphabetamotif?gzip=false">ALPHA-BETA-MOTIF 76_8</a></html> FER1_MAIZE -1 76 80 ALPHA-BETA-MOTIF
+<html>Found in PDBs: 1gaq.B <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/alphabetamotif?gzip=false">ALPHA-BETA-MOTIF 77_8</a></html> FER1_MAIZE -1 77 81 ALPHA-BETA-MOTIF
+<html>Found in PDBs: 1gaq.B <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/betaturnir?gzip=false">BETA-TURN-IR 127_13</a></html> FER1_MAIZE -1 127 130 BETA-TURN-IR
+<html>Found in PDBs: 1gaq.B <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/gammaturnclassic?gzip=false">GAMMA-TURN-CLASSIC 113_11</a></html> FER1_MAIZE -1 113 115 GAMMA-TURN-CLASSIC
+<html>Found in PDBs: 1gaq.B <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/gammaturninverse?gzip=false">GAMMA-TURN-INVERSE 59_6</a></html> FER1_MAIZE -1 59 61 GAMMA-TURN-INVERSE
+<html>Found in PDBs: 1gaq.B <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/gammaturninverse?gzip=false">GAMMA-TURN-INVERSE 104_10</a></html> FER1_MAIZE -1 104 106 GAMMA-TURN-INVERSE
+<html>Found in PDBs: 1gaq.B <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/nestlr?gzip=false">NEST-LR 92_9</a></html> FER1_MAIZE -1 92 94 NEST-LR
+<html>Found in PDBs: 1gaq.B <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/nestlr?gzip=false">NEST-LR 94_9</a></html> FER1_MAIZE -1 94 96 NEST-LR
+<html>Found in PDBs: 1gaq.B <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/nestrl?gzip=false">NEST-RL 83_8</a></html> FER1_MAIZE -1 83 85 NEST-RL
+<html>Found in PDBs: 1gaq.B <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/nestrl?gzip=false">NEST-RL 91_9</a></html> FER1_MAIZE -1 91 93 NEST-RL
+<html>Found in PDBs: 1gaq.B <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/nestrl?gzip=false">NEST-RL 93_9</a></html> FER1_MAIZE -1 93 95 NEST-RL
+<html>Found in PDBs: 1gaq.B <a href="http://www.ebi.ac.uk/msd-srv/msdmotif/nestrl?gzip=false">NEST-RL 123_12</a></html> FER1_MAIZE -1 123 125 NEST-RL
+ALPHA-BETA-MOTIF FER1_MAIZE -1 132 136 ALPHA-BETA-MOTIF
+ALPHA-BETA-MOTIF FER1_MAIZE -1 174 178 ALPHA-BETA-MOTIF
+ALPHA-BETA-MOTIF FER1_MAIZE -1 175 179 ALPHA-BETA-MOTIF
+ALPHA-BETA-MOTIF FER1_MAIZE -1 180 184 ALPHA-BETA-MOTIF
+ALPHA-BETA-MOTIF FER1_MAIZE -1 181 185 ALPHA-BETA-MOTIF
+ALPHA-BETA-MOTIF FER1_MAIZE -1 214 218 ALPHA-BETA-MOTIF
+ALPHA-BETA-MOTIF FER1_MAIZE -1 215 219 ALPHA-BETA-MOTIF
+ALPHA-BETA-MOTIF FER1_MAIZE -1 218 222 ALPHA-BETA-MOTIF
+ALPHA-BETA-MOTIF FER1_MAIZE -1 223 227 ALPHA-BETA-MOTIF
+ALPHA-BETA-MOTIF FER1_MAIZE -1 246 250 ALPHA-BETA-MOTIF
+ALPHA-BETA-MOTIF FER1_MAIZE -1 251 255 ALPHA-BETA-MOTIF
+ALPHA-BETA-MOTIF FER1_MAIZE -1 254 258 ALPHA-BETA-MOTIF
+ALPHA-BETA-MOTIF FER1_MAIZE -1 258 262 ALPHA-BETA-MOTIF
+ALPHA-BETA-MOTIF FER1_MAIZE -1 279 283 ALPHA-BETA-MOTIF
+ALPHA-BETA-MOTIF FER1_MAIZE -1 280 284 ALPHA-BETA-MOTIF
+ALPHA-BETA-MOTIF FER1_MAIZE -1 289 293 ALPHA-BETA-MOTIF
+ALPHA-BETA-MOTIF FER1_MAIZE -1 296 300 ALPHA-BETA-MOTIF
+ALPHA-BETA-MOTIF FER1_MAIZE -1 299 303 ALPHA-BETA-MOTIF
+ASX-TURN-IIL FER1_MAIZE -1 160 162 ASX-TURN-IIL
+ASX-TURN-IIR FER1_MAIZE -1 107 109 ASX-TURN-IIR
+BETA-BULGE FER1_MAIZE -1 31 32 BETA-BULGE
+BETA-BULGE FER1_MAIZE -1 43 44 BETA-BULGE
+BETA-TURN-IIL FER1_MAIZE -1 170 173 BETA-TURN-IIL
+BETA-TURN-IIR FER1_MAIZE -1 71 74 BETA-TURN-IIR
+BETA-TURN-IIR FER1_MAIZE -1 140 143 BETA-TURN-IIR
+BETA-TURN-IIR FER1_MAIZE -1 274 277 BETA-TURN-IIR
+BETA-TURN-IL FER1_MAIZE -1 64 67 BETA-TURN-IL
+BETA-TURN-IR FER1_MAIZE -1 33 36 BETA-TURN-IR
+BETA-TURN-IR FER1_MAIZE -1 50 53 BETA-TURN-IR
+BETA-TURN-IR FER1_MAIZE -1 100 103 BETA-TURN-IR
+BETA-TURN-IR FER1_MAIZE -1 103 106 BETA-TURN-IR
+BETA-TURN-IR FER1_MAIZE -1 136 139 BETA-TURN-IR
+BETA-TURN-IR FER1_MAIZE -1 171 174 BETA-TURN-IR
+BETA-TURN-IR FER1_MAIZE -1 172 175 BETA-TURN-IR
+BETA-TURN-IR FER1_MAIZE -1 206 209 BETA-TURN-IR
+BETA-TURN-IR FER1_MAIZE -1 207 210 BETA-TURN-IR
+BETA-TURN-IR FER1_MAIZE -1 223 226 BETA-TURN-IR
+BETA-TURN-IR FER1_MAIZE -1 233 236 BETA-TURN-IR
+BETA-TURN-IR FER1_MAIZE -1 252 255 BETA-TURN-IR
+BETA-TURN-IR FER1_MAIZE -1 264 267 BETA-TURN-IR
+BETA-TURN-IR FER1_MAIZE -1 289 292 BETA-TURN-IR
+BETA-TURN-IR FER1_MAIZE -1 295 298 BETA-TURN-IR
+CATMAT-3 FER1_MAIZE -1 20 22 CATMAT-3
+CATMAT-3 FER1_MAIZE -1 47 49 CATMAT-3
+CATMAT-3 FER1_MAIZE -1 97 99 CATMAT-3
+CATMAT-4 FER1_MAIZE -1 189 192 CATMAT-4
+GAMMA-TURN-INVERSE FER1_MAIZE -1 68 70 GAMMA-TURN-INVERSE
+GAMMA-TURN-INVERSE FER1_MAIZE -1 84 86 GAMMA-TURN-INVERSE
+GAMMA-TURN-INVERSE FER1_MAIZE -1 232 234 GAMMA-TURN-INVERSE
+GAMMA-TURN-INVERSE FER1_MAIZE -1 240 242 GAMMA-TURN-INVERSE
+GAMMA-TURN-INVERSE FER1_MAIZE -1 244 246 GAMMA-TURN-INVERSE
+NEST-LR FER1_MAIZE -1 30 32 NEST-LR
+NEST-LR FER1_MAIZE -1 66 68 NEST-LR
+NEST-LR FER1_MAIZE -1 106 108 NEST-LR
+NEST-LR FER1_MAIZE -1 108 110 NEST-LR
+NEST-LR FER1_MAIZE -1 212 214 NEST-LR
+NEST-LR FER1_MAIZE -1 276 278 NEST-LR
+NEST-LR FER1_MAIZE -1 307 309 NEST-LR
+NEST-RL FER1_MAIZE -1 64 66 NEST-RL
+NEST-RL FER1_MAIZE -1 105 107 NEST-RL
+NEST-RL FER1_MAIZE -1 107 109 NEST-RL
+NEST-RL FER1_MAIZE -1 306 308 NEST-RL
+ST-TURN-IIL FER1_MAIZE -1 20 22 ST-TURN-IIL
+ALPHA-BETA-MOTIF FER1_MAIZE -1 24 28 ALPHA-BETA-MOTIF
+ALPHA-BETA-MOTIF FER1_MAIZE -1 25 29 ALPHA-BETA-MOTIF
+BETA-TURN-IR FER1_MAIZE -1 75 78 BETA-TURN-IR
+GAMMA-TURN-CLASSIC FER1_MAIZE -1 61 63 GAMMA-TURN-CLASSIC
+GAMMA-TURN-INVERSE FER1_MAIZE -1 7 9 GAMMA-TURN-INVERSE
+GAMMA-TURN-INVERSE FER1_MAIZE -1 52 54 GAMMA-TURN-INVERSE
+NEST-LR FER1_MAIZE -1 40 42 NEST-LR
+NEST-LR FER1_MAIZE -1 42 44 NEST-LR
+NEST-RL FER1_MAIZE -1 31 33 NEST-RL
+NEST-RL FER1_MAIZE -1 39 41 NEST-RL
+NEST-RL FER1_MAIZE -1 41 43 NEST-RL
+NEST-RL FER1_MAIZE -1 71 73 NEST-RL
+ALPHA-BETA-MOTIF FER1_MAIZE -1 176 180 ALPHA-BETA-MOTIF
+ALPHA-BETA-MOTIF FER1_MAIZE -1 233 237 ALPHA-BETA-MOTIF
+ALPHA-BETA-MOTIF FER1_MAIZE -1 247 251 ALPHA-BETA-MOTIF
+ALPHA-BETA-MOTIF FER1_MAIZE -1 278 282 ALPHA-BETA-MOTIF
+ALPHA-BETA-MOTIF FER1_MAIZE -1 286 290 ALPHA-BETA-MOTIF
+ALPHA-BETA-MOTIF FER1_MAIZE -1 295 299 ALPHA-BETA-MOTIF
+ASX-MOTIF FER1_MAIZE -1 122 126 ASX-MOTIF
+ASX-MOTIF FER1_MAIZE -1 160 164 ASX-MOTIF
+ASX-TURN-IR FER1_MAIZE -1 122 124 ASX-TURN-IR
+BETA-BULGE-LOOP-5 FER1_MAIZE -1 122 126 BETA-BULGE-LOOP-5
+BETA-BULGE-LOOP-5 FER1_MAIZE -1 239 243 BETA-BULGE-LOOP-5
+BETA-TURN-IR FER1_MAIZE -1 122 125 BETA-TURN-IR
+BETA-TURN-IR FER1_MAIZE -1 160 163 BETA-TURN-IR
+BETA-TURN-IR FER1_MAIZE -1 239 242 BETA-TURN-IR
+BETA-TURN-IR FER1_MAIZE -1 261 264 BETA-TURN-IR
+CATMAT-3 FER1_MAIZE -1 80 82 CATMAT-3
+CATMAT-3 FER1_MAIZE -1 87 89 CATMAT-3
+CATMAT-3 FER1_MAIZE -1 262 264 CATMAT-3
+NEST-RL FER1_MAIZE -1 124 126 NEST-RL
+NEST-RL FER1_MAIZE -1 241 243 NEST-RL
+NEST-RL FER1_MAIZE -1 292 294 NEST-RL
+ENDGROUP s3dm
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+-->
<html><!-- InstanceBegin template="/Templates/jtemplate.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<!-- InstanceBeginEditable name="doctitle" -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+-->
<html><!-- InstanceBegin template="/Templates/jtemplate.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<!-- InstanceBeginEditable name="doctitle" -->
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+/**
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-// default console to report messages\r
-var _console = document.getElementById("stdout");\r
-var _jvapps = new Array();\r
-// jvjmols is a list associating a jmol id to { modelstofiles }\r
-var _jvjmols = new Hashtable();\r
-// array of model names used to lookup index in Jmol\r
-var _modeltofiles = new Array();\r
-// counter for jmol structures\r
-var mnum = 1;\r
-\r
-function setConsole(console) {\r
- _console = console;\r
-}\r
-\r
-function getDestinationFrms(source, frames) {\r
- var frms = new Array();\r
- var frid = "";\r
- for (frm in frames) {\r
- try {\r
- frid = (source!=null) && (("" + source.getSequenceSetId()) == ("" + frames[frm].currentAlignFrame\r
- .getSequenceSetId()));\r
- } catch (q) {\r
- };\r
- \r
- if (!frames[frm].equals(source) && !frid\r
- && !frames[frm].currentAlignFrame.equals(source)) {\r
- frms[frms.length] = frames[frm];\r
- }\r
- }\r
- return frms;\r
-}\r
-\r
-function mouseover(list1, list2, list3, list4) {\r
- // list1 = new Object(list1);\r
- var list = new Array(("" + list1), ("" + list2), ("" + list3), ("" + list4));\r
- var msg = "Mouse over :\n" + "AlignFrame obj: " + list1 + " Seq : "\r
- + list[1] + "\nPos: " + list[2] + "(" + list[3] + ")\n";\r
-\r
- var flist = getDestinationFrms(list1, _jvapps);\r
- if (_console) {\r
- _console.value = msg + "\n";\r
- }\r
-\r
- for (follower in flist) {\r
- if (_console) {\r
- _console.value += "Sending to " + flist[follower] + "\n";\r
- }\r
- flist[follower].highlight(list[1], list[2], "true");\r
- }\r
- return true;\r
-}\r
-\r
-function sellist(list1, list2, list3, list4) {\r
- // list1 = new Object(list1);\r
- var list = new Array(("" + list1), ("" + list2), ("" + list3), ("" + list4));\r
- var msg = "Selection:\n" + "AlignFrame obj: " + list[0] + " id : "\r
- + list[1] + "\nSeqs " + list[2] + "\nColumns " + list[3] + "\n";\r
- var flist = getDestinationFrms(list1, _jvapps);\r
- if (_console) {\r
- _console.value = msg + "\n";\r
- }\r
- \r
- for (follower in flist) {\r
- if (_console) {\r
- _console.value += "Sending to " + flist[follower] + "\n";\r
- }\r
- flist[follower].selectIn(flist[follower].getDefaultTargetFrame(),\r
- list[2], list[3])\r
- }\r
- return true;\r
-}\r
-\r
-function viewlist(list1, list2, list3, list4) {\r
- // list1 = new Object(list1);\r
- var list = new Array(("" + list1), ("" + list2), ("" + list3), ("" + list4));\r
- var msg = "Viewport extent change::\n" + "AlignFrame obj: " + list[0]\r
- + " id : " + list[1] + "\nRow from " + list[2] + " and to "\r
- + list[3] + "\nVisible columns: " + list[4] + "\n";\r
- var flist = getDestinationFrms(list1, _jvapps);\r
- if (_console) {\r
- _console.value = msg + "\n";\r
- }\r
-\r
- for (follower in flist) {\r
- if (_console) {\r
- _console.value += "Sending to " + flist[follower] + "\n";\r
- }\r
- flist[follower].scrollToViewIn(flist[follower].getDefaultTargetFrame(),\r
- list[2], "-1");\r
- }\r
- return true;\r
-}\r
-\r
-// register a jalview applet and add some handlers to it\r
-// jmolView is a reference to a jmol applet that is displaying the PDB files listed (in order) in the modeltofiles Array\r
-function linkJvJmol(applet, jmolView, modeltofiles) {\r
- var i = _jvapps.length;\r
- while (i--) {\r
- if (_jvapps[i].equals(applet)) {\r
- throw ("Ignoring additional linkJvJmol call for "\r
- + applet.getName() + ".");\r
- }\r
- }\r
- _jvapps[_jvapps.length] = applet;\r
- applet.setMouseoverListener("mouseover");\r
- applet.setSelectionListener("sellist");\r
- // viewListener not fully implemented in 2.7\r
- // try { applet.setViewListener("viewlist"); } catch (err) {};\r
- if (jmolView)\r
- {\r
- var sep = applet.getSeparator();\r
- var oldjm=jmolView;\r
- // recover full id of Jmol applet\r
- jmolView=_jmolGetApplet(jmolView).id;\r
- var jmbinding=_jvjmols.get(jmolView);\r
- if (!jmbinding)\r
- { \r
- jmbinding=new Object();\r
- jmbinding._modelstofiles=new Array();\r
- jmbinding._fullmpath=new Array();\r
- jmbinding._filetonum=new Hashtable();\r
- jmbinding._jmol=jmolView;\r
- jmbinding._jmhandle=oldjm;\r
- _jvjmols.put(jmolView,jmbinding);\r
- }\r
- \r
- jmbinding._modelstofiles=jmbinding._modelstofiles.concat(jmbinding._modelstofiles,modeltofiles);\r
- jmbinding._jmol=jmolView;\r
- // now update structureListener list\r
- mtf="";\r
- var dbase = document.baseURI.substring(0,document.baseURI.lastIndexOf("/")+1);\r
- for (m in jmbinding._modelstofiles)\r
- { if (m>0) { mtf+=sep; }\r
- mtf+=jmbinding._modelstofiles[m];\r
- if (jmbinding._modelstofiles[m].indexOf("//")==-1)\r
- { jmbinding._fullmpath[m] = dbase+((jmbinding._modelstofiles[m].indexOf("/")==0) ? jmbinding._modelstofiles[m].substring(1) : jmbinding._modelstofiles[m]); }\r
- jmbinding._filetonum.put(jmbinding._modelstofiles[m], m+1); \r
- jmbinding._filetonum.put(jmbinding._fullmpath[m], m+1);\r
- \r
- }\r
- applet.setStructureListener("_structure", mtf);\r
- }\r
-}\r
-\r
-/*function _addJmolModel(jmolid, modelname) {\r
- modelname=""+modelname;\r
- var jminf = _jvjmols[jmolid];\r
- if (!jminf) {\r
- jminf = new Object();\r
- jminf._modelstofiles = new Array(); //new Hashtable();\r
- jminf._jmol = jmolid;\r
- jminf._modellist=new Array();\r
- _jvjmols[jmolid] = jminf;\r
- }\r
- var obj = new Object();\r
- jminf._modeltofiles[modelname] = obj; // .put(modelname, obj);\r
- obj.id = modelname;\r
- obj.mnum = jminf._modeltofiles.length;\r
- jminf._modellist+=modelname;\r
-}*/\r
-\r
-\r
-\r
-// jmol Jalview Methods\r
-\r
-function _structure(list1, list2, list3, list4) {\r
- var follower;\r
- // if (_console) { if (!_console.value) { _console.value="";} }\r
- if (list1 == "mouseover") {\r
- var list = new Array(("" + list1), ("" + list2), ("" + list3),\r
- ("" + list4));\r
- // 1 is pdb file, 2 is residue number, 3 is chain\r
- // list1 = new Object(list1);\r
- var base = list[1].indexOf(document.baseURI\r
- .substring(0, document.baseURI.lastIndexOf('/'))\r
- ); // .indexOf(_path);\r
- if (base==0) { base = document.baseURI.lastIndexOf('/'); }\r
- var sid = list[1]; // .substring(base);\r
- base = list[1].substring(0, base);\r
- if (_console) {\r
- _console.value += "Model is " + list[1] + ", Structure id is : "\r
- + sid + "\n";\r
- }\r
- ;\r
- var siddat;\r
- for ( var jmolappi in _jvjmols.values()) {\r
- var jmolapp=_jvjmols.values()[jmolappi];\r
- var msg = "";\r
- if (siddat = jmolapp._filetonum.get(sid)) {\r
- // we don't putin chain number because there isn't one ?\r
- // skip select 0 bit\r
- var ch = ""+list[3];\r
- if ((""+list[2]).trim().length==1)\r
- {\r
- ch+=":"+list[2];\r
- }\r
- msg = "select (" + ch + " /" + siddat + ") ;";\r
- }\r
- if (msg) {\r
- if (_console) {\r
- _console.value += "Sending '" + msg + "' to jmol." + "\n";\r
- }\r
- }\r
- jmolScriptWait(msg, "" + jmolapp._jmhandle);\r
- // only do highlight for one jmol ?\r
- // return 1;\r
- }\r
- }\r
- if (list1 == "colourstruct") {\r
- if (_console) {\r
- _console.value += 'colourStruct("' + list1 + '","' + list2\r
- + '") [' + list4 + ']' + "\n";\r
- }\r
- setTimeout('colourStruct("'+list4+'","' + list1 + '","' + list2 + '")', 1);\r
- return 1;\r
- }\r
- return 1;\r
-}\r
-// last colour message\r
-var _lastMsg = "";\r
-// indicator - if _colourStruct==0 then no colouring is going on\r
-var _colourStruct = 0;\r
-\r
-function colourStruct(involves, msg, handle) {\r
- if (_colourStruct == 0) {\r
- _colourStruct = 1;\r
- for (ap in _jvapps) {\r
- var _msg = "";\r
- do {\r
- if (_msg.match(/\S/)) {\r
- _lastMsg += _msg;\r
- }\r
- _msg = "" + _jvapps[ap].getJsMessage(msg, handle);\r
- } while (_msg.match(/\S/));\r
- }\r
- // locate the jmol that should get the message\r
- for (var jmol in _jvjmols.values())\r
- {\r
- var jml=_jvjmols.values()[jmol];\r
- if (jml._filetonum.get(involves))\r
- {\r
- colourStructs(jml._jmhandle);\r
- }\r
- }\r
- _colourStruct = 0;\r
- } else {\r
- // setTimeout('colourStruct("'+msg+'","'+handle+'")',3);\r
- }\r
-}\r
-\r
-function colourStructs(jmolapp) {\r
- dbg(0, "Colouring the structures\n");\r
- jmolScriptWait("set selectionhalos false;" + _lastMsg\r
- + "; select 0; set selectionhalos true;", jmolapp);\r
- _lastMsg = "";\r
-}\r
-var _jmolhovermsg="";\r
-function _jmolhover(jmid, atomlabel, atomidx) {\r
- var msg=""+jmid+" "+atomlabel+" "+atomidx;\r
- if (_jmolhovermsg==msg)\r
- {\r
- return;\r
- }\r
- _jmolhovermsg=msg;\r
- modeltofiles = _jvjmols.get(jmid)._modelstofiles;\r
- // atomlabel=(""+atomlabel).match(/\[(.+)\](\d+):(.)\.(\S+)\s*\/(\d+)\..+/);\r
- // relaxed third parameter - may be null or a model number for multi model\r
- // views\r
- atomlabel = ("" + atomlabel)\r
- .match(/\[(.+)\](\d+):(.)\.([^\/]+)(\/\d+\.|).+/);\r
- atomidx = "" + atomidx;\r
- if (atomlabel[5]) {\r
- atomlabel[5] = atomlabel[5].match(/\/(.+)\./)[1];\r
- atomlabel[5] = parseInt(atomlabel[5])-1;\r
- } else {\r
- // default - first model\r
- atomlabel[5] = 0;\r
- }\r
- // use atomlabel[5] to look up model filename so we can highlight associated positions in any jalviews\r
- for (ap in _jvapps) {\r
- _jvapps[ap].mouseOverStructure(atomlabel[2], atomlabel[3],\r
- document.baseURI\r
- .substring(0, document.baseURI.lastIndexOf('/'))\r
- + "/" + \r
- modeltofiles[atomlabel[5]]);\r
- msg = _jmolhovermsg;\r
- }\r
-}\r
-function _jmolpick(jmid, atomlabel, atomidx) {\r
- atomlabel = "" + atomlabel;\r
- atomidx = "" + atomidx;\r
- // label is atom id, atom number, and xyz coordinates in the form:\r
- // C6 #6 -0.30683374 -1.6836332 -0.716934\r
- // atom index, starting with 0.\r
-\r
-}\r
-function _jmolMessagecallback(jmid, statmess) {\r
- // if (statmess.indexOf("Script Terminated")==0)\r
- {\r
- var thisTime = new Date();\r
- if (_console) {\r
- _console.value += "Last script execution took : "\r
- + (thisTime.valueOf() - _lastTime.valueOf()) / 1000.0\r
- + " seconds.";\r
- }\r
- _lastTime = thisTime;\r
-\r
- }\r
-}\r
+ */
+// default console to report messages
+var _console = document.getElementById("stdout");
+var _jvapps = new Array();
+// jvjmols is a list associating a jmol id to { modelstofiles }
+var _jvjmols = new Hashtable();
+// array of model names used to lookup index in Jmol
+var _modeltofiles = new Array();
+// counter for jmol structures
+var mnum = 1;
+
+function setConsole(console) {
+ _console = console;
+}
+
+function getDestinationFrms(source, frames) {
+ var frms = new Array();
+ var frid = "";
+ for (frm in frames) {
+ try {
+ frid = (source!=null) && (("" + source.getSequenceSetId()) == ("" + frames[frm].currentAlignFrame
+ .getSequenceSetId()));
+ } catch (q) {
+ };
+
+ if (!frames[frm].equals(source) && !frid
+ && !frames[frm].currentAlignFrame.equals(source)) {
+ frms[frms.length] = frames[frm];
+ }
+ }
+ return frms;
+}
+
+function mouseover(list1, list2, list3, list4) {
+ // list1 = new Object(list1);
+ var list = new Array(("" + list1), ("" + list2), ("" + list3), ("" + list4));
+ var msg = "Mouse over :\n" + "AlignFrame obj: " + list1 + " Seq : "
+ + list[1] + "\nPos: " + list[2] + "(" + list[3] + ")\n";
+
+ var flist = getDestinationFrms(list1, _jvapps);
+ if (_console) {
+ _console.value = msg + "\n";
+ }
+
+ for (follower in flist) {
+ if (_console) {
+ _console.value += "Sending to " + flist[follower] + "\n";
+ }
+ flist[follower].highlight(list[1], list[2], "true");
+ }
+ return true;
+}
+
+function sellist(list1, list2, list3, list4) {
+ // list1 = new Object(list1);
+ var list = new Array(("" + list1), ("" + list2), ("" + list3), ("" + list4));
+ var msg = "Selection:\n" + "AlignFrame obj: " + list[0] + " id : "
+ + list[1] + "\nSeqs " + list[2] + "\nColumns " + list[3] + "\n";
+ var flist = getDestinationFrms(list1, _jvapps);
+ if (_console) {
+ _console.value = msg + "\n";
+ }
+
+ for (follower in flist) {
+ if (_console) {
+ _console.value += "Sending to " + flist[follower] + "\n";
+ }
+ flist[follower].selectIn(flist[follower].getDefaultTargetFrame(),
+ list[2], list[3])
+ }
+ return true;
+}
+
+function viewlist(list1, list2, list3, list4) {
+ // list1 = new Object(list1);
+ var list = new Array(("" + list1), ("" + list2), ("" + list3), ("" + list4));
+ var msg = "Viewport extent change::\n" + "AlignFrame obj: " + list[0]
+ + " id : " + list[1] + "\nRow from " + list[2] + " and to "
+ + list[3] + "\nVisible columns: " + list[4] + "\n";
+ var flist = getDestinationFrms(list1, _jvapps);
+ if (_console) {
+ _console.value = msg + "\n";
+ }
+
+ for (follower in flist) {
+ if (_console) {
+ _console.value += "Sending to " + flist[follower] + "\n";
+ }
+ flist[follower].scrollToViewIn(flist[follower].getDefaultTargetFrame(),
+ list[2], "-1");
+ }
+ return true;
+}
+
+// register a jalview applet and add some handlers to it
+// jmolView is a reference to a jmol applet that is displaying the PDB files listed (in order) in the modeltofiles Array
+function linkJvJmol(applet, jmolView, modeltofiles) {
+ var i = _jvapps.length;
+ while (i--) {
+ if (_jvapps[i].equals(applet)) {
+ throw ("Ignoring additional linkJvJmol call for "
+ + applet.getName() + ".");
+ }
+ }
+ _jvapps[_jvapps.length] = applet;
+ applet.setMouseoverListener("mouseover");
+ applet.setSelectionListener("sellist");
+ // viewListener not fully implemented in 2.7
+ // try { applet.setViewListener("viewlist"); } catch (err) {};
+ if (jmolView)
+ {
+ var sep = applet.getSeparator();
+ var oldjm=jmolView;
+ // recover full id of Jmol applet
+ jmolView=_jmolGetApplet(jmolView).id;
+ var jmbinding=_jvjmols.get(jmolView);
+ if (!jmbinding)
+ {
+ jmbinding=new Object();
+ jmbinding._modelstofiles=new Array();
+ jmbinding._fullmpath=new Array();
+ jmbinding._filetonum=new Hashtable();
+ jmbinding._jmol=jmolView;
+ jmbinding._jmhandle=oldjm;
+ _jvjmols.put(jmolView,jmbinding);
+ }
+
+ jmbinding._modelstofiles=jmbinding._modelstofiles.concat(jmbinding._modelstofiles,modeltofiles);
+ jmbinding._jmol=jmolView;
+ // now update structureListener list
+ mtf="";
+ var dbase = document.baseURI.substring(0,document.baseURI.lastIndexOf("/")+1);
+ for (m in jmbinding._modelstofiles)
+ { if (m>0) { mtf+=sep; }
+ mtf+=jmbinding._modelstofiles[m];
+ if (jmbinding._modelstofiles[m].indexOf("//")==-1)
+ { jmbinding._fullmpath[m] = dbase+((jmbinding._modelstofiles[m].indexOf("/")==0) ? jmbinding._modelstofiles[m].substring(1) : jmbinding._modelstofiles[m]); }
+ jmbinding._filetonum.put(jmbinding._modelstofiles[m], m+1);
+ jmbinding._filetonum.put(jmbinding._fullmpath[m], m+1);
+
+ }
+ applet.setStructureListener("_structure", mtf);
+ }
+}
+
+/*function _addJmolModel(jmolid, modelname) {
+ modelname=""+modelname;
+ var jminf = _jvjmols[jmolid];
+ if (!jminf) {
+ jminf = new Object();
+ jminf._modelstofiles = new Array(); //new Hashtable();
+ jminf._jmol = jmolid;
+ jminf._modellist=new Array();
+ _jvjmols[jmolid] = jminf;
+ }
+ var obj = new Object();
+ jminf._modeltofiles[modelname] = obj; // .put(modelname, obj);
+ obj.id = modelname;
+ obj.mnum = jminf._modeltofiles.length;
+ jminf._modellist+=modelname;
+}*/
+
+
+
+// jmol Jalview Methods
+
+function _structure(list1, list2, list3, list4) {
+ var follower;
+ // if (_console) { if (!_console.value) { _console.value="";} }
+ if (list1 == "mouseover") {
+ var list = new Array(("" + list1), ("" + list2), ("" + list3),
+ ("" + list4));
+ // 1 is pdb file, 2 is residue number, 3 is chain
+ // list1 = new Object(list1);
+ var base = list[1].indexOf(document.baseURI
+ .substring(0, document.baseURI.lastIndexOf('/'))
+ ); // .indexOf(_path);
+ if (base==0) { base = document.baseURI.lastIndexOf('/'); }
+ var sid = list[1]; // .substring(base);
+ base = list[1].substring(0, base);
+ if (_console) {
+ _console.value += "Model is " + list[1] + ", Structure id is : "
+ + sid + "\n";
+ }
+ ;
+ var siddat;
+ for ( var jmolappi in _jvjmols.values()) {
+ var jmolapp=_jvjmols.values()[jmolappi];
+ var msg = "";
+ if (siddat = jmolapp._filetonum.get(sid)) {
+ // we don't putin chain number because there isn't one ?
+ // skip select 0 bit
+ var ch = ""+list[3];
+ if ((""+list[2]).trim().length==1)
+ {
+ ch+=":"+list[2];
+ }
+ msg = "select (" + ch + " /" + siddat + ") ;";
+ }
+ if (msg) {
+ if (_console) {
+ _console.value += "Sending '" + msg + "' to jmol." + "\n";
+ }
+ }
+ jmolScriptWait(msg, "" + jmolapp._jmhandle);
+ // only do highlight for one jmol ?
+ // return 1;
+ }
+ }
+ if (list1 == "colourstruct") {
+ if (_console) {
+ _console.value += 'colourStruct("' + list1 + '","' + list2
+ + '") [' + list4 + ']' + "\n";
+ }
+ setTimeout('colourStruct("'+list4+'","' + list1 + '","' + list2 + '")', 1);
+ return 1;
+ }
+ return 1;
+}
+// last colour message
+var _lastMsg = "";
+// indicator - if _colourStruct==0 then no colouring is going on
+var _colourStruct = 0;
+
+function colourStruct(involves, msg, handle) {
+ if (_colourStruct == 0) {
+ _colourStruct = 1;
+ for (ap in _jvapps) {
+ var _msg = "";
+ do {
+ if (_msg.match(/\S/)) {
+ _lastMsg += _msg;
+ }
+ _msg = "" + _jvapps[ap].getJsMessage(msg, handle);
+ } while (_msg.match(/\S/));
+ }
+ // locate the jmol that should get the message
+ for (var jmol in _jvjmols.values())
+ {
+ var jml=_jvjmols.values()[jmol];
+ if (jml._filetonum.get(involves))
+ {
+ colourStructs(jml._jmhandle);
+ }
+ }
+ _colourStruct = 0;
+ } else {
+ // setTimeout('colourStruct("'+msg+'","'+handle+'")',3);
+ }
+}
+
+function colourStructs(jmolapp) {
+ dbg(0, "Colouring the structures\n");
+ jmolScriptWait("set selectionhalos false;" + _lastMsg
+ + "; select 0; set selectionhalos true;", jmolapp);
+ _lastMsg = "";
+}
+var _jmolhovermsg="";
+function _jmolhover(jmid, atomlabel, atomidx) {
+ var msg=""+jmid+" "+atomlabel+" "+atomidx;
+ if (_jmolhovermsg==msg)
+ {
+ return;
+ }
+ _jmolhovermsg=msg;
+ modeltofiles = _jvjmols.get(jmid)._modelstofiles;
+ // atomlabel=(""+atomlabel).match(/\[(.+)\](\d+):(.)\.(\S+)\s*\/(\d+)\..+/);
+ // relaxed third parameter - may be null or a model number for multi model
+ // views
+ atomlabel = ("" + atomlabel)
+ .match(/\[(.+)\](\d+):(.)\.([^\/]+)(\/\d+\.|).+/);
+ atomidx = "" + atomidx;
+ if (atomlabel[5]) {
+ atomlabel[5] = atomlabel[5].match(/\/(.+)\./)[1];
+ atomlabel[5] = parseInt(atomlabel[5])-1;
+ } else {
+ // default - first model
+ atomlabel[5] = 0;
+ }
+ // use atomlabel[5] to look up model filename so we can highlight associated positions in any jalviews
+ for (ap in _jvapps) {
+ _jvapps[ap].mouseOverStructure(atomlabel[2], atomlabel[3],
+ document.baseURI
+ .substring(0, document.baseURI.lastIndexOf('/'))
+ + "/" +
+ modeltofiles[atomlabel[5]]);
+ msg = _jmolhovermsg;
+ }
+}
+function _jmolpick(jmid, atomlabel, atomidx) {
+ atomlabel = "" + atomlabel;
+ atomidx = "" + atomidx;
+ // label is atom id, atom number, and xyz coordinates in the form:
+ // C6 #6 -0.30683374 -1.6836332 -0.716934
+ // atom index, starting with 0.
+
+}
+function _jmolMessagecallback(jmid, statmess) {
+ // if (statmess.indexOf("Script Terminated")==0)
+ {
+ var thisTime = new Date();
+ if (_console) {
+ _console.value += "Last script execution took : "
+ + (thisTime.valueOf() - _lastTime.valueOf()) / 1000.0
+ + " seconds.";
+ }
+ _lastTime = thisTime;
+
+ }
+}
<html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+-->
<head><title>Opening JalviewLite from Javascript</title>
</head>
<body>
</body>
-</html>
\ No newline at end of file
+</html>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">\r
-<html><!-- InstanceBegin template="/Templates/jtemplate.dwt" codeOutsideHTMLIsLocked="false" -->\r
-<head>\r
-<!-- InstanceBeginEditable name="doctitle" -->\r
-<title>Linked Jalview Applets Demo</title>\r
-<!-- InstanceEndEditable --> \r
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><meta http-equiv="keywords" content="jalview,multiple,sequence,alignment,editor,viewer,java,download,barton group,protein,dna,das,distributed annotation system">\r
-<!-- InstanceBeginEditable name="head" -->\r
-<script src="http://www.java.com/js/deployJava.js"></script>\r
-<script src="javascript/jalview.js" language="javascript"></script>\r
-<script> //deployJava.debug="true";\r
- \r
- function lJvApp() {\r
- var jvapp = document.getElementById("jvapp");\r
- var jvfollower = document.getElementById("jvfollower");\r
- setConsole(document.getElementById("stdout"));\r
- //jvapp.setSeparator(""+jvapp.getSeparator());\r
- linkJvJmol(jvapp);\r
- };\r
-\r
- function lJvFollow() {\r
- var jvapp = document.getElementById("jvapp");\r
- var jvfollower = document.getElementById("jvfollower");\r
- //jvfollower.setSeparator(""+jvfollower.getSeparator());\r
- linkJvJmol(jvfollower);\r
- };\r
-</script>\r
-\r
-<!-- InstanceEndEditable --> \r
-<style type="text/css">\r
-<!--\r
-td {\r
- font-family: Geneva, Arial, Helvetica, sans-serif;\r
- font-size: 12px;\r
-}\r
-.plain {\r
- font-family: Verdana, Arial, Helvetica, sans-serif;\r
- font-size: 14px;\r
- text-decoration: none;\r
-}\r
-.plain:hover{\r
- background-color:#000000; color: #F2F2FF;\r
-}\r
- \r
--->\r
-</style>\r
-<script language="JavaScript">\r
-function genHref()\r
-{\r
-var s1 = "ml:ljvwr", s2 = "athpai.g", s3 = "ioe@leo ", href="";\r
-for(i=0; i<8; i++)\r
-{href = href + s1.charAt(i) + s2.charAt(i) + s3.charAt(i); }\r
-window.location=href;\r
-}\r
-function getEventTarget(e)\r
-{\r
-if(!e)\r
-e = window.event;\r
-if(e.target)\r
-return e.target;\r
-return e.srcElement;\r
-}\r
-</script>\r
-</head>\r
-<body alink="#000000" vlink="#000000" link="#000000">\r
-<script type="text/javascript">\r
-var gaJsHost = (("https:" == document.location.protocol) ? \r
-"https://ssl." : "http://www.");\r
-document.write(unescape("%3Cscript src='" + gaJsHost + \r
-"google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));\r
-</script>\r
-<script type="text/javascript">\r
-try{\r
-var pageTracker = _gat._getTracker("UA-9060947-1");\r
-pageTracker._trackPageview();\r
-} catch(err) {}\r
-</script>\r
-<div align="left"> \r
- <table width="805" height="100" cellpadding="5">\r
- <tr>\r
- <td background="../jalview.gif"> <a href="http://www.compbio.dundee.ac.uk" target="NEW"><img src="../uodc_r1_c1.gif" width="143" height="101" border="1"></a></td>\r
- </tr>\r
- </table>\r
- <table width="805" border="0" cellpadding="5" cellspacing="5">\r
- <tr> \r
- <td width="183" valign="top" bgcolor="#F2F2FF" border="5"> \r
- \r
- <div align="center">\r
- <table width="182" height="386" border="0" cellpadding="0" cellspacing="0">\r
- <tr> \r
- <td align="left" valign="middle"><a href="../index.html" class="plain">Home</a></td>\r
- </tr>\r
- <tr> \r
- <td align="left" valign="middle"><a href="../overview.html" class="plain">Overview</a></td>\r
- </tr>\r
- <tr> \r
- <td align="left" valign="middle"><a href="../download.html" class="plain">Download</a></td>\r
- </tr>\r
- <tr> \r
- <td align="left" valign="middle"><a href="applets.html" class="plain">Applet \r
- Version</a></td>\r
- </tr>\r
- <tr> \r
- <td align="left" valign="middle"><a href="examples.html" class="plain">Screenshots</a></td>\r
- </tr>\r
- <tr> \r
- <td align="left" valign="middle"><a href="../faq.html" class="plain">FAQ</a></td>\r
- </tr>\r
- <tr> \r
- <td align="left" valign="middle"><a href="../documentList.html" class="plain">Documentation</a></td>\r
- </tr>\r
- <tr>\r
- <td align="left" valign="middle" ><a href="../releaseHistory.html" class="plain">Release \r
- history</a></td>\r
- </tr>\r
- <tr> \r
- <td align="left" valign="middle"><a href="../source/source.html" class="plain">Source \r
- Code</a></td>\r
- </tr>\r
- <tr> \r
- <td align="left" valign="middle"><a href="../versions.html" class="plain">Development Version</a></td>\r
- </tr>\r
- <tr> \r
- <td align="left" valign="middle"><a href="../links.html" class="plain">Links</a></td>\r
- </tr>\r
- <tr> \r
- <td align="left" valign="middle"><a href="http://www.jalview.org/mailman/listinfo/jalview-announce" class="plain" target="NEW">News \r
- Mailing List</a></td>\r
- </tr>\r
- <tr>\r
- <td align="left" valign="middle"><a\r
- href="http://www.jalview.org/mailman/listinfo/jalview-discuss"\r
- class="plain" target="NEW">Discussion Mailing List</a><br><br><em>Please send problems<br>and\r
- bug reports to the discussion list.</em></td>\r
- </tr>\r
- <tr></tr>\r
- <tr>\r
- <!--<td align="left" valign="middle"><br>\r
- Please send problems<br>and\r
- bug reports to:<br><a href="#" onClick="javascript:genHref();"><img src="../help.gif" width="123" height="19" border="0"></a></td>-->\r
- </tr>\r
- </table>\r
- </div>\r
- <div align="center"> <a href="http://www.bbsrc.ac.uk/" target="NEW"><br>\r
- <img src="../bbsrc-new.gif" width="179" height="64" border="1"></a> \r
- </div>\r
- </td>\r
- <td valign="top" width="587" bgcolor="#F2F2FF"><!-- InstanceBeginEditable name="Contents" -->\r
- <p> </p>\r
- <strong>JalviewLite Linked Applets Demo<br></strong>\r
- <p>The two applets below use <a href="JalviewLiteJs.html">JalviewLite's javascript API</a> to exchange events about the currently selected region and mouse position in the alignment.\r
- </p>\r
- <p>See the other demonstration pages below to see the API in action:</p>\r
- <ul>\r
- <li><a href="formComplete.html">use Javascript to control and get data from JalviewLite</a></li>\r
- <li><a href="embeddedWJmol.html">configure JalviewLite to talk to a Jmol applet on the page.</a></li>\r
- <li><a href="javascriptLaunch.html">launch JalviewLite from a javascript button</a></li>\r
- \r
- </ul>\r
- <script> \r
- var attributes = {\r
- code : 'jalview.bin.JalviewLite',\r
- archive : 'jalviewApplet.jar',\r
- width : 800,\r
- height : 300,\r
- mayscript : 'True', scriptable: 'True',\r
- id : 'jvapp'\r
- };\r
- var parameters = {\r
- oninit : "lJvApp",\r
- automaticScrolling : "true",\r
- file : "plantfdx.fa",\r
- annotations : "plantfdx.annotations",\r
- debug : "true",\r
- wrap : "false",\r
- // separator : "^",\r
- showAnnotation : "true",\r
- embedded : "true",\r
- showFullId : "false",\r
- RGB : "F2F2FF",\r
- linkLabel_1 : "SRS",\r
- linkUrl_1 : "http://srs.ebi.ac.uk/srs7bin/cgi-bin/wgetz?-e+[uniprot-all:$SEQUENCE_ID$]+-vn+2"\r
- \r
- ,\r
- linkLabel_2 : "Uniprot"\r
- \r
- ,\r
- linkUrl_2 : "http://us.expasy.org/cgi-bin/niceprot.pl?$SEQUENCE_ID$",\r
- APPLICATION_URL : "http://www.jalview.org/services/launchApp"\r
- };\r
- \r
- deployJava.runApplet(attributes, parameters, '1.6');\r
-</script>\r
-<script> \r
- var attributes = {\r
- code : 'jalview.bin.JalviewLite',\r
- archive : 'jalviewApplet.jar',\r
- width : 800,\r
- height : 300,\r
- mayscript : 'True', scriptable: 'True',\r
- id : "jvfollower"\r
- };\r
- var parameters = {\r
- oninit : "lJvFollow",\r
- file : "plantfdx.fa",\r
- annotations : "plantfdx.annotations",\r
- automaticScrolling : "true",\r
- debug : "true",\r
- wrap : "false",\r
- // separator : "^",\r
- showAnnotation : "true",\r
- embedded : "true",\r
- showFullId : "false",\r
- RGB : "F2F2FF",\r
- linkLabel_1 : "SRS",\r
- linkUrl_1 : "http://srs.ebi.ac.uk/srs7bin/cgi-bin/wgetz?-e+[uniprot-all:$SEQUENCE_ID$]+-vn+2"\r
- \r
- ,\r
- linkLabel_2 : "Uniprot"\r
- \r
- ,\r
- linkUrl_2 : "http://us.expasy.org/cgi-bin/niceprot.pl?$SEQUENCE_ID$",\r
- APPLICATION_URL : "http://www.jalview.org/services/launchApp"\r
- };\r
- deployJava.runApplet(attributes, parameters, '1.6');\r
-</script>\r
- <p>\r
-<!-- <a href="javascript:linkJvJmol()">Click Me If you don't see any messages below</a>\r
- <br>\r
- --><form name="console" id="console"><textarea name="output"\r
- id="stdout" rows="20" cols="80">Messages will appear here.</textarea></form>\r
- <br>\r
-</p>\r
-\r
-</body>\r
-</html>
\ No newline at end of file
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+-->
+<html><!-- InstanceBegin template="/Templates/jtemplate.dwt" codeOutsideHTMLIsLocked="false" -->
+<head>
+<!-- InstanceBeginEditable name="doctitle" -->
+<title>Linked Jalview Applets Demo</title>
+<!-- InstanceEndEditable -->
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><meta http-equiv="keywords" content="jalview,multiple,sequence,alignment,editor,viewer,java,download,barton group,protein,dna,das,distributed annotation system">
+<!-- InstanceBeginEditable name="head" -->
+<script src="http://www.java.com/js/deployJava.js"></script>
+<script src="javascript/jalview.js" language="javascript"></script>
+<script> //deployJava.debug="true";
+
+ function lJvApp() {
+ var jvapp = document.getElementById("jvapp");
+ var jvfollower = document.getElementById("jvfollower");
+ setConsole(document.getElementById("stdout"));
+ //jvapp.setSeparator(""+jvapp.getSeparator());
+ linkJvJmol(jvapp);
+ };
+
+ function lJvFollow() {
+ var jvapp = document.getElementById("jvapp");
+ var jvfollower = document.getElementById("jvfollower");
+ //jvfollower.setSeparator(""+jvfollower.getSeparator());
+ linkJvJmol(jvfollower);
+ };
+</script>
+
+<!-- InstanceEndEditable -->
+<style type="text/css">
+<!--
+td {
+ font-family: Geneva, Arial, Helvetica, sans-serif;
+ font-size: 12px;
+}
+.plain {
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size: 14px;
+ text-decoration: none;
+}
+.plain:hover{
+ background-color:#000000; color: #F2F2FF;
+}
+
+-->
+</style>
+<script language="JavaScript">
+function genHref()
+{
+var s1 = "ml:ljvwr", s2 = "athpai.g", s3 = "ioe@leo ", href="";
+for(i=0; i<8; i++)
+{href = href + s1.charAt(i) + s2.charAt(i) + s3.charAt(i); }
+window.location=href;
+}
+function getEventTarget(e)
+{
+if(!e)
+e = window.event;
+if(e.target)
+return e.target;
+return e.srcElement;
+}
+</script>
+</head>
+<body alink="#000000" vlink="#000000" link="#000000">
+<script type="text/javascript">
+var gaJsHost = (("https:" == document.location.protocol) ?
+"https://ssl." : "http://www.");
+document.write(unescape("%3Cscript src='" + gaJsHost +
+"google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
+</script>
+<script type="text/javascript">
+try{
+var pageTracker = _gat._getTracker("UA-9060947-1");
+pageTracker._trackPageview();
+} catch(err) {}
+</script>
+<div align="left">
+ <table width="805" height="100" cellpadding="5">
+ <tr>
+ <td background="../jalview.gif"> <a href="http://www.compbio.dundee.ac.uk" target="NEW"><img src="../uodc_r1_c1.gif" width="143" height="101" border="1"></a></td>
+ </tr>
+ </table>
+ <table width="805" border="0" cellpadding="5" cellspacing="5">
+ <tr>
+ <td width="183" valign="top" bgcolor="#F2F2FF" border="5">
+
+ <div align="center">
+ <table width="182" height="386" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td align="left" valign="middle"><a href="../index.html" class="plain">Home</a></td>
+ </tr>
+ <tr>
+ <td align="left" valign="middle"><a href="../overview.html" class="plain">Overview</a></td>
+ </tr>
+ <tr>
+ <td align="left" valign="middle"><a href="../download.html" class="plain">Download</a></td>
+ </tr>
+ <tr>
+ <td align="left" valign="middle"><a href="applets.html" class="plain">Applet
+ Version</a></td>
+ </tr>
+ <tr>
+ <td align="left" valign="middle"><a href="examples.html" class="plain">Screenshots</a></td>
+ </tr>
+ <tr>
+ <td align="left" valign="middle"><a href="../faq.html" class="plain">FAQ</a></td>
+ </tr>
+ <tr>
+ <td align="left" valign="middle"><a href="../documentList.html" class="plain">Documentation</a></td>
+ </tr>
+ <tr>
+ <td align="left" valign="middle" ><a href="../releaseHistory.html" class="plain">Release
+ history</a></td>
+ </tr>
+ <tr>
+ <td align="left" valign="middle"><a href="../source/source.html" class="plain">Source
+ Code</a></td>
+ </tr>
+ <tr>
+ <td align="left" valign="middle"><a href="../versions.html" class="plain">Development Version</a></td>
+ </tr>
+ <tr>
+ <td align="left" valign="middle"><a href="../links.html" class="plain">Links</a></td>
+ </tr>
+ <tr>
+ <td align="left" valign="middle"><a href="http://www.jalview.org/mailman/listinfo/jalview-announce" class="plain" target="NEW">News
+ Mailing List</a></td>
+ </tr>
+ <tr>
+ <td align="left" valign="middle"><a
+ href="http://www.jalview.org/mailman/listinfo/jalview-discuss"
+ class="plain" target="NEW">Discussion Mailing List</a><br><br><em>Please send problems<br>and
+ bug reports to the discussion list.</em></td>
+ </tr>
+ <tr></tr>
+ <tr>
+ <!--<td align="left" valign="middle"><br>
+ Please send problems<br>and
+ bug reports to:<br><a href="#" onClick="javascript:genHref();"><img src="../help.gif" width="123" height="19" border="0"></a></td>-->
+ </tr>
+ </table>
+ </div>
+ <div align="center"> <a href="http://www.bbsrc.ac.uk/" target="NEW"><br>
+ <img src="../bbsrc-new.gif" width="179" height="64" border="1"></a>
+ </div>
+ </td>
+ <td valign="top" width="587" bgcolor="#F2F2FF"><!-- InstanceBeginEditable name="Contents" -->
+ <p> </p>
+ <strong>JalviewLite Linked Applets Demo<br></strong>
+ <p>The two applets below use <a href="JalviewLiteJs.html">JalviewLite's javascript API</a> to exchange events about the currently selected region and mouse position in the alignment.
+ </p>
+ <p>See the other demonstration pages below to see the API in action:</p>
+ <ul>
+ <li><a href="formComplete.html">use Javascript to control and get data from JalviewLite</a></li>
+ <li><a href="embeddedWJmol.html">configure JalviewLite to talk to a Jmol applet on the page.</a></li>
+ <li><a href="javascriptLaunch.html">launch JalviewLite from a javascript button</a></li>
+
+ </ul>
+ <script>
+ var attributes = {
+ code : 'jalview.bin.JalviewLite',
+ archive : 'jalviewApplet.jar',
+ width : 800,
+ height : 300,
+ mayscript : 'True', scriptable: 'True',
+ id : 'jvapp'
+ };
+ var parameters = {
+ oninit : "lJvApp",
+ automaticScrolling : "true",
+ file : "plantfdx.fa",
+ annotations : "plantfdx.annotations",
+ debug : "true",
+ wrap : "false",
+ // separator : "^",
+ showAnnotation : "true",
+ embedded : "true",
+ showFullId : "false",
+ RGB : "F2F2FF",
+ linkLabel_1 : "SRS",
+ linkUrl_1 : "http://srs.ebi.ac.uk/srs7bin/cgi-bin/wgetz?-e+[uniprot-all:$SEQUENCE_ID$]+-vn+2"
+
+ ,
+ linkLabel_2 : "Uniprot"
+
+ ,
+ linkUrl_2 : "http://us.expasy.org/cgi-bin/niceprot.pl?$SEQUENCE_ID$",
+ APPLICATION_URL : "http://www.jalview.org/services/launchApp"
+ };
+
+ deployJava.runApplet(attributes, parameters, '1.6');
+</script>
+<script>
+ var attributes = {
+ code : 'jalview.bin.JalviewLite',
+ archive : 'jalviewApplet.jar',
+ width : 800,
+ height : 300,
+ mayscript : 'True', scriptable: 'True',
+ id : "jvfollower"
+ };
+ var parameters = {
+ oninit : "lJvFollow",
+ file : "plantfdx.fa",
+ annotations : "plantfdx.annotations",
+ automaticScrolling : "true",
+ debug : "true",
+ wrap : "false",
+ // separator : "^",
+ showAnnotation : "true",
+ embedded : "true",
+ showFullId : "false",
+ RGB : "F2F2FF",
+ linkLabel_1 : "SRS",
+ linkUrl_1 : "http://srs.ebi.ac.uk/srs7bin/cgi-bin/wgetz?-e+[uniprot-all:$SEQUENCE_ID$]+-vn+2"
+
+ ,
+ linkLabel_2 : "Uniprot"
+
+ ,
+ linkUrl_2 : "http://us.expasy.org/cgi-bin/niceprot.pl?$SEQUENCE_ID$",
+ APPLICATION_URL : "http://www.jalview.org/services/launchApp"
+ };
+ deployJava.runApplet(attributes, parameters, '1.6');
+</script>
+ <p>
+<!-- <a href="javascript:linkJvJmol()">Click Me If you don't see any messages below</a>
+ <br>
+ --><form name="console" id="console"><textarea name="output"
+ id="stdout" rows="20" cols="80">Messages will appear here.</textarea></form>
+ <br>
+</p>
+
+</body>
+</html>
<?xml version="1.0" encoding="ISO-8859-1" ?>\r
+<!--\r
+ Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)\r
+ Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle\r
+ \r
+ This file is part of Jalview.\r
+ \r
+ Jalview is free software: you can redistribute it and/or\r
+ modify it under the terms of the GNU General Public License \r
+ as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
+ \r
+ Jalview is distributed in the hope that it will be useful, but \r
+ WITHOUT ANY WARRANTY; without even the implied warranty \r
+ of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
+ PURPOSE. See the GNU General Public License for more details.\r
+ \r
+ You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
+-->\r
<!DOCTYPE helpset PUBLIC "-//Sun Microsystems Inc.//DTD JavaHelp HelpSet Version 1.0//EN" "http://java.sun.com/products/javahelp/helpset_1_0.dtd">\r
<helpset version="1.0">\r
<!-- title -->\r
<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+ Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+
+ This file is part of Jalview.
+
+ Jalview is free software: you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+
+ Jalview is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty
+ of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+-->
<!DOCTYPE map PUBLIC "-//Sun Microsystems Inc.//DTD JavaHelp Map Version 1.0//EN" "http://java.sun.com/products/javahelp/map_1_0.dtd">
<map version="1.0">
<mapID target="home" url="html/index.html" />
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+
+ This file is part of Jalview.
+
+ Jalview is free software: you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+
+ Jalview is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty
+ of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
-->
<!DOCTYPE toc PUBLIC "-//Sun Microsystems Inc.//DTD JavaHelp TOC Version 1.0//EN" "http://java.sun.com/products/javahelp/toc_1_0.dtd">
<toc version="1.0">
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+-->
<head>
<title>Substitution matrices in Jalview</title>
</head>
and ambiguity codes</a>
</em></strong>
</body>
-</html>
\ No newline at end of file
+</html>
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-<html>\r
-<!--\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
--->\r
-<head>\r
-<title>DNA Sequence Coding Region Definition</title>\r
-</head>\r
-<body>\r
-<p><strong>DNA Sequence Coding Region Definition</strong></p>\r
-<p>Jalview includes the standard DNA codon translation table in\r
-order to be able to dynamically translate cDNA to its expressed\r
-protein sequence. DNA Sequence Coding Regions are sequence \r
-features that can be defined on any DNA sequence in order to\r
-mark stretches of cDNA that will be concatenated to form the\r
-series of codons that are translated by the <strong>"\r
-Calculate→Translate cDNA"</strong> menu function. \r
-</p>\r
-</body>\r
-</html>\r
+<html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+-->
+<head>
+<title>DNA Sequence Coding Region Definition</title>
+</head>
+<body>
+<p><strong>DNA Sequence Coding Region Definition</strong></p>
+<p>Jalview includes the standard DNA codon translation table in
+order to be able to dynamically translate cDNA to its expressed
+protein sequence. DNA Sequence Coding Regions are sequence
+features that can be defined on any DNA sequence in order to
+mark stretches of cDNA that will be concatenated to form the
+series of codons that are translated by the <strong>"
+Calculate→Translate cDNA"</strong> menu function.
+</p>
+</body>
+</html>
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-<html>\r
-<!--\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
--->\r
-<head>\r
-<title>Groovy Shell</title>\r
-</head>\r
-<body>\r
- <p>\r
- <strong>The Groovy Shell</strong>\r
- </p>\r
- <p>\r
- <a href="http://groovy.codehaus.org/">Groovy</a> is an "<em>agile\r
- and dynamic language for the Java platform</em>". The groovy\r
- scripting language makes it extremely easy to programmatically\r
- interact with Java programs, in much the same way that Javascript is\r
- used to generate and interact with applets and other objects on the\r
- page.\r
- </p>\r
- <p>\r
- <strong><em>Getting Groovy...</em>\r
- </strong><br> Jalview Groovy support is only possible if the core groovy\r
- jars which include the GroovyShell are present on the CLASSPATH when\r
- Jalview is started.\r
- </p>\r
- <p>\r
- The jars are obtained from the <em>embedded</em> directory within the\r
- <a href="http://dist.codehaus.org/groovy/distributions">groovy\r
- distribution</a>. The easiest way of adding them to the Jalview classpath\r
- is to download and build jalview from it's source distribution, and\r
- then add the groovy-all-*.jar to the lib directory whose path is given\r
- in the java.ext.dirs property.\r
- </p>\r
- <p>\r
- <strong>Opening Jalview's Groovy Console</strong><br>If groovy is\r
- available, then the <strong>Tools→Groovy Console...</strong>\r
- menu entry will be available from the Jalview Desktop's drop-down\r
- menu. Selecting this will open the <a\r
- href="http://groovy.codehaus.org/Groovy+Console">Groovy Console</a>\r
- which allows you to interactively execute Groovy scripts within the\r
- Jalview run-time environment.\r
- </p>\r
- <p>\r
- <strong>Executing groovy scripts on Jalview startup</strong><br>\r
- The -groovy <script> option on the <a href="commandline.html" />\r
- Jalview command line</a> will execute the contents of <script>.\r
- <script> may be a file, a URL, or alternatively if it is\r
- "STDIN" then the standard input will be used.<br>\r
- <em>Note: The groovy script will be executed <strong>after</strong>\r
- any data is loaded, and <strong>before</strong> images or any output\r
- files are written. This allows you to perform customised jalview\r
- analysis workflows with groovy.</em>\r
- </p>\r
- <p>\r
- <strong>Access to Jalview's functions from Groovy Scripts</strong><br>\r
- There is as yet no properly defined scripting interface to Jalview,\r
- but all the public methods of the jalview class hierarchy can be\r
- called from Groovy scripts. The access point for this is the <strong>Jalview</strong>\r
- object defined in the groovy environent which corresponds to the\r
- <pre>jalview.gui.Desktop</pre>\r
- object which manages all the Jalview windows.\r
- </p>\r
- Here's an example to get you started:\r
- <br>\r
- <ul>\r
- <li>Getting the title, alignment and first sequence from the\r
- current alignFrame<br> <pre>\r
-def alf = Jalview.getAlignframes();\r
-print alf[0].getTitle();\r
-def alignment = alf[0].viewport.alignment;\r
-def seq = alignment.getSequenceAt(0);\r
-</pre></li>\r
-<li>When running a groovy script from the command line, the alignment that was just loaded can be referred to like so:<br><pre>\r
-print currentAlFrame.getTitle();</pre>\r
- </ul>\r
- </p>\r
-\r
- <p> </p>\r
-</body>\r
-</html>\r
+<html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+-->
+<head>
+<title>Groovy Shell</title>
+</head>
+<body>
+ <p>
+ <strong>The Groovy Shell</strong>
+ </p>
+ <p>
+ <a href="http://groovy.codehaus.org/">Groovy</a> is an "<em>agile
+ and dynamic language for the Java platform</em>". The groovy
+ scripting language makes it extremely easy to programmatically
+ interact with Java programs, in much the same way that Javascript is
+ used to generate and interact with applets and other objects on the
+ page.
+ </p>
+ <p>
+ <strong><em>Getting Groovy...</em>
+ </strong><br> Jalview Groovy support is only possible if the core groovy
+ jars which include the GroovyShell are present on the CLASSPATH when
+ Jalview is started.
+ </p>
+ <p>
+ The jars are obtained from the <em>embedded</em> directory within the
+ <a href="http://dist.codehaus.org/groovy/distributions">groovy
+ distribution</a>. The easiest way of adding them to the Jalview classpath
+ is to download and build jalview from it's source distribution, and
+ then add the groovy-all-*.jar to the lib directory whose path is given
+ in the java.ext.dirs property.
+ </p>
+ <p>
+ <strong>Opening Jalview's Groovy Console</strong><br>If groovy is
+ available, then the <strong>Tools→Groovy Console...</strong>
+ menu entry will be available from the Jalview Desktop's drop-down
+ menu. Selecting this will open the <a
+ href="http://groovy.codehaus.org/Groovy+Console">Groovy Console</a>
+ which allows you to interactively execute Groovy scripts within the
+ Jalview run-time environment.
+ </p>
+ <p>
+ <strong>Executing groovy scripts on Jalview startup</strong><br>
+ The -groovy <script> option on the <a href="commandline.html" />
+ Jalview command line</a> will execute the contents of <script>.
+ <script> may be a file, a URL, or alternatively if it is
+ "STDIN" then the standard input will be used.<br>
+ <em>Note: The groovy script will be executed <strong>after</strong>
+ any data is loaded, and <strong>before</strong> images or any output
+ files are written. This allows you to perform customised jalview
+ analysis workflows with groovy.</em>
+ </p>
+ <p>
+ <strong>Access to Jalview's functions from Groovy Scripts</strong><br>
+ There is as yet no properly defined scripting interface to Jalview,
+ but all the public methods of the jalview class hierarchy can be
+ called from Groovy scripts. The access point for this is the <strong>Jalview</strong>
+ object defined in the groovy environent which corresponds to the
+ <pre>jalview.gui.Desktop</pre>
+ object which manages all the Jalview windows.
+ </p>
+ Here's an example to get you started:
+ <br>
+ <ul>
+ <li>Getting the title, alignment and first sequence from the
+ current alignFrame<br> <pre>
+def alf = Jalview.getAlignframes();
+print alf[0].getTitle();
+def alignment = alf[0].viewport.alignment;
+def seq = alignment.getSequenceAt(0);
+</pre></li>
+<li>When running a groovy script from the command line, the alignment that was just loaded can be referred to like so:<br><pre>
+print currentAlFrame.getTitle();</pre>
+ </ul>
+ </p>
+
+ <p> </p>
+</body>
+</html>
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-<html>\r
-<!--\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
--->\r
-<head>\r
-<title>The Jmol PDB Viewer</title>\r
-</head>\r
-<body>\r
-<p><strong>The Jmol PDB Viewer</strong></p>\r
-<p>Since Jalview 2.3, <a href="http://jmol.sourceforge.net/">Jmol</a>\r
-has been integrated into Jalview for interactively viewing structures\r
-opened by selecting the <strong>"Structure→View PDB\r
-entry:"</strong> option in the <a href="../menus/popupMenu.html">sequence\r
-id pop-up menu</a> (if you can't see this, then you need to <a\r
- href="viewingpdbs.html">associate a PDB structure</a> with the\r
-sequence). Jmol is available from the Jalview desktop and should also\r
-run in the JalviewLite applet, providing the browser supports Java 1.5.\r
-If Jmol is not available, then the original <a href="pdbviewer.html">internal\r
-pdb viewer</a> will be used as a fallback.</p>\r
-<p><a name="align"><strong>Superposing structures based\r
-on their aligned sequences</strong></a><br>\r
-If several structures are available on the alignment, you may add\r
-additional structures to an existing Jmol view by selecting their entry\r
-in the appropriate pop-up menu. Jalview will ask you if you wish to add\r
-the structure to the existing alignment, and if you do, it will import\r
-and superimpose the new PDB file using the corresponding positions from\r
-the alignment. If the alignment is subsequently edited, you can use the\r
-<a href="#sAlign"><em>Jmol→Align</em></a> menu option from the\r
-menu bar of the structure view window to superpose the structures using\r
-the updated alignment.<br>\r
-<em>Sequence based structure superposition was added in Jalview 2.6</em>\r
-</p>\r
-<p><strong>Controls</strong><br>\r
-The structure is by default rendered as a ribbon diagram. Moving the\r
-mouse over the structure brings up tooltips giving the residue name, PDB\r
-residue number and chain code, atom name and number\r
-([RES]Num:Chain.AtomName#AtomNumber). If a mapping exists to a residue\r
-in any associated sequences, then this will be highlighted in each one's\r
-alignment window. The converse also occurs - moving the mouse over an\r
-associated residue in an alignment window highlights the associated\r
-atoms in the displayed structures.</p>\r
-<p>Selecting a residue highlights its associated sequence residue\r
-and alpha carbon location. Double clicking an atom allows distances to\r
-be measured from it to any other atom in the structure.</p>\r
-<p>\r
-<table>\r
- <tr>\r
- <td><strong>Action</strong></td>\r
- <td><strong>Windows</strong></td>\r
- <td><strong>Unix</strong></td>\r
- <td><strong>Mac/OSX</strong></td>\r
- </tr>\r
- <tr>\r
- <td>Rotate View</td>\r
- <td>Left Click and Drag</td>\r
- <td>Left Click and Drag</td>\r
- <td>Click and Drag</td>\r
- </tr>\r
- <tr>\r
- <td>Zoom</td>\r
- <td>Shift + Left Click<br>\r
- drag mouse up or down</td>\r
- <td>Shift + Left Click<br>\r
- or middle button<br>\r
- drag mouse up or down</td>\r
- <td>Left-Alt + Click and drag mouse up or down</td>\r
- </tr>\r
- <tr>\r
- <td>Select/<br>\r
- Deselect<br>\r
- Residue</td>\r
- <td>Left Click</td>\r
- <td>Left Click</td>\r
- <td>Click</td>\r
- </tr>\r
- <tr>\r
- <td>Roll View</td>\r
- <td>Shift + Left Click<br>\r
- drag mouse to left or right</td>\r
- <td>Shift + Left Click<br>\r
- or middle button<br>\r
- drag mouse to left or right</td>\r
- <td>Left-Alt + Click and drag mouse to left or right</td>\r
- </tr>\r
- <tr>\r
- <td>Move Origin</td>\r
- <td>Shift+Control+Left Click<br>\r
- or Middle Button<br>\r
- + Drag</td>\r
- <td>Middle-Button<br>\r
- and<br>\r
- drag</td>\r
- <td>Shift+Control+Left Click<br>\r
- or Middle Button<br>\r
- and drag</td>\r
- </tr>\r
- <tr>\r
- <td>Jmol Menu</td>\r
- <td>Right-Click</td>\r
- <td>Right-Click</td>\r
- <td>Apple-Click</td>\r
- </tr>\r
-</table>\r
-</p>\r
-<p>The window has up to five menus:\r
-<ul>\r
- <li><Strong>File<br>\r
- </strong>\r
- <ul>\r
- <li><strong>Save As<br>\r
- </strong><em>Save the displayed PDB File, or the current view as an EPS or\r
- PNG file.</em></li>\r
- <li><strong>View Mapping<br>\r
- </strong><em> Opens a text window showing the alignment between the\r
- residues corresponding to alpha-carbon atoms in the PDB structure and\r
- the residues in the associated sequence.</em></li>\r
- </ul>\r
- </li>\r
- <li><strong>View</strong>\r
- <ul>\r
- <li><strong>Show Chains<br>\r
- </strong><em>Select which of the PDB file's chains are to be displayed.</em></li>\r
- <li><strong>Colour by ..<br></strong><em>Submenu allowing specific alignment views to be selected for colouring associated chains in the structure display. This menu contains all the alignment views associated with the structure view, with those used to colour the view indicated by ticks. Addditionally, it contains the following menu entries:</em>\r
- <ul><li><strong>Select many views<br></strong><em>When this option is enabled, selecting an alignment view adds it to the set used to colour the structures. Use this when colouring structures related to a number of alignments involving different domains or chains which are shown in the same structure view.</em>\r
- </li>\r
- <li><strong>Select all views<br></strong><em>This is only enabled when </em><strong>Select many views</strong><em> is also enabled, and will add all associated views to the set used to colour the structure display.</em>\r
- </li>\r
- <li><strong>Invert selection<br></strong><em>This is only enabled when </em><strong>Select many views</strong><em> is also enabled, and will replace the current set of views with any remaining views not currently used to colour the structure display.</em>\r
- </li></ul></li>\r
- <li><strong>Colours<br>\r
- </strong>\r
- <ul>\r
- <li><strong>By Sequence<br>\r
- </strong><em> Colours each residue in the structure with the colour of its\r
- corresponding residue in the associated sequence as rendered in the\r
- associated alignment views, including any Uniprot sequence features or\r
- region colourings.<br/>Pick which of the associated alignment views are used to colour the structures using the <strong>View→Colour by ..</strong> sub menu.</em><br>\r
- Residues which only exist in the PDB structure are coloured white if\r
- they are insertions (relative to the associated sequence in the\r
- alignment) and grey if they are N or C terminal flanks outside the\r
- region mapped to the alignment window's sequence.</em></li>\r
- <li><strong>By Chain<br>\r
- </strong><em> Assigns a random colour to each PDB chain.</em>\r
- <li><strong>Charge & Cysteine<br>\r
- </strong><em> Highlights cysteines in yellow, anionic (Aspartic Acid or\r
- Glutamic Acid) residues in red, and cationic (Lysine or Arginine)\r
- residues in blue.</em></li>\r
- <li><strong>Colour with Jmol<br></strong><em>Defers any colouring operations to Jmol. Select this if you want to use the Jmol scripting interface or menu to modify the view directly.</em></li>\r
- <li><strong>Standard and User Defined Jalview\r
- colourschemes.<br>\r
- </strong><em>The remaining entries apply the colourschemes available from\r
- the standard and user defined <a href="../colourSchemes/index.html">amino\r
- acid colours</a>.</em></li>\r
- </ul>\r
- </li>\r
- <li><strong>Jmol<br>\r
- </strong><em>This pulldown menu is only displayed if there are multiple\r
- structures shown in the Jmol window, and Jalview can also locate at\r
- least two of the structures in the currently associated alignment view.</em>\r
- <ul>\r
- <li><strong><a name="sAlign">Align</a> <br>\r
- </strong><em> When selected, the associated alignment will be used to\r
- superimpose all the structures in the view onto the first structure in\r
- the alignment. The regions used to calculate the superposition will be\r
- highlighted using the 'Cartoon' rendering style, and the remaining\r
- data shown as a chain trace.<br>\r
- (This option was introduced in Jalview 2.6)</em></li>\r
- </ul>\r
- </li>\r
- <li><strong>Help<br>\r
- </strong>\r
- <ul>\r
- <li><strong>Jmol Help<br>\r
- </strong><em>Access the Jmol Help documentation in a new browser window.</em></li>\r
- </ul>\r
- </li>\r
-</ul>\r
-</p>\r
-<p><strong>Functionality provided by Jmol</strong></p>\r
-<p>Jmol's own functions are accessed by clicking the 'Jmol' logo or\r
-right-clicking in the structure display area. Either way will open the\r
-Jmol pop-up menu, which provides access to a number of features for\r
-controlling the colour and display of molecules, adding measurements and\r
-labels, plotting surfaces, and display animation. The 'Set Picking' menu\r
-controls the behaviour of single and double mouse clicking on the\r
-structure, and the 'Console' option opens the Jmol scripting console.</p>\r
-<p>The state of each Jmol display is stored within <a\r
- href="jalarchive.html">jalview archives</a> as a Jmol state recovery\r
-script file. This means that any Jmol visualization effects that you add\r
-beyond those provided by Jalview will be able to be stored and recovered\r
-along with the displayed alignments in Jalview.</p>\r
-<p><strong>More Information</strong></p>\r
-<p>Jmol is a sophisticated program in its own right, with its own\r
-command console and scripting language. Only the essentials have been\r
-described here - the interested reader is referred to <a\r
- href="http://jmol.sourceforge.net/docs/">Jmol's own comprehensive\r
-online documentation</a>.</p>\r
-</p>\r
-</body>\r
-</html>\r
+<html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+-->
+<head>
+<title>The Jmol PDB Viewer</title>
+</head>
+<body>
+<p><strong>The Jmol PDB Viewer</strong></p>
+<p>Since Jalview 2.3, <a href="http://jmol.sourceforge.net/">Jmol</a>
+has been integrated into Jalview for interactively viewing structures
+opened by selecting the <strong>"Structure→View PDB
+entry:"</strong> option in the <a href="../menus/popupMenu.html">sequence
+id pop-up menu</a> (if you can't see this, then you need to <a
+ href="viewingpdbs.html">associate a PDB structure</a> with the
+sequence). Jmol is available from the Jalview desktop and should also
+run in the JalviewLite applet, providing the browser supports Java 1.5.
+If Jmol is not available, then the original <a href="pdbviewer.html">internal
+pdb viewer</a> will be used as a fallback.</p>
+<p><a name="align"><strong>Superposing structures based
+on their aligned sequences</strong></a><br>
+If several structures are available on the alignment, you may add
+additional structures to an existing Jmol view by selecting their entry
+in the appropriate pop-up menu. Jalview will ask you if you wish to add
+the structure to the existing alignment, and if you do, it will import
+and superimpose the new PDB file using the corresponding positions from
+the alignment. If the alignment is subsequently edited, you can use the
+<a href="#sAlign"><em>Jmol→Align</em></a> menu option from the
+menu bar of the structure view window to superpose the structures using
+the updated alignment.<br>
+<em>Sequence based structure superposition was added in Jalview 2.6</em>
+</p>
+<p><strong>Controls</strong><br>
+The structure is by default rendered as a ribbon diagram. Moving the
+mouse over the structure brings up tooltips giving the residue name, PDB
+residue number and chain code, atom name and number
+([RES]Num:Chain.AtomName#AtomNumber). If a mapping exists to a residue
+in any associated sequences, then this will be highlighted in each one's
+alignment window. The converse also occurs - moving the mouse over an
+associated residue in an alignment window highlights the associated
+atoms in the displayed structures.</p>
+<p>Selecting a residue highlights its associated sequence residue
+and alpha carbon location. Double clicking an atom allows distances to
+be measured from it to any other atom in the structure.</p>
+<p>
+<table>
+ <tr>
+ <td><strong>Action</strong></td>
+ <td><strong>Windows</strong></td>
+ <td><strong>Unix</strong></td>
+ <td><strong>Mac/OSX</strong></td>
+ </tr>
+ <tr>
+ <td>Rotate View</td>
+ <td>Left Click and Drag</td>
+ <td>Left Click and Drag</td>
+ <td>Click and Drag</td>
+ </tr>
+ <tr>
+ <td>Zoom</td>
+ <td>Shift + Left Click<br>
+ drag mouse up or down</td>
+ <td>Shift + Left Click<br>
+ or middle button<br>
+ drag mouse up or down</td>
+ <td>Left-Alt + Click and drag mouse up or down</td>
+ </tr>
+ <tr>
+ <td>Select/<br>
+ Deselect<br>
+ Residue</td>
+ <td>Left Click</td>
+ <td>Left Click</td>
+ <td>Click</td>
+ </tr>
+ <tr>
+ <td>Roll View</td>
+ <td>Shift + Left Click<br>
+ drag mouse to left or right</td>
+ <td>Shift + Left Click<br>
+ or middle button<br>
+ drag mouse to left or right</td>
+ <td>Left-Alt + Click and drag mouse to left or right</td>
+ </tr>
+ <tr>
+ <td>Move Origin</td>
+ <td>Shift+Control+Left Click<br>
+ or Middle Button<br>
+ + Drag</td>
+ <td>Middle-Button<br>
+ and<br>
+ drag</td>
+ <td>Shift+Control+Left Click<br>
+ or Middle Button<br>
+ and drag</td>
+ </tr>
+ <tr>
+ <td>Jmol Menu</td>
+ <td>Right-Click</td>
+ <td>Right-Click</td>
+ <td>Apple-Click</td>
+ </tr>
+</table>
+</p>
+<p>The window has up to five menus:
+<ul>
+ <li><Strong>File<br>
+ </strong>
+ <ul>
+ <li><strong>Save As<br>
+ </strong><em>Save the displayed PDB File, or the current view as an EPS or
+ PNG file.</em></li>
+ <li><strong>View Mapping<br>
+ </strong><em> Opens a text window showing the alignment between the
+ residues corresponding to alpha-carbon atoms in the PDB structure and
+ the residues in the associated sequence.</em></li>
+ </ul>
+ </li>
+ <li><strong>View</strong>
+ <ul>
+ <li><strong>Show Chains<br>
+ </strong><em>Select which of the PDB file's chains are to be displayed.</em></li>
+ <li><strong>Colour by ..<br></strong><em>Submenu allowing specific alignment views to be selected for colouring associated chains in the structure display. This menu contains all the alignment views associated with the structure view, with those used to colour the view indicated by ticks. Addditionally, it contains the following menu entries:</em>
+ <ul><li><strong>Select many views<br></strong><em>When this option is enabled, selecting an alignment view adds it to the set used to colour the structures. Use this when colouring structures related to a number of alignments involving different domains or chains which are shown in the same structure view.</em>
+ </li>
+ <li><strong>Select all views<br></strong><em>This is only enabled when </em><strong>Select many views</strong><em> is also enabled, and will add all associated views to the set used to colour the structure display.</em>
+ </li>
+ <li><strong>Invert selection<br></strong><em>This is only enabled when </em><strong>Select many views</strong><em> is also enabled, and will replace the current set of views with any remaining views not currently used to colour the structure display.</em>
+ </li></ul></li>
+ <li><strong>Colours<br>
+ </strong>
+ <ul>
+ <li><strong>By Sequence<br>
+ </strong><em> Colours each residue in the structure with the colour of its
+ corresponding residue in the associated sequence as rendered in the
+ associated alignment views, including any Uniprot sequence features or
+ region colourings.<br/>Pick which of the associated alignment views are used to colour the structures using the <strong>View→Colour by ..</strong> sub menu.</em><br>
+ Residues which only exist in the PDB structure are coloured white if
+ they are insertions (relative to the associated sequence in the
+ alignment) and grey if they are N or C terminal flanks outside the
+ region mapped to the alignment window's sequence.</em></li>
+ <li><strong>By Chain<br>
+ </strong><em> Assigns a random colour to each PDB chain.</em>
+ <li><strong>Charge & Cysteine<br>
+ </strong><em> Highlights cysteines in yellow, anionic (Aspartic Acid or
+ Glutamic Acid) residues in red, and cationic (Lysine or Arginine)
+ residues in blue.</em></li>
+ <li><strong>Colour with Jmol<br></strong><em>Defers any colouring operations to Jmol. Select this if you want to use the Jmol scripting interface or menu to modify the view directly.</em></li>
+ <li><strong>Standard and User Defined Jalview
+ colourschemes.<br>
+ </strong><em>The remaining entries apply the colourschemes available from
+ the standard and user defined <a href="../colourSchemes/index.html">amino
+ acid colours</a>.</em></li>
+ </ul>
+ </li>
+ <li><strong>Jmol<br>
+ </strong><em>This pulldown menu is only displayed if there are multiple
+ structures shown in the Jmol window, and Jalview can also locate at
+ least two of the structures in the currently associated alignment view.</em>
+ <ul>
+ <li><strong><a name="sAlign">Align</a> <br>
+ </strong><em> When selected, the associated alignment will be used to
+ superimpose all the structures in the view onto the first structure in
+ the alignment. The regions used to calculate the superposition will be
+ highlighted using the 'Cartoon' rendering style, and the remaining
+ data shown as a chain trace.<br>
+ (This option was introduced in Jalview 2.6)</em></li>
+ </ul>
+ </li>
+ <li><strong>Help<br>
+ </strong>
+ <ul>
+ <li><strong>Jmol Help<br>
+ </strong><em>Access the Jmol Help documentation in a new browser window.</em></li>
+ </ul>
+ </li>
+</ul>
+</p>
+<p><strong>Functionality provided by Jmol</strong></p>
+<p>Jmol's own functions are accessed by clicking the 'Jmol' logo or
+right-clicking in the structure display area. Either way will open the
+Jmol pop-up menu, which provides access to a number of features for
+controlling the colour and display of molecules, adding measurements and
+labels, plotting surfaces, and display animation. The 'Set Picking' menu
+controls the behaviour of single and double mouse clicking on the
+structure, and the 'Console' option opens the Jmol scripting console.</p>
+<p>The state of each Jmol display is stored within <a
+ href="jalarchive.html">jalview archives</a> as a Jmol state recovery
+script file. This means that any Jmol visualization effects that you add
+beyond those provided by Jalview will be able to be stored and recovered
+along with the displayed alignments in Jalview.</p>
+<p><strong>More Information</strong></p>
+<p>Jmol is a sophisticated program in its own right, with its own
+command console and scripting language. Only the essentials have been
+described here - the interested reader is referred to <a
+ href="http://jmol.sourceforge.net/docs/">Jmol's own comprehensive
+online documentation</a>.</p>
+</p>
+</body>
+</html>
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-<html>\r
-<!--\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
--->\r
-<head>\r
-<title>Mapping Between Different Sequences</title>\r
-</head>\r
-<body>\r
-<p><strong>Mapping Between Different Sequences</strong></p>\r
-<p>A new feature in Jalview 2.3 is the ability to map between sequences in different \r
- domains, based on alignment, or by the use of explicit mappings provided by \r
- databases. </p>\r
-<p>The most familiar mapping is the one used to identify\r
-the coordinates corresponding to a displayed sequence when\r
-viewing a PDB file associated with a sequence (see \r
-<a href="viewingpdbs.html">"Viewing PDB Files"</a> \r
-for more information.</p>\r
-<p>The newest form of mapping supported by Jalview is the \r
-correspondence between DNA and protein sequences. This mapping\r
-can be imported directly from EMBL and EMBLCDS database records \r
-retrieved by the <a href="seqfetch.html">Sequence Fetcher</a>, \r
-and allows sequence features to be mapped directly from Uniprot \r
-das sources to their coding region on EMBL sequence records.\r
-</body>\r
-</html>\r
+<html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+-->
+<head>
+<title>Mapping Between Different Sequences</title>
+</head>
+<body>
+<p><strong>Mapping Between Different Sequences</strong></p>
+<p>A new feature in Jalview 2.3 is the ability to map between sequences in different
+ domains, based on alignment, or by the use of explicit mappings provided by
+ databases. </p>
+<p>The most familiar mapping is the one used to identify
+the coordinates corresponding to a displayed sequence when
+viewing a PDB file associated with a sequence (see
+<a href="viewingpdbs.html">"Viewing PDB Files"</a>
+for more information.</p>
+<p>The newest form of mapping supported by Jalview is the
+correspondence between DNA and protein sequences. This mapping
+can be imported directly from EMBL and EMBLCDS database records
+retrieved by the <a href="seqfetch.html">Sequence Fetcher</a>,
+and allows sequence features to be mapped directly from Uniprot
+das sources to their coding region on EMBL sequence records.
+</body>
+</html>
-<html>\r
-<!--\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
--->\r
-<head>\r
-<title>The VARNA RNA Viewer</title>\r
-</head>\r
-<body>\r
-<p><strong>The VARNA RNA Viewer</strong></p>\r
-<p>Since Jalview\r
-2.7.1, <a href="http://varna.lri.fr/index.html">VARNA</a> has been\r
-integrated into Jalview for interactively viewing structures opened by\r
-selecting the <strong>"Structure→View\r
-Structure:"</strong> option in\r
-the <a href="../menus/popupMenu.html">sequence id pop-up menu</a> (if\r
-you can't see this, then no RNA structure is associated with your\r
-sequence or alignment. In the pop-up menu all structures that\r
-are associated with this sequence and all sequences that are\r
-associated with the alignment are available.\r
-\r
-<p><strong>Different structures</strong></p>\r
-<ul>\r
- <li>\r
- <b>Alignment structures</b>:\r
- Structures associated with the alignment are marked by having "consensus" attached to their name. VARNA contains two different entries for consensus structures.\r
- <ul>\r
- <li>Consensus structure: the individual sequence folded into the consensus structure</li>\r
- <li>Trimmed consensus structure: the individual sequence\r
- folded into the the gap-free consensus structure. That means all\r
- columns that contained gaps in the individual sequence were\r
- removed. If this breaks a base-pair the pairing is removed also.\r
- This can be considered as an approximation for the individual structure.\r
- </ul>\r
- </li>\r
- <li>\r
- <b>Individual structures</b>:\r
- this is a structure associated with the individual sequence and therefore not related to the alignment \r
- </li>\r
-\r
-<p><strong>Controls</strong><br>\r
-<ul>\r
-<li>Rotate view - Left Click and drag</li>\r
-<li>Zoom in - Press '+'</li>\r
-<li>Zoom out - Press '-'</li>\r
-<li>Choose a different structure - Left click on structure in the left hand panel</li>\r
-<li>Highlighting bases - Move mouse over columns in the Jalview alignment panel</li>\r
-</ul>\r
-\r
-<p><strong>Functionality provided by VARNA</strong></p>\r
-<p>VARNA's own functions are accessed by right-clicking in the\r
-structure display area. That will open the VARNA pop-up menu,\r
-which provides access to a number of features like different draw algorithm, color highlighting or annotations. \r
-</p>\r
-<p><strong>More Information</strong></p>\r
-<p>VARNA is a very powerful RNA viewer on its own. Only the\r
-essentials have been described here - the interested reader is\r
-referred to <a href="http://varna.lri.fr/usermanual.html">VARNA's own\r
-comprehensive online documentation</a>.</p>\r
-</body>\r
-</html>\r
+<html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+-->
+<head>
+<title>The VARNA RNA Viewer</title>
+</head>
+<body>
+<p><strong>The VARNA RNA Viewer</strong></p>
+<p>Since Jalview
+2.7.1, <a href="http://varna.lri.fr/index.html">VARNA</a> has been
+integrated into Jalview for interactively viewing structures opened by
+selecting the <strong>"Structure→View
+Structure:"</strong> option in
+the <a href="../menus/popupMenu.html">sequence id pop-up menu</a> (if
+you can't see this, then no RNA structure is associated with your
+sequence or alignment. In the pop-up menu all structures that
+are associated with this sequence and all sequences that are
+associated with the alignment are available.
+
+<p><strong>Different structures</strong></p>
+<ul>
+ <li>
+ <b>Alignment structures</b>:
+ Structures associated with the alignment are marked by having "consensus" attached to their name. VARNA contains two different entries for consensus structures.
+ <ul>
+ <li>Consensus structure: the individual sequence folded into the consensus structure</li>
+ <li>Trimmed consensus structure: the individual sequence
+ folded into the the gap-free consensus structure. That means all
+ columns that contained gaps in the individual sequence were
+ removed. If this breaks a base-pair the pairing is removed also.
+ This can be considered as an approximation for the individual structure.
+ </ul>
+ </li>
+ <li>
+ <b>Individual structures</b>:
+ this is a structure associated with the individual sequence and therefore not related to the alignment
+ </li>
+
+<p><strong>Controls</strong><br>
+<ul>
+<li>Rotate view - Left Click and drag</li>
+<li>Zoom in - Press '+'</li>
+<li>Zoom out - Press '-'</li>
+<li>Choose a different structure - Left click on structure in the left hand panel</li>
+<li>Highlighting bases - Move mouse over columns in the Jalview alignment panel</li>
+</ul>
+
+<p><strong>Functionality provided by VARNA</strong></p>
+<p>VARNA's own functions are accessed by right-clicking in the
+structure display area. That will open the VARNA pop-up menu,
+which provides access to a number of features like different draw algorithm, color highlighting or annotations.
+</p>
+<p><strong>More Information</strong></p>
+<p>VARNA is a very powerful RNA viewer on its own. Only the
+essentials have been described here - the interested reader is
+referred to <a href="http://varna.lri.fr/usermanual.html">VARNA's own
+comprehensive online documentation</a>.</p>
+</body>
+</html>
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
</pre>
</body>
-</html>
\ No newline at end of file
+</html>
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-<!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r
-<!--\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
--->\r
-<html xmlns="http://www.w3.org/1999/xhtml">\r
-<head>\r
-Database Reference Fetching\r
-</head>\r
-<p>\r
-<p><strong>Discovering Database References for Sequences</strong><br>\r
-Database references are associated with a sequence are displayed as a\r
-list in the tooltip shown when mousing over its sequence ID. Jalview\r
-uses references for the retrieval of <a\r
- href="../features/viewingpdbs.html">PDB structures</a> and <a\r
- href="../features/dasfeatures.html">DAS features</a>, and for\r
-retrieving sequence cross-references such as the protein products of a\r
-DNA sequence.</p>\r
-<p><strong>Initiating reference retrieval</strong><br>\r
-The application provides three ways to access the retrieval function. Either:\r
-<ul><li>select the <strong>Discover PDB IDs</strong> option from the structure submenu of the sequence's popup menu</li>\r
-<li>Choose one of the options from the 'Fetch DB Refs' submenu in the alignment window's <strong>Web Services</strong> menu:<ul>\r
-<li><em>Standard Databases</em> will fetch references from the EBI databases plus currently selected DAS sources</li>\r
-<li>The other entries submenus leading to lists of individual database sources that Jalview can access.</li></ul></li>\r
-<li>Answer 'Yes' when asked if you wish to retrieve database references for your sequences after initiating a DAS Sequence Feature fetch.</li>\r
-</ul> \r
-<p>Jalview discovers references for a sequence by generating a set\r
-of ID queries from the ID string of each sequence in the alignment. It\r
-then tries to query a subset of all the databases it can access in order to match\r
-the alignment sequence to any records retrieved from the database. If a\r
-match is found, then the sequence is annotated with that database's\r
-reference, and any cross-references that it's records contain.</p>\r
-<p><strong>The Sequence Identification Process</strong><br>\r
-The method of accession id discovery is derived from the method which\r
-earlier Jalview versions used for Uniprot sequence feature retrieval,\r
-and was originally restricted to the identifaction of valid Uniprot\r
-accessions.<br>\r
-Essentially, Jalview will try to retrieve records from a subset of the databases\r
-accessible by the <a href="../features/seqfetch.html">sequence\r
-fetcher</a> using each sequence's ID string (or each string in the ID\r
-separated by the '∣' symbol).</p>\r
-<p>If a record (or set of records) is retrieved by any query derived\r
-from the ID string of a sequence, then the sequence is aligned to the\r
-ones retrieved to determine the correct start and end residue positions\r
-(which are displayed when the 'Show Full Sequence ID' option). This is\r
-important for the correct display of the location of any features\r
-associated with that database.</p>\r
-<p>If the alignment reveals differences between the sequence in the\r
-alignment and the one in the record, then Jalview will assume that the\r
-aligned sequence is not the one in the retrieved record.</p>\r
-<p>In some cases, the ID used to retrieve records may be out\r
-of date and a dialog box will be opened indicating that a 100% match\r
-between the sequence and the record was identified, but the\r
-sequence name is different. In this case, the can be manually\r
-changed (by right clicking on the sequence ID and selecting <strong>Sequence→Edit\r
-Name</strong>).\r
-<ul>\r
- <li><em>Note</em><br>\r
- Please remember to save your alignment if either the start/end\r
- numbering, or the sequence IDs were updated during the ID\r
- retrieval process.</li>\r
-</ul>\r
-<body></body>\r
-</html>\r
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+-->
+<!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+Database Reference Fetching
+</head>
+<p>
+<p><strong>Discovering Database References for Sequences</strong><br>
+Database references are associated with a sequence are displayed as a
+list in the tooltip shown when mousing over its sequence ID. Jalview
+uses references for the retrieval of <a
+ href="../features/viewingpdbs.html">PDB structures</a> and <a
+ href="../features/dasfeatures.html">DAS features</a>, and for
+retrieving sequence cross-references such as the protein products of a
+DNA sequence.</p>
+<p><strong>Initiating reference retrieval</strong><br>
+The application provides three ways to access the retrieval function. Either:
+<ul><li>select the <strong>Discover PDB IDs</strong> option from the structure submenu of the sequence's popup menu</li>
+<li>Choose one of the options from the 'Fetch DB Refs' submenu in the alignment window's <strong>Web Services</strong> menu:<ul>
+<li><em>Standard Databases</em> will fetch references from the EBI databases plus currently selected DAS sources</li>
+<li>The other entries submenus leading to lists of individual database sources that Jalview can access.</li></ul></li>
+<li>Answer 'Yes' when asked if you wish to retrieve database references for your sequences after initiating a DAS Sequence Feature fetch.</li>
+</ul>
+<p>Jalview discovers references for a sequence by generating a set
+of ID queries from the ID string of each sequence in the alignment. It
+then tries to query a subset of all the databases it can access in order to match
+the alignment sequence to any records retrieved from the database. If a
+match is found, then the sequence is annotated with that database's
+reference, and any cross-references that it's records contain.</p>
+<p><strong>The Sequence Identification Process</strong><br>
+The method of accession id discovery is derived from the method which
+earlier Jalview versions used for Uniprot sequence feature retrieval,
+and was originally restricted to the identifaction of valid Uniprot
+accessions.<br>
+Essentially, Jalview will try to retrieve records from a subset of the databases
+accessible by the <a href="../features/seqfetch.html">sequence
+fetcher</a> using each sequence's ID string (or each string in the ID
+separated by the '∣' symbol).</p>
+<p>If a record (or set of records) is retrieved by any query derived
+from the ID string of a sequence, then the sequence is aligned to the
+ones retrieved to determine the correct start and end residue positions
+(which are displayed when the 'Show Full Sequence ID' option). This is
+important for the correct display of the location of any features
+associated with that database.</p>
+<p>If the alignment reveals differences between the sequence in the
+alignment and the one in the record, then Jalview will assume that the
+aligned sequence is not the one in the retrieved record.</p>
+<p>In some cases, the ID used to retrieve records may be out
+of date and a dialog box will be opened indicating that a 100% match
+between the sequence and the record was identified, but the
+sequence name is different. In this case, the can be manually
+changed (by right clicking on the sequence ID and selecting <strong>Sequence→Edit
+Name</strong>).
+<ul>
+ <li><em>Note</em><br>
+ Please remember to save your alignment if either the start/end
+ numbering, or the sequence IDs were updated during the ID
+ retrieval process.</li>
+</ul>
+<body></body>
+</html>
-
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+-->
<head>Jalview Desktop RSS News Reader
</head>
<body>
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
<html>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
###############################################################################
-# Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
-# Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
-#
+# Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+# Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+#
# This file is part of Jalview.
-#
+#
# Jalview is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
-#
+#
# Jalview is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
###############################################################################
nbbuild.xml.data.CRC32=f5d3c6c2
###############################################################################
-# Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
-# Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
-#
+# Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+# Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+#
# This file is part of Jalview.
-#
+#
# Jalview is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
-#
+#
# Jalview is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
###############################################################################
annotation.processing.enabled=true
-<?xml version="1.0" encoding="UTF-8"?><!--
- Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+
+ This file is part of Jalview.
+
+ Jalview is free software: you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- This file is part of Jalview.
-
- Jalview is free software: you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
-
- Jalview is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty
- of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- -->
-
+ Jalview is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty
+ of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+-->
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.java.j2seproject</type>
<configuration>
-<?xml version="1.0"?>\r
-<!--\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
--->\r
-<mapping xmlns="http://castor.exolab.org/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
- xsi:schemaLocation="http://castor.exolab.org/ ../schemas/castor-mapping.xsd">\r
-<!--\r
- History: Originally created from EMBL_common_V1.0\r
- Updated on 24th April 2007 for WsDBFetch Service move to EMBL_Services_V1.1.xsd\r
- -->\r
- <class name="jalview.datamodel.xdb.embl.EmblFile">\r
- <map-to xml="EMBL_Services"/>\r
- <field name="entries" type="jalview.datamodel.xdb.embl.EmblEntry" collection="vector">\r
- <bind-xml name="entry"/>\r
- </field>\r
- \r
- <field name="errors" type="jalview.datamodel.xdb.embl.EmblError" collection="vector">\r
- <bind-xml name="Error"/>\r
- </field>\r
- </class>\r
- <class name="jalview.datamodel.xdb.embl.EmblEntry">\r
- <map-to xml="entry"/>\r
- <field name="accession" type="string">\r
- <bind-xml location="accession" node="attribute"/>\r
- </field>\r
- <field name="lastUpdated" type="string">\r
- <bind-xml location="last-updated" node="attribute"/>\r
- </field>\r
- <field name="version" type="string">\r
- <bind-xml location="version" node="attribute"/>\r
- </field>\r
- \r
- <field name="rCreated" type="string">\r
- <bind-xml location="releaseCreated" node="attribute"/>\r
- </field>\r
- <field name="rLastUpdated" type="string">\r
- <bind-xml location="releaseLastUpdated" node="attribute"/>\r
- </field>\r
- <field name="desc" type="string">\r
- <bind-xml name="description" node="element"/>\r
- </field>\r
- <field name="Keywords" type="string" collection="vector">\r
- <bind-xml name="keyword" node="element"/>\r
- </field>\r
- <field name="features" type="jalview.datamodel.xdb.embl.EmblFeature" collection="vector">\r
- <bind-xml name="feature"/>\r
- </field>\r
- <field name="dbRefs" type="jalview.datamodel.DBRefEntry" collection="vector">\r
- <bind-xml name="dbreference" />\r
- </field>\r
- <field name="sequence" type="jalview.datamodel.xdb.embl.EmblSequence">\r
- <bind-xml name="sequence"/> <!-- location="sequence" node="element"/ -->\r
- </field>\r
- </class>\r
- <class name="jalview.datamodel.xdb.embl.EmblSequence">\r
- <map-to xml="sequence"/>\r
- <field name="type" type="string">\r
- <bind-xml name="type" node="attribute" location="type"/>\r
- </field>\r
- <field name="version" type="string">\r
- <bind-xml name="version" node="attribute" location="version"/>\r
- </field>\r
- <field name="sequence" type="string">\r
- <bind-xml node="text"/>\r
- </field>\r
- </class>\r
- <class name="jalview.datamodel.xdb.embl.EmblFeature" verify-constructable="false">\r
- <map-to xml="feature"/>\r
- <field name="name" type="string">\r
- <bind-xml name="name" node="attribute"/>\r
- </field>\r
- <field name="dbRefs" type="jalview.datamodel.DBRefEntry" collection="vector">\r
- <bind-xml name="dbreference" node="element"/>\r
- </field>\r
- <field name="qualifiers" type="jalview.datamodel.xdb.embl.Qualifier" collection="vector">\r
- <bind-xml name="qualifier"/>\r
- </field> \r
- <field name="locations" type="jalview.datamodel.xdb.embl.EmblFeatureLocations" collection="vector">\r
- <bind-xml name="location"/>\r
- </field>\r
- </class>\r
- <class name="jalview.datamodel.DBRefEntry" verify-constructable="false">\r
- <field name="accessionId" type="java.lang.String"><!-- set-method="setAccessionId" get-method="getAccessionId"> -->\r
- <bind-xml name="primary" node="attribute"/>\r
- </field>\r
- <field name="source" type="java.lang.String"> <!--set-method="setSource" get-method="getSource"> -->\r
- <bind-xml name="db" node="attribute"/>\r
- </field>\r
- <field name="version" type="string"><!-- set-method="setVersion" get-method="getVersion"> -->\r
- <bind-xml name="secondary" node="attribute"/>\r
- </field>\r
- </class>\r
- <class name="jalview.datamodel.xdb.embl.Qualifier" verify-constructable="false">\r
- <map-to xml="Qualifier"/>\r
- <field name="name">\r
- <bind-xml name="name" node="attribute"/>\r
- </field>\r
- <field name="evidence" type="string" collection="array">\r
- <bind-xml name="evidence" node="element"/>\r
- </field>\r
- <field name="values" type="string" collection="array">\r
- <bind-xml name="value" node="element"/>\r
- </field>\r
- </class>\r
- <class name="jalview.datamodel.xdb.embl.EmblFeatureLocations">\r
- <map-to xml="location"/>\r
- <field name="locationType" type="string">\r
- <bind-xml name="type" node="attribute"/>\r
- </field>\r
- <field name="locationComplement" type="boolean">\r
- <bind-xml name="complement" node="attribute"/>\r
- </field>\r
- <field name="locElements" type="jalview.datamodel.xdb.embl.EmblFeatureLocElement" collection="vector">\r
- <bind-xml name="locationElement"/>\r
- </field>\r
- </class>\r
- <class name="jalview.datamodel.xdb.embl.EmblFeatureLocElement">\r
- <map-to xml="locationElement"/>\r
- <field name="type" type="string">\r
- <bind-xml name="type" node="attribute"/>\r
- </field>\r
- <field name="accession" type="string">\r
- <bind-xml name="accession" node="attribute"/> \r
- </field>\r
- <field name="version" type="string">\r
- <bind-xml name="version" node="attribute"/>\r
- </field>\r
- <field name="complement" type="boolean">\r
- <bind-xml name="complement"/>\r
- </field>\r
- <field name="basePositions" type="jalview.datamodel.xdb.embl.BasePosition" collection="array">\r
- <bind-xml name="basePosition" node="element"/>\r
- </field>\r
- </class>\r
- <class name="jalview.datamodel.xdb.embl.BasePosition">\r
- <map-to xml="basePosition"/>\r
- <field name="type">\r
- <bind-xml name="type" node="attribute"/>\r
- </field>\r
- <field name="pos">\r
- <bind-xml node="text"/>\r
- </field>\r
- </class>\r
-</mapping>\r
+<?xml version="1.0"?>
+<!--
+ Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+
+ This file is part of Jalview.
+
+ Jalview is free software: you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+
+ Jalview is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty
+ of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+-->
+<mapping xmlns="http://castor.exolab.org/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://castor.exolab.org/ ../schemas/castor-mapping.xsd">
+<!--
+ History: Originally created from EMBL_common_V1.0
+ Updated on 24th April 2007 for WsDBFetch Service move to EMBL_Services_V1.1.xsd
+ -->
+ <class name="jalview.datamodel.xdb.embl.EmblFile">
+ <map-to xml="EMBL_Services"/>
+ <field name="entries" type="jalview.datamodel.xdb.embl.EmblEntry" collection="vector">
+ <bind-xml name="entry"/>
+ </field>
+
+ <field name="errors" type="jalview.datamodel.xdb.embl.EmblError" collection="vector">
+ <bind-xml name="Error"/>
+ </field>
+ </class>
+ <class name="jalview.datamodel.xdb.embl.EmblEntry">
+ <map-to xml="entry"/>
+ <field name="accession" type="string">
+ <bind-xml location="accession" node="attribute"/>
+ </field>
+ <field name="lastUpdated" type="string">
+ <bind-xml location="last-updated" node="attribute"/>
+ </field>
+ <field name="version" type="string">
+ <bind-xml location="version" node="attribute"/>
+ </field>
+
+ <field name="rCreated" type="string">
+ <bind-xml location="releaseCreated" node="attribute"/>
+ </field>
+ <field name="rLastUpdated" type="string">
+ <bind-xml location="releaseLastUpdated" node="attribute"/>
+ </field>
+ <field name="desc" type="string">
+ <bind-xml name="description" node="element"/>
+ </field>
+ <field name="Keywords" type="string" collection="vector">
+ <bind-xml name="keyword" node="element"/>
+ </field>
+ <field name="features" type="jalview.datamodel.xdb.embl.EmblFeature" collection="vector">
+ <bind-xml name="feature"/>
+ </field>
+ <field name="dbRefs" type="jalview.datamodel.DBRefEntry" collection="vector">
+ <bind-xml name="dbreference" />
+ </field>
+ <field name="sequence" type="jalview.datamodel.xdb.embl.EmblSequence">
+ <bind-xml name="sequence"/> <!-- location="sequence" node="element"/ -->
+ </field>
+ </class>
+ <class name="jalview.datamodel.xdb.embl.EmblSequence">
+ <map-to xml="sequence"/>
+ <field name="type" type="string">
+ <bind-xml name="type" node="attribute" location="type"/>
+ </field>
+ <field name="version" type="string">
+ <bind-xml name="version" node="attribute" location="version"/>
+ </field>
+ <field name="sequence" type="string">
+ <bind-xml node="text"/>
+ </field>
+ </class>
+ <class name="jalview.datamodel.xdb.embl.EmblFeature" verify-constructable="false">
+ <map-to xml="feature"/>
+ <field name="name" type="string">
+ <bind-xml name="name" node="attribute"/>
+ </field>
+ <field name="dbRefs" type="jalview.datamodel.DBRefEntry" collection="vector">
+ <bind-xml name="dbreference" node="element"/>
+ </field>
+ <field name="qualifiers" type="jalview.datamodel.xdb.embl.Qualifier" collection="vector">
+ <bind-xml name="qualifier"/>
+ </field>
+ <field name="locations" type="jalview.datamodel.xdb.embl.EmblFeatureLocations" collection="vector">
+ <bind-xml name="location"/>
+ </field>
+ </class>
+ <class name="jalview.datamodel.DBRefEntry" verify-constructable="false">
+ <field name="accessionId" type="java.lang.String"><!-- set-method="setAccessionId" get-method="getAccessionId"> -->
+ <bind-xml name="primary" node="attribute"/>
+ </field>
+ <field name="source" type="java.lang.String"> <!--set-method="setSource" get-method="getSource"> -->
+ <bind-xml name="db" node="attribute"/>
+ </field>
+ <field name="version" type="string"><!-- set-method="setVersion" get-method="getVersion"> -->
+ <bind-xml name="secondary" node="attribute"/>
+ </field>
+ </class>
+ <class name="jalview.datamodel.xdb.embl.Qualifier" verify-constructable="false">
+ <map-to xml="Qualifier"/>
+ <field name="name">
+ <bind-xml name="name" node="attribute"/>
+ </field>
+ <field name="evidence" type="string" collection="array">
+ <bind-xml name="evidence" node="element"/>
+ </field>
+ <field name="values" type="string" collection="array">
+ <bind-xml name="value" node="element"/>
+ </field>
+ </class>
+ <class name="jalview.datamodel.xdb.embl.EmblFeatureLocations">
+ <map-to xml="location"/>
+ <field name="locationType" type="string">
+ <bind-xml name="type" node="attribute"/>
+ </field>
+ <field name="locationComplement" type="boolean">
+ <bind-xml name="complement" node="attribute"/>
+ </field>
+ <field name="locElements" type="jalview.datamodel.xdb.embl.EmblFeatureLocElement" collection="vector">
+ <bind-xml name="locationElement"/>
+ </field>
+ </class>
+ <class name="jalview.datamodel.xdb.embl.EmblFeatureLocElement">
+ <map-to xml="locationElement"/>
+ <field name="type" type="string">
+ <bind-xml name="type" node="attribute"/>
+ </field>
+ <field name="accession" type="string">
+ <bind-xml name="accession" node="attribute"/>
+ </field>
+ <field name="version" type="string">
+ <bind-xml name="version" node="attribute"/>
+ </field>
+ <field name="complement" type="boolean">
+ <bind-xml name="complement"/>
+ </field>
+ <field name="basePositions" type="jalview.datamodel.xdb.embl.BasePosition" collection="array">
+ <bind-xml name="basePosition" node="element"/>
+ </field>
+ </class>
+ <class name="jalview.datamodel.xdb.embl.BasePosition">
+ <map-to xml="basePosition"/>
+ <field name="type">
+ <bind-xml name="type" node="attribute"/>
+ </field>
+ <field name="pos">
+ <bind-xml node="text"/>
+ </field>
+ </class>
+</mapping>
<?xml version="1.0"?>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+
+ This file is part of Jalview.
+
+ Jalview is free software: you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+
+ Jalview is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty
+ of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
-->
<mapping>
<class name="jalview.datamodel.UniprotFile">
<?xml version="1.0" encoding="UTF-8"?>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+
+ This file is part of Jalview.
+
+ Jalview is free software: you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+
+ Jalview is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty
+ of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
-->
<!-- edited with XMLSpy v2005 rel. 3 U (http://www.altova.com) by lj (jl) -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="www.jalview.org/colours">
<?xml version="1.0" encoding="UTF-8"?>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+
+ This file is part of Jalview.
+
+ Jalview is free software: you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+
+ Jalview is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty
+ of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="www.jalview.org/xml/wsparamset">
-<?xml version="1.0" encoding="UTF-8"?>\r
-<!--\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
--->\r
-<!--DOCTYPE schema PUBLIC "-//W3C/DTD XML Schema Version 1.0//EN"\r
- "http://www.w3.org/TR/2000/WD-xmlschema-1-20000225/structures.dtd"-->\r
- <!--\r
- Castor Object Mapping XML Schema\r
- \r
- Namespace: http://castor.exolab.org/\r
- System: http://castor.exolab.org/mapping.xsd\r
- Public: -//EXOLAB/Castor Object Mapping Schema Version 1.0//EN\r
- \r
- *Note*: This schema is under evolution and subject to change.\r
- \r
- -->\r
- <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"\r
- targetNamespace="http://castor.exolab.org/"\r
- xmlns="http://castor.exolab.org/"\r
- version="0.9.4">\r
- \r
- <xsd:element name="mapping">\r
- <xsd:complexType>\r
- <xsd:sequence>\r
- <xsd:element name="description" type="xsd:string" minOccurs="0" maxOccurs="1" />\r
- <xsd:element ref="include" minOccurs="0" maxOccurs="unbounded" />\r
- <xsd:element ref="class" minOccurs="0" maxOccurs="unbounded" />\r
- <xsd:element ref="key-generator" minOccurs="0" maxOccurs="unbounded" />\r
- </xsd:sequence>\r
- </xsd:complexType>\r
- </xsd:element>\r
- \r
- <xsd:element name="include">\r
- <xsd:complexType>\r
- <xsd:attribute name="href" type="xsd:string" use="required"/>\r
- </xsd:complexType>\r
- </xsd:element>\r
- \r
- <xsd:element name="class">\r
- <xsd:complexType>\r
- <xsd:sequence>\r
- <xsd:element name="description" type="xsd:string" minOccurs="0" maxOccurs="1" />\r
- <xsd:element ref="cache-type" minOccurs="0" maxOccurs="1" />\r
- <xsd:element ref="map-to" minOccurs="0" maxOccurs="1" />\r
- <xsd:choice minOccurs="1">\r
- <xsd:element ref="field" minOccurs="0" maxOccurs="unbounded"/>\r
- <xsd:element ref="container" minOccurs="0" maxOccurs="unbounded"/>\r
- </xsd:choice>\r
- </xsd:sequence>\r
- <xsd:attribute name="name" type="xsd:ID" use="required"/>\r
- <xsd:attribute name="extends" type="xsd:IDREF" use="optional"/>\r
- <xsd:attribute name="depends" type="xsd:IDREF" use="optional"/>\r
- <xsd:attribute name="identity" type="xsd:NMTOKENS" use="optional"/>\r
- <xsd:attribute name="access" default="shared" use="optional">\r
- <xsd:simpleType>\r
- <xsd:restriction base="xsd:string">\r
- <xsd:enumeration value="read-only"/>\r
- <xsd:enumeration value="shared"/>\r
- <xsd:enumeration value="exclusive"/>\r
- <xsd:enumeration value="db-locked"/>\r
- </xsd:restriction>\r
- </xsd:simpleType>\r
- </xsd:attribute>\r
- <xsd:attribute name="key-generator" type="xsd:string" use="optional"/>\r
- <xsd:attribute name="auto-complete" type="xsd:boolean" use="optional" default="false"/>\r
- <xsd:attribute name="verify-constructable" type="xsd:boolean" use="optional" default="true"/>\r
- </xsd:complexType>\r
- </xsd:element>\r
- \r
- <xsd:element name="map-to">\r
- <xsd:complexType>\r
- <xsd:attribute name="table" type="xsd:NMTOKEN" use="optional"/>\r
- <xsd:attribute name="xml" type="xsd:string" use="optional"/>\r
- <xsd:attribute name="ns-uri" type="xsd:string" use="optional"/>\r
- <xsd:attribute name="ns-prefix" type="xsd:NMTOKEN" use="optional"/>\r
- <xsd:attribute name="ldap-dn" type="xsd:string" use="optional"/>\r
- <xsd:attribute name="ldap-oc" type="xsd:string" use="optional"/>\r
- </xsd:complexType>\r
- </xsd:element>\r
- \r
- <xsd:element name="field">\r
- <xsd:complexType>\r
- <xsd:sequence>\r
- <xsd:element name="description" type="xsd:string" minOccurs="0" maxOccurs="1" />\r
- <xsd:element ref="sql" minOccurs="0" maxOccurs="1"/>\r
- <xsd:element ref="bind-xml" minOccurs="0" maxOccurs="1"/>\r
- <xsd:element ref="ldap" minOccurs="0" maxOccurs="1"/>\r
- </xsd:sequence>\r
- \r
- <xsd:attribute name="name" type="xsd:string" use="required"/>\r
- <xsd:attribute name="type" type="xsd:string" use="optional"/>\r
- <xsd:attribute name="required" type="xsd:boolean" use="optional" default="false"/>\r
- <xsd:attribute name="transient" type="xsd:boolean" use="optional" default="false"/>\r
- <xsd:attribute name="direct" type="xsd:boolean" use="optional" default="false"/>\r
- <xsd:attribute name="lazy" type="xsd:boolean" use="optional" default="false"/>\r
- <xsd:attribute name="container" type="xsd:boolean" use="optional"/>\r
- <xsd:attribute name="get-method" type="xsd:string" use="optional"/>\r
- <xsd:attribute name="has-method" type="xsd:string" use="optional"/>\r
- <xsd:attribute name="set-method" type="xsd:string" use="optional"/>\r
- <xsd:attribute name="create-method" type="xsd:string" use="optional"/>\r
- <xsd:attribute name="handler" type="xsd:string" use="optional"/>\r
- <xsd:attribute name="collection" use="optional">\r
- <xsd:simpleType>\r
- <xsd:restriction base="xsd:string">\r
- <xsd:enumeration value="array"/>\r
- <xsd:enumeration value="vector"/>\r
- <xsd:enumeration value="arraylist"/>\r
- <xsd:enumeration value="hashtable"/>\r
- <xsd:enumeration value="collection"/>\r
- <xsd:enumeration value="set"/>\r
- <xsd:enumeration value="map"/>\r
- <xsd:enumeration value="enumerate"/>\r
- </xsd:restriction>\r
- </xsd:simpleType>\r
- </xsd:attribute>\r
- </xsd:complexType>\r
- </xsd:element>\r
- \r
- <xsd:element name="container">\r
- <xsd:complexType>\r
- <xsd:sequence>\r
- <xsd:element name="description" type="xsd:string" minOccurs="0" maxOccurs="1" />\r
- <xsd:element ref="field" minOccurs="1"/>\r
- </xsd:sequence>\r
- <xsd:attribute name="name" type="xsd:NMTOKEN" use="required"/>\r
- <xsd:attribute name="type" type="xsd:NMTOKEN" use="optional"/>\r
- <xsd:attribute name="required" type="xsd:boolean" use="optional" default="false"/>\r
- <xsd:attribute name="direct" type="xsd:boolean" use="optional" default="false"/>\r
- <xsd:attribute name="get-method" type="xsd:NMTOKEN" use="optional"/>\r
- <xsd:attribute name="set-method" type="xsd:NMTOKEN" use="optional"/>\r
- <xsd:attribute name="create-method" type="xsd:NMTOKEN" use="optional"/>\r
- </xsd:complexType>\r
- </xsd:element>\r
- \r
- <xsd:element name="sql">\r
- <xsd:complexType>\r
- <xsd:attribute name="name" type="xsd:NMTOKENS" use="optional"/>\r
- <xsd:attribute name="type" type="xsd:string" use="optional"/>\r
- <xsd:attribute name="many-table" type="xsd:NMTOKEN" use="optional"/>\r
- <xsd:attribute name="many-key" type="xsd:NMTOKENS" use="optional"/>\r
- <xsd:attribute name="read-only" type="xsd:boolean" use="optional" default="false"/>\r
- \r
- <!-- signals that this field is transient for database mapping (ie should be ignored) -->\r
- <xsd:attribute name="transient" type="xsd:boolean" use="optional"/>\r
- \r
- \r
- <xsd:attribute name="dirty" default="check" use="optional">\r
- <xsd:simpleType>\r
- <xsd:restriction base="xsd:string">\r
- <xsd:enumeration value="check"/>\r
- <xsd:enumeration value="ignore"/>\r
- </xsd:restriction>\r
- </xsd:simpleType>\r
- </xsd:attribute>\r
- </xsd:complexType>\r
- </xsd:element>\r
- \r
- <!--\r
- The 'bind-xml' element is used for specifying XML specific databinding\r
- properties and behavior for a specific field. 'bind-xml' may only appear\r
- as a child of a 'field' element.\r
- -->\r
- <xsd:element name="bind-xml">\r
- <xsd:annotation>\r
- <xsd:documentation>\r
- The 'bind-xml' element is used for specifying XML specific databinding\r
- properties and behavior for a specific field. 'bind-xml' may only appear\r
- as a child of a 'field' element.\r
- </xsd:documentation>\r
- </xsd:annotation>\r
- <xsd:complexType>\r
- \r
- <xsd:sequence>\r
- <xsd:element ref="class" minOccurs="0" maxOccurs="1"/>\r
- <xsd:element name="property" type="propertyType" minOccurs="0" maxOccurs="unbounded"/>\r
- </xsd:sequence>\r
- \r
- <!--\r
- An optional attribute used for specifying the XML name for the\r
- field associated with the 'bind-xml' element.\r
- -->\r
- <xsd:attribute name="name" type="xsd:QName" use="optional">\r
- <xsd:annotation>\r
- <xsd:documentation>\r
- An optional attribute used for specifying the XML name for the\r
- field associated with the 'bind-xml' element.\r
- </xsd:documentation>\r
- </xsd:annotation>\r
- </xsd:attribute>\r
- \r
- <xsd:attribute name="type" type="xsd:NMTOKEN" use="optional"/>\r
- \r
- <!--\r
- Allows specifying how Castor should automatically determines\r
- the XML name of this field when no name has been specified.\r
- -->\r
- <xsd:attribute name="auto-naming" use="optional">\r
- <xsd:annotation>\r
- <xsd:documentation>\r
- Allows specifying how Castor should automatically determines\r
- the XML name of this field when no name has been specified.\r
- In most cases the XML name is determined by using the field name,\r
- but in some cases the user may want to use the Class name of\r
- the field type. This attribute allows choosing between the\r
- two approaches. If this attribute is not specified, the field\r
- name is used as the XML name.\r
- </xsd:documentation>\r
- </xsd:annotation>\r
- <xsd:simpleType>\r
- <xsd:restriction base="xsd:string">\r
- <xsd:enumeration value="deriveByClass"/>\r
- <xsd:enumeration value="deriveByField"/>\r
- </xsd:restriction>\r
- </xsd:simpleType>\r
- </xsd:attribute>\r
- \r
- <!--\r
- Allows specifying a nested location path for this field,\r
- the value should just be a simplified XPath like value\r
- where names are separated by "/".\r
- -->\r
- <xsd:attribute name="location" type="xsd:string" use="optional">\r
- <xsd:annotation>\r
- <xsd:documentation>\r
- Allows specifying a nested location path for this field,\r
- the value should just be a simplified XPath like value\r
- where names are separated by "/".\r
- </xsd:documentation>\r
- </xsd:annotation>\r
- </xsd:attribute>\r
- \r
- <!-- Allows overriding the matching rule -->\r
- <xsd:attribute name="matches" type="xsd:string" use="optional"/>\r
- \r
- \r
- <!-- Signal that this field should be marshalled as a reference -->\r
- <xsd:attribute name="reference" type="xsd:boolean" use="optional"/>\r
- \r
- <!-- NodeType for the XML node -->\r
- <xsd:attribute name="node" use="optional">\r
- <xsd:simpleType>\r
- <xsd:restriction base="xsd:string">\r
- <xsd:enumeration value="attribute"/>\r
- <xsd:enumeration value="element"/>\r
- <xsd:enumeration value="namespace"/>\r
- <xsd:enumeration value="text"/>\r
- </xsd:restriction>\r
- </xsd:simpleType>\r
- </xsd:attribute>\r
- \r
- <xsd:attribute name="QName-prefix" type="xsd:NMTOKEN" use="optional"/>\r
- \r
- <!-- Signal that this field is transient for XML (ie should be ignored) -->\r
- <xsd:attribute name="transient" type="xsd:boolean" use="optional"/>\r
- \r
- </xsd:complexType>\r
- </xsd:element>\r
- \r
- \r
- \r
- <xsd:element name="ldap">\r
- <xsd:complexType>\r
- <xsd:attribute name="name" type="xsd:NMTOKEN" use="optional"/>\r
- </xsd:complexType>\r
- </xsd:element>\r
- \r
- <xsd:element name="key-generator">\r
- <xsd:complexType>\r
- <xsd:sequence>\r
- <xsd:element ref="param" minOccurs="0" maxOccurs="unbounded" />\r
- </xsd:sequence>\r
- <xsd:attribute name="name" type="xsd:ID" use="required"/>\r
- <xsd:attribute name="alias" type="xsd:string" use="optional"/>\r
- </xsd:complexType>\r
- </xsd:element>\r
- \r
- <xsd:element name="cache-type">\r
- <xsd:complexType>\r
- <xsd:attribute name="type" type="xsd:string" use="optional" default="count-limited" />\r
- <xsd:attribute name="capacity" type="xsd:integer" use="optional"/>\r
- </xsd:complexType>\r
- </xsd:element>\r
- \r
- <xsd:element name="param">\r
- <xsd:complexType>\r
- <xsd:attribute name="name" type="xsd:string" use="required"/>\r
- <xsd:attribute name="value" type="xsd:string" use="required"/>\r
- </xsd:complexType>\r
- </xsd:element>\r
- \r
- \r
- <xsd:complexType name="propertyType">\r
- <xsd:sequence>\r
- <xsd:element name="name" type="xsd:string"/>\r
- <xsd:element name="value" type="xsd:string"/>\r
- </xsd:sequence>\r
- </xsd:complexType>\r
- \r
- \r
- </xsd:schema>\r
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+
+ This file is part of Jalview.
+
+ Jalview is free software: you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+
+ Jalview is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty
+ of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+-->
+<!--DOCTYPE schema PUBLIC "-//W3C/DTD XML Schema Version 1.0//EN"
+ "http://www.w3.org/TR/2000/WD-xmlschema-1-20000225/structures.dtd"-->
+ <!--
+ Castor Object Mapping XML Schema
+
+ Namespace: http://castor.exolab.org/
+ System: http://castor.exolab.org/mapping.xsd
+ Public: -//EXOLAB/Castor Object Mapping Schema Version 1.0//EN
+
+ *Note*: This schema is under evolution and subject to change.
+
+ -->
+ <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://castor.exolab.org/"
+ xmlns="http://castor.exolab.org/"
+ version="0.9.4">
+
+ <xsd:element name="mapping">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="description" type="xsd:string" minOccurs="0" maxOccurs="1" />
+ <xsd:element ref="include" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element ref="class" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element ref="key-generator" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="include">
+ <xsd:complexType>
+ <xsd:attribute name="href" type="xsd:string" use="required"/>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="class">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="description" type="xsd:string" minOccurs="0" maxOccurs="1" />
+ <xsd:element ref="cache-type" minOccurs="0" maxOccurs="1" />
+ <xsd:element ref="map-to" minOccurs="0" maxOccurs="1" />
+ <xsd:choice minOccurs="1">
+ <xsd:element ref="field" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element ref="container" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:choice>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:ID" use="required"/>
+ <xsd:attribute name="extends" type="xsd:IDREF" use="optional"/>
+ <xsd:attribute name="depends" type="xsd:IDREF" use="optional"/>
+ <xsd:attribute name="identity" type="xsd:NMTOKENS" use="optional"/>
+ <xsd:attribute name="access" default="shared" use="optional">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="read-only"/>
+ <xsd:enumeration value="shared"/>
+ <xsd:enumeration value="exclusive"/>
+ <xsd:enumeration value="db-locked"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:attribute>
+ <xsd:attribute name="key-generator" type="xsd:string" use="optional"/>
+ <xsd:attribute name="auto-complete" type="xsd:boolean" use="optional" default="false"/>
+ <xsd:attribute name="verify-constructable" type="xsd:boolean" use="optional" default="true"/>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="map-to">
+ <xsd:complexType>
+ <xsd:attribute name="table" type="xsd:NMTOKEN" use="optional"/>
+ <xsd:attribute name="xml" type="xsd:string" use="optional"/>
+ <xsd:attribute name="ns-uri" type="xsd:string" use="optional"/>
+ <xsd:attribute name="ns-prefix" type="xsd:NMTOKEN" use="optional"/>
+ <xsd:attribute name="ldap-dn" type="xsd:string" use="optional"/>
+ <xsd:attribute name="ldap-oc" type="xsd:string" use="optional"/>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="field">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="description" type="xsd:string" minOccurs="0" maxOccurs="1" />
+ <xsd:element ref="sql" minOccurs="0" maxOccurs="1"/>
+ <xsd:element ref="bind-xml" minOccurs="0" maxOccurs="1"/>
+ <xsd:element ref="ldap" minOccurs="0" maxOccurs="1"/>
+ </xsd:sequence>
+
+ <xsd:attribute name="name" type="xsd:string" use="required"/>
+ <xsd:attribute name="type" type="xsd:string" use="optional"/>
+ <xsd:attribute name="required" type="xsd:boolean" use="optional" default="false"/>
+ <xsd:attribute name="transient" type="xsd:boolean" use="optional" default="false"/>
+ <xsd:attribute name="direct" type="xsd:boolean" use="optional" default="false"/>
+ <xsd:attribute name="lazy" type="xsd:boolean" use="optional" default="false"/>
+ <xsd:attribute name="container" type="xsd:boolean" use="optional"/>
+ <xsd:attribute name="get-method" type="xsd:string" use="optional"/>
+ <xsd:attribute name="has-method" type="xsd:string" use="optional"/>
+ <xsd:attribute name="set-method" type="xsd:string" use="optional"/>
+ <xsd:attribute name="create-method" type="xsd:string" use="optional"/>
+ <xsd:attribute name="handler" type="xsd:string" use="optional"/>
+ <xsd:attribute name="collection" use="optional">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="array"/>
+ <xsd:enumeration value="vector"/>
+ <xsd:enumeration value="arraylist"/>
+ <xsd:enumeration value="hashtable"/>
+ <xsd:enumeration value="collection"/>
+ <xsd:enumeration value="set"/>
+ <xsd:enumeration value="map"/>
+ <xsd:enumeration value="enumerate"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:attribute>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="container">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="description" type="xsd:string" minOccurs="0" maxOccurs="1" />
+ <xsd:element ref="field" minOccurs="1"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:NMTOKEN" use="required"/>
+ <xsd:attribute name="type" type="xsd:NMTOKEN" use="optional"/>
+ <xsd:attribute name="required" type="xsd:boolean" use="optional" default="false"/>
+ <xsd:attribute name="direct" type="xsd:boolean" use="optional" default="false"/>
+ <xsd:attribute name="get-method" type="xsd:NMTOKEN" use="optional"/>
+ <xsd:attribute name="set-method" type="xsd:NMTOKEN" use="optional"/>
+ <xsd:attribute name="create-method" type="xsd:NMTOKEN" use="optional"/>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="sql">
+ <xsd:complexType>
+ <xsd:attribute name="name" type="xsd:NMTOKENS" use="optional"/>
+ <xsd:attribute name="type" type="xsd:string" use="optional"/>
+ <xsd:attribute name="many-table" type="xsd:NMTOKEN" use="optional"/>
+ <xsd:attribute name="many-key" type="xsd:NMTOKENS" use="optional"/>
+ <xsd:attribute name="read-only" type="xsd:boolean" use="optional" default="false"/>
+
+ <!-- signals that this field is transient for database mapping (ie should be ignored) -->
+ <xsd:attribute name="transient" type="xsd:boolean" use="optional"/>
+
+
+ <xsd:attribute name="dirty" default="check" use="optional">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="check"/>
+ <xsd:enumeration value="ignore"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:attribute>
+ </xsd:complexType>
+ </xsd:element>
+
+ <!--
+ The 'bind-xml' element is used for specifying XML specific databinding
+ properties and behavior for a specific field. 'bind-xml' may only appear
+ as a child of a 'field' element.
+ -->
+ <xsd:element name="bind-xml">
+ <xsd:annotation>
+ <xsd:documentation>
+ The 'bind-xml' element is used for specifying XML specific databinding
+ properties and behavior for a specific field. 'bind-xml' may only appear
+ as a child of a 'field' element.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+
+ <xsd:sequence>
+ <xsd:element ref="class" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="property" type="propertyType" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+
+ <!--
+ An optional attribute used for specifying the XML name for the
+ field associated with the 'bind-xml' element.
+ -->
+ <xsd:attribute name="name" type="xsd:QName" use="optional">
+ <xsd:annotation>
+ <xsd:documentation>
+ An optional attribute used for specifying the XML name for the
+ field associated with the 'bind-xml' element.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+
+ <xsd:attribute name="type" type="xsd:NMTOKEN" use="optional"/>
+
+ <!--
+ Allows specifying how Castor should automatically determines
+ the XML name of this field when no name has been specified.
+ -->
+ <xsd:attribute name="auto-naming" use="optional">
+ <xsd:annotation>
+ <xsd:documentation>
+ Allows specifying how Castor should automatically determines
+ the XML name of this field when no name has been specified.
+ In most cases the XML name is determined by using the field name,
+ but in some cases the user may want to use the Class name of
+ the field type. This attribute allows choosing between the
+ two approaches. If this attribute is not specified, the field
+ name is used as the XML name.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="deriveByClass"/>
+ <xsd:enumeration value="deriveByField"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:attribute>
+
+ <!--
+ Allows specifying a nested location path for this field,
+ the value should just be a simplified XPath like value
+ where names are separated by "/".
+ -->
+ <xsd:attribute name="location" type="xsd:string" use="optional">
+ <xsd:annotation>
+ <xsd:documentation>
+ Allows specifying a nested location path for this field,
+ the value should just be a simplified XPath like value
+ where names are separated by "/".
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+
+ <!-- Allows overriding the matching rule -->
+ <xsd:attribute name="matches" type="xsd:string" use="optional"/>
+
+
+ <!-- Signal that this field should be marshalled as a reference -->
+ <xsd:attribute name="reference" type="xsd:boolean" use="optional"/>
+
+ <!-- NodeType for the XML node -->
+ <xsd:attribute name="node" use="optional">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="attribute"/>
+ <xsd:enumeration value="element"/>
+ <xsd:enumeration value="namespace"/>
+ <xsd:enumeration value="text"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:attribute>
+
+ <xsd:attribute name="QName-prefix" type="xsd:NMTOKEN" use="optional"/>
+
+ <!-- Signal that this field is transient for XML (ie should be ignored) -->
+ <xsd:attribute name="transient" type="xsd:boolean" use="optional"/>
+
+ </xsd:complexType>
+ </xsd:element>
+
+
+
+ <xsd:element name="ldap">
+ <xsd:complexType>
+ <xsd:attribute name="name" type="xsd:NMTOKEN" use="optional"/>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="key-generator">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="param" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:ID" use="required"/>
+ <xsd:attribute name="alias" type="xsd:string" use="optional"/>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="cache-type">
+ <xsd:complexType>
+ <xsd:attribute name="type" type="xsd:string" use="optional" default="count-limited" />
+ <xsd:attribute name="capacity" type="xsd:integer" use="optional"/>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="param">
+ <xsd:complexType>
+ <xsd:attribute name="name" type="xsd:string" use="required"/>
+ <xsd:attribute name="value" type="xsd:string" use="required"/>
+ </xsd:complexType>
+ </xsd:element>
+
+
+ <xsd:complexType name="propertyType">
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string"/>
+ <xsd:element name="value" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+
+ </xsd:schema>
###############################################################################
-# Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
-# Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
-#
+# Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+# Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+#
# This file is part of Jalview.
-#
+#
# Jalview is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
-#
+#
# Jalview is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
###############################################################################
-#\r
-# Property file for SourceCodeGenerator for jalview project XML for parsing without descriptors\r
-#\r
-\r
-#org.exolab.castor.builder.superclass=com.xyz.BaseObject\r
-\r
-# XML namespace mapping to Java packages\r
-#\r
-org.exolab.castor.builder.nspackages=\\r
- www.vamsas.ac.uk/jalview/version2=jalview.binding,\\r
- www.jalview.org/colours=jalview.binding,\\r
- www.jalview.org=jalview.binding\r
-\r
+#
+# Property file for SourceCodeGenerator for jalview project XML for parsing without descriptors
+#
+
+#org.exolab.castor.builder.superclass=com.xyz.BaseObject
+
+# XML namespace mapping to Java packages
+#
+org.exolab.castor.builder.nspackages=\
+ www.vamsas.ac.uk/jalview/version2=jalview.binding,\
+ www.jalview.org/colours=jalview.binding,\
+ www.jalview.org=jalview.binding
+
###############################################################################
-# Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
-# Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
-#
+# Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+# Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+#
# This file is part of Jalview.
-#
+#
# Jalview is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
-#
+#
# Jalview is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
###############################################################################
-#\r
-# Property file for SourceCodeGenerator for jalview project XML\r
-#\r
-\r
-#org.exolab.castor.builder.superclass=com.xyz.BaseObject\r
-\r
-# XML namespace mapping to Java packages\r
-#\r
-org.exolab.castor.builder.nspackages=\\r
- www.vamsas.ac.uk/jalview/version2=jalview.schemabinding.version2,\\r
- www.jalview.org/colours=jalview.schemabinding.version2,\\r
- www.jalview.org=jalview.schemabinding.version2\r
-\r
+#
+# Property file for SourceCodeGenerator for jalview project XML
+#
+
+#org.exolab.castor.builder.superclass=com.xyz.BaseObject
+
+# XML namespace mapping to Java packages
+#
+org.exolab.castor.builder.nspackages=\
+ www.vamsas.ac.uk/jalview/version2=jalview.schemabinding.version2,\
+ www.jalview.org/colours=jalview.schemabinding.version2,\
+ www.jalview.org=jalview.schemabinding.version2
+
<?xml version="1.0" encoding="UTF-8"?>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+
+ This file is part of Jalview.
+
+ Jalview is free software: you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+
+ Jalview is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty
+ of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:vamsas="www.vamsas.ac.uk/jalview/version2" xmlns:jalview="www.jalview.org/colours" xmlns:jv="www.jalview.org" xmlns:jvws="www.jalview.org/xml/wsparamset" targetNamespace="www.jalview.org" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:import namespace="www.vamsas.ac.uk/jalview/version2" schemaLocation="vamsas.xsd"/>
-<?xml version="1.0" encoding="UTF-8"?>\r
-<!--\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
--->\r
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"\r
- xmlns:vamsas="www.vamsas.org"\r
- xmlns:jalview="www.jalview.org/colours"\r
- xmlns:jv="www.jalview.org" \r
- targetNamespace="www.jalview.org" elementFormDefault="qualified" attributeFormDefault="unqualified">\r
- \r
- <xs:import schemaLocation="vamsasJvV1.xsd" namespace="www.vamsas.org"/>\r
- <xs:import schemaLocation="jalviewUserColours.xsd" namespace="www.jalview.org/colours"/>\r
- <xs:complexType name="JalviewModel">\r
- <xs:sequence>\r
- <xs:element name="creationDate" type="xs:dateTime"/>\r
- <xs:element name="version" type="xs:string"/>\r
- <xs:element name="vamsasModel" type="vamsas:VAMSAS"/>\r
- <xs:sequence>\r
- <xs:element name="JSeq" maxOccurs="unbounded">\r
- <xs:complexType>\r
- <xs:sequence>\r
- <xs:element name="features" type="jv:feature" minOccurs="0" maxOccurs="unbounded"/>\r
- <xs:element name="pdbids" type="jv:pdbentry" minOccurs="0" maxOccurs="unbounded"/>\r
- </xs:sequence>\r
- \r
- <xs:attribute name="colour" type="xs:int" use="optional"/>\r
- <xs:attribute name="start" type="xs:int" use="required"/>\r
- <xs:attribute name="end" type="xs:int" use="required"/>\r
- <xs:attribute name="id" type="xs:int" use="required"/>\r
- </xs:complexType>\r
- </xs:element>\r
- <xs:element name="JGroup" minOccurs="0" maxOccurs="unbounded">\r
- <xs:complexType>\r
- <xs:sequence minOccurs="1">\r
- <xs:element name="seq" maxOccurs="unbounded" type="xs:int"/>\r
- </xs:sequence>\r
- <xs:attribute name="start" type="xs:int"/>\r
- <xs:attribute name="end" type="xs:int"/>\r
- <xs:attribute name="name" type="xs:string"/>\r
- <xs:attribute name="colour" type="xs:string"/>\r
- <xs:attribute name="consThreshold" type="xs:int"/>\r
- <xs:attribute name="pidThreshold" type="xs:int"/>\r
- <xs:attribute name="outlineColour" type="xs:int"/>\r
- <xs:attribute name="displayBoxes" type="xs:boolean"/>\r
- <xs:attribute name="displayText" type="xs:boolean"/>\r
- <xs:attribute name="colourText" type="xs:boolean"/>\r
- </xs:complexType>\r
- </xs:element>\r
- <xs:element name="Viewport" maxOccurs="unbounded">\r
- <xs:complexType>\r
- <xs:attribute name="conservationSelected" type="xs:boolean"/>\r
- <xs:attribute name="pidSelected" type="xs:boolean"/>\r
- <xs:attribute name="bgColour" type="xs:string"/>\r
- <xs:attribute name="consThreshold" type="xs:int"/>\r
- <xs:attribute name="pidThreshold" type="xs:int"/>\r
- <xs:attribute name="title" type="xs:string"/>\r
- <xs:attribute name="showFullId" type="xs:boolean"/>\r
- <xs:attribute name="showText" type="xs:boolean"/>\r
- <xs:attribute name="showColourText" type="xs:boolean"/>\r
- <xs:attribute name="showBoxes" type="xs:boolean"/>\r
- <xs:attribute name="wrapAlignment" type="xs:boolean"/>\r
- <xs:attribute name="renderGaps" type="xs:boolean"/>\r
- <xs:attribute name="showSequenceFeatures" type="xs:boolean"/>\r
- <xs:attribute name="showAnnotation" type="xs:boolean"/>\r
- <xs:attribute name="showConservation" type="xs:boolean"/>\r
- <xs:attribute name="showQuality" type="xs:boolean"/>\r
- <xs:attribute name="showIdentity" type="xs:boolean"/>\r
- <xs:attribute name="xpos" type="xs:int"/>\r
- <xs:attribute name="ypos" type="xs:int"/>\r
- <xs:attribute name="width" type="xs:int"/>\r
- <xs:attribute name="height" type="xs:int"/>\r
- <xs:attribute name="startRes" type="xs:int"/>\r
- <xs:attribute name="startSeq" type="xs:int"/>\r
- <xs:attribute name="fontName" type="xs:string"/>\r
- <xs:attribute name="fontSize" type="xs:int"/>\r
- <xs:attribute name="fontStyle" type="xs:int"/>\r
- </xs:complexType>\r
- </xs:element>\r
- <xs:element name="UserColours" minOccurs="0" maxOccurs="unbounded">\r
- <xs:complexType>\r
- <xs:sequence minOccurs="1">\r
- <xs:element name="UserColourScheme" type="jalview:JalviewUserColours"/>\r
- </xs:sequence>\r
- <xs:attribute name="id" type="xs:string"/>\r
- </xs:complexType>\r
- </xs:element>\r
- <xs:element name="tree" minOccurs="0" maxOccurs="unbounded">\r
- <xs:complexType>\r
- <xs:sequence minOccurs="0" maxOccurs="1">\r
- <xs:element name="title" type="xs:string"/>\r
- <xs:element name="newick" type="xs:string"/>\r
- </xs:sequence>\r
- <xs:attribute name="width" type="xs:int"/>\r
- <xs:attribute name="height" type="xs:int"/>\r
- <xs:attribute name="xpos" type="xs:int"/>\r
- <xs:attribute name="ypos" type="xs:int"/>\r
- <xs:attribute name="fontName" type="xs:string"/>\r
- <xs:attribute name="fontSize" type="xs:int"/>\r
- <xs:attribute name="fontStyle" type="xs:int"/>\r
- <xs:attribute name="threshold" type="xs:float"/>\r
- <xs:attribute name="showBootstrap" type="xs:boolean"/>\r
- <xs:attribute name="showDistances" type="xs:boolean"/>\r
- <xs:attribute name="markUnlinked" type="xs:boolean"/>\r
- <xs:attribute name="fitToWindow" type="xs:boolean"/>\r
- <xs:attribute name="currentTree" type="xs:boolean"/>\r
- </xs:complexType>\r
- </xs:element>\r
- \r
- <xs:element name="FeatureSettings" minOccurs="0" maxOccurs="1">\r
- <xs:complexType>\r
- <xs:sequence>\r
- <xs:element name="setting" minOccurs="0" maxOccurs="unbounded">\r
- <xs:complexType>\r
- <xs:attribute name="type" type="xs:string" use="required"/>\r
- <xs:attribute name="colour" type="xs:int" use="required"/>\r
- <xs:attribute name="display" type="xs:boolean" use="required"/>\r
- </xs:complexType>\r
- </xs:element>\r
- </xs:sequence>\r
- </xs:complexType>\r
- </xs:element>\r
- \r
- </xs:sequence>\r
- </xs:sequence>\r
- </xs:complexType>\r
- \r
- <xs:complexType name="feature">\r
- <xs:attribute name="begin" type="xs:int" use="required"/>\r
- <xs:attribute name="end" type="xs:int" use="required"/>\r
- <xs:attribute name="type" type="xs:string" use="required"/>\r
- <xs:attribute name="description" type="xs:string" use="optional"/>\r
- <xs:attribute name="status" type="xs:string" use="optional"/>\r
- </xs:complexType>\r
- \r
- <xs:complexType name="pdbentry">\r
- <xs:sequence minOccurs="0" maxOccurs="unbounded">\r
- <xs:element name="property" minOccurs="0" maxOccurs="unbounded">\r
- <xs:complexType>\r
- <xs:attribute name="name" type="xs:string" use="required"/>\r
- <xs:attribute name="value" type="xs:string" use="required"/>\r
- </xs:complexType>\r
- </xs:element>\r
- </xs:sequence>\r
- <xs:attribute name="id" type="xs:string" use="required"/>\r
- <xs:attribute name="type" type="xs:string" use="optional"/>\r
- </xs:complexType>\r
- \r
-</xs:schema>\r
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+
+ This file is part of Jalview.
+
+ Jalview is free software: you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+
+ Jalview is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty
+ of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+-->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:vamsas="www.vamsas.org"
+ xmlns:jalview="www.jalview.org/colours"
+ xmlns:jv="www.jalview.org"
+ targetNamespace="www.jalview.org" elementFormDefault="qualified" attributeFormDefault="unqualified">
+
+ <xs:import schemaLocation="vamsasJvV1.xsd" namespace="www.vamsas.org"/>
+ <xs:import schemaLocation="jalviewUserColours.xsd" namespace="www.jalview.org/colours"/>
+ <xs:complexType name="JalviewModel">
+ <xs:sequence>
+ <xs:element name="creationDate" type="xs:dateTime"/>
+ <xs:element name="version" type="xs:string"/>
+ <xs:element name="vamsasModel" type="vamsas:VAMSAS"/>
+ <xs:sequence>
+ <xs:element name="JSeq" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="features" type="jv:feature" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element name="pdbids" type="jv:pdbentry" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+
+ <xs:attribute name="colour" type="xs:int" use="optional"/>
+ <xs:attribute name="start" type="xs:int" use="required"/>
+ <xs:attribute name="end" type="xs:int" use="required"/>
+ <xs:attribute name="id" type="xs:int" use="required"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="JGroup" minOccurs="0" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:sequence minOccurs="1">
+ <xs:element name="seq" maxOccurs="unbounded" type="xs:int"/>
+ </xs:sequence>
+ <xs:attribute name="start" type="xs:int"/>
+ <xs:attribute name="end" type="xs:int"/>
+ <xs:attribute name="name" type="xs:string"/>
+ <xs:attribute name="colour" type="xs:string"/>
+ <xs:attribute name="consThreshold" type="xs:int"/>
+ <xs:attribute name="pidThreshold" type="xs:int"/>
+ <xs:attribute name="outlineColour" type="xs:int"/>
+ <xs:attribute name="displayBoxes" type="xs:boolean"/>
+ <xs:attribute name="displayText" type="xs:boolean"/>
+ <xs:attribute name="colourText" type="xs:boolean"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="Viewport" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:attribute name="conservationSelected" type="xs:boolean"/>
+ <xs:attribute name="pidSelected" type="xs:boolean"/>
+ <xs:attribute name="bgColour" type="xs:string"/>
+ <xs:attribute name="consThreshold" type="xs:int"/>
+ <xs:attribute name="pidThreshold" type="xs:int"/>
+ <xs:attribute name="title" type="xs:string"/>
+ <xs:attribute name="showFullId" type="xs:boolean"/>
+ <xs:attribute name="showText" type="xs:boolean"/>
+ <xs:attribute name="showColourText" type="xs:boolean"/>
+ <xs:attribute name="showBoxes" type="xs:boolean"/>
+ <xs:attribute name="wrapAlignment" type="xs:boolean"/>
+ <xs:attribute name="renderGaps" type="xs:boolean"/>
+ <xs:attribute name="showSequenceFeatures" type="xs:boolean"/>
+ <xs:attribute name="showAnnotation" type="xs:boolean"/>
+ <xs:attribute name="showConservation" type="xs:boolean"/>
+ <xs:attribute name="showQuality" type="xs:boolean"/>
+ <xs:attribute name="showIdentity" type="xs:boolean"/>
+ <xs:attribute name="xpos" type="xs:int"/>
+ <xs:attribute name="ypos" type="xs:int"/>
+ <xs:attribute name="width" type="xs:int"/>
+ <xs:attribute name="height" type="xs:int"/>
+ <xs:attribute name="startRes" type="xs:int"/>
+ <xs:attribute name="startSeq" type="xs:int"/>
+ <xs:attribute name="fontName" type="xs:string"/>
+ <xs:attribute name="fontSize" type="xs:int"/>
+ <xs:attribute name="fontStyle" type="xs:int"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="UserColours" minOccurs="0" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:sequence minOccurs="1">
+ <xs:element name="UserColourScheme" type="jalview:JalviewUserColours"/>
+ </xs:sequence>
+ <xs:attribute name="id" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="tree" minOccurs="0" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:sequence minOccurs="0" maxOccurs="1">
+ <xs:element name="title" type="xs:string"/>
+ <xs:element name="newick" type="xs:string"/>
+ </xs:sequence>
+ <xs:attribute name="width" type="xs:int"/>
+ <xs:attribute name="height" type="xs:int"/>
+ <xs:attribute name="xpos" type="xs:int"/>
+ <xs:attribute name="ypos" type="xs:int"/>
+ <xs:attribute name="fontName" type="xs:string"/>
+ <xs:attribute name="fontSize" type="xs:int"/>
+ <xs:attribute name="fontStyle" type="xs:int"/>
+ <xs:attribute name="threshold" type="xs:float"/>
+ <xs:attribute name="showBootstrap" type="xs:boolean"/>
+ <xs:attribute name="showDistances" type="xs:boolean"/>
+ <xs:attribute name="markUnlinked" type="xs:boolean"/>
+ <xs:attribute name="fitToWindow" type="xs:boolean"/>
+ <xs:attribute name="currentTree" type="xs:boolean"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="FeatureSettings" minOccurs="0" maxOccurs="1">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="setting" minOccurs="0" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:attribute name="type" type="xs:string" use="required"/>
+ <xs:attribute name="colour" type="xs:int" use="required"/>
+ <xs:attribute name="display" type="xs:boolean" use="required"/>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+ </xs:sequence>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="feature">
+ <xs:attribute name="begin" type="xs:int" use="required"/>
+ <xs:attribute name="end" type="xs:int" use="required"/>
+ <xs:attribute name="type" type="xs:string" use="required"/>
+ <xs:attribute name="description" type="xs:string" use="optional"/>
+ <xs:attribute name="status" type="xs:string" use="optional"/>
+ </xs:complexType>
+
+ <xs:complexType name="pdbentry">
+ <xs:sequence minOccurs="0" maxOccurs="unbounded">
+ <xs:element name="property" minOccurs="0" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:attribute name="name" type="xs:string" use="required"/>
+ <xs:attribute name="value" type="xs:string" use="required"/>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ <xs:attribute name="id" type="xs:string" use="required"/>
+ <xs:attribute name="type" type="xs:string" use="optional"/>
+ </xs:complexType>
+
+</xs:schema>
<?xml version="1.0" encoding="UTF-8"?>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+
+ This file is part of Jalview.
+
+ Jalview is free software: you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+
+ Jalview is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty
+ of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
-->
<!-- edited with XMLSpy v2006 sp1 U (http://www.altova.com) by ioh[ (o[ih[oh) -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:vamsas="www.vamsas.ac.uk/jalview/version2" targetNamespace="www.vamsas.ac.uk/jalview/version2" elementFormDefault="qualified" attributeFormDefault="unqualified">
-<?xml version="1.0" encoding="UTF-8"?>\r
-<!--\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
--->\r
-<!-- edited with XMLSpy v2006 sp1 U (http://www.altova.com) by ioh[ (o[ih[oh) -->\r
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:vamsas="www.vamsas.org" targetNamespace="www.vamsas.org" elementFormDefault="qualified" attributeFormDefault="unqualified">\r
- <xs:complexType name="VAMSAS">\r
- <xs:sequence>\r
- <xs:element name="Alignment" minOccurs="0" maxOccurs="unbounded">\r
- <xs:complexType>\r
- <xs:sequence>\r
- <xs:element name="Annotation" minOccurs="0">\r
- <xs:complexType>\r
- <xs:sequence>\r
- <xs:element ref="vamsas:annotationElement" maxOccurs="unbounded"/>\r
- <xs:element name="label" type="xs:string"/>\r
- <xs:element name="description" type="xs:string"/>\r
- </xs:sequence>\r
- <xs:attribute name="graph" type="xs:boolean" use="required"/>\r
- <xs:attribute name="graphType" type="xs:int" use="optional"/>\r
- </xs:complexType>\r
- </xs:element>\r
- <xs:element ref="vamsas:SequenceSet"/>\r
- </xs:sequence>\r
- </xs:complexType>\r
- </xs:element>\r
- <xs:element name="Tree" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>\r
- <xs:element ref="vamsas:SequenceSet" minOccurs="0" maxOccurs="unbounded"/>\r
- </xs:sequence>\r
- </xs:complexType>\r
- <xs:element name="SequenceSet">\r
- <xs:complexType>\r
- <xs:sequence>\r
- <xs:element name="Sequence" type="vamsas:SequenceType" maxOccurs="unbounded"/>\r
- <xs:element name="Annotation" minOccurs="0" maxOccurs="unbounded">\r
- <xs:complexType>\r
- <xs:sequence>\r
- <xs:element name="description" type="xs:string" minOccurs="0"/>\r
- <xs:element name="status" type="xs:string" minOccurs="0"/>\r
- <xs:element ref="vamsas:annotationElement" minOccurs="0" maxOccurs="unbounded"/>\r
- </xs:sequence>\r
- <xs:attribute name="type" type="xs:string" use="required"/>\r
- <xs:attribute name="end" type="xs:string" use="required"/>\r
- <xs:attribute name="begin" type="xs:string" use="required"/>\r
- <xs:attribute name="seqRef" type="xs:string" use="required"/>\r
- </xs:complexType>\r
- </xs:element>\r
- </xs:sequence>\r
- <xs:attribute name="gapChar" type="xs:string" use="required"/>\r
- <xs:attribute name="aligned" type="xs:boolean" use="optional"/>\r
- </xs:complexType>\r
- </xs:element>\r
- <xs:element name="annotationElement">\r
- <xs:complexType>\r
- <xs:sequence>\r
- <xs:element name="displayCharacter" type="xs:string"/>\r
- <xs:element name="description" type="xs:string"/>\r
- <xs:element name="secondaryStructure">\r
- <xs:simpleType>\r
- <xs:restriction base="xs:string">\r
- <xs:length value="1"/>\r
- </xs:restriction>\r
- </xs:simpleType>\r
- </xs:element>\r
- <xs:element name="value" type="xs:float"/>\r
- </xs:sequence>\r
- <xs:attribute name="position" type="xs:int" use="required"/>\r
- </xs:complexType>\r
- </xs:element>\r
- <xs:complexType name="SequenceType">\r
- <xs:sequence>\r
- <xs:element name="sequence" type="xs:string"/>\r
- <xs:element name="name" type="xs:string"/>\r
- </xs:sequence>\r
- <xs:attribute name="id" type="xs:string"/>\r
- </xs:complexType>\r
-</xs:schema>\r
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+
+ This file is part of Jalview.
+
+ Jalview is free software: you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+
+ Jalview is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty
+ of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+-->
+<!-- edited with XMLSpy v2006 sp1 U (http://www.altova.com) by ioh[ (o[ih[oh) -->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:vamsas="www.vamsas.org" targetNamespace="www.vamsas.org" elementFormDefault="qualified" attributeFormDefault="unqualified">
+ <xs:complexType name="VAMSAS">
+ <xs:sequence>
+ <xs:element name="Alignment" minOccurs="0" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="Annotation" minOccurs="0">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="vamsas:annotationElement" maxOccurs="unbounded"/>
+ <xs:element name="label" type="xs:string"/>
+ <xs:element name="description" type="xs:string"/>
+ </xs:sequence>
+ <xs:attribute name="graph" type="xs:boolean" use="required"/>
+ <xs:attribute name="graphType" type="xs:int" use="optional"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element ref="vamsas:SequenceSet"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="Tree" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="vamsas:SequenceSet" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:element name="SequenceSet">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="Sequence" type="vamsas:SequenceType" maxOccurs="unbounded"/>
+ <xs:element name="Annotation" minOccurs="0" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="description" type="xs:string" minOccurs="0"/>
+ <xs:element name="status" type="xs:string" minOccurs="0"/>
+ <xs:element ref="vamsas:annotationElement" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="type" type="xs:string" use="required"/>
+ <xs:attribute name="end" type="xs:string" use="required"/>
+ <xs:attribute name="begin" type="xs:string" use="required"/>
+ <xs:attribute name="seqRef" type="xs:string" use="required"/>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ <xs:attribute name="gapChar" type="xs:string" use="required"/>
+ <xs:attribute name="aligned" type="xs:boolean" use="optional"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="annotationElement">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="displayCharacter" type="xs:string"/>
+ <xs:element name="description" type="xs:string"/>
+ <xs:element name="secondaryStructure">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:length value="1"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+ <xs:element name="value" type="xs:float"/>
+ </xs:sequence>
+ <xs:attribute name="position" type="xs:int" use="required"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:complexType name="SequenceType">
+ <xs:sequence>
+ <xs:element name="sequence" type="xs:string"/>
+ <xs:element name="name" type="xs:string"/>
+ </xs:sequence>
+ <xs:attribute name="id" type="xs:string"/>
+ </xs:complexType>
+</xs:schema>
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package ext.vamsas;\r
-\r
-public interface SeqSearchI extends java.rmi.Remote\r
-{\r
- public java.lang.String getDatabase() throws java.rmi.RemoteException;\r
-\r
- public vamsas.objects.simple.SeqSearchResult getResult(\r
- java.lang.String job_id) throws java.rmi.RemoteException;\r
-\r
- public vamsas.objects.simple.WsJobId psearch(\r
- vamsas.objects.simple.Alignment al, java.lang.String database)\r
- throws java.rmi.RemoteException;\r
-\r
- public vamsas.objects.simple.WsJobId search(\r
- vamsas.objects.simple.Sequence s, java.lang.String database)\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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package ext.vamsas;
+
+public interface SeqSearchI extends java.rmi.Remote
+{
+ public java.lang.String getDatabase() throws java.rmi.RemoteException;
+
+ public vamsas.objects.simple.SeqSearchResult getResult(
+ java.lang.String job_id) throws java.rmi.RemoteException;
+
+ public vamsas.objects.simple.WsJobId psearch(
+ vamsas.objects.simple.Alignment al, java.lang.String database)
+ throws java.rmi.RemoteException;
+
+ public vamsas.objects.simple.WsJobId search(
+ vamsas.objects.simple.Sequence s, java.lang.String database)
+ throws java.rmi.RemoteException;
+
+ public vamsas.objects.simple.WsJobId cancel(java.lang.String jobId)
+ throws java.rmi.RemoteException;
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package ext.vamsas;\r
-\r
-public class SeqSearchServiceLocator extends org.apache.axis.client.Service\r
- implements ext.vamsas.SeqSearchServiceService\r
-{\r
-\r
- public SeqSearchServiceLocator()\r
- {\r
- }\r
-\r
- public SeqSearchServiceLocator(org.apache.axis.EngineConfiguration config)\r
- {\r
- super(config);\r
- }\r
-\r
- // Use to get a proxy class for ScanPSService\r
- private java.lang.String ScanPSService_address = "http://localhost:8080/TestJWS/services/ScanPSService";\r
-\r
- public java.lang.String getSeqSeachServiceAddress()\r
- {\r
- return ScanPSService_address;\r
- }\r
-\r
- // The WSDD service name defaults to the port name.\r
- private java.lang.String ScanPSServiceWSDDServiceName = "ScanPSService";\r
-\r
- public java.lang.String getScanPSServiceWSDDServiceName()\r
- {\r
- return ScanPSServiceWSDDServiceName;\r
- }\r
-\r
- public void setScanPSServiceWSDDServiceName(java.lang.String name)\r
- {\r
- ScanPSServiceWSDDServiceName = name;\r
- }\r
-\r
- public ext.vamsas.SeqSearchI getSeqSearchService()\r
- throws javax.xml.rpc.ServiceException\r
- {\r
- java.net.URL endpoint;\r
- try\r
- {\r
- endpoint = new java.net.URL(ScanPSService_address);\r
- } catch (java.net.MalformedURLException e)\r
- {\r
- throw new javax.xml.rpc.ServiceException(e);\r
- }\r
- return getSeqSearchService(endpoint);\r
- }\r
-\r
- public ext.vamsas.SeqSearchI getSeqSearchService(java.net.URL portAddress)\r
- throws javax.xml.rpc.ServiceException\r
- {\r
- try\r
- {\r
- ext.vamsas.SeqSearchServiceSoapBindingStub _stub = new ext.vamsas.SeqSearchServiceSoapBindingStub(\r
- portAddress, this);\r
- _stub.setPortName(getScanPSServiceWSDDServiceName());\r
- return _stub;\r
- } catch (org.apache.axis.AxisFault e)\r
- {\r
- return null;\r
- }\r
- }\r
-\r
- public void setScanPSServiceEndpointAddress(java.lang.String address)\r
- {\r
- ScanPSService_address = address;\r
- }\r
-\r
- /**\r
- * For the given interface, get the stub implementation. If this service has\r
- * no port for the given interface, 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.SeqSearchI.class\r
- .isAssignableFrom(serviceEndpointInterface))\r
- {\r
- ext.vamsas.SeqSearchServiceSoapBindingStub _stub = new ext.vamsas.SeqSearchServiceSoapBindingStub(\r
- new java.net.URL(ScanPSService_address), this);\r
- _stub.setPortName(getScanPSServiceWSDDServiceName());\r
- return _stub;\r
- }\r
- } catch (java.lang.Throwable t)\r
- {\r
- throw new javax.xml.rpc.ServiceException(t);\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. If this service has\r
- * no port for the given interface, 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
- java.lang.String inputPortName = portName.getLocalPart();\r
- if ("ScanPSService".equals(inputPortName))\r
- {\r
- return getSeqSearchService();\r
- }\r
- else\r
- {\r
- java.rmi.Remote _stub = getPort(serviceEndpointInterface);\r
- ((org.apache.axis.client.Stub) _stub).setPortName(portName);\r
- return _stub;\r
- }\r
- }\r
-\r
- public javax.xml.namespace.QName getServiceName()\r
- {\r
- return new javax.xml.namespace.QName("vamsas", "ScanPSServiceService");\r
- }\r
-\r
- private java.util.HashSet ports = null;\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", "ScanPSService"));\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) throws javax.xml.rpc.ServiceException\r
- {\r
- if ("ScanPSService".equals(portName))\r
- {\r
- setScanPSServiceEndpointAddress(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) throws javax.xml.rpc.ServiceException\r
- {\r
- setEndpointAddress(portName.getLocalPart(), address);\r
- }\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package ext.vamsas;
+
+public class SeqSearchServiceLocator extends org.apache.axis.client.Service
+ implements ext.vamsas.SeqSearchServiceService
+{
+
+ public SeqSearchServiceLocator()
+ {
+ }
+
+ public SeqSearchServiceLocator(org.apache.axis.EngineConfiguration config)
+ {
+ super(config);
+ }
+
+ // Use to get a proxy class for ScanPSService
+ private java.lang.String ScanPSService_address = "http://localhost:8080/TestJWS/services/ScanPSService";
+
+ public java.lang.String getSeqSeachServiceAddress()
+ {
+ return ScanPSService_address;
+ }
+
+ // The WSDD service name defaults to the port name.
+ private java.lang.String ScanPSServiceWSDDServiceName = "ScanPSService";
+
+ public java.lang.String getScanPSServiceWSDDServiceName()
+ {
+ return ScanPSServiceWSDDServiceName;
+ }
+
+ public void setScanPSServiceWSDDServiceName(java.lang.String name)
+ {
+ ScanPSServiceWSDDServiceName = name;
+ }
+
+ public ext.vamsas.SeqSearchI getSeqSearchService()
+ throws javax.xml.rpc.ServiceException
+ {
+ java.net.URL endpoint;
+ try
+ {
+ endpoint = new java.net.URL(ScanPSService_address);
+ } catch (java.net.MalformedURLException e)
+ {
+ throw new javax.xml.rpc.ServiceException(e);
+ }
+ return getSeqSearchService(endpoint);
+ }
+
+ public ext.vamsas.SeqSearchI getSeqSearchService(java.net.URL portAddress)
+ throws javax.xml.rpc.ServiceException
+ {
+ try
+ {
+ ext.vamsas.SeqSearchServiceSoapBindingStub _stub = new ext.vamsas.SeqSearchServiceSoapBindingStub(
+ portAddress, this);
+ _stub.setPortName(getScanPSServiceWSDDServiceName());
+ return _stub;
+ } catch (org.apache.axis.AxisFault e)
+ {
+ return null;
+ }
+ }
+
+ public void setScanPSServiceEndpointAddress(java.lang.String address)
+ {
+ ScanPSService_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.SeqSearchI.class
+ .isAssignableFrom(serviceEndpointInterface))
+ {
+ ext.vamsas.SeqSearchServiceSoapBindingStub _stub = new ext.vamsas.SeqSearchServiceSoapBindingStub(
+ new java.net.URL(ScanPSService_address), this);
+ _stub.setPortName(getScanPSServiceWSDDServiceName());
+ 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 ("ScanPSService".equals(inputPortName))
+ {
+ return getSeqSearchService();
+ }
+ 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", "ScanPSServiceService");
+ }
+
+ private java.util.HashSet ports = null;
+
+ public java.util.Iterator getPorts()
+ {
+ if (ports == null)
+ {
+ ports = new java.util.HashSet();
+ ports.add(new javax.xml.namespace.QName("vamsas", "ScanPSService"));
+ }
+ 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 ("ScanPSService".equals(portName))
+ {
+ setScanPSServiceEndpointAddress(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
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package ext.vamsas;\r
-\r
-public interface SeqSearchServiceService extends javax.xml.rpc.Service\r
-{\r
- public java.lang.String getSeqSeachServiceAddress();\r
-\r
- public ext.vamsas.SeqSearchI getSeqSearchService()\r
- throws javax.xml.rpc.ServiceException;\r
-\r
- public ext.vamsas.SeqSearchI getSeqSearchService(java.net.URL portAddress)\r
- throws javax.xml.rpc.ServiceException;\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package ext.vamsas;
+
+public interface SeqSearchServiceService extends javax.xml.rpc.Service
+{
+ public java.lang.String getSeqSeachServiceAddress();
+
+ public ext.vamsas.SeqSearchI getSeqSearchService()
+ throws javax.xml.rpc.ServiceException;
+
+ public ext.vamsas.SeqSearchI getSeqSearchService(java.net.URL portAddress)
+ throws javax.xml.rpc.ServiceException;
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package ext.vamsas;\r
-\r
-public class SeqSearchServiceSoapBindingStub extends\r
- org.apache.axis.client.Stub implements ext.vamsas.SeqSearchI\r
-{\r
- private java.util.Vector cachedSerClasses = new java.util.Vector();\r
-\r
- private java.util.Vector cachedSerQNames = new java.util.Vector();\r
-\r
- private java.util.Vector cachedSerFactories = new java.util.Vector();\r
-\r
- private java.util.Vector cachedDeserFactories = new java.util.Vector();\r
-\r
- static org.apache.axis.description.OperationDesc[] _operations;\r
-\r
- static\r
- {\r
- _operations = new org.apache.axis.description.OperationDesc[5];\r
- _initOperationDesc1();\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("getDatabase");\r
- oper.setReturnType(new javax.xml.namespace.QName(\r
- "http://www.w3.org/2001/XMLSchema", "string"));\r
- oper.setReturnClass(java.lang.String.class);\r
- oper.setReturnQName(new javax.xml.namespace.QName("",\r
- "getDatabaseReturn"));\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("getResult");\r
- oper.addParameter(new javax.xml.namespace.QName("", "job_id"),\r
- new javax.xml.namespace.QName(\r
- "http://www.w3.org/2001/XMLSchema", "string"),\r
- 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", "SeqSearchResult"));\r
- oper.setReturnClass(vamsas.objects.simple.SeqSearchResult.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[1] = oper;\r
-\r
- oper = new org.apache.axis.description.OperationDesc();\r
- oper.setName("psearch");\r
- oper.addParameter(new javax.xml.namespace.QName("", "al"),\r
- new javax.xml.namespace.QName("simple.objects.vamsas",\r
- "Alignment"), vamsas.objects.simple.Alignment.class,\r
- org.apache.axis.description.ParameterDesc.IN, false, false);\r
- oper.addParameter(new javax.xml.namespace.QName("", "database"),\r
- new javax.xml.namespace.QName(\r
- "http://www.w3.org/2001/XMLSchema", "string"),\r
- 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("", "psearchReturn"));\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("search");\r
- oper.addParameter(new javax.xml.namespace.QName("", "s"),\r
- new javax.xml.namespace.QName("simple.objects.vamsas",\r
- "Sequence"), vamsas.objects.simple.Sequence.class,\r
- org.apache.axis.description.ParameterDesc.IN, false, false);\r
- oper.addParameter(new javax.xml.namespace.QName("", "database"),\r
- new javax.xml.namespace.QName(\r
- "http://www.w3.org/2001/XMLSchema", "string"),\r
- 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("", "searchReturn"));\r
- oper.setStyle(org.apache.axis.constants.Style.RPC);\r
- oper.setUse(org.apache.axis.constants.Use.ENCODED);\r
- _operations[3] = 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", "string"),\r
- 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[4] = oper;\r
-\r
- }\r
-\r
- public SeqSearchServiceSoapBindingStub() throws org.apache.axis.AxisFault\r
- {\r
- this(null);\r
- }\r
-\r
- public SeqSearchServiceSoapBindingStub(java.net.URL endpointURL,\r
- javax.xml.rpc.Service service) throws org.apache.axis.AxisFault\r
- {\r
- this(service);\r
- super.cachedEndpoint = endpointURL;\r
- }\r
-\r
- public SeqSearchServiceSoapBindingStub(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
- 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.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.ArraySerializerFactory.class;\r
- java.lang.Class arraydf = org.apache.axis.encoding.ser.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", "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
- qName = new javax.xml.namespace.QName("simple.objects.vamsas",\r
- "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("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("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",\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",\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
- "SeqSearchResult");\r
- cachedSerQNames.add(qName);\r
- cls = vamsas.objects.simple.SeqSearchResult.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
- }\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.service\r
- .createCall();\r
- if (super.maintainSessionSet)\r
- {\r
- _call.setMaintainSession(super.maintainSession);\r
- }\r
- if (super.cachedUsername != null)\r
- {\r
- _call.setUsername(super.cachedUsername);\r
- }\r
- if (super.cachedPassword != null)\r
- {\r
- _call.setPassword(super.cachedPassword);\r
- }\r
- if (super.cachedEndpoint != null)\r
- {\r
- _call.setTargetEndpointAddress(super.cachedEndpoint);\r
- }\r
- if (super.cachedTimeout != null)\r
- {\r
- _call.setTimeout(super.cachedTimeout);\r
- }\r
- if (super.cachedPortName != null)\r
- {\r
- _call.setPortName(super.cachedPortName);\r
- }\r
- java.util.Enumeration keys = super.cachedProperties.keys();\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
- // 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.SOAP11_CONSTANTS);\r
- _call.setEncodingStyle(org.apache.axis.Constants.URI_SOAP11_ENC);\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) cachedSerQNames\r
- .get(i);\r
- java.lang.Class sf = (java.lang.Class) cachedSerFactories\r
- .get(i);\r
- java.lang.Class df = (java.lang.Class) cachedDeserFactories\r
- .get(i);\r
- _call.registerTypeMapping(cls, qName, sf, df, false);\r
- }\r
- }\r
- }\r
- return _call;\r
- } catch (java.lang.Throwable _t)\r
- {\r
- throw new org.apache.axis.AxisFault(\r
- "Failure trying to get the Call object", _t);\r
- }\r
- }\r
-\r
- public java.lang.String getDatabase() throws java.rmi.RemoteException\r
- {\r
- if (super.cachedEndpoint == null)\r
- {\r
- throw new org.apache.axis.NoEndPointException();\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",\r
- "getDatabase"));\r
-\r
- setRequestHeaders(_call);\r
- setAttachments(_call);\r
- java.lang.Object _resp = _call.invoke(new java.lang.Object[]\r
- {});\r
-\r
- if (_resp instanceof java.rmi.RemoteException)\r
- {\r
- throw (java.rmi.RemoteException) _resp;\r
- }\r
- else\r
- {\r
- extractAttachments(_call);\r
- try\r
- {\r
- return (java.lang.String) _resp;\r
- } catch (java.lang.Exception _exception)\r
- {\r
- return (java.lang.String) org.apache.axis.utils.JavaUtils.convert(\r
- _resp, java.lang.String.class);\r
- }\r
- }\r
- }\r
-\r
- public vamsas.objects.simple.SeqSearchResult getResult(\r
- java.lang.String job_id) throws java.rmi.RemoteException\r
- {\r
- if (super.cachedEndpoint == null)\r
- {\r
- throw new org.apache.axis.NoEndPointException();\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
- "getResult"));\r
-\r
- setRequestHeaders(_call);\r
- setAttachments(_call);\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
- try\r
- {\r
- return (vamsas.objects.simple.SeqSearchResult) _resp;\r
- } catch (java.lang.Exception _exception)\r
- {\r
- return (vamsas.objects.simple.SeqSearchResult) org.apache.axis.utils.JavaUtils\r
- .convert(_resp, vamsas.objects.simple.SeqSearchResult.class);\r
- }\r
- }\r
- }\r
-\r
- public vamsas.objects.simple.WsJobId psearch(\r
- vamsas.objects.simple.Alignment al, java.lang.String database)\r
- throws java.rmi.RemoteException\r
- {\r
- if (super.cachedEndpoint == null)\r
- {\r
- throw new org.apache.axis.NoEndPointException();\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
- "psearch"));\r
-\r
- setRequestHeaders(_call);\r
- setAttachments(_call);\r
- java.lang.Object _resp = _call.invoke(new java.lang.Object[]\r
- { al, database });\r
-\r
- if (_resp instanceof java.rmi.RemoteException)\r
- {\r
- throw (java.rmi.RemoteException) _resp;\r
- }\r
- else\r
- {\r
- extractAttachments(_call);\r
- try\r
- {\r
- return (vamsas.objects.simple.WsJobId) _resp;\r
- } catch (java.lang.Exception _exception)\r
- {\r
- return (vamsas.objects.simple.WsJobId) org.apache.axis.utils.JavaUtils\r
- .convert(_resp, vamsas.objects.simple.WsJobId.class);\r
- }\r
- }\r
- }\r
-\r
- public vamsas.objects.simple.WsJobId search(\r
- vamsas.objects.simple.Sequence s, java.lang.String database)\r
- throws java.rmi.RemoteException\r
- {\r
- if (super.cachedEndpoint == null)\r
- {\r
- throw new org.apache.axis.NoEndPointException();\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", "search"));\r
-\r
- setRequestHeaders(_call);\r
- setAttachments(_call);\r
- java.lang.Object _resp = _call.invoke(new java.lang.Object[]\r
- { s, database });\r
-\r
- if (_resp instanceof java.rmi.RemoteException)\r
- {\r
- throw (java.rmi.RemoteException) _resp;\r
- }\r
- else\r
- {\r
- extractAttachments(_call);\r
- try\r
- {\r
- return (vamsas.objects.simple.WsJobId) _resp;\r
- } catch (java.lang.Exception _exception)\r
- {\r
- return (vamsas.objects.simple.WsJobId) org.apache.axis.utils.JavaUtils\r
- .convert(_resp, vamsas.objects.simple.WsJobId.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
- org.apache.axis.client.Call _call = createCall();\r
- _call.setOperation(_operations[4]);\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
- 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
- try\r
- {\r
- return (vamsas.objects.simple.WsJobId) _resp;\r
- } catch (java.lang.Exception _exception)\r
- {\r
- return (vamsas.objects.simple.WsJobId) org.apache.axis.utils.JavaUtils\r
- .convert(_resp, vamsas.objects.simple.WsJobId.class);\r
- }\r
- }\r
- }\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package ext.vamsas;
+
+public class SeqSearchServiceSoapBindingStub extends
+ org.apache.axis.client.Stub implements ext.vamsas.SeqSearchI
+{
+ 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();
+
+ static org.apache.axis.description.OperationDesc[] _operations;
+
+ static
+ {
+ _operations = new org.apache.axis.description.OperationDesc[5];
+ _initOperationDesc1();
+ }
+
+ private static void _initOperationDesc1()
+ {
+ org.apache.axis.description.OperationDesc oper;
+ oper = new org.apache.axis.description.OperationDesc();
+ oper.setName("getDatabase");
+ oper.setReturnType(new javax.xml.namespace.QName(
+ "http://www.w3.org/2001/XMLSchema", "string"));
+ oper.setReturnClass(java.lang.String.class);
+ oper.setReturnQName(new javax.xml.namespace.QName("",
+ "getDatabaseReturn"));
+ 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("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", "SeqSearchResult"));
+ oper.setReturnClass(vamsas.objects.simple.SeqSearchResult.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[1] = oper;
+
+ oper = new org.apache.axis.description.OperationDesc();
+ oper.setName("psearch");
+ oper.addParameter(new javax.xml.namespace.QName("", "al"),
+ new javax.xml.namespace.QName("simple.objects.vamsas",
+ "Alignment"), vamsas.objects.simple.Alignment.class,
+ org.apache.axis.description.ParameterDesc.IN, false, false);
+ oper.addParameter(new javax.xml.namespace.QName("", "database"),
+ 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("", "psearchReturn"));
+ 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("search");
+ oper.addParameter(new javax.xml.namespace.QName("", "s"),
+ new javax.xml.namespace.QName("simple.objects.vamsas",
+ "Sequence"), vamsas.objects.simple.Sequence.class,
+ org.apache.axis.description.ParameterDesc.IN, false, false);
+ oper.addParameter(new javax.xml.namespace.QName("", "database"),
+ 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("", "searchReturn"));
+ oper.setStyle(org.apache.axis.constants.Style.RPC);
+ oper.setUse(org.apache.axis.constants.Use.ENCODED);
+ _operations[3] = 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[4] = oper;
+
+ }
+
+ public SeqSearchServiceSoapBindingStub() throws org.apache.axis.AxisFault
+ {
+ this(null);
+ }
+
+ public SeqSearchServiceSoapBindingStub(java.net.URL endpointURL,
+ javax.xml.rpc.Service service) throws org.apache.axis.AxisFault
+ {
+ this(service);
+ super.cachedEndpoint = endpointURL;
+ }
+
+ public SeqSearchServiceSoapBindingStub(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", "Result");
+ cachedSerQNames.add(qName);
+ cls = vamsas.objects.simple.Result.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("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("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",
+ "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",
+ "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",
+ "SeqSearchResult");
+ cachedSerQNames.add(qName);
+ cls = vamsas.objects.simple.SeqSearchResult.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);
+
+ }
+
+ 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 java.lang.String getDatabase() 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",
+ "getDatabase"));
+
+ setRequestHeaders(_call);
+ setAttachments(_call);
+ java.lang.Object _resp = _call.invoke(new java.lang.Object[]
+ {});
+
+ if (_resp instanceof java.rmi.RemoteException)
+ {
+ throw (java.rmi.RemoteException) _resp;
+ }
+ else
+ {
+ extractAttachments(_call);
+ try
+ {
+ return (java.lang.String) _resp;
+ } catch (java.lang.Exception _exception)
+ {
+ return (java.lang.String) org.apache.axis.utils.JavaUtils.convert(
+ _resp, java.lang.String.class);
+ }
+ }
+ }
+
+ public vamsas.objects.simple.SeqSearchResult 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[1]);
+ _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.SeqSearchResult) _resp;
+ } catch (java.lang.Exception _exception)
+ {
+ return (vamsas.objects.simple.SeqSearchResult) org.apache.axis.utils.JavaUtils
+ .convert(_resp, vamsas.objects.simple.SeqSearchResult.class);
+ }
+ }
+ }
+
+ public vamsas.objects.simple.WsJobId psearch(
+ vamsas.objects.simple.Alignment al, java.lang.String database)
+ 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",
+ "psearch"));
+
+ setRequestHeaders(_call);
+ setAttachments(_call);
+ java.lang.Object _resp = _call.invoke(new java.lang.Object[]
+ { al, database });
+
+ 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.WsJobId search(
+ vamsas.objects.simple.Sequence s, java.lang.String database)
+ 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", "search"));
+
+ setRequestHeaders(_call);
+ setAttachments(_call);
+ java.lang.Object _resp = _call.invoke(new java.lang.Object[]
+ { s, database });
+
+ 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.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[4]);
+ _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);
+ }
+ }
+ }
+
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
package jalview.analysis;
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
package jalview.analysis;
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- *\r
- * This file is part of Jalview.\r
- *\r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- *\r
- * Jalview is distributed in the hope that it will be useful, but\r
- * WITHOUT ANY WARRANTY; without even the implied warranty\r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR\r
- * PURPOSE. See the GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.analysis;\r
-\r
-import java.util.Enumeration;\r
-import java.util.List;\r
-import java.util.Vector;\r
-import java.util.Hashtable;\r
-\r
-import jalview.datamodel.AlignedCodonFrame;\r
-import jalview.datamodel.Alignment;\r
-import jalview.datamodel.AlignmentI;\r
-import jalview.datamodel.DBRefSource;\r
-import jalview.datamodel.DBRefEntry;\r
-import jalview.datamodel.Sequence;\r
-import jalview.datamodel.SequenceI;\r
-import jalview.ws.SequenceFetcher;\r
-import jalview.ws.seqfetcher.ASequenceFetcher;\r
-\r
-/**\r
- * Functions for cross-referencing sequence databases. user must first specify\r
- * if cross-referencing from protein or dna (set dna==true)\r
- * \r
- * @author JimP\r
- * \r
- */\r
-public class CrossRef\r
-{\r
- /**\r
- * get the DNA or protein references for a protein or dna sequence\r
- * \r
- * @param dna\r
- * @param rfs\r
- * @return\r
- */\r
- public static DBRefEntry[] findXDbRefs(boolean dna, DBRefEntry[] rfs)\r
- {\r
- if (dna)\r
- {\r
- rfs = jalview.util.DBRefUtils.selectRefs(rfs, DBRefSource.PROTEINDBS);\r
- }\r
- else\r
- {\r
- rfs = jalview.util.DBRefUtils.selectRefs(rfs,\r
- DBRefSource.DNACODINGDBS); // could attempt to find other cross\r
- // refs and return here - ie PDB xrefs\r
- // (not dna, not protein seq)\r
- }\r
- return rfs;\r
- }\r
-\r
- public static Hashtable classifyDbRefs(DBRefEntry[] rfs)\r
- {\r
- Hashtable classes = new Hashtable();\r
- classes.put(DBRefSource.PROTEINDBS,\r
- jalview.util.DBRefUtils.selectRefs(rfs, DBRefSource.PROTEINDBS));\r
- classes.put(DBRefSource.DNACODINGDBS, jalview.util.DBRefUtils\r
- .selectRefs(rfs, DBRefSource.DNACODINGDBS));\r
- classes.put(DBRefSource.DOMAINDBS,\r
- jalview.util.DBRefUtils.selectRefs(rfs, DBRefSource.DOMAINDBS));\r
- // classes.put(OTHER, )\r
- return classes;\r
- }\r
-\r
- /**\r
- * @param dna\r
- * true if seqs are DNA seqs\r
- * @param seqs\r
- * @return a list of sequence database cross reference source types\r
- */\r
- public static String[] findSequenceXrefTypes(boolean dna, SequenceI[] seqs)\r
- {\r
- return findSequenceXrefTypes(dna, seqs, null);\r
- }\r
-\r
- /**\r
- * Indirect references are references from other sequences from the dataset to\r
- * any of the direct DBRefEntrys on the given sequences.\r
- * \r
- * @param dna\r
- * true if seqs are DNA seqs\r
- * @param seqs\r
- * @return a list of sequence database cross reference source types\r
- */\r
- public static String[] findSequenceXrefTypes(boolean dna,\r
- SequenceI[] seqs, AlignmentI dataset)\r
- {\r
- String[] dbrefs = null;\r
- Vector refs = new Vector();\r
- for (int s = 0; s < seqs.length; s++)\r
- {\r
- if (seqs[s] != null)\r
- {\r
-\r
- SequenceI dss = seqs[s];\r
- while (dss.getDatasetSequence() != null)\r
- {\r
- dss = dss.getDatasetSequence();\r
- }\r
- DBRefEntry[] rfs = findXDbRefs(dna, dss.getDBRef());\r
- for (int r = 0; rfs != null && r < rfs.length; r++)\r
- {\r
- if (!refs.contains(rfs[r].getSource()))\r
- {\r
- refs.addElement(rfs[r].getSource());\r
- }\r
- }\r
- if (dataset != null)\r
- {\r
- // search for references to this sequence's direct references.\r
- DBRefEntry[] lrfs = CrossRef\r
- .findXDbRefs(!dna, seqs[s].getDBRef());\r
- Vector rseqs = new Vector();\r
- CrossRef.searchDatasetXrefs(seqs[s], !dna, lrfs, dataset, rseqs,\r
- null); // don't need to specify codon frame for mapping here\r
- Enumeration lr = rseqs.elements();\r
- while (lr.hasMoreElements())\r
- {\r
- SequenceI rs = (SequenceI) lr.nextElement();\r
- DBRefEntry[] xrs = findXDbRefs(dna, rs.getDBRef());\r
- for (int r = 0; rfs != null && r < rfs.length; r++)\r
- {\r
- if (!refs.contains(rfs[r].getSource()))\r
- {\r
- refs.addElement(rfs[r].getSource());\r
- }\r
- }\r
- }\r
- }\r
- }\r
- }\r
- if (refs.size() > 0)\r
- {\r
- dbrefs = new String[refs.size()];\r
- refs.copyInto(dbrefs);\r
- }\r
- return dbrefs;\r
- }\r
-\r
- /*\r
- * if (dna) { if (rfs[r].hasMap()) { // most likely this is a protein cross\r
- * reference if (!refs.contains(rfs[r].getSource())) {\r
- * refs.addElement(rfs[r].getSource()); } } }\r
- */\r
- public static boolean hasCdnaMap(SequenceI[] seqs)\r
- {\r
- String[] reftypes = findSequenceXrefTypes(false, seqs);\r
- for (int s = 0; s < reftypes.length; s++)\r
- {\r
- if (reftypes.equals(DBRefSource.EMBLCDS))\r
- {\r
- return true;\r
- // no map\r
- }\r
- }\r
- return false;\r
- }\r
-\r
- public static SequenceI[] getCdnaMap(SequenceI[] seqs)\r
- {\r
- Vector cseqs = new Vector();\r
- for (int s = 0; s < seqs.length; s++)\r
- {\r
- DBRefEntry[] cdna = findXDbRefs(true, seqs[s].getDBRef());\r
- for (int c = 0; c < cdna.length; c++)\r
- {\r
- if (cdna[c].getSource().equals(DBRefSource.EMBLCDS))\r
- {\r
- System.err\r
- .println("TODO: unimplemented sequence retrieval for coding region sequence.");\r
- // TODO: retrieve CDS dataset sequences\r
- // need global dataset sequence retriever/resolver to reuse refs\r
- // and construct Mapping entry.\r
- // insert gaps in CDS according to peptide gaps.\r
- // add gapped sequence to cseqs\r
- }\r
- }\r
- }\r
- if (cseqs.size() > 0)\r
- {\r
- SequenceI[] rsqs = new SequenceI[cseqs.size()];\r
- cseqs.copyInto(rsqs);\r
- return rsqs;\r
- }\r
- return null;\r
-\r
- }\r
-\r
- /**\r
- * \r
- * @param dna\r
- * @param seqs\r
- * @return\r
- */\r
- public static Alignment findXrefSequences(SequenceI[] seqs, boolean dna,\r
- String source)\r
- {\r
- return findXrefSequences(seqs, dna, source, null);\r
- }\r
-\r
- /**\r
- * \r
- * @param seqs\r
- * @param dna\r
- * @param source\r
- * @param dataset\r
- * alignment to search for product sequences.\r
- * @return products (as dataset sequences)\r
- */\r
- public static Alignment findXrefSequences(SequenceI[] seqs, boolean dna,\r
- String source, AlignmentI dataset)\r
- {\r
- Vector rseqs = new Vector();\r
- Alignment ral = null;\r
- AlignedCodonFrame cf = new AlignedCodonFrame(0); // nominal width\r
- for (int s = 0; s < seqs.length; s++)\r
- {\r
- SequenceI dss = seqs[s];\r
- while (dss.getDatasetSequence() != null)\r
- {\r
- dss = dss.getDatasetSequence();\r
- }\r
- boolean found = false;\r
- DBRefEntry[] xrfs = CrossRef.findXDbRefs(dna, dss.getDBRef());\r
- if ((xrfs == null || xrfs.length == 0) && dataset != null)\r
- {\r
- System.out.println("Attempting to find ds Xrefs refs.");\r
- DBRefEntry[] lrfs = CrossRef.findXDbRefs(!dna, seqs[s].getDBRef()); // less\r
- // ambiguous\r
- // would\r
- // be a\r
- // 'find\r
- // primary\r
- // dbRefEntry'\r
- // method.\r
- // filter for desired source xref here\r
- found = CrossRef.searchDatasetXrefs(dss, !dna, lrfs, dataset,\r
- rseqs, cf);\r
- }\r
- for (int r = 0; xrfs != null && r < xrfs.length; r++)\r
- {\r
- if (source != null && !source.equals(xrfs[r].getSource()))\r
- continue;\r
- if (xrfs[r].hasMap())\r
- {\r
- if (xrfs[r].getMap().getTo() != null)\r
- {\r
- Sequence rsq = new Sequence(xrfs[r].getMap().getTo());\r
- rseqs.addElement(rsq);\r
- if (xrfs[r].getMap().getMap().getFromRatio() != xrfs[r]\r
- .getMap().getMap().getToRatio())\r
- {\r
- // get sense of map correct for adding to product alignment.\r
- if (dna)\r
- {\r
- // map is from dna seq to a protein product\r
- cf.addMap(dss, rsq, xrfs[r].getMap().getMap());\r
- }\r
- else\r
- {\r
- // map should be from protein seq to its coding dna\r
- cf.addMap(rsq, dss, xrfs[r].getMap().getMap().getInverse());\r
- }\r
- }\r
- found = true;\r
- }\r
- }\r
- if (!found)\r
- {\r
- // do a bit more work - search for sequences with references matching\r
- // xrefs on this sequence.\r
- if (dataset != null)\r
- {\r
- found |= searchDataset(dss, xrfs[r], dataset, rseqs, cf); // ,false,!dna);\r
- if (found)\r
- xrfs[r] = null; // we've recovered seqs for this one.\r
- }\r
- }\r
- }\r
- if (!found)\r
- {\r
- if (xrfs != null && xrfs.length > 0)\r
- {\r
- // Try and get the sequence reference...\r
- /*\r
- * Ideal world - we ask for a sequence fetcher implementation here if\r
- * (jalview.io.RunTimeEnvironment.getSequenceFetcher()) (\r
- */\r
- ASequenceFetcher sftch = new SequenceFetcher();\r
- SequenceI[] retrieved = null;\r
- int l = xrfs.length;\r
- for (int r = 0; r < xrfs.length; r++)\r
- {\r
- // filter out any irrelevant or irretrievable references\r
- if (xrfs[r] == null\r
- || ((source != null && !source.equals(xrfs[r]\r
- .getSource())) || !sftch.isFetchable(xrfs[r]\r
- .getSource())))\r
- {\r
- l--;\r
- xrfs[r] = null;\r
- }\r
- }\r
- if (l > 0)\r
- {\r
- System.out\r
- .println("Attempting to retrieve cross referenced sequences.");\r
- DBRefEntry[] t = new DBRefEntry[l];\r
- l = 0;\r
- for (int r = 0; r < xrfs.length; r++)\r
- {\r
- if (xrfs[r] != null)\r
- t[l++] = xrfs[r];\r
- }\r
- xrfs = t;\r
- try\r
- {\r
- retrieved = sftch.getSequences(xrfs); // problem here is we don't\r
- // know which of xrfs\r
- // resulted in which\r
- // retrieved element\r
- } catch (Exception e)\r
- {\r
- System.err\r
- .println("Problem whilst retrieving cross references for Sequence : "\r
- + seqs[s].getName());\r
- e.printStackTrace();\r
- }\r
- if (retrieved != null)\r
- {\r
- for (int rs = 0; rs < retrieved.length; rs++)\r
- {\r
- // TODO: examine each sequence for 'redundancy'\r
- jalview.datamodel.DBRefEntry[] dbr = retrieved[rs]\r
- .getDBRef();\r
- if (dbr != null && dbr.length > 0)\r
- {\r
- for (int di = 0; di < dbr.length; di++)\r
- {\r
- // find any entry where we should put in the sequence being\r
- // cross-referenced into the map\r
- jalview.datamodel.Mapping map = dbr[di].getMap();\r
- if (map != null)\r
- {\r
- if (map.getTo() != null && map.getMap() != null)\r
- {\r
- // should search the local dataset to find any existing\r
- // candidates for To !\r
- try\r
- {\r
- // compare ms with dss and replace with dss in mapping\r
- // if map is congruent\r
- SequenceI ms = map.getTo();\r
- int sf = map.getMap().getToLowest();\r
- int st = map.getMap().getToHighest();\r
- SequenceI mappedrg = ms.getSubSequence(sf, st);\r
- SequenceI loc = dss.getSubSequence(sf, st);\r
- if (mappedrg.getLength() > 0\r
- && mappedrg.getSequenceAsString().equals(\r
- loc.getSequenceAsString()))\r
- {\r
- System.err\r
- .println("Mapping updated for retrieved crossreference");\r
- // method to update all refs of existing To on\r
- // retrieved sequence with dss and merge any props\r
- // on To onto dss.\r
- map.setTo(dss);\r
- }\r
- } catch (Exception e)\r
- {\r
- System.err\r
- .println("Exception when consolidating Mapped sequence set...");\r
- e.printStackTrace(System.err);\r
- }\r
- }\r
- }\r
- }\r
- }\r
- retrieved[rs].updatePDBIds();\r
- rseqs.addElement(retrieved[rs]);\r
- }\r
- }\r
- }\r
- }\r
- }\r
- }\r
- if (rseqs.size() > 0)\r
- {\r
- SequenceI[] rsqs = new SequenceI[rseqs.size()];\r
- rseqs.copyInto(rsqs);\r
- ral = new Alignment(rsqs);\r
- if (cf != null && cf.getProtMappings() != null)\r
- {\r
- ral.addCodonFrame(cf);\r
- }\r
- }\r
- return ral;\r
- }\r
-\r
- /**\r
- * find references to lrfs in the cross-reference set of each sequence in\r
- * dataset (that is not equal to sequenceI) Identifies matching DBRefEntry\r
- * based on source and accession string only - Map and Version are nulled.\r
- * \r
- * @param sequenceI\r
- * @param lrfs\r
- * @param dataset\r
- * @param rseqs\r
- * @return true if matches were found.\r
- */\r
- private static boolean searchDatasetXrefs(SequenceI sequenceI,\r
- boolean dna, DBRefEntry[] lrfs, AlignmentI dataset, Vector rseqs,\r
- AlignedCodonFrame cf)\r
- {\r
- boolean found = false;\r
- if (lrfs == null)\r
- return false;\r
- for (int i = 0; i < lrfs.length; i++)\r
- {\r
- DBRefEntry xref = new DBRefEntry(lrfs[i]);\r
- // add in wildcards\r
- xref.setVersion(null);\r
- xref.setMap(null);\r
- found = searchDataset(sequenceI, xref, dataset, rseqs, cf, false, dna);\r
- }\r
- return found;\r
- }\r
-\r
- /**\r
- * search a given sequence dataset for references matching cross-references to\r
- * the given sequence\r
- * \r
- * @param sequenceI\r
- * @param xrf\r
- * @param dataset\r
- * @param rseqs\r
- * set of unique sequences\r
- * @param cf\r
- * @return true if one or more unique sequences were found and added\r
- */\r
- public static boolean searchDataset(SequenceI sequenceI, DBRefEntry xrf,\r
- AlignmentI dataset, Vector rseqs, AlignedCodonFrame cf)\r
- {\r
- return searchDataset(sequenceI, xrf, dataset, rseqs, cf, true, false);\r
- }\r
-\r
- /**\r
- * TODO: generalise to different protein classifications Search dataset for\r
- * DBRefEntrys matching the given one (xrf) and add the associated sequence to\r
- * rseq.\r
- * \r
- * @param sequenceI\r
- * @param xrf\r
- * @param dataset\r
- * @param rseqs\r
- * @param direct\r
- * - search all references or only subset\r
- * @param dna\r
- * search dna or protein xrefs (if direct=false)\r
- * @return true if relationship found and sequence added.\r
- */\r
- public static boolean searchDataset(SequenceI sequenceI, DBRefEntry xrf,\r
- AlignmentI dataset, Vector rseqs, AlignedCodonFrame cf,\r
- boolean direct, boolean dna)\r
- {\r
- boolean found = false;\r
- SequenceI[] typer = new SequenceI[1];\r
- if (dataset == null)\r
- return false;\r
- if (dataset.getSequences() == null)\r
- {\r
- System.err.println("Empty dataset sequence set - NO VECTOR");\r
- return false;\r
- }\r
- List<SequenceI> ds;\r
- synchronized (ds = dataset.getSequences())\r
- {\r
- for (SequenceI nxt : ds)\r
- if (nxt != null)\r
- {\r
- if (nxt.getDatasetSequence() != null)\r
- {\r
- System.err\r
- .println("Implementation warning: getProducts passed a dataset alignment without dataset sequences in it!");\r
- }\r
- if (nxt != sequenceI && nxt != sequenceI.getDatasetSequence())\r
- {\r
- // check if this is the correct sequence type\r
- {\r
- typer[0] = nxt;\r
- boolean isDna = jalview.util.Comparison.isNucleotide(typer);\r
- if ((direct && isDna == dna) || (!direct && isDna != dna))\r
- {\r
- // skip this sequence because it is same molecule type\r
- continue;\r
- }\r
- }\r
-\r
- // look for direct or indirect references in common\r
- DBRefEntry[] poss = nxt.getDBRef(), cands = null;\r
- if (direct)\r
- {\r
- cands = jalview.util.DBRefUtils.searchRefs(poss, xrf);\r
- }\r
- else\r
- {\r
- poss = CrossRef.findXDbRefs(dna, poss); //\r
- cands = jalview.util.DBRefUtils.searchRefs(poss, xrf);\r
- }\r
- if (cands != null)\r
- {\r
- if (!rseqs.contains(nxt))\r
- {\r
- rseqs.addElement(nxt);\r
- boolean foundmap = cf != null; // don't search if we aren't\r
- // given\r
- // a codon map object\r
- for (int r = 0; foundmap && r < cands.length; r++)\r
- {\r
- if (cands[r].hasMap())\r
- {\r
- if (cands[r].getMap().getTo() != null\r
- && cands[r].getMap().getMap().getFromRatio() != cands[r]\r
- .getMap().getMap().getToRatio())\r
- {\r
- foundmap = true;\r
- // get sense of map correct for adding to product\r
- // alignment.\r
- if (dna)\r
- {\r
- // map is from dna seq to a protein product\r
- cf.addMap(sequenceI, nxt, cands[r].getMap()\r
- .getMap());\r
- }\r
- else\r
- {\r
- // map should be from protein seq to its coding dna\r
- cf.addMap(nxt, sequenceI, cands[r].getMap()\r
- .getMap().getInverse());\r
- }\r
- }\r
- }\r
- }\r
- // TODO: add mapping between sequences if necessary\r
- found = true;\r
- }\r
- }\r
-\r
- }\r
- }\r
- }\r
- return found;\r
- }\r
-\r
- /**\r
- * precalculate different products that can be found for seqs in dataset and\r
- * return them.\r
- * \r
- * @param dna\r
- * @param seqs\r
- * @param dataset\r
- * @param fake\r
- * - don't actually build lists - just get types\r
- * @return public static Object[] buildXProductsList(boolean dna, SequenceI[]\r
- * seqs, AlignmentI dataset, boolean fake) { String types[] =\r
- * jalview.analysis.CrossRef.findSequenceXrefTypes( dna, seqs,\r
- * dataset); if (types != null) { System.out.println("Xref Types for:\r
- * "+(dna ? "dna" : "prot")); for (int t = 0; t < types.length; t++) {\r
- * System.out.println("Type: " + types[t]); SequenceI[] prod =\r
- * jalview.analysis.CrossRef.findXrefSequences(seqs, dna, types[t]);\r
- * System.out.println("Found " + ((prod == null) ? "no" : "" +\r
- * prod.length) + " products"); if (prod!=null) { for (int p=0;\r
- * p<prod.length; p++) { System.out.println("Prod "+p+":\r
- * "+prod[p].getDisplayId(true)); } } } } else {\r
- * System.out.println("Trying getProducts for\r
- * "+al.getSequenceAt(0).getDisplayId(true));\r
- * System.out.println("Search DS Xref for: "+(dna ? "dna" : "prot"));\r
- * // have a bash at finding the products amongst all the retrieved\r
- * sequences. SequenceI[] prod =\r
- * jalview.analysis.CrossRef.findXrefSequences(al\r
- * .getSequencesArray(), dna, null, ds); System.out.println("Found " +\r
- * ((prod == null) ? "no" : "" + prod.length) + " products"); if\r
- * (prod!=null) { // select non-equivalent sequences from dataset list\r
- * for (int p=0; p<prod.length; p++) { System.out.println("Prod "+p+":\r
- * "+prod[p].getDisplayId(true)); } } } }\r
- */\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.analysis;
+
+import java.util.Enumeration;
+import java.util.List;
+import java.util.Vector;
+import java.util.Hashtable;
+
+import jalview.datamodel.AlignedCodonFrame;
+import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.DBRefSource;
+import jalview.datamodel.DBRefEntry;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceI;
+import jalview.ws.SequenceFetcher;
+import jalview.ws.seqfetcher.ASequenceFetcher;
+
+/**
+ * Functions for cross-referencing sequence databases. user must first specify
+ * if cross-referencing from protein or dna (set dna==true)
+ *
+ * @author JimP
+ *
+ */
+public class CrossRef
+{
+ /**
+ * get the DNA or protein references for a protein or dna sequence
+ *
+ * @param dna
+ * @param rfs
+ * @return
+ */
+ public static DBRefEntry[] findXDbRefs(boolean dna, DBRefEntry[] rfs)
+ {
+ if (dna)
+ {
+ rfs = jalview.util.DBRefUtils.selectRefs(rfs, DBRefSource.PROTEINDBS);
+ }
+ else
+ {
+ rfs = jalview.util.DBRefUtils.selectRefs(rfs,
+ DBRefSource.DNACODINGDBS); // could attempt to find other cross
+ // refs and return here - ie PDB xrefs
+ // (not dna, not protein seq)
+ }
+ return rfs;
+ }
+
+ public static Hashtable classifyDbRefs(DBRefEntry[] rfs)
+ {
+ Hashtable classes = new Hashtable();
+ classes.put(DBRefSource.PROTEINDBS,
+ jalview.util.DBRefUtils.selectRefs(rfs, DBRefSource.PROTEINDBS));
+ classes.put(DBRefSource.DNACODINGDBS, jalview.util.DBRefUtils
+ .selectRefs(rfs, DBRefSource.DNACODINGDBS));
+ classes.put(DBRefSource.DOMAINDBS,
+ jalview.util.DBRefUtils.selectRefs(rfs, DBRefSource.DOMAINDBS));
+ // classes.put(OTHER, )
+ return classes;
+ }
+
+ /**
+ * @param dna
+ * true if seqs are DNA seqs
+ * @param seqs
+ * @return a list of sequence database cross reference source types
+ */
+ public static String[] findSequenceXrefTypes(boolean dna, SequenceI[] seqs)
+ {
+ return findSequenceXrefTypes(dna, seqs, null);
+ }
+
+ /**
+ * Indirect references are references from other sequences from the dataset to
+ * any of the direct DBRefEntrys on the given sequences.
+ *
+ * @param dna
+ * true if seqs are DNA seqs
+ * @param seqs
+ * @return a list of sequence database cross reference source types
+ */
+ public static String[] findSequenceXrefTypes(boolean dna,
+ SequenceI[] seqs, AlignmentI dataset)
+ {
+ String[] dbrefs = null;
+ Vector refs = new Vector();
+ for (int s = 0; s < seqs.length; s++)
+ {
+ if (seqs[s] != null)
+ {
+
+ SequenceI dss = seqs[s];
+ while (dss.getDatasetSequence() != null)
+ {
+ dss = dss.getDatasetSequence();
+ }
+ DBRefEntry[] rfs = findXDbRefs(dna, dss.getDBRef());
+ for (int r = 0; rfs != null && r < rfs.length; r++)
+ {
+ if (!refs.contains(rfs[r].getSource()))
+ {
+ refs.addElement(rfs[r].getSource());
+ }
+ }
+ if (dataset != null)
+ {
+ // search for references to this sequence's direct references.
+ DBRefEntry[] lrfs = CrossRef
+ .findXDbRefs(!dna, seqs[s].getDBRef());
+ Vector rseqs = new Vector();
+ CrossRef.searchDatasetXrefs(seqs[s], !dna, lrfs, dataset, rseqs,
+ null); // don't need to specify codon frame for mapping here
+ Enumeration lr = rseqs.elements();
+ while (lr.hasMoreElements())
+ {
+ SequenceI rs = (SequenceI) lr.nextElement();
+ DBRefEntry[] xrs = findXDbRefs(dna, rs.getDBRef());
+ for (int r = 0; rfs != null && r < rfs.length; r++)
+ {
+ if (!refs.contains(rfs[r].getSource()))
+ {
+ refs.addElement(rfs[r].getSource());
+ }
+ }
+ }
+ }
+ }
+ }
+ if (refs.size() > 0)
+ {
+ dbrefs = new String[refs.size()];
+ refs.copyInto(dbrefs);
+ }
+ return dbrefs;
+ }
+
+ /*
+ * if (dna) { if (rfs[r].hasMap()) { // most likely this is a protein cross
+ * reference if (!refs.contains(rfs[r].getSource())) {
+ * refs.addElement(rfs[r].getSource()); } } }
+ */
+ public static boolean hasCdnaMap(SequenceI[] seqs)
+ {
+ String[] reftypes = findSequenceXrefTypes(false, seqs);
+ for (int s = 0; s < reftypes.length; s++)
+ {
+ if (reftypes.equals(DBRefSource.EMBLCDS))
+ {
+ return true;
+ // no map
+ }
+ }
+ return false;
+ }
+
+ public static SequenceI[] getCdnaMap(SequenceI[] seqs)
+ {
+ Vector cseqs = new Vector();
+ for (int s = 0; s < seqs.length; s++)
+ {
+ DBRefEntry[] cdna = findXDbRefs(true, seqs[s].getDBRef());
+ for (int c = 0; c < cdna.length; c++)
+ {
+ if (cdna[c].getSource().equals(DBRefSource.EMBLCDS))
+ {
+ System.err
+ .println("TODO: unimplemented sequence retrieval for coding region sequence.");
+ // TODO: retrieve CDS dataset sequences
+ // need global dataset sequence retriever/resolver to reuse refs
+ // and construct Mapping entry.
+ // insert gaps in CDS according to peptide gaps.
+ // add gapped sequence to cseqs
+ }
+ }
+ }
+ if (cseqs.size() > 0)
+ {
+ SequenceI[] rsqs = new SequenceI[cseqs.size()];
+ cseqs.copyInto(rsqs);
+ return rsqs;
+ }
+ return null;
+
+ }
+
+ /**
+ *
+ * @param dna
+ * @param seqs
+ * @return
+ */
+ public static Alignment findXrefSequences(SequenceI[] seqs, boolean dna,
+ String source)
+ {
+ return findXrefSequences(seqs, dna, source, null);
+ }
+
+ /**
+ *
+ * @param seqs
+ * @param dna
+ * @param source
+ * @param dataset
+ * alignment to search for product sequences.
+ * @return products (as dataset sequences)
+ */
+ public static Alignment findXrefSequences(SequenceI[] seqs, boolean dna,
+ String source, AlignmentI dataset)
+ {
+ Vector rseqs = new Vector();
+ Alignment ral = null;
+ AlignedCodonFrame cf = new AlignedCodonFrame(0); // nominal width
+ for (int s = 0; s < seqs.length; s++)
+ {
+ SequenceI dss = seqs[s];
+ while (dss.getDatasetSequence() != null)
+ {
+ dss = dss.getDatasetSequence();
+ }
+ boolean found = false;
+ DBRefEntry[] xrfs = CrossRef.findXDbRefs(dna, dss.getDBRef());
+ if ((xrfs == null || xrfs.length == 0) && dataset != null)
+ {
+ System.out.println("Attempting to find ds Xrefs refs.");
+ DBRefEntry[] lrfs = CrossRef.findXDbRefs(!dna, seqs[s].getDBRef()); // less
+ // ambiguous
+ // would
+ // be a
+ // 'find
+ // primary
+ // dbRefEntry'
+ // method.
+ // filter for desired source xref here
+ found = CrossRef.searchDatasetXrefs(dss, !dna, lrfs, dataset,
+ rseqs, cf);
+ }
+ for (int r = 0; xrfs != null && r < xrfs.length; r++)
+ {
+ if (source != null && !source.equals(xrfs[r].getSource()))
+ continue;
+ if (xrfs[r].hasMap())
+ {
+ if (xrfs[r].getMap().getTo() != null)
+ {
+ Sequence rsq = new Sequence(xrfs[r].getMap().getTo());
+ rseqs.addElement(rsq);
+ if (xrfs[r].getMap().getMap().getFromRatio() != xrfs[r]
+ .getMap().getMap().getToRatio())
+ {
+ // get sense of map correct for adding to product alignment.
+ if (dna)
+ {
+ // map is from dna seq to a protein product
+ cf.addMap(dss, rsq, xrfs[r].getMap().getMap());
+ }
+ else
+ {
+ // map should be from protein seq to its coding dna
+ cf.addMap(rsq, dss, xrfs[r].getMap().getMap().getInverse());
+ }
+ }
+ found = true;
+ }
+ }
+ if (!found)
+ {
+ // do a bit more work - search for sequences with references matching
+ // xrefs on this sequence.
+ if (dataset != null)
+ {
+ found |= searchDataset(dss, xrfs[r], dataset, rseqs, cf); // ,false,!dna);
+ if (found)
+ xrfs[r] = null; // we've recovered seqs for this one.
+ }
+ }
+ }
+ if (!found)
+ {
+ if (xrfs != null && xrfs.length > 0)
+ {
+ // Try and get the sequence reference...
+ /*
+ * Ideal world - we ask for a sequence fetcher implementation here if
+ * (jalview.io.RunTimeEnvironment.getSequenceFetcher()) (
+ */
+ ASequenceFetcher sftch = new SequenceFetcher();
+ SequenceI[] retrieved = null;
+ int l = xrfs.length;
+ for (int r = 0; r < xrfs.length; r++)
+ {
+ // filter out any irrelevant or irretrievable references
+ if (xrfs[r] == null
+ || ((source != null && !source.equals(xrfs[r]
+ .getSource())) || !sftch.isFetchable(xrfs[r]
+ .getSource())))
+ {
+ l--;
+ xrfs[r] = null;
+ }
+ }
+ if (l > 0)
+ {
+ System.out
+ .println("Attempting to retrieve cross referenced sequences.");
+ DBRefEntry[] t = new DBRefEntry[l];
+ l = 0;
+ for (int r = 0; r < xrfs.length; r++)
+ {
+ if (xrfs[r] != null)
+ t[l++] = xrfs[r];
+ }
+ xrfs = t;
+ try
+ {
+ retrieved = sftch.getSequences(xrfs); // problem here is we don't
+ // know which of xrfs
+ // resulted in which
+ // retrieved element
+ } catch (Exception e)
+ {
+ System.err
+ .println("Problem whilst retrieving cross references for Sequence : "
+ + seqs[s].getName());
+ e.printStackTrace();
+ }
+ if (retrieved != null)
+ {
+ for (int rs = 0; rs < retrieved.length; rs++)
+ {
+ // TODO: examine each sequence for 'redundancy'
+ jalview.datamodel.DBRefEntry[] dbr = retrieved[rs]
+ .getDBRef();
+ if (dbr != null && dbr.length > 0)
+ {
+ for (int di = 0; di < dbr.length; di++)
+ {
+ // find any entry where we should put in the sequence being
+ // cross-referenced into the map
+ jalview.datamodel.Mapping map = dbr[di].getMap();
+ if (map != null)
+ {
+ if (map.getTo() != null && map.getMap() != null)
+ {
+ // should search the local dataset to find any existing
+ // candidates for To !
+ try
+ {
+ // compare ms with dss and replace with dss in mapping
+ // if map is congruent
+ SequenceI ms = map.getTo();
+ int sf = map.getMap().getToLowest();
+ int st = map.getMap().getToHighest();
+ SequenceI mappedrg = ms.getSubSequence(sf, st);
+ SequenceI loc = dss.getSubSequence(sf, st);
+ if (mappedrg.getLength() > 0
+ && mappedrg.getSequenceAsString().equals(
+ loc.getSequenceAsString()))
+ {
+ System.err
+ .println("Mapping updated for retrieved crossreference");
+ // method to update all refs of existing To on
+ // retrieved sequence with dss and merge any props
+ // on To onto dss.
+ map.setTo(dss);
+ }
+ } catch (Exception e)
+ {
+ System.err
+ .println("Exception when consolidating Mapped sequence set...");
+ e.printStackTrace(System.err);
+ }
+ }
+ }
+ }
+ }
+ retrieved[rs].updatePDBIds();
+ rseqs.addElement(retrieved[rs]);
+ }
+ }
+ }
+ }
+ }
+ }
+ if (rseqs.size() > 0)
+ {
+ SequenceI[] rsqs = new SequenceI[rseqs.size()];
+ rseqs.copyInto(rsqs);
+ ral = new Alignment(rsqs);
+ if (cf != null && cf.getProtMappings() != null)
+ {
+ ral.addCodonFrame(cf);
+ }
+ }
+ return ral;
+ }
+
+ /**
+ * find references to lrfs in the cross-reference set of each sequence in
+ * dataset (that is not equal to sequenceI) Identifies matching DBRefEntry
+ * based on source and accession string only - Map and Version are nulled.
+ *
+ * @param sequenceI
+ * @param lrfs
+ * @param dataset
+ * @param rseqs
+ * @return true if matches were found.
+ */
+ private static boolean searchDatasetXrefs(SequenceI sequenceI,
+ boolean dna, DBRefEntry[] lrfs, AlignmentI dataset, Vector rseqs,
+ AlignedCodonFrame cf)
+ {
+ boolean found = false;
+ if (lrfs == null)
+ return false;
+ for (int i = 0; i < lrfs.length; i++)
+ {
+ DBRefEntry xref = new DBRefEntry(lrfs[i]);
+ // add in wildcards
+ xref.setVersion(null);
+ xref.setMap(null);
+ found = searchDataset(sequenceI, xref, dataset, rseqs, cf, false, dna);
+ }
+ return found;
+ }
+
+ /**
+ * search a given sequence dataset for references matching cross-references to
+ * the given sequence
+ *
+ * @param sequenceI
+ * @param xrf
+ * @param dataset
+ * @param rseqs
+ * set of unique sequences
+ * @param cf
+ * @return true if one or more unique sequences were found and added
+ */
+ public static boolean searchDataset(SequenceI sequenceI, DBRefEntry xrf,
+ AlignmentI dataset, Vector rseqs, AlignedCodonFrame cf)
+ {
+ return searchDataset(sequenceI, xrf, dataset, rseqs, cf, true, false);
+ }
+
+ /**
+ * TODO: generalise to different protein classifications Search dataset for
+ * DBRefEntrys matching the given one (xrf) and add the associated sequence to
+ * rseq.
+ *
+ * @param sequenceI
+ * @param xrf
+ * @param dataset
+ * @param rseqs
+ * @param direct
+ * - search all references or only subset
+ * @param dna
+ * search dna or protein xrefs (if direct=false)
+ * @return true if relationship found and sequence added.
+ */
+ public static boolean searchDataset(SequenceI sequenceI, DBRefEntry xrf,
+ AlignmentI dataset, Vector rseqs, AlignedCodonFrame cf,
+ boolean direct, boolean dna)
+ {
+ boolean found = false;
+ SequenceI[] typer = new SequenceI[1];
+ if (dataset == null)
+ return false;
+ if (dataset.getSequences() == null)
+ {
+ System.err.println("Empty dataset sequence set - NO VECTOR");
+ return false;
+ }
+ List<SequenceI> ds;
+ synchronized (ds = dataset.getSequences())
+ {
+ for (SequenceI nxt : ds)
+ if (nxt != null)
+ {
+ if (nxt.getDatasetSequence() != null)
+ {
+ System.err
+ .println("Implementation warning: getProducts passed a dataset alignment without dataset sequences in it!");
+ }
+ if (nxt != sequenceI && nxt != sequenceI.getDatasetSequence())
+ {
+ // check if this is the correct sequence type
+ {
+ typer[0] = nxt;
+ boolean isDna = jalview.util.Comparison.isNucleotide(typer);
+ if ((direct && isDna == dna) || (!direct && isDna != dna))
+ {
+ // skip this sequence because it is same molecule type
+ continue;
+ }
+ }
+
+ // look for direct or indirect references in common
+ DBRefEntry[] poss = nxt.getDBRef(), cands = null;
+ if (direct)
+ {
+ cands = jalview.util.DBRefUtils.searchRefs(poss, xrf);
+ }
+ else
+ {
+ poss = CrossRef.findXDbRefs(dna, poss); //
+ cands = jalview.util.DBRefUtils.searchRefs(poss, xrf);
+ }
+ if (cands != null)
+ {
+ if (!rseqs.contains(nxt))
+ {
+ rseqs.addElement(nxt);
+ boolean foundmap = cf != null; // don't search if we aren't
+ // given
+ // a codon map object
+ for (int r = 0; foundmap && r < cands.length; r++)
+ {
+ if (cands[r].hasMap())
+ {
+ if (cands[r].getMap().getTo() != null
+ && cands[r].getMap().getMap().getFromRatio() != cands[r]
+ .getMap().getMap().getToRatio())
+ {
+ foundmap = true;
+ // get sense of map correct for adding to product
+ // alignment.
+ if (dna)
+ {
+ // map is from dna seq to a protein product
+ cf.addMap(sequenceI, nxt, cands[r].getMap()
+ .getMap());
+ }
+ else
+ {
+ // map should be from protein seq to its coding dna
+ cf.addMap(nxt, sequenceI, cands[r].getMap()
+ .getMap().getInverse());
+ }
+ }
+ }
+ }
+ // TODO: add mapping between sequences if necessary
+ found = true;
+ }
+ }
+
+ }
+ }
+ }
+ return found;
+ }
+
+ /**
+ * precalculate different products that can be found for seqs in dataset and
+ * return them.
+ *
+ * @param dna
+ * @param seqs
+ * @param dataset
+ * @param fake
+ * - don't actually build lists - just get types
+ * @return public static Object[] buildXProductsList(boolean dna, SequenceI[]
+ * seqs, AlignmentI dataset, boolean fake) { String types[] =
+ * jalview.analysis.CrossRef.findSequenceXrefTypes( dna, seqs,
+ * dataset); if (types != null) { System.out.println("Xref Types for:
+ * "+(dna ? "dna" : "prot")); for (int t = 0; t < types.length; t++) {
+ * System.out.println("Type: " + types[t]); SequenceI[] prod =
+ * jalview.analysis.CrossRef.findXrefSequences(seqs, dna, types[t]);
+ * System.out.println("Found " + ((prod == null) ? "no" : "" +
+ * prod.length) + " products"); if (prod!=null) { for (int p=0;
+ * p<prod.length; p++) { System.out.println("Prod "+p+":
+ * "+prod[p].getDisplayId(true)); } } } } else {
+ * System.out.println("Trying getProducts for
+ * "+al.getSequenceAt(0).getDisplayId(true));
+ * System.out.println("Search DS Xref for: "+(dna ? "dna" : "prot"));
+ * // have a bash at finding the products amongst all the retrieved
+ * sequences. SequenceI[] prod =
+ * jalview.analysis.CrossRef.findXrefSequences(al
+ * .getSequencesArray(), dna, null, ds); System.out.println("Found " +
+ * ((prod == null) ? "no" : "" + prod.length) + " products"); if
+ * (prod!=null) { // select non-equivalent sequences from dataset list
+ * for (int p=0; p<prod.length; p++) { System.out.println("Prod "+p+":
+ * "+prod[p].getDisplayId(true)); } } } }
+ */
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.analysis;\r
-\r
-import java.util.Enumeration;\r
-import java.util.Hashtable;\r
-import java.util.Vector;\r
-\r
-import jalview.datamodel.AlignedCodonFrame;\r
-import jalview.datamodel.Alignment;\r
-import jalview.datamodel.AlignmentAnnotation;\r
-import jalview.datamodel.AlignmentI;\r
-import jalview.datamodel.Annotation;\r
-import jalview.datamodel.ColumnSelection;\r
-import jalview.datamodel.DBRefEntry;\r
-import jalview.datamodel.FeatureProperties;\r
-import jalview.datamodel.Mapping;\r
-import jalview.datamodel.Sequence;\r
-import jalview.datamodel.SequenceFeature;\r
-import jalview.datamodel.SequenceI;\r
-import jalview.schemes.ResidueProperties;\r
-import jalview.util.MapList;\r
-import jalview.util.ShiftList;\r
-\r
-public class Dna\r
-{\r
- /**\r
- * \r
- * @param cdp1\r
- * @param cdp2\r
- * @return -1 if cdp1 aligns before cdp2, 0 if in the same column or cdp2 is\r
- * null, +1 if after cdp2\r
- */\r
- private static int compare_codonpos(int[] cdp1, int[] cdp2)\r
- {\r
- if (cdp2 == null\r
- || (cdp1[0] == cdp2[0] && cdp1[1] == cdp2[1] && cdp1[2] == cdp2[2]))\r
- return 0;\r
- if (cdp1[0] < cdp2[0] || cdp1[1] < cdp2[1] || cdp1[2] < cdp2[2])\r
- return -1; // one base in cdp1 precedes the corresponding base in the\r
- // other codon\r
- return 1; // one base in cdp1 appears after the corresponding base in the\r
- // other codon.\r
- }\r
-\r
- /**\r
- * DNA->mapped protein sequence alignment translation given set of sequences\r
- * 1. id distinct coding regions within selected region for each sequence 2.\r
- * generate peptides based on inframe (or given) translation or (optionally\r
- * and where specified) out of frame translations (annotated appropriately) 3.\r
- * align peptides based on codon alignment\r
- */\r
- /**\r
- * id potential products from dna 1. search for distinct products within\r
- * selected region for each selected sequence 2. group by associated DB type.\r
- * 3. return as form for input into above function\r
- */\r
- /**\r
- * \r
- */\r
- /**\r
- * create a new alignment of protein sequences by an inframe translation of\r
- * the provided NA sequences\r
- * \r
- * @param selection\r
- * @param seqstring\r
- * @param viscontigs\r
- * @param gapCharacter\r
- * @param annotations\r
- * @param aWidth\r
- * @param dataset\r
- * destination dataset for translated sequences and mappings\r
- * @return\r
- */\r
- public static AlignmentI CdnaTranslate(SequenceI[] selection,\r
- String[] seqstring, int viscontigs[], char gapCharacter,\r
- AlignmentAnnotation[] annotations, int aWidth, Alignment dataset)\r
- {\r
- return CdnaTranslate(selection, seqstring, null, viscontigs,\r
- gapCharacter, annotations, aWidth, dataset);\r
- }\r
-\r
- /**\r
- * \r
- * @param selection\r
- * @param seqstring\r
- * @param product\r
- * - array of DbRefEntry objects from which exon map in seqstring is\r
- * derived\r
- * @param viscontigs\r
- * @param gapCharacter\r
- * @param annotations\r
- * @param aWidth\r
- * @param dataset\r
- * @return\r
- */\r
- public static AlignmentI CdnaTranslate(SequenceI[] selection,\r
- String[] seqstring, DBRefEntry[] product, int viscontigs[],\r
- char gapCharacter, AlignmentAnnotation[] annotations, int aWidth,\r
- Alignment dataset)\r
- {\r
- AlignedCodonFrame codons = new AlignedCodonFrame(aWidth); // stores hash of\r
- // subsequent\r
- // positions for\r
- // each codon\r
- // start position\r
- // in alignment\r
- int s, sSize = selection.length;\r
- Vector pepseqs = new Vector();\r
- for (s = 0; s < sSize; s++)\r
- {\r
- SequenceI newseq = translateCodingRegion(selection[s], seqstring[s],\r
- viscontigs, codons, gapCharacter,\r
- (product != null) ? product[s] : null); // possibly anonymous\r
- // product\r
- if (newseq != null)\r
- {\r
- pepseqs.addElement(newseq);\r
- SequenceI ds = newseq;\r
- while (ds.getDatasetSequence() != null)\r
- {\r
- ds = ds.getDatasetSequence();\r
- }\r
- dataset.addSequence(ds);\r
- }\r
- }\r
- if (codons.aaWidth == 0)\r
- return null;\r
- SequenceI[] newseqs = new SequenceI[pepseqs.size()];\r
- pepseqs.copyInto(newseqs);\r
- AlignmentI al = new Alignment(newseqs);\r
- al.padGaps(); // ensure we look aligned.\r
- al.setDataset(dataset);\r
- translateAlignedAnnotations(annotations, al, codons);\r
- al.addCodonFrame(codons);\r
- return al;\r
- }\r
-\r
- /**\r
- * fake the collection of DbRefs with associated exon mappings to identify if\r
- * a translation would generate distinct product in the currently selected\r
- * region.\r
- * \r
- * @param selection\r
- * @param viscontigs\r
- * @return\r
- */\r
- public static boolean canTranslate(SequenceI[] selection,\r
- int viscontigs[])\r
- {\r
- for (int gd = 0; gd < selection.length; gd++)\r
- {\r
- SequenceI dna = selection[gd];\r
- jalview.datamodel.DBRefEntry[] dnarefs = jalview.util.DBRefUtils\r
- .selectRefs(dna.getDBRef(),\r
- jalview.datamodel.DBRefSource.DNACODINGDBS);\r
- if (dnarefs != null)\r
- {\r
- // intersect with pep\r
- // intersect with pep\r
- Vector mappedrefs = new Vector();\r
- DBRefEntry[] refs = dna.getDBRef();\r
- for (int d = 0; d < refs.length; d++)\r
- {\r
- if (refs[d].getMap() != null && refs[d].getMap().getMap() != null\r
- && refs[d].getMap().getMap().getFromRatio() == 3\r
- && refs[d].getMap().getMap().getToRatio() == 1)\r
- {\r
- mappedrefs.addElement(refs[d]); // add translated protein maps\r
- }\r
- }\r
- dnarefs = new DBRefEntry[mappedrefs.size()];\r
- mappedrefs.copyInto(dnarefs);\r
- for (int d = 0; d < dnarefs.length; d++)\r
- {\r
- Mapping mp = dnarefs[d].getMap();\r
- if (mp != null)\r
- {\r
- for (int vc = 0; vc < viscontigs.length; vc += 2)\r
- {\r
- int[] mpr = mp.locateMappedRange(viscontigs[vc],\r
- viscontigs[vc + 1]);\r
- if (mpr != null)\r
- {\r
- return true;\r
- }\r
- }\r
- }\r
- }\r
- }\r
- }\r
- return false;\r
- }\r
-\r
- /**\r
- * generate a set of translated protein products from annotated sequenceI\r
- * \r
- * @param selection\r
- * @param viscontigs\r
- * @param gapCharacter\r
- * @param dataset\r
- * destination dataset for translated sequences\r
- * @param annotations\r
- * @param aWidth\r
- * @return\r
- */\r
- public static AlignmentI CdnaTranslate(SequenceI[] selection,\r
- int viscontigs[], char gapCharacter, Alignment dataset)\r
- {\r
- int alwidth = 0;\r
- Vector cdnasqs = new Vector();\r
- Vector cdnasqi = new Vector();\r
- Vector cdnaprod = new Vector();\r
- for (int gd = 0; gd < selection.length; gd++)\r
- {\r
- SequenceI dna = selection[gd];\r
- jalview.datamodel.DBRefEntry[] dnarefs = jalview.util.DBRefUtils\r
- .selectRefs(dna.getDBRef(),\r
- jalview.datamodel.DBRefSource.DNACODINGDBS);\r
- if (dnarefs != null)\r
- {\r
- // intersect with pep\r
- Vector mappedrefs = new Vector();\r
- DBRefEntry[] refs = dna.getDBRef();\r
- for (int d = 0; d < refs.length; d++)\r
- {\r
- if (refs[d].getMap() != null && refs[d].getMap().getMap() != null\r
- && refs[d].getMap().getMap().getFromRatio() == 3\r
- && refs[d].getMap().getMap().getToRatio() == 1)\r
- {\r
- mappedrefs.addElement(refs[d]); // add translated protein maps\r
- }\r
- }\r
- dnarefs = new DBRefEntry[mappedrefs.size()];\r
- mappedrefs.copyInto(dnarefs);\r
- for (int d = 0; d < dnarefs.length; d++)\r
- {\r
- Mapping mp = dnarefs[d].getMap();\r
- StringBuffer sqstr = new StringBuffer();\r
- if (mp != null)\r
- {\r
- Mapping intersect = mp.intersectVisContigs(viscontigs);\r
- // generate seqstring for this sequence based on mapping\r
-\r
- if (sqstr.length() > alwidth)\r
- alwidth = sqstr.length();\r
- cdnasqs.addElement(sqstr.toString());\r
- cdnasqi.addElement(dna);\r
- cdnaprod.addElement(intersect);\r
- }\r
- }\r
- }\r
- SequenceI[] cdna = new SequenceI[cdnasqs.size()];\r
- DBRefEntry[] prods = new DBRefEntry[cdnaprod.size()];\r
- String[] xons = new String[cdnasqs.size()];\r
- cdnasqs.copyInto(xons);\r
- cdnaprod.copyInto(prods);\r
- cdnasqi.copyInto(cdna);\r
- return CdnaTranslate(cdna, xons, prods, viscontigs, gapCharacter,\r
- null, alwidth, dataset);\r
- }\r
- return null;\r
- }\r
-\r
- /**\r
- * translate na alignment annotations onto translated amino acid alignment al\r
- * using codon mapping codons\r
- * \r
- * @param annotations\r
- * @param al\r
- * @param codons\r
- */\r
- public static void translateAlignedAnnotations(\r
- AlignmentAnnotation[] annotations, AlignmentI al,\r
- AlignedCodonFrame codons)\r
- {\r
- // //////////////////////////////\r
- // Copy annotations across\r
- //\r
- // Can only do this for columns with consecutive codons, or where\r
- // annotation is sequence associated.\r
-\r
- int pos, a, aSize;\r
- if (annotations != null)\r
- {\r
- for (int i = 0; i < annotations.length; i++)\r
- {\r
- // Skip any autogenerated annotation\r
- if (annotations[i].autoCalculated)\r
- {\r
- continue;\r
- }\r
-\r
- aSize = codons.getaaWidth(); // aa alignment width.\r
- jalview.datamodel.Annotation[] anots = (annotations[i].annotations == null) ? null\r
- : new jalview.datamodel.Annotation[aSize];\r
- if (anots != null)\r
- {\r
- for (a = 0; a < aSize; a++)\r
- {\r
- // process through codon map.\r
- if (codons.codons[a] != null\r
- && codons.codons[a][0] == (codons.codons[a][2] - 2))\r
- {\r
- anots[a] = getCodonAnnotation(codons.codons[a],\r
- annotations[i].annotations);\r
- }\r
- }\r
- }\r
-\r
- jalview.datamodel.AlignmentAnnotation aa = new jalview.datamodel.AlignmentAnnotation(\r
- annotations[i].label, annotations[i].description, anots);\r
- aa.graph = annotations[i].graph;\r
- aa.graphGroup = annotations[i].graphGroup;\r
- aa.graphHeight = annotations[i].graphHeight;\r
- if (annotations[i].getThreshold() != null)\r
- {\r
- aa.setThreshold(new jalview.datamodel.GraphLine(annotations[i]\r
- .getThreshold()));\r
- }\r
- if (annotations[i].hasScore)\r
- {\r
- aa.setScore(annotations[i].getScore());\r
- }\r
- if (annotations[i].sequenceRef != null)\r
- {\r
- SequenceI aaSeq = codons\r
- .getAaForDnaSeq(annotations[i].sequenceRef);\r
- if (aaSeq != null)\r
- {\r
- // aa.compactAnnotationArray(); // throw away alignment annotation\r
- // positioning\r
- aa.setSequenceRef(aaSeq);\r
- aa.createSequenceMapping(aaSeq, aaSeq.getStart(), true); // rebuild\r
- // mapping\r
- aa.adjustForAlignment();\r
- aaSeq.addAlignmentAnnotation(aa);\r
- }\r
-\r
- }\r
- al.addAnnotation(aa);\r
- }\r
- }\r
- }\r
-\r
- private static Annotation getCodonAnnotation(int[] is,\r
- Annotation[] annotations)\r
- {\r
- // Have a look at all the codon positions for annotation and put the first\r
- // one found into the translated annotation pos.\r
- int contrib = 0;\r
- Annotation annot = null;\r
- for (int p = 0; p < 3; p++)\r
- {\r
- if (annotations[is[p]] != null)\r
- {\r
- if (annot == null)\r
- {\r
- annot = new Annotation(annotations[is[p]]);\r
- contrib = 1;\r
- }\r
- else\r
- {\r
- // merge with last\r
- Annotation cpy = new Annotation(annotations[is[p]]);\r
- if (annot.colour == null)\r
- {\r
- annot.colour = cpy.colour;\r
- }\r
- if (annot.description == null || annot.description.length() == 0)\r
- {\r
- annot.description = cpy.description;\r
- }\r
- if (annot.displayCharacter == null)\r
- {\r
- annot.displayCharacter = cpy.displayCharacter;\r
- }\r
- if (annot.secondaryStructure == 0)\r
- {\r
- annot.secondaryStructure = cpy.secondaryStructure;\r
- }\r
- annot.value += cpy.value;\r
- contrib++;\r
- }\r
- }\r
- }\r
- if (contrib > 1)\r
- {\r
- annot.value /= (float) contrib;\r
- }\r
- return annot;\r
- }\r
-\r
- /**\r
- * Translate a na sequence\r
- * \r
- * @param selection\r
- * sequence displayed under viscontigs visible columns\r
- * @param seqstring\r
- * ORF read in some global alignment reference frame\r
- * @param viscontigs\r
- * mapping from global reference frame to visible seqstring ORF read\r
- * @param codons\r
- * Definition of global ORF alignment reference frame\r
- * @param gapCharacter\r
- * @param newSeq\r
- * @return sequence ready to be added to alignment.\r
- */\r
- public static SequenceI translateCodingRegion(SequenceI selection,\r
- String seqstring, int[] viscontigs, AlignedCodonFrame codons,\r
- char gapCharacter, DBRefEntry product)\r
- {\r
- Vector skip = new Vector();\r
- int skipint[] = null;\r
- ShiftList vismapping = new ShiftList(); // map from viscontigs to seqstring\r
- // intervals\r
- int vc, scontigs[] = new int[viscontigs.length];\r
- int npos = 0;\r
- for (vc = 0; vc < viscontigs.length; vc += 2)\r
- {\r
- if (vc == 0)\r
- {\r
- vismapping.addShift(npos, viscontigs[vc]);\r
- }\r
- else\r
- {\r
- // hidden region\r
- vismapping.addShift(npos, viscontigs[vc] - viscontigs[vc - 1] + 1);\r
- }\r
- scontigs[vc] = viscontigs[vc];\r
- scontigs[vc + 1] = viscontigs[vc + 1];\r
- }\r
-\r
- StringBuffer protein = new StringBuffer();\r
- String seq = seqstring.replace('U', 'T');\r
- char codon[] = new char[3];\r
- int cdp[] = new int[3], rf = 0, lastnpos = 0, nend;\r
- int aspos = 0;\r
- int resSize = 0;\r
- for (npos = 0, nend = seq.length(); npos < nend; npos++)\r
- {\r
- if (!jalview.util.Comparison.isGap(seq.charAt(npos)))\r
- {\r
- cdp[rf] = npos; // store position\r
- codon[rf++] = seq.charAt(npos); // store base\r
- }\r
- // filled an RF yet ?\r
- if (rf == 3)\r
- {\r
- String aa = ResidueProperties.codonTranslate(new String(codon));\r
- rf = 0;\r
- if (aa == null)\r
- {\r
- aa = String.valueOf(gapCharacter);\r
- if (skipint == null)\r
- {\r
- skipint = new int[]\r
- { cdp[0], cdp[2] };\r
- }\r
- skipint[1] = cdp[2];\r
- }\r
- else\r
- {\r
- if (skipint != null)\r
- {\r
- // edit scontigs\r
- skipint[0] = vismapping.shift(skipint[0]);\r
- skipint[1] = vismapping.shift(skipint[1]);\r
- for (vc = 0; vc < scontigs.length; vc += 2)\r
- {\r
- if (scontigs[vc + 1] < skipint[0])\r
- {\r
- continue;\r
- }\r
- if (scontigs[vc] <= skipint[0])\r
- {\r
- if (skipint[0] == scontigs[vc])\r
- {\r
-\r
- }\r
- else\r
- {\r
- int[] t = new int[scontigs.length + 2];\r
- System.arraycopy(scontigs, 0, t, 0, vc - 1);\r
- // scontigs[vc]; //\r
- }\r
- }\r
- }\r
- skip.addElement(skipint);\r
- skipint = null;\r
- }\r
- if (aa.equals("STOP"))\r
- {\r
- aa = "X";\r
- }\r
- resSize++;\r
- }\r
- // insert/delete gaps prior to this codon - if necessary\r
- boolean findpos = true;\r
- while (findpos)\r
- {\r
- // first ensure that the codons array is long enough.\r
- codons.checkCodonFrameWidth(aspos);\r
- // now check to see if we place the aa at the current aspos in the\r
- // protein alignment\r
- switch (Dna.compare_codonpos(cdp, codons.codons[aspos]))\r
- {\r
- case -1:\r
- codons.insertAAGap(aspos, gapCharacter);\r
- findpos = false;\r
- break;\r
- case +1:\r
- // this aa appears after the aligned codons at aspos, so prefix it\r
- // with a gap\r
- aa = "" + gapCharacter + aa;\r
- aspos++;\r
- // if (aspos >= codons.aaWidth)\r
- // codons.aaWidth = aspos + 1;\r
- break; // check the next position for alignment\r
- case 0:\r
- // codon aligns at aspos position.\r
- findpos = false;\r
- }\r
- }\r
- // codon aligns with all other sequence residues found at aspos\r
- protein.append(aa);\r
- lastnpos = npos;\r
- if (codons.codons[aspos] == null)\r
- {\r
- // mark this column as aligning to this aligned reading frame\r
- codons.codons[aspos] = new int[]\r
- { cdp[0], cdp[1], cdp[2] };\r
- }\r
- if (aspos >= codons.aaWidth)\r
- {\r
- // update maximum alignment width\r
- // (we can do this without calling checkCodonFrameWidth because it was\r
- // already done above)\r
- codons.setAaWidth(aspos);\r
- }\r
- // ready for next translated reading frame alignment position (if any)\r
- aspos++;\r
- }\r
- }\r
- if (resSize > 0)\r
- {\r
- SequenceI newseq = new Sequence(selection.getName(),\r
- protein.toString());\r
- if (rf != 0)\r
- {\r
- jalview.bin.Cache.log\r
- .debug("trimming contigs for incomplete terminal codon.");\r
- // map and trim contigs to ORF region\r
- vc = scontigs.length - 1;\r
- lastnpos = vismapping.shift(lastnpos); // place npos in context of\r
- // whole dna alignment (rather\r
- // than visible contigs)\r
- // incomplete ORF could be broken over one or two visible contig\r
- // intervals.\r
- while (vc >= 0 && scontigs[vc] > lastnpos)\r
- {\r
- if (vc > 0 && scontigs[vc - 1] > lastnpos)\r
- {\r
- vc -= 2;\r
- }\r
- else\r
- {\r
- // correct last interval in list.\r
- scontigs[vc] = lastnpos;\r
- }\r
- }\r
-\r
- if (vc > 0 && (vc + 1) < scontigs.length)\r
- {\r
- // truncate map list to just vc elements\r
- int t[] = new int[vc + 1];\r
- System.arraycopy(scontigs, 0, t, 0, vc + 1);\r
- scontigs = t;\r
- }\r
- if (vc <= 0)\r
- scontigs = null;\r
- }\r
- if (scontigs != null)\r
- {\r
- npos = 0;\r
- // map scontigs to actual sequence positions on selection\r
- for (vc = 0; vc < scontigs.length; vc += 2)\r
- {\r
- scontigs[vc] = selection.findPosition(scontigs[vc]); // not from 1!\r
- scontigs[vc + 1] = selection.findPosition(scontigs[vc + 1]); // exclusive\r
- if (scontigs[vc + 1] == selection.getEnd())\r
- break;\r
- }\r
- // trim trailing empty intervals.\r
- if ((vc + 2) < scontigs.length)\r
- {\r
- int t[] = new int[vc + 2];\r
- System.arraycopy(scontigs, 0, t, 0, vc + 2);\r
- scontigs = t;\r
- }\r
- /*\r
- * delete intervals in scontigs which are not translated. 1. map skip\r
- * into sequence position intervals 2. truncate existing ranges and add\r
- * new ranges to exclude untranslated regions. if (skip.size()>0) {\r
- * Vector narange = new Vector(); for (vc=0; vc<scontigs.length; vc++) {\r
- * narange.addElement(new int[] {scontigs[vc]}); } int sint=0,iv[]; vc =\r
- * 0; while (sint<skip.size()) { skipint = (int[]) skip.elementAt(sint);\r
- * do { iv = (int[]) narange.elementAt(vc); if (iv[0]>=skipint[0] &&\r
- * iv[0]<=skipint[1]) { if (iv[0]==skipint[0]) { // delete beginning of\r
- * range } else { // truncate range and create new one if necessary iv =\r
- * (int[]) narange.elementAt(vc+1); if (iv[0]<=skipint[1]) { // truncate\r
- * range iv[0] = skipint[1]; } else { } } } else if (iv[0]<skipint[0]) {\r
- * iv = (int[]) narange.elementAt(vc+1); } } while (iv[0]) } }\r
- */\r
- MapList map = new MapList(scontigs, new int[]\r
- { 1, resSize }, 3, 1);\r
-\r
- // update newseq as if it was generated as mapping from product\r
-\r
- if (product != null)\r
- {\r
- newseq.setName(product.getSource() + "|"\r
- + product.getAccessionId());\r
- if (product.getMap() != null)\r
- {\r
- // Mapping mp = product.getMap();\r
- // newseq.setStart(mp.getPosition(scontigs[0]));\r
- // newseq.setEnd(mp\r
- // .getPosition(scontigs[scontigs.length - 1]));\r
- }\r
- }\r
- transferCodedFeatures(selection, newseq, map, null, null);\r
- SequenceI rseq = newseq.deriveSequence(); // construct a dataset\r
- // sequence for our new\r
- // peptide, regardless.\r
- // store a mapping (this actually stores a mapping between the dataset\r
- // sequences for the two sequences\r
- codons.addMap(selection, rseq, map);\r
- return rseq;\r
- }\r
- }\r
- // register the mapping somehow\r
- //\r
- return null;\r
- }\r
-\r
- /**\r
- * Given a peptide newly translated from a dna sequence, copy over and set any\r
- * features on the peptide from the DNA. If featureTypes is null, all features\r
- * on the dna sequence are searched (rather than just the displayed ones), and\r
- * similarly for featureGroups.\r
- * \r
- * @param dna\r
- * @param pep\r
- * @param map\r
- * @param featureTypes\r
- * hash who's keys are the displayed feature type strings\r
- * @param featureGroups\r
- * hash where keys are feature groups and values are Boolean objects\r
- * indicating if they are displayed.\r
- */\r
- private static void transferCodedFeatures(SequenceI dna, SequenceI pep,\r
- MapList map, Hashtable featureTypes, Hashtable featureGroups)\r
- {\r
- SequenceFeature[] sf = dna.getDatasetSequence().getSequenceFeatures();\r
- Boolean fgstate;\r
- jalview.datamodel.DBRefEntry[] dnarefs = jalview.util.DBRefUtils\r
- .selectRefs(dna.getDBRef(),\r
- jalview.datamodel.DBRefSource.DNACODINGDBS);\r
- if (dnarefs != null)\r
- {\r
- // intersect with pep\r
- for (int d = 0; d < dnarefs.length; d++)\r
- {\r
- Mapping mp = dnarefs[d].getMap();\r
- if (mp != null)\r
- {\r
- }\r
- }\r
- }\r
- if (sf != null)\r
- {\r
- for (int f = 0; f < sf.length; f++)\r
- {\r
- fgstate = (featureGroups == null) ? null : ((Boolean) featureGroups\r
- .get(sf[f].featureGroup));\r
- if ((featureTypes == null || featureTypes.containsKey(sf[f]\r
- .getType())) && (fgstate == null || fgstate.booleanValue()))\r
- {\r
- if (FeatureProperties.isCodingFeature(null, sf[f].getType()))\r
- {\r
- // if (map.intersectsFrom(sf[f].begin, sf[f].end))\r
- {\r
-\r
- }\r
- }\r
- }\r
- }\r
- }\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.analysis;
+
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Vector;
+
+import jalview.datamodel.AlignedCodonFrame;
+import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.Annotation;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.DBRefEntry;
+import jalview.datamodel.FeatureProperties;
+import jalview.datamodel.Mapping;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceFeature;
+import jalview.datamodel.SequenceI;
+import jalview.schemes.ResidueProperties;
+import jalview.util.MapList;
+import jalview.util.ShiftList;
+
+public class Dna
+{
+ /**
+ *
+ * @param cdp1
+ * @param cdp2
+ * @return -1 if cdp1 aligns before cdp2, 0 if in the same column or cdp2 is
+ * null, +1 if after cdp2
+ */
+ private static int compare_codonpos(int[] cdp1, int[] cdp2)
+ {
+ if (cdp2 == null
+ || (cdp1[0] == cdp2[0] && cdp1[1] == cdp2[1] && cdp1[2] == cdp2[2]))
+ return 0;
+ if (cdp1[0] < cdp2[0] || cdp1[1] < cdp2[1] || cdp1[2] < cdp2[2])
+ return -1; // one base in cdp1 precedes the corresponding base in the
+ // other codon
+ return 1; // one base in cdp1 appears after the corresponding base in the
+ // other codon.
+ }
+
+ /**
+ * DNA->mapped protein sequence alignment translation given set of sequences
+ * 1. id distinct coding regions within selected region for each sequence 2.
+ * generate peptides based on inframe (or given) translation or (optionally
+ * and where specified) out of frame translations (annotated appropriately) 3.
+ * align peptides based on codon alignment
+ */
+ /**
+ * id potential products from dna 1. search for distinct products within
+ * selected region for each selected sequence 2. group by associated DB type.
+ * 3. return as form for input into above function
+ */
+ /**
+ *
+ */
+ /**
+ * create a new alignment of protein sequences by an inframe translation of
+ * the provided NA sequences
+ *
+ * @param selection
+ * @param seqstring
+ * @param viscontigs
+ * @param gapCharacter
+ * @param annotations
+ * @param aWidth
+ * @param dataset
+ * destination dataset for translated sequences and mappings
+ * @return
+ */
+ public static AlignmentI CdnaTranslate(SequenceI[] selection,
+ String[] seqstring, int viscontigs[], char gapCharacter,
+ AlignmentAnnotation[] annotations, int aWidth, Alignment dataset)
+ {
+ return CdnaTranslate(selection, seqstring, null, viscontigs,
+ gapCharacter, annotations, aWidth, dataset);
+ }
+
+ /**
+ *
+ * @param selection
+ * @param seqstring
+ * @param product
+ * - array of DbRefEntry objects from which exon map in seqstring is
+ * derived
+ * @param viscontigs
+ * @param gapCharacter
+ * @param annotations
+ * @param aWidth
+ * @param dataset
+ * @return
+ */
+ public static AlignmentI CdnaTranslate(SequenceI[] selection,
+ String[] seqstring, DBRefEntry[] product, int viscontigs[],
+ char gapCharacter, AlignmentAnnotation[] annotations, int aWidth,
+ Alignment dataset)
+ {
+ AlignedCodonFrame codons = new AlignedCodonFrame(aWidth); // stores hash of
+ // subsequent
+ // positions for
+ // each codon
+ // start position
+ // in alignment
+ int s, sSize = selection.length;
+ Vector pepseqs = new Vector();
+ for (s = 0; s < sSize; s++)
+ {
+ SequenceI newseq = translateCodingRegion(selection[s], seqstring[s],
+ viscontigs, codons, gapCharacter,
+ (product != null) ? product[s] : null); // possibly anonymous
+ // product
+ if (newseq != null)
+ {
+ pepseqs.addElement(newseq);
+ SequenceI ds = newseq;
+ while (ds.getDatasetSequence() != null)
+ {
+ ds = ds.getDatasetSequence();
+ }
+ dataset.addSequence(ds);
+ }
+ }
+ if (codons.aaWidth == 0)
+ return null;
+ SequenceI[] newseqs = new SequenceI[pepseqs.size()];
+ pepseqs.copyInto(newseqs);
+ AlignmentI al = new Alignment(newseqs);
+ al.padGaps(); // ensure we look aligned.
+ al.setDataset(dataset);
+ translateAlignedAnnotations(annotations, al, codons);
+ al.addCodonFrame(codons);
+ return al;
+ }
+
+ /**
+ * fake the collection of DbRefs with associated exon mappings to identify if
+ * a translation would generate distinct product in the currently selected
+ * region.
+ *
+ * @param selection
+ * @param viscontigs
+ * @return
+ */
+ public static boolean canTranslate(SequenceI[] selection,
+ int viscontigs[])
+ {
+ for (int gd = 0; gd < selection.length; gd++)
+ {
+ SequenceI dna = selection[gd];
+ jalview.datamodel.DBRefEntry[] dnarefs = jalview.util.DBRefUtils
+ .selectRefs(dna.getDBRef(),
+ jalview.datamodel.DBRefSource.DNACODINGDBS);
+ if (dnarefs != null)
+ {
+ // intersect with pep
+ // intersect with pep
+ Vector mappedrefs = new Vector();
+ DBRefEntry[] refs = dna.getDBRef();
+ for (int d = 0; d < refs.length; d++)
+ {
+ if (refs[d].getMap() != null && refs[d].getMap().getMap() != null
+ && refs[d].getMap().getMap().getFromRatio() == 3
+ && refs[d].getMap().getMap().getToRatio() == 1)
+ {
+ mappedrefs.addElement(refs[d]); // add translated protein maps
+ }
+ }
+ dnarefs = new DBRefEntry[mappedrefs.size()];
+ mappedrefs.copyInto(dnarefs);
+ for (int d = 0; d < dnarefs.length; d++)
+ {
+ Mapping mp = dnarefs[d].getMap();
+ if (mp != null)
+ {
+ for (int vc = 0; vc < viscontigs.length; vc += 2)
+ {
+ int[] mpr = mp.locateMappedRange(viscontigs[vc],
+ viscontigs[vc + 1]);
+ if (mpr != null)
+ {
+ return true;
+ }
+ }
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * generate a set of translated protein products from annotated sequenceI
+ *
+ * @param selection
+ * @param viscontigs
+ * @param gapCharacter
+ * @param dataset
+ * destination dataset for translated sequences
+ * @param annotations
+ * @param aWidth
+ * @return
+ */
+ public static AlignmentI CdnaTranslate(SequenceI[] selection,
+ int viscontigs[], char gapCharacter, Alignment dataset)
+ {
+ int alwidth = 0;
+ Vector cdnasqs = new Vector();
+ Vector cdnasqi = new Vector();
+ Vector cdnaprod = new Vector();
+ for (int gd = 0; gd < selection.length; gd++)
+ {
+ SequenceI dna = selection[gd];
+ jalview.datamodel.DBRefEntry[] dnarefs = jalview.util.DBRefUtils
+ .selectRefs(dna.getDBRef(),
+ jalview.datamodel.DBRefSource.DNACODINGDBS);
+ if (dnarefs != null)
+ {
+ // intersect with pep
+ Vector mappedrefs = new Vector();
+ DBRefEntry[] refs = dna.getDBRef();
+ for (int d = 0; d < refs.length; d++)
+ {
+ if (refs[d].getMap() != null && refs[d].getMap().getMap() != null
+ && refs[d].getMap().getMap().getFromRatio() == 3
+ && refs[d].getMap().getMap().getToRatio() == 1)
+ {
+ mappedrefs.addElement(refs[d]); // add translated protein maps
+ }
+ }
+ dnarefs = new DBRefEntry[mappedrefs.size()];
+ mappedrefs.copyInto(dnarefs);
+ for (int d = 0; d < dnarefs.length; d++)
+ {
+ Mapping mp = dnarefs[d].getMap();
+ StringBuffer sqstr = new StringBuffer();
+ if (mp != null)
+ {
+ Mapping intersect = mp.intersectVisContigs(viscontigs);
+ // generate seqstring for this sequence based on mapping
+
+ if (sqstr.length() > alwidth)
+ alwidth = sqstr.length();
+ cdnasqs.addElement(sqstr.toString());
+ cdnasqi.addElement(dna);
+ cdnaprod.addElement(intersect);
+ }
+ }
+ }
+ SequenceI[] cdna = new SequenceI[cdnasqs.size()];
+ DBRefEntry[] prods = new DBRefEntry[cdnaprod.size()];
+ String[] xons = new String[cdnasqs.size()];
+ cdnasqs.copyInto(xons);
+ cdnaprod.copyInto(prods);
+ cdnasqi.copyInto(cdna);
+ return CdnaTranslate(cdna, xons, prods, viscontigs, gapCharacter,
+ null, alwidth, dataset);
+ }
+ return null;
+ }
+
+ /**
+ * translate na alignment annotations onto translated amino acid alignment al
+ * using codon mapping codons
+ *
+ * @param annotations
+ * @param al
+ * @param codons
+ */
+ public static void translateAlignedAnnotations(
+ AlignmentAnnotation[] annotations, AlignmentI al,
+ AlignedCodonFrame codons)
+ {
+ // //////////////////////////////
+ // Copy annotations across
+ //
+ // Can only do this for columns with consecutive codons, or where
+ // annotation is sequence associated.
+
+ int pos, a, aSize;
+ if (annotations != null)
+ {
+ for (int i = 0; i < annotations.length; i++)
+ {
+ // Skip any autogenerated annotation
+ if (annotations[i].autoCalculated)
+ {
+ continue;
+ }
+
+ aSize = codons.getaaWidth(); // aa alignment width.
+ jalview.datamodel.Annotation[] anots = (annotations[i].annotations == null) ? null
+ : new jalview.datamodel.Annotation[aSize];
+ if (anots != null)
+ {
+ for (a = 0; a < aSize; a++)
+ {
+ // process through codon map.
+ if (codons.codons[a] != null
+ && codons.codons[a][0] == (codons.codons[a][2] - 2))
+ {
+ anots[a] = getCodonAnnotation(codons.codons[a],
+ annotations[i].annotations);
+ }
+ }
+ }
+
+ jalview.datamodel.AlignmentAnnotation aa = new jalview.datamodel.AlignmentAnnotation(
+ annotations[i].label, annotations[i].description, anots);
+ aa.graph = annotations[i].graph;
+ aa.graphGroup = annotations[i].graphGroup;
+ aa.graphHeight = annotations[i].graphHeight;
+ if (annotations[i].getThreshold() != null)
+ {
+ aa.setThreshold(new jalview.datamodel.GraphLine(annotations[i]
+ .getThreshold()));
+ }
+ if (annotations[i].hasScore)
+ {
+ aa.setScore(annotations[i].getScore());
+ }
+ if (annotations[i].sequenceRef != null)
+ {
+ SequenceI aaSeq = codons
+ .getAaForDnaSeq(annotations[i].sequenceRef);
+ if (aaSeq != null)
+ {
+ // aa.compactAnnotationArray(); // throw away alignment annotation
+ // positioning
+ aa.setSequenceRef(aaSeq);
+ aa.createSequenceMapping(aaSeq, aaSeq.getStart(), true); // rebuild
+ // mapping
+ aa.adjustForAlignment();
+ aaSeq.addAlignmentAnnotation(aa);
+ }
+
+ }
+ al.addAnnotation(aa);
+ }
+ }
+ }
+
+ private static Annotation getCodonAnnotation(int[] is,
+ Annotation[] annotations)
+ {
+ // Have a look at all the codon positions for annotation and put the first
+ // one found into the translated annotation pos.
+ int contrib = 0;
+ Annotation annot = null;
+ for (int p = 0; p < 3; p++)
+ {
+ if (annotations[is[p]] != null)
+ {
+ if (annot == null)
+ {
+ annot = new Annotation(annotations[is[p]]);
+ contrib = 1;
+ }
+ else
+ {
+ // merge with last
+ Annotation cpy = new Annotation(annotations[is[p]]);
+ if (annot.colour == null)
+ {
+ annot.colour = cpy.colour;
+ }
+ if (annot.description == null || annot.description.length() == 0)
+ {
+ annot.description = cpy.description;
+ }
+ if (annot.displayCharacter == null)
+ {
+ annot.displayCharacter = cpy.displayCharacter;
+ }
+ if (annot.secondaryStructure == 0)
+ {
+ annot.secondaryStructure = cpy.secondaryStructure;
+ }
+ annot.value += cpy.value;
+ contrib++;
+ }
+ }
+ }
+ if (contrib > 1)
+ {
+ annot.value /= (float) contrib;
+ }
+ return annot;
+ }
+
+ /**
+ * Translate a na sequence
+ *
+ * @param selection
+ * sequence displayed under viscontigs visible columns
+ * @param seqstring
+ * ORF read in some global alignment reference frame
+ * @param viscontigs
+ * mapping from global reference frame to visible seqstring ORF read
+ * @param codons
+ * Definition of global ORF alignment reference frame
+ * @param gapCharacter
+ * @param newSeq
+ * @return sequence ready to be added to alignment.
+ */
+ public static SequenceI translateCodingRegion(SequenceI selection,
+ String seqstring, int[] viscontigs, AlignedCodonFrame codons,
+ char gapCharacter, DBRefEntry product)
+ {
+ Vector skip = new Vector();
+ int skipint[] = null;
+ ShiftList vismapping = new ShiftList(); // map from viscontigs to seqstring
+ // intervals
+ int vc, scontigs[] = new int[viscontigs.length];
+ int npos = 0;
+ for (vc = 0; vc < viscontigs.length; vc += 2)
+ {
+ if (vc == 0)
+ {
+ vismapping.addShift(npos, viscontigs[vc]);
+ }
+ else
+ {
+ // hidden region
+ vismapping.addShift(npos, viscontigs[vc] - viscontigs[vc - 1] + 1);
+ }
+ scontigs[vc] = viscontigs[vc];
+ scontigs[vc + 1] = viscontigs[vc + 1];
+ }
+
+ StringBuffer protein = new StringBuffer();
+ String seq = seqstring.replace('U', 'T');
+ char codon[] = new char[3];
+ int cdp[] = new int[3], rf = 0, lastnpos = 0, nend;
+ int aspos = 0;
+ int resSize = 0;
+ for (npos = 0, nend = seq.length(); npos < nend; npos++)
+ {
+ if (!jalview.util.Comparison.isGap(seq.charAt(npos)))
+ {
+ cdp[rf] = npos; // store position
+ codon[rf++] = seq.charAt(npos); // store base
+ }
+ // filled an RF yet ?
+ if (rf == 3)
+ {
+ String aa = ResidueProperties.codonTranslate(new String(codon));
+ rf = 0;
+ if (aa == null)
+ {
+ aa = String.valueOf(gapCharacter);
+ if (skipint == null)
+ {
+ skipint = new int[]
+ { cdp[0], cdp[2] };
+ }
+ skipint[1] = cdp[2];
+ }
+ else
+ {
+ if (skipint != null)
+ {
+ // edit scontigs
+ skipint[0] = vismapping.shift(skipint[0]);
+ skipint[1] = vismapping.shift(skipint[1]);
+ for (vc = 0; vc < scontigs.length; vc += 2)
+ {
+ if (scontigs[vc + 1] < skipint[0])
+ {
+ continue;
+ }
+ if (scontigs[vc] <= skipint[0])
+ {
+ if (skipint[0] == scontigs[vc])
+ {
+
+ }
+ else
+ {
+ int[] t = new int[scontigs.length + 2];
+ System.arraycopy(scontigs, 0, t, 0, vc - 1);
+ // scontigs[vc]; //
+ }
+ }
+ }
+ skip.addElement(skipint);
+ skipint = null;
+ }
+ if (aa.equals("STOP"))
+ {
+ aa = "X";
+ }
+ resSize++;
+ }
+ // insert/delete gaps prior to this codon - if necessary
+ boolean findpos = true;
+ while (findpos)
+ {
+ // first ensure that the codons array is long enough.
+ codons.checkCodonFrameWidth(aspos);
+ // now check to see if we place the aa at the current aspos in the
+ // protein alignment
+ switch (Dna.compare_codonpos(cdp, codons.codons[aspos]))
+ {
+ case -1:
+ codons.insertAAGap(aspos, gapCharacter);
+ findpos = false;
+ break;
+ case +1:
+ // this aa appears after the aligned codons at aspos, so prefix it
+ // with a gap
+ aa = "" + gapCharacter + aa;
+ aspos++;
+ // if (aspos >= codons.aaWidth)
+ // codons.aaWidth = aspos + 1;
+ break; // check the next position for alignment
+ case 0:
+ // codon aligns at aspos position.
+ findpos = false;
+ }
+ }
+ // codon aligns with all other sequence residues found at aspos
+ protein.append(aa);
+ lastnpos = npos;
+ if (codons.codons[aspos] == null)
+ {
+ // mark this column as aligning to this aligned reading frame
+ codons.codons[aspos] = new int[]
+ { cdp[0], cdp[1], cdp[2] };
+ }
+ if (aspos >= codons.aaWidth)
+ {
+ // update maximum alignment width
+ // (we can do this without calling checkCodonFrameWidth because it was
+ // already done above)
+ codons.setAaWidth(aspos);
+ }
+ // ready for next translated reading frame alignment position (if any)
+ aspos++;
+ }
+ }
+ if (resSize > 0)
+ {
+ SequenceI newseq = new Sequence(selection.getName(),
+ protein.toString());
+ if (rf != 0)
+ {
+ jalview.bin.Cache.log
+ .debug("trimming contigs for incomplete terminal codon.");
+ // map and trim contigs to ORF region
+ vc = scontigs.length - 1;
+ lastnpos = vismapping.shift(lastnpos); // place npos in context of
+ // whole dna alignment (rather
+ // than visible contigs)
+ // incomplete ORF could be broken over one or two visible contig
+ // intervals.
+ while (vc >= 0 && scontigs[vc] > lastnpos)
+ {
+ if (vc > 0 && scontigs[vc - 1] > lastnpos)
+ {
+ vc -= 2;
+ }
+ else
+ {
+ // correct last interval in list.
+ scontigs[vc] = lastnpos;
+ }
+ }
+
+ if (vc > 0 && (vc + 1) < scontigs.length)
+ {
+ // truncate map list to just vc elements
+ int t[] = new int[vc + 1];
+ System.arraycopy(scontigs, 0, t, 0, vc + 1);
+ scontigs = t;
+ }
+ if (vc <= 0)
+ scontigs = null;
+ }
+ if (scontigs != null)
+ {
+ npos = 0;
+ // map scontigs to actual sequence positions on selection
+ for (vc = 0; vc < scontigs.length; vc += 2)
+ {
+ scontigs[vc] = selection.findPosition(scontigs[vc]); // not from 1!
+ scontigs[vc + 1] = selection.findPosition(scontigs[vc + 1]); // exclusive
+ if (scontigs[vc + 1] == selection.getEnd())
+ break;
+ }
+ // trim trailing empty intervals.
+ if ((vc + 2) < scontigs.length)
+ {
+ int t[] = new int[vc + 2];
+ System.arraycopy(scontigs, 0, t, 0, vc + 2);
+ scontigs = t;
+ }
+ /*
+ * delete intervals in scontigs which are not translated. 1. map skip
+ * into sequence position intervals 2. truncate existing ranges and add
+ * new ranges to exclude untranslated regions. if (skip.size()>0) {
+ * Vector narange = new Vector(); for (vc=0; vc<scontigs.length; vc++) {
+ * narange.addElement(new int[] {scontigs[vc]}); } int sint=0,iv[]; vc =
+ * 0; while (sint<skip.size()) { skipint = (int[]) skip.elementAt(sint);
+ * do { iv = (int[]) narange.elementAt(vc); if (iv[0]>=skipint[0] &&
+ * iv[0]<=skipint[1]) { if (iv[0]==skipint[0]) { // delete beginning of
+ * range } else { // truncate range and create new one if necessary iv =
+ * (int[]) narange.elementAt(vc+1); if (iv[0]<=skipint[1]) { // truncate
+ * range iv[0] = skipint[1]; } else { } } } else if (iv[0]<skipint[0]) {
+ * iv = (int[]) narange.elementAt(vc+1); } } while (iv[0]) } }
+ */
+ MapList map = new MapList(scontigs, new int[]
+ { 1, resSize }, 3, 1);
+
+ // update newseq as if it was generated as mapping from product
+
+ if (product != null)
+ {
+ newseq.setName(product.getSource() + "|"
+ + product.getAccessionId());
+ if (product.getMap() != null)
+ {
+ // Mapping mp = product.getMap();
+ // newseq.setStart(mp.getPosition(scontigs[0]));
+ // newseq.setEnd(mp
+ // .getPosition(scontigs[scontigs.length - 1]));
+ }
+ }
+ transferCodedFeatures(selection, newseq, map, null, null);
+ SequenceI rseq = newseq.deriveSequence(); // construct a dataset
+ // sequence for our new
+ // peptide, regardless.
+ // store a mapping (this actually stores a mapping between the dataset
+ // sequences for the two sequences
+ codons.addMap(selection, rseq, map);
+ return rseq;
+ }
+ }
+ // register the mapping somehow
+ //
+ return null;
+ }
+
+ /**
+ * Given a peptide newly translated from a dna sequence, copy over and set any
+ * features on the peptide from the DNA. If featureTypes is null, all features
+ * on the dna sequence are searched (rather than just the displayed ones), and
+ * similarly for featureGroups.
+ *
+ * @param dna
+ * @param pep
+ * @param map
+ * @param featureTypes
+ * hash who's keys are the displayed feature type strings
+ * @param featureGroups
+ * hash where keys are feature groups and values are Boolean objects
+ * indicating if they are displayed.
+ */
+ private static void transferCodedFeatures(SequenceI dna, SequenceI pep,
+ MapList map, Hashtable featureTypes, Hashtable featureGroups)
+ {
+ SequenceFeature[] sf = dna.getDatasetSequence().getSequenceFeatures();
+ Boolean fgstate;
+ jalview.datamodel.DBRefEntry[] dnarefs = jalview.util.DBRefUtils
+ .selectRefs(dna.getDBRef(),
+ jalview.datamodel.DBRefSource.DNACODINGDBS);
+ if (dnarefs != null)
+ {
+ // intersect with pep
+ for (int d = 0; d < dnarefs.length; d++)
+ {
+ Mapping mp = dnarefs[d].getMap();
+ if (mp != null)
+ {
+ }
+ }
+ }
+ if (sf != null)
+ {
+ for (int f = 0; f < sf.length; f++)
+ {
+ fgstate = (featureGroups == null) ? null : ((Boolean) featureGroups
+ .get(sf[f].featureGroup));
+ if ((featureTypes == null || featureTypes.containsKey(sf[f]
+ .getType())) && (fgstate == null || fgstate.booleanValue()))
+ {
+ if (FeatureProperties.isCodingFeature(null, sf[f].getType()))
+ {
+ // if (map.intersectsFrom(sf[f].begin, sf[f].end))
+ {
+
+ }
+ }
+ }
+ }
+ }
+ }
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
*
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
/* Author: Lauren Michelle Lui
* Methods are based on RALEE methods http://personalpages.manchester.ac.uk/staff/sam.griffiths-jones/software/ralee/
* */
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
+
package jalview.analysis;
import java.util.*;
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
package jalview.analysis;
public class WUSSParseException extends Exception
return problemPos;
}
-}
\ No newline at end of file
+}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
package jalview.api;
import jalview.datamodel.AlignmentAnnotation;
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
package jalview.api;
import jalview.datamodel.AlignmentAnnotation;
-/**
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
*
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
package jalview.api;
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-
+ */
package jalview.api;
import jalview.datamodel.AlignmentI;
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
package jalview.api;
public interface OOMHandlerI
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
package jalview.api;
import jalview.datamodel.SequencePoint;
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ */
package jalview.api;
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- *\r
- * This file is part of Jalview.\r
- *\r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- *\r
- * Jalview is distributed in the hope that it will be useful, but\r
- * WITHOUT ANY WARRANTY; without even the implied warranty\r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR\r
- * PURPOSE. See the GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.appletgui;\r
-\r
-import jalview.analysis.AAFrequency;\r
-import jalview.analysis.AlignmentSorter;\r
-import jalview.analysis.Conservation;\r
-import jalview.api.SequenceStructureBinding;\r
-import jalview.bin.JalviewLite;\r
-import jalview.commands.CommandI;\r
-import jalview.commands.EditCommand;\r
-import jalview.commands.OrderCommand;\r
-import jalview.commands.RemoveGapColCommand;\r
-import jalview.commands.RemoveGapsCommand;\r
-import jalview.commands.SlideSequencesCommand;\r
-import jalview.commands.TrimRegionCommand;\r
-import jalview.datamodel.Alignment;\r
-import jalview.datamodel.AlignmentI;\r
-import jalview.datamodel.AlignmentOrder;\r
-import jalview.datamodel.ColumnSelection;\r
-import jalview.datamodel.PDBEntry;\r
-import jalview.datamodel.Sequence;\r
-import jalview.datamodel.SequenceCollectionI;\r
-import jalview.datamodel.SequenceGroup;\r
-import jalview.datamodel.SequenceI;\r
-import jalview.io.AnnotationFile;\r
-import jalview.io.AppletFormatAdapter;\r
-import jalview.io.FeaturesFile;\r
-import jalview.io.TCoffeeScoreFile;\r
-import jalview.schemes.Blosum62ColourScheme;\r
-import jalview.schemes.BuriedColourScheme;\r
-import jalview.schemes.ClustalxColourScheme;\r
-import jalview.schemes.ColourSchemeI;\r
-import jalview.schemes.HelixColourScheme;\r
-import jalview.schemes.HydrophobicColourScheme;\r
-import jalview.schemes.NucleotideColourScheme;\r
-import jalview.schemes.PIDColourScheme;\r
-import jalview.schemes.PurinePyrimidineColourScheme;\r
-import jalview.schemes.RNAHelicesColourChooser;\r
-import jalview.schemes.ResidueProperties;\r
-import jalview.schemes.StrandColourScheme;\r
-import jalview.schemes.TCoffeeColourScheme;\r
-import jalview.schemes.TaylorColourScheme;\r
-import jalview.schemes.TurnColourScheme;\r
-import jalview.schemes.ZappoColourScheme;\r
-import jalview.structure.StructureSelectionManager;\r
-\r
-import java.awt.BorderLayout;\r
-import java.awt.Canvas;\r
-import java.awt.CheckboxMenuItem;\r
-import java.awt.Color;\r
-import java.awt.Font;\r
-import java.awt.FontMetrics;\r
-import java.awt.Frame;\r
-import java.awt.Graphics;\r
-import java.awt.Label;\r
-import java.awt.Menu;\r
-import java.awt.MenuBar;\r
-import java.awt.MenuItem;\r
-import java.awt.event.ActionEvent;\r
-import java.awt.event.ActionListener;\r
-import java.awt.event.FocusEvent;\r
-import java.awt.event.FocusListener;\r
-import java.awt.event.ItemEvent;\r
-import java.awt.event.ItemListener;\r
-import java.awt.event.KeyEvent;\r
-import java.awt.event.KeyListener;\r
-import java.awt.event.WindowAdapter;\r
-import java.awt.event.WindowEvent;\r
-import java.io.IOException;\r
-import java.io.InputStreamReader;\r
-import java.net.URL;\r
-import java.net.URLEncoder;\r
-import java.util.Enumeration;\r
-import java.util.Hashtable;\r
-import java.util.List;\r
-import java.util.StringTokenizer;\r
-import java.util.Vector;\r
-\r
-public class AlignFrame extends EmbmenuFrame implements ActionListener,\r
- ItemListener, KeyListener\r
-{\r
- public AlignmentPanel alignPanel;\r
-\r
- public AlignViewport viewport;\r
-\r
- int DEFAULT_WIDTH = 700;\r
-\r
- int DEFAULT_HEIGHT = 500;\r
-\r
- String jalviewServletURL;\r
-\r
- public AlignFrame(AlignmentI al, jalview.bin.JalviewLite applet,\r
- String title, boolean embedded)\r
- {\r
- if (applet != null)\r
- {\r
- jalviewServletURL = applet.getParameter("APPLICATION_URL");\r
- }\r
-\r
- try\r
- {\r
- jbInit();\r
- } catch (Exception ex)\r
- {\r
- ex.printStackTrace();\r
- }\r
-\r
- viewport = new AlignViewport(al, applet);\r
- alignPanel = new AlignmentPanel(this, viewport);\r
-\r
- viewport.updateConservation(alignPanel);\r
- viewport.updateConsensus(alignPanel);\r
-\r
- annotationPanelMenuItem.setState(viewport.showAnnotation);\r
- displayNonconservedMenuItem.setState(viewport.getShowUnconserved());\r
- followMouseOverFlag.setState(viewport.getFollowHighlight());\r
- showGroupConsensus.setState(viewport.isShowGroupConsensus());\r
- showGroupConservation.setState(viewport.isShowGroupConservation());\r
- showConsensusHistogram.setState(viewport.isShowConsensusHistogram());\r
- showSequenceLogo.setState(viewport.isShowSequenceLogo());\r
- normSequenceLogo.setState(viewport.isNormaliseSequenceLogo());\r
-\r
- seqLimits.setState(viewport.showJVSuffix);\r
-\r
- if (applet != null)\r
- {\r
- String param = applet.getParameter("sortBy");\r
- if (param != null)\r
- {\r
- if (param.equalsIgnoreCase("Id"))\r
- {\r
- sortIDMenuItem_actionPerformed();\r
- }\r
- else if (param.equalsIgnoreCase("Pairwise Identity"))\r
- {\r
- sortPairwiseMenuItem_actionPerformed();\r
- }\r
- else if (param.equalsIgnoreCase("Length"))\r
- {\r
- sortLengthMenuItem_actionPerformed();\r
- }\r
- }\r
-\r
- param = applet.getParameter("wrap");\r
- if (param != null)\r
- {\r
- if (param.equalsIgnoreCase("true"))\r
- {\r
- wrapMenuItem.setState(true);\r
- wrapMenuItem_actionPerformed();\r
- }\r
- }\r
- param = applet.getParameter("centrecolumnlabels");\r
- if (param != null)\r
- {\r
- centreColumnLabelFlag.setState(true);\r
- centreColumnLabelFlag_stateChanged();\r
- }\r
- try\r
- {\r
- param = applet.getParameter("windowWidth");\r
- if (param != null)\r
- {\r
- int width = Integer.parseInt(param);\r
- DEFAULT_WIDTH = width;\r
- }\r
- param = applet.getParameter("windowHeight");\r
- if (param != null)\r
- {\r
- int height = Integer.parseInt(param);\r
- DEFAULT_HEIGHT = height;\r
- }\r
- } catch (Exception ex)\r
- {\r
- }\r
-\r
- }\r
- if (viewport.getAlignment().isNucleotide())\r
- {\r
- viewport.updateStrucConsensus(alignPanel);\r
- if (viewport.getAlignment().hasRNAStructure())\r
- {\r
- RNAHelixColour.setEnabled(true);\r
- }\r
- else\r
- {\r
- RNAHelixColour.setEnabled(false);\r
- }\r
- }\r
- else\r
- {\r
- RNAHelixColour.setEnabled(false);\r
- purinePyrimidineColour.setEnabled(false);\r
- }\r
- // Some JVMS send keyevents to Top frame or lowest panel,\r
- // Havent worked out why yet. So add to both this frame and seqCanvas for\r
- // now\r
- this.addKeyListener(this);\r
- alignPanel.seqPanel.seqCanvas.addKeyListener(this);\r
- alignPanel.idPanel.idCanvas.addKeyListener(this);\r
- alignPanel.scalePanel.addKeyListener(this);\r
- alignPanel.annotationPanel.addKeyListener(this);\r
- alignPanel.annotationPanelHolder.addKeyListener(this);\r
- alignPanel.annotationSpaceFillerHolder.addKeyListener(this);\r
- alignPanel.alabels.addKeyListener(this);\r
- createAlignFrameWindow(embedded, title);\r
-\r
- validate();\r
- alignPanel.adjustAnnotationHeight();\r
- alignPanel.paintAlignment(true);\r
- }\r
-\r
- public AlignViewport getAlignViewport()\r
- {\r
- return viewport;\r
- }\r
-\r
- public SeqCanvas getSeqcanvas()\r
- {\r
- return alignPanel.seqPanel.seqCanvas;\r
- }\r
-\r
- /**\r
- * Load a features file onto the alignment\r
- * \r
- * @param file\r
- * file URL, content, or other resolvable path\r
- * @param type\r
- * is protocol for accessing data referred to by file\r
- */\r
-\r
- public boolean parseFeaturesFile(String file, String type)\r
- {\r
- return parseFeaturesFile(file, type, true);\r
- }\r
-\r
- /**\r
- * Load a features file onto the alignment\r
- * \r
- * @param file\r
- * file URL, content, or other resolvable path\r
- * @param type\r
- * is protocol for accessing data referred to by file\r
- * @param autoenabledisplay\r
- * when true, display features flag will be automatically enabled if\r
- * features are loaded\r
- * @return true if data parsed as a features file\r
- */\r
- public boolean parseFeaturesFile(String file, String type,\r
- boolean autoenabledisplay)\r
- {\r
- // TODO: test if importing a features file onto an alignment which already\r
- // has features with links overwrites the original links.\r
-\r
- Hashtable featureLinks = new Hashtable();\r
- boolean featuresFile = false;\r
- try\r
- {\r
- featuresFile = new jalview.io.FeaturesFile(file, type)\r
- .parse(viewport.getAlignment(), alignPanel.seqPanel.seqCanvas\r
- .getFeatureRenderer().featureColours, featureLinks,\r
- true, viewport.applet.getDefaultParameter(\r
- "relaxedidmatch", false));\r
- } catch (Exception ex)\r
- {\r
- ex.printStackTrace();\r
- }\r
-\r
- if (featuresFile)\r
- {\r
- if (featureLinks.size() > 0)\r
- {\r
- alignPanel.seqPanel.seqCanvas.getFeatureRenderer().featureLinks = featureLinks;\r
- }\r
- if (autoenabledisplay)\r
- {\r
- viewport.showSequenceFeatures = true;\r
- sequenceFeatures.setState(true);\r
- }\r
- if (viewport.featureSettings != null)\r
- {\r
- viewport.featureSettings.refreshTable();\r
- }\r
- alignPanel.paintAlignment(true);\r
- statusBar.setText("Successfully added features to alignment.");\r
- }\r
- return featuresFile;\r
- }\r
-\r
- @Override\r
- public void keyPressed(KeyEvent evt)\r
- {\r
- if (viewport.cursorMode\r
- && ((evt.getKeyCode() >= KeyEvent.VK_0 && evt.getKeyCode() <= KeyEvent.VK_9) || (evt\r
- .getKeyCode() >= KeyEvent.VK_NUMPAD0 && evt\r
- .getKeyCode() <= KeyEvent.VK_NUMPAD9))\r
- && Character.isDigit(evt.getKeyChar()))\r
- alignPanel.seqPanel.numberPressed(evt.getKeyChar());\r
-\r
- switch (evt.getKeyCode())\r
- {\r
- case 27: // escape key\r
- deselectAllSequenceMenuItem_actionPerformed();\r
-\r
- alignPanel.alabels.cancelDrag();\r
- break;\r
- case KeyEvent.VK_X:\r
- if (evt.isControlDown() || evt.isMetaDown())\r
- {\r
- cut_actionPerformed();\r
- }\r
- break;\r
- case KeyEvent.VK_C:\r
- if (viewport.cursorMode && !evt.isControlDown())\r
- {\r
- alignPanel.seqPanel.setCursorColumn();\r
- }\r
- if (evt.isControlDown() || evt.isMetaDown())\r
- {\r
- copy_actionPerformed();\r
- }\r
- break;\r
- case KeyEvent.VK_V:\r
- if (evt.isControlDown())\r
- {\r
- paste(evt.isShiftDown());\r
- }\r
- break;\r
- case KeyEvent.VK_A:\r
- if (evt.isControlDown() || evt.isMetaDown())\r
- {\r
- selectAllSequenceMenuItem_actionPerformed();\r
- }\r
- break;\r
- case KeyEvent.VK_DOWN:\r
- if (viewport.cursorMode)\r
- {\r
- alignPanel.seqPanel.moveCursor(0, 1);\r
- }\r
- else\r
- {\r
- moveSelectedSequences(false);\r
- }\r
- break;\r
-\r
- case KeyEvent.VK_UP:\r
- if (viewport.cursorMode)\r
- {\r
- alignPanel.seqPanel.moveCursor(0, -1);\r
- }\r
- else\r
- {\r
- moveSelectedSequences(true);\r
- }\r
- break;\r
-\r
- case KeyEvent.VK_LEFT:\r
- if (evt.isAltDown() || !viewport.cursorMode)\r
- slideSequences(false, alignPanel.seqPanel.getKeyboardNo1());\r
- else\r
- alignPanel.seqPanel.moveCursor(-1, 0);\r
- break;\r
-\r
- case KeyEvent.VK_RIGHT:\r
- if (evt.isAltDown() || !viewport.cursorMode)\r
- slideSequences(true, alignPanel.seqPanel.getKeyboardNo1());\r
- else\r
- alignPanel.seqPanel.moveCursor(1, 0);\r
- break;\r
-\r
- case KeyEvent.VK_SPACE:\r
- if (viewport.cursorMode)\r
- {\r
- alignPanel.seqPanel.insertGapAtCursor(evt.isControlDown()\r
- || evt.isShiftDown() || evt.isAltDown());\r
- }\r
- break;\r
-\r
- case KeyEvent.VK_DELETE:\r
- case KeyEvent.VK_BACK_SPACE:\r
- if (viewport.cursorMode)\r
- {\r
- alignPanel.seqPanel.deleteGapAtCursor(evt.isControlDown()\r
- || evt.isShiftDown() || evt.isAltDown());\r
- }\r
- else\r
- {\r
- cut_actionPerformed();\r
- alignPanel.seqPanel.seqCanvas.repaint();\r
- }\r
- break;\r
-\r
- case KeyEvent.VK_S:\r
- if (viewport.cursorMode)\r
- {\r
- alignPanel.seqPanel.setCursorRow();\r
- }\r
- break;\r
- case KeyEvent.VK_P:\r
- if (viewport.cursorMode)\r
- {\r
- alignPanel.seqPanel.setCursorPosition();\r
- }\r
- break;\r
-\r
- case KeyEvent.VK_ENTER:\r
- case KeyEvent.VK_COMMA:\r
- if (viewport.cursorMode)\r
- {\r
- alignPanel.seqPanel.setCursorRowAndColumn();\r
- }\r
- break;\r
-\r
- case KeyEvent.VK_Q:\r
- if (viewport.cursorMode)\r
- {\r
- alignPanel.seqPanel.setSelectionAreaAtCursor(true);\r
- }\r
- break;\r
- case KeyEvent.VK_M:\r
- if (viewport.cursorMode)\r
- {\r
- alignPanel.seqPanel.setSelectionAreaAtCursor(false);\r
- }\r
- break;\r
-\r
- case KeyEvent.VK_F2:\r
- viewport.cursorMode = !viewport.cursorMode;\r
- statusBar.setText("Keyboard editing mode is "\r
- + (viewport.cursorMode ? "on" : "off"));\r
- if (viewport.cursorMode)\r
- {\r
- alignPanel.seqPanel.seqCanvas.cursorX = viewport.startRes;\r
- alignPanel.seqPanel.seqCanvas.cursorY = viewport.startSeq;\r
- }\r
- break;\r
-\r
- case KeyEvent.VK_F:\r
- if (evt.isControlDown())\r
- {\r
- findMenuItem_actionPerformed();\r
- }\r
- break;\r
-\r
- case KeyEvent.VK_H:\r
- {\r
- boolean toggleSeqs = !evt.isControlDown();\r
- boolean toggleCols = !evt.isShiftDown();\r
- toggleHiddenRegions(toggleSeqs, toggleCols);\r
- break;\r
- }\r
-\r
- case KeyEvent.VK_PAGE_UP:\r
- if (viewport.wrapAlignment)\r
- {\r
- alignPanel.scrollUp(true);\r
- }\r
- else\r
- {\r
- alignPanel.setScrollValues(viewport.startRes, viewport.startSeq\r
- - viewport.endSeq + viewport.startSeq);\r
- }\r
- break;\r
-\r
- case KeyEvent.VK_PAGE_DOWN:\r
- if (viewport.wrapAlignment)\r
- {\r
- alignPanel.scrollUp(false);\r
- }\r
- else\r
- {\r
- alignPanel.setScrollValues(viewport.startRes, viewport.startSeq\r
- + viewport.endSeq - viewport.startSeq);\r
- }\r
- break;\r
-\r
- case KeyEvent.VK_Z:\r
- if (evt.isControlDown())\r
- {\r
- undoMenuItem_actionPerformed();\r
- }\r
- break;\r
-\r
- case KeyEvent.VK_Y:\r
- if (evt.isControlDown())\r
- {\r
- redoMenuItem_actionPerformed();\r
- }\r
- break;\r
-\r
- case KeyEvent.VK_L:\r
- if (evt.isControlDown())\r
- {\r
- trimAlignment(true);\r
- }\r
- break;\r
-\r
- case KeyEvent.VK_R:\r
- if (evt.isControlDown())\r
- {\r
- trimAlignment(false);\r
- }\r
- break;\r
-\r
- case KeyEvent.VK_E:\r
- if (evt.isControlDown())\r
- {\r
- if (evt.isShiftDown())\r
- {\r
- this.removeAllGapsMenuItem_actionPerformed();\r
- }\r
- else\r
- {\r
- removeGappedColumnMenuItem_actionPerformed();\r
- }\r
- }\r
- break;\r
- case KeyEvent.VK_I:\r
- if (evt.isControlDown())\r
- {\r
- if (evt.isAltDown())\r
- {\r
- invertColSel_actionPerformed();\r
- }\r
- else\r
- {\r
- invertSequenceMenuItem_actionPerformed();\r
- }\r
- }\r
- break;\r
-\r
- case KeyEvent.VK_U:\r
- if (evt.isControlDown())\r
- {\r
- this.deleteGroups_actionPerformed();\r
- }\r
- break;\r
-\r
- case KeyEvent.VK_T:\r
- if (evt.isControlDown())\r
- {\r
- newView(null);\r
- }\r
- break;\r
-\r
- }\r
- alignPanel.paintAlignment(true);\r
- }\r
-\r
- /**\r
- * called by key handler and the hide all/show all menu items\r
- * \r
- * @param toggleSeqs\r
- * @param toggleCols\r
- */\r
- private void toggleHiddenRegions(boolean toggleSeqs, boolean toggleCols)\r
- {\r
- boolean hide = false;\r
- SequenceGroup sg = viewport.getSelectionGroup();\r
- if (!toggleSeqs && !toggleCols)\r
- {\r
- // Hide everything by the current selection - this is a hack - we do the\r
- // invert and then hide\r
- // first check that there will be visible columns after the invert.\r
- if ((viewport.getColumnSelection() != null\r
- && viewport.getColumnSelection().getSelected() != null && viewport\r
- .getColumnSelection().getSelected().size() > 0)\r
- || (sg != null && sg.getSize() > 0 && sg.getStartRes() <= sg\r
- .getEndRes()))\r
- {\r
- // now invert the sequence set, if required - empty selection implies\r
- // that no hiding is required.\r
- if (sg != null)\r
- {\r
- invertSequenceMenuItem_actionPerformed();\r
- sg = viewport.getSelectionGroup();\r
- toggleSeqs = true;\r
-\r
- }\r
- viewport.expandColSelection(sg, true);\r
- // finally invert the column selection and get the new sequence\r
- // selection and indicate it should be hidden.\r
- invertColSel_actionPerformed();\r
- toggleCols = true;\r
- }\r
- }\r
-\r
- if (toggleSeqs)\r
- {\r
- if (sg != null && sg.getSize() != viewport.getAlignment().getHeight())\r
- {\r
- hide = true;\r
- viewport.hideAllSelectedSeqs();\r
- }\r
- else if (!(toggleCols && viewport.getColumnSelection().getSelected()\r
- .size() > 0))\r
- {\r
- viewport.showAllHiddenSeqs();\r
- }\r
- }\r
-\r
- if (toggleCols)\r
- {\r
- if (viewport.getColumnSelection().getSelected().size() > 0)\r
- {\r
- viewport.hideSelectedColumns();\r
- if (!toggleSeqs)\r
- {\r
- viewport.setSelectionGroup(sg);\r
- }\r
- }\r
- else if (!hide)\r
- {\r
- viewport.showAllHiddenColumns();\r
- }\r
- }\r
- }\r
-\r
- @Override\r
- public void keyReleased(KeyEvent evt)\r
- {\r
- }\r
-\r
- @Override\r
- public void keyTyped(KeyEvent evt)\r
- {\r
- }\r
-\r
- @Override\r
- public void itemStateChanged(ItemEvent evt)\r
- {\r
- if (evt.getSource() == displayNonconservedMenuItem)\r
- {\r
- displayNonconservedMenuItem_actionPerformed();\r
- }\r
- else if (evt.getSource() == colourTextMenuItem)\r
- {\r
- colourTextMenuItem_actionPerformed();\r
- }\r
- else if (evt.getSource() == wrapMenuItem)\r
- {\r
- wrapMenuItem_actionPerformed();\r
- }\r
- else if (evt.getSource() == scaleAbove)\r
- {\r
- viewport.setScaleAboveWrapped(scaleAbove.getState());\r
- }\r
- else if (evt.getSource() == scaleLeft)\r
- {\r
- viewport.setScaleLeftWrapped(scaleLeft.getState());\r
- }\r
- else if (evt.getSource() == scaleRight)\r
- {\r
- viewport.setScaleRightWrapped(scaleRight.getState());\r
- }\r
- else if (evt.getSource() == seqLimits)\r
- {\r
- seqLimits_itemStateChanged();\r
- }\r
- else if (evt.getSource() == viewBoxesMenuItem)\r
- {\r
- viewport.setShowBoxes(viewBoxesMenuItem.getState());\r
- }\r
- else if (evt.getSource() == viewTextMenuItem)\r
- {\r
- viewport.setShowText(viewTextMenuItem.getState());\r
- }\r
- else if (evt.getSource() == renderGapsMenuItem)\r
- {\r
- viewport.setRenderGaps(renderGapsMenuItem.getState());\r
- }\r
- else if (evt.getSource() == annotationPanelMenuItem)\r
- {\r
- viewport.setShowAnnotation(annotationPanelMenuItem.getState());\r
- alignPanel.setAnnotationVisible(annotationPanelMenuItem.getState());\r
- }\r
- else if (evt.getSource() == sequenceFeatures)\r
- {\r
- viewport.showSequenceFeatures(sequenceFeatures.getState());\r
- alignPanel.seqPanel.seqCanvas.repaint();\r
- }\r
- else if (evt.getSource() == conservationMenuItem)\r
- {\r
- conservationMenuItem_actionPerformed();\r
- }\r
- else if (evt.getSource() == abovePIDThreshold)\r
- {\r
- abovePIDThreshold_actionPerformed();\r
- }\r
- else if (evt.getSource() == applyToAllGroups)\r
- {\r
- viewport.setColourAppliesToAllGroups(applyToAllGroups.getState());\r
- }\r
- else if (evt.getSource() == autoCalculate)\r
- {\r
- viewport.autoCalculateConsensus = autoCalculate.getState();\r
- }\r
- else if (evt.getSource() == sortByTree)\r
- {\r
- viewport.sortByTree = sortByTree.getState();\r
- }\r
- else if (evt.getSource() == this.centreColumnLabelFlag)\r
- {\r
- centreColumnLabelFlag_stateChanged();\r
- }\r
- else if (evt.getSource() == this.followMouseOverFlag)\r
- {\r
- mouseOverFlag_stateChanged();\r
- }\r
- else if (evt.getSource() == showGroupConsensus)\r
- {\r
- showGroupConsensus_actionPerformed();\r
- }\r
- else if (evt.getSource() == showGroupConservation)\r
- {\r
- showGroupConservation_actionPerformed();\r
- }\r
- else if (evt.getSource() == showSequenceLogo)\r
- {\r
- showSequenceLogo_actionPerformed();\r
- }\r
- else if (evt.getSource() == normSequenceLogo)\r
- {\r
- normSequenceLogo_actionPerformed();\r
- }\r
- else if (evt.getSource() == showConsensusHistogram)\r
- {\r
- showConsensusHistogram_actionPerformed();\r
- }\r
- else if (evt.getSource() == applyAutoAnnotationSettings)\r
- {\r
- applyAutoAnnotationSettings_actionPerformed();\r
- }\r
- alignPanel.paintAlignment(true);\r
- }\r
-\r
- private void mouseOverFlag_stateChanged()\r
- {\r
- viewport.followHighlight = followMouseOverFlag.getState();\r
- // TODO: could kick the scrollTo mechanism to reset view for current\r
- // searchresults.\r
- }\r
-\r
- private void centreColumnLabelFlag_stateChanged()\r
- {\r
- viewport.centreColumnLabels = centreColumnLabelFlag.getState();\r
- this.alignPanel.annotationPanel.repaint();\r
- }\r
-\r
- @Override\r
- public void actionPerformed(ActionEvent evt)\r
- {\r
- Object source = evt.getSource();\r
-\r
- if (source == inputText)\r
- {\r
- inputText_actionPerformed();\r
- }\r
- else if (source == loadTree)\r
- {\r
- loadTree_actionPerformed();\r
- }\r
- else if (source == loadApplication)\r
- {\r
- launchFullApplication();\r
- }\r
- else if (source == loadAnnotations)\r
- {\r
- loadAnnotations();\r
- }\r
- else if (source == outputAnnotations)\r
- {\r
- outputAnnotations(true);\r
- }\r
- else if (source == outputFeatures)\r
- {\r
- outputFeatures(true, "Jalview");\r
- }\r
- else if (source == closeMenuItem)\r
- {\r
- closeMenuItem_actionPerformed();\r
- }\r
- else if (source == copy)\r
- {\r
- copy_actionPerformed();\r
- }\r
- else if (source == undoMenuItem)\r
- {\r
- undoMenuItem_actionPerformed();\r
- }\r
- else if (source == redoMenuItem)\r
- {\r
- redoMenuItem_actionPerformed();\r
- }\r
- else if (source == inputText)\r
- {\r
- inputText_actionPerformed();\r
- }\r
- else if (source == closeMenuItem)\r
- {\r
- closeMenuItem_actionPerformed();\r
- }\r
- else if (source == undoMenuItem)\r
- {\r
- undoMenuItem_actionPerformed();\r
- }\r
- else if (source == redoMenuItem)\r
- {\r
- redoMenuItem_actionPerformed();\r
- }\r
- else if (source == copy)\r
- {\r
- copy_actionPerformed();\r
- }\r
- else if (source == pasteNew)\r
- {\r
- pasteNew_actionPerformed();\r
- }\r
- else if (source == pasteThis)\r
- {\r
- pasteThis_actionPerformed();\r
- }\r
- else if (source == cut)\r
- {\r
- cut_actionPerformed();\r
- }\r
- else if (source == delete)\r
- {\r
- delete_actionPerformed();\r
- }\r
- else if (source == grpsFromSelection)\r
- {\r
- makeGrpsFromSelection_actionPerformed();\r
- }\r
- else if (source == deleteGroups)\r
- {\r
- deleteGroups_actionPerformed();\r
- }\r
- else if (source == selectAllSequenceMenuItem)\r
- {\r
- selectAllSequenceMenuItem_actionPerformed();\r
- }\r
- else if (source == deselectAllSequenceMenuItem)\r
- {\r
- deselectAllSequenceMenuItem_actionPerformed();\r
- }\r
- else if (source == invertSequenceMenuItem)\r
- {\r
- invertSequenceMenuItem_actionPerformed();\r
- }\r
- else if (source == invertColSel)\r
- {\r
- viewport.invertColumnSelection();\r
- alignPanel.paintAlignment(true);\r
- }\r
- else if (source == remove2LeftMenuItem)\r
- {\r
- trimAlignment(true);\r
- }\r
- else if (source == remove2RightMenuItem)\r
- {\r
- trimAlignment(false);\r
- }\r
- else if (source == removeGappedColumnMenuItem)\r
- {\r
- removeGappedColumnMenuItem_actionPerformed();\r
- }\r
- else if (source == removeAllGapsMenuItem)\r
- {\r
- removeAllGapsMenuItem_actionPerformed();\r
- }\r
- else if (source == findMenuItem)\r
- {\r
- findMenuItem_actionPerformed();\r
- }\r
- else if (source == font)\r
- {\r
- new FontChooser(alignPanel);\r
- }\r
- else if (source == newView)\r
- {\r
- newView(null);\r
- }\r
- else if (source == showColumns)\r
- {\r
- viewport.showAllHiddenColumns();\r
- alignPanel.paintAlignment(true);\r
- }\r
- else if (source == showSeqs)\r
- {\r
- viewport.showAllHiddenSeqs();\r
- alignPanel.paintAlignment(true);\r
- }\r
- else if (source == hideColumns)\r
- {\r
- viewport.hideSelectedColumns();\r
- alignPanel.paintAlignment(true);\r
- }\r
- else if (source == hideSequences\r
- && viewport.getSelectionGroup() != null)\r
- {\r
- viewport.hideAllSelectedSeqs();\r
- alignPanel.paintAlignment(true);\r
- }\r
- else if (source == hideAllButSelection)\r
- {\r
- toggleHiddenRegions(false, false);\r
- alignPanel.paintAlignment(true);\r
- }\r
- else if (source == hideAllSelection)\r
- {\r
- SequenceGroup sg = viewport.getSelectionGroup();\r
- viewport.expandColSelection(sg, false);\r
- viewport.hideAllSelectedSeqs();\r
- viewport.hideSelectedColumns();\r
- alignPanel.paintAlignment(true);\r
- }\r
- else if (source == showAllHidden)\r
- {\r
- viewport.showAllHiddenColumns();\r
- viewport.showAllHiddenSeqs();\r
- alignPanel.paintAlignment(true);\r
- }\r
- else if (source == showGroupConsensus)\r
- {\r
- showGroupConsensus_actionPerformed();\r
- }\r
- else if (source == showGroupConservation)\r
- {\r
- showGroupConservation_actionPerformed();\r
- }\r
- else if (source == showSequenceLogo)\r
- {\r
- showSequenceLogo_actionPerformed();\r
- }\r
- else if (source == normSequenceLogo)\r
- {\r
- normSequenceLogo_actionPerformed();\r
- }\r
- else if (source == showConsensusHistogram)\r
- {\r
- showConsensusHistogram_actionPerformed();\r
- }\r
- else if (source == applyAutoAnnotationSettings)\r
- {\r
- applyAutoAnnotationSettings_actionPerformed();\r
- }\r
- else if (source == featureSettings)\r
- {\r
- new FeatureSettings(alignPanel);\r
- }\r
- else if (source == alProperties)\r
- {\r
- StringBuffer contents = new jalview.io.AlignmentProperties(\r
- viewport.getAlignment()).formatAsString();\r
- CutAndPasteTransfer cap = new CutAndPasteTransfer(false, this);\r
- cap.setText(contents.toString());\r
- Frame frame = new Frame();\r
- frame.add(cap);\r
- jalview.bin.JalviewLite.addFrame(frame, "Alignment Properties: "\r
- + getTitle(), 400, 250);\r
- }\r
- else if (source == overviewMenuItem)\r
- {\r
- overviewMenuItem_actionPerformed();\r
- }\r
- else if (source == noColourmenuItem)\r
- {\r
- changeColour(null);\r
- }\r
- else if (source == clustalColour)\r
- {\r
- abovePIDThreshold.setState(false);\r
- changeColour(new ClustalxColourScheme(viewport.getAlignment(), null));\r
- }\r
- else if (source == zappoColour)\r
- {\r
- changeColour(new ZappoColourScheme());\r
- }\r
- else if (source == taylorColour)\r
- {\r
- changeColour(new TaylorColourScheme());\r
- }\r
- else if (source == hydrophobicityColour)\r
- {\r
- changeColour(new HydrophobicColourScheme());\r
- }\r
- else if (source == helixColour)\r
- {\r
- changeColour(new HelixColourScheme());\r
- }\r
- else if (source == strandColour)\r
- {\r
- changeColour(new StrandColourScheme());\r
- }\r
- else if (source == turnColour)\r
- {\r
- changeColour(new TurnColourScheme());\r
- }\r
- else if (source == buriedColour)\r
- {\r
- changeColour(new BuriedColourScheme());\r
- }\r
- else if (source == nucleotideColour)\r
- {\r
- changeColour(new NucleotideColourScheme());\r
- }\r
- else if (source == purinePyrimidineColour)\r
- {\r
- changeColour(new PurinePyrimidineColourScheme());\r
- }\r
- else if (source == RNAHelixColour)\r
- {\r
- new RNAHelicesColourChooser(viewport, alignPanel);\r
- }\r
- else if (source == modifyPID)\r
- {\r
- modifyPID_actionPerformed();\r
- }\r
- else if (source == modifyConservation)\r
- {\r
- modifyConservation_actionPerformed();\r
- }\r
- else if (source == userDefinedColour)\r
- {\r
- new UserDefinedColours(alignPanel, null);\r
- }\r
- else if (source == PIDColour)\r
- {\r
- changeColour(new PIDColourScheme());\r
- }\r
- else if (source == BLOSUM62Colour)\r
- {\r
- changeColour(new Blosum62ColourScheme());\r
- }\r
- else if (source == tcoffeeColour)\r
- {\r
- changeColour(new TCoffeeColourScheme(alignPanel.getAlignment()));\r
- }\r
- else if (source == annotationColour)\r
- {\r
- new AnnotationColourChooser(viewport, alignPanel);\r
- }\r
- else if (source == sortPairwiseMenuItem)\r
- {\r
- sortPairwiseMenuItem_actionPerformed();\r
- }\r
- else if (source == sortIDMenuItem)\r
- {\r
- sortIDMenuItem_actionPerformed();\r
- }\r
- else if (source == sortLengthMenuItem)\r
- {\r
- sortLengthMenuItem_actionPerformed();\r
- }\r
- else if (source == sortGroupMenuItem)\r
- {\r
- sortGroupMenuItem_actionPerformed();\r
- }\r
- else if (source == removeRedundancyMenuItem)\r
- {\r
- removeRedundancyMenuItem_actionPerformed();\r
- }\r
- else if (source == pairwiseAlignmentMenuItem)\r
- {\r
- pairwiseAlignmentMenuItem_actionPerformed();\r
- }\r
- else if (source == PCAMenuItem)\r
- {\r
- PCAMenuItem_actionPerformed();\r
- }\r
- else if (source == averageDistanceTreeMenuItem)\r
- {\r
- averageDistanceTreeMenuItem_actionPerformed();\r
- }\r
- else if (source == neighbourTreeMenuItem)\r
- {\r
- neighbourTreeMenuItem_actionPerformed();\r
- }\r
- else if (source == njTreeBlosumMenuItem)\r
- {\r
- njTreeBlosumMenuItem_actionPerformed();\r
- }\r
- else if (source == avDistanceTreeBlosumMenuItem)\r
- {\r
- avTreeBlosumMenuItem_actionPerformed();\r
- }\r
- else if (source == documentation)\r
- {\r
- documentation_actionPerformed();\r
- }\r
- else if (source == about)\r
- {\r
- about_actionPerformed();\r
- }\r
-\r
- }\r
-\r
- public void inputText_actionPerformed()\r
- {\r
- CutAndPasteTransfer cap = new CutAndPasteTransfer(true, this);\r
- Frame frame = new Frame();\r
- frame.add(cap);\r
- jalview.bin.JalviewLite.addFrame(frame, "Cut & Paste Input", 500, 500);\r
- }\r
-\r
- protected void outputText_actionPerformed(ActionEvent e)\r
- {\r
- CutAndPasteTransfer cap = new CutAndPasteTransfer(true, this);\r
- Frame frame = new Frame();\r
- frame.add(cap);\r
- jalview.bin.JalviewLite.addFrame(frame,\r
- "Alignment output - " + e.getActionCommand(), 600, 500);\r
- cap.setText(new AppletFormatAdapter().formatSequences(\r
- e.getActionCommand(), viewport.getAlignment(),\r
- viewport.showJVSuffix));\r
- }\r
-\r
- public void loadAnnotations()\r
- {\r
- CutAndPasteTransfer cap = new CutAndPasteTransfer(true, this);\r
- cap.setText("Paste your features / annotations / T-coffee score file here.");\r
- cap.setAnnotationImport();\r
- Frame frame = new Frame();\r
- frame.add(cap);\r
- jalview.bin.JalviewLite.addFrame(frame, "Paste Annotations ", 400, 300);\r
-\r
- }\r
-\r
- public String outputAnnotations(boolean displayTextbox)\r
- {\r
- String annotation = new AnnotationFile().printAnnotations(\r
- viewport.showAnnotation ? viewport.getAlignment()\r
- .getAlignmentAnnotation() : null, viewport\r
- .getAlignment().getGroups(), ((Alignment) viewport\r
- .getAlignment()).alignmentProperties);\r
-\r
- if (displayTextbox)\r
- {\r
- CutAndPasteTransfer cap = new CutAndPasteTransfer(false, this);\r
- Frame frame = new Frame();\r
- frame.add(cap);\r
- jalview.bin.JalviewLite.addFrame(frame, "Annotations", 600, 500);\r
- cap.setText(annotation);\r
- }\r
-\r
- return annotation;\r
- }\r
-\r
- private Hashtable getDisplayedFeatureCols()\r
- {\r
- if (alignPanel.getFeatureRenderer() != null\r
- && viewport.featuresDisplayed != null)\r
- {\r
- FeatureRenderer fr = alignPanel.getFeatureRenderer();\r
- Hashtable fcols = new Hashtable();\r
- Enumeration en = viewport.featuresDisplayed.keys();\r
- while (en.hasMoreElements())\r
- {\r
- Object col = en.nextElement();\r
- fcols.put(col, fr.featureColours.get(col));\r
- }\r
- return fcols;\r
- }\r
- return null;\r
- }\r
-\r
- public String outputFeatures(boolean displayTextbox, String format)\r
- {\r
- String features;\r
- if (format.equalsIgnoreCase("Jalview"))\r
- {\r
- features = new FeaturesFile().printJalviewFormat(viewport\r
- .getAlignment().getSequencesArray(),\r
- getDisplayedFeatureCols());\r
- }\r
- else\r
- {\r
- features = new FeaturesFile().printGFFFormat(viewport.getAlignment()\r
- .getSequencesArray(), getDisplayedFeatureCols());\r
- }\r
-\r
- if (displayTextbox)\r
- {\r
- boolean frimport = false;\r
- if (features == null || features.equals("No Features Visible"))\r
- {\r
- features = "# No features visible - paste some and import them here.";\r
- frimport = true;\r
- }\r
-\r
- CutAndPasteTransfer cap = new CutAndPasteTransfer(frimport, this);\r
- if (frimport)\r
- {\r
- cap.setAnnotationImport();\r
- }\r
- Frame frame = new Frame();\r
- frame.add(cap);\r
- jalview.bin.JalviewLite.addFrame(frame, "Features", 600, 500);\r
- cap.setText(features);\r
- }\r
- else\r
- {\r
- if (features == null)\r
- features = "";\r
- }\r
-\r
- return features;\r
- }\r
-\r
- void launchFullApplication()\r
- {\r
- StringBuffer url = new StringBuffer(jalviewServletURL);\r
-\r
- url.append("?open="\r
- + appendProtocol(viewport.applet.getParameter("file")));\r
-\r
- if (viewport.applet.getParameter("features") != null)\r
- {\r
- url.append("&features=");\r
- url.append(appendProtocol(viewport.applet.getParameter("features")));\r
- }\r
-\r
- if (viewport.applet.getParameter("annotations") != null)\r
- {\r
- url.append("&annotations=");\r
- url.append(appendProtocol(viewport.applet.getParameter("annotations")));\r
- }\r
-\r
- if (viewport.applet.getParameter("jnetfile") != null)\r
- {\r
- url.append("&annotations=");\r
- url.append(appendProtocol(viewport.applet.getParameter("jnetfile")));\r
- }\r
-\r
- if (viewport.applet.getParameter("defaultColour") != null)\r
- {\r
- url.append("&colour="\r
- + removeWhiteSpace(viewport.applet\r
- .getParameter("defaultColour")));\r
- }\r
-\r
- if (viewport.applet.getParameter("userDefinedColour") != null)\r
- {\r
- url.append("&colour="\r
- + removeWhiteSpace(viewport.applet\r
- .getParameter("userDefinedColour")));\r
- }\r
- if (viewport.applet.getParameter("tree") != null)\r
- {\r
- url.append("&tree="\r
- + appendProtocol(viewport.applet.getParameter("tree")));\r
- }\r
- if (viewport.applet.getParameter("treeFile") != null)\r
- {\r
- url.append("&tree="\r
- + appendProtocol(viewport.applet.getParameter("treeFile")));\r
- }\r
-\r
- showURL(url.toString(), "FULL_APP");\r
- }\r
-\r
- String removeWhiteSpace(String colour)\r
- {\r
- StringBuffer sb = new StringBuffer();\r
- for (int i = 0; i < colour.length(); i++)\r
- {\r
- if (Character.isWhitespace(colour.charAt(i)))\r
- {\r
- sb.append("%20");\r
- }\r
- else\r
- {\r
- sb.append(colour.charAt(i));\r
- }\r
- }\r
-\r
- return sb.toString();\r
- }\r
-\r
- String appendProtocol(String url)\r
- {\r
- try\r
- {\r
- new URL(url);\r
- url = URLEncoder.encode(url);\r
- }\r
- /*\r
- * When we finally deprecate 1.1 compatibility, we can start to use\r
- * URLEncoder.encode(url,"UTF-8") and then we'll need this catch: catch\r
- * (UnsupportedEncodingException ex) { System.err.println("WARNING -\r
- * IMPLEMENTATION ERROR - UNSUPPORTED ENCODING EXCEPTION FOR "+url);\r
- * ex.printStackTrace(); }\r
- */\r
- catch (java.net.MalformedURLException ex)\r
- {\r
- url = viewport.applet.getCodeBase() + url;\r
- }\r
- return url;\r
- }\r
-\r
- public void closeMenuItem_actionPerformed()\r
- {\r
- PaintRefresher.RemoveComponent(alignPanel);\r
- if (alignPanel.seqPanel != null\r
- && alignPanel.seqPanel.seqCanvas != null)\r
- {\r
- PaintRefresher.RemoveComponent(alignPanel.seqPanel.seqCanvas);\r
- }\r
- if (alignPanel.idPanel != null && alignPanel.idPanel.idCanvas != null)\r
- {\r
- PaintRefresher.RemoveComponent(alignPanel.idPanel.idCanvas);\r
- }\r
-\r
- if (PaintRefresher.components.size() == 0 && viewport.applet == null)\r
- {\r
- System.exit(0);\r
- }\r
- else\r
- {\r
- }\r
- viewport = null;\r
- alignPanel = null;\r
- this.dispose();\r
- }\r
-\r
- /**\r
- * TODO: JAL-1104\r
- */\r
- void updateEditMenuBar()\r
- {\r
-\r
- if (viewport.historyList.size() > 0)\r
- {\r
- undoMenuItem.setEnabled(true);\r
- CommandI command = (CommandI) viewport.historyList.peek();\r
- undoMenuItem.setLabel("Undo " + command.getDescription());\r
- }\r
- else\r
- {\r
- undoMenuItem.setEnabled(false);\r
- undoMenuItem.setLabel("Undo");\r
- }\r
-\r
- if (viewport.redoList.size() > 0)\r
- {\r
- redoMenuItem.setEnabled(true);\r
-\r
- CommandI command = (CommandI) viewport.redoList.peek();\r
- redoMenuItem.setLabel("Redo " + command.getDescription());\r
- }\r
- else\r
- {\r
- redoMenuItem.setEnabled(false);\r
- redoMenuItem.setLabel("Redo");\r
- }\r
- }\r
-\r
- /**\r
- * TODO: JAL-1104\r
- */\r
- public void addHistoryItem(CommandI command)\r
- {\r
- if (command.getSize() > 0)\r
- {\r
- viewport.historyList.push(command);\r
- viewport.redoList.removeAllElements();\r
- updateEditMenuBar();\r
- viewport.updateHiddenColumns();\r
- }\r
- }\r
-\r
- /**\r
- * TODO: JAL-1104 DOCUMENT ME!\r
- * \r
- * @param e\r
- * DOCUMENT ME!\r
- */\r
- protected void undoMenuItem_actionPerformed()\r
- {\r
- if (viewport.historyList.size() < 1)\r
- {\r
- return;\r
- }\r
-\r
- CommandI command = (CommandI) viewport.historyList.pop();\r
- viewport.redoList.push(command);\r
- command.undoCommand(null);\r
-\r
- AlignViewport originalSource = getOriginatingSource(command);\r
- // JBPNote Test\r
- if (originalSource != viewport)\r
- {\r
- System.err\r
- .println("Warning: Viewport object mismatch whilst undoing");\r
- }\r
- originalSource.updateHiddenColumns(); // originalSource.hasHiddenColumns =\r
- // viewport.getColumnSelection().getHiddenColumns()\r
- // != null;\r
- updateEditMenuBar();\r
- originalSource.firePropertyChange("alignment", null, originalSource\r
- .getAlignment().getSequences());\r
- }\r
-\r
- /**\r
- * TODO: JAL-1104 DOCUMENT ME!\r
- * \r
- * @param e\r
- * DOCUMENT ME!\r
- */\r
- protected void redoMenuItem_actionPerformed()\r
- {\r
- if (viewport.redoList.size() < 1)\r
- {\r
- return;\r
- }\r
-\r
- CommandI command = (CommandI) viewport.redoList.pop();\r
- viewport.historyList.push(command);\r
- command.doCommand(null);\r
-\r
- AlignViewport originalSource = getOriginatingSource(command);\r
- // JBPNote Test\r
- if (originalSource != viewport)\r
- {\r
- System.err\r
- .println("Warning: Viewport object mismatch whilst re-doing");\r
- }\r
- originalSource.updateHiddenColumns(); // sethasHiddenColumns(); =\r
- // viewport.getColumnSelection().getHiddenColumns()\r
- // != null;\r
-\r
- updateEditMenuBar();\r
- originalSource.firePropertyChange("alignment", null, originalSource\r
- .getAlignment().getSequences());\r
- }\r
-\r
- AlignViewport getOriginatingSource(CommandI command)\r
- {\r
- AlignViewport originalSource = null;\r
- // For sequence removal and addition, we need to fire\r
- // the property change event FROM the viewport where the\r
- // original alignment was altered\r
- AlignmentI al = null;\r
- if (command instanceof EditCommand)\r
- {\r
- EditCommand editCommand = (EditCommand) command;\r
- al = editCommand.getAlignment();\r
- Vector comps = (Vector) PaintRefresher.components.get(viewport\r
- .getSequenceSetId());\r
- for (int i = 0; i < comps.size(); i++)\r
- {\r
- if (comps.elementAt(i) instanceof AlignmentPanel)\r
- {\r
- if (al == ((AlignmentPanel) comps.elementAt(i)).av.getAlignment())\r
- {\r
- originalSource = ((AlignmentPanel) comps.elementAt(i)).av;\r
- break;\r
- }\r
- }\r
- }\r
- }\r
-\r
- if (originalSource == null)\r
- {\r
- // The original view is closed, we must validate\r
- // the current view against the closed view first\r
- if (al != null)\r
- {\r
- PaintRefresher.validateSequences(al, viewport.getAlignment());\r
- }\r
-\r
- originalSource = viewport;\r
- }\r
-\r
- return originalSource;\r
- }\r
-\r
- public void moveSelectedSequences(boolean up)\r
- {\r
- SequenceGroup sg = viewport.getSelectionGroup();\r
- if (sg == null)\r
- {\r
- return;\r
- }\r
- viewport.getAlignment().moveSelectedSequencesByOne(sg,\r
- up ? null : viewport.getHiddenRepSequences(), up);\r
- alignPanel.paintAlignment(true);\r
- }\r
-\r
- synchronized void slideSequences(boolean right, int size)\r
- {\r
- List<SequenceI> sg = new Vector<SequenceI>();\r
- if (viewport.cursorMode)\r
- {\r
- sg.add(viewport.getAlignment().getSequenceAt(\r
- alignPanel.seqPanel.seqCanvas.cursorY));\r
- }\r
- else if (viewport.getSelectionGroup() != null\r
- && viewport.getSelectionGroup().getSize() != viewport\r
- .getAlignment().getHeight())\r
- {\r
- sg = viewport.getSelectionGroup().getSequences(\r
- viewport.getHiddenRepSequences());\r
- }\r
-\r
- if (sg.size() < 1)\r
- {\r
- return;\r
- }\r
-\r
- Vector<SequenceI> invertGroup = new Vector();\r
-\r
- for (int i = 0; i < viewport.getAlignment().getHeight(); i++)\r
- {\r
- if (!sg.contains(viewport.getAlignment().getSequenceAt(i)))\r
- invertGroup.addElement(viewport.getAlignment().getSequenceAt(i));\r
- }\r
-\r
- SequenceI[] seqs1 = sg.toArray(new SequenceI[sg.size()]);\r
-\r
- SequenceI[] seqs2 = invertGroup.toArray(new SequenceI[invertGroup\r
- .size()]);\r
- for (int i = 0; i < invertGroup.size(); i++)\r
- seqs2[i] = invertGroup.elementAt(i);\r
-\r
- SlideSequencesCommand ssc;\r
- if (right)\r
- ssc = new SlideSequencesCommand("Slide Sequences", seqs2, seqs1,\r
- size, viewport.getGapCharacter());\r
- else\r
- ssc = new SlideSequencesCommand("Slide Sequences", seqs1, seqs2,\r
- size, viewport.getGapCharacter());\r
-\r
- int groupAdjustment = 0;\r
- if (ssc.getGapsInsertedBegin() && right)\r
- {\r
- if (viewport.cursorMode)\r
- alignPanel.seqPanel.moveCursor(size, 0);\r
- else\r
- groupAdjustment = size;\r
- }\r
- else if (!ssc.getGapsInsertedBegin() && !right)\r
- {\r
- if (viewport.cursorMode)\r
- alignPanel.seqPanel.moveCursor(-size, 0);\r
- else\r
- groupAdjustment = -size;\r
- }\r
-\r
- if (groupAdjustment != 0)\r
- {\r
- viewport.getSelectionGroup().setStartRes(\r
- viewport.getSelectionGroup().getStartRes() + groupAdjustment);\r
- viewport.getSelectionGroup().setEndRes(\r
- viewport.getSelectionGroup().getEndRes() + groupAdjustment);\r
- }\r
-\r
- boolean appendHistoryItem = false;\r
- if (viewport.historyList != null && viewport.historyList.size() > 0\r
- && viewport.historyList.peek() instanceof SlideSequencesCommand)\r
- {\r
- appendHistoryItem = ssc\r
- .appendSlideCommand((SlideSequencesCommand) viewport.historyList\r
- .peek());\r
- }\r
-\r
- if (!appendHistoryItem)\r
- addHistoryItem(ssc);\r
-\r
- repaint();\r
- }\r
-\r
- static StringBuffer copiedSequences;\r
-\r
- static Vector copiedHiddenColumns;\r
-\r
- protected void copy_actionPerformed()\r
- {\r
- if (viewport.getSelectionGroup() == null)\r
- {\r
- return;\r
- }\r
-\r
- SequenceGroup sg = viewport.getSelectionGroup();\r
- copiedSequences = new StringBuffer();\r
- Hashtable orderedSeqs = new Hashtable();\r
- for (int i = 0; i < sg.getSize(); i++)\r
- {\r
- SequenceI seq = sg.getSequenceAt(i);\r
- int index = viewport.getAlignment().findIndex(seq);\r
- orderedSeqs.put(index + "", seq);\r
- }\r
-\r
- int index = 0, startRes, endRes;\r
- char ch;\r
-\r
- if (viewport.hasHiddenColumns() && viewport.getSelectionGroup() != null)\r
- {\r
- copiedHiddenColumns = new Vector();\r
- int hiddenOffset = viewport.getSelectionGroup().getStartRes();\r
- for (int i = 0; i < viewport.getColumnSelection().getHiddenColumns()\r
- .size(); i++)\r
- {\r
- int[] region = (int[]) viewport.getColumnSelection()\r
- .getHiddenColumns().elementAt(i);\r
-\r
- copiedHiddenColumns.addElement(new int[]\r
- { region[0] - hiddenOffset, region[1] - hiddenOffset });\r
- }\r
- }\r
- else\r
- {\r
- copiedHiddenColumns = null;\r
- }\r
-\r
- for (int i = 0; i < sg.getSize(); i++)\r
- {\r
- SequenceI seq = null;\r
-\r
- while (seq == null)\r
- {\r
- if (orderedSeqs.containsKey(index + ""))\r
- {\r
- seq = (SequenceI) orderedSeqs.get(index + "");\r
- index++;\r
-\r
- break;\r
- }\r
- else\r
- {\r
- index++;\r
- }\r
- }\r
-\r
- // FIND START RES\r
- // Returns residue following index if gap\r
- startRes = seq.findPosition(sg.getStartRes());\r
-\r
- // FIND END RES\r
- // Need to find the residue preceeding index if gap\r
- endRes = 0;\r
-\r
- for (int j = 0; j < sg.getEndRes() + 1 && j < seq.getLength(); j++)\r
- {\r
- ch = seq.getCharAt(j);\r
- if (!jalview.util.Comparison.isGap((ch)))\r
- {\r
- endRes++;\r
- }\r
- }\r
-\r
- if (endRes > 0)\r
- {\r
- endRes += seq.getStart() - 1;\r
- }\r
-\r
- copiedSequences.append(seq.getName()\r
- + "\t"\r
- + startRes\r
- + "\t"\r
- + endRes\r
- + "\t"\r
- + seq.getSequenceAsString(sg.getStartRes(),\r
- sg.getEndRes() + 1) + "\n");\r
- }\r
-\r
- }\r
-\r
- protected void pasteNew_actionPerformed()\r
- {\r
- paste(true);\r
- }\r
-\r
- protected void pasteThis_actionPerformed()\r
- {\r
- paste(false);\r
- }\r
-\r
- void paste(boolean newAlignment)\r
- {\r
- try\r
- {\r
-\r
- if (copiedSequences == null)\r
- {\r
- return;\r
- }\r
-\r
- StringTokenizer st = new StringTokenizer(copiedSequences.toString());\r
- Vector seqs = new Vector();\r
- while (st.hasMoreElements())\r
- {\r
- String name = st.nextToken();\r
- int start = Integer.parseInt(st.nextToken());\r
- int end = Integer.parseInt(st.nextToken());\r
- seqs.addElement(new Sequence(name, st.nextToken(), start, end));\r
- }\r
- SequenceI[] newSeqs = new SequenceI[seqs.size()];\r
- for (int i = 0; i < seqs.size(); i++)\r
- {\r
- newSeqs[i] = (SequenceI) seqs.elementAt(i);\r
- }\r
-\r
- if (newAlignment)\r
- {\r
- String newtitle = new String("Copied sequences");\r
- if (getTitle().startsWith("Copied sequences"))\r
- {\r
- newtitle = getTitle();\r
- }\r
- else\r
- {\r
- newtitle = newtitle.concat("- from " + getTitle());\r
- }\r
- AlignFrame af = new AlignFrame(new Alignment(newSeqs),\r
- viewport.applet, newtitle, false);\r
- if (copiedHiddenColumns != null)\r
- {\r
- for (int i = 0; i < copiedHiddenColumns.size(); i++)\r
- {\r
- int[] region = (int[]) copiedHiddenColumns.elementAt(i);\r
- af.viewport.hideColumns(region[0], region[1]);\r
- }\r
- }\r
-\r
- jalview.bin.JalviewLite.addFrame(af, newtitle, DEFAULT_WIDTH,\r
- DEFAULT_HEIGHT);\r
- }\r
- else\r
- {\r
- addSequences(newSeqs);\r
- }\r
-\r
- } catch (Exception ex)\r
- {\r
- } // could be anything being pasted in here\r
-\r
- }\r
-\r
- void addSequences(SequenceI[] seqs)\r
- {\r
- for (int i = 0; i < seqs.length; i++)\r
- {\r
- viewport.getAlignment().addSequence(seqs[i]);\r
- }\r
-\r
- // !newAlignment\r
- addHistoryItem(new EditCommand("Add sequences", EditCommand.PASTE,\r
- seqs, 0, viewport.getAlignment().getWidth(),\r
- viewport.getAlignment()));\r
-\r
- viewport.setEndSeq(viewport.getAlignment().getHeight());\r
- viewport.getAlignment().getWidth();\r
- viewport.firePropertyChange("alignment", null, viewport.getAlignment()\r
- .getSequences());\r
-\r
- }\r
-\r
- protected void cut_actionPerformed()\r
- {\r
- copy_actionPerformed();\r
- delete_actionPerformed();\r
- }\r
-\r
- protected void delete_actionPerformed()\r
- {\r
-\r
- SequenceGroup sg = viewport.getSelectionGroup();\r
- if (sg == null)\r
- {\r
- return;\r
- }\r
-\r
- Vector seqs = new Vector();\r
- SequenceI seq;\r
- for (int i = 0; i < sg.getSize(); i++)\r
- {\r
- seq = sg.getSequenceAt(i);\r
- seqs.addElement(seq);\r
- }\r
-\r
- // If the cut affects all sequences, remove highlighted columns\r
- if (sg.getSize() == viewport.getAlignment().getHeight())\r
- {\r
- viewport.getColumnSelection().removeElements(sg.getStartRes(),\r
- sg.getEndRes() + 1);\r
- }\r
-\r
- SequenceI[] cut = new SequenceI[seqs.size()];\r
- for (int i = 0; i < seqs.size(); i++)\r
- {\r
- cut[i] = (SequenceI) seqs.elementAt(i);\r
- }\r
-\r
- /*\r
- * //ADD HISTORY ITEM\r
- */\r
- addHistoryItem(new EditCommand("Cut Sequences", EditCommand.CUT, cut,\r
- sg.getStartRes(), sg.getEndRes() - sg.getStartRes() + 1,\r
- viewport.getAlignment()));\r
-\r
- viewport.setSelectionGroup(null);\r
- viewport.getAlignment().deleteGroup(sg);\r
-\r
- viewport.firePropertyChange("alignment", null, viewport.getAlignment()\r
- .getSequences());\r
-\r
- if (viewport.getAlignment().getHeight() < 1)\r
- {\r
- this.setVisible(false);\r
- }\r
- viewport.sendSelection();\r
- }\r
-\r
- /**\r
- * group consensus toggled\r
- * \r
- */\r
- protected void showGroupConsensus_actionPerformed()\r
- {\r
- viewport.setShowGroupConsensus(showGroupConsensus.getState());\r
- alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState());\r
-\r
- }\r
-\r
- /**\r
- * group conservation toggled.\r
- */\r
- protected void showGroupConservation_actionPerformed()\r
- {\r
- viewport.setShowGroupConservation(showGroupConservation.getState());\r
- alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState());\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see\r
- * jalview.jbgui.GAlignFrame#showConsensusHistogram_actionPerformed(java.awt\r
- * .event.ActionEvent)\r
- */\r
- protected void showConsensusHistogram_actionPerformed()\r
- {\r
- viewport.setShowConsensusHistogram(showConsensusHistogram.getState());\r
- alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState());\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see\r
- * jalview.jbgui.GAlignFrame#showConsensusProfile_actionPerformed(java.awt\r
- * .event.ActionEvent)\r
- */\r
- protected void showSequenceLogo_actionPerformed()\r
- {\r
- viewport.setShowSequenceLogo(showSequenceLogo.getState());\r
- alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState());\r
- }\r
-\r
- protected void normSequenceLogo_actionPerformed()\r
- {\r
- showSequenceLogo.setState(true);\r
- viewport.setShowSequenceLogo(true);\r
- viewport.setNormaliseSequenceLogo(normSequenceLogo.getState());\r
- alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState());\r
- }\r
-\r
- protected void applyAutoAnnotationSettings_actionPerformed()\r
- {\r
- alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState());\r
- }\r
-\r
- protected void makeGrpsFromSelection_actionPerformed()\r
- {\r
- if (viewport.getSelectionGroup() != null)\r
- {\r
- SequenceGroup[] gps = jalview.analysis.Grouping.makeGroupsFrom(\r
- viewport.getSequenceSelection(),\r
- viewport.getAlignmentView(true).getSequenceStrings(\r
- viewport.getGapCharacter()), viewport.getAlignment()\r
- .getGroups());\r
- viewport.getAlignment().deleteAllGroups();\r
- viewport.sequenceColours = null;\r
- viewport.setSelectionGroup(null);\r
- // set view properties for each group\r
- for (int g = 0; g < gps.length; g++)\r
- {\r
- // gps[g].setShowunconserved(viewport.getShowUnconserved());\r
- gps[g].setshowSequenceLogo(viewport.isShowSequenceLogo());\r
- viewport.getAlignment().addGroup(gps[g]);\r
- Color col = new Color((int) (Math.random() * 255),\r
- (int) (Math.random() * 255), (int) (Math.random() * 255));\r
- col = col.brighter();\r
- for (SequenceI sq : gps[g].getSequences(null))\r
- viewport.setSequenceColour(sq, col);\r
- }\r
- PaintRefresher.Refresh(this, viewport.getSequenceSetId());\r
- alignPanel.updateAnnotation();\r
- alignPanel.paintAlignment(true);\r
- }\r
- }\r
-\r
- protected void deleteGroups_actionPerformed()\r
- {\r
- viewport.getAlignment().deleteAllGroups();\r
- viewport.sequenceColours = null;\r
- viewport.setSelectionGroup(null);\r
-\r
- alignPanel.paintAlignment(true);\r
- }\r
-\r
- public void selectAllSequenceMenuItem_actionPerformed()\r
- {\r
- SequenceGroup sg = new SequenceGroup();\r
- for (int i = 0; i < viewport.getAlignment().getSequences().size(); i++)\r
- {\r
- sg.addSequence(viewport.getAlignment().getSequenceAt(i), false);\r
- }\r
- sg.setEndRes(viewport.getAlignment().getWidth() - 1);\r
- viewport.setSelectionGroup(sg);\r
- alignPanel.paintAlignment(true);\r
- PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId());\r
- viewport.sendSelection();\r
- }\r
-\r
- public void deselectAllSequenceMenuItem_actionPerformed()\r
- {\r
- if (viewport.cursorMode)\r
- {\r
- alignPanel.seqPanel.keyboardNo1 = null;\r
- alignPanel.seqPanel.keyboardNo2 = null;\r
- }\r
- viewport.setSelectionGroup(null);\r
- viewport.getColumnSelection().clear();\r
- viewport.setSelectionGroup(null);\r
- alignPanel.idPanel.idCanvas.searchResults = null;\r
- alignPanel.seqPanel.seqCanvas.highlightSearchResults(null);\r
- alignPanel.paintAlignment(true);\r
- PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId());\r
- viewport.sendSelection();\r
- }\r
-\r
- public void invertSequenceMenuItem_actionPerformed()\r
- {\r
- SequenceGroup sg = viewport.getSelectionGroup();\r
- for (int i = 0; i < viewport.getAlignment().getSequences().size(); i++)\r
- {\r
- sg.addOrRemove(viewport.getAlignment().getSequenceAt(i), false);\r
- }\r
-\r
- PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId());\r
- viewport.sendSelection();\r
- }\r
-\r
- public void invertColSel_actionPerformed()\r
- {\r
- viewport.invertColumnSelection();\r
- alignPanel.paintAlignment(true);\r
- PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId());\r
- viewport.sendSelection();\r
- }\r
-\r
- void trimAlignment(boolean trimLeft)\r
- {\r
- ColumnSelection colSel = viewport.getColumnSelection();\r
- int column;\r
-\r
- if (colSel.size() > 0)\r
- {\r
- if (trimLeft)\r
- {\r
- column = colSel.getMin();\r
- }\r
- else\r
- {\r
- column = colSel.getMax();\r
- }\r
-\r
- SequenceI[] seqs;\r
- if (viewport.getSelectionGroup() != null)\r
- {\r
- seqs = viewport.getSelectionGroup().getSequencesAsArray(\r
- viewport.getHiddenRepSequences());\r
- }\r
- else\r
- {\r
- seqs = viewport.getAlignment().getSequencesArray();\r
- }\r
-\r
- TrimRegionCommand trimRegion;\r
- if (trimLeft)\r
- {\r
- trimRegion = new TrimRegionCommand("Remove Left",\r
- TrimRegionCommand.TRIM_LEFT, seqs, column,\r
- viewport.getAlignment(), viewport.getColumnSelection(),\r
- viewport.getSelectionGroup());\r
- viewport.setStartRes(0);\r
- }\r
- else\r
- {\r
- trimRegion = new TrimRegionCommand("Remove Right",\r
- TrimRegionCommand.TRIM_RIGHT, seqs, column,\r
- viewport.getAlignment(), viewport.getColumnSelection(),\r
- viewport.getSelectionGroup());\r
- }\r
-\r
- statusBar.setText("Removed " + trimRegion.getSize() + " columns.");\r
-\r
- addHistoryItem(trimRegion);\r
-\r
- for (SequenceGroup sg : viewport.getAlignment().getGroups())\r
- {\r
- if ((trimLeft && !sg.adjustForRemoveLeft(column))\r
- || (!trimLeft && !sg.adjustForRemoveRight(column)))\r
- {\r
- viewport.getAlignment().deleteGroup(sg);\r
- }\r
- }\r
-\r
- viewport.firePropertyChange("alignment", null, viewport\r
- .getAlignment().getSequences());\r
- }\r
- }\r
-\r
- public void removeGappedColumnMenuItem_actionPerformed()\r
- {\r
- int start = 0, end = viewport.getAlignment().getWidth() - 1;\r
-\r
- SequenceI[] seqs;\r
- if (viewport.getSelectionGroup() != null)\r
- {\r
- seqs = viewport.getSelectionGroup().getSequencesAsArray(\r
- viewport.getHiddenRepSequences());\r
- start = viewport.getSelectionGroup().getStartRes();\r
- end = viewport.getSelectionGroup().getEndRes();\r
- }\r
- else\r
- {\r
- seqs = viewport.getAlignment().getSequencesArray();\r
- }\r
-\r
- RemoveGapColCommand removeGapCols = new RemoveGapColCommand(\r
- "Remove Gapped Columns", seqs, start, end,\r
- viewport.getAlignment());\r
-\r
- addHistoryItem(removeGapCols);\r
-\r
- statusBar.setText("Removed " + removeGapCols.getSize()\r
- + " empty columns.");\r
-\r
- // This is to maintain viewport position on first residue\r
- // of first sequence\r
- SequenceI seq = viewport.getAlignment().getSequenceAt(0);\r
- int startRes = seq.findPosition(viewport.startRes);\r
- // ShiftList shifts;\r
- // viewport.getAlignment().removeGaps(shifts=new ShiftList());\r
- // edit.alColumnChanges=shifts.getInverse();\r
- // if (viewport.hasHiddenColumns)\r
- // viewport.getColumnSelection().compensateForEdits(shifts);\r
- viewport.setStartRes(seq.findIndex(startRes) - 1);\r
- viewport.firePropertyChange("alignment", null, viewport.getAlignment()\r
- .getSequences());\r
-\r
- }\r
-\r
- public void removeAllGapsMenuItem_actionPerformed()\r
- {\r
- int start = 0, end = viewport.getAlignment().getWidth() - 1;\r
-\r
- SequenceI[] seqs;\r
- if (viewport.getSelectionGroup() != null)\r
- {\r
- seqs = viewport.getSelectionGroup().getSequencesAsArray(\r
- viewport.getHiddenRepSequences());\r
- start = viewport.getSelectionGroup().getStartRes();\r
- end = viewport.getSelectionGroup().getEndRes();\r
- }\r
- else\r
- {\r
- seqs = viewport.getAlignment().getSequencesArray();\r
- }\r
-\r
- // This is to maintain viewport position on first residue\r
- // of first sequence\r
- SequenceI seq = viewport.getAlignment().getSequenceAt(0);\r
- int startRes = seq.findPosition(viewport.startRes);\r
-\r
- addHistoryItem(new RemoveGapsCommand("Remove Gaps", seqs, start, end,\r
- viewport.getAlignment()));\r
-\r
- viewport.setStartRes(seq.findIndex(startRes) - 1);\r
-\r
- viewport.firePropertyChange("alignment", null, viewport.getAlignment()\r
- .getSequences());\r
-\r
- }\r
-\r
- public void findMenuItem_actionPerformed()\r
- {\r
- new Finder(alignPanel);\r
- }\r
-\r
- /**\r
- * create a new view derived from the current view\r
- * \r
- * @param viewtitle\r
- * @return frame for the new view\r
- */\r
- public AlignFrame newView(String viewtitle)\r
- {\r
- AlignmentI newal;\r
- if (viewport.hasHiddenRows())\r
- {\r
- newal = new Alignment(viewport.getAlignment().getHiddenSequences()\r
- .getFullAlignment().getSequencesArray());\r
- }\r
- else\r
- {\r
- newal = new Alignment(viewport.getAlignment().getSequencesArray());\r
- }\r
-\r
- if (viewport.getAlignment().getAlignmentAnnotation() != null)\r
- {\r
- for (int i = 0; i < viewport.getAlignment().getAlignmentAnnotation().length; i++)\r
- {\r
- if (!viewport.getAlignment().getAlignmentAnnotation()[i].autoCalculated)\r
- {\r
- newal.addAnnotation(viewport.getAlignment()\r
- .getAlignmentAnnotation()[i]);\r
- }\r
- }\r
- }\r
-\r
- AlignFrame newaf = new AlignFrame(newal, viewport.applet, "", false);\r
-\r
- newaf.viewport.setSequenceSetId(alignPanel.av.getSequenceSetId());\r
- PaintRefresher.Register(alignPanel, alignPanel.av.getSequenceSetId());\r
- PaintRefresher.Register(newaf.alignPanel,\r
- newaf.alignPanel.av.getSequenceSetId());\r
-\r
- PaintRefresher.Register(newaf.alignPanel.idPanel.idCanvas,\r
- newaf.alignPanel.av.getSequenceSetId());\r
- PaintRefresher.Register(newaf.alignPanel.seqPanel.seqCanvas,\r
- newaf.alignPanel.av.getSequenceSetId());\r
-\r
- Vector comps = (Vector) PaintRefresher.components.get(viewport\r
- .getSequenceSetId());\r
- int viewSize = -1;\r
- for (int i = 0; i < comps.size(); i++)\r
- {\r
- if (comps.elementAt(i) instanceof AlignmentPanel)\r
- {\r
- viewSize++;\r
- }\r
- }\r
-\r
- String title = new String(this.getTitle());\r
- if (viewtitle != null)\r
- {\r
- title = viewtitle + " ( " + title + ")";\r
- }\r
- else\r
- {\r
- if (title.indexOf("(View") > -1)\r
- {\r
- title = title.substring(0, title.indexOf("(View"));\r
- }\r
- title += "(View " + viewSize + ")";\r
- }\r
-\r
- newaf.setTitle(title.toString());\r
-\r
- newaf.viewport.historyList = viewport.historyList;\r
- newaf.viewport.redoList = viewport.redoList;\r
- return newaf;\r
- }\r
-\r
- /**\r
- * \r
- * @return list of feature groups on the view\r
- */\r
- public String[] getFeatureGroups()\r
- {\r
- FeatureRenderer fr = null;\r
- if (alignPanel != null\r
- && (fr = alignPanel.getFeatureRenderer()) != null)\r
- {\r
- return fr.getGroups();\r
- }\r
- return null;\r
- }\r
-\r
- /**\r
- * get sequence feature groups that are hidden or shown\r
- * \r
- * @param visible\r
- * true is visible\r
- * @return list\r
- */\r
- public String[] getFeatureGroupsOfState(boolean visible)\r
- {\r
- FeatureRenderer fr = null;\r
- if (alignPanel != null\r
- && (fr = alignPanel.getFeatureRenderer()) != null)\r
- {\r
- return fr.getGroups(visible);\r
- }\r
- return null;\r
- }\r
-\r
- /**\r
- * Change the display state for the given feature groups\r
- * \r
- * @param groups\r
- * list of group strings\r
- * @param state\r
- * visible or invisible\r
- */\r
- public void setFeatureGroupState(String[] groups, boolean state)\r
- {\r
- FeatureRenderer fr = null;\r
- this.sequenceFeatures.setState(true);\r
- viewport.showSequenceFeatures(true);\r
- if (alignPanel != null\r
- && (fr = alignPanel.getFeatureRenderer()) != null)\r
- {\r
- fr.setGroupState(groups, state);\r
- alignPanel.seqPanel.seqCanvas.repaint();\r
- if (alignPanel.overviewPanel != null)\r
- {\r
- alignPanel.overviewPanel.updateOverviewImage();\r
- }\r
- }\r
- }\r
-\r
- public void seqLimits_itemStateChanged()\r
- {\r
- viewport.setShowJVSuffix(seqLimits.getState());\r
- alignPanel.fontChanged();\r
- alignPanel.paintAlignment(true);\r
- }\r
-\r
- protected void colourTextMenuItem_actionPerformed()\r
- {\r
- viewport.setColourText(colourTextMenuItem.getState());\r
- alignPanel.paintAlignment(true);\r
- }\r
-\r
- protected void displayNonconservedMenuItem_actionPerformed()\r
- {\r
- viewport.setShowunconserved(displayNonconservedMenuItem.getState());\r
- alignPanel.paintAlignment(true);\r
- }\r
-\r
- protected void wrapMenuItem_actionPerformed()\r
- {\r
- viewport.setWrapAlignment(wrapMenuItem.getState());\r
- alignPanel.setWrapAlignment(wrapMenuItem.getState());\r
- scaleAbove.setEnabled(wrapMenuItem.getState());\r
- scaleLeft.setEnabled(wrapMenuItem.getState());\r
- scaleRight.setEnabled(wrapMenuItem.getState());\r
- alignPanel.paintAlignment(true);\r
- }\r
-\r
- public void overviewMenuItem_actionPerformed()\r
- {\r
- if (alignPanel.overviewPanel != null)\r
- {\r
- return;\r
- }\r
-\r
- Frame frame = new Frame();\r
- OverviewPanel overview = new OverviewPanel(alignPanel);\r
- frame.add(overview);\r
- // +50 must allow for applet frame window\r
- jalview.bin.JalviewLite.addFrame(frame, "Overview " + this.getTitle(),\r
- overview.getPreferredSize().width,\r
- overview.getPreferredSize().height + 50);\r
-\r
- frame.pack();\r
- final AlignmentPanel ap = alignPanel;\r
- frame.addWindowListener(new WindowAdapter()\r
- {\r
- @Override\r
- public void windowClosing(WindowEvent e)\r
- {\r
- if (ap != null)\r
- {\r
- ap.setOverviewPanel(null);\r
- }\r
- };\r
- });\r
-\r
- alignPanel.setOverviewPanel(overview);\r
-\r
- }\r
-\r
- void changeColour(ColourSchemeI cs)\r
- {\r
- int threshold = 0;\r
-\r
- if (cs != null)\r
- {\r
- if (viewport.getAbovePIDThreshold())\r
- {\r
- threshold = SliderPanel.setPIDSliderSource(alignPanel, cs,\r
- "Background");\r
-\r
- cs.setThreshold(threshold, viewport.getIgnoreGapsConsensus());\r
-\r
- viewport.setGlobalColourScheme(cs);\r
- }\r
- else\r
- {\r
- cs.setThreshold(0, viewport.getIgnoreGapsConsensus());\r
- }\r
-\r
- if (viewport.getConservationSelected())\r
- {\r
-\r
- Alignment al = (Alignment) viewport.getAlignment();\r
- Conservation c = new Conservation("All",\r
- ResidueProperties.propHash, 3, al.getSequences(), 0,\r
- al.getWidth() - 1);\r
-\r
- c.calculate();\r
- c.verdict(false, viewport.getConsPercGaps());\r
-\r
- cs.setConservation(c);\r
-\r
- cs.setConservationInc(SliderPanel.setConservationSlider(alignPanel,\r
- cs, "Background"));\r
-\r
- }\r
- else\r
- {\r
- cs.setConservation(null);\r
- }\r
-\r
- cs.setConsensus(viewport.getSequenceConsensusHash());\r
-\r
- }\r
- viewport.setGlobalColourScheme(cs);\r
-\r
- if (alignPanel.getOverviewPanel() != null)\r
- {\r
- alignPanel.getOverviewPanel().updateOverviewImage();\r
- }\r
-\r
- jalview.structure.StructureSelectionManager\r
- .getStructureSelectionManager(viewport.applet)\r
- .sequenceColoursChanged(alignPanel);\r
-\r
- alignPanel.paintAlignment(true);\r
- }\r
-\r
- protected void modifyPID_actionPerformed()\r
- {\r
- if (viewport.getAbovePIDThreshold()\r
- && viewport.getGlobalColourScheme() != null)\r
- {\r
- SliderPanel.setPIDSliderSource(alignPanel,\r
- viewport.getGlobalColourScheme(), "Background");\r
- SliderPanel.showPIDSlider();\r
- }\r
- }\r
-\r
- protected void modifyConservation_actionPerformed()\r
- {\r
- if (viewport.getConservationSelected()\r
- && viewport.getGlobalColourScheme() != null)\r
- {\r
- SliderPanel.setConservationSlider(alignPanel,\r
- viewport.getGlobalColourScheme(), "Background");\r
- SliderPanel.showConservationSlider();\r
- }\r
- }\r
-\r
- protected void conservationMenuItem_actionPerformed()\r
- {\r
- viewport.setConservationSelected(conservationMenuItem.getState());\r
-\r
- viewport.setAbovePIDThreshold(false);\r
- abovePIDThreshold.setState(false);\r
-\r
- changeColour(viewport.getGlobalColourScheme());\r
-\r
- modifyConservation_actionPerformed();\r
- }\r
-\r
- public void abovePIDThreshold_actionPerformed()\r
- {\r
- viewport.setAbovePIDThreshold(abovePIDThreshold.getState());\r
-\r
- conservationMenuItem.setState(false);\r
- viewport.setConservationSelected(false);\r
-\r
- changeColour(viewport.getGlobalColourScheme());\r
-\r
- modifyPID_actionPerformed();\r
- }\r
-\r
- public void sortPairwiseMenuItem_actionPerformed()\r
- {\r
- SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();\r
- AlignmentSorter.sortByPID(viewport.getAlignment(), viewport\r
- .getAlignment().getSequenceAt(0), null);\r
-\r
- addHistoryItem(new OrderCommand("Pairwise Sort", oldOrder,\r
- viewport.getAlignment()));\r
- alignPanel.paintAlignment(true);\r
- }\r
-\r
- public void sortIDMenuItem_actionPerformed()\r
- {\r
- SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();\r
- AlignmentSorter.sortByID(viewport.getAlignment());\r
- addHistoryItem(new OrderCommand("ID Sort", oldOrder,\r
- viewport.getAlignment()));\r
- alignPanel.paintAlignment(true);\r
- }\r
-\r
- public void sortLengthMenuItem_actionPerformed()\r
- {\r
- SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();\r
- AlignmentSorter.sortByLength(viewport.getAlignment());\r
- addHistoryItem(new OrderCommand("Length Sort", oldOrder,\r
- viewport.getAlignment()));\r
- alignPanel.paintAlignment(true);\r
- }\r
-\r
- public void sortGroupMenuItem_actionPerformed()\r
- {\r
- SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();\r
- AlignmentSorter.sortByGroup(viewport.getAlignment());\r
- addHistoryItem(new OrderCommand("Group Sort", oldOrder,\r
- viewport.getAlignment()));\r
- alignPanel.paintAlignment(true);\r
-\r
- }\r
-\r
- public void removeRedundancyMenuItem_actionPerformed()\r
- {\r
- new RedundancyPanel(alignPanel);\r
- }\r
-\r
- public void pairwiseAlignmentMenuItem_actionPerformed()\r
- {\r
- if (viewport.getSelectionGroup() != null\r
- && viewport.getSelectionGroup().getSize() > 1)\r
- {\r
- Frame frame = new Frame();\r
- frame.add(new PairwiseAlignPanel(alignPanel));\r
- jalview.bin.JalviewLite.addFrame(frame, "Pairwise Alignment", 600,\r
- 500);\r
- }\r
- }\r
-\r
- public void PCAMenuItem_actionPerformed()\r
- {\r
- // are the sequences aligned?\r
- if (!viewport.getAlignment().isAligned(false))\r
- {\r
- SequenceI current;\r
- int Width = viewport.getAlignment().getWidth();\r
-\r
- for (int i = 0; i < viewport.getAlignment().getSequences().size(); i++)\r
- {\r
- current = viewport.getAlignment().getSequenceAt(i);\r
-\r
- if (current.getLength() < Width)\r
- {\r
- current.insertCharAt(Width - 1, viewport.getGapCharacter());\r
- }\r
- }\r
- alignPanel.paintAlignment(true);\r
- }\r
-\r
- if ((viewport.getSelectionGroup() != null\r
- && viewport.getSelectionGroup().getSize() < 4 && viewport\r
- .getSelectionGroup().getSize() > 0)\r
- || viewport.getAlignment().getHeight() < 4)\r
- {\r
- return;\r
- }\r
-\r
- try\r
- {\r
- new PCAPanel(viewport);\r
- } catch (java.lang.OutOfMemoryError ex)\r
- {\r
- }\r
-\r
- }\r
-\r
- public void averageDistanceTreeMenuItem_actionPerformed()\r
- {\r
- NewTreePanel("AV", "PID", "Average distance tree using PID");\r
- }\r
-\r
- public void neighbourTreeMenuItem_actionPerformed()\r
- {\r
- NewTreePanel("NJ", "PID", "Neighbour joining tree using PID");\r
- }\r
-\r
- protected void njTreeBlosumMenuItem_actionPerformed()\r
- {\r
- NewTreePanel("NJ", "BL", "Neighbour joining tree using BLOSUM62");\r
- }\r
-\r
- protected void avTreeBlosumMenuItem_actionPerformed()\r
- {\r
- NewTreePanel("AV", "BL", "Average distance tree using BLOSUM62");\r
- }\r
-\r
- void NewTreePanel(String type, String pwType, String title)\r
- {\r
- // are the sequences aligned?\r
- if (!viewport.getAlignment().isAligned(false))\r
- {\r
- SequenceI current;\r
- int Width = viewport.getAlignment().getWidth();\r
-\r
- for (int i = 0; i < viewport.getAlignment().getSequences().size(); i++)\r
- {\r
- current = viewport.getAlignment().getSequenceAt(i);\r
-\r
- if (current.getLength() < Width)\r
- {\r
- current.insertCharAt(Width - 1, viewport.getGapCharacter());\r
- }\r
- }\r
- alignPanel.paintAlignment(true);\r
-\r
- }\r
-\r
- if ((viewport.getSelectionGroup() != null && viewport\r
- .getSelectionGroup().getSize() > 1)\r
- || (viewport.getAlignment().getHeight() > 1))\r
- {\r
- final TreePanel tp = new TreePanel(alignPanel, type, pwType);\r
-\r
- addTreeMenuItem(tp, title);\r
-\r
- jalview.bin.JalviewLite.addFrame(tp, title, 600, 500);\r
- }\r
- }\r
-\r
- void loadTree_actionPerformed()\r
- {\r
- CutAndPasteTransfer cap = new CutAndPasteTransfer(true, this);\r
- cap.setText("Paste your Newick tree file here.");\r
- cap.setTreeImport();\r
- Frame frame = new Frame();\r
- frame.add(cap);\r
- jalview.bin.JalviewLite.addFrame(frame, "Paste Newick file ", 400, 300);\r
- }\r
-\r
- public void loadTree(jalview.io.NewickFile tree, String treeFile)\r
- {\r
- TreePanel tp = new TreePanel(alignPanel, treeFile, "From File - ", tree);\r
- jalview.bin.JalviewLite.addFrame(tp, treeFile, 600, 500);\r
- addTreeMenuItem(tp, treeFile);\r
- }\r
-\r
- /**\r
- * sort the alignment using the given treePanel\r
- * \r
- * @param treePanel\r
- * tree used to sort view\r
- * @param title\r
- * string used for undo event name\r
- */\r
- public void sortByTree(TreePanel treePanel, String title)\r
- {\r
- SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();\r
- AlignmentSorter\r
- .sortByTree(viewport.getAlignment(), treePanel.getTree());\r
- // addHistoryItem(new HistoryItem("Sort", viewport.alignment,\r
- // HistoryItem.SORT));\r
- addHistoryItem(new OrderCommand("Order by " + title, oldOrder,\r
- viewport.getAlignment()));\r
- alignPanel.paintAlignment(true);\r
- }\r
-\r
- /**\r
- * Do any automatic reordering of the alignment and add the necessary bits to\r
- * the menu structure for the new tree\r
- * \r
- * @param treePanel\r
- * @param title\r
- */\r
- protected void addTreeMenuItem(final TreePanel treePanel,\r
- final String title)\r
- {\r
- final MenuItem item = new MenuItem(title);\r
- sortByTreeMenu.add(item);\r
- item.addActionListener(new java.awt.event.ActionListener()\r
- {\r
- @Override\r
- public void actionPerformed(ActionEvent evt)\r
- {\r
- sortByTree(treePanel, title); // treePanel.getTitle());\r
- }\r
- });\r
-\r
- treePanel.addWindowListener(new WindowAdapter()\r
- {\r
- @Override\r
- public void windowOpened(WindowEvent e)\r
- {\r
- if (viewport.sortByTree)\r
- {\r
- sortByTree(treePanel, title);\r
- }\r
- super.windowOpened(e);\r
- }\r
-\r
- @Override\r
- public void windowClosing(WindowEvent e)\r
- {\r
- sortByTreeMenu.remove(item);\r
- };\r
- });\r
- }\r
-\r
- public boolean sortBy(AlignmentOrder alorder, String undoname)\r
- {\r
- SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();\r
- if (viewport.applet.debug)\r
- {\r
- System.err.println("Sorting " + alorder.getOrder().size()\r
- + " in alignment '" + getTitle() + "'");\r
- }\r
- AlignmentSorter.sortBy(viewport.getAlignment(), alorder);\r
- if (undoname != null)\r
- {\r
- addHistoryItem(new OrderCommand(undoname, oldOrder,\r
- viewport.getAlignment()));\r
- }\r
- alignPanel.paintAlignment(true);\r
- return true;\r
- }\r
-\r
- protected void documentation_actionPerformed()\r
- {\r
- alignPanel.av.applet.openJalviewHelpUrl();\r
- }\r
-\r
- protected void about_actionPerformed()\r
- {\r
-\r
- class AboutPanel extends Canvas\r
- {\r
- String version;\r
-\r
- String builddate;\r
-\r
- public AboutPanel(String version, String builddate)\r
- {\r
- this.version = version;\r
- this.builddate = builddate;\r
- }\r
-\r
- @Override\r
- public void paint(Graphics g)\r
- {\r
- g.setColor(Color.white);\r
- g.fillRect(0, 0, getSize().width, getSize().height);\r
- g.setFont(new Font("Helvetica", Font.PLAIN, 12));\r
- FontMetrics fm = g.getFontMetrics();\r
- int fh = fm.getHeight();\r
- int y = 5, x = 7;\r
- g.setColor(Color.black);\r
- // TODO: update this text for each release or centrally store it for\r
- // lite and application\r
- g.setFont(new Font("Helvetica", Font.BOLD, 14));\r
- g.drawString("JalviewLite - Release " + version, x, y += fh);\r
- g.setFont(new Font("Helvetica", Font.BOLD, 12));\r
- g.drawString("Build date: " + builddate, x, y += fh);\r
- g.setFont(new Font("Helvetica", Font.PLAIN, 12));\r
- g.drawString(\r
- "Authors: Jim Procter, Andrew Waterhouse, Michele Clamp, James Cuff, Steve Searle,",\r
- x, y += fh * 1.5);\r
- g.drawString("David Martin & Geoff Barton.", x + 50, y += fh);\r
- g.drawString(\r
- "Development managed by The Barton Group, University of Dundee, Scotland, UK.",\r
- x, y += fh);\r
- g.drawString(\r
- "For help, see the FAQ at www.jalview.org and/or join the jalview-discuss@jalview.org mailing list",\r
- x, y += fh);\r
- g.drawString("If you use Jalview, please cite:", x, y += fh + 8);\r
- g.drawString(\r
- "Waterhouse, A.M., Procter, J.B., Martin, D.M.A, Clamp, M. and Barton, G. J. (2009)",\r
- x, y += fh);\r
- g.drawString(\r
- "Jalview Version 2 - a multiple sequence alignment editor and analysis workbench",\r
- x, y += fh);\r
- g.drawString("Bioinformatics doi: 10.1093/bioinformatics/btp033",\r
- x, y += fh);\r
- }\r
- }\r
-\r
- Frame frame = new Frame();\r
- frame.add(new AboutPanel(JalviewLite.getVersion(), JalviewLite\r
- .getBuildDate()));\r
- jalview.bin.JalviewLite.addFrame(frame, "Jalview", 580, 220);\r
-\r
- }\r
-\r
- public void showURL(String url, String target)\r
- {\r
- if (viewport.applet == null)\r
- {\r
- System.out.println("Not running as applet - no browser available.");\r
- }\r
- else\r
- {\r
- viewport.applet.showURL(url, target);\r
- }\r
- }\r
-\r
- // ////////////////////////////////////////////////////////////////////////////////\r
- // JBuilder Graphics here\r
-\r
- MenuBar alignFrameMenuBar = new MenuBar();\r
-\r
- Menu fileMenu = new Menu("File");\r
-\r
- MenuItem loadApplication = new MenuItem("View in Full Application");\r
-\r
- MenuItem loadTree = new MenuItem("Load Associated Tree ...");\r
-\r
- MenuItem loadAnnotations = new MenuItem("Load Features/Annotations ...");\r
-\r
- MenuItem outputFeatures = new MenuItem("Export Features ...");\r
-\r
- MenuItem outputAnnotations = new MenuItem("Export Annotations ...");\r
-\r
- MenuItem closeMenuItem = new MenuItem("Close");\r
-\r
- Menu editMenu = new Menu("Edit");\r
-\r
- Menu viewMenu = new Menu("View");\r
-\r
- Menu colourMenu = new Menu("Colour");\r
-\r
- Menu calculateMenu = new Menu("Calculate");\r
-\r
- MenuItem selectAllSequenceMenuItem = new MenuItem("Select all");\r
-\r
- MenuItem deselectAllSequenceMenuItem = new MenuItem("Deselect All");\r
-\r
- MenuItem invertSequenceMenuItem = new MenuItem("Invert Selection");\r
-\r
- MenuItem remove2LeftMenuItem = new MenuItem();\r
-\r
- MenuItem remove2RightMenuItem = new MenuItem();\r
-\r
- MenuItem removeGappedColumnMenuItem = new MenuItem();\r
-\r
- MenuItem removeAllGapsMenuItem = new MenuItem();\r
-\r
- CheckboxMenuItem viewBoxesMenuItem = new CheckboxMenuItem();\r
-\r
- CheckboxMenuItem viewTextMenuItem = new CheckboxMenuItem();\r
-\r
- MenuItem sortPairwiseMenuItem = new MenuItem();\r
-\r
- MenuItem sortIDMenuItem = new MenuItem();\r
-\r
- MenuItem sortLengthMenuItem = new MenuItem();\r
-\r
- MenuItem sortGroupMenuItem = new MenuItem();\r
-\r
- MenuItem removeRedundancyMenuItem = new MenuItem();\r
-\r
- MenuItem pairwiseAlignmentMenuItem = new MenuItem();\r
-\r
- MenuItem PCAMenuItem = new MenuItem();\r
-\r
- MenuItem averageDistanceTreeMenuItem = new MenuItem();\r
-\r
- MenuItem neighbourTreeMenuItem = new MenuItem();\r
-\r
- BorderLayout borderLayout1 = new BorderLayout();\r
-\r
- public Label statusBar = new Label();\r
-\r
- Menu outputTextboxMenu = new Menu();\r
-\r
- MenuItem clustalColour = new MenuItem();\r
-\r
- MenuItem zappoColour = new MenuItem();\r
-\r
- MenuItem taylorColour = new MenuItem();\r
-\r
- MenuItem hydrophobicityColour = new MenuItem();\r
-\r
- MenuItem helixColour = new MenuItem();\r
-\r
- MenuItem strandColour = new MenuItem();\r
-\r
- MenuItem turnColour = new MenuItem();\r
-\r
- MenuItem buriedColour = new MenuItem();\r
-\r
- MenuItem purinePyrimidineColour = new MenuItem();\r
-\r
- MenuItem RNAHelixColour = new MenuItem();\r
-\r
- MenuItem userDefinedColour = new MenuItem();\r
-\r
- MenuItem PIDColour = new MenuItem();\r
-\r
- MenuItem BLOSUM62Colour = new MenuItem();\r
-\r
- MenuItem tcoffeeColour = new MenuItem();\r
-\r
- MenuItem njTreeBlosumMenuItem = new MenuItem();\r
-\r
- MenuItem avDistanceTreeBlosumMenuItem = new MenuItem();\r
-\r
- CheckboxMenuItem annotationPanelMenuItem = new CheckboxMenuItem();\r
-\r
- CheckboxMenuItem colourTextMenuItem = new CheckboxMenuItem();\r
-\r
- CheckboxMenuItem displayNonconservedMenuItem = new CheckboxMenuItem();\r
-\r
- MenuItem alProperties = new MenuItem("Alignment Properties...");\r
-\r
- MenuItem overviewMenuItem = new MenuItem();\r
-\r
- MenuItem undoMenuItem = new MenuItem();\r
-\r
- MenuItem redoMenuItem = new MenuItem();\r
-\r
- CheckboxMenuItem conservationMenuItem = new CheckboxMenuItem();\r
-\r
- MenuItem noColourmenuItem = new MenuItem();\r
-\r
- CheckboxMenuItem wrapMenuItem = new CheckboxMenuItem();\r
-\r
- CheckboxMenuItem renderGapsMenuItem = new CheckboxMenuItem();\r
-\r
- MenuItem findMenuItem = new MenuItem();\r
-\r
- CheckboxMenuItem abovePIDThreshold = new CheckboxMenuItem();\r
-\r
- MenuItem nucleotideColour = new MenuItem();\r
-\r
- MenuItem deleteGroups = new MenuItem();\r
-\r
- MenuItem grpsFromSelection = new MenuItem();\r
-\r
- MenuItem delete = new MenuItem();\r
-\r
- MenuItem copy = new MenuItem();\r
-\r
- MenuItem cut = new MenuItem();\r
-\r
- Menu pasteMenu = new Menu();\r
-\r
- MenuItem pasteNew = new MenuItem();\r
-\r
- MenuItem pasteThis = new MenuItem();\r
-\r
- CheckboxMenuItem applyToAllGroups = new CheckboxMenuItem();\r
-\r
- MenuItem font = new MenuItem();\r
-\r
- CheckboxMenuItem scaleAbove = new CheckboxMenuItem();\r
-\r
- CheckboxMenuItem scaleLeft = new CheckboxMenuItem();\r
-\r
- CheckboxMenuItem scaleRight = new CheckboxMenuItem();\r
-\r
- MenuItem modifyPID = new MenuItem();\r
-\r
- MenuItem modifyConservation = new MenuItem();\r
-\r
- CheckboxMenuItem autoCalculate = new CheckboxMenuItem(\r
- "Autocalculate Consensus", true);\r
-\r
- CheckboxMenuItem sortByTree = new CheckboxMenuItem(\r
- "Sort Alignment With New Tree", true);\r
-\r
- Menu sortByTreeMenu = new Menu();\r
-\r
- Menu sort = new Menu();\r
-\r
- Menu calculate = new Menu();\r
-\r
- MenuItem inputText = new MenuItem();\r
-\r
- Menu helpMenu = new Menu();\r
-\r
- MenuItem documentation = new MenuItem();\r
-\r
- MenuItem about = new MenuItem();\r
-\r
- CheckboxMenuItem seqLimits = new CheckboxMenuItem();\r
-\r
- CheckboxMenuItem centreColumnLabelFlag = new CheckboxMenuItem();\r
-\r
- CheckboxMenuItem followMouseOverFlag = new CheckboxMenuItem();\r
-\r
- Menu autoAnnMenu = new Menu();\r
-\r
- CheckboxMenuItem showSequenceLogo = new CheckboxMenuItem();\r
-\r
- CheckboxMenuItem applyAutoAnnotationSettings = new CheckboxMenuItem();\r
-\r
- CheckboxMenuItem showConsensusHistogram = new CheckboxMenuItem();\r
-\r
- CheckboxMenuItem showGroupConsensus = new CheckboxMenuItem();\r
-\r
- CheckboxMenuItem showGroupConservation = new CheckboxMenuItem();\r
-\r
- CheckboxMenuItem normSequenceLogo = new CheckboxMenuItem();\r
-\r
- private void jbInit() throws Exception\r
- {\r
-\r
- setMenuBar(alignFrameMenuBar);\r
-\r
- MenuItem item;\r
-\r
- // dynamically fill save as menu with available formats\r
- for (int i = 0; i < jalview.io.AppletFormatAdapter.WRITEABLE_FORMATS.length; i++)\r
- {\r
-\r
- item = new MenuItem(\r
- jalview.io.AppletFormatAdapter.WRITEABLE_FORMATS[i]);\r
-\r
- item.addActionListener(new java.awt.event.ActionListener()\r
- {\r
- @Override\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- outputText_actionPerformed(e);\r
- }\r
- });\r
-\r
- outputTextboxMenu.add(item);\r
- }\r
- closeMenuItem.addActionListener(this);\r
- loadApplication.addActionListener(this);\r
-\r
- loadTree.addActionListener(this);\r
- loadAnnotations.addActionListener(this);\r
- outputFeatures.addActionListener(this);\r
- outputAnnotations.addActionListener(this);\r
- selectAllSequenceMenuItem.addActionListener(this);\r
- deselectAllSequenceMenuItem.addActionListener(this);\r
- invertSequenceMenuItem.addActionListener(this);\r
- remove2LeftMenuItem.setLabel("Remove Left");\r
- remove2LeftMenuItem.addActionListener(this);\r
- remove2RightMenuItem.setLabel("Remove Right");\r
- remove2RightMenuItem.addActionListener(this);\r
- removeGappedColumnMenuItem.setLabel("Remove Empty Columns");\r
- removeGappedColumnMenuItem.addActionListener(this);\r
- removeAllGapsMenuItem.setLabel("Remove All Gaps");\r
- removeAllGapsMenuItem.addActionListener(this);\r
- viewBoxesMenuItem.setLabel("Boxes");\r
- viewBoxesMenuItem.setState(true);\r
- viewBoxesMenuItem.addItemListener(this);\r
- viewTextMenuItem.setLabel("Text");\r
- viewTextMenuItem.setState(true);\r
- viewTextMenuItem.addItemListener(this);\r
- sortPairwiseMenuItem.setLabel("by Pairwise Identity");\r
- sortPairwiseMenuItem.addActionListener(this);\r
- sortIDMenuItem.setLabel("by ID");\r
- sortIDMenuItem.addActionListener(this);\r
- sortLengthMenuItem.setLabel("by Length");\r
- sortLengthMenuItem.addActionListener(this);\r
- sortGroupMenuItem.setLabel("by Group");\r
- sortGroupMenuItem.addActionListener(this);\r
- removeRedundancyMenuItem.setLabel("Remove Redundancy...");\r
- removeRedundancyMenuItem.addActionListener(this);\r
- pairwiseAlignmentMenuItem.setLabel("Pairwise Alignments...");\r
- pairwiseAlignmentMenuItem.addActionListener(this);\r
- PCAMenuItem.setLabel("Principal Component Analysis");\r
- PCAMenuItem.addActionListener(this);\r
- averageDistanceTreeMenuItem\r
- .setLabel("Average Distance Using % Identity");\r
- averageDistanceTreeMenuItem.addActionListener(this);\r
- neighbourTreeMenuItem.setLabel("Neighbour Joining Using % Identity");\r
- neighbourTreeMenuItem.addActionListener(this);\r
- statusBar.setBackground(Color.white);\r
- statusBar.setFont(new java.awt.Font("Verdana", 0, 11));\r
- statusBar.setText("Status bar");\r
- outputTextboxMenu.setLabel("Output to Textbox");\r
- clustalColour.setLabel("Clustalx");\r
-\r
- clustalColour.addActionListener(this);\r
- zappoColour.setLabel("Zappo");\r
- zappoColour.addActionListener(this);\r
- taylorColour.setLabel("Taylor");\r
- taylorColour.addActionListener(this);\r
- hydrophobicityColour.setLabel("Hydrophobicity");\r
- hydrophobicityColour.addActionListener(this);\r
- helixColour.setLabel("Helix Propensity");\r
- helixColour.addActionListener(this);\r
- strandColour.setLabel("Strand Propensity");\r
- strandColour.addActionListener(this);\r
- turnColour.setLabel("Turn Propensity");\r
- turnColour.addActionListener(this);\r
- buriedColour.setLabel("Buried Index");\r
- buriedColour.addActionListener(this);\r
- purinePyrimidineColour.setLabel("Purine/Pyrimidine");\r
- purinePyrimidineColour.addActionListener(this);\r
- RNAHelixColour.setLabel("by RNA Helices");\r
- RNAHelixColour.addActionListener(this);\r
- userDefinedColour.setLabel("User Defined...");\r
- userDefinedColour.addActionListener(this);\r
- PIDColour.setLabel("Percentage Identity");\r
- PIDColour.addActionListener(this);\r
- BLOSUM62Colour.setLabel("BLOSUM62 Score");\r
- BLOSUM62Colour.addActionListener(this);\r
- tcoffeeColour.setLabel("T-Coffee Scores");\r
- tcoffeeColour.setEnabled(false); // it will enabled only if a score file is\r
- // provided\r
- tcoffeeColour.addActionListener(this);\r
- avDistanceTreeBlosumMenuItem\r
- .setLabel("Average Distance Using BLOSUM62");\r
- avDistanceTreeBlosumMenuItem.addActionListener(this);\r
- njTreeBlosumMenuItem.setLabel("Neighbour Joining Using BLOSUM62");\r
- njTreeBlosumMenuItem.addActionListener(this);\r
- annotationPanelMenuItem.setLabel("Show Annotations");\r
- annotationPanelMenuItem.addItemListener(this);\r
- colourTextMenuItem.setLabel("Colour Text");\r
- colourTextMenuItem.addItemListener(this);\r
- displayNonconservedMenuItem.setLabel("Show nonconserved");\r
- displayNonconservedMenuItem.addItemListener(this);\r
- alProperties.addActionListener(this);\r
- overviewMenuItem.setLabel("Overview Window");\r
- overviewMenuItem.addActionListener(this);\r
- undoMenuItem.setEnabled(false);\r
- undoMenuItem.setLabel("Undo");\r
- undoMenuItem.addActionListener(this);\r
- redoMenuItem.setEnabled(false);\r
- redoMenuItem.setLabel("Redo");\r
- redoMenuItem.addActionListener(this);\r
- conservationMenuItem.setLabel("by Conservation");\r
- conservationMenuItem.addItemListener(this);\r
- noColourmenuItem.setLabel("None");\r
- noColourmenuItem.addActionListener(this);\r
- wrapMenuItem.setLabel("Wrap");\r
- wrapMenuItem.addItemListener(this);\r
- renderGapsMenuItem.setLabel("Show Gaps");\r
- renderGapsMenuItem.setState(true);\r
- renderGapsMenuItem.addItemListener(this);\r
- findMenuItem.setLabel("Find...");\r
- findMenuItem.addActionListener(this);\r
- abovePIDThreshold.setLabel("Above Identity Threshold");\r
- abovePIDThreshold.addItemListener(this);\r
- nucleotideColour.setLabel("Nucleotide");\r
- nucleotideColour.addActionListener(this);\r
- deleteGroups.setLabel("Undefine Groups");\r
- deleteGroups.addActionListener(this);\r
- grpsFromSelection.setLabel("Make Groups for selection");\r
- grpsFromSelection.addActionListener(this);\r
- copy.setLabel("Copy");\r
- copy.addActionListener(this);\r
- cut.setLabel("Cut");\r
- cut.addActionListener(this);\r
- delete.setLabel("Delete");\r
- delete.addActionListener(this);\r
- pasteMenu.setLabel("Paste");\r
- pasteNew.setLabel("To New Alignment");\r
- pasteNew.addActionListener(this);\r
- pasteThis.setLabel("Add To This Alignment");\r
- pasteThis.addActionListener(this);\r
- applyToAllGroups.setLabel("Apply Colour To All Groups");\r
- applyToAllGroups.setState(true);\r
- applyToAllGroups.addItemListener(this);\r
- font.setLabel("Font...");\r
- font.addActionListener(this);\r
- scaleAbove.setLabel("Scale Above");\r
- scaleAbove.setState(true);\r
- scaleAbove.setEnabled(false);\r
- scaleAbove.addItemListener(this);\r
- scaleLeft.setEnabled(false);\r
- scaleLeft.setState(true);\r
- scaleLeft.setLabel("Scale Left");\r
- scaleLeft.addItemListener(this);\r
- scaleRight.setEnabled(false);\r
- scaleRight.setState(true);\r
- scaleRight.setLabel("Scale Right");\r
- scaleRight.addItemListener(this);\r
- modifyPID.setLabel("Modify Identity Threshold...");\r
- modifyPID.addActionListener(this);\r
- modifyConservation.setLabel("Modify Conservation Threshold...");\r
- modifyConservation.addActionListener(this);\r
- sortByTreeMenu.setLabel("By Tree Order");\r
- sort.setLabel("Sort");\r
- calculate.setLabel("Calculate Tree");\r
- autoCalculate.addItemListener(this);\r
- sortByTree.addItemListener(this);\r
- inputText.setLabel("Input from textbox");\r
- inputText.addActionListener(this);\r
- centreColumnLabelFlag.setLabel("Centre column labels");\r
- centreColumnLabelFlag.addItemListener(this);\r
- followMouseOverFlag.setLabel("Automatic Scrolling");\r
- followMouseOverFlag.addItemListener(this);\r
- helpMenu.setLabel("Help");\r
- documentation.setLabel("Documentation");\r
- documentation.addActionListener(this);\r
-\r
- about.setLabel("About...");\r
- about.addActionListener(this);\r
- seqLimits.setState(true);\r
- seqLimits.setLabel("Show Sequence Limits");\r
- seqLimits.addItemListener(this);\r
- featureSettings.setLabel("Feature Settings...");\r
- featureSettings.addActionListener(this);\r
- sequenceFeatures.setLabel("Sequence Features");\r
- sequenceFeatures.addItemListener(this);\r
- sequenceFeatures.setState(false);\r
- annotationColour.setLabel("by Annotation...");\r
- annotationColour.addActionListener(this);\r
- invertSequenceMenuItem.setLabel("Invert Sequence Selection");\r
- invertColSel.setLabel("Invert Column Selection");\r
- menu1.setLabel("Show");\r
- showColumns.setLabel("All Columns ");\r
- showSeqs.setLabel("All Sequences");\r
- menu2.setLabel("Hide");\r
- hideColumns.setLabel("Selected Columns");\r
- hideSequences.setLabel("Selected Sequences");\r
- hideAllButSelection.setLabel("All but Selected Region (Shift+Ctrl+H)");\r
- hideAllSelection.setLabel("Selected Region");\r
- showAllHidden.setLabel("All Sequences and Columns");\r
- showGroupConsensus.setLabel("Group Consensus");\r
- showGroupConservation.setLabel("Group Conservation");\r
- showConsensusHistogram.setLabel("Show Consensus Histogram");\r
- showSequenceLogo.setLabel("Show Consensus Logo");\r
- normSequenceLogo.setLabel("Normalise Consensus Logo");\r
- applyAutoAnnotationSettings.setLabel("Apply to all groups");\r
- applyAutoAnnotationSettings.setState(true);\r
- autoAnnMenu.setLabel("Autocalculated Annotation");\r
-\r
- invertColSel.addActionListener(this);\r
- showColumns.addActionListener(this);\r
- showSeqs.addActionListener(this);\r
- hideColumns.addActionListener(this);\r
- hideSequences.addActionListener(this);\r
- hideAllButSelection.addActionListener(this);\r
- hideAllSelection.addActionListener(this);\r
- showAllHidden.addActionListener(this);\r
- showGroupConsensus.addItemListener(this);\r
- showGroupConservation.addItemListener(this);\r
- showConsensusHistogram.addItemListener(this);\r
- showSequenceLogo.addItemListener(this);\r
- normSequenceLogo.addItemListener(this);\r
-\r
- applyAutoAnnotationSettings.addItemListener(this);\r
- formatMenu.setLabel("Format");\r
- selectMenu.setLabel("Select");\r
- newView.setLabel("New View");\r
- newView.addActionListener(this);\r
- alignFrameMenuBar.add(fileMenu);\r
- alignFrameMenuBar.add(editMenu);\r
- alignFrameMenuBar.add(selectMenu);\r
- alignFrameMenuBar.add(viewMenu);\r
- alignFrameMenuBar.add(formatMenu);\r
- alignFrameMenuBar.add(colourMenu);\r
- alignFrameMenuBar.add(calculateMenu);\r
- alignFrameMenuBar.add(helpMenu);\r
-\r
- fileMenu.add(inputText);\r
- fileMenu.add(loadTree);\r
- fileMenu.add(loadAnnotations);\r
-\r
- fileMenu.addSeparator();\r
- fileMenu.add(outputTextboxMenu);\r
- fileMenu.add(outputFeatures);\r
- fileMenu.add(outputAnnotations);\r
-\r
- if (jalviewServletURL != null)\r
- {\r
- fileMenu.add(loadApplication);\r
- }\r
-\r
- fileMenu.addSeparator();\r
- fileMenu.add(closeMenuItem);\r
-\r
- editMenu.add(undoMenuItem);\r
- editMenu.add(redoMenuItem);\r
- editMenu.add(cut);\r
- editMenu.add(copy);\r
- editMenu.add(pasteMenu);\r
- editMenu.add(delete);\r
- editMenu.addSeparator();\r
- editMenu.add(remove2LeftMenuItem);\r
- editMenu.add(remove2RightMenuItem);\r
- editMenu.add(removeGappedColumnMenuItem);\r
- editMenu.add(removeAllGapsMenuItem);\r
- editMenu.add(removeRedundancyMenuItem);\r
- viewMenu.add(newView);\r
- viewMenu.addSeparator();\r
- viewMenu.add(menu1);\r
- viewMenu.add(menu2);\r
- viewMenu.addSeparator();\r
- viewMenu.add(followMouseOverFlag);\r
- viewMenu.add(annotationPanelMenuItem);\r
- autoAnnMenu.add(applyAutoAnnotationSettings);\r
- autoAnnMenu.add(showConsensusHistogram);\r
- autoAnnMenu.add(showSequenceLogo);\r
- autoAnnMenu.add(normSequenceLogo);\r
- autoAnnMenu.addSeparator();\r
- autoAnnMenu.add(showGroupConservation);\r
- autoAnnMenu.add(showGroupConsensus);\r
- viewMenu.add(autoAnnMenu);\r
- viewMenu.addSeparator();\r
- viewMenu.add(sequenceFeatures);\r
- viewMenu.add(featureSettings);\r
- viewMenu.addSeparator();\r
- viewMenu.add(alProperties);\r
- viewMenu.addSeparator();\r
- viewMenu.add(overviewMenuItem);\r
- colourMenu.add(applyToAllGroups);\r
- colourMenu.addSeparator();\r
- colourMenu.add(noColourmenuItem);\r
- colourMenu.add(clustalColour);\r
- colourMenu.add(BLOSUM62Colour);\r
- colourMenu.add(PIDColour);\r
- colourMenu.add(zappoColour);\r
- colourMenu.add(taylorColour);\r
- colourMenu.add(hydrophobicityColour);\r
- colourMenu.add(helixColour);\r
- colourMenu.add(strandColour);\r
- colourMenu.add(turnColour);\r
- colourMenu.add(buriedColour);\r
- colourMenu.add(nucleotideColour);\r
- colourMenu.add(purinePyrimidineColour);\r
- colourMenu.add(tcoffeeColour);\r
- colourMenu.add(userDefinedColour);\r
- colourMenu.addSeparator();\r
- colourMenu.add(conservationMenuItem);\r
- colourMenu.add(modifyConservation);\r
- colourMenu.add(abovePIDThreshold);\r
- colourMenu.add(modifyPID);\r
- colourMenu.add(annotationColour);\r
- colourMenu.add(RNAHelixColour);\r
- calculateMenu.add(sort);\r
- calculateMenu.add(calculate);\r
- calculateMenu.addSeparator();\r
- calculateMenu.add(pairwiseAlignmentMenuItem);\r
- calculateMenu.add(PCAMenuItem);\r
- calculateMenu.add(autoCalculate);\r
- calculateMenu.add(sortByTree);\r
- this.add(statusBar, BorderLayout.SOUTH);\r
- pasteMenu.add(pasteNew);\r
- pasteMenu.add(pasteThis);\r
- sort.add(sortIDMenuItem);\r
- sort.add(sortLengthMenuItem);\r
- sort.add(sortByTreeMenu);\r
- sort.add(sortGroupMenuItem);\r
- sort.add(sortPairwiseMenuItem);\r
- calculate.add(averageDistanceTreeMenuItem);\r
- calculate.add(neighbourTreeMenuItem);\r
- calculate.add(avDistanceTreeBlosumMenuItem);\r
- calculate.add(njTreeBlosumMenuItem);\r
- helpMenu.add(documentation);\r
- helpMenu.add(about);\r
- menu1.add(showColumns);\r
- menu1.add(showSeqs);\r
- menu1.add(showAllHidden);\r
- menu2.add(hideColumns);\r
- menu2.add(hideSequences);\r
- menu2.add(hideAllSelection);\r
- menu2.add(hideAllButSelection);\r
- formatMenu.add(font);\r
- formatMenu.add(seqLimits);\r
- formatMenu.add(wrapMenuItem);\r
- formatMenu.add(scaleAbove);\r
- formatMenu.add(scaleLeft);\r
- formatMenu.add(scaleRight);\r
- formatMenu.add(viewBoxesMenuItem);\r
- formatMenu.add(viewTextMenuItem);\r
- formatMenu.add(colourTextMenuItem);\r
- formatMenu.add(displayNonconservedMenuItem);\r
- formatMenu.add(renderGapsMenuItem);\r
- formatMenu.add(centreColumnLabelFlag);\r
- selectMenu.add(findMenuItem);\r
- selectMenu.addSeparator();\r
- selectMenu.add(selectAllSequenceMenuItem);\r
- selectMenu.add(deselectAllSequenceMenuItem);\r
- selectMenu.add(invertSequenceMenuItem);\r
- selectMenu.add(invertColSel);\r
- selectMenu.add(grpsFromSelection);\r
- selectMenu.add(deleteGroups);\r
-\r
- }\r
-\r
- MenuItem featureSettings = new MenuItem();\r
-\r
- CheckboxMenuItem sequenceFeatures = new CheckboxMenuItem();\r
-\r
- MenuItem annotationColour = new MenuItem();\r
-\r
- MenuItem invertColSel = new MenuItem();\r
-\r
- Menu menu1 = new Menu();\r
-\r
- MenuItem showColumns = new MenuItem();\r
-\r
- MenuItem showSeqs = new MenuItem();\r
-\r
- Menu menu2 = new Menu();\r
-\r
- MenuItem hideColumns = new MenuItem();\r
-\r
- MenuItem hideSequences = new MenuItem();\r
-\r
- MenuItem hideAllButSelection = new MenuItem();\r
-\r
- MenuItem hideAllSelection = new MenuItem();\r
-\r
- MenuItem showAllHidden = new MenuItem();\r
-\r
- Menu formatMenu = new Menu();\r
-\r
- Menu selectMenu = new Menu();\r
-\r
- MenuItem newView = new MenuItem();\r
-\r
- /**\r
- * Attach the alignFrame panels after embedding menus, if necessary. This used\r
- * to be called setEmbedded, but is now creates the dropdown menus in a\r
- * platform independent manner to avoid OSX/Mac menu appendage daftness.\r
- * \r
- * @param reallyEmbedded\r
- * true to attach the view to the applet area on the page rather than\r
- * in a new window\r
- */\r
- public void createAlignFrameWindow(boolean reallyEmbedded, String title)\r
- {\r
- if (reallyEmbedded)\r
- {\r
- // ////\r
- // Explicly build the embedded menu panel for the on-page applet\r
- //\r
- // view cannot be closed if its actually on the page\r
- fileMenu.remove(closeMenuItem);\r
- fileMenu.remove(3); // Remove Seperator\r
- embeddedMenu = makeEmbeddedPopupMenu(alignFrameMenuBar, "Arial",\r
- Font.PLAIN, 10, false); // use our own fonts.\r
- // and actually add the components to the applet area\r
- viewport.applet.setLayout(new BorderLayout());\r
- viewport.applet.add(embeddedMenu, BorderLayout.NORTH);\r
- viewport.applet.add(statusBar, BorderLayout.SOUTH);\r
- alignPanel.setSize(viewport.applet.getSize().width,\r
- viewport.applet.getSize().height - embeddedMenu.HEIGHT\r
- - statusBar.HEIGHT);\r
- viewport.applet.add(alignPanel, BorderLayout.CENTER);\r
- final AlignFrame me = this;\r
- viewport.applet.addFocusListener(new FocusListener()\r
- {\r
-\r
- @Override\r
- public void focusLost(FocusEvent e)\r
- {\r
- if (me.viewport.applet.currentAlignFrame == me)\r
- {\r
- me.viewport.applet.currentAlignFrame = null;\r
- }\r
- }\r
-\r
- @Override\r
- public void focusGained(FocusEvent e)\r
- {\r
- me.viewport.applet.currentAlignFrame = me;\r
- }\r
- });\r
- viewport.applet.validate();\r
- }\r
- else\r
- {\r
- // //////\r
- // test and embed menu bar if necessary.\r
- //\r
- if (embedMenuIfNeeded(alignPanel))\r
- {\r
- // adjust for status bar height too\r
- alignPanel.setSize(getSize().width, getSize().height\r
- - statusBar.HEIGHT);\r
- }\r
- add(statusBar, BorderLayout.SOUTH);\r
- add(alignPanel, BorderLayout.CENTER);\r
- // and register with the applet so it can pass external API calls to us\r
- jalview.bin.JalviewLite.addFrame(this, title, DEFAULT_WIDTH,\r
- DEFAULT_HEIGHT);\r
- }\r
- }\r
-\r
- /**\r
- * create a new binding between structures in an existing jmol viewer instance\r
- * and an alignpanel with sequences that have existing PDBFile entries. Note,\r
- * this does not open a new Jmol window, or modify the display of the\r
- * structures in the original jmol window. Note This method doesn't work\r
- * without an additional javascript library to exchange messages between the\r
- * distinct applets. See http://issues.jalview.org/browse/JAL-621\r
- * \r
- * @param viewer\r
- * JmolViewer instance\r
- * @param sequenceIds\r
- * - sequence Ids to search for associations\r
- */\r
- public SequenceStructureBinding addStructureViewInstance(\r
- Object jmolviewer, String[] sequenceIds)\r
- {\r
- org.jmol.api.JmolViewer viewer = null;\r
- try\r
- {\r
- viewer = (org.jmol.api.JmolViewer) jmolviewer;\r
- } catch (ClassCastException ex)\r
- {\r
- System.err.println("Unsupported viewer object :"\r
- + jmolviewer.getClass());\r
- }\r
- if (viewer == null)\r
- {\r
- System.err.println("Can't use this object as a structure viewer:"\r
- + jmolviewer.getClass());\r
- return null;\r
- }\r
- SequenceI[] seqs = null;\r
- if (sequenceIds == null || sequenceIds.length == 0)\r
- {\r
- seqs = viewport.getAlignment().getSequencesArray();\r
- }\r
- else\r
- {\r
- Vector sqi = new Vector();\r
- AlignmentI al = viewport.getAlignment();\r
- for (int sid = 0; sid < sequenceIds.length; sid++)\r
- {\r
- SequenceI sq = al.findName(sequenceIds[sid]);\r
- if (sq != null)\r
- {\r
- sqi.addElement(sq);\r
- }\r
- }\r
- if (sqi.size() > 0)\r
- {\r
- seqs = new SequenceI[sqi.size()];\r
- for (int sid = 0, sSize = sqi.size(); sid < sSize; sid++)\r
- {\r
- seqs[sid] = (SequenceI) sqi.elementAt(sid);\r
- }\r
- }\r
- else\r
- {\r
- return null;\r
- }\r
- }\r
- ExtJmol jmv = null;\r
- // TODO: search for a jmv that involves viewer\r
- if (jmv == null)\r
- { // create a new viewer/jalview binding.\r
- jmv = new ExtJmol(viewer, alignPanel, new SequenceI[][]\r
- { seqs });\r
- }\r
- return jmv;\r
-\r
- }\r
-\r
- /**\r
- * bind a pdb file to a sequence in the current view\r
- * \r
- * @param sequenceId\r
- * - sequenceId within the dataset.\r
- * @param pdbEntryString\r
- * - the short name for the PDB file\r
- * @param pdbFile\r
- * - pdb file - either a URL or a valid PDB file.\r
- * @return true if binding was as success TODO: consider making an exception\r
- * structure for indicating when PDB parsing or sequenceId location\r
- * fails.\r
- */\r
- public boolean addPdbFile(String sequenceId, String pdbEntryString,\r
- String pdbFile)\r
- {\r
- SequenceI toaddpdb = viewport.getAlignment().findName(sequenceId);\r
- boolean needtoadd = false;\r
- if (toaddpdb != null)\r
- {\r
- Vector pdbe = toaddpdb.getPDBId();\r
- PDBEntry pdbentry = null;\r
- if (pdbe != null && pdbe.size() > 0)\r
- {\r
- for (int pe = 0, peSize = pdbe.size(); pe < peSize; pe++)\r
- {\r
- pdbentry = (PDBEntry) pdbe.elementAt(pe);\r
- if (!pdbentry.getId().equals(pdbEntryString)\r
- && !pdbentry.getFile().equals(pdbFile))\r
- {\r
- pdbentry = null;\r
- }\r
- else\r
- {\r
- continue;\r
- }\r
- }\r
- }\r
- if (pdbentry == null)\r
- {\r
- pdbentry = new PDBEntry();\r
- pdbentry.setId(pdbEntryString);\r
- pdbentry.setFile(pdbFile);\r
- needtoadd = true; // add this new entry to sequence.\r
- }\r
- // resolve data source\r
- // TODO: this code should be a refactored to an io package\r
- String protocol = AppletFormatAdapter.resolveProtocol(pdbFile, "PDB");\r
- if (protocol == null)\r
- {\r
- return false;\r
- }\r
- if (needtoadd)\r
- {\r
- // make a note of the access mode and add\r
- if (pdbentry.getProperty() == null)\r
- {\r
- pdbentry.setProperty(new Hashtable());\r
- }\r
- pdbentry.getProperty().put("protocol", protocol);\r
- toaddpdb.addPDBId(pdbentry);\r
- }\r
- }\r
- return true;\r
- }\r
-\r
- private Object[] cleanSeqChainArrays(SequenceI[] seqs, String[] chains)\r
- {\r
- if (seqs != null)\r
- {\r
- Vector sequences = new Vector();\r
- for (int i = 0; i < seqs.length; i++)\r
- {\r
- if (seqs[i] != null)\r
- {\r
- sequences.addElement(new Object[]\r
- { seqs[i], (chains != null) ? chains[i] : null });\r
- }\r
- }\r
- seqs = new SequenceI[sequences.size()];\r
- chains = new String[sequences.size()];\r
- for (int i = 0, isize = sequences.size(); i < isize; i++)\r
- {\r
- Object[] oj = (Object[]) sequences.elementAt(i);\r
-\r
- seqs[i] = (SequenceI) oj[0];\r
- chains[i] = (String) oj[1];\r
- }\r
- }\r
- return new Object[]\r
- { seqs, chains };\r
-\r
- }\r
-\r
- public void newStructureView(JalviewLite applet, PDBEntry pdb,\r
- SequenceI[] seqs, String[] chains, String protocol)\r
- {\r
- // Scrub any null sequences from the array\r
- Object[] sqch = cleanSeqChainArrays(seqs, chains);\r
- seqs = (SequenceI[]) sqch[0];\r
- chains = (String[]) sqch[1];\r
- if (seqs == null || seqs.length == 0)\r
- {\r
- System.err\r
- .println("JalviewLite.AlignFrame:newStructureView: No sequence to bind structure to.");\r
- }\r
- if (protocol == null || protocol.trim().length() == 0\r
- || protocol.equals("null"))\r
- {\r
- protocol = (String) pdb.getProperty().get("protocol");\r
- if (protocol == null)\r
- {\r
- System.err.println("Couldn't work out protocol to open structure: "\r
- + pdb.getId());\r
- return;\r
- }\r
- }\r
- if (applet.useXtrnalSviewer)\r
- {\r
- // register the association(s) and quit, don't create any windows.\r
- if (StructureSelectionManager.getStructureSelectionManager(applet)\r
- .setMapping(seqs, chains, pdb.getFile(), protocol) == null)\r
- {\r
- System.err.println("Failed to map " + pdb.getFile() + " ("\r
- + protocol + ") to any sequences");\r
- }\r
- return;\r
- }\r
- if (applet.isAlignPdbStructures() && applet.jmolAvailable)\r
- {\r
- // can only do alignments with Jmol\r
- // find the last jmol window assigned to this alignment\r
- jalview.appletgui.AppletJmol ajm = null, tajm;\r
- Vector jmols = applet\r
- .getAppletWindow(jalview.appletgui.AppletJmol.class);\r
- for (int i = 0, iSize = jmols.size(); i < iSize; i++)\r
- {\r
- tajm = (jalview.appletgui.AppletJmol) jmols.elementAt(i);\r
- if (tajm.ap.alignFrame == this)\r
- {\r
- ajm = tajm;\r
- break;\r
- }\r
- }\r
- if (ajm != null)\r
- {\r
- System.err\r
- .println("Incremental adding and aligning structure to existing Jmol view not yet implemented.");\r
- // try and add the pdb structure\r
- // ajm.addS\r
- ajm = null;\r
- }\r
- }\r
- // otherwise, create a new window\r
- if (applet.jmolAvailable)\r
- {\r
- new jalview.appletgui.AppletJmol(pdb, seqs, chains, alignPanel,\r
- protocol);\r
- applet.lastFrameX += 40;\r
- applet.lastFrameY += 40;\r
- }\r
- else\r
- {\r
- new MCview.AppletPDBViewer(pdb, seqs, chains, alignPanel, protocol);\r
- }\r
-\r
- }\r
-\r
- public void alignedStructureView(JalviewLite applet, PDBEntry[] pdb,\r
- SequenceI[][] seqs, String[][] chains, String[] protocols)\r
- {\r
- // TODO Auto-generated method stub\r
- System.err.println("Aligned Structure View: Not yet implemented.");\r
- }\r
-\r
- /**\r
- * modify the current selection, providing the user has not made a selection\r
- * already.\r
- * \r
- * @param sel\r
- * - sequences from this alignment\r
- * @param csel\r
- * - columns to be selected on the alignment\r
- */\r
- public void select(SequenceGroup sel, ColumnSelection csel)\r
- {\r
- alignPanel.seqPanel.selection(sel, csel, null);\r
- }\r
-\r
- public void scrollTo(int row, int column)\r
- {\r
- alignPanel.seqPanel.scrollTo(row, column);\r
- }\r
-\r
- public void scrollToRow(int row)\r
- {\r
- alignPanel.seqPanel.scrollToRow(row);\r
- }\r
-\r
- public void scrollToColumn(int column)\r
- {\r
- alignPanel.seqPanel.scrollToColumn(column);\r
- }\r
-\r
- /**\r
- * @return the alignments unique ID.\r
- */\r
- public String getSequenceSetId()\r
- {\r
- return viewport.getSequenceSetId();\r
- }\r
-\r
- /**\r
- * Load the (T-Coffee) score file from the specified url\r
- * \r
- * @param source\r
- * File/URL/T-COFFEE score file contents\r
- * @throws IOException\r
- * @return true if alignment was annotated with data from source\r
- */\r
- public boolean loadScoreFile(String source) throws IOException\r
- {\r
-\r
- TCoffeeScoreFile file = new TCoffeeScoreFile(source,\r
- AppletFormatAdapter.checkProtocol(source));\r
- if (!file.isValid())\r
- {\r
- // TODO: raise dialog for gui\r
- System.err.println("Problems parsing T-Coffee scores: "\r
- + file.getWarningMessage());\r
- System.err.println("Origin was:\n" + source);\r
- return false;\r
- }\r
-\r
- /*\r
- * check that the score matrix matches the alignment dimensions\r
- */\r
- AlignmentI aln;\r
- if ((aln = viewport.getAlignment()) != null\r
- && (aln.getHeight() != file.getHeight() || aln.getWidth() != file\r
- .getWidth()))\r
- {\r
- // TODO: raise a dialog box here rather than bomb out.\r
- System.err\r
- .println("The scores matrix does not match the alignment dimensions");\r
-\r
- }\r
-\r
- // TODO add parameter to indicate if matching should be done\r
- if (file.annotateAlignment(alignPanel.getAlignment(), false))\r
- {\r
- alignPanel.fontChanged();\r
- tcoffeeColour.setEnabled(true);\r
- // switch to this color\r
- changeColour(new TCoffeeColourScheme(alignPanel.getAlignment()));\r
- return true;\r
- }\r
- else\r
- {\r
- System.err.println("Problems resolving T-Coffee scores:");\r
- if (file.getWarningMessage() != null)\r
- {\r
- System.err.println(file.getWarningMessage());\r
- }\r
- }\r
- return false;\r
- }\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.appletgui;
+
+import jalview.analysis.AAFrequency;
+import jalview.analysis.AlignmentSorter;
+import jalview.analysis.Conservation;
+import jalview.api.SequenceStructureBinding;
+import jalview.bin.JalviewLite;
+import jalview.commands.CommandI;
+import jalview.commands.EditCommand;
+import jalview.commands.OrderCommand;
+import jalview.commands.RemoveGapColCommand;
+import jalview.commands.RemoveGapsCommand;
+import jalview.commands.SlideSequencesCommand;
+import jalview.commands.TrimRegionCommand;
+import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.AlignmentOrder;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.PDBEntry;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceCollectionI;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
+import jalview.io.AnnotationFile;
+import jalview.io.AppletFormatAdapter;
+import jalview.io.FeaturesFile;
+import jalview.io.TCoffeeScoreFile;
+import jalview.schemes.Blosum62ColourScheme;
+import jalview.schemes.BuriedColourScheme;
+import jalview.schemes.ClustalxColourScheme;
+import jalview.schemes.ColourSchemeI;
+import jalview.schemes.HelixColourScheme;
+import jalview.schemes.HydrophobicColourScheme;
+import jalview.schemes.NucleotideColourScheme;
+import jalview.schemes.PIDColourScheme;
+import jalview.schemes.PurinePyrimidineColourScheme;
+import jalview.schemes.RNAHelicesColourChooser;
+import jalview.schemes.ResidueProperties;
+import jalview.schemes.StrandColourScheme;
+import jalview.schemes.TCoffeeColourScheme;
+import jalview.schemes.TaylorColourScheme;
+import jalview.schemes.TurnColourScheme;
+import jalview.schemes.ZappoColourScheme;
+import jalview.structure.StructureSelectionManager;
+
+import java.awt.BorderLayout;
+import java.awt.Canvas;
+import java.awt.CheckboxMenuItem;
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Frame;
+import java.awt.Graphics;
+import java.awt.Label;
+import java.awt.Menu;
+import java.awt.MenuBar;
+import java.awt.MenuItem;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.net.URLEncoder;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+public class AlignFrame extends EmbmenuFrame implements ActionListener,
+ ItemListener, KeyListener
+{
+ public AlignmentPanel alignPanel;
+
+ public AlignViewport viewport;
+
+ int DEFAULT_WIDTH = 700;
+
+ int DEFAULT_HEIGHT = 500;
+
+ String jalviewServletURL;
+
+ public AlignFrame(AlignmentI al, jalview.bin.JalviewLite applet,
+ String title, boolean embedded)
+ {
+ if (applet != null)
+ {
+ jalviewServletURL = applet.getParameter("APPLICATION_URL");
+ }
+
+ try
+ {
+ jbInit();
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+
+ viewport = new AlignViewport(al, applet);
+ alignPanel = new AlignmentPanel(this, viewport);
+
+ viewport.updateConservation(alignPanel);
+ viewport.updateConsensus(alignPanel);
+
+ annotationPanelMenuItem.setState(viewport.showAnnotation);
+ displayNonconservedMenuItem.setState(viewport.getShowUnconserved());
+ followMouseOverFlag.setState(viewport.getFollowHighlight());
+ showGroupConsensus.setState(viewport.isShowGroupConsensus());
+ showGroupConservation.setState(viewport.isShowGroupConservation());
+ showConsensusHistogram.setState(viewport.isShowConsensusHistogram());
+ showSequenceLogo.setState(viewport.isShowSequenceLogo());
+ normSequenceLogo.setState(viewport.isNormaliseSequenceLogo());
+
+ seqLimits.setState(viewport.showJVSuffix);
+
+ if (applet != null)
+ {
+ String param = applet.getParameter("sortBy");
+ if (param != null)
+ {
+ if (param.equalsIgnoreCase("Id"))
+ {
+ sortIDMenuItem_actionPerformed();
+ }
+ else if (param.equalsIgnoreCase("Pairwise Identity"))
+ {
+ sortPairwiseMenuItem_actionPerformed();
+ }
+ else if (param.equalsIgnoreCase("Length"))
+ {
+ sortLengthMenuItem_actionPerformed();
+ }
+ }
+
+ param = applet.getParameter("wrap");
+ if (param != null)
+ {
+ if (param.equalsIgnoreCase("true"))
+ {
+ wrapMenuItem.setState(true);
+ wrapMenuItem_actionPerformed();
+ }
+ }
+ param = applet.getParameter("centrecolumnlabels");
+ if (param != null)
+ {
+ centreColumnLabelFlag.setState(true);
+ centreColumnLabelFlag_stateChanged();
+ }
+ try
+ {
+ param = applet.getParameter("windowWidth");
+ if (param != null)
+ {
+ int width = Integer.parseInt(param);
+ DEFAULT_WIDTH = width;
+ }
+ param = applet.getParameter("windowHeight");
+ if (param != null)
+ {
+ int height = Integer.parseInt(param);
+ DEFAULT_HEIGHT = height;
+ }
+ } catch (Exception ex)
+ {
+ }
+
+ }
+ if (viewport.getAlignment().isNucleotide())
+ {
+ viewport.updateStrucConsensus(alignPanel);
+ if (viewport.getAlignment().hasRNAStructure())
+ {
+ RNAHelixColour.setEnabled(true);
+ }
+ else
+ {
+ RNAHelixColour.setEnabled(false);
+ }
+ }
+ else
+ {
+ RNAHelixColour.setEnabled(false);
+ purinePyrimidineColour.setEnabled(false);
+ }
+ // Some JVMS send keyevents to Top frame or lowest panel,
+ // Havent worked out why yet. So add to both this frame and seqCanvas for
+ // now
+ this.addKeyListener(this);
+ alignPanel.seqPanel.seqCanvas.addKeyListener(this);
+ alignPanel.idPanel.idCanvas.addKeyListener(this);
+ alignPanel.scalePanel.addKeyListener(this);
+ alignPanel.annotationPanel.addKeyListener(this);
+ alignPanel.annotationPanelHolder.addKeyListener(this);
+ alignPanel.annotationSpaceFillerHolder.addKeyListener(this);
+ alignPanel.alabels.addKeyListener(this);
+ createAlignFrameWindow(embedded, title);
+
+ validate();
+ alignPanel.adjustAnnotationHeight();
+ alignPanel.paintAlignment(true);
+ }
+
+ public AlignViewport getAlignViewport()
+ {
+ return viewport;
+ }
+
+ public SeqCanvas getSeqcanvas()
+ {
+ return alignPanel.seqPanel.seqCanvas;
+ }
+
+ /**
+ * Load a features file onto the alignment
+ *
+ * @param file
+ * file URL, content, or other resolvable path
+ * @param type
+ * is protocol for accessing data referred to by file
+ */
+
+ public boolean parseFeaturesFile(String file, String type)
+ {
+ return parseFeaturesFile(file, type, true);
+ }
+
+ /**
+ * Load a features file onto the alignment
+ *
+ * @param file
+ * file URL, content, or other resolvable path
+ * @param type
+ * is protocol for accessing data referred to by file
+ * @param autoenabledisplay
+ * when true, display features flag will be automatically enabled if
+ * features are loaded
+ * @return true if data parsed as a features file
+ */
+ public boolean parseFeaturesFile(String file, String type,
+ boolean autoenabledisplay)
+ {
+ // TODO: test if importing a features file onto an alignment which already
+ // has features with links overwrites the original links.
+
+ Hashtable featureLinks = new Hashtable();
+ boolean featuresFile = false;
+ try
+ {
+ featuresFile = new jalview.io.FeaturesFile(file, type)
+ .parse(viewport.getAlignment(), alignPanel.seqPanel.seqCanvas
+ .getFeatureRenderer().featureColours, featureLinks,
+ true, viewport.applet.getDefaultParameter(
+ "relaxedidmatch", false));
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+
+ if (featuresFile)
+ {
+ if (featureLinks.size() > 0)
+ {
+ alignPanel.seqPanel.seqCanvas.getFeatureRenderer().featureLinks = featureLinks;
+ }
+ if (autoenabledisplay)
+ {
+ viewport.showSequenceFeatures = true;
+ sequenceFeatures.setState(true);
+ }
+ if (viewport.featureSettings != null)
+ {
+ viewport.featureSettings.refreshTable();
+ }
+ alignPanel.paintAlignment(true);
+ statusBar.setText("Successfully added features to alignment.");
+ }
+ return featuresFile;
+ }
+
+ @Override
+ public void keyPressed(KeyEvent evt)
+ {
+ if (viewport.cursorMode
+ && ((evt.getKeyCode() >= KeyEvent.VK_0 && evt.getKeyCode() <= KeyEvent.VK_9) || (evt
+ .getKeyCode() >= KeyEvent.VK_NUMPAD0 && evt
+ .getKeyCode() <= KeyEvent.VK_NUMPAD9))
+ && Character.isDigit(evt.getKeyChar()))
+ alignPanel.seqPanel.numberPressed(evt.getKeyChar());
+
+ switch (evt.getKeyCode())
+ {
+ case 27: // escape key
+ deselectAllSequenceMenuItem_actionPerformed();
+
+ alignPanel.alabels.cancelDrag();
+ break;
+ case KeyEvent.VK_X:
+ if (evt.isControlDown() || evt.isMetaDown())
+ {
+ cut_actionPerformed();
+ }
+ break;
+ case KeyEvent.VK_C:
+ if (viewport.cursorMode && !evt.isControlDown())
+ {
+ alignPanel.seqPanel.setCursorColumn();
+ }
+ if (evt.isControlDown() || evt.isMetaDown())
+ {
+ copy_actionPerformed();
+ }
+ break;
+ case KeyEvent.VK_V:
+ if (evt.isControlDown())
+ {
+ paste(evt.isShiftDown());
+ }
+ break;
+ case KeyEvent.VK_A:
+ if (evt.isControlDown() || evt.isMetaDown())
+ {
+ selectAllSequenceMenuItem_actionPerformed();
+ }
+ break;
+ case KeyEvent.VK_DOWN:
+ if (viewport.cursorMode)
+ {
+ alignPanel.seqPanel.moveCursor(0, 1);
+ }
+ else
+ {
+ moveSelectedSequences(false);
+ }
+ break;
+
+ case KeyEvent.VK_UP:
+ if (viewport.cursorMode)
+ {
+ alignPanel.seqPanel.moveCursor(0, -1);
+ }
+ else
+ {
+ moveSelectedSequences(true);
+ }
+ break;
+
+ case KeyEvent.VK_LEFT:
+ if (evt.isAltDown() || !viewport.cursorMode)
+ slideSequences(false, alignPanel.seqPanel.getKeyboardNo1());
+ else
+ alignPanel.seqPanel.moveCursor(-1, 0);
+ break;
+
+ case KeyEvent.VK_RIGHT:
+ if (evt.isAltDown() || !viewport.cursorMode)
+ slideSequences(true, alignPanel.seqPanel.getKeyboardNo1());
+ else
+ alignPanel.seqPanel.moveCursor(1, 0);
+ break;
+
+ case KeyEvent.VK_SPACE:
+ if (viewport.cursorMode)
+ {
+ alignPanel.seqPanel.insertGapAtCursor(evt.isControlDown()
+ || evt.isShiftDown() || evt.isAltDown());
+ }
+ break;
+
+ case KeyEvent.VK_DELETE:
+ case KeyEvent.VK_BACK_SPACE:
+ if (viewport.cursorMode)
+ {
+ alignPanel.seqPanel.deleteGapAtCursor(evt.isControlDown()
+ || evt.isShiftDown() || evt.isAltDown());
+ }
+ else
+ {
+ cut_actionPerformed();
+ alignPanel.seqPanel.seqCanvas.repaint();
+ }
+ break;
+
+ case KeyEvent.VK_S:
+ if (viewport.cursorMode)
+ {
+ alignPanel.seqPanel.setCursorRow();
+ }
+ break;
+ case KeyEvent.VK_P:
+ if (viewport.cursorMode)
+ {
+ alignPanel.seqPanel.setCursorPosition();
+ }
+ break;
+
+ case KeyEvent.VK_ENTER:
+ case KeyEvent.VK_COMMA:
+ if (viewport.cursorMode)
+ {
+ alignPanel.seqPanel.setCursorRowAndColumn();
+ }
+ break;
+
+ case KeyEvent.VK_Q:
+ if (viewport.cursorMode)
+ {
+ alignPanel.seqPanel.setSelectionAreaAtCursor(true);
+ }
+ break;
+ case KeyEvent.VK_M:
+ if (viewport.cursorMode)
+ {
+ alignPanel.seqPanel.setSelectionAreaAtCursor(false);
+ }
+ break;
+
+ case KeyEvent.VK_F2:
+ viewport.cursorMode = !viewport.cursorMode;
+ statusBar.setText("Keyboard editing mode is "
+ + (viewport.cursorMode ? "on" : "off"));
+ if (viewport.cursorMode)
+ {
+ alignPanel.seqPanel.seqCanvas.cursorX = viewport.startRes;
+ alignPanel.seqPanel.seqCanvas.cursorY = viewport.startSeq;
+ }
+ break;
+
+ case KeyEvent.VK_F:
+ if (evt.isControlDown())
+ {
+ findMenuItem_actionPerformed();
+ }
+ break;
+
+ case KeyEvent.VK_H:
+ {
+ boolean toggleSeqs = !evt.isControlDown();
+ boolean toggleCols = !evt.isShiftDown();
+ toggleHiddenRegions(toggleSeqs, toggleCols);
+ break;
+ }
+
+ case KeyEvent.VK_PAGE_UP:
+ if (viewport.wrapAlignment)
+ {
+ alignPanel.scrollUp(true);
+ }
+ else
+ {
+ alignPanel.setScrollValues(viewport.startRes, viewport.startSeq
+ - viewport.endSeq + viewport.startSeq);
+ }
+ break;
+
+ case KeyEvent.VK_PAGE_DOWN:
+ if (viewport.wrapAlignment)
+ {
+ alignPanel.scrollUp(false);
+ }
+ else
+ {
+ alignPanel.setScrollValues(viewport.startRes, viewport.startSeq
+ + viewport.endSeq - viewport.startSeq);
+ }
+ break;
+
+ case KeyEvent.VK_Z:
+ if (evt.isControlDown())
+ {
+ undoMenuItem_actionPerformed();
+ }
+ break;
+
+ case KeyEvent.VK_Y:
+ if (evt.isControlDown())
+ {
+ redoMenuItem_actionPerformed();
+ }
+ break;
+
+ case KeyEvent.VK_L:
+ if (evt.isControlDown())
+ {
+ trimAlignment(true);
+ }
+ break;
+
+ case KeyEvent.VK_R:
+ if (evt.isControlDown())
+ {
+ trimAlignment(false);
+ }
+ break;
+
+ case KeyEvent.VK_E:
+ if (evt.isControlDown())
+ {
+ if (evt.isShiftDown())
+ {
+ this.removeAllGapsMenuItem_actionPerformed();
+ }
+ else
+ {
+ removeGappedColumnMenuItem_actionPerformed();
+ }
+ }
+ break;
+ case KeyEvent.VK_I:
+ if (evt.isControlDown())
+ {
+ if (evt.isAltDown())
+ {
+ invertColSel_actionPerformed();
+ }
+ else
+ {
+ invertSequenceMenuItem_actionPerformed();
+ }
+ }
+ break;
+
+ case KeyEvent.VK_U:
+ if (evt.isControlDown())
+ {
+ this.deleteGroups_actionPerformed();
+ }
+ break;
+
+ case KeyEvent.VK_T:
+ if (evt.isControlDown())
+ {
+ newView(null);
+ }
+ break;
+
+ }
+ alignPanel.paintAlignment(true);
+ }
+
+ /**
+ * called by key handler and the hide all/show all menu items
+ *
+ * @param toggleSeqs
+ * @param toggleCols
+ */
+ private void toggleHiddenRegions(boolean toggleSeqs, boolean toggleCols)
+ {
+ boolean hide = false;
+ SequenceGroup sg = viewport.getSelectionGroup();
+ if (!toggleSeqs && !toggleCols)
+ {
+ // Hide everything by the current selection - this is a hack - we do the
+ // invert and then hide
+ // first check that there will be visible columns after the invert.
+ if ((viewport.getColumnSelection() != null
+ && viewport.getColumnSelection().getSelected() != null && viewport
+ .getColumnSelection().getSelected().size() > 0)
+ || (sg != null && sg.getSize() > 0 && sg.getStartRes() <= sg
+ .getEndRes()))
+ {
+ // now invert the sequence set, if required - empty selection implies
+ // that no hiding is required.
+ if (sg != null)
+ {
+ invertSequenceMenuItem_actionPerformed();
+ sg = viewport.getSelectionGroup();
+ toggleSeqs = true;
+
+ }
+ viewport.expandColSelection(sg, true);
+ // finally invert the column selection and get the new sequence
+ // selection and indicate it should be hidden.
+ invertColSel_actionPerformed();
+ toggleCols = true;
+ }
+ }
+
+ if (toggleSeqs)
+ {
+ if (sg != null && sg.getSize() != viewport.getAlignment().getHeight())
+ {
+ hide = true;
+ viewport.hideAllSelectedSeqs();
+ }
+ else if (!(toggleCols && viewport.getColumnSelection().getSelected()
+ .size() > 0))
+ {
+ viewport.showAllHiddenSeqs();
+ }
+ }
+
+ if (toggleCols)
+ {
+ if (viewport.getColumnSelection().getSelected().size() > 0)
+ {
+ viewport.hideSelectedColumns();
+ if (!toggleSeqs)
+ {
+ viewport.setSelectionGroup(sg);
+ }
+ }
+ else if (!hide)
+ {
+ viewport.showAllHiddenColumns();
+ }
+ }
+ }
+
+ @Override
+ public void keyReleased(KeyEvent evt)
+ {
+ }
+
+ @Override
+ public void keyTyped(KeyEvent evt)
+ {
+ }
+
+ @Override
+ public void itemStateChanged(ItemEvent evt)
+ {
+ if (evt.getSource() == displayNonconservedMenuItem)
+ {
+ displayNonconservedMenuItem_actionPerformed();
+ }
+ else if (evt.getSource() == colourTextMenuItem)
+ {
+ colourTextMenuItem_actionPerformed();
+ }
+ else if (evt.getSource() == wrapMenuItem)
+ {
+ wrapMenuItem_actionPerformed();
+ }
+ else if (evt.getSource() == scaleAbove)
+ {
+ viewport.setScaleAboveWrapped(scaleAbove.getState());
+ }
+ else if (evt.getSource() == scaleLeft)
+ {
+ viewport.setScaleLeftWrapped(scaleLeft.getState());
+ }
+ else if (evt.getSource() == scaleRight)
+ {
+ viewport.setScaleRightWrapped(scaleRight.getState());
+ }
+ else if (evt.getSource() == seqLimits)
+ {
+ seqLimits_itemStateChanged();
+ }
+ else if (evt.getSource() == viewBoxesMenuItem)
+ {
+ viewport.setShowBoxes(viewBoxesMenuItem.getState());
+ }
+ else if (evt.getSource() == viewTextMenuItem)
+ {
+ viewport.setShowText(viewTextMenuItem.getState());
+ }
+ else if (evt.getSource() == renderGapsMenuItem)
+ {
+ viewport.setRenderGaps(renderGapsMenuItem.getState());
+ }
+ else if (evt.getSource() == annotationPanelMenuItem)
+ {
+ viewport.setShowAnnotation(annotationPanelMenuItem.getState());
+ alignPanel.setAnnotationVisible(annotationPanelMenuItem.getState());
+ }
+ else if (evt.getSource() == sequenceFeatures)
+ {
+ viewport.showSequenceFeatures(sequenceFeatures.getState());
+ alignPanel.seqPanel.seqCanvas.repaint();
+ }
+ else if (evt.getSource() == conservationMenuItem)
+ {
+ conservationMenuItem_actionPerformed();
+ }
+ else if (evt.getSource() == abovePIDThreshold)
+ {
+ abovePIDThreshold_actionPerformed();
+ }
+ else if (evt.getSource() == applyToAllGroups)
+ {
+ viewport.setColourAppliesToAllGroups(applyToAllGroups.getState());
+ }
+ else if (evt.getSource() == autoCalculate)
+ {
+ viewport.autoCalculateConsensus = autoCalculate.getState();
+ }
+ else if (evt.getSource() == sortByTree)
+ {
+ viewport.sortByTree = sortByTree.getState();
+ }
+ else if (evt.getSource() == this.centreColumnLabelFlag)
+ {
+ centreColumnLabelFlag_stateChanged();
+ }
+ else if (evt.getSource() == this.followMouseOverFlag)
+ {
+ mouseOverFlag_stateChanged();
+ }
+ else if (evt.getSource() == showGroupConsensus)
+ {
+ showGroupConsensus_actionPerformed();
+ }
+ else if (evt.getSource() == showGroupConservation)
+ {
+ showGroupConservation_actionPerformed();
+ }
+ else if (evt.getSource() == showSequenceLogo)
+ {
+ showSequenceLogo_actionPerformed();
+ }
+ else if (evt.getSource() == normSequenceLogo)
+ {
+ normSequenceLogo_actionPerformed();
+ }
+ else if (evt.getSource() == showConsensusHistogram)
+ {
+ showConsensusHistogram_actionPerformed();
+ }
+ else if (evt.getSource() == applyAutoAnnotationSettings)
+ {
+ applyAutoAnnotationSettings_actionPerformed();
+ }
+ alignPanel.paintAlignment(true);
+ }
+
+ private void mouseOverFlag_stateChanged()
+ {
+ viewport.followHighlight = followMouseOverFlag.getState();
+ // TODO: could kick the scrollTo mechanism to reset view for current
+ // searchresults.
+ }
+
+ private void centreColumnLabelFlag_stateChanged()
+ {
+ viewport.centreColumnLabels = centreColumnLabelFlag.getState();
+ this.alignPanel.annotationPanel.repaint();
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent evt)
+ {
+ Object source = evt.getSource();
+
+ if (source == inputText)
+ {
+ inputText_actionPerformed();
+ }
+ else if (source == loadTree)
+ {
+ loadTree_actionPerformed();
+ }
+ else if (source == loadApplication)
+ {
+ launchFullApplication();
+ }
+ else if (source == loadAnnotations)
+ {
+ loadAnnotations();
+ }
+ else if (source == outputAnnotations)
+ {
+ outputAnnotations(true);
+ }
+ else if (source == outputFeatures)
+ {
+ outputFeatures(true, "Jalview");
+ }
+ else if (source == closeMenuItem)
+ {
+ closeMenuItem_actionPerformed();
+ }
+ else if (source == copy)
+ {
+ copy_actionPerformed();
+ }
+ else if (source == undoMenuItem)
+ {
+ undoMenuItem_actionPerformed();
+ }
+ else if (source == redoMenuItem)
+ {
+ redoMenuItem_actionPerformed();
+ }
+ else if (source == inputText)
+ {
+ inputText_actionPerformed();
+ }
+ else if (source == closeMenuItem)
+ {
+ closeMenuItem_actionPerformed();
+ }
+ else if (source == undoMenuItem)
+ {
+ undoMenuItem_actionPerformed();
+ }
+ else if (source == redoMenuItem)
+ {
+ redoMenuItem_actionPerformed();
+ }
+ else if (source == copy)
+ {
+ copy_actionPerformed();
+ }
+ else if (source == pasteNew)
+ {
+ pasteNew_actionPerformed();
+ }
+ else if (source == pasteThis)
+ {
+ pasteThis_actionPerformed();
+ }
+ else if (source == cut)
+ {
+ cut_actionPerformed();
+ }
+ else if (source == delete)
+ {
+ delete_actionPerformed();
+ }
+ else if (source == grpsFromSelection)
+ {
+ makeGrpsFromSelection_actionPerformed();
+ }
+ else if (source == deleteGroups)
+ {
+ deleteGroups_actionPerformed();
+ }
+ else if (source == selectAllSequenceMenuItem)
+ {
+ selectAllSequenceMenuItem_actionPerformed();
+ }
+ else if (source == deselectAllSequenceMenuItem)
+ {
+ deselectAllSequenceMenuItem_actionPerformed();
+ }
+ else if (source == invertSequenceMenuItem)
+ {
+ invertSequenceMenuItem_actionPerformed();
+ }
+ else if (source == invertColSel)
+ {
+ viewport.invertColumnSelection();
+ alignPanel.paintAlignment(true);
+ }
+ else if (source == remove2LeftMenuItem)
+ {
+ trimAlignment(true);
+ }
+ else if (source == remove2RightMenuItem)
+ {
+ trimAlignment(false);
+ }
+ else if (source == removeGappedColumnMenuItem)
+ {
+ removeGappedColumnMenuItem_actionPerformed();
+ }
+ else if (source == removeAllGapsMenuItem)
+ {
+ removeAllGapsMenuItem_actionPerformed();
+ }
+ else if (source == findMenuItem)
+ {
+ findMenuItem_actionPerformed();
+ }
+ else if (source == font)
+ {
+ new FontChooser(alignPanel);
+ }
+ else if (source == newView)
+ {
+ newView(null);
+ }
+ else if (source == showColumns)
+ {
+ viewport.showAllHiddenColumns();
+ alignPanel.paintAlignment(true);
+ }
+ else if (source == showSeqs)
+ {
+ viewport.showAllHiddenSeqs();
+ alignPanel.paintAlignment(true);
+ }
+ else if (source == hideColumns)
+ {
+ viewport.hideSelectedColumns();
+ alignPanel.paintAlignment(true);
+ }
+ else if (source == hideSequences
+ && viewport.getSelectionGroup() != null)
+ {
+ viewport.hideAllSelectedSeqs();
+ alignPanel.paintAlignment(true);
+ }
+ else if (source == hideAllButSelection)
+ {
+ toggleHiddenRegions(false, false);
+ alignPanel.paintAlignment(true);
+ }
+ else if (source == hideAllSelection)
+ {
+ SequenceGroup sg = viewport.getSelectionGroup();
+ viewport.expandColSelection(sg, false);
+ viewport.hideAllSelectedSeqs();
+ viewport.hideSelectedColumns();
+ alignPanel.paintAlignment(true);
+ }
+ else if (source == showAllHidden)
+ {
+ viewport.showAllHiddenColumns();
+ viewport.showAllHiddenSeqs();
+ alignPanel.paintAlignment(true);
+ }
+ else if (source == showGroupConsensus)
+ {
+ showGroupConsensus_actionPerformed();
+ }
+ else if (source == showGroupConservation)
+ {
+ showGroupConservation_actionPerformed();
+ }
+ else if (source == showSequenceLogo)
+ {
+ showSequenceLogo_actionPerformed();
+ }
+ else if (source == normSequenceLogo)
+ {
+ normSequenceLogo_actionPerformed();
+ }
+ else if (source == showConsensusHistogram)
+ {
+ showConsensusHistogram_actionPerformed();
+ }
+ else if (source == applyAutoAnnotationSettings)
+ {
+ applyAutoAnnotationSettings_actionPerformed();
+ }
+ else if (source == featureSettings)
+ {
+ new FeatureSettings(alignPanel);
+ }
+ else if (source == alProperties)
+ {
+ StringBuffer contents = new jalview.io.AlignmentProperties(
+ viewport.getAlignment()).formatAsString();
+ CutAndPasteTransfer cap = new CutAndPasteTransfer(false, this);
+ cap.setText(contents.toString());
+ Frame frame = new Frame();
+ frame.add(cap);
+ jalview.bin.JalviewLite.addFrame(frame, "Alignment Properties: "
+ + getTitle(), 400, 250);
+ }
+ else if (source == overviewMenuItem)
+ {
+ overviewMenuItem_actionPerformed();
+ }
+ else if (source == noColourmenuItem)
+ {
+ changeColour(null);
+ }
+ else if (source == clustalColour)
+ {
+ abovePIDThreshold.setState(false);
+ changeColour(new ClustalxColourScheme(viewport.getAlignment(), null));
+ }
+ else if (source == zappoColour)
+ {
+ changeColour(new ZappoColourScheme());
+ }
+ else if (source == taylorColour)
+ {
+ changeColour(new TaylorColourScheme());
+ }
+ else if (source == hydrophobicityColour)
+ {
+ changeColour(new HydrophobicColourScheme());
+ }
+ else if (source == helixColour)
+ {
+ changeColour(new HelixColourScheme());
+ }
+ else if (source == strandColour)
+ {
+ changeColour(new StrandColourScheme());
+ }
+ else if (source == turnColour)
+ {
+ changeColour(new TurnColourScheme());
+ }
+ else if (source == buriedColour)
+ {
+ changeColour(new BuriedColourScheme());
+ }
+ else if (source == nucleotideColour)
+ {
+ changeColour(new NucleotideColourScheme());
+ }
+ else if (source == purinePyrimidineColour)
+ {
+ changeColour(new PurinePyrimidineColourScheme());
+ }
+ else if (source == RNAHelixColour)
+ {
+ new RNAHelicesColourChooser(viewport, alignPanel);
+ }
+ else if (source == modifyPID)
+ {
+ modifyPID_actionPerformed();
+ }
+ else if (source == modifyConservation)
+ {
+ modifyConservation_actionPerformed();
+ }
+ else if (source == userDefinedColour)
+ {
+ new UserDefinedColours(alignPanel, null);
+ }
+ else if (source == PIDColour)
+ {
+ changeColour(new PIDColourScheme());
+ }
+ else if (source == BLOSUM62Colour)
+ {
+ changeColour(new Blosum62ColourScheme());
+ }
+ else if (source == tcoffeeColour)
+ {
+ changeColour(new TCoffeeColourScheme(alignPanel.getAlignment()));
+ }
+ else if (source == annotationColour)
+ {
+ new AnnotationColourChooser(viewport, alignPanel);
+ }
+ else if (source == sortPairwiseMenuItem)
+ {
+ sortPairwiseMenuItem_actionPerformed();
+ }
+ else if (source == sortIDMenuItem)
+ {
+ sortIDMenuItem_actionPerformed();
+ }
+ else if (source == sortLengthMenuItem)
+ {
+ sortLengthMenuItem_actionPerformed();
+ }
+ else if (source == sortGroupMenuItem)
+ {
+ sortGroupMenuItem_actionPerformed();
+ }
+ else if (source == removeRedundancyMenuItem)
+ {
+ removeRedundancyMenuItem_actionPerformed();
+ }
+ else if (source == pairwiseAlignmentMenuItem)
+ {
+ pairwiseAlignmentMenuItem_actionPerformed();
+ }
+ else if (source == PCAMenuItem)
+ {
+ PCAMenuItem_actionPerformed();
+ }
+ else if (source == averageDistanceTreeMenuItem)
+ {
+ averageDistanceTreeMenuItem_actionPerformed();
+ }
+ else if (source == neighbourTreeMenuItem)
+ {
+ neighbourTreeMenuItem_actionPerformed();
+ }
+ else if (source == njTreeBlosumMenuItem)
+ {
+ njTreeBlosumMenuItem_actionPerformed();
+ }
+ else if (source == avDistanceTreeBlosumMenuItem)
+ {
+ avTreeBlosumMenuItem_actionPerformed();
+ }
+ else if (source == documentation)
+ {
+ documentation_actionPerformed();
+ }
+ else if (source == about)
+ {
+ about_actionPerformed();
+ }
+
+ }
+
+ public void inputText_actionPerformed()
+ {
+ CutAndPasteTransfer cap = new CutAndPasteTransfer(true, this);
+ Frame frame = new Frame();
+ frame.add(cap);
+ jalview.bin.JalviewLite.addFrame(frame, "Cut & Paste Input", 500, 500);
+ }
+
+ protected void outputText_actionPerformed(ActionEvent e)
+ {
+ CutAndPasteTransfer cap = new CutAndPasteTransfer(true, this);
+ Frame frame = new Frame();
+ frame.add(cap);
+ jalview.bin.JalviewLite.addFrame(frame,
+ "Alignment output - " + e.getActionCommand(), 600, 500);
+ cap.setText(new AppletFormatAdapter().formatSequences(
+ e.getActionCommand(), viewport.getAlignment(),
+ viewport.showJVSuffix));
+ }
+
+ public void loadAnnotations()
+ {
+ CutAndPasteTransfer cap = new CutAndPasteTransfer(true, this);
+ cap.setText("Paste your features / annotations / T-coffee score file here.");
+ cap.setAnnotationImport();
+ Frame frame = new Frame();
+ frame.add(cap);
+ jalview.bin.JalviewLite.addFrame(frame, "Paste Annotations ", 400, 300);
+
+ }
+
+ public String outputAnnotations(boolean displayTextbox)
+ {
+ String annotation = new AnnotationFile().printAnnotations(
+ viewport.showAnnotation ? viewport.getAlignment()
+ .getAlignmentAnnotation() : null, viewport
+ .getAlignment().getGroups(), ((Alignment) viewport
+ .getAlignment()).alignmentProperties);
+
+ if (displayTextbox)
+ {
+ CutAndPasteTransfer cap = new CutAndPasteTransfer(false, this);
+ Frame frame = new Frame();
+ frame.add(cap);
+ jalview.bin.JalviewLite.addFrame(frame, "Annotations", 600, 500);
+ cap.setText(annotation);
+ }
+
+ return annotation;
+ }
+
+ private Hashtable getDisplayedFeatureCols()
+ {
+ if (alignPanel.getFeatureRenderer() != null
+ && viewport.featuresDisplayed != null)
+ {
+ FeatureRenderer fr = alignPanel.getFeatureRenderer();
+ Hashtable fcols = new Hashtable();
+ Enumeration en = viewport.featuresDisplayed.keys();
+ while (en.hasMoreElements())
+ {
+ Object col = en.nextElement();
+ fcols.put(col, fr.featureColours.get(col));
+ }
+ return fcols;
+ }
+ return null;
+ }
+
+ public String outputFeatures(boolean displayTextbox, String format)
+ {
+ String features;
+ if (format.equalsIgnoreCase("Jalview"))
+ {
+ features = new FeaturesFile().printJalviewFormat(viewport
+ .getAlignment().getSequencesArray(),
+ getDisplayedFeatureCols());
+ }
+ else
+ {
+ features = new FeaturesFile().printGFFFormat(viewport.getAlignment()
+ .getSequencesArray(), getDisplayedFeatureCols());
+ }
+
+ if (displayTextbox)
+ {
+ boolean frimport = false;
+ if (features == null || features.equals("No Features Visible"))
+ {
+ features = "# No features visible - paste some and import them here.";
+ frimport = true;
+ }
+
+ CutAndPasteTransfer cap = new CutAndPasteTransfer(frimport, this);
+ if (frimport)
+ {
+ cap.setAnnotationImport();
+ }
+ Frame frame = new Frame();
+ frame.add(cap);
+ jalview.bin.JalviewLite.addFrame(frame, "Features", 600, 500);
+ cap.setText(features);
+ }
+ else
+ {
+ if (features == null)
+ features = "";
+ }
+
+ return features;
+ }
+
+ void launchFullApplication()
+ {
+ StringBuffer url = new StringBuffer(jalviewServletURL);
+
+ url.append("?open="
+ + appendProtocol(viewport.applet.getParameter("file")));
+
+ if (viewport.applet.getParameter("features") != null)
+ {
+ url.append("&features=");
+ url.append(appendProtocol(viewport.applet.getParameter("features")));
+ }
+
+ if (viewport.applet.getParameter("annotations") != null)
+ {
+ url.append("&annotations=");
+ url.append(appendProtocol(viewport.applet.getParameter("annotations")));
+ }
+
+ if (viewport.applet.getParameter("jnetfile") != null)
+ {
+ url.append("&annotations=");
+ url.append(appendProtocol(viewport.applet.getParameter("jnetfile")));
+ }
+
+ if (viewport.applet.getParameter("defaultColour") != null)
+ {
+ url.append("&colour="
+ + removeWhiteSpace(viewport.applet
+ .getParameter("defaultColour")));
+ }
+
+ if (viewport.applet.getParameter("userDefinedColour") != null)
+ {
+ url.append("&colour="
+ + removeWhiteSpace(viewport.applet
+ .getParameter("userDefinedColour")));
+ }
+ if (viewport.applet.getParameter("tree") != null)
+ {
+ url.append("&tree="
+ + appendProtocol(viewport.applet.getParameter("tree")));
+ }
+ if (viewport.applet.getParameter("treeFile") != null)
+ {
+ url.append("&tree="
+ + appendProtocol(viewport.applet.getParameter("treeFile")));
+ }
+
+ showURL(url.toString(), "FULL_APP");
+ }
+
+ String removeWhiteSpace(String colour)
+ {
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < colour.length(); i++)
+ {
+ if (Character.isWhitespace(colour.charAt(i)))
+ {
+ sb.append("%20");
+ }
+ else
+ {
+ sb.append(colour.charAt(i));
+ }
+ }
+
+ return sb.toString();
+ }
+
+ String appendProtocol(String url)
+ {
+ try
+ {
+ new URL(url);
+ url = URLEncoder.encode(url);
+ }
+ /*
+ * When we finally deprecate 1.1 compatibility, we can start to use
+ * URLEncoder.encode(url,"UTF-8") and then we'll need this catch: catch
+ * (UnsupportedEncodingException ex) { System.err.println("WARNING -
+ * IMPLEMENTATION ERROR - UNSUPPORTED ENCODING EXCEPTION FOR "+url);
+ * ex.printStackTrace(); }
+ */
+ catch (java.net.MalformedURLException ex)
+ {
+ url = viewport.applet.getCodeBase() + url;
+ }
+ return url;
+ }
+
+ public void closeMenuItem_actionPerformed()
+ {
+ PaintRefresher.RemoveComponent(alignPanel);
+ if (alignPanel.seqPanel != null
+ && alignPanel.seqPanel.seqCanvas != null)
+ {
+ PaintRefresher.RemoveComponent(alignPanel.seqPanel.seqCanvas);
+ }
+ if (alignPanel.idPanel != null && alignPanel.idPanel.idCanvas != null)
+ {
+ PaintRefresher.RemoveComponent(alignPanel.idPanel.idCanvas);
+ }
+
+ if (PaintRefresher.components.size() == 0 && viewport.applet == null)
+ {
+ System.exit(0);
+ }
+ else
+ {
+ }
+ viewport = null;
+ alignPanel = null;
+ this.dispose();
+ }
+
+ /**
+ * TODO: JAL-1104
+ */
+ void updateEditMenuBar()
+ {
+
+ if (viewport.historyList.size() > 0)
+ {
+ undoMenuItem.setEnabled(true);
+ CommandI command = (CommandI) viewport.historyList.peek();
+ undoMenuItem.setLabel("Undo " + command.getDescription());
+ }
+ else
+ {
+ undoMenuItem.setEnabled(false);
+ undoMenuItem.setLabel("Undo");
+ }
+
+ if (viewport.redoList.size() > 0)
+ {
+ redoMenuItem.setEnabled(true);
+
+ CommandI command = (CommandI) viewport.redoList.peek();
+ redoMenuItem.setLabel("Redo " + command.getDescription());
+ }
+ else
+ {
+ redoMenuItem.setEnabled(false);
+ redoMenuItem.setLabel("Redo");
+ }
+ }
+
+ /**
+ * TODO: JAL-1104
+ */
+ public void addHistoryItem(CommandI command)
+ {
+ if (command.getSize() > 0)
+ {
+ viewport.historyList.push(command);
+ viewport.redoList.removeAllElements();
+ updateEditMenuBar();
+ viewport.updateHiddenColumns();
+ }
+ }
+
+ /**
+ * TODO: JAL-1104 DOCUMENT ME!
+ *
+ * @param e
+ * DOCUMENT ME!
+ */
+ protected void undoMenuItem_actionPerformed()
+ {
+ if (viewport.historyList.size() < 1)
+ {
+ return;
+ }
+
+ CommandI command = (CommandI) viewport.historyList.pop();
+ viewport.redoList.push(command);
+ command.undoCommand(null);
+
+ AlignViewport originalSource = getOriginatingSource(command);
+ // JBPNote Test
+ if (originalSource != viewport)
+ {
+ System.err
+ .println("Warning: Viewport object mismatch whilst undoing");
+ }
+ originalSource.updateHiddenColumns(); // originalSource.hasHiddenColumns =
+ // viewport.getColumnSelection().getHiddenColumns()
+ // != null;
+ updateEditMenuBar();
+ originalSource.firePropertyChange("alignment", null, originalSource
+ .getAlignment().getSequences());
+ }
+
+ /**
+ * TODO: JAL-1104 DOCUMENT ME!
+ *
+ * @param e
+ * DOCUMENT ME!
+ */
+ protected void redoMenuItem_actionPerformed()
+ {
+ if (viewport.redoList.size() < 1)
+ {
+ return;
+ }
+
+ CommandI command = (CommandI) viewport.redoList.pop();
+ viewport.historyList.push(command);
+ command.doCommand(null);
+
+ AlignViewport originalSource = getOriginatingSource(command);
+ // JBPNote Test
+ if (originalSource != viewport)
+ {
+ System.err
+ .println("Warning: Viewport object mismatch whilst re-doing");
+ }
+ originalSource.updateHiddenColumns(); // sethasHiddenColumns(); =
+ // viewport.getColumnSelection().getHiddenColumns()
+ // != null;
+
+ updateEditMenuBar();
+ originalSource.firePropertyChange("alignment", null, originalSource
+ .getAlignment().getSequences());
+ }
+
+ AlignViewport getOriginatingSource(CommandI command)
+ {
+ AlignViewport originalSource = null;
+ // For sequence removal and addition, we need to fire
+ // the property change event FROM the viewport where the
+ // original alignment was altered
+ AlignmentI al = null;
+ if (command instanceof EditCommand)
+ {
+ EditCommand editCommand = (EditCommand) command;
+ al = editCommand.getAlignment();
+ Vector comps = (Vector) PaintRefresher.components.get(viewport
+ .getSequenceSetId());
+ for (int i = 0; i < comps.size(); i++)
+ {
+ if (comps.elementAt(i) instanceof AlignmentPanel)
+ {
+ if (al == ((AlignmentPanel) comps.elementAt(i)).av.getAlignment())
+ {
+ originalSource = ((AlignmentPanel) comps.elementAt(i)).av;
+ break;
+ }
+ }
+ }
+ }
+
+ if (originalSource == null)
+ {
+ // The original view is closed, we must validate
+ // the current view against the closed view first
+ if (al != null)
+ {
+ PaintRefresher.validateSequences(al, viewport.getAlignment());
+ }
+
+ originalSource = viewport;
+ }
+
+ return originalSource;
+ }
+
+ public void moveSelectedSequences(boolean up)
+ {
+ SequenceGroup sg = viewport.getSelectionGroup();
+ if (sg == null)
+ {
+ return;
+ }
+ viewport.getAlignment().moveSelectedSequencesByOne(sg,
+ up ? null : viewport.getHiddenRepSequences(), up);
+ alignPanel.paintAlignment(true);
+ }
+
+ synchronized void slideSequences(boolean right, int size)
+ {
+ List<SequenceI> sg = new Vector<SequenceI>();
+ if (viewport.cursorMode)
+ {
+ sg.add(viewport.getAlignment().getSequenceAt(
+ alignPanel.seqPanel.seqCanvas.cursorY));
+ }
+ else if (viewport.getSelectionGroup() != null
+ && viewport.getSelectionGroup().getSize() != viewport
+ .getAlignment().getHeight())
+ {
+ sg = viewport.getSelectionGroup().getSequences(
+ viewport.getHiddenRepSequences());
+ }
+
+ if (sg.size() < 1)
+ {
+ return;
+ }
+
+ Vector<SequenceI> invertGroup = new Vector();
+
+ for (int i = 0; i < viewport.getAlignment().getHeight(); i++)
+ {
+ if (!sg.contains(viewport.getAlignment().getSequenceAt(i)))
+ invertGroup.addElement(viewport.getAlignment().getSequenceAt(i));
+ }
+
+ SequenceI[] seqs1 = sg.toArray(new SequenceI[sg.size()]);
+
+ SequenceI[] seqs2 = invertGroup.toArray(new SequenceI[invertGroup
+ .size()]);
+ for (int i = 0; i < invertGroup.size(); i++)
+ seqs2[i] = invertGroup.elementAt(i);
+
+ SlideSequencesCommand ssc;
+ if (right)
+ ssc = new SlideSequencesCommand("Slide Sequences", seqs2, seqs1,
+ size, viewport.getGapCharacter());
+ else
+ ssc = new SlideSequencesCommand("Slide Sequences", seqs1, seqs2,
+ size, viewport.getGapCharacter());
+
+ int groupAdjustment = 0;
+ if (ssc.getGapsInsertedBegin() && right)
+ {
+ if (viewport.cursorMode)
+ alignPanel.seqPanel.moveCursor(size, 0);
+ else
+ groupAdjustment = size;
+ }
+ else if (!ssc.getGapsInsertedBegin() && !right)
+ {
+ if (viewport.cursorMode)
+ alignPanel.seqPanel.moveCursor(-size, 0);
+ else
+ groupAdjustment = -size;
+ }
+
+ if (groupAdjustment != 0)
+ {
+ viewport.getSelectionGroup().setStartRes(
+ viewport.getSelectionGroup().getStartRes() + groupAdjustment);
+ viewport.getSelectionGroup().setEndRes(
+ viewport.getSelectionGroup().getEndRes() + groupAdjustment);
+ }
+
+ boolean appendHistoryItem = false;
+ if (viewport.historyList != null && viewport.historyList.size() > 0
+ && viewport.historyList.peek() instanceof SlideSequencesCommand)
+ {
+ appendHistoryItem = ssc
+ .appendSlideCommand((SlideSequencesCommand) viewport.historyList
+ .peek());
+ }
+
+ if (!appendHistoryItem)
+ addHistoryItem(ssc);
+
+ repaint();
+ }
+
+ static StringBuffer copiedSequences;
+
+ static Vector copiedHiddenColumns;
+
+ protected void copy_actionPerformed()
+ {
+ if (viewport.getSelectionGroup() == null)
+ {
+ return;
+ }
+
+ SequenceGroup sg = viewport.getSelectionGroup();
+ copiedSequences = new StringBuffer();
+ Hashtable orderedSeqs = new Hashtable();
+ for (int i = 0; i < sg.getSize(); i++)
+ {
+ SequenceI seq = sg.getSequenceAt(i);
+ int index = viewport.getAlignment().findIndex(seq);
+ orderedSeqs.put(index + "", seq);
+ }
+
+ int index = 0, startRes, endRes;
+ char ch;
+
+ if (viewport.hasHiddenColumns() && viewport.getSelectionGroup() != null)
+ {
+ copiedHiddenColumns = new Vector();
+ int hiddenOffset = viewport.getSelectionGroup().getStartRes();
+ for (int i = 0; i < viewport.getColumnSelection().getHiddenColumns()
+ .size(); i++)
+ {
+ int[] region = (int[]) viewport.getColumnSelection()
+ .getHiddenColumns().elementAt(i);
+
+ copiedHiddenColumns.addElement(new int[]
+ { region[0] - hiddenOffset, region[1] - hiddenOffset });
+ }
+ }
+ else
+ {
+ copiedHiddenColumns = null;
+ }
+
+ for (int i = 0; i < sg.getSize(); i++)
+ {
+ SequenceI seq = null;
+
+ while (seq == null)
+ {
+ if (orderedSeqs.containsKey(index + ""))
+ {
+ seq = (SequenceI) orderedSeqs.get(index + "");
+ index++;
+
+ break;
+ }
+ else
+ {
+ index++;
+ }
+ }
+
+ // FIND START RES
+ // Returns residue following index if gap
+ startRes = seq.findPosition(sg.getStartRes());
+
+ // FIND END RES
+ // Need to find the residue preceeding index if gap
+ endRes = 0;
+
+ for (int j = 0; j < sg.getEndRes() + 1 && j < seq.getLength(); j++)
+ {
+ ch = seq.getCharAt(j);
+ if (!jalview.util.Comparison.isGap((ch)))
+ {
+ endRes++;
+ }
+ }
+
+ if (endRes > 0)
+ {
+ endRes += seq.getStart() - 1;
+ }
+
+ copiedSequences.append(seq.getName()
+ + "\t"
+ + startRes
+ + "\t"
+ + endRes
+ + "\t"
+ + seq.getSequenceAsString(sg.getStartRes(),
+ sg.getEndRes() + 1) + "\n");
+ }
+
+ }
+
+ protected void pasteNew_actionPerformed()
+ {
+ paste(true);
+ }
+
+ protected void pasteThis_actionPerformed()
+ {
+ paste(false);
+ }
+
+ void paste(boolean newAlignment)
+ {
+ try
+ {
+
+ if (copiedSequences == null)
+ {
+ return;
+ }
+
+ StringTokenizer st = new StringTokenizer(copiedSequences.toString());
+ Vector seqs = new Vector();
+ while (st.hasMoreElements())
+ {
+ String name = st.nextToken();
+ int start = Integer.parseInt(st.nextToken());
+ int end = Integer.parseInt(st.nextToken());
+ seqs.addElement(new Sequence(name, st.nextToken(), start, end));
+ }
+ SequenceI[] newSeqs = new SequenceI[seqs.size()];
+ for (int i = 0; i < seqs.size(); i++)
+ {
+ newSeqs[i] = (SequenceI) seqs.elementAt(i);
+ }
+
+ if (newAlignment)
+ {
+ String newtitle = new String("Copied sequences");
+ if (getTitle().startsWith("Copied sequences"))
+ {
+ newtitle = getTitle();
+ }
+ else
+ {
+ newtitle = newtitle.concat("- from " + getTitle());
+ }
+ AlignFrame af = new AlignFrame(new Alignment(newSeqs),
+ viewport.applet, newtitle, false);
+ if (copiedHiddenColumns != null)
+ {
+ for (int i = 0; i < copiedHiddenColumns.size(); i++)
+ {
+ int[] region = (int[]) copiedHiddenColumns.elementAt(i);
+ af.viewport.hideColumns(region[0], region[1]);
+ }
+ }
+
+ jalview.bin.JalviewLite.addFrame(af, newtitle, DEFAULT_WIDTH,
+ DEFAULT_HEIGHT);
+ }
+ else
+ {
+ addSequences(newSeqs);
+ }
+
+ } catch (Exception ex)
+ {
+ } // could be anything being pasted in here
+
+ }
+
+ void addSequences(SequenceI[] seqs)
+ {
+ for (int i = 0; i < seqs.length; i++)
+ {
+ viewport.getAlignment().addSequence(seqs[i]);
+ }
+
+ // !newAlignment
+ addHistoryItem(new EditCommand("Add sequences", EditCommand.PASTE,
+ seqs, 0, viewport.getAlignment().getWidth(),
+ viewport.getAlignment()));
+
+ viewport.setEndSeq(viewport.getAlignment().getHeight());
+ viewport.getAlignment().getWidth();
+ viewport.firePropertyChange("alignment", null, viewport.getAlignment()
+ .getSequences());
+
+ }
+
+ protected void cut_actionPerformed()
+ {
+ copy_actionPerformed();
+ delete_actionPerformed();
+ }
+
+ protected void delete_actionPerformed()
+ {
+
+ SequenceGroup sg = viewport.getSelectionGroup();
+ if (sg == null)
+ {
+ return;
+ }
+
+ Vector seqs = new Vector();
+ SequenceI seq;
+ for (int i = 0; i < sg.getSize(); i++)
+ {
+ seq = sg.getSequenceAt(i);
+ seqs.addElement(seq);
+ }
+
+ // If the cut affects all sequences, remove highlighted columns
+ if (sg.getSize() == viewport.getAlignment().getHeight())
+ {
+ viewport.getColumnSelection().removeElements(sg.getStartRes(),
+ sg.getEndRes() + 1);
+ }
+
+ SequenceI[] cut = new SequenceI[seqs.size()];
+ for (int i = 0; i < seqs.size(); i++)
+ {
+ cut[i] = (SequenceI) seqs.elementAt(i);
+ }
+
+ /*
+ * //ADD HISTORY ITEM
+ */
+ addHistoryItem(new EditCommand("Cut Sequences", EditCommand.CUT, cut,
+ sg.getStartRes(), sg.getEndRes() - sg.getStartRes() + 1,
+ viewport.getAlignment()));
+
+ viewport.setSelectionGroup(null);
+ viewport.getAlignment().deleteGroup(sg);
+
+ viewport.firePropertyChange("alignment", null, viewport.getAlignment()
+ .getSequences());
+
+ if (viewport.getAlignment().getHeight() < 1)
+ {
+ this.setVisible(false);
+ }
+ viewport.sendSelection();
+ }
+
+ /**
+ * group consensus toggled
+ *
+ */
+ protected void showGroupConsensus_actionPerformed()
+ {
+ viewport.setShowGroupConsensus(showGroupConsensus.getState());
+ alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState());
+
+ }
+
+ /**
+ * group conservation toggled.
+ */
+ protected void showGroupConservation_actionPerformed()
+ {
+ viewport.setShowGroupConservation(showGroupConservation.getState());
+ alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState());
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.jbgui.GAlignFrame#showConsensusHistogram_actionPerformed(java.awt
+ * .event.ActionEvent)
+ */
+ protected void showConsensusHistogram_actionPerformed()
+ {
+ viewport.setShowConsensusHistogram(showConsensusHistogram.getState());
+ alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState());
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.jbgui.GAlignFrame#showConsensusProfile_actionPerformed(java.awt
+ * .event.ActionEvent)
+ */
+ protected void showSequenceLogo_actionPerformed()
+ {
+ viewport.setShowSequenceLogo(showSequenceLogo.getState());
+ alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState());
+ }
+
+ protected void normSequenceLogo_actionPerformed()
+ {
+ showSequenceLogo.setState(true);
+ viewport.setShowSequenceLogo(true);
+ viewport.setNormaliseSequenceLogo(normSequenceLogo.getState());
+ alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState());
+ }
+
+ protected void applyAutoAnnotationSettings_actionPerformed()
+ {
+ alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState());
+ }
+
+ protected void makeGrpsFromSelection_actionPerformed()
+ {
+ if (viewport.getSelectionGroup() != null)
+ {
+ SequenceGroup[] gps = jalview.analysis.Grouping.makeGroupsFrom(
+ viewport.getSequenceSelection(),
+ viewport.getAlignmentView(true).getSequenceStrings(
+ viewport.getGapCharacter()), viewport.getAlignment()
+ .getGroups());
+ viewport.getAlignment().deleteAllGroups();
+ viewport.sequenceColours = null;
+ viewport.setSelectionGroup(null);
+ // set view properties for each group
+ for (int g = 0; g < gps.length; g++)
+ {
+ // gps[g].setShowunconserved(viewport.getShowUnconserved());
+ gps[g].setshowSequenceLogo(viewport.isShowSequenceLogo());
+ viewport.getAlignment().addGroup(gps[g]);
+ Color col = new Color((int) (Math.random() * 255),
+ (int) (Math.random() * 255), (int) (Math.random() * 255));
+ col = col.brighter();
+ for (SequenceI sq : gps[g].getSequences(null))
+ viewport.setSequenceColour(sq, col);
+ }
+ PaintRefresher.Refresh(this, viewport.getSequenceSetId());
+ alignPanel.updateAnnotation();
+ alignPanel.paintAlignment(true);
+ }
+ }
+
+ protected void deleteGroups_actionPerformed()
+ {
+ viewport.getAlignment().deleteAllGroups();
+ viewport.sequenceColours = null;
+ viewport.setSelectionGroup(null);
+
+ alignPanel.paintAlignment(true);
+ }
+
+ public void selectAllSequenceMenuItem_actionPerformed()
+ {
+ SequenceGroup sg = new SequenceGroup();
+ for (int i = 0; i < viewport.getAlignment().getSequences().size(); i++)
+ {
+ sg.addSequence(viewport.getAlignment().getSequenceAt(i), false);
+ }
+ sg.setEndRes(viewport.getAlignment().getWidth() - 1);
+ viewport.setSelectionGroup(sg);
+ alignPanel.paintAlignment(true);
+ PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId());
+ viewport.sendSelection();
+ }
+
+ public void deselectAllSequenceMenuItem_actionPerformed()
+ {
+ if (viewport.cursorMode)
+ {
+ alignPanel.seqPanel.keyboardNo1 = null;
+ alignPanel.seqPanel.keyboardNo2 = null;
+ }
+ viewport.setSelectionGroup(null);
+ viewport.getColumnSelection().clear();
+ viewport.setSelectionGroup(null);
+ alignPanel.idPanel.idCanvas.searchResults = null;
+ alignPanel.seqPanel.seqCanvas.highlightSearchResults(null);
+ alignPanel.paintAlignment(true);
+ PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId());
+ viewport.sendSelection();
+ }
+
+ public void invertSequenceMenuItem_actionPerformed()
+ {
+ SequenceGroup sg = viewport.getSelectionGroup();
+ for (int i = 0; i < viewport.getAlignment().getSequences().size(); i++)
+ {
+ sg.addOrRemove(viewport.getAlignment().getSequenceAt(i), false);
+ }
+
+ PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId());
+ viewport.sendSelection();
+ }
+
+ public void invertColSel_actionPerformed()
+ {
+ viewport.invertColumnSelection();
+ alignPanel.paintAlignment(true);
+ PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId());
+ viewport.sendSelection();
+ }
+
+ void trimAlignment(boolean trimLeft)
+ {
+ ColumnSelection colSel = viewport.getColumnSelection();
+ int column;
+
+ if (colSel.size() > 0)
+ {
+ if (trimLeft)
+ {
+ column = colSel.getMin();
+ }
+ else
+ {
+ column = colSel.getMax();
+ }
+
+ SequenceI[] seqs;
+ if (viewport.getSelectionGroup() != null)
+ {
+ seqs = viewport.getSelectionGroup().getSequencesAsArray(
+ viewport.getHiddenRepSequences());
+ }
+ else
+ {
+ seqs = viewport.getAlignment().getSequencesArray();
+ }
+
+ TrimRegionCommand trimRegion;
+ if (trimLeft)
+ {
+ trimRegion = new TrimRegionCommand("Remove Left",
+ TrimRegionCommand.TRIM_LEFT, seqs, column,
+ viewport.getAlignment(), viewport.getColumnSelection(),
+ viewport.getSelectionGroup());
+ viewport.setStartRes(0);
+ }
+ else
+ {
+ trimRegion = new TrimRegionCommand("Remove Right",
+ TrimRegionCommand.TRIM_RIGHT, seqs, column,
+ viewport.getAlignment(), viewport.getColumnSelection(),
+ viewport.getSelectionGroup());
+ }
+
+ statusBar.setText("Removed " + trimRegion.getSize() + " columns.");
+
+ addHistoryItem(trimRegion);
+
+ for (SequenceGroup sg : viewport.getAlignment().getGroups())
+ {
+ if ((trimLeft && !sg.adjustForRemoveLeft(column))
+ || (!trimLeft && !sg.adjustForRemoveRight(column)))
+ {
+ viewport.getAlignment().deleteGroup(sg);
+ }
+ }
+
+ viewport.firePropertyChange("alignment", null, viewport
+ .getAlignment().getSequences());
+ }
+ }
+
+ public void removeGappedColumnMenuItem_actionPerformed()
+ {
+ int start = 0, end = viewport.getAlignment().getWidth() - 1;
+
+ SequenceI[] seqs;
+ if (viewport.getSelectionGroup() != null)
+ {
+ seqs = viewport.getSelectionGroup().getSequencesAsArray(
+ viewport.getHiddenRepSequences());
+ start = viewport.getSelectionGroup().getStartRes();
+ end = viewport.getSelectionGroup().getEndRes();
+ }
+ else
+ {
+ seqs = viewport.getAlignment().getSequencesArray();
+ }
+
+ RemoveGapColCommand removeGapCols = new RemoveGapColCommand(
+ "Remove Gapped Columns", seqs, start, end,
+ viewport.getAlignment());
+
+ addHistoryItem(removeGapCols);
+
+ statusBar.setText("Removed " + removeGapCols.getSize()
+ + " empty columns.");
+
+ // This is to maintain viewport position on first residue
+ // of first sequence
+ SequenceI seq = viewport.getAlignment().getSequenceAt(0);
+ int startRes = seq.findPosition(viewport.startRes);
+ // ShiftList shifts;
+ // viewport.getAlignment().removeGaps(shifts=new ShiftList());
+ // edit.alColumnChanges=shifts.getInverse();
+ // if (viewport.hasHiddenColumns)
+ // viewport.getColumnSelection().compensateForEdits(shifts);
+ viewport.setStartRes(seq.findIndex(startRes) - 1);
+ viewport.firePropertyChange("alignment", null, viewport.getAlignment()
+ .getSequences());
+
+ }
+
+ public void removeAllGapsMenuItem_actionPerformed()
+ {
+ int start = 0, end = viewport.getAlignment().getWidth() - 1;
+
+ SequenceI[] seqs;
+ if (viewport.getSelectionGroup() != null)
+ {
+ seqs = viewport.getSelectionGroup().getSequencesAsArray(
+ viewport.getHiddenRepSequences());
+ start = viewport.getSelectionGroup().getStartRes();
+ end = viewport.getSelectionGroup().getEndRes();
+ }
+ else
+ {
+ seqs = viewport.getAlignment().getSequencesArray();
+ }
+
+ // This is to maintain viewport position on first residue
+ // of first sequence
+ SequenceI seq = viewport.getAlignment().getSequenceAt(0);
+ int startRes = seq.findPosition(viewport.startRes);
+
+ addHistoryItem(new RemoveGapsCommand("Remove Gaps", seqs, start, end,
+ viewport.getAlignment()));
+
+ viewport.setStartRes(seq.findIndex(startRes) - 1);
+
+ viewport.firePropertyChange("alignment", null, viewport.getAlignment()
+ .getSequences());
+
+ }
+
+ public void findMenuItem_actionPerformed()
+ {
+ new Finder(alignPanel);
+ }
+
+ /**
+ * create a new view derived from the current view
+ *
+ * @param viewtitle
+ * @return frame for the new view
+ */
+ public AlignFrame newView(String viewtitle)
+ {
+ AlignmentI newal;
+ if (viewport.hasHiddenRows())
+ {
+ newal = new Alignment(viewport.getAlignment().getHiddenSequences()
+ .getFullAlignment().getSequencesArray());
+ }
+ else
+ {
+ newal = new Alignment(viewport.getAlignment().getSequencesArray());
+ }
+
+ if (viewport.getAlignment().getAlignmentAnnotation() != null)
+ {
+ for (int i = 0; i < viewport.getAlignment().getAlignmentAnnotation().length; i++)
+ {
+ if (!viewport.getAlignment().getAlignmentAnnotation()[i].autoCalculated)
+ {
+ newal.addAnnotation(viewport.getAlignment()
+ .getAlignmentAnnotation()[i]);
+ }
+ }
+ }
+
+ AlignFrame newaf = new AlignFrame(newal, viewport.applet, "", false);
+
+ newaf.viewport.setSequenceSetId(alignPanel.av.getSequenceSetId());
+ PaintRefresher.Register(alignPanel, alignPanel.av.getSequenceSetId());
+ PaintRefresher.Register(newaf.alignPanel,
+ newaf.alignPanel.av.getSequenceSetId());
+
+ PaintRefresher.Register(newaf.alignPanel.idPanel.idCanvas,
+ newaf.alignPanel.av.getSequenceSetId());
+ PaintRefresher.Register(newaf.alignPanel.seqPanel.seqCanvas,
+ newaf.alignPanel.av.getSequenceSetId());
+
+ Vector comps = (Vector) PaintRefresher.components.get(viewport
+ .getSequenceSetId());
+ int viewSize = -1;
+ for (int i = 0; i < comps.size(); i++)
+ {
+ if (comps.elementAt(i) instanceof AlignmentPanel)
+ {
+ viewSize++;
+ }
+ }
+
+ String title = new String(this.getTitle());
+ if (viewtitle != null)
+ {
+ title = viewtitle + " ( " + title + ")";
+ }
+ else
+ {
+ if (title.indexOf("(View") > -1)
+ {
+ title = title.substring(0, title.indexOf("(View"));
+ }
+ title += "(View " + viewSize + ")";
+ }
+
+ newaf.setTitle(title.toString());
+
+ newaf.viewport.historyList = viewport.historyList;
+ newaf.viewport.redoList = viewport.redoList;
+ return newaf;
+ }
+
+ /**
+ *
+ * @return list of feature groups on the view
+ */
+ public String[] getFeatureGroups()
+ {
+ FeatureRenderer fr = null;
+ if (alignPanel != null
+ && (fr = alignPanel.getFeatureRenderer()) != null)
+ {
+ return fr.getGroups();
+ }
+ return null;
+ }
+
+ /**
+ * get sequence feature groups that are hidden or shown
+ *
+ * @param visible
+ * true is visible
+ * @return list
+ */
+ public String[] getFeatureGroupsOfState(boolean visible)
+ {
+ FeatureRenderer fr = null;
+ if (alignPanel != null
+ && (fr = alignPanel.getFeatureRenderer()) != null)
+ {
+ return fr.getGroups(visible);
+ }
+ return null;
+ }
+
+ /**
+ * Change the display state for the given feature groups
+ *
+ * @param groups
+ * list of group strings
+ * @param state
+ * visible or invisible
+ */
+ public void setFeatureGroupState(String[] groups, boolean state)
+ {
+ FeatureRenderer fr = null;
+ this.sequenceFeatures.setState(true);
+ viewport.showSequenceFeatures(true);
+ if (alignPanel != null
+ && (fr = alignPanel.getFeatureRenderer()) != null)
+ {
+ fr.setGroupState(groups, state);
+ alignPanel.seqPanel.seqCanvas.repaint();
+ if (alignPanel.overviewPanel != null)
+ {
+ alignPanel.overviewPanel.updateOverviewImage();
+ }
+ }
+ }
+
+ public void seqLimits_itemStateChanged()
+ {
+ viewport.setShowJVSuffix(seqLimits.getState());
+ alignPanel.fontChanged();
+ alignPanel.paintAlignment(true);
+ }
+
+ protected void colourTextMenuItem_actionPerformed()
+ {
+ viewport.setColourText(colourTextMenuItem.getState());
+ alignPanel.paintAlignment(true);
+ }
+
+ protected void displayNonconservedMenuItem_actionPerformed()
+ {
+ viewport.setShowunconserved(displayNonconservedMenuItem.getState());
+ alignPanel.paintAlignment(true);
+ }
+
+ protected void wrapMenuItem_actionPerformed()
+ {
+ viewport.setWrapAlignment(wrapMenuItem.getState());
+ alignPanel.setWrapAlignment(wrapMenuItem.getState());
+ scaleAbove.setEnabled(wrapMenuItem.getState());
+ scaleLeft.setEnabled(wrapMenuItem.getState());
+ scaleRight.setEnabled(wrapMenuItem.getState());
+ alignPanel.paintAlignment(true);
+ }
+
+ public void overviewMenuItem_actionPerformed()
+ {
+ if (alignPanel.overviewPanel != null)
+ {
+ return;
+ }
+
+ Frame frame = new Frame();
+ OverviewPanel overview = new OverviewPanel(alignPanel);
+ frame.add(overview);
+ // +50 must allow for applet frame window
+ jalview.bin.JalviewLite.addFrame(frame, "Overview " + this.getTitle(),
+ overview.getPreferredSize().width,
+ overview.getPreferredSize().height + 50);
+
+ frame.pack();
+ final AlignmentPanel ap = alignPanel;
+ frame.addWindowListener(new WindowAdapter()
+ {
+ @Override
+ public void windowClosing(WindowEvent e)
+ {
+ if (ap != null)
+ {
+ ap.setOverviewPanel(null);
+ }
+ };
+ });
+
+ alignPanel.setOverviewPanel(overview);
+
+ }
+
+ void changeColour(ColourSchemeI cs)
+ {
+ int threshold = 0;
+
+ if (cs != null)
+ {
+ if (viewport.getAbovePIDThreshold())
+ {
+ threshold = SliderPanel.setPIDSliderSource(alignPanel, cs,
+ "Background");
+
+ cs.setThreshold(threshold, viewport.getIgnoreGapsConsensus());
+
+ viewport.setGlobalColourScheme(cs);
+ }
+ else
+ {
+ cs.setThreshold(0, viewport.getIgnoreGapsConsensus());
+ }
+
+ if (viewport.getConservationSelected())
+ {
+
+ Alignment al = (Alignment) viewport.getAlignment();
+ Conservation c = new Conservation("All",
+ ResidueProperties.propHash, 3, al.getSequences(), 0,
+ al.getWidth() - 1);
+
+ c.calculate();
+ c.verdict(false, viewport.getConsPercGaps());
+
+ cs.setConservation(c);
+
+ cs.setConservationInc(SliderPanel.setConservationSlider(alignPanel,
+ cs, "Background"));
+
+ }
+ else
+ {
+ cs.setConservation(null);
+ }
+
+ cs.setConsensus(viewport.getSequenceConsensusHash());
+
+ }
+ viewport.setGlobalColourScheme(cs);
+
+ if (alignPanel.getOverviewPanel() != null)
+ {
+ alignPanel.getOverviewPanel().updateOverviewImage();
+ }
+
+ jalview.structure.StructureSelectionManager
+ .getStructureSelectionManager(viewport.applet)
+ .sequenceColoursChanged(alignPanel);
+
+ alignPanel.paintAlignment(true);
+ }
+
+ protected void modifyPID_actionPerformed()
+ {
+ if (viewport.getAbovePIDThreshold()
+ && viewport.getGlobalColourScheme() != null)
+ {
+ SliderPanel.setPIDSliderSource(alignPanel,
+ viewport.getGlobalColourScheme(), "Background");
+ SliderPanel.showPIDSlider();
+ }
+ }
+
+ protected void modifyConservation_actionPerformed()
+ {
+ if (viewport.getConservationSelected()
+ && viewport.getGlobalColourScheme() != null)
+ {
+ SliderPanel.setConservationSlider(alignPanel,
+ viewport.getGlobalColourScheme(), "Background");
+ SliderPanel.showConservationSlider();
+ }
+ }
+
+ protected void conservationMenuItem_actionPerformed()
+ {
+ viewport.setConservationSelected(conservationMenuItem.getState());
+
+ viewport.setAbovePIDThreshold(false);
+ abovePIDThreshold.setState(false);
+
+ changeColour(viewport.getGlobalColourScheme());
+
+ modifyConservation_actionPerformed();
+ }
+
+ public void abovePIDThreshold_actionPerformed()
+ {
+ viewport.setAbovePIDThreshold(abovePIDThreshold.getState());
+
+ conservationMenuItem.setState(false);
+ viewport.setConservationSelected(false);
+
+ changeColour(viewport.getGlobalColourScheme());
+
+ modifyPID_actionPerformed();
+ }
+
+ public void sortPairwiseMenuItem_actionPerformed()
+ {
+ SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();
+ AlignmentSorter.sortByPID(viewport.getAlignment(), viewport
+ .getAlignment().getSequenceAt(0), null);
+
+ addHistoryItem(new OrderCommand("Pairwise Sort", oldOrder,
+ viewport.getAlignment()));
+ alignPanel.paintAlignment(true);
+ }
+
+ public void sortIDMenuItem_actionPerformed()
+ {
+ SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();
+ AlignmentSorter.sortByID(viewport.getAlignment());
+ addHistoryItem(new OrderCommand("ID Sort", oldOrder,
+ viewport.getAlignment()));
+ alignPanel.paintAlignment(true);
+ }
+
+ public void sortLengthMenuItem_actionPerformed()
+ {
+ SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();
+ AlignmentSorter.sortByLength(viewport.getAlignment());
+ addHistoryItem(new OrderCommand("Length Sort", oldOrder,
+ viewport.getAlignment()));
+ alignPanel.paintAlignment(true);
+ }
+
+ public void sortGroupMenuItem_actionPerformed()
+ {
+ SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();
+ AlignmentSorter.sortByGroup(viewport.getAlignment());
+ addHistoryItem(new OrderCommand("Group Sort", oldOrder,
+ viewport.getAlignment()));
+ alignPanel.paintAlignment(true);
+
+ }
+
+ public void removeRedundancyMenuItem_actionPerformed()
+ {
+ new RedundancyPanel(alignPanel);
+ }
+
+ public void pairwiseAlignmentMenuItem_actionPerformed()
+ {
+ if (viewport.getSelectionGroup() != null
+ && viewport.getSelectionGroup().getSize() > 1)
+ {
+ Frame frame = new Frame();
+ frame.add(new PairwiseAlignPanel(alignPanel));
+ jalview.bin.JalviewLite.addFrame(frame, "Pairwise Alignment", 600,
+ 500);
+ }
+ }
+
+ public void PCAMenuItem_actionPerformed()
+ {
+ // are the sequences aligned?
+ if (!viewport.getAlignment().isAligned(false))
+ {
+ SequenceI current;
+ int Width = viewport.getAlignment().getWidth();
+
+ for (int i = 0; i < viewport.getAlignment().getSequences().size(); i++)
+ {
+ current = viewport.getAlignment().getSequenceAt(i);
+
+ if (current.getLength() < Width)
+ {
+ current.insertCharAt(Width - 1, viewport.getGapCharacter());
+ }
+ }
+ alignPanel.paintAlignment(true);
+ }
+
+ if ((viewport.getSelectionGroup() != null
+ && viewport.getSelectionGroup().getSize() < 4 && viewport
+ .getSelectionGroup().getSize() > 0)
+ || viewport.getAlignment().getHeight() < 4)
+ {
+ return;
+ }
+
+ try
+ {
+ new PCAPanel(viewport);
+ } catch (java.lang.OutOfMemoryError ex)
+ {
+ }
+
+ }
+
+ public void averageDistanceTreeMenuItem_actionPerformed()
+ {
+ NewTreePanel("AV", "PID", "Average distance tree using PID");
+ }
+
+ public void neighbourTreeMenuItem_actionPerformed()
+ {
+ NewTreePanel("NJ", "PID", "Neighbour joining tree using PID");
+ }
+
+ protected void njTreeBlosumMenuItem_actionPerformed()
+ {
+ NewTreePanel("NJ", "BL", "Neighbour joining tree using BLOSUM62");
+ }
+
+ protected void avTreeBlosumMenuItem_actionPerformed()
+ {
+ NewTreePanel("AV", "BL", "Average distance tree using BLOSUM62");
+ }
+
+ void NewTreePanel(String type, String pwType, String title)
+ {
+ // are the sequences aligned?
+ if (!viewport.getAlignment().isAligned(false))
+ {
+ SequenceI current;
+ int Width = viewport.getAlignment().getWidth();
+
+ for (int i = 0; i < viewport.getAlignment().getSequences().size(); i++)
+ {
+ current = viewport.getAlignment().getSequenceAt(i);
+
+ if (current.getLength() < Width)
+ {
+ current.insertCharAt(Width - 1, viewport.getGapCharacter());
+ }
+ }
+ alignPanel.paintAlignment(true);
+
+ }
+
+ if ((viewport.getSelectionGroup() != null && viewport
+ .getSelectionGroup().getSize() > 1)
+ || (viewport.getAlignment().getHeight() > 1))
+ {
+ final TreePanel tp = new TreePanel(alignPanel, type, pwType);
+
+ addTreeMenuItem(tp, title);
+
+ jalview.bin.JalviewLite.addFrame(tp, title, 600, 500);
+ }
+ }
+
+ void loadTree_actionPerformed()
+ {
+ CutAndPasteTransfer cap = new CutAndPasteTransfer(true, this);
+ cap.setText("Paste your Newick tree file here.");
+ cap.setTreeImport();
+ Frame frame = new Frame();
+ frame.add(cap);
+ jalview.bin.JalviewLite.addFrame(frame, "Paste Newick file ", 400, 300);
+ }
+
+ public void loadTree(jalview.io.NewickFile tree, String treeFile)
+ {
+ TreePanel tp = new TreePanel(alignPanel, treeFile, "From File - ", tree);
+ jalview.bin.JalviewLite.addFrame(tp, treeFile, 600, 500);
+ addTreeMenuItem(tp, treeFile);
+ }
+
+ /**
+ * sort the alignment using the given treePanel
+ *
+ * @param treePanel
+ * tree used to sort view
+ * @param title
+ * string used for undo event name
+ */
+ public void sortByTree(TreePanel treePanel, String title)
+ {
+ SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();
+ AlignmentSorter
+ .sortByTree(viewport.getAlignment(), treePanel.getTree());
+ // addHistoryItem(new HistoryItem("Sort", viewport.alignment,
+ // HistoryItem.SORT));
+ addHistoryItem(new OrderCommand("Order by " + title, oldOrder,
+ viewport.getAlignment()));
+ alignPanel.paintAlignment(true);
+ }
+
+ /**
+ * Do any automatic reordering of the alignment and add the necessary bits to
+ * the menu structure for the new tree
+ *
+ * @param treePanel
+ * @param title
+ */
+ protected void addTreeMenuItem(final TreePanel treePanel,
+ final String title)
+ {
+ final MenuItem item = new MenuItem(title);
+ sortByTreeMenu.add(item);
+ item.addActionListener(new java.awt.event.ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent evt)
+ {
+ sortByTree(treePanel, title); // treePanel.getTitle());
+ }
+ });
+
+ treePanel.addWindowListener(new WindowAdapter()
+ {
+ @Override
+ public void windowOpened(WindowEvent e)
+ {
+ if (viewport.sortByTree)
+ {
+ sortByTree(treePanel, title);
+ }
+ super.windowOpened(e);
+ }
+
+ @Override
+ public void windowClosing(WindowEvent e)
+ {
+ sortByTreeMenu.remove(item);
+ };
+ });
+ }
+
+ public boolean sortBy(AlignmentOrder alorder, String undoname)
+ {
+ SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();
+ if (viewport.applet.debug)
+ {
+ System.err.println("Sorting " + alorder.getOrder().size()
+ + " in alignment '" + getTitle() + "'");
+ }
+ AlignmentSorter.sortBy(viewport.getAlignment(), alorder);
+ if (undoname != null)
+ {
+ addHistoryItem(new OrderCommand(undoname, oldOrder,
+ viewport.getAlignment()));
+ }
+ alignPanel.paintAlignment(true);
+ return true;
+ }
+
+ protected void documentation_actionPerformed()
+ {
+ alignPanel.av.applet.openJalviewHelpUrl();
+ }
+
+ protected void about_actionPerformed()
+ {
+
+ class AboutPanel extends Canvas
+ {
+ String version;
+
+ String builddate;
+
+ public AboutPanel(String version, String builddate)
+ {
+ this.version = version;
+ this.builddate = builddate;
+ }
+
+ @Override
+ public void paint(Graphics g)
+ {
+ g.setColor(Color.white);
+ g.fillRect(0, 0, getSize().width, getSize().height);
+ g.setFont(new Font("Helvetica", Font.PLAIN, 12));
+ FontMetrics fm = g.getFontMetrics();
+ int fh = fm.getHeight();
+ int y = 5, x = 7;
+ g.setColor(Color.black);
+ // TODO: update this text for each release or centrally store it for
+ // lite and application
+ g.setFont(new Font("Helvetica", Font.BOLD, 14));
+ g.drawString("JalviewLite - Release " + version, x, y += fh);
+ g.setFont(new Font("Helvetica", Font.BOLD, 12));
+ g.drawString("Build date: " + builddate, x, y += fh);
+ g.setFont(new Font("Helvetica", Font.PLAIN, 12));
+ g.drawString(
+ "Authors: Jim Procter, Andrew Waterhouse, Michele Clamp, James Cuff, Steve Searle,",
+ x, y += fh * 1.5);
+ g.drawString("David Martin & Geoff Barton.", x + 50, y += fh);
+ g.drawString(
+ "Development managed by The Barton Group, University of Dundee, Scotland, UK.",
+ x, y += fh);
+ g.drawString(
+ "For help, see the FAQ at www.jalview.org and/or join the jalview-discuss@jalview.org mailing list",
+ x, y += fh);
+ g.drawString("If you use Jalview, please cite:", x, y += fh + 8);
+ g.drawString(
+ "Waterhouse, A.M., Procter, J.B., Martin, D.M.A, Clamp, M. and Barton, G. J. (2009)",
+ x, y += fh);
+ g.drawString(
+ "Jalview Version 2 - a multiple sequence alignment editor and analysis workbench",
+ x, y += fh);
+ g.drawString("Bioinformatics doi: 10.1093/bioinformatics/btp033",
+ x, y += fh);
+ }
+ }
+
+ Frame frame = new Frame();
+ frame.add(new AboutPanel(JalviewLite.getVersion(), JalviewLite
+ .getBuildDate()));
+ jalview.bin.JalviewLite.addFrame(frame, "Jalview", 580, 220);
+
+ }
+
+ public void showURL(String url, String target)
+ {
+ if (viewport.applet == null)
+ {
+ System.out.println("Not running as applet - no browser available.");
+ }
+ else
+ {
+ viewport.applet.showURL(url, target);
+ }
+ }
+
+ // ////////////////////////////////////////////////////////////////////////////////
+ // JBuilder Graphics here
+
+ MenuBar alignFrameMenuBar = new MenuBar();
+
+ Menu fileMenu = new Menu("File");
+
+ MenuItem loadApplication = new MenuItem("View in Full Application");
+
+ MenuItem loadTree = new MenuItem("Load Associated Tree ...");
+
+ MenuItem loadAnnotations = new MenuItem("Load Features/Annotations ...");
+
+ MenuItem outputFeatures = new MenuItem("Export Features ...");
+
+ MenuItem outputAnnotations = new MenuItem("Export Annotations ...");
+
+ MenuItem closeMenuItem = new MenuItem("Close");
+
+ Menu editMenu = new Menu("Edit");
+
+ Menu viewMenu = new Menu("View");
+
+ Menu colourMenu = new Menu("Colour");
+
+ Menu calculateMenu = new Menu("Calculate");
+
+ MenuItem selectAllSequenceMenuItem = new MenuItem("Select all");
+
+ MenuItem deselectAllSequenceMenuItem = new MenuItem("Deselect All");
+
+ MenuItem invertSequenceMenuItem = new MenuItem("Invert Selection");
+
+ MenuItem remove2LeftMenuItem = new MenuItem();
+
+ MenuItem remove2RightMenuItem = new MenuItem();
+
+ MenuItem removeGappedColumnMenuItem = new MenuItem();
+
+ MenuItem removeAllGapsMenuItem = new MenuItem();
+
+ CheckboxMenuItem viewBoxesMenuItem = new CheckboxMenuItem();
+
+ CheckboxMenuItem viewTextMenuItem = new CheckboxMenuItem();
+
+ MenuItem sortPairwiseMenuItem = new MenuItem();
+
+ MenuItem sortIDMenuItem = new MenuItem();
+
+ MenuItem sortLengthMenuItem = new MenuItem();
+
+ MenuItem sortGroupMenuItem = new MenuItem();
+
+ MenuItem removeRedundancyMenuItem = new MenuItem();
+
+ MenuItem pairwiseAlignmentMenuItem = new MenuItem();
+
+ MenuItem PCAMenuItem = new MenuItem();
+
+ MenuItem averageDistanceTreeMenuItem = new MenuItem();
+
+ MenuItem neighbourTreeMenuItem = new MenuItem();
+
+ BorderLayout borderLayout1 = new BorderLayout();
+
+ public Label statusBar = new Label();
+
+ Menu outputTextboxMenu = new Menu();
+
+ MenuItem clustalColour = new MenuItem();
+
+ MenuItem zappoColour = new MenuItem();
+
+ MenuItem taylorColour = new MenuItem();
+
+ MenuItem hydrophobicityColour = new MenuItem();
+
+ MenuItem helixColour = new MenuItem();
+
+ MenuItem strandColour = new MenuItem();
+
+ MenuItem turnColour = new MenuItem();
+
+ MenuItem buriedColour = new MenuItem();
+
+ MenuItem purinePyrimidineColour = new MenuItem();
+
+ MenuItem RNAHelixColour = new MenuItem();
+
+ MenuItem userDefinedColour = new MenuItem();
+
+ MenuItem PIDColour = new MenuItem();
+
+ MenuItem BLOSUM62Colour = new MenuItem();
+
+ MenuItem tcoffeeColour = new MenuItem();
+
+ MenuItem njTreeBlosumMenuItem = new MenuItem();
+
+ MenuItem avDistanceTreeBlosumMenuItem = new MenuItem();
+
+ CheckboxMenuItem annotationPanelMenuItem = new CheckboxMenuItem();
+
+ CheckboxMenuItem colourTextMenuItem = new CheckboxMenuItem();
+
+ CheckboxMenuItem displayNonconservedMenuItem = new CheckboxMenuItem();
+
+ MenuItem alProperties = new MenuItem("Alignment Properties...");
+
+ MenuItem overviewMenuItem = new MenuItem();
+
+ MenuItem undoMenuItem = new MenuItem();
+
+ MenuItem redoMenuItem = new MenuItem();
+
+ CheckboxMenuItem conservationMenuItem = new CheckboxMenuItem();
+
+ MenuItem noColourmenuItem = new MenuItem();
+
+ CheckboxMenuItem wrapMenuItem = new CheckboxMenuItem();
+
+ CheckboxMenuItem renderGapsMenuItem = new CheckboxMenuItem();
+
+ MenuItem findMenuItem = new MenuItem();
+
+ CheckboxMenuItem abovePIDThreshold = new CheckboxMenuItem();
+
+ MenuItem nucleotideColour = new MenuItem();
+
+ MenuItem deleteGroups = new MenuItem();
+
+ MenuItem grpsFromSelection = new MenuItem();
+
+ MenuItem delete = new MenuItem();
+
+ MenuItem copy = new MenuItem();
+
+ MenuItem cut = new MenuItem();
+
+ Menu pasteMenu = new Menu();
+
+ MenuItem pasteNew = new MenuItem();
+
+ MenuItem pasteThis = new MenuItem();
+
+ CheckboxMenuItem applyToAllGroups = new CheckboxMenuItem();
+
+ MenuItem font = new MenuItem();
+
+ CheckboxMenuItem scaleAbove = new CheckboxMenuItem();
+
+ CheckboxMenuItem scaleLeft = new CheckboxMenuItem();
+
+ CheckboxMenuItem scaleRight = new CheckboxMenuItem();
+
+ MenuItem modifyPID = new MenuItem();
+
+ MenuItem modifyConservation = new MenuItem();
+
+ CheckboxMenuItem autoCalculate = new CheckboxMenuItem(
+ "Autocalculate Consensus", true);
+
+ CheckboxMenuItem sortByTree = new CheckboxMenuItem(
+ "Sort Alignment With New Tree", true);
+
+ Menu sortByTreeMenu = new Menu();
+
+ Menu sort = new Menu();
+
+ Menu calculate = new Menu();
+
+ MenuItem inputText = new MenuItem();
+
+ Menu helpMenu = new Menu();
+
+ MenuItem documentation = new MenuItem();
+
+ MenuItem about = new MenuItem();
+
+ CheckboxMenuItem seqLimits = new CheckboxMenuItem();
+
+ CheckboxMenuItem centreColumnLabelFlag = new CheckboxMenuItem();
+
+ CheckboxMenuItem followMouseOverFlag = new CheckboxMenuItem();
+
+ Menu autoAnnMenu = new Menu();
+
+ CheckboxMenuItem showSequenceLogo = new CheckboxMenuItem();
+
+ CheckboxMenuItem applyAutoAnnotationSettings = new CheckboxMenuItem();
+
+ CheckboxMenuItem showConsensusHistogram = new CheckboxMenuItem();
+
+ CheckboxMenuItem showGroupConsensus = new CheckboxMenuItem();
+
+ CheckboxMenuItem showGroupConservation = new CheckboxMenuItem();
+
+ CheckboxMenuItem normSequenceLogo = new CheckboxMenuItem();
+
+ private void jbInit() throws Exception
+ {
+
+ setMenuBar(alignFrameMenuBar);
+
+ MenuItem item;
+
+ // dynamically fill save as menu with available formats
+ for (int i = 0; i < jalview.io.AppletFormatAdapter.WRITEABLE_FORMATS.length; i++)
+ {
+
+ item = new MenuItem(
+ jalview.io.AppletFormatAdapter.WRITEABLE_FORMATS[i]);
+
+ item.addActionListener(new java.awt.event.ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ outputText_actionPerformed(e);
+ }
+ });
+
+ outputTextboxMenu.add(item);
+ }
+ closeMenuItem.addActionListener(this);
+ loadApplication.addActionListener(this);
+
+ loadTree.addActionListener(this);
+ loadAnnotations.addActionListener(this);
+ outputFeatures.addActionListener(this);
+ outputAnnotations.addActionListener(this);
+ selectAllSequenceMenuItem.addActionListener(this);
+ deselectAllSequenceMenuItem.addActionListener(this);
+ invertSequenceMenuItem.addActionListener(this);
+ remove2LeftMenuItem.setLabel("Remove Left");
+ remove2LeftMenuItem.addActionListener(this);
+ remove2RightMenuItem.setLabel("Remove Right");
+ remove2RightMenuItem.addActionListener(this);
+ removeGappedColumnMenuItem.setLabel("Remove Empty Columns");
+ removeGappedColumnMenuItem.addActionListener(this);
+ removeAllGapsMenuItem.setLabel("Remove All Gaps");
+ removeAllGapsMenuItem.addActionListener(this);
+ viewBoxesMenuItem.setLabel("Boxes");
+ viewBoxesMenuItem.setState(true);
+ viewBoxesMenuItem.addItemListener(this);
+ viewTextMenuItem.setLabel("Text");
+ viewTextMenuItem.setState(true);
+ viewTextMenuItem.addItemListener(this);
+ sortPairwiseMenuItem.setLabel("by Pairwise Identity");
+ sortPairwiseMenuItem.addActionListener(this);
+ sortIDMenuItem.setLabel("by ID");
+ sortIDMenuItem.addActionListener(this);
+ sortLengthMenuItem.setLabel("by Length");
+ sortLengthMenuItem.addActionListener(this);
+ sortGroupMenuItem.setLabel("by Group");
+ sortGroupMenuItem.addActionListener(this);
+ removeRedundancyMenuItem.setLabel("Remove Redundancy...");
+ removeRedundancyMenuItem.addActionListener(this);
+ pairwiseAlignmentMenuItem.setLabel("Pairwise Alignments...");
+ pairwiseAlignmentMenuItem.addActionListener(this);
+ PCAMenuItem.setLabel("Principal Component Analysis");
+ PCAMenuItem.addActionListener(this);
+ averageDistanceTreeMenuItem
+ .setLabel("Average Distance Using % Identity");
+ averageDistanceTreeMenuItem.addActionListener(this);
+ neighbourTreeMenuItem.setLabel("Neighbour Joining Using % Identity");
+ neighbourTreeMenuItem.addActionListener(this);
+ statusBar.setBackground(Color.white);
+ statusBar.setFont(new java.awt.Font("Verdana", 0, 11));
+ statusBar.setText("Status bar");
+ outputTextboxMenu.setLabel("Output to Textbox");
+ clustalColour.setLabel("Clustalx");
+
+ clustalColour.addActionListener(this);
+ zappoColour.setLabel("Zappo");
+ zappoColour.addActionListener(this);
+ taylorColour.setLabel("Taylor");
+ taylorColour.addActionListener(this);
+ hydrophobicityColour.setLabel("Hydrophobicity");
+ hydrophobicityColour.addActionListener(this);
+ helixColour.setLabel("Helix Propensity");
+ helixColour.addActionListener(this);
+ strandColour.setLabel("Strand Propensity");
+ strandColour.addActionListener(this);
+ turnColour.setLabel("Turn Propensity");
+ turnColour.addActionListener(this);
+ buriedColour.setLabel("Buried Index");
+ buriedColour.addActionListener(this);
+ purinePyrimidineColour.setLabel("Purine/Pyrimidine");
+ purinePyrimidineColour.addActionListener(this);
+ RNAHelixColour.setLabel("by RNA Helices");
+ RNAHelixColour.addActionListener(this);
+ userDefinedColour.setLabel("User Defined...");
+ userDefinedColour.addActionListener(this);
+ PIDColour.setLabel("Percentage Identity");
+ PIDColour.addActionListener(this);
+ BLOSUM62Colour.setLabel("BLOSUM62 Score");
+ BLOSUM62Colour.addActionListener(this);
+ tcoffeeColour.setLabel("T-Coffee Scores");
+ tcoffeeColour.setEnabled(false); // it will enabled only if a score file is
+ // provided
+ tcoffeeColour.addActionListener(this);
+ avDistanceTreeBlosumMenuItem
+ .setLabel("Average Distance Using BLOSUM62");
+ avDistanceTreeBlosumMenuItem.addActionListener(this);
+ njTreeBlosumMenuItem.setLabel("Neighbour Joining Using BLOSUM62");
+ njTreeBlosumMenuItem.addActionListener(this);
+ annotationPanelMenuItem.setLabel("Show Annotations");
+ annotationPanelMenuItem.addItemListener(this);
+ colourTextMenuItem.setLabel("Colour Text");
+ colourTextMenuItem.addItemListener(this);
+ displayNonconservedMenuItem.setLabel("Show nonconserved");
+ displayNonconservedMenuItem.addItemListener(this);
+ alProperties.addActionListener(this);
+ overviewMenuItem.setLabel("Overview Window");
+ overviewMenuItem.addActionListener(this);
+ undoMenuItem.setEnabled(false);
+ undoMenuItem.setLabel("Undo");
+ undoMenuItem.addActionListener(this);
+ redoMenuItem.setEnabled(false);
+ redoMenuItem.setLabel("Redo");
+ redoMenuItem.addActionListener(this);
+ conservationMenuItem.setLabel("by Conservation");
+ conservationMenuItem.addItemListener(this);
+ noColourmenuItem.setLabel("None");
+ noColourmenuItem.addActionListener(this);
+ wrapMenuItem.setLabel("Wrap");
+ wrapMenuItem.addItemListener(this);
+ renderGapsMenuItem.setLabel("Show Gaps");
+ renderGapsMenuItem.setState(true);
+ renderGapsMenuItem.addItemListener(this);
+ findMenuItem.setLabel("Find...");
+ findMenuItem.addActionListener(this);
+ abovePIDThreshold.setLabel("Above Identity Threshold");
+ abovePIDThreshold.addItemListener(this);
+ nucleotideColour.setLabel("Nucleotide");
+ nucleotideColour.addActionListener(this);
+ deleteGroups.setLabel("Undefine Groups");
+ deleteGroups.addActionListener(this);
+ grpsFromSelection.setLabel("Make Groups for selection");
+ grpsFromSelection.addActionListener(this);
+ copy.setLabel("Copy");
+ copy.addActionListener(this);
+ cut.setLabel("Cut");
+ cut.addActionListener(this);
+ delete.setLabel("Delete");
+ delete.addActionListener(this);
+ pasteMenu.setLabel("Paste");
+ pasteNew.setLabel("To New Alignment");
+ pasteNew.addActionListener(this);
+ pasteThis.setLabel("Add To This Alignment");
+ pasteThis.addActionListener(this);
+ applyToAllGroups.setLabel("Apply Colour To All Groups");
+ applyToAllGroups.setState(true);
+ applyToAllGroups.addItemListener(this);
+ font.setLabel("Font...");
+ font.addActionListener(this);
+ scaleAbove.setLabel("Scale Above");
+ scaleAbove.setState(true);
+ scaleAbove.setEnabled(false);
+ scaleAbove.addItemListener(this);
+ scaleLeft.setEnabled(false);
+ scaleLeft.setState(true);
+ scaleLeft.setLabel("Scale Left");
+ scaleLeft.addItemListener(this);
+ scaleRight.setEnabled(false);
+ scaleRight.setState(true);
+ scaleRight.setLabel("Scale Right");
+ scaleRight.addItemListener(this);
+ modifyPID.setLabel("Modify Identity Threshold...");
+ modifyPID.addActionListener(this);
+ modifyConservation.setLabel("Modify Conservation Threshold...");
+ modifyConservation.addActionListener(this);
+ sortByTreeMenu.setLabel("By Tree Order");
+ sort.setLabel("Sort");
+ calculate.setLabel("Calculate Tree");
+ autoCalculate.addItemListener(this);
+ sortByTree.addItemListener(this);
+ inputText.setLabel("Input from textbox");
+ inputText.addActionListener(this);
+ centreColumnLabelFlag.setLabel("Centre column labels");
+ centreColumnLabelFlag.addItemListener(this);
+ followMouseOverFlag.setLabel("Automatic Scrolling");
+ followMouseOverFlag.addItemListener(this);
+ helpMenu.setLabel("Help");
+ documentation.setLabel("Documentation");
+ documentation.addActionListener(this);
+
+ about.setLabel("About...");
+ about.addActionListener(this);
+ seqLimits.setState(true);
+ seqLimits.setLabel("Show Sequence Limits");
+ seqLimits.addItemListener(this);
+ featureSettings.setLabel("Feature Settings...");
+ featureSettings.addActionListener(this);
+ sequenceFeatures.setLabel("Sequence Features");
+ sequenceFeatures.addItemListener(this);
+ sequenceFeatures.setState(false);
+ annotationColour.setLabel("by Annotation...");
+ annotationColour.addActionListener(this);
+ invertSequenceMenuItem.setLabel("Invert Sequence Selection");
+ invertColSel.setLabel("Invert Column Selection");
+ menu1.setLabel("Show");
+ showColumns.setLabel("All Columns ");
+ showSeqs.setLabel("All Sequences");
+ menu2.setLabel("Hide");
+ hideColumns.setLabel("Selected Columns");
+ hideSequences.setLabel("Selected Sequences");
+ hideAllButSelection.setLabel("All but Selected Region (Shift+Ctrl+H)");
+ hideAllSelection.setLabel("Selected Region");
+ showAllHidden.setLabel("All Sequences and Columns");
+ showGroupConsensus.setLabel("Group Consensus");
+ showGroupConservation.setLabel("Group Conservation");
+ showConsensusHistogram.setLabel("Show Consensus Histogram");
+ showSequenceLogo.setLabel("Show Consensus Logo");
+ normSequenceLogo.setLabel("Normalise Consensus Logo");
+ applyAutoAnnotationSettings.setLabel("Apply to all groups");
+ applyAutoAnnotationSettings.setState(true);
+ autoAnnMenu.setLabel("Autocalculated Annotation");
+
+ invertColSel.addActionListener(this);
+ showColumns.addActionListener(this);
+ showSeqs.addActionListener(this);
+ hideColumns.addActionListener(this);
+ hideSequences.addActionListener(this);
+ hideAllButSelection.addActionListener(this);
+ hideAllSelection.addActionListener(this);
+ showAllHidden.addActionListener(this);
+ showGroupConsensus.addItemListener(this);
+ showGroupConservation.addItemListener(this);
+ showConsensusHistogram.addItemListener(this);
+ showSequenceLogo.addItemListener(this);
+ normSequenceLogo.addItemListener(this);
+
+ applyAutoAnnotationSettings.addItemListener(this);
+ formatMenu.setLabel("Format");
+ selectMenu.setLabel("Select");
+ newView.setLabel("New View");
+ newView.addActionListener(this);
+ alignFrameMenuBar.add(fileMenu);
+ alignFrameMenuBar.add(editMenu);
+ alignFrameMenuBar.add(selectMenu);
+ alignFrameMenuBar.add(viewMenu);
+ alignFrameMenuBar.add(formatMenu);
+ alignFrameMenuBar.add(colourMenu);
+ alignFrameMenuBar.add(calculateMenu);
+ alignFrameMenuBar.add(helpMenu);
+
+ fileMenu.add(inputText);
+ fileMenu.add(loadTree);
+ fileMenu.add(loadAnnotations);
+
+ fileMenu.addSeparator();
+ fileMenu.add(outputTextboxMenu);
+ fileMenu.add(outputFeatures);
+ fileMenu.add(outputAnnotations);
+
+ if (jalviewServletURL != null)
+ {
+ fileMenu.add(loadApplication);
+ }
+
+ fileMenu.addSeparator();
+ fileMenu.add(closeMenuItem);
+
+ editMenu.add(undoMenuItem);
+ editMenu.add(redoMenuItem);
+ editMenu.add(cut);
+ editMenu.add(copy);
+ editMenu.add(pasteMenu);
+ editMenu.add(delete);
+ editMenu.addSeparator();
+ editMenu.add(remove2LeftMenuItem);
+ editMenu.add(remove2RightMenuItem);
+ editMenu.add(removeGappedColumnMenuItem);
+ editMenu.add(removeAllGapsMenuItem);
+ editMenu.add(removeRedundancyMenuItem);
+ viewMenu.add(newView);
+ viewMenu.addSeparator();
+ viewMenu.add(menu1);
+ viewMenu.add(menu2);
+ viewMenu.addSeparator();
+ viewMenu.add(followMouseOverFlag);
+ viewMenu.add(annotationPanelMenuItem);
+ autoAnnMenu.add(applyAutoAnnotationSettings);
+ autoAnnMenu.add(showConsensusHistogram);
+ autoAnnMenu.add(showSequenceLogo);
+ autoAnnMenu.add(normSequenceLogo);
+ autoAnnMenu.addSeparator();
+ autoAnnMenu.add(showGroupConservation);
+ autoAnnMenu.add(showGroupConsensus);
+ viewMenu.add(autoAnnMenu);
+ viewMenu.addSeparator();
+ viewMenu.add(sequenceFeatures);
+ viewMenu.add(featureSettings);
+ viewMenu.addSeparator();
+ viewMenu.add(alProperties);
+ viewMenu.addSeparator();
+ viewMenu.add(overviewMenuItem);
+ colourMenu.add(applyToAllGroups);
+ colourMenu.addSeparator();
+ colourMenu.add(noColourmenuItem);
+ colourMenu.add(clustalColour);
+ colourMenu.add(BLOSUM62Colour);
+ colourMenu.add(PIDColour);
+ colourMenu.add(zappoColour);
+ colourMenu.add(taylorColour);
+ colourMenu.add(hydrophobicityColour);
+ colourMenu.add(helixColour);
+ colourMenu.add(strandColour);
+ colourMenu.add(turnColour);
+ colourMenu.add(buriedColour);
+ colourMenu.add(nucleotideColour);
+ colourMenu.add(purinePyrimidineColour);
+ colourMenu.add(tcoffeeColour);
+ colourMenu.add(userDefinedColour);
+ colourMenu.addSeparator();
+ colourMenu.add(conservationMenuItem);
+ colourMenu.add(modifyConservation);
+ colourMenu.add(abovePIDThreshold);
+ colourMenu.add(modifyPID);
+ colourMenu.add(annotationColour);
+ colourMenu.add(RNAHelixColour);
+ calculateMenu.add(sort);
+ calculateMenu.add(calculate);
+ calculateMenu.addSeparator();
+ calculateMenu.add(pairwiseAlignmentMenuItem);
+ calculateMenu.add(PCAMenuItem);
+ calculateMenu.add(autoCalculate);
+ calculateMenu.add(sortByTree);
+ this.add(statusBar, BorderLayout.SOUTH);
+ pasteMenu.add(pasteNew);
+ pasteMenu.add(pasteThis);
+ sort.add(sortIDMenuItem);
+ sort.add(sortLengthMenuItem);
+ sort.add(sortByTreeMenu);
+ sort.add(sortGroupMenuItem);
+ sort.add(sortPairwiseMenuItem);
+ calculate.add(averageDistanceTreeMenuItem);
+ calculate.add(neighbourTreeMenuItem);
+ calculate.add(avDistanceTreeBlosumMenuItem);
+ calculate.add(njTreeBlosumMenuItem);
+ helpMenu.add(documentation);
+ helpMenu.add(about);
+ menu1.add(showColumns);
+ menu1.add(showSeqs);
+ menu1.add(showAllHidden);
+ menu2.add(hideColumns);
+ menu2.add(hideSequences);
+ menu2.add(hideAllSelection);
+ menu2.add(hideAllButSelection);
+ formatMenu.add(font);
+ formatMenu.add(seqLimits);
+ formatMenu.add(wrapMenuItem);
+ formatMenu.add(scaleAbove);
+ formatMenu.add(scaleLeft);
+ formatMenu.add(scaleRight);
+ formatMenu.add(viewBoxesMenuItem);
+ formatMenu.add(viewTextMenuItem);
+ formatMenu.add(colourTextMenuItem);
+ formatMenu.add(displayNonconservedMenuItem);
+ formatMenu.add(renderGapsMenuItem);
+ formatMenu.add(centreColumnLabelFlag);
+ selectMenu.add(findMenuItem);
+ selectMenu.addSeparator();
+ selectMenu.add(selectAllSequenceMenuItem);
+ selectMenu.add(deselectAllSequenceMenuItem);
+ selectMenu.add(invertSequenceMenuItem);
+ selectMenu.add(invertColSel);
+ selectMenu.add(grpsFromSelection);
+ selectMenu.add(deleteGroups);
+
+ }
+
+ MenuItem featureSettings = new MenuItem();
+
+ CheckboxMenuItem sequenceFeatures = new CheckboxMenuItem();
+
+ MenuItem annotationColour = new MenuItem();
+
+ MenuItem invertColSel = new MenuItem();
+
+ Menu menu1 = new Menu();
+
+ MenuItem showColumns = new MenuItem();
+
+ MenuItem showSeqs = new MenuItem();
+
+ Menu menu2 = new Menu();
+
+ MenuItem hideColumns = new MenuItem();
+
+ MenuItem hideSequences = new MenuItem();
+
+ MenuItem hideAllButSelection = new MenuItem();
+
+ MenuItem hideAllSelection = new MenuItem();
+
+ MenuItem showAllHidden = new MenuItem();
+
+ Menu formatMenu = new Menu();
+
+ Menu selectMenu = new Menu();
+
+ MenuItem newView = new MenuItem();
+
+ /**
+ * Attach the alignFrame panels after embedding menus, if necessary. This used
+ * to be called setEmbedded, but is now creates the dropdown menus in a
+ * platform independent manner to avoid OSX/Mac menu appendage daftness.
+ *
+ * @param reallyEmbedded
+ * true to attach the view to the applet area on the page rather than
+ * in a new window
+ */
+ public void createAlignFrameWindow(boolean reallyEmbedded, String title)
+ {
+ if (reallyEmbedded)
+ {
+ // ////
+ // Explicly build the embedded menu panel for the on-page applet
+ //
+ // view cannot be closed if its actually on the page
+ fileMenu.remove(closeMenuItem);
+ fileMenu.remove(3); // Remove Seperator
+ embeddedMenu = makeEmbeddedPopupMenu(alignFrameMenuBar, "Arial",
+ Font.PLAIN, 10, false); // use our own fonts.
+ // and actually add the components to the applet area
+ viewport.applet.setLayout(new BorderLayout());
+ viewport.applet.add(embeddedMenu, BorderLayout.NORTH);
+ viewport.applet.add(statusBar, BorderLayout.SOUTH);
+ alignPanel.setSize(viewport.applet.getSize().width,
+ viewport.applet.getSize().height - embeddedMenu.HEIGHT
+ - statusBar.HEIGHT);
+ viewport.applet.add(alignPanel, BorderLayout.CENTER);
+ final AlignFrame me = this;
+ viewport.applet.addFocusListener(new FocusListener()
+ {
+
+ @Override
+ public void focusLost(FocusEvent e)
+ {
+ if (me.viewport.applet.currentAlignFrame == me)
+ {
+ me.viewport.applet.currentAlignFrame = null;
+ }
+ }
+
+ @Override
+ public void focusGained(FocusEvent e)
+ {
+ me.viewport.applet.currentAlignFrame = me;
+ }
+ });
+ viewport.applet.validate();
+ }
+ else
+ {
+ // //////
+ // test and embed menu bar if necessary.
+ //
+ if (embedMenuIfNeeded(alignPanel))
+ {
+ // adjust for status bar height too
+ alignPanel.setSize(getSize().width, getSize().height
+ - statusBar.HEIGHT);
+ }
+ add(statusBar, BorderLayout.SOUTH);
+ add(alignPanel, BorderLayout.CENTER);
+ // and register with the applet so it can pass external API calls to us
+ jalview.bin.JalviewLite.addFrame(this, title, DEFAULT_WIDTH,
+ DEFAULT_HEIGHT);
+ }
+ }
+
+ /**
+ * create a new binding between structures in an existing jmol viewer instance
+ * and an alignpanel with sequences that have existing PDBFile entries. Note,
+ * this does not open a new Jmol window, or modify the display of the
+ * structures in the original jmol window. Note This method doesn't work
+ * without an additional javascript library to exchange messages between the
+ * distinct applets. See http://issues.jalview.org/browse/JAL-621
+ *
+ * @param viewer
+ * JmolViewer instance
+ * @param sequenceIds
+ * - sequence Ids to search for associations
+ */
+ public SequenceStructureBinding addStructureViewInstance(
+ Object jmolviewer, String[] sequenceIds)
+ {
+ org.jmol.api.JmolViewer viewer = null;
+ try
+ {
+ viewer = (org.jmol.api.JmolViewer) jmolviewer;
+ } catch (ClassCastException ex)
+ {
+ System.err.println("Unsupported viewer object :"
+ + jmolviewer.getClass());
+ }
+ if (viewer == null)
+ {
+ System.err.println("Can't use this object as a structure viewer:"
+ + jmolviewer.getClass());
+ return null;
+ }
+ SequenceI[] seqs = null;
+ if (sequenceIds == null || sequenceIds.length == 0)
+ {
+ seqs = viewport.getAlignment().getSequencesArray();
+ }
+ else
+ {
+ Vector sqi = new Vector();
+ AlignmentI al = viewport.getAlignment();
+ for (int sid = 0; sid < sequenceIds.length; sid++)
+ {
+ SequenceI sq = al.findName(sequenceIds[sid]);
+ if (sq != null)
+ {
+ sqi.addElement(sq);
+ }
+ }
+ if (sqi.size() > 0)
+ {
+ seqs = new SequenceI[sqi.size()];
+ for (int sid = 0, sSize = sqi.size(); sid < sSize; sid++)
+ {
+ seqs[sid] = (SequenceI) sqi.elementAt(sid);
+ }
+ }
+ else
+ {
+ return null;
+ }
+ }
+ ExtJmol jmv = null;
+ // TODO: search for a jmv that involves viewer
+ if (jmv == null)
+ { // create a new viewer/jalview binding.
+ jmv = new ExtJmol(viewer, alignPanel, new SequenceI[][]
+ { seqs });
+ }
+ return jmv;
+
+ }
+
+ /**
+ * bind a pdb file to a sequence in the current view
+ *
+ * @param sequenceId
+ * - sequenceId within the dataset.
+ * @param pdbEntryString
+ * - the short name for the PDB file
+ * @param pdbFile
+ * - pdb file - either a URL or a valid PDB file.
+ * @return true if binding was as success TODO: consider making an exception
+ * structure for indicating when PDB parsing or sequenceId location
+ * fails.
+ */
+ public boolean addPdbFile(String sequenceId, String pdbEntryString,
+ String pdbFile)
+ {
+ SequenceI toaddpdb = viewport.getAlignment().findName(sequenceId);
+ boolean needtoadd = false;
+ if (toaddpdb != null)
+ {
+ Vector pdbe = toaddpdb.getPDBId();
+ PDBEntry pdbentry = null;
+ if (pdbe != null && pdbe.size() > 0)
+ {
+ for (int pe = 0, peSize = pdbe.size(); pe < peSize; pe++)
+ {
+ pdbentry = (PDBEntry) pdbe.elementAt(pe);
+ if (!pdbentry.getId().equals(pdbEntryString)
+ && !pdbentry.getFile().equals(pdbFile))
+ {
+ pdbentry = null;
+ }
+ else
+ {
+ continue;
+ }
+ }
+ }
+ if (pdbentry == null)
+ {
+ pdbentry = new PDBEntry();
+ pdbentry.setId(pdbEntryString);
+ pdbentry.setFile(pdbFile);
+ needtoadd = true; // add this new entry to sequence.
+ }
+ // resolve data source
+ // TODO: this code should be a refactored to an io package
+ String protocol = AppletFormatAdapter.resolveProtocol(pdbFile, "PDB");
+ if (protocol == null)
+ {
+ return false;
+ }
+ if (needtoadd)
+ {
+ // make a note of the access mode and add
+ if (pdbentry.getProperty() == null)
+ {
+ pdbentry.setProperty(new Hashtable());
+ }
+ pdbentry.getProperty().put("protocol", protocol);
+ toaddpdb.addPDBId(pdbentry);
+ }
+ }
+ return true;
+ }
+
+ private Object[] cleanSeqChainArrays(SequenceI[] seqs, String[] chains)
+ {
+ if (seqs != null)
+ {
+ Vector sequences = new Vector();
+ for (int i = 0; i < seqs.length; i++)
+ {
+ if (seqs[i] != null)
+ {
+ sequences.addElement(new Object[]
+ { seqs[i], (chains != null) ? chains[i] : null });
+ }
+ }
+ seqs = new SequenceI[sequences.size()];
+ chains = new String[sequences.size()];
+ for (int i = 0, isize = sequences.size(); i < isize; i++)
+ {
+ Object[] oj = (Object[]) sequences.elementAt(i);
+
+ seqs[i] = (SequenceI) oj[0];
+ chains[i] = (String) oj[1];
+ }
+ }
+ return new Object[]
+ { seqs, chains };
+
+ }
+
+ public void newStructureView(JalviewLite applet, PDBEntry pdb,
+ SequenceI[] seqs, String[] chains, String protocol)
+ {
+ // Scrub any null sequences from the array
+ Object[] sqch = cleanSeqChainArrays(seqs, chains);
+ seqs = (SequenceI[]) sqch[0];
+ chains = (String[]) sqch[1];
+ if (seqs == null || seqs.length == 0)
+ {
+ System.err
+ .println("JalviewLite.AlignFrame:newStructureView: No sequence to bind structure to.");
+ }
+ if (protocol == null || protocol.trim().length() == 0
+ || protocol.equals("null"))
+ {
+ protocol = (String) pdb.getProperty().get("protocol");
+ if (protocol == null)
+ {
+ System.err.println("Couldn't work out protocol to open structure: "
+ + pdb.getId());
+ return;
+ }
+ }
+ if (applet.useXtrnalSviewer)
+ {
+ // register the association(s) and quit, don't create any windows.
+ if (StructureSelectionManager.getStructureSelectionManager(applet)
+ .setMapping(seqs, chains, pdb.getFile(), protocol) == null)
+ {
+ System.err.println("Failed to map " + pdb.getFile() + " ("
+ + protocol + ") to any sequences");
+ }
+ return;
+ }
+ if (applet.isAlignPdbStructures() && applet.jmolAvailable)
+ {
+ // can only do alignments with Jmol
+ // find the last jmol window assigned to this alignment
+ jalview.appletgui.AppletJmol ajm = null, tajm;
+ Vector jmols = applet
+ .getAppletWindow(jalview.appletgui.AppletJmol.class);
+ for (int i = 0, iSize = jmols.size(); i < iSize; i++)
+ {
+ tajm = (jalview.appletgui.AppletJmol) jmols.elementAt(i);
+ if (tajm.ap.alignFrame == this)
+ {
+ ajm = tajm;
+ break;
+ }
+ }
+ if (ajm != null)
+ {
+ System.err
+ .println("Incremental adding and aligning structure to existing Jmol view not yet implemented.");
+ // try and add the pdb structure
+ // ajm.addS
+ ajm = null;
+ }
+ }
+ // otherwise, create a new window
+ if (applet.jmolAvailable)
+ {
+ new jalview.appletgui.AppletJmol(pdb, seqs, chains, alignPanel,
+ protocol);
+ applet.lastFrameX += 40;
+ applet.lastFrameY += 40;
+ }
+ else
+ {
+ new MCview.AppletPDBViewer(pdb, seqs, chains, alignPanel, protocol);
+ }
+
+ }
+
+ public void alignedStructureView(JalviewLite applet, PDBEntry[] pdb,
+ SequenceI[][] seqs, String[][] chains, String[] protocols)
+ {
+ // TODO Auto-generated method stub
+ System.err.println("Aligned Structure View: Not yet implemented.");
+ }
+
+ /**
+ * modify the current selection, providing the user has not made a selection
+ * already.
+ *
+ * @param sel
+ * - sequences from this alignment
+ * @param csel
+ * - columns to be selected on the alignment
+ */
+ public void select(SequenceGroup sel, ColumnSelection csel)
+ {
+ alignPanel.seqPanel.selection(sel, csel, null);
+ }
+
+ public void scrollTo(int row, int column)
+ {
+ alignPanel.seqPanel.scrollTo(row, column);
+ }
+
+ public void scrollToRow(int row)
+ {
+ alignPanel.seqPanel.scrollToRow(row);
+ }
+
+ public void scrollToColumn(int column)
+ {
+ alignPanel.seqPanel.scrollToColumn(column);
+ }
+
+ /**
+ * @return the alignments unique ID.
+ */
+ public String getSequenceSetId()
+ {
+ return viewport.getSequenceSetId();
+ }
+
+ /**
+ * Load the (T-Coffee) score file from the specified url
+ *
+ * @param source
+ * File/URL/T-COFFEE score file contents
+ * @throws IOException
+ * @return true if alignment was annotated with data from source
+ */
+ public boolean loadScoreFile(String source) throws IOException
+ {
+
+ TCoffeeScoreFile file = new TCoffeeScoreFile(source,
+ AppletFormatAdapter.checkProtocol(source));
+ if (!file.isValid())
+ {
+ // TODO: raise dialog for gui
+ System.err.println("Problems parsing T-Coffee scores: "
+ + file.getWarningMessage());
+ System.err.println("Origin was:\n" + source);
+ return false;
+ }
+
+ /*
+ * check that the score matrix matches the alignment dimensions
+ */
+ AlignmentI aln;
+ if ((aln = viewport.getAlignment()) != null
+ && (aln.getHeight() != file.getHeight() || aln.getWidth() != file
+ .getWidth()))
+ {
+ // TODO: raise a dialog box here rather than bomb out.
+ System.err
+ .println("The scores matrix does not match the alignment dimensions");
+
+ }
+
+ // TODO add parameter to indicate if matching should be done
+ if (file.annotateAlignment(alignPanel.getAlignment(), false))
+ {
+ alignPanel.fontChanged();
+ tcoffeeColour.setEnabled(true);
+ // switch to this color
+ changeColour(new TCoffeeColourScheme(alignPanel.getAlignment()));
+ return true;
+ }
+ else
+ {
+ System.err.println("Problems resolving T-Coffee scores:");
+ if (file.getWarningMessage() != null)
+ {
+ System.err.println(file.getWarningMessage());
+ }
+ }
+ return false;
+ }
+
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
package jalview.appletgui;
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.appletgui;\r
-\r
-import java.awt.BorderLayout;\r
-import java.awt.Color;\r
-import java.awt.Container;\r
-import java.awt.FlowLayout;\r
-import java.awt.Font;\r
-import java.awt.Frame;\r
-import java.awt.GraphicsConfiguration;\r
-import java.awt.HeadlessException;\r
-import java.awt.Label;\r
-import java.awt.Menu;\r
-import java.awt.MenuBar;\r
-import java.awt.Panel;\r
-import java.awt.PopupMenu;\r
-import java.awt.event.ActionListener;\r
-import java.awt.event.ItemListener;\r
-import java.awt.event.MouseEvent;\r
-import java.awt.event.MouseListener;\r
-import java.util.Enumeration;\r
-import java.util.Hashtable;\r
-\r
-/**\r
- * This class implements a pattern form embedding toolbars as a panel with\r
- * popups for situations where the system menu bar is either invisible or\r
- * inappropriate. It was derived from the code for embedding the jalview applet\r
- * alignFrame as a component on the web-page, which requires the local\r
- * alignFrame menu to be attached to that panel rather than placed on the parent\r
- * (which isn't allowed anyhow). TODO: try to modify the embeddedMenu display so\r
- * it looks like a real toolbar menu TODO: modify click/mouse handler for\r
- * embeddedMenu so it behaves more like a real pulldown menu toolbar\r
- * \r
- * @author Jim Procter and Andrew Waterhouse\r
- * \r
- */\r
-public class EmbmenuFrame extends Frame implements MouseListener\r
-{\r
- /**\r
- * map from labels to popup menus for the embedded menubar\r
- */\r
- protected Hashtable embeddedPopup;\r
-\r
- /**\r
- * the embedded menu is built on this and should be added to the frame at the\r
- * appropriate position.\r
- * \r
- */\r
- protected Panel embeddedMenu;\r
-\r
- public EmbmenuFrame() throws HeadlessException\r
- {\r
- super();\r
- }\r
-\r
- public EmbmenuFrame(String title) throws HeadlessException\r
- {\r
- super(title);\r
- }\r
-\r
- /**\r
- * Check if the applet is running on a platform that requires the Frame\r
- * menuBar to be embedded, and if so, embeds it.\r
- * \r
- * @param tobeAdjusted\r
- * the panel that is to be reduced to make space for the embedded\r
- * menu bar\r
- * @return true if menuBar was embedded and tobeAdjusted's height modified\r
- */\r
- protected boolean embedMenuIfNeeded(Panel tobeAdjusted)\r
- {\r
- MenuBar topMenuBar = getMenuBar();\r
- if (topMenuBar == null)\r
- {\r
- return false;\r
- }\r
- // DEBUG Hint: can test embedded menus by inserting true here.\r
- if (new jalview.util.Platform().isAMac())\r
- {\r
- // Build the embedded menu panel\r
- embeddedMenu = makeEmbeddedPopupMenu(topMenuBar, "Arial", Font.PLAIN,\r
- 10, true); // try to pickup system font.\r
- setMenuBar(null);\r
- // add the components to the TreePanel area.\r
- add(embeddedMenu, BorderLayout.NORTH);\r
- tobeAdjusted.setSize(getSize().width, getSize().height\r
- - embeddedMenu.HEIGHT);\r
- return true;\r
- }\r
- return false;\r
- }\r
-\r
- /**\r
- * move all menus on menuBar onto embeddedMenu. embeddedPopup is used to store\r
- * the popups for each menu removed from the menuBar and added to the panel.\r
- * NOTE: it is up to the caller to remove menuBar from the Frame if it is\r
- * already attached.\r
- * \r
- * @param menuBar\r
- * @param fn\r
- * @param fstyle\r
- * @param fsz\r
- * @param overrideFonts\r
- * true if we take the menuBar fonts in preference to the supplied\r
- * defaults\r
- * @return the embedded menu instance to be added to the frame.\r
- */\r
- protected Panel makeEmbeddedPopupMenu(MenuBar menuBar, String fn,\r
- int fstyle, int fsz, boolean overrideFonts)\r
- {\r
- return makeEmbeddedPopupMenu(menuBar, fn, fstyle, fsz, overrideFonts,\r
- false);\r
- }\r
-\r
- /**\r
- * Create or add elements to the embedded menu from menuBar. This removes all\r
- * menu from menuBar and it is up to the caller to remove the now useless\r
- * menuBar from the Frame if it is already attached.\r
- * \r
- * @param menuBar\r
- * @param fn\r
- * @param fstyle\r
- * @param fsz\r
- * @param overrideFonts\r
- * @param append\r
- * true means existing menu will be emptied before adding new\r
- * elements\r
- * @return\r
- */\r
- protected Panel makeEmbeddedPopupMenu(MenuBar menuBar, String fn,\r
- int fstyle, int fsz, boolean overrideFonts, boolean append)\r
- {\r
- if (!append)\r
- {\r
- if (embeddedPopup != null)\r
- {\r
- embeddedPopup.clear(); // TODO: check if j1.1\r
- }\r
- if (embeddedMenu != null)\r
- {\r
- embeddedMenu.removeAll();\r
- }\r
- }\r
- if (embeddedPopup == null)\r
- {\r
- embeddedPopup = new Hashtable();\r
- }\r
-\r
- embeddedMenu = makeEmbeddedPopupMenu(menuBar, fn, fstyle, fsz,\r
- overrideFonts, embeddedPopup, new Panel(), this);\r
- return embeddedMenu;\r
- }\r
-\r
- /**\r
- * Generic method to move elements from menubar onto embeddedMenu using the\r
- * existing or the supplied font, and adds binding from panel to attached\r
- * menus in embeddedPopup This removes all menu from menuBar and it is up to\r
- * the caller to remove the now useless menuBar from the Frame if it is\r
- * already attached.\r
- * \r
- * @param menuBar\r
- * must be non-null\r
- * @param fn\r
- * @param fstyle\r
- * @param fsz\r
- * @param overrideFonts\r
- * @param embeddedPopup\r
- * must be non-null\r
- * @param embeddedMenu\r
- * if null, a new panel will be created and returned\r
- * @param clickHandler\r
- * - usually the instance of EmbmenuFrame that holds references to\r
- * embeddedPopup and embeddedMenu\r
- * @return the panel instance for convenience.\r
- */\r
- protected Panel makeEmbeddedPopupMenu(MenuBar menuBar, String fn,\r
- int fstyle, int fsz, boolean overrideFonts,\r
- Hashtable embeddedPopup, Panel embeddedMenu,\r
- MouseListener clickHandler)\r
- {\r
- if (embeddedPopup == null)\r
- {\r
- throw new Error(\r
- "Implementation error - embeddedPopup must be non-null");\r
- }\r
- if (overrideFonts)\r
- {\r
- Font mbf = menuBar.getFont();\r
- if (mbf != null)\r
- {\r
- fn = mbf.getName();\r
- fstyle = mbf.getStyle();\r
- fsz = mbf.getSize();\r
- }\r
- }\r
- if (embeddedMenu == null)\r
- embeddedMenu = new Panel();\r
- FlowLayout flowLayout1 = new FlowLayout();\r
- embeddedMenu.setBackground(Color.lightGray);\r
- embeddedMenu.setLayout(flowLayout1);\r
- // loop thru\r
- for (int mbi = 0, nMbi = menuBar.getMenuCount(); mbi < nMbi; mbi++)\r
- {\r
- Menu mi = menuBar.getMenu(mbi);\r
- Label elab = new Label(mi.getLabel());\r
- elab.setFont(new java.awt.Font(fn, fstyle, fsz));\r
- // add the menu entries\r
- PopupMenu popup = new PopupMenu();\r
- int m, mSize = mi.getItemCount();\r
- for (m = 0; m < mSize; m++)\r
- {\r
- popup.add(mi.getItem(m));\r
- mSize--;\r
- m--;\r
- }\r
- embeddedPopup.put(elab, popup);\r
- embeddedMenu.add(elab);\r
- elab.addMouseListener(clickHandler);\r
- }\r
- flowLayout1.setAlignment(FlowLayout.LEFT);\r
- flowLayout1.setHgap(2);\r
- flowLayout1.setVgap(0);\r
- return embeddedMenu;\r
- }\r
-\r
- public void mousePressed(MouseEvent evt)\r
- {\r
- PopupMenu popup = null;\r
- Label source = (Label) evt.getSource();\r
- popup = getPopupMenu(source);\r
- if (popup != null)\r
- {\r
- embeddedMenu.add(popup);\r
- popup.show(embeddedMenu, source.getBounds().x, source.getBounds().y\r
- + source.getBounds().getSize().height);\r
- }\r
- }\r
-\r
- /**\r
- * get the menu for source from the hash.\r
- * \r
- * @param source\r
- * what was clicked on.\r
- */\r
- PopupMenu getPopupMenu(Label source)\r
- {\r
- return (PopupMenu) embeddedPopup.get(source);\r
- }\r
-\r
- public void mouseClicked(MouseEvent evt)\r
- {\r
- }\r
-\r
- public void mouseReleased(MouseEvent evt)\r
- {\r
- }\r
-\r
- public void mouseEntered(MouseEvent evt)\r
- {\r
- }\r
-\r
- public void mouseExited(MouseEvent evt)\r
- {\r
- }\r
-\r
- /**\r
- * called to clear the GUI resources taken up for embedding and remove any\r
- * self references so we can be garbage collected.\r
- */\r
- public void destroyMenus()\r
- {\r
- if (embeddedPopup != null)\r
- {\r
- Enumeration e = embeddedPopup.keys();\r
- while (e.hasMoreElements())\r
- {\r
- Label lb = (Label) e.nextElement();\r
- lb.removeMouseListener(this);\r
- }\r
- embeddedPopup.clear();\r
- }\r
- if (embeddedMenu != null)\r
- {\r
- embeddedMenu.removeAll();\r
- }\r
- }\r
-\r
- /**\r
- * calls destroyMenus()\r
- */\r
- public void finalize() throws Throwable\r
- {\r
- destroyMenus();\r
- embeddedPopup = null;\r
- embeddedMenu = null;\r
- super.finalize();\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.appletgui;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Container;
+import java.awt.FlowLayout;
+import java.awt.Font;
+import java.awt.Frame;
+import java.awt.GraphicsConfiguration;
+import java.awt.HeadlessException;
+import java.awt.Label;
+import java.awt.Menu;
+import java.awt.MenuBar;
+import java.awt.Panel;
+import java.awt.PopupMenu;
+import java.awt.event.ActionListener;
+import java.awt.event.ItemListener;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.util.Enumeration;
+import java.util.Hashtable;
+
+/**
+ * This class implements a pattern form embedding toolbars as a panel with
+ * popups for situations where the system menu bar is either invisible or
+ * inappropriate. It was derived from the code for embedding the jalview applet
+ * alignFrame as a component on the web-page, which requires the local
+ * alignFrame menu to be attached to that panel rather than placed on the parent
+ * (which isn't allowed anyhow). TODO: try to modify the embeddedMenu display so
+ * it looks like a real toolbar menu TODO: modify click/mouse handler for
+ * embeddedMenu so it behaves more like a real pulldown menu toolbar
+ *
+ * @author Jim Procter and Andrew Waterhouse
+ *
+ */
+public class EmbmenuFrame extends Frame implements MouseListener
+{
+ /**
+ * map from labels to popup menus for the embedded menubar
+ */
+ protected Hashtable embeddedPopup;
+
+ /**
+ * the embedded menu is built on this and should be added to the frame at the
+ * appropriate position.
+ *
+ */
+ protected Panel embeddedMenu;
+
+ public EmbmenuFrame() throws HeadlessException
+ {
+ super();
+ }
+
+ public EmbmenuFrame(String title) throws HeadlessException
+ {
+ super(title);
+ }
+
+ /**
+ * Check if the applet is running on a platform that requires the Frame
+ * menuBar to be embedded, and if so, embeds it.
+ *
+ * @param tobeAdjusted
+ * the panel that is to be reduced to make space for the embedded
+ * menu bar
+ * @return true if menuBar was embedded and tobeAdjusted's height modified
+ */
+ protected boolean embedMenuIfNeeded(Panel tobeAdjusted)
+ {
+ MenuBar topMenuBar = getMenuBar();
+ if (topMenuBar == null)
+ {
+ return false;
+ }
+ // DEBUG Hint: can test embedded menus by inserting true here.
+ if (new jalview.util.Platform().isAMac())
+ {
+ // Build the embedded menu panel
+ embeddedMenu = makeEmbeddedPopupMenu(topMenuBar, "Arial", Font.PLAIN,
+ 10, true); // try to pickup system font.
+ setMenuBar(null);
+ // add the components to the TreePanel area.
+ add(embeddedMenu, BorderLayout.NORTH);
+ tobeAdjusted.setSize(getSize().width, getSize().height
+ - embeddedMenu.HEIGHT);
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * move all menus on menuBar onto embeddedMenu. embeddedPopup is used to store
+ * the popups for each menu removed from the menuBar and added to the panel.
+ * NOTE: it is up to the caller to remove menuBar from the Frame if it is
+ * already attached.
+ *
+ * @param menuBar
+ * @param fn
+ * @param fstyle
+ * @param fsz
+ * @param overrideFonts
+ * true if we take the menuBar fonts in preference to the supplied
+ * defaults
+ * @return the embedded menu instance to be added to the frame.
+ */
+ protected Panel makeEmbeddedPopupMenu(MenuBar menuBar, String fn,
+ int fstyle, int fsz, boolean overrideFonts)
+ {
+ return makeEmbeddedPopupMenu(menuBar, fn, fstyle, fsz, overrideFonts,
+ false);
+ }
+
+ /**
+ * Create or add elements to the embedded menu from menuBar. This removes all
+ * menu from menuBar and it is up to the caller to remove the now useless
+ * menuBar from the Frame if it is already attached.
+ *
+ * @param menuBar
+ * @param fn
+ * @param fstyle
+ * @param fsz
+ * @param overrideFonts
+ * @param append
+ * true means existing menu will be emptied before adding new
+ * elements
+ * @return
+ */
+ protected Panel makeEmbeddedPopupMenu(MenuBar menuBar, String fn,
+ int fstyle, int fsz, boolean overrideFonts, boolean append)
+ {
+ if (!append)
+ {
+ if (embeddedPopup != null)
+ {
+ embeddedPopup.clear(); // TODO: check if j1.1
+ }
+ if (embeddedMenu != null)
+ {
+ embeddedMenu.removeAll();
+ }
+ }
+ if (embeddedPopup == null)
+ {
+ embeddedPopup = new Hashtable();
+ }
+
+ embeddedMenu = makeEmbeddedPopupMenu(menuBar, fn, fstyle, fsz,
+ overrideFonts, embeddedPopup, new Panel(), this);
+ return embeddedMenu;
+ }
+
+ /**
+ * Generic method to move elements from menubar onto embeddedMenu using the
+ * existing or the supplied font, and adds binding from panel to attached
+ * menus in embeddedPopup This removes all menu from menuBar and it is up to
+ * the caller to remove the now useless menuBar from the Frame if it is
+ * already attached.
+ *
+ * @param menuBar
+ * must be non-null
+ * @param fn
+ * @param fstyle
+ * @param fsz
+ * @param overrideFonts
+ * @param embeddedPopup
+ * must be non-null
+ * @param embeddedMenu
+ * if null, a new panel will be created and returned
+ * @param clickHandler
+ * - usually the instance of EmbmenuFrame that holds references to
+ * embeddedPopup and embeddedMenu
+ * @return the panel instance for convenience.
+ */
+ protected Panel makeEmbeddedPopupMenu(MenuBar menuBar, String fn,
+ int fstyle, int fsz, boolean overrideFonts,
+ Hashtable embeddedPopup, Panel embeddedMenu,
+ MouseListener clickHandler)
+ {
+ if (embeddedPopup == null)
+ {
+ throw new Error(
+ "Implementation error - embeddedPopup must be non-null");
+ }
+ if (overrideFonts)
+ {
+ Font mbf = menuBar.getFont();
+ if (mbf != null)
+ {
+ fn = mbf.getName();
+ fstyle = mbf.getStyle();
+ fsz = mbf.getSize();
+ }
+ }
+ if (embeddedMenu == null)
+ embeddedMenu = new Panel();
+ FlowLayout flowLayout1 = new FlowLayout();
+ embeddedMenu.setBackground(Color.lightGray);
+ embeddedMenu.setLayout(flowLayout1);
+ // loop thru
+ for (int mbi = 0, nMbi = menuBar.getMenuCount(); mbi < nMbi; mbi++)
+ {
+ Menu mi = menuBar.getMenu(mbi);
+ Label elab = new Label(mi.getLabel());
+ elab.setFont(new java.awt.Font(fn, fstyle, fsz));
+ // add the menu entries
+ PopupMenu popup = new PopupMenu();
+ int m, mSize = mi.getItemCount();
+ for (m = 0; m < mSize; m++)
+ {
+ popup.add(mi.getItem(m));
+ mSize--;
+ m--;
+ }
+ embeddedPopup.put(elab, popup);
+ embeddedMenu.add(elab);
+ elab.addMouseListener(clickHandler);
+ }
+ flowLayout1.setAlignment(FlowLayout.LEFT);
+ flowLayout1.setHgap(2);
+ flowLayout1.setVgap(0);
+ return embeddedMenu;
+ }
+
+ public void mousePressed(MouseEvent evt)
+ {
+ PopupMenu popup = null;
+ Label source = (Label) evt.getSource();
+ popup = getPopupMenu(source);
+ if (popup != null)
+ {
+ embeddedMenu.add(popup);
+ popup.show(embeddedMenu, source.getBounds().x, source.getBounds().y
+ + source.getBounds().getSize().height);
+ }
+ }
+
+ /**
+ * get the menu for source from the hash.
+ *
+ * @param source
+ * what was clicked on.
+ */
+ PopupMenu getPopupMenu(Label source)
+ {
+ return (PopupMenu) embeddedPopup.get(source);
+ }
+
+ public void mouseClicked(MouseEvent evt)
+ {
+ }
+
+ public void mouseReleased(MouseEvent evt)
+ {
+ }
+
+ public void mouseEntered(MouseEvent evt)
+ {
+ }
+
+ public void mouseExited(MouseEvent evt)
+ {
+ }
+
+ /**
+ * called to clear the GUI resources taken up for embedding and remove any
+ * self references so we can be garbage collected.
+ */
+ public void destroyMenus()
+ {
+ if (embeddedPopup != null)
+ {
+ Enumeration e = embeddedPopup.keys();
+ while (e.hasMoreElements())
+ {
+ Label lb = (Label) e.nextElement();
+ lb.removeMouseListener(this);
+ }
+ embeddedPopup.clear();
+ }
+ if (embeddedMenu != null)
+ {
+ embeddedMenu.removeAll();
+ }
+ }
+
+ /**
+ * calls destroyMenus()
+ */
+ public void finalize() throws Throwable
+ {
+ destroyMenus();
+ embeddedPopup = null;
+ embeddedMenu = null;
+ super.finalize();
+ }
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
package jalview.appletgui;
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
package jalview.appletgui;
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.appletgui;\r
-\r
-import java.applet.*;\r
-import java.util.*;\r
-\r
-import java.awt.*;\r
-import java.awt.event.*;\r
-\r
-public class Tooltip extends Canvas implements MouseListener,\r
- MouseMotionListener\r
-{\r
- private String[] tip;\r
-\r
- private String lastTip = "";\r
-\r
- private boolean setPosition = false;\r
-\r
- protected Component owner;\r
-\r
- private Container mainContainer;\r
-\r
- private LayoutManager mainLayout;\r
-\r
- private boolean shown;\r
-\r
- private final int VERTICAL_OFFSET = 20;\r
-\r
- private final int HORIZONTAL_ENLARGE = 10;\r
-\r
- int fontHeight = 0;\r
-\r
- Image linkImage;\r
-\r
- FontMetrics fm;\r
-\r
- public Tooltip(String tip, Component owner)\r
- {\r
- this.owner = owner;\r
- owner.addMouseListener(this);\r
- owner.addMouseMotionListener(this);\r
- setBackground(new Color(255, 255, 220));\r
- setTip(tip);\r
- java.net.URL url = getClass().getResource("/images/link.gif");\r
- if (url != null)\r
- {\r
- linkImage = java.awt.Toolkit.getDefaultToolkit().getImage(url);\r
- }\r
- }\r
-\r
- public void paint(Graphics g)\r
- {\r
- int w = getSize().width;\r
- int h = getSize().height;\r
-\r
- g.drawRect(0, 0, w - 1, h - 1);\r
- int lindex, x;\r
- for (int i = 0; i < tip.length; i++)\r
- {\r
- x = 3;\r
- lindex = tip[i].indexOf("%LINK%");\r
- if (lindex != -1)\r
- {\r
- if (lindex > 0)\r
- {\r
- g.drawString(tip[i].substring(0, lindex), 3, (i + 1) * fontHeight\r
- - 3);\r
- x += fm.stringWidth(tip[i].substring(0, lindex) + 3);\r
- }\r
- g.drawImage(linkImage, x, i * fontHeight + 1, this);\r
- if (lindex + 6 < tip[i].length())\r
- {\r
- g.drawString(tip[i].substring(lindex + 6),\r
- x + linkImage.getWidth(this), (i + 1) * fontHeight - 3);\r
- }\r
- }\r
- else\r
- {\r
- g.drawString(tip[i], 3, (i + 1) * fontHeight - 3);\r
- }\r
- }\r
- }\r
-\r
- synchronized void setTip(String tip)\r
- {\r
- if (tip == null)\r
- {\r
- setTip("");\r
- return;\r
- }\r
-\r
- if (lastTip.equals(tip))\r
- {\r
- return;\r
- }\r
-\r
- lastTip = tip;\r
- setPosition = true;\r
-\r
- fm = getFontMetrics(owner.getFont());\r
- fontHeight = fm.getHeight();\r
-\r
- int longestLine = 0;\r
- StringTokenizer st = new StringTokenizer(tip, "\n");\r
- this.tip = new String[st.countTokens()];\r
- int index = 0;\r
- while (st.hasMoreElements())\r
- {\r
- this.tip[index] = st.nextToken();\r
- if (fm.stringWidth(this.tip[index]) > longestLine)\r
- {\r
- longestLine = fm.stringWidth(this.tip[index]);\r
- }\r
- index++;\r
- }\r
-\r
- setSize(longestLine + HORIZONTAL_ENLARGE, fontHeight * this.tip.length);\r
-\r
- repaint();\r
-\r
- }\r
-\r
- void setTipLocation(MouseEvent evt)\r
- {\r
- if (mainContainer == null || owner == null)\r
- {\r
- return;\r
- }\r
- setLocation(\r
- (owner.getLocationOnScreen().x - mainContainer.getLocationOnScreen().x)\r
- + evt.getX(),\r
- (owner.getLocationOnScreen().y\r
- - mainContainer.getLocationOnScreen().y + VERTICAL_OFFSET)\r
- + evt.getY());\r
-\r
- // correction, whole tool tip must be visible\r
- if (mainContainer.getSize().width < (getLocation().x + getSize().width))\r
- {\r
- setLocation(mainContainer.getSize().width - getSize().width,\r
- getLocation().y);\r
- }\r
- }\r
-\r
- private void removeToolTip()\r
- {\r
- if (shown)\r
- {\r
- mainContainer.remove(0);\r
- mainContainer.setLayout(mainLayout);\r
- mainContainer.validate();\r
- }\r
- shown = false;\r
- }\r
-\r
- private void findMainContainer()\r
- {\r
- Container parent = owner.getParent();\r
- while (true)\r
- {\r
- if ((parent instanceof Applet) || (parent instanceof Frame))\r
- {\r
- mainContainer = parent;\r
- break;\r
- }\r
- else\r
- {\r
- parent = parent.getParent();\r
- }\r
- }\r
- mainLayout = mainContainer.getLayout();\r
- }\r
-\r
- public void mouseEntered(MouseEvent me)\r
- {\r
- setTipLocation(me);\r
- }\r
-\r
- public void mouseExited(MouseEvent me)\r
- {\r
- removeToolTip();\r
- }\r
-\r
- public void mousePressed(MouseEvent me)\r
- {\r
- removeToolTip();\r
- }\r
-\r
- public void mouseReleased(MouseEvent me)\r
- {\r
- }\r
-\r
- public void mouseClicked(MouseEvent me)\r
- {\r
- }\r
-\r
- public void mouseMoved(MouseEvent me)\r
- {\r
- if (!shown)\r
- {\r
- findMainContainer();\r
- mainContainer.setLayout(null);\r
- mainContainer.add(this, 0);\r
- mainContainer.validate();\r
- shown = true;\r
- setTipLocation(me);\r
- }\r
- else if (setPosition)\r
- {\r
- setTipLocation(me);\r
- setPosition = false;\r
- }\r
- }\r
-\r
- public void mouseDragged(MouseEvent me)\r
- {\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.appletgui;
+
+import java.applet.*;
+import java.util.*;
+
+import java.awt.*;
+import java.awt.event.*;
+
+public class Tooltip extends Canvas implements MouseListener,
+ MouseMotionListener
+{
+ private String[] tip;
+
+ private String lastTip = "";
+
+ private boolean setPosition = false;
+
+ protected Component owner;
+
+ private Container mainContainer;
+
+ private LayoutManager mainLayout;
+
+ private boolean shown;
+
+ private final int VERTICAL_OFFSET = 20;
+
+ private final int HORIZONTAL_ENLARGE = 10;
+
+ int fontHeight = 0;
+
+ Image linkImage;
+
+ FontMetrics fm;
+
+ public Tooltip(String tip, Component owner)
+ {
+ this.owner = owner;
+ owner.addMouseListener(this);
+ owner.addMouseMotionListener(this);
+ setBackground(new Color(255, 255, 220));
+ setTip(tip);
+ java.net.URL url = getClass().getResource("/images/link.gif");
+ if (url != null)
+ {
+ linkImage = java.awt.Toolkit.getDefaultToolkit().getImage(url);
+ }
+ }
+
+ public void paint(Graphics g)
+ {
+ int w = getSize().width;
+ int h = getSize().height;
+
+ g.drawRect(0, 0, w - 1, h - 1);
+ int lindex, x;
+ for (int i = 0; i < tip.length; i++)
+ {
+ x = 3;
+ lindex = tip[i].indexOf("%LINK%");
+ if (lindex != -1)
+ {
+ if (lindex > 0)
+ {
+ g.drawString(tip[i].substring(0, lindex), 3, (i + 1) * fontHeight
+ - 3);
+ x += fm.stringWidth(tip[i].substring(0, lindex) + 3);
+ }
+ g.drawImage(linkImage, x, i * fontHeight + 1, this);
+ if (lindex + 6 < tip[i].length())
+ {
+ g.drawString(tip[i].substring(lindex + 6),
+ x + linkImage.getWidth(this), (i + 1) * fontHeight - 3);
+ }
+ }
+ else
+ {
+ g.drawString(tip[i], 3, (i + 1) * fontHeight - 3);
+ }
+ }
+ }
+
+ synchronized void setTip(String tip)
+ {
+ if (tip == null)
+ {
+ setTip("");
+ return;
+ }
+
+ if (lastTip.equals(tip))
+ {
+ return;
+ }
+
+ lastTip = tip;
+ setPosition = true;
+
+ fm = getFontMetrics(owner.getFont());
+ fontHeight = fm.getHeight();
+
+ int longestLine = 0;
+ StringTokenizer st = new StringTokenizer(tip, "\n");
+ this.tip = new String[st.countTokens()];
+ int index = 0;
+ while (st.hasMoreElements())
+ {
+ this.tip[index] = st.nextToken();
+ if (fm.stringWidth(this.tip[index]) > longestLine)
+ {
+ longestLine = fm.stringWidth(this.tip[index]);
+ }
+ index++;
+ }
+
+ setSize(longestLine + HORIZONTAL_ENLARGE, fontHeight * this.tip.length);
+
+ repaint();
+
+ }
+
+ void setTipLocation(MouseEvent evt)
+ {
+ if (mainContainer == null || owner == null)
+ {
+ return;
+ }
+ setLocation(
+ (owner.getLocationOnScreen().x - mainContainer.getLocationOnScreen().x)
+ + evt.getX(),
+ (owner.getLocationOnScreen().y
+ - mainContainer.getLocationOnScreen().y + VERTICAL_OFFSET)
+ + evt.getY());
+
+ // correction, whole tool tip must be visible
+ if (mainContainer.getSize().width < (getLocation().x + getSize().width))
+ {
+ setLocation(mainContainer.getSize().width - getSize().width,
+ getLocation().y);
+ }
+ }
+
+ private void removeToolTip()
+ {
+ if (shown)
+ {
+ mainContainer.remove(0);
+ mainContainer.setLayout(mainLayout);
+ mainContainer.validate();
+ }
+ shown = false;
+ }
+
+ private void findMainContainer()
+ {
+ Container parent = owner.getParent();
+ while (true)
+ {
+ if ((parent instanceof Applet) || (parent instanceof Frame))
+ {
+ mainContainer = parent;
+ break;
+ }
+ else
+ {
+ parent = parent.getParent();
+ }
+ }
+ mainLayout = mainContainer.getLayout();
+ }
+
+ public void mouseEntered(MouseEvent me)
+ {
+ setTipLocation(me);
+ }
+
+ public void mouseExited(MouseEvent me)
+ {
+ removeToolTip();
+ }
+
+ public void mousePressed(MouseEvent me)
+ {
+ removeToolTip();
+ }
+
+ public void mouseReleased(MouseEvent me)
+ {
+ }
+
+ public void mouseClicked(MouseEvent me)
+ {
+ }
+
+ public void mouseMoved(MouseEvent me)
+ {
+ if (!shown)
+ {
+ findMainContainer();
+ mainContainer.setLayout(null);
+ mainContainer.add(this, 0);
+ mainContainer.validate();
+ shown = true;
+ setTipLocation(me);
+ }
+ else if (setPosition)
+ {
+ setTipLocation(me);
+ setPosition = false;
+ }
+ }
+
+ public void mouseDragged(MouseEvent me)
+ {
+ }
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
package jalview.appletgui;
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.bin;\r
-\r
-import jalview.api.StructureSelectionManagerProvider;\r
-import jalview.appletgui.AlignFrame;\r
-import jalview.appletgui.AlignViewport;\r
-import jalview.appletgui.EmbmenuFrame;\r
-import jalview.appletgui.FeatureSettings;\r
-import jalview.datamodel.Alignment;\r
-import jalview.datamodel.AlignmentI;\r
-import jalview.datamodel.AlignmentOrder;\r
-import jalview.datamodel.ColumnSelection;\r
-import jalview.datamodel.PDBEntry;\r
-import jalview.datamodel.Sequence;\r
-import jalview.datamodel.SequenceGroup;\r
-import jalview.datamodel.SequenceI;\r
-import jalview.io.AnnotationFile;\r
-import jalview.io.AppletFormatAdapter;\r
-import jalview.io.FileParse;\r
-import jalview.io.IdentifyFile;\r
-import jalview.io.JnetAnnotationMaker;\r
-import jalview.javascript.JSFunctionExec;\r
-import jalview.javascript.JalviewLiteJsApi;\r
-import jalview.javascript.JsCallBack;\r
-import jalview.structure.SelectionListener;\r
-import jalview.structure.StructureSelectionManager;\r
-\r
-import java.applet.Applet;\r
-import java.awt.Button;\r
-import java.awt.Color;\r
-import java.awt.Component;\r
-import java.awt.EventQueue;\r
-import java.awt.Font;\r
-import java.awt.Frame;\r
-import java.awt.Graphics;\r
-import java.awt.event.ActionEvent;\r
-import java.awt.event.WindowAdapter;\r
-import java.awt.event.WindowEvent;\r
-import java.io.BufferedReader;\r
-import java.io.InputStreamReader;\r
-import java.net.URL;\r
-import java.util.Hashtable;\r
-import java.util.StringTokenizer;\r
-import java.util.Vector;\r
-\r
-import netscape.javascript.JSObject;\r
-\r
-/**\r
- * Jalview Applet. Runs in Java 1.18 runtime\r
- * \r
- * @author $author$\r
- * @version $Revision: 1.92 $\r
- */\r
-public class JalviewLite extends Applet implements\r
- StructureSelectionManagerProvider, JalviewLiteJsApi\r
-{\r
-\r
- public StructureSelectionManager getStructureSelectionManager()\r
- {\r
- return StructureSelectionManager.getStructureSelectionManager(this);\r
- }\r
-\r
- // /////////////////////////////////////////\r
- // The following public methods maybe called\r
- // externally, eg via javascript in HTML page\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.bin.JalviewLiteJsApi#getSelectedSequences()\r
- */\r
- public String getSelectedSequences()\r
- {\r
- return getSelectedSequencesFrom(getDefaultTargetFrame());\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.bin.JalviewLiteJsApi#getSelectedSequences(java.lang.String)\r
- */\r
- public String getSelectedSequences(String sep)\r
- {\r
- return getSelectedSequencesFrom(getDefaultTargetFrame(), sep);\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see\r
- * jalview.bin.JalviewLiteJsApi#getSelectedSequencesFrom(jalview.appletgui\r
- * .AlignFrame)\r
- */\r
- public String getSelectedSequencesFrom(AlignFrame alf)\r
- {\r
- return getSelectedSequencesFrom(alf, separator); // ""+0x00AC);\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see\r
- * jalview.bin.JalviewLiteJsApi#getSelectedSequencesFrom(jalview.appletgui\r
- * .AlignFrame, java.lang.String)\r
- */\r
- public String getSelectedSequencesFrom(AlignFrame alf, String sep)\r
- {\r
- StringBuffer result = new StringBuffer("");\r
- if (sep == null || sep.length() == 0)\r
- {\r
- sep = separator; // "+0x00AC;\r
- }\r
- if (alf.viewport.getSelectionGroup() != null)\r
- {\r
- SequenceI[] seqs = alf.viewport.getSelectionGroup()\r
- .getSequencesInOrder(alf.viewport.getAlignment());\r
-\r
- for (int i = 0; i < seqs.length; i++)\r
- {\r
- result.append(seqs[i].getName());\r
- result.append(sep);\r
- }\r
- }\r
-\r
- return result.toString();\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.bin.JalviewLiteJsApi#highlight(java.lang.String,\r
- * java.lang.String, java.lang.String)\r
- */\r
- public void highlight(String sequenceId, String position,\r
- String alignedPosition)\r
- {\r
- highlightIn(getDefaultTargetFrame(), sequenceId, position,\r
- alignedPosition);\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.bin.JalviewLiteJsApi#highlightIn(jalview.appletgui.AlignFrame,\r
- * java.lang.String, java.lang.String, java.lang.String)\r
- */\r
- public void highlightIn(final AlignFrame alf, final String sequenceId,\r
- final String position, final String alignedPosition)\r
- {\r
- // TODO: could try to highlight in all alignments if alf==null\r
- jalview.analysis.SequenceIdMatcher matcher = new jalview.analysis.SequenceIdMatcher(\r
- alf.viewport.getAlignment().getSequencesArray());\r
- final SequenceI sq = matcher.findIdMatch(sequenceId);\r
- if (sq != null)\r
- {\r
- int apos = -1;\r
- try\r
- {\r
- apos = new Integer(position).intValue();\r
- apos--;\r
- } catch (NumberFormatException ex)\r
- {\r
- return;\r
- }\r
- final StructureSelectionManagerProvider me = this;\r
- final int pos = apos;\r
- // use vamsas listener to broadcast to all listeners in scope\r
- if (alignedPosition != null\r
- && (alignedPosition.trim().length() == 0 || alignedPosition\r
- .toLowerCase().indexOf("false") > -1))\r
- {\r
- java.awt.EventQueue.invokeLater(new Runnable()\r
- {\r
- @Override\r
- public void run()\r
- {\r
- StructureSelectionManager.getStructureSelectionManager(me)\r
- .mouseOverVamsasSequence(sq, sq.findIndex(pos), null);\r
- }\r
- });\r
- }\r
- else\r
- {\r
- java.awt.EventQueue.invokeLater(new Runnable()\r
- {\r
- @Override\r
- public void run()\r
- {\r
- StructureSelectionManager.getStructureSelectionManager(me)\r
- .mouseOverVamsasSequence(sq, pos, null);\r
- }\r
- });\r
- }\r
- }\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.bin.JalviewLiteJsApi#select(java.lang.String,\r
- * java.lang.String)\r
- */\r
- public void select(String sequenceIds, String columns)\r
- {\r
- selectIn(getDefaultTargetFrame(), sequenceIds, columns, separator);\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.bin.JalviewLiteJsApi#select(java.lang.String,\r
- * java.lang.String, java.lang.String)\r
- */\r
- public void select(String sequenceIds, String columns, String sep)\r
- {\r
- selectIn(getDefaultTargetFrame(), sequenceIds, columns, sep);\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.bin.JalviewLiteJsApi#selectIn(jalview.appletgui.AlignFrame,\r
- * java.lang.String, java.lang.String)\r
- */\r
- public void selectIn(AlignFrame alf, String sequenceIds, String columns)\r
- {\r
- selectIn(alf, sequenceIds, columns, separator);\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.bin.JalviewLiteJsApi#selectIn(jalview.appletgui.AlignFrame,\r
- * java.lang.String, java.lang.String, java.lang.String)\r
- */\r
- public void selectIn(final AlignFrame alf, String sequenceIds,\r
- String columns, String sep)\r
- {\r
- if (sep == null || sep.length() == 0)\r
- {\r
- sep = separator;\r
- }\r
- else\r
- {\r
- if (debug)\r
- {\r
- System.err.println("Selecting region using separator string '"\r
- + separator + "'");\r
- }\r
- }\r
- // deparse fields\r
- String[] ids = separatorListToArray(sequenceIds, sep);\r
- String[] cols = separatorListToArray(columns, sep);\r
- final SequenceGroup sel = new SequenceGroup();\r
- final ColumnSelection csel = new ColumnSelection();\r
- AlignmentI al = alf.viewport.getAlignment();\r
- jalview.analysis.SequenceIdMatcher matcher = new jalview.analysis.SequenceIdMatcher(\r
- alf.viewport.getAlignment().getSequencesArray());\r
- int start = 0, end = al.getWidth(), alw = al.getWidth();\r
- boolean seqsfound = true;\r
- if (ids != null && ids.length > 0)\r
- {\r
- seqsfound = false;\r
- for (int i = 0; i < ids.length; i++)\r
- {\r
- if (ids[i].trim().length() == 0)\r
- {\r
- continue;\r
- }\r
- SequenceI sq = matcher.findIdMatch(ids[i]);\r
- if (sq != null)\r
- {\r
- seqsfound = true;\r
- sel.addSequence(sq, false);\r
- }\r
- }\r
- }\r
- boolean inseqpos = false;\r
- if (cols != null && cols.length > 0)\r
- {\r
- boolean seset = false;\r
- for (int i = 0; i < cols.length; i++)\r
- {\r
- String cl = cols[i].trim();\r
- if (cl.length() == 0)\r
- {\r
- continue;\r
- }\r
- int p;\r
- if ((p = cl.indexOf("-")) > -1)\r
- {\r
- int from = -1, to = -1;\r
- try\r
- {\r
- from = new Integer(cl.substring(0, p)).intValue();\r
- from--;\r
- } catch (NumberFormatException ex)\r
- {\r
- System.err\r
- .println("ERROR: Couldn't parse first integer in range element column selection string '"\r
- + cl + "' - format is 'from-to'");\r
- return;\r
- }\r
- try\r
- {\r
- to = new Integer(cl.substring(p + 1)).intValue();\r
- to--;\r
- } catch (NumberFormatException ex)\r
- {\r
- System.err\r
- .println("ERROR: Couldn't parse second integer in range element column selection string '"\r
- + cl + "' - format is 'from-to'");\r
- return;\r
- }\r
- if (from >= 0 && to >= 0)\r
- {\r
- // valid range\r
- if (from < to)\r
- {\r
- int t = to;\r
- to = from;\r
- to = t;\r
- }\r
- if (!seset)\r
- {\r
- start = from;\r
- end = to;\r
- seset = true;\r
- }\r
- else\r
- {\r
- // comment to prevent range extension\r
- if (start > from)\r
- {\r
- start = from;\r
- }\r
- if (end < to)\r
- {\r
- end = to;\r
- }\r
- }\r
- for (int r = from; r <= to; r++)\r
- {\r
- if (r >= 0 && r < alw)\r
- {\r
- csel.addElement(r);\r
- }\r
- }\r
- if (debug)\r
- {\r
- System.err.println("Range '" + cl + "' deparsed as [" + from\r
- + "," + to + "]");\r
- }\r
- }\r
- else\r
- {\r
- System.err.println("ERROR: Invalid Range '" + cl\r
- + "' deparsed as [" + from + "," + to + "]");\r
- }\r
- }\r
- else\r
- {\r
- int r = -1;\r
- try\r
- {\r
- r = new Integer(cl).intValue();\r
- r--;\r
- } catch (NumberFormatException ex)\r
- {\r
- if (cl.toLowerCase().equals("sequence"))\r
- {\r
- // we are in the dataset sequence's coordinate frame.\r
- inseqpos = true;\r
- }\r
- else\r
- {\r
- System.err\r
- .println("ERROR: Couldn't parse integer from point selection element of column selection string '"\r
- + cl + "'");\r
- return;\r
- }\r
- }\r
- if (r >= 0 && r <= alw)\r
- {\r
- if (!seset)\r
- {\r
- start = r;\r
- end = r;\r
- seset = true;\r
- }\r
- else\r
- {\r
- // comment to prevent range extension\r
- if (start > r)\r
- {\r
- start = r;\r
- }\r
- if (end < r)\r
- {\r
- end = r;\r
- }\r
- }\r
- csel.addElement(r);\r
- if (debug)\r
- {\r
- System.err.println("Point selection '" + cl\r
- + "' deparsed as [" + r + "]");\r
- }\r
- }\r
- else\r
- {\r
- System.err.println("ERROR: Invalid Point selection '" + cl\r
- + "' deparsed as [" + r + "]");\r
- }\r
- }\r
- }\r
- }\r
- if (seqsfound)\r
- {\r
- // we only propagate the selection when it was the null selection, or the\r
- // given sequences were found in the alignment.\r
- if (inseqpos && sel.getSize() > 0)\r
- {\r
- // assume first sequence provides reference frame ?\r
- SequenceI rs = sel.getSequenceAt(0);\r
- start = rs.findIndex(start);\r
- end = rs.findIndex(end);\r
- if (csel != null)\r
- {\r
- Vector cs = csel.getSelected();\r
- csel.clear();\r
- for (int csi = 0, csiS = cs.size(); csi < csiS; csi++)\r
- {\r
- csel.addElement(rs.findIndex(((Integer) cs.elementAt(csi))\r
- .intValue()));\r
- }\r
- }\r
- }\r
- sel.setStartRes(start);\r
- sel.setEndRes(end);\r
- EventQueue.invokeLater(new Runnable()\r
- {\r
- @Override\r
- public void run()\r
- {\r
- alf.select(sel, csel);\r
- }\r
- });\r
- }\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see\r
- * jalview.bin.JalviewLiteJsApi#getSelectedSequencesAsAlignment(java.lang.\r
- * String, java.lang.String)\r
- */\r
- public String getSelectedSequencesAsAlignment(String format, String suffix)\r
- {\r
- return getSelectedSequencesAsAlignmentFrom(getDefaultTargetFrame(),\r
- format, suffix);\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see\r
- * jalview.bin.JalviewLiteJsApi#getSelectedSequencesAsAlignmentFrom(jalview\r
- * .appletgui.AlignFrame, java.lang.String, java.lang.String)\r
- */\r
- public String getSelectedSequencesAsAlignmentFrom(AlignFrame alf,\r
- String format, String suffix)\r
- {\r
- try\r
- {\r
- boolean seqlimits = suffix.equalsIgnoreCase("true");\r
- if (alf.viewport.getSelectionGroup() != null)\r
- {\r
- // JBPNote: getSelectionAsNewSequence behaviour has changed - this\r
- // method now returns a full copy of sequence data\r
- // TODO consider using getSequenceSelection instead here\r
- String reply = new AppletFormatAdapter().formatSequences(format,\r
- new Alignment(alf.viewport.getSelectionAsNewSequence()),\r
- seqlimits);\r
- return reply;\r
- }\r
- } catch (Exception ex)\r
- {\r
- ex.printStackTrace();\r
- return "Error retrieving alignment in " + format + " format. ";\r
- }\r
- return "";\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.bin.JalviewLiteJsApi#getAlignmentOrder()\r
- */\r
- public String getAlignmentOrder()\r
- {\r
- return getAlignmentOrderFrom(getDefaultTargetFrame());\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see\r
- * jalview.bin.JalviewLiteJsApi#getAlignmentOrderFrom(jalview.appletgui.AlignFrame\r
- * )\r
- */\r
- public String getAlignmentOrderFrom(AlignFrame alf)\r
- {\r
- return getAlignmentOrderFrom(alf, separator);\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see\r
- * jalview.bin.JalviewLiteJsApi#getAlignmentOrderFrom(jalview.appletgui.AlignFrame\r
- * , java.lang.String)\r
- */\r
- public String getAlignmentOrderFrom(AlignFrame alf, String sep)\r
- {\r
- AlignmentI alorder = alf.getAlignViewport().getAlignment();\r
- String[] order = new String[alorder.getHeight()];\r
- for (int i = 0; i < order.length; i++)\r
- {\r
- order[i] = alorder.getSequenceAt(i).getName();\r
- }\r
- return arrayToSeparatorList(order);\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.bin.JalviewLiteJsApi#orderBy(java.lang.String,\r
- * java.lang.String)\r
- */\r
- public String orderBy(String order, String undoName)\r
- {\r
- return orderBy(order, undoName, separator);\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.bin.JalviewLiteJsApi#orderBy(java.lang.String,\r
- * java.lang.String, java.lang.String)\r
- */\r
- public String orderBy(String order, String undoName, String sep)\r
- {\r
- return orderAlignmentBy(getDefaultTargetFrame(), order, undoName, sep);\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see\r
- * jalview.bin.JalviewLiteJsApi#orderAlignmentBy(jalview.appletgui.AlignFrame,\r
- * java.lang.String, java.lang.String, java.lang.String)\r
- */\r
- public String orderAlignmentBy(AlignFrame alf, String order,\r
- String undoName, String sep)\r
- {\r
- String[] ids = separatorListToArray(order, sep);\r
- SequenceI[] sqs = null;\r
- if (ids != null && ids.length > 0)\r
- {\r
- jalview.analysis.SequenceIdMatcher matcher = new jalview.analysis.SequenceIdMatcher(\r
- alf.viewport.getAlignment().getSequencesArray());\r
- int s = 0;\r
- sqs = new SequenceI[ids.length];\r
- for (int i = 0; i < ids.length; i++)\r
- {\r
- if (ids[i].trim().length() == 0)\r
- {\r
- continue;\r
- }\r
- SequenceI sq = matcher.findIdMatch(ids[i]);\r
- if (sq != null)\r
- {\r
- sqs[s++] = sq;\r
- }\r
- }\r
- if (s > 0)\r
- {\r
- SequenceI[] sqq = new SequenceI[s];\r
- System.arraycopy(sqs, 0, sqq, 0, s);\r
- sqs = sqq;\r
- }\r
- else\r
- {\r
- sqs = null;\r
- }\r
- }\r
- if (sqs == null)\r
- {\r
- return "";\r
- }\r
- ;\r
- final AlignmentOrder aorder = new AlignmentOrder(sqs);\r
-\r
- if (undoName != null && undoName.trim().length() == 0)\r
- {\r
- undoName = null;\r
- }\r
- final String _undoName = undoName;\r
- // TODO: deal with synchronization here: cannot raise any events until after\r
- // this has returned.\r
- return alf.sortBy(aorder, _undoName) ? "true" : "";\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.bin.JalviewLiteJsApi#getAlignment(java.lang.String)\r
- */\r
- public String getAlignment(String format)\r
- {\r
- return getAlignmentFrom(getDefaultTargetFrame(), format, "true");\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see\r
- * jalview.bin.JalviewLiteJsApi#getAlignmentFrom(jalview.appletgui.AlignFrame,\r
- * java.lang.String)\r
- */\r
- public String getAlignmentFrom(AlignFrame alf, String format)\r
- {\r
- return getAlignmentFrom(alf, format, "true");\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.bin.JalviewLiteJsApi#getAlignment(java.lang.String,\r
- * java.lang.String)\r
- */\r
- public String getAlignment(String format, String suffix)\r
- {\r
- return getAlignmentFrom(getDefaultTargetFrame(), format, suffix);\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see\r
- * jalview.bin.JalviewLiteJsApi#getAlignmentFrom(jalview.appletgui.AlignFrame,\r
- * java.lang.String, java.lang.String)\r
- */\r
- public String getAlignmentFrom(AlignFrame alf, String format,\r
- String suffix)\r
- {\r
- try\r
- {\r
- boolean seqlimits = suffix.equalsIgnoreCase("true");\r
-\r
- String reply = new AppletFormatAdapter().formatSequences(format,\r
- alf.viewport.getAlignment(), seqlimits);\r
- return reply;\r
- } catch (Exception ex)\r
- {\r
- ex.printStackTrace();\r
- return "Error retrieving alignment in " + format + " format. ";\r
- }\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.bin.JalviewLiteJsApi#loadAnnotation(java.lang.String)\r
- */\r
- public void loadAnnotation(String annotation)\r
- {\r
- loadAnnotationFrom(getDefaultTargetFrame(), annotation);\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see\r
- * jalview.bin.JalviewLiteJsApi#loadAnnotationFrom(jalview.appletgui.AlignFrame\r
- * , java.lang.String)\r
- */\r
- public void loadAnnotationFrom(AlignFrame alf, String annotation)\r
- {\r
- if (new AnnotationFile().readAnnotationFile(alf.getAlignViewport()\r
- .getAlignment(), annotation, AppletFormatAdapter.PASTE))\r
- {\r
- alf.alignPanel.fontChanged();\r
- alf.alignPanel.setScrollValues(0, 0);\r
- }\r
- else\r
- {\r
- alf.parseFeaturesFile(annotation, AppletFormatAdapter.PASTE);\r
- }\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.bin.JalviewLiteJsApi#loadAnnotation(java.lang.String)\r
- */\r
- public void loadFeatures(String features, boolean autoenabledisplay)\r
- {\r
- loadFeaturesFrom(getDefaultTargetFrame(), features, autoenabledisplay);\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see\r
- * jalview.bin.JalviewLiteJsApi#loadAnnotationFrom(jalview.appletgui.AlignFrame\r
- * , java.lang.String)\r
- */\r
- public boolean loadFeaturesFrom(AlignFrame alf, String features,\r
- boolean autoenabledisplay)\r
- {\r
- return alf.parseFeaturesFile(features, AppletFormatAdapter.PASTE,\r
- autoenabledisplay);\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.bin.JalviewLiteJsApi#getFeatures(java.lang.String)\r
- */\r
- public String getFeatures(String format)\r
- {\r
- return getFeaturesFrom(getDefaultTargetFrame(), format);\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see\r
- * jalview.bin.JalviewLiteJsApi#getFeaturesFrom(jalview.appletgui.AlignFrame,\r
- * java.lang.String)\r
- */\r
- public String getFeaturesFrom(AlignFrame alf, String format)\r
- {\r
- return alf.outputFeatures(false, format);\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.bin.JalviewLiteJsApi#getAnnotation()\r
- */\r
- public String getAnnotation()\r
- {\r
- return getAnnotationFrom(getDefaultTargetFrame());\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see\r
- * jalview.bin.JalviewLiteJsApi#getAnnotationFrom(jalview.appletgui.AlignFrame\r
- * )\r
- */\r
- public String getAnnotationFrom(AlignFrame alf)\r
- {\r
- return alf.outputAnnotations(false);\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.bin.JalviewLiteJsApi#newView()\r
- */\r
- public AlignFrame newView()\r
- {\r
- return newViewFrom(getDefaultTargetFrame());\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.bin.JalviewLiteJsApi#newView(java.lang.String)\r
- */\r
- public AlignFrame newView(String name)\r
- {\r
- return newViewFrom(getDefaultTargetFrame(), name);\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.bin.JalviewLiteJsApi#newViewFrom(jalview.appletgui.AlignFrame)\r
- */\r
- public AlignFrame newViewFrom(AlignFrame alf)\r
- {\r
- return alf.newView(null);\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.bin.JalviewLiteJsApi#newViewFrom(jalview.appletgui.AlignFrame,\r
- * java.lang.String)\r
- */\r
- public AlignFrame newViewFrom(AlignFrame alf, String name)\r
- {\r
- return alf.newView(name);\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.bin.JalviewLiteJsApi#loadAlignment(java.lang.String,\r
- * java.lang.String)\r
- */\r
- public AlignFrame loadAlignment(String text, String title)\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,\r
- AppletFormatAdapter.PASTE, format);\r
- if (al.getHeight() > 0)\r
- {\r
- return new AlignFrame(al, this, title, false);\r
- }\r
- } catch (java.io.IOException ex)\r
- {\r
- ex.printStackTrace();\r
- }\r
- return null;\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.bin.JalviewLiteJsApi#setMouseoverListener(java.lang.String)\r
- */\r
- public void setMouseoverListener(String listener)\r
- {\r
- setMouseoverListener(currentAlignFrame, listener);\r
- }\r
-\r
- private Vector<jalview.javascript.JSFunctionExec> javascriptListeners = new Vector<jalview.javascript.JSFunctionExec>();\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see\r
- * jalview.bin.JalviewLiteJsApi#setMouseoverListener(jalview.appletgui.AlignFrame\r
- * , java.lang.String)\r
- */\r
- public void setMouseoverListener(AlignFrame af, String listener)\r
- {\r
- if (listener != null)\r
- {\r
- listener = listener.trim();\r
- if (listener.length() == 0)\r
- {\r
- System.err\r
- .println("jalview Javascript error: Ignoring empty function for mouseover listener.");\r
- return;\r
- }\r
- }\r
- jalview.javascript.MouseOverListener mol = new jalview.javascript.MouseOverListener(\r
- this, af, listener);\r
- javascriptListeners.addElement(mol);\r
- StructureSelectionManager.getStructureSelectionManager(this)\r
- .addStructureViewerListener(mol);\r
- if (debug)\r
- {\r
- System.err.println("Added a mouseover listener for "\r
- + ((af == null) ? "All frames" : "Just views for "\r
- + af.getAlignViewport().getSequenceSetId()));\r
- System.err.println("There are now " + javascriptListeners.size()\r
- + " listeners in total.");\r
- }\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.bin.JalviewLiteJsApi#setSelectionListener(java.lang.String)\r
- */\r
- public void setSelectionListener(String listener)\r
- {\r
- setSelectionListener(null, listener);\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see\r
- * jalview.bin.JalviewLiteJsApi#setSelectionListener(jalview.appletgui.AlignFrame\r
- * , java.lang.String)\r
- */\r
- public void setSelectionListener(AlignFrame af, String listener)\r
- {\r
- if (listener != null)\r
- {\r
- listener = listener.trim();\r
- if (listener.length() == 0)\r
- {\r
- System.err\r
- .println("jalview Javascript error: Ignoring empty function for selection listener.");\r
- return;\r
- }\r
- }\r
- jalview.javascript.JsSelectionSender mol = new jalview.javascript.JsSelectionSender(\r
- this, af, listener);\r
- javascriptListeners.addElement(mol);\r
- StructureSelectionManager.getStructureSelectionManager(this)\r
- .addSelectionListener(mol);\r
- if (debug)\r
- {\r
- System.err.println("Added a selection listener for "\r
- + ((af == null) ? "All frames" : "Just views for "\r
- + af.getAlignViewport().getSequenceSetId()));\r
- System.err.println("There are now " + javascriptListeners.size()\r
- + " listeners in total.");\r
- }\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.bin.JalviewLiteJsApi#setStructureListener(java.lang.String,\r
- * java.lang.String)\r
- */\r
- public void setStructureListener(String listener, String modelSet)\r
- {\r
- if (listener != null)\r
- {\r
- listener = listener.trim();\r
- if (listener.length() == 0)\r
- {\r
- System.err\r
- .println("jalview Javascript error: Ignoring empty function for selection listener.");\r
- return;\r
- }\r
- }\r
- jalview.javascript.MouseOverStructureListener mol = new jalview.javascript.MouseOverStructureListener(\r
- this, listener, separatorListToArray(modelSet));\r
- javascriptListeners.addElement(mol);\r
- StructureSelectionManager.getStructureSelectionManager(this)\r
- .addStructureViewerListener(mol);\r
- if (debug)\r
- {\r
- System.err.println("Added a javascript structure viewer listener '"\r
- + listener + "'");\r
- System.err.println("There are now " + javascriptListeners.size()\r
- + " listeners in total.");\r
- }\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see\r
- * jalview.bin.JalviewLiteJsApi#removeJavascriptListener(jalview.appletgui\r
- * .AlignFrame, java.lang.String)\r
- */\r
- public void removeJavascriptListener(AlignFrame af, String listener)\r
- {\r
- if (listener != null)\r
- {\r
- listener = listener.trim();\r
- if (listener.length() == 0)\r
- {\r
- listener = null;\r
- }\r
- }\r
- boolean rprt = false;\r
- for (int ms = 0, msSize = javascriptListeners.size(); ms < msSize;)\r
- {\r
- Object lstn = javascriptListeners.elementAt(ms);\r
- JsCallBack lstner = (JsCallBack) lstn;\r
- if ((af == null || lstner.getAlignFrame() == af)\r
- && (listener == null || lstner.getListenerFunction().equals(\r
- listener)))\r
- {\r
- javascriptListeners.removeElement(lstner);\r
- msSize--;\r
- if (lstner instanceof SelectionListener)\r
- {\r
- StructureSelectionManager.getStructureSelectionManager(this)\r
- .removeSelectionListener((SelectionListener) lstner);\r
- }\r
- else\r
- {\r
- StructureSelectionManager.getStructureSelectionManager(this)\r
- .removeStructureViewerListener(lstner, null);\r
- }\r
- rprt = debug;\r
- if (debug)\r
- {\r
- System.err.println("Removed listener '" + listener + "'");\r
- }\r
- }\r
- else\r
- {\r
- ms++;\r
- }\r
- }\r
- if (rprt)\r
- {\r
- System.err.println("There are now " + javascriptListeners.size()\r
- + " listeners in total.");\r
- }\r
- }\r
-\r
- public void stop()\r
- {\r
- System.err.println("Applet " + getName() + " stop().");\r
- tidyUp();\r
- }\r
-\r
- public void destroy()\r
- {\r
- System.err.println("Applet " + getName() + " destroy().");\r
- tidyUp();\r
- }\r
-\r
- private void tidyUp()\r
- {\r
- removeAll();\r
- if (currentAlignFrame != null && currentAlignFrame.viewport != null\r
- && currentAlignFrame.viewport.applet != null)\r
- {\r
- AlignViewport av = currentAlignFrame.viewport;\r
- currentAlignFrame.closeMenuItem_actionPerformed();\r
- av.applet = null;\r
- currentAlignFrame = null;\r
- }\r
- if (javascriptListeners != null)\r
- {\r
- while (javascriptListeners.size() > 0)\r
- {\r
- jalview.javascript.JSFunctionExec mol = javascriptListeners\r
- .elementAt(0);\r
- javascriptListeners.removeElement(mol);\r
- if (mol instanceof SelectionListener)\r
- {\r
- StructureSelectionManager.getStructureSelectionManager(this)\r
- .removeSelectionListener((SelectionListener) mol);\r
- }\r
- else\r
- {\r
- StructureSelectionManager.getStructureSelectionManager(this)\r
- .removeStructureViewerListener(mol, null);\r
- }\r
- mol.jvlite = null;\r
- }\r
- }\r
- if (jsFunctionExec != null)\r
- {\r
- jsFunctionExec.stopQueue();\r
- jsFunctionExec.jvlite = null;\r
- }\r
- initialAlignFrame = null;\r
- jsFunctionExec = null;\r
- javascriptListeners = null;\r
- StructureSelectionManager.release(this);\r
- }\r
-\r
- private jalview.javascript.JSFunctionExec jsFunctionExec;\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.bin.JalviewLiteJsApi#mouseOverStructure(java.lang.String,\r
- * java.lang.String, java.lang.String)\r
- */\r
- public void mouseOverStructure(final String pdbResNum,\r
- final String chain, final String pdbfile)\r
- {\r
- final StructureSelectionManagerProvider me = this;\r
- java.awt.EventQueue.invokeLater(new Runnable()\r
- {\r
- @Override\r
- public void run()\r
- {\r
- try\r
- {\r
- StructureSelectionManager.getStructureSelectionManager(me)\r
- .mouseOverStructure(new Integer(pdbResNum).intValue(),\r
- chain, pdbfile);\r
- if (debug)\r
- {\r
- System.err.println("mouseOver for '" + pdbResNum\r
- + "' in chain '" + chain + "' in structure '" + pdbfile\r
- + "'");\r
- }\r
- } catch (NumberFormatException e)\r
- {\r
- System.err.println("Ignoring invalid residue number string '"\r
- + pdbResNum + "'");\r
- }\r
-\r
- }\r
- });\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see\r
- * jalview.bin.JalviewLiteJsApi#scrollViewToIn(jalview.appletgui.AlignFrame,\r
- * java.lang.String, java.lang.String)\r
- */\r
- public void scrollViewToIn(final AlignFrame alf, final String topRow,\r
- final String leftHandColumn)\r
- {\r
- java.awt.EventQueue.invokeLater(new Runnable()\r
- {\r
- @Override\r
- public void run()\r
- {\r
- try\r
- {\r
- alf.scrollTo(new Integer(topRow).intValue(), new Integer(\r
- leftHandColumn).intValue());\r
-\r
- } catch (Exception ex)\r
- {\r
- System.err.println("Couldn't parse integer arguments (topRow='"\r
- + topRow + "' and leftHandColumn='" + leftHandColumn\r
- + "')");\r
- ex.printStackTrace();\r
- }\r
- }\r
- });\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see\r
- * jalview.javascript.JalviewLiteJsApi#scrollViewToRowIn(jalview.appletgui\r
- * .AlignFrame, java.lang.String)\r
- */\r
- @Override\r
- public void scrollViewToRowIn(final AlignFrame alf, final String topRow)\r
- {\r
-\r
- java.awt.EventQueue.invokeLater(new Runnable()\r
- {\r
- @Override\r
- public void run()\r
- {\r
- try\r
- {\r
- alf.scrollToRow(new Integer(topRow).intValue());\r
-\r
- } catch (Exception ex)\r
- {\r
- System.err.println("Couldn't parse integer arguments (topRow='"\r
- + topRow + "')");\r
- ex.printStackTrace();\r
- }\r
-\r
- }\r
- });\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see\r
- * jalview.javascript.JalviewLiteJsApi#scrollViewToColumnIn(jalview.appletgui\r
- * .AlignFrame, java.lang.String)\r
- */\r
- @Override\r
- public void scrollViewToColumnIn(final AlignFrame alf,\r
- final String leftHandColumn)\r
- {\r
- java.awt.EventQueue.invokeLater(new Runnable()\r
- {\r
-\r
- @Override\r
- public void run()\r
- {\r
- try\r
- {\r
- alf.scrollToColumn(new Integer(leftHandColumn).intValue());\r
-\r
- } catch (Exception ex)\r
- {\r
- System.err\r
- .println("Couldn't parse integer arguments (leftHandColumn='"\r
- + leftHandColumn + "')");\r
- ex.printStackTrace();\r
- }\r
- }\r
- });\r
-\r
- }\r
-\r
- // //////////////////////////////////////////////\r
- // //////////////////////////////////////////////\r
-\r
- public static int lastFrameX = 200;\r
-\r
- public static int lastFrameY = 200;\r
-\r
- boolean fileFound = true;\r
-\r
- String file = "No file";\r
-\r
- Button launcher = new Button("Start Jalview");\r
-\r
- /**\r
- * The currentAlignFrame is static, it will change if and when the user\r
- * selects a new window. Note that it will *never* point back to the embedded\r
- * AlignFrame if the applet is started as embedded on the page and then\r
- * afterwards a new view is created.\r
- */\r
- public AlignFrame currentAlignFrame = null;\r
-\r
- /**\r
- * This is the first frame to be displayed, and does not change. API calls\r
- * will default to this instance if currentAlignFrame is null.\r
- */\r
- AlignFrame initialAlignFrame = null;\r
-\r
- boolean embedded = false;\r
-\r
- private boolean checkForJmol = true;\r
-\r
- private boolean checkedForJmol = false; // ensure we don't check for jmol\r
-\r
- // every time the app is re-inited\r
-\r
- public boolean jmolAvailable = false;\r
-\r
- private boolean alignPdbStructures = false;\r
-\r
- /**\r
- * use an external structure viewer exclusively (no jmols or MCViews will be\r
- * opened by JalviewLite itself)\r
- */\r
- public boolean useXtrnalSviewer = false;\r
-\r
- public static boolean debug = false;\r
-\r
- static String builddate = null, version = null;\r
-\r
- private static void initBuildDetails()\r
- {\r
- if (builddate == null)\r
- {\r
- builddate = "unknown";\r
- version = "test";\r
- java.net.URL url = JalviewLite.class\r
- .getResource("/.build_properties");\r
- if (url != null)\r
- {\r
- try\r
- {\r
- BufferedReader reader = new BufferedReader(new InputStreamReader(\r
- url.openStream()));\r
- String line;\r
- while ((line = reader.readLine()) != null)\r
- {\r
- if (line.indexOf("VERSION") > -1)\r
- {\r
- version = line.substring(line.indexOf("=") + 1);\r
- }\r
- if (line.indexOf("BUILD_DATE") > -1)\r
- {\r
- builddate = line.substring(line.indexOf("=") + 1);\r
- }\r
- }\r
- } catch (Exception ex)\r
- {\r
- ex.printStackTrace();\r
- }\r
- }\r
- }\r
- }\r
-\r
- public static String getBuildDate()\r
- {\r
- initBuildDetails();\r
- return builddate;\r
- }\r
-\r
- public static String getVersion()\r
- {\r
- initBuildDetails();\r
- return version;\r
- }\r
-\r
- // public JSObject scriptObject = null;\r
-\r
- /**\r
- * init method for Jalview Applet\r
- */\r
- public void init()\r
- {\r
- // remove any handlers that might be hanging around from an earlier instance\r
- try\r
- {\r
- if (debug)\r
- {\r
- System.err.println("Applet context is '"\r
- + getAppletContext().getClass().toString() + "'");\r
- }\r
- JSObject scriptObject = JSObject.getWindow(this);\r
- if (debug && scriptObject != null)\r
- {\r
- System.err.println("Applet has Javascript callback support.");\r
- }\r
-\r
- } catch (Exception ex)\r
- {\r
- System.err\r
- .println("Warning: No JalviewLite javascript callbacks available.");\r
- if (debug)\r
- {\r
- ex.printStackTrace();\r
- }\r
- }\r
- /**\r
- * turn on extra applet debugging\r
- */\r
- String dbg = getParameter("debug");\r
- if (dbg != null)\r
- {\r
- debug = dbg.toLowerCase().equals("true");\r
- }\r
- if (debug)\r
- {\r
-\r
- System.err.println("JalviewLite Version " + getVersion());\r
- System.err.println("Build Date : " + getBuildDate());\r
-\r
- }\r
- String externalsviewer = getParameter("externalstructureviewer");\r
- if (externalsviewer != null)\r
- {\r
- useXtrnalSviewer = externalsviewer.trim().toLowerCase()\r
- .equals("true");\r
- }\r
- /**\r
- * if true disable the check for jmol\r
- */\r
- String chkforJmol = getParameter("nojmol");\r
- if (chkforJmol != null)\r
- {\r
- checkForJmol = !chkforJmol.equals("true");\r
- }\r
- /**\r
- * get the separator parameter if present\r
- */\r
- String sep = getParameter("separator");\r
- if (sep != null)\r
- {\r
- if (sep.length() > 0)\r
- {\r
- separator = sep;\r
- if (debug)\r
- {\r
- System.err.println("Separator set to '" + separator + "'");\r
- }\r
- }\r
- else\r
- {\r
- throw new Error(\r
- "Invalid separator parameter - must be non-zero length");\r
- }\r
- }\r
- int r = 255;\r
- int g = 255;\r
- int b = 255;\r
- String param = getParameter("RGB");\r
-\r
- if (param != null)\r
- {\r
- try\r
- {\r
- r = Integer.parseInt(param.substring(0, 2), 16);\r
- g = Integer.parseInt(param.substring(2, 4), 16);\r
- b = Integer.parseInt(param.substring(4, 6), 16);\r
- } catch (Exception ex)\r
- {\r
- r = 255;\r
- g = 255;\r
- b = 255;\r
- }\r
- }\r
- param = getParameter("label");\r
- if (param != null)\r
- {\r
- launcher.setLabel(param);\r
- }\r
-\r
- setBackground(new Color(r, g, b));\r
-\r
- file = getParameter("file");\r
-\r
- if (file == null)\r
- {\r
- // Maybe the sequences are added as parameters\r
- StringBuffer data = new StringBuffer("PASTE");\r
- int i = 1;\r
- while ((file = getParameter("sequence" + i)) != null)\r
- {\r
- data.append(file.toString() + "\n");\r
- i++;\r
- }\r
- if (data.length() > 5)\r
- {\r
- file = data.toString();\r
- }\r
- }\r
-\r
- final JalviewLite jvapplet = this;\r
- if (getParameter("embedded") != null\r
- && getParameter("embedded").equalsIgnoreCase("true"))\r
- {\r
- // Launch as embedded applet in page\r
- embedded = true;\r
- LoadingThread loader = new LoadingThread(file, jvapplet);\r
- loader.start();\r
- }\r
- else if (file != null)\r
- {\r
- if (getParameter("showbutton") == null\r
- || !getParameter("showbutton").equalsIgnoreCase("false"))\r
- {\r
- // Add the JalviewLite 'Button' to the page\r
- add(launcher);\r
- launcher.addActionListener(new java.awt.event.ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- LoadingThread loader = new LoadingThread(file, jvapplet);\r
- loader.start();\r
- }\r
- });\r
- }\r
- else\r
- {\r
- // Open jalviewLite immediately.\r
- LoadingThread loader = new LoadingThread(file, jvapplet);\r
- loader.start();\r
- }\r
- }\r
- else\r
- {\r
- // jalview initialisation with no alignment. loadAlignment() method can\r
- // still be called to open new alignments.\r
- file = "NO FILE";\r
- fileFound = false;\r
- // callInitCallback();\r
- }\r
- }\r
-\r
- private void callInitCallback()\r
- {\r
- String initjscallback = getParameter("oninit");\r
- if (initjscallback == null)\r
- {\r
- return;\r
- }\r
- initjscallback = initjscallback.trim();\r
- if (initjscallback.length() > 0)\r
- {\r
- JSObject scriptObject = null;\r
- try\r
- {\r
- scriptObject = JSObject.getWindow(this);\r
- } catch (Exception ex)\r
- {\r
- }\r
- ;\r
- if (scriptObject != null)\r
- {\r
- try\r
- {\r
- // do onInit with the JS executor thread\r
- new JSFunctionExec(this).executeJavascriptFunction(true,\r
- initjscallback, null, "Calling oninit callback '"\r
- + initjscallback + "'.");\r
- } catch (Exception e)\r
- {\r
- System.err.println("Exception when executing _oninit callback '"\r
- + initjscallback + "'.");\r
- e.printStackTrace();\r
- }\r
- }\r
- else\r
- {\r
- System.err.println("Not executing _oninit callback '"\r
- + initjscallback + "' - no scripting allowed.");\r
- }\r
- }\r
- }\r
-\r
- /**\r
- * Initialises and displays a new java.awt.Frame\r
- * \r
- * @param frame\r
- * java.awt.Frame to be displayed\r
- * @param title\r
- * title of new frame\r
- * @param width\r
- * width if new frame\r
- * @param height\r
- * height of new frame\r
- */\r
- public static void addFrame(final Frame frame, String title, int width,\r
- int height)\r
- {\r
- frame.setLocation(lastFrameX, lastFrameY);\r
- lastFrameX += 40;\r
- lastFrameY += 40;\r
- frame.setSize(width, height);\r
- frame.setTitle(title);\r
- frame.addWindowListener(new WindowAdapter()\r
- {\r
- public void windowClosing(WindowEvent e)\r
- {\r
- if (frame instanceof AlignFrame)\r
- {\r
- AlignViewport vp = ((AlignFrame) frame).viewport;\r
- ((AlignFrame) frame).closeMenuItem_actionPerformed();\r
- if (vp.applet.currentAlignFrame == frame)\r
- {\r
- vp.applet.currentAlignFrame = null;\r
- }\r
- vp.applet = null;\r
- vp = null;\r
-\r
- }\r
- lastFrameX -= 40;\r
- lastFrameY -= 40;\r
- if (frame instanceof EmbmenuFrame)\r
- {\r
- ((EmbmenuFrame) frame).destroyMenus();\r
- }\r
- frame.setMenuBar(null);\r
- frame.dispose();\r
- }\r
-\r
- public void windowActivated(WindowEvent e)\r
- {\r
- if (frame instanceof AlignFrame)\r
- {\r
- ((AlignFrame) frame).viewport.applet.currentAlignFrame = (AlignFrame) frame;\r
- if (debug)\r
- {\r
- System.err.println("Activated window " + frame);\r
- }\r
- }\r
- // be good.\r
- super.windowActivated(e);\r
- }\r
- /*\r
- * Probably not necessary to do this - see TODO above. (non-Javadoc)\r
- * \r
- * @see\r
- * java.awt.event.WindowAdapter#windowDeactivated(java.awt.event.WindowEvent\r
- * )\r
- * \r
- * public void windowDeactivated(WindowEvent e) { if (currentAlignFrame ==\r
- * frame) { currentAlignFrame = null; if (debug) {\r
- * System.err.println("Deactivated window "+frame); } }\r
- * super.windowDeactivated(e); }\r
- */\r
- });\r
- frame.setVisible(true);\r
- }\r
-\r
- /**\r
- * This paints the background surrounding the "Launch Jalview button" <br>\r
- * <br>\r
- * If file given in parameter not found, displays error message\r
- * \r
- * @param g\r
- * graphics context\r
- */\r
- public void paint(Graphics g)\r
- {\r
- if (!fileFound)\r
- {\r
- g.setColor(new Color(200, 200, 200));\r
- g.setColor(Color.cyan);\r
- g.fillRect(0, 0, getSize().width, getSize().height);\r
- g.setColor(Color.red);\r
- g.drawString("Jalview can't open file", 5, 15);\r
- g.drawString("\"" + file + "\"", 5, 30);\r
- }\r
- else if (embedded)\r
- {\r
- g.setColor(Color.black);\r
- g.setFont(new Font("Arial", Font.BOLD, 24));\r
- g.drawString("Jalview Applet", 50, getSize().height / 2 - 30);\r
- g.drawString("Loading Data...", 50, getSize().height / 2);\r
- }\r
- }\r
-\r
- /**\r
- * get all components associated with the applet of the given type\r
- * \r
- * @param class1\r
- * @return\r
- */\r
- public Vector getAppletWindow(Class class1)\r
- {\r
- Vector wnds = new Vector();\r
- Component[] cmp = getComponents();\r
- if (cmp != null)\r
- {\r
- for (int i = 0; i < cmp.length; i++)\r
- {\r
- if (class1.isAssignableFrom(cmp[i].getClass()))\r
- {\r
- wnds.addElement(cmp);\r
- }\r
- }\r
- }\r
- return wnds;\r
- }\r
-\r
- class LoadJmolThread extends Thread\r
- {\r
- private boolean running = false;\r
-\r
- public void run()\r
- {\r
- if (running || checkedForJmol)\r
- {\r
- return;\r
- }\r
- running = true;\r
- if (checkForJmol)\r
- {\r
- try\r
- {\r
- if (!System.getProperty("java.version").startsWith("1.1"))\r
- {\r
- Class.forName("org.jmol.adapter.smarter.SmarterJmolAdapter");\r
- jmolAvailable = true;\r
- }\r
- if (!jmolAvailable)\r
- {\r
- System.out\r
- .println("Jmol not available - Using MCview for structures");\r
- }\r
- } catch (java.lang.ClassNotFoundException ex)\r
- {\r
- }\r
- }\r
- else\r
- {\r
- jmolAvailable = false;\r
- if (debug)\r
- {\r
- System.err\r
- .println("Skipping Jmol check. Will use MCView (probably)");\r
- }\r
- }\r
- checkedForJmol = true;\r
- running = false;\r
- }\r
-\r
- public boolean notFinished()\r
- {\r
- return running || !checkedForJmol;\r
- }\r
- }\r
-\r
- class LoadingThread extends Thread\r
- {\r
- /**\r
- * State variable: File source\r
- */\r
- String file;\r
-\r
- /**\r
- * State variable: protocol for access to file source\r
- */\r
- String protocol;\r
-\r
- /**\r
- * State variable: format of file source\r
- */\r
- String format;\r
-\r
- String _file;\r
-\r
- JalviewLite applet;\r
-\r
- private void dbgMsg(String msg)\r
- {\r
- if (applet.debug)\r
- {\r
- System.err.println(msg);\r
- }\r
- }\r
-\r
- /**\r
- * update the protocol state variable for accessing the datasource located\r
- * by file.\r
- * \r
- * @param file\r
- * @return possibly updated datasource string\r
- */\r
- public String setProtocolState(String file)\r
- {\r
- if (file.startsWith("PASTE"))\r
- {\r
- file = file.substring(5);\r
- protocol = AppletFormatAdapter.PASTE;\r
- }\r
- else if (inArchive(file))\r
- {\r
- protocol = AppletFormatAdapter.CLASSLOADER;\r
- }\r
- else\r
- {\r
- file = addProtocol(file);\r
- protocol = AppletFormatAdapter.URL;\r
- }\r
- dbgMsg("Protocol identified as '" + protocol + "'");\r
- return file;\r
- }\r
-\r
- public LoadingThread(String _file, JalviewLite _applet)\r
- {\r
- this._file = _file;\r
- applet = _applet;\r
- }\r
-\r
- public void run()\r
- {\r
- LoadJmolThread jmolchecker = new LoadJmolThread();\r
- jmolchecker.start();\r
- while (jmolchecker.notFinished())\r
- {\r
- // wait around until the Jmol check is complete.\r
- try\r
- {\r
- Thread.sleep(2);\r
- } catch (Exception e)\r
- {\r
- }\r
- ;\r
- }\r
- startLoading();\r
- // applet.callInitCallback();\r
- }\r
-\r
- private void startLoading()\r
- {\r
- AlignFrame newAlignFrame;\r
- dbgMsg("Loading thread started with:\n>>file\n" + _file + ">>endfile");\r
- file = setProtocolState(_file);\r
-\r
- format = new jalview.io.IdentifyFile().Identify(file, protocol);\r
- dbgMsg("File identified as '" + format + "'");\r
- dbgMsg("Loading started.");\r
- Alignment al = null;\r
- try\r
- {\r
- al = new AppletFormatAdapter().readFile(file, protocol, format);\r
- } catch (java.io.IOException ex)\r
- {\r
- dbgMsg("File load exception.");\r
- ex.printStackTrace();\r
- if (debug)\r
- {\r
- try\r
- {\r
- FileParse fp = new FileParse(file, protocol);\r
- String ln = null;\r
- dbgMsg(">>>Dumping contents of '" + file + "' " + "("\r
- + protocol + ")");\r
- while ((ln = fp.nextLine()) != null)\r
- {\r
- dbgMsg(ln);\r
- }\r
- dbgMsg(">>>Dump finished.");\r
- } catch (Exception e)\r
- {\r
- System.err\r
- .println("Exception when trying to dump the content of the file parameter.");\r
- e.printStackTrace();\r
- }\r
- }\r
- }\r
- if ((al != null) && (al.getHeight() > 0))\r
- {\r
- dbgMsg("Successfully loaded file.");\r
- newAlignFrame = new AlignFrame(al, applet, file, embedded);\r
- if (initialAlignFrame == null)\r
- {\r
- initialAlignFrame = newAlignFrame;\r
- }\r
- // update the focus.\r
- currentAlignFrame = newAlignFrame;\r
-\r
- if (protocol == jalview.io.AppletFormatAdapter.PASTE)\r
- {\r
- newAlignFrame.setTitle("Sequences from "\r
- + applet.getDocumentBase());\r
- }\r
-\r
- newAlignFrame.statusBar.setText("Successfully loaded file " + file);\r
-\r
- String treeFile = applet.getParameter("tree");\r
- if (treeFile == null)\r
- {\r
- treeFile = applet.getParameter("treeFile");\r
- }\r
-\r
- if (treeFile != null)\r
- {\r
- try\r
- {\r
- treeFile = setProtocolState(treeFile);\r
- /*\r
- * if (inArchive(treeFile)) { protocol =\r
- * AppletFormatAdapter.CLASSLOADER; } else { protocol =\r
- * AppletFormatAdapter.URL; treeFile = addProtocol(treeFile); }\r
- */\r
- jalview.io.NewickFile fin = new jalview.io.NewickFile(treeFile,\r
- protocol);\r
-\r
- fin.parse();\r
-\r
- if (fin.getTree() != null)\r
- {\r
- newAlignFrame.loadTree(fin, treeFile);\r
- dbgMsg("Successfuly imported tree.");\r
- }\r
- else\r
- {\r
- dbgMsg("Tree parameter did not resolve to a valid tree.");\r
- }\r
- } catch (Exception ex)\r
- {\r
- ex.printStackTrace();\r
- }\r
- }\r
-\r
- /*\r
- * Try to load T-Coffee score file\r
- */\r
- String sScoreFile = applet.getParameter("scoreFile");\r
- if (sScoreFile != null && !"".equals(sScoreFile))\r
- {\r
- try\r
- {\r
- if (debug)\r
- {\r
- System.err\r
- .println("Attempting to load T-COFFEE score file from the scoreFile parameter");\r
- }\r
- if (!newAlignFrame.loadScoreFile(sScoreFile))\r
- {\r
- System.err\r
- .println("Failed to parse T-COFFEE parameter as a valid score file ('"\r
- + sScoreFile + "')");\r
- }\r
- } catch (Exception e)\r
- {\r
- System.err.printf("Cannot read score file: '%s'. Cause: %s \n",\r
- sScoreFile, e.getMessage());\r
- }\r
- }\r
-\r
- // ///////////////////////////\r
- // modify display of features\r
- // we do this before any features have been loaded, ensuring any hidden\r
- // groups are hidden when features first displayed\r
- //\r
- // hide specific groups\r
- //\r
- String param = applet.getParameter("hidefeaturegroups");\r
- if (param != null)\r
- {\r
- newAlignFrame.setFeatureGroupState(separatorListToArray(param),\r
- false);\r
- // applet.setFeatureGroupStateOn(newAlignFrame, param, false);\r
- }\r
- // show specific groups\r
- param = applet.getParameter("showfeaturegroups");\r
- if (param != null)\r
- {\r
- newAlignFrame.setFeatureGroupState(separatorListToArray(param),\r
- true);\r
- // applet.setFeatureGroupStateOn(newAlignFrame, param, true);\r
- }\r
- // and now load features\r
- param = applet.getParameter("features");\r
- if (param != null)\r
- {\r
- param = setProtocolState(param);\r
-\r
- newAlignFrame.parseFeaturesFile(param, protocol);\r
- }\r
-\r
- param = applet.getParameter("showFeatureSettings");\r
- if (param != null && param.equalsIgnoreCase("true"))\r
- {\r
- newAlignFrame.viewport.showSequenceFeatures(true);\r
- new FeatureSettings(newAlignFrame.alignPanel);\r
- }\r
-\r
- param = applet.getParameter("annotations");\r
- if (param != null)\r
- {\r
- param = setProtocolState(param);\r
-\r
- if (new AnnotationFile().readAnnotationFile(\r
- newAlignFrame.viewport.getAlignment(), param, protocol))\r
- {\r
- newAlignFrame.alignPanel.fontChanged();\r
- newAlignFrame.alignPanel.setScrollValues(0, 0);\r
- }\r
- else\r
- {\r
- System.err\r
- .println("Annotations were not added from annotation file '"\r
- + param + "'");\r
- }\r
-\r
- }\r
-\r
- param = applet.getParameter("jnetfile");\r
- if (param != null)\r
- {\r
- try\r
- {\r
- param = setProtocolState(param);\r
- jalview.io.JPredFile predictions = new jalview.io.JPredFile(\r
- param, protocol);\r
- JnetAnnotationMaker.add_annotation(predictions,\r
- newAlignFrame.viewport.getAlignment(), 0, false); // false==do\r
- // not\r
- // add\r
- // sequence\r
- // profile\r
- // from\r
- // concise\r
- // output\r
- newAlignFrame.alignPanel.fontChanged();\r
- newAlignFrame.alignPanel.setScrollValues(0, 0);\r
- } catch (Exception ex)\r
- {\r
- ex.printStackTrace();\r
- }\r
- }\r
- /*\r
- * <param name="alignpdbfiles" value="false/true"/> Undocumented for 2.6\r
- * - related to JAL-434\r
- */\r
- applet.setAlignPdbStructures(getDefaultParameter("alignpdbfiles",\r
- false));\r
- /*\r
- * <param name="PDBfile" value="1gaq.txt PDB|1GAQ|1GAQ|A PDB|1GAQ|1GAQ|B\r
- * PDB|1GAQ|1GAQ|C">\r
- * \r
- * <param name="PDBfile2" value="1gaq.txt A=SEQA B=SEQB C=SEQB">\r
- * \r
- * <param name="PDBfile3" value="1q0o Q45135_9MICO">\r
- */\r
-\r
- int pdbFileCount = 0;\r
- // Accumulate pdbs here if they are heading for the same view (if\r
- // alignPdbStructures is true)\r
- Vector pdbs = new Vector();\r
- // create a lazy matcher if we're asked to\r
- jalview.analysis.SequenceIdMatcher matcher = (applet\r
- .getDefaultParameter("relaxedidmatch", false)) ? new jalview.analysis.SequenceIdMatcher(\r
- newAlignFrame.getAlignViewport().getAlignment()\r
- .getSequencesArray()) : null;\r
-\r
- do\r
- {\r
- if (pdbFileCount > 0)\r
- {\r
- param = applet.getParameter("PDBFILE" + pdbFileCount);\r
- }\r
- else\r
- {\r
- param = applet.getParameter("PDBFILE");\r
- }\r
-\r
- if (param != null)\r
- {\r
- PDBEntry pdb = new PDBEntry();\r
-\r
- String seqstring;\r
- SequenceI[] seqs = null;\r
- String[] chains = null;\r
-\r
- StringTokenizer st = new StringTokenizer(param, " ");\r
-\r
- if (st.countTokens() < 2)\r
- {\r
- String sequence = applet.getParameter("PDBSEQ");\r
- if (sequence != null)\r
- seqs = new SequenceI[]\r
- { matcher == null ? (Sequence) newAlignFrame\r
- .getAlignViewport().getAlignment()\r
- .findName(sequence) : matcher.findIdMatch(sequence) };\r
-\r
- }\r
- else\r
- {\r
- param = st.nextToken();\r
- Vector tmp = new Vector();\r
- Vector tmp2 = new Vector();\r
-\r
- while (st.hasMoreTokens())\r
- {\r
- seqstring = st.nextToken();\r
- StringTokenizer st2 = new StringTokenizer(seqstring, "=");\r
- if (st2.countTokens() > 1)\r
- {\r
- // This is the chain\r
- tmp2.addElement(st2.nextToken());\r
- seqstring = st2.nextToken();\r
- }\r
- tmp.addElement(matcher == null ? (Sequence) newAlignFrame\r
- .getAlignViewport().getAlignment()\r
- .findName(seqstring) : matcher\r
- .findIdMatch(seqstring));\r
- }\r
-\r
- seqs = new SequenceI[tmp.size()];\r
- tmp.copyInto(seqs);\r
- if (tmp2.size() == tmp.size())\r
- {\r
- chains = new String[tmp2.size()];\r
- tmp2.copyInto(chains);\r
- }\r
- }\r
- param = setProtocolState(param);\r
-\r
- if (// !jmolAvailable\r
- // &&\r
- protocol == AppletFormatAdapter.CLASSLOADER\r
- && !useXtrnalSviewer)\r
- {\r
- // Re: JAL-357 : the bug isn't a problem if we are using an\r
- // external viewer!\r
- // TODO: verify this Re:\r
- // https://mantis.lifesci.dundee.ac.uk/view.php?id=36605\r
- // This exception preserves the current behaviour where, even if\r
- // the local pdb file was identified in the class loader\r
- protocol = AppletFormatAdapter.URL; // this is probably NOT\r
- // CORRECT!\r
- param = addProtocol(param); //\r
- }\r
-\r
- pdb.setFile(param);\r
-\r
- if (seqs != null)\r
- {\r
- for (int i = 0; i < seqs.length; i++)\r
- {\r
- if (seqs[i] != null)\r
- {\r
- ((Sequence) seqs[i]).addPDBId(pdb);\r
- }\r
- else\r
- {\r
- if (JalviewLite.debug)\r
- {\r
- // this may not really be a problem but we give a warning\r
- // anyway\r
- System.err\r
- .println("Warning: Possible input parsing error: Null sequence for attachment of PDB (sequence "\r
- + i + ")");\r
- }\r
- }\r
- }\r
-\r
- if (!alignPdbStructures)\r
- {\r
- newAlignFrame.newStructureView(applet, pdb, seqs, chains,\r
- protocol);\r
- }\r
- else\r
- {\r
- pdbs.addElement(new Object[]\r
- { pdb, seqs, chains, new String(protocol) });\r
- }\r
- }\r
- }\r
-\r
- pdbFileCount++;\r
- } while (param != null || pdbFileCount < 10);\r
- if (pdbs.size() > 0)\r
- {\r
- SequenceI[][] seqs = new SequenceI[pdbs.size()][];\r
- PDBEntry[] pdb = new PDBEntry[pdbs.size()];\r
- String[][] chains = new String[pdbs.size()][];\r
- String[] protocols = new String[pdbs.size()];\r
- for (int pdbsi = 0, pdbsiSize = pdbs.size(); pdbsi < pdbsiSize; pdbsi++)\r
- {\r
- Object[] o = (Object[]) pdbs.elementAt(pdbsi);\r
- pdb[pdbsi] = (PDBEntry) o[0];\r
- seqs[pdbsi] = (SequenceI[]) o[1];\r
- chains[pdbsi] = (String[]) o[2];\r
- protocols[pdbsi] = (String) o[3];\r
- }\r
- newAlignFrame.alignedStructureView(applet, pdb, seqs, chains,\r
- protocols);\r
-\r
- }\r
- }\r
- else\r
- {\r
- fileFound = false;\r
- applet.remove(launcher);\r
- applet.repaint();\r
- }\r
- callInitCallback();\r
- }\r
-\r
- /**\r
- * Discovers whether the given file is in the Applet Archive\r
- * \r
- * @param file\r
- * String\r
- * @return boolean\r
- */\r
- boolean inArchive(String file)\r
- {\r
- // This might throw a security exception in certain browsers\r
- // Netscape Communicator for instance.\r
- try\r
- {\r
- boolean rtn = (getClass().getResourceAsStream("/" + file) != null);\r
- if (debug)\r
- {\r
- System.err.println("Resource '" + file + "' was "\r
- + (rtn ? "" : "not") + " located by classloader.");\r
- }\r
- return rtn;\r
- } catch (Exception ex)\r
- {\r
- System.out.println("Exception checking resources: " + file + " "\r
- + ex);\r
- return false;\r
- }\r
- }\r
-\r
- String addProtocol(String file)\r
- {\r
- if (file.indexOf("://") == -1)\r
- {\r
- String fl = applet.resolveUrlForLocalOrAbsolute(file,\r
- getDocumentBase());\r
- try\r
- {\r
- if (new java.net.URL(fl).openStream() != null)\r
- {\r
- if (debug)\r
- {\r
- System.err.println("Prepended document base for resource: '"\r
- + file + "'");\r
- }\r
- return fl;\r
- }\r
- } catch (Exception x)\r
- {\r
- }\r
- ;\r
- fl = applet.resolveUrlForLocalOrAbsolute(file, getCodeBase());\r
- try\r
- {\r
- if (new java.net.URL(fl).openStream() != null)\r
- {\r
- if (debug)\r
- {\r
- System.err.println("Prepended codebase for resource: '"\r
- + file + "'");\r
- }\r
- return fl;\r
- }\r
- } catch (Exception x)\r
- {\r
- }\r
- ;\r
-\r
- }\r
-\r
- return file;\r
- }\r
- }\r
-\r
- /**\r
- * @return the default alignFrame acted on by the public applet methods. May\r
- * return null with an error message on System.err indicating the\r
- * fact.\r
- */\r
- public AlignFrame getDefaultTargetFrame()\r
- {\r
- if (currentAlignFrame != null)\r
- {\r
- return currentAlignFrame;\r
- }\r
- if (initialAlignFrame != null)\r
- {\r
- return initialAlignFrame;\r
- }\r
- System.err\r
- .println("Implementation error: Jalview Applet API cannot work out which AlignFrame to use.");\r
- return null;\r
- }\r
-\r
- /**\r
- * separator used for separatorList\r
- */\r
- protected String separator = "" + ((char) 0x00AC); // the default used to be\r
- // '|' but many sequence\r
- // IDS include pipes.\r
-\r
- /**\r
- * set to enable the URL based javascript execution mechanism\r
- */\r
- public boolean jsfallbackEnabled = false;\r
-\r
- /**\r
- * parse the string into a list\r
- * \r
- * @param list\r
- * @return elements separated by separator\r
- */\r
- public String[] separatorListToArray(String list)\r
- {\r
- return separatorListToArray(list, separator);\r
- }\r
-\r
- /**\r
- * parse the string into a list\r
- * \r
- * @param list\r
- * @param separator\r
- * @return elements separated by separator\r
- */\r
- public String[] separatorListToArray(String list, String separator)\r
- {\r
- // note separator local variable intentionally masks object field\r
- int seplen = separator.length();\r
- if (list == null || list.equals("") || list.equals(separator))\r
- return null;\r
- java.util.Vector jv = new Vector();\r
- int cp = 0, pos;\r
- while ((pos = list.indexOf(separator, cp)) > cp)\r
- {\r
- jv.addElement(list.substring(cp, pos));\r
- cp = pos + seplen;\r
- }\r
- if (cp < list.length())\r
- {\r
- String c = list.substring(cp);\r
- if (!c.equals(separator))\r
- {\r
- jv.addElement(c);\r
- }\r
- }\r
- if (jv.size() > 0)\r
- {\r
- String[] v = new String[jv.size()];\r
- for (int i = 0; i < v.length; i++)\r
- {\r
- v[i] = (String) jv.elementAt(i);\r
- }\r
- jv.removeAllElements();\r
- if (debug)\r
- {\r
- System.err.println("Array from '" + separator\r
- + "' separated List:\n" + v.length);\r
- for (int i = 0; i < v.length; i++)\r
- {\r
- System.err.println("item " + i + " '" + v[i] + "'");\r
- }\r
- }\r
- return v;\r
- }\r
- if (debug)\r
- {\r
- System.err.println("Empty Array from '" + separator\r
- + "' separated List");\r
- }\r
- return null;\r
- }\r
-\r
- /**\r
- * concatenate the list with separator\r
- * \r
- * @param list\r
- * @return concatenated string\r
- */\r
- public String arrayToSeparatorList(String[] list)\r
- {\r
- return arrayToSeparatorList(list, separator);\r
- }\r
-\r
- /**\r
- * concatenate the list with separator\r
- * \r
- * @param list\r
- * @param separator\r
- * @return concatenated string\r
- */\r
- public String arrayToSeparatorList(String[] list, String separator)\r
- {\r
- StringBuffer v = new StringBuffer();\r
- if (list != null && list.length > 0)\r
- {\r
- for (int i = 0, iSize = list.length; i < iSize; i++)\r
- {\r
- if (list[i] != null)\r
- {\r
- if (i > 0)\r
- {\r
- v.append(separator);\r
- }\r
- v.append(list[i]);\r
- }\r
- }\r
- if (debug)\r
- {\r
- System.err.println("Returning '" + separator\r
- + "' separated List:\n");\r
- System.err.println(v);\r
- }\r
- return v.toString();\r
- }\r
- if (debug)\r
- {\r
- System.err.println("Returning empty '" + separator\r
- + "' separated List\n");\r
- }\r
- return "" + separator;\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.bin.JalviewLiteJsApi#getFeatureGroups()\r
- */\r
- public String getFeatureGroups()\r
- {\r
- String lst = arrayToSeparatorList(getDefaultTargetFrame()\r
- .getFeatureGroups());\r
- return lst;\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see\r
- * jalview.bin.JalviewLiteJsApi#getFeatureGroupsOn(jalview.appletgui.AlignFrame\r
- * )\r
- */\r
- public String getFeatureGroupsOn(AlignFrame alf)\r
- {\r
- String lst = arrayToSeparatorList(alf.getFeatureGroups());\r
- return lst;\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.bin.JalviewLiteJsApi#getFeatureGroupsOfState(boolean)\r
- */\r
- public String getFeatureGroupsOfState(boolean visible)\r
- {\r
- return arrayToSeparatorList(getDefaultTargetFrame()\r
- .getFeatureGroupsOfState(visible));\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see\r
- * jalview.bin.JalviewLiteJsApi#getFeatureGroupsOfStateOn(jalview.appletgui\r
- * .AlignFrame, boolean)\r
- */\r
- public String getFeatureGroupsOfStateOn(AlignFrame alf, boolean visible)\r
- {\r
- return arrayToSeparatorList(alf.getFeatureGroupsOfState(visible));\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.bin.JalviewLiteJsApi#setFeatureGroupStateOn(jalview.appletgui.\r
- * AlignFrame, java.lang.String, boolean)\r
- */\r
- public void setFeatureGroupStateOn(final AlignFrame alf,\r
- final String groups, boolean state)\r
- {\r
- final boolean st = state;// !(state==null || state.equals("") ||\r
- // state.toLowerCase().equals("false"));\r
- java.awt.EventQueue.invokeLater(new Runnable()\r
- {\r
- @Override\r
- public void run()\r
- {\r
- alf.setFeatureGroupState(separatorListToArray(groups), st);\r
- }\r
- });\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.bin.JalviewLiteJsApi#setFeatureGroupState(java.lang.String,\r
- * boolean)\r
- */\r
- public void setFeatureGroupState(String groups, boolean state)\r
- {\r
- setFeatureGroupStateOn(getDefaultTargetFrame(), groups, state);\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.bin.JalviewLiteJsApi#getSeparator()\r
- */\r
- public String getSeparator()\r
- {\r
- return separator;\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.bin.JalviewLiteJsApi#setSeparator(java.lang.String)\r
- */\r
- public void setSeparator(String separator)\r
- {\r
- if (separator == null || separator.length() < 1)\r
- {\r
- // reset to default\r
- separator = "" + ((char) 0x00AC);\r
- }\r
- this.separator = separator;\r
- if (debug)\r
- {\r
- System.err.println("Default Separator now: '" + separator + "'");\r
- }\r
- }\r
-\r
- /**\r
- * get boolean value of applet parameter 'name' and return default if\r
- * parameter is not set\r
- * \r
- * @param name\r
- * name of paremeter\r
- * @param def\r
- * the value to return otherwise\r
- * @return true or false\r
- */\r
- public boolean getDefaultParameter(String name, boolean def)\r
- {\r
- String stn;\r
- if ((stn = getParameter(name)) == null)\r
- {\r
- return def;\r
- }\r
- if (stn.toLowerCase().equals("true"))\r
- {\r
- return true;\r
- }\r
- return false;\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.bin.JalviewLiteJsApi#addPdbFile(jalview.appletgui.AlignFrame,\r
- * java.lang.String, java.lang.String, java.lang.String)\r
- */\r
- public boolean addPdbFile(AlignFrame alFrame, String sequenceId,\r
- String pdbEntryString, String pdbFile)\r
- {\r
- return alFrame.addPdbFile(sequenceId, pdbEntryString, pdbFile);\r
- }\r
-\r
- protected void setAlignPdbStructures(boolean alignPdbStructures)\r
- {\r
- this.alignPdbStructures = alignPdbStructures;\r
- }\r
-\r
- public boolean isAlignPdbStructures()\r
- {\r
- return alignPdbStructures;\r
- }\r
-\r
- public void start()\r
- {\r
- // callInitCallback();\r
- }\r
-\r
- private Hashtable<String, long[]> jshashes = new Hashtable<String, long[]>();\r
-\r
- private Hashtable<String, Hashtable<String, String[]>> jsmessages = new Hashtable<String, Hashtable<String, String[]>>();\r
-\r
- public void setJsMessageSet(String messageclass, String viewId,\r
- String[] colcommands)\r
- {\r
- Hashtable<String, String[]> msgset = jsmessages.get(messageclass);\r
- if (msgset == null)\r
- {\r
- msgset = new Hashtable<String, String[]>();\r
- jsmessages.put(messageclass, msgset);\r
- }\r
- msgset.put(viewId, colcommands);\r
- long[] l = new long[colcommands.length];\r
- for (int i = 0; i < colcommands.length; i++)\r
- {\r
- l[i] = colcommands[i].hashCode();\r
- }\r
- jshashes.put(messageclass + "|" + viewId, l);\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.bin.JalviewLiteJsApi#getJsMessage(java.lang.String,\r
- * java.lang.String)\r
- */\r
- public String getJsMessage(String messageclass, String viewId)\r
- {\r
- Hashtable<String, String[]> msgset = jsmessages.get(messageclass);\r
- if (msgset != null)\r
- {\r
- String[] msgs = msgset.get(viewId);\r
- if (msgs != null)\r
- {\r
- for (int i = 0; i < msgs.length; i++)\r
- {\r
- if (msgs[i] != null)\r
- {\r
- String m = msgs[i];\r
- msgs[i] = null;\r
- return m;\r
- }\r
- }\r
- }\r
- }\r
- return "";\r
- }\r
-\r
- public boolean isJsMessageSetChanged(String string, String string2,\r
- String[] colcommands)\r
- {\r
- long[] l = jshashes.get(string + "|" + string2);\r
- if (l == null && colcommands != null)\r
- {\r
- return true;\r
- }\r
- for (int i = 0; i < colcommands.length; i++)\r
- {\r
- if (l[i] != colcommands[i].hashCode())\r
- {\r
- return true;\r
- }\r
- }\r
- return false;\r
- }\r
-\r
- private Vector jsExecQueue = new Vector();\r
-\r
- public Vector getJsExecQueue()\r
- {\r
- return jsExecQueue;\r
- }\r
-\r
- public void setExecutor(JSFunctionExec jsFunctionExec2)\r
- {\r
- jsFunctionExec = jsFunctionExec2;\r
- }\r
-\r
- /**\r
- * return the given colour value parameter or the given default if parameter\r
- * not given\r
- * \r
- * @param colparam\r
- * @param defcolour\r
- * @return\r
- */\r
- public Color getDefaultColourParameter(String colparam, Color defcolour)\r
- {\r
- String colprop = getParameter(colparam);\r
- if (colprop == null || colprop.trim().length() == 0)\r
- {\r
- return defcolour;\r
- }\r
- Color col = jalview.schemes.ColourSchemeProperty\r
- .getAWTColorFromName(colprop);\r
- if (col == null)\r
- {\r
- try\r
- {\r
- col = new jalview.schemes.UserColourScheme(colprop).findColour('A');\r
- } catch (Exception ex)\r
- {\r
- System.err.println("Couldn't parse '" + colprop\r
- + "' as a colour for " + colparam);\r
- col = null;\r
- }\r
- }\r
- return (col == null) ? defcolour : col;\r
-\r
- }\r
-\r
- public void openJalviewHelpUrl()\r
- {\r
- String helpUrl = getParameter("jalviewhelpurl");\r
- if (helpUrl == null || helpUrl.trim().length() < 5)\r
- {\r
- helpUrl = "http://www.jalview.org/help.html";\r
- }\r
- showURL(helpUrl, "HELP");\r
- }\r
-\r
- /**\r
- * form a complete URL given a path to a resource and a reference location on\r
- * the same server\r
- * \r
- * @param url\r
- * - an absolute path on the same server as localref or a document\r
- * located relative to localref\r
- * @param localref\r
- * - a URL on the same server as url\r
- * @return a complete URL for the resource located by url\r
- */\r
- private String resolveUrlForLocalOrAbsolute(String url, URL localref)\r
- {\r
- String codebase = localref.toString();\r
- if (url.indexOf("/") == 0)\r
- {\r
- url = codebase.substring(0, codebase.length()\r
- - localref.getFile().length())\r
- + url;\r
- }\r
- else\r
- {\r
- url = localref + url;\r
- }\r
- return url;\r
- }\r
-\r
- /**\r
- * open a URL in the browser - resolving it according to relative refs and\r
- * coping with javascript: protocol if necessary.\r
- * \r
- * @param url\r
- * @param target\r
- */\r
- public void showURL(String url, String target)\r
- {\r
- try\r
- {\r
- if (url.indexOf(":") == -1)\r
- {\r
- // TODO: verify (Bas Vroling bug) prepend codebase or server URL to\r
- // form valid URL\r
- // Should really use docbase, not codebase.\r
- URL prepend;\r
- url = resolveUrlForLocalOrAbsolute(\r
- url,\r
- prepend = getDefaultParameter("resolvetocodebase", false) ? getDocumentBase()\r
- : getCodeBase());\r
- if (debug)\r
- {\r
- System.err\r
- .println("Show url (prepended "\r
- + prepend\r
- + " - toggle resolvetocodebase if code/docbase resolution is wrong): "\r
- + url);\r
- }\r
- }\r
- else\r
- {\r
- if (debug)\r
- {\r
- System.err.println("Show url: " + url);\r
- }\r
- }\r
- if (url.indexOf("javascript:") == 0)\r
- {\r
- // no target for the javascript context\r
- getAppletContext().showDocument(new java.net.URL(url));\r
- }\r
- else\r
- {\r
- getAppletContext().showDocument(new java.net.URL(url), target);\r
- }\r
- } catch (Exception ex)\r
- {\r
- ex.printStackTrace();\r
- }\r
- }\r
-\r
- /**\r
- * bind structures in a viewer to any matching sequences in an alignFrame (use\r
- * sequenceIds to limit scope of search to specific sequences)\r
- * \r
- * @param alFrame\r
- * @param viewer\r
- * @param sequenceIds\r
- * @return TODO: consider making an exception structure for indicating when\r
- * binding fails public SequenceStructureBinding\r
- * addStructureViewInstance( AlignFrame alFrame, Object viewer, String\r
- * sequenceIds) {\r
- * \r
- * if (sequenceIds != null && sequenceIds.length() > 0) { return\r
- * alFrame.addStructureViewInstance(viewer,\r
- * separatorListToArray(sequenceIds)); } else { return\r
- * alFrame.addStructureViewInstance(viewer, null); } // return null; }\r
- */\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.bin;
+
+import jalview.api.StructureSelectionManagerProvider;
+import jalview.appletgui.AlignFrame;
+import jalview.appletgui.AlignViewport;
+import jalview.appletgui.EmbmenuFrame;
+import jalview.appletgui.FeatureSettings;
+import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.AlignmentOrder;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.PDBEntry;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
+import jalview.io.AnnotationFile;
+import jalview.io.AppletFormatAdapter;
+import jalview.io.FileParse;
+import jalview.io.IdentifyFile;
+import jalview.io.JnetAnnotationMaker;
+import jalview.javascript.JSFunctionExec;
+import jalview.javascript.JalviewLiteJsApi;
+import jalview.javascript.JsCallBack;
+import jalview.structure.SelectionListener;
+import jalview.structure.StructureSelectionManager;
+
+import java.applet.Applet;
+import java.awt.Button;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.EventQueue;
+import java.awt.Font;
+import java.awt.Frame;
+import java.awt.Graphics;
+import java.awt.event.ActionEvent;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.util.Hashtable;
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+import netscape.javascript.JSObject;
+
+/**
+ * Jalview Applet. Runs in Java 1.18 runtime
+ *
+ * @author $author$
+ * @version $Revision: 1.92 $
+ */
+public class JalviewLite extends Applet implements
+ StructureSelectionManagerProvider, JalviewLiteJsApi
+{
+
+ public StructureSelectionManager getStructureSelectionManager()
+ {
+ return StructureSelectionManager.getStructureSelectionManager(this);
+ }
+
+ // /////////////////////////////////////////
+ // The following public methods maybe called
+ // externally, eg via javascript in HTML page
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#getSelectedSequences()
+ */
+ public String getSelectedSequences()
+ {
+ return getSelectedSequencesFrom(getDefaultTargetFrame());
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#getSelectedSequences(java.lang.String)
+ */
+ public String getSelectedSequences(String sep)
+ {
+ return getSelectedSequencesFrom(getDefaultTargetFrame(), sep);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.bin.JalviewLiteJsApi#getSelectedSequencesFrom(jalview.appletgui
+ * .AlignFrame)
+ */
+ public String getSelectedSequencesFrom(AlignFrame alf)
+ {
+ return getSelectedSequencesFrom(alf, separator); // ""+0x00AC);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.bin.JalviewLiteJsApi#getSelectedSequencesFrom(jalview.appletgui
+ * .AlignFrame, java.lang.String)
+ */
+ public String getSelectedSequencesFrom(AlignFrame alf, String sep)
+ {
+ StringBuffer result = new StringBuffer("");
+ if (sep == null || sep.length() == 0)
+ {
+ sep = separator; // "+0x00AC;
+ }
+ if (alf.viewport.getSelectionGroup() != null)
+ {
+ SequenceI[] seqs = alf.viewport.getSelectionGroup()
+ .getSequencesInOrder(alf.viewport.getAlignment());
+
+ for (int i = 0; i < seqs.length; i++)
+ {
+ result.append(seqs[i].getName());
+ result.append(sep);
+ }
+ }
+
+ return result.toString();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#highlight(java.lang.String,
+ * java.lang.String, java.lang.String)
+ */
+ public void highlight(String sequenceId, String position,
+ String alignedPosition)
+ {
+ highlightIn(getDefaultTargetFrame(), sequenceId, position,
+ alignedPosition);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#highlightIn(jalview.appletgui.AlignFrame,
+ * java.lang.String, java.lang.String, java.lang.String)
+ */
+ public void highlightIn(final AlignFrame alf, final String sequenceId,
+ final String position, final String alignedPosition)
+ {
+ // TODO: could try to highlight in all alignments if alf==null
+ jalview.analysis.SequenceIdMatcher matcher = new jalview.analysis.SequenceIdMatcher(
+ alf.viewport.getAlignment().getSequencesArray());
+ final SequenceI sq = matcher.findIdMatch(sequenceId);
+ if (sq != null)
+ {
+ int apos = -1;
+ try
+ {
+ apos = new Integer(position).intValue();
+ apos--;
+ } catch (NumberFormatException ex)
+ {
+ return;
+ }
+ final StructureSelectionManagerProvider me = this;
+ final int pos = apos;
+ // use vamsas listener to broadcast to all listeners in scope
+ if (alignedPosition != null
+ && (alignedPosition.trim().length() == 0 || alignedPosition
+ .toLowerCase().indexOf("false") > -1))
+ {
+ java.awt.EventQueue.invokeLater(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ StructureSelectionManager.getStructureSelectionManager(me)
+ .mouseOverVamsasSequence(sq, sq.findIndex(pos), null);
+ }
+ });
+ }
+ else
+ {
+ java.awt.EventQueue.invokeLater(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ StructureSelectionManager.getStructureSelectionManager(me)
+ .mouseOverVamsasSequence(sq, pos, null);
+ }
+ });
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#select(java.lang.String,
+ * java.lang.String)
+ */
+ public void select(String sequenceIds, String columns)
+ {
+ selectIn(getDefaultTargetFrame(), sequenceIds, columns, separator);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#select(java.lang.String,
+ * java.lang.String, java.lang.String)
+ */
+ public void select(String sequenceIds, String columns, String sep)
+ {
+ selectIn(getDefaultTargetFrame(), sequenceIds, columns, sep);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#selectIn(jalview.appletgui.AlignFrame,
+ * java.lang.String, java.lang.String)
+ */
+ public void selectIn(AlignFrame alf, String sequenceIds, String columns)
+ {
+ selectIn(alf, sequenceIds, columns, separator);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#selectIn(jalview.appletgui.AlignFrame,
+ * java.lang.String, java.lang.String, java.lang.String)
+ */
+ public void selectIn(final AlignFrame alf, String sequenceIds,
+ String columns, String sep)
+ {
+ if (sep == null || sep.length() == 0)
+ {
+ sep = separator;
+ }
+ else
+ {
+ if (debug)
+ {
+ System.err.println("Selecting region using separator string '"
+ + separator + "'");
+ }
+ }
+ // deparse fields
+ String[] ids = separatorListToArray(sequenceIds, sep);
+ String[] cols = separatorListToArray(columns, sep);
+ final SequenceGroup sel = new SequenceGroup();
+ final ColumnSelection csel = new ColumnSelection();
+ AlignmentI al = alf.viewport.getAlignment();
+ jalview.analysis.SequenceIdMatcher matcher = new jalview.analysis.SequenceIdMatcher(
+ alf.viewport.getAlignment().getSequencesArray());
+ int start = 0, end = al.getWidth(), alw = al.getWidth();
+ boolean seqsfound = true;
+ if (ids != null && ids.length > 0)
+ {
+ seqsfound = false;
+ for (int i = 0; i < ids.length; i++)
+ {
+ if (ids[i].trim().length() == 0)
+ {
+ continue;
+ }
+ SequenceI sq = matcher.findIdMatch(ids[i]);
+ if (sq != null)
+ {
+ seqsfound = true;
+ sel.addSequence(sq, false);
+ }
+ }
+ }
+ boolean inseqpos = false;
+ if (cols != null && cols.length > 0)
+ {
+ boolean seset = false;
+ for (int i = 0; i < cols.length; i++)
+ {
+ String cl = cols[i].trim();
+ if (cl.length() == 0)
+ {
+ continue;
+ }
+ int p;
+ if ((p = cl.indexOf("-")) > -1)
+ {
+ int from = -1, to = -1;
+ try
+ {
+ from = new Integer(cl.substring(0, p)).intValue();
+ from--;
+ } catch (NumberFormatException ex)
+ {
+ System.err
+ .println("ERROR: Couldn't parse first integer in range element column selection string '"
+ + cl + "' - format is 'from-to'");
+ return;
+ }
+ try
+ {
+ to = new Integer(cl.substring(p + 1)).intValue();
+ to--;
+ } catch (NumberFormatException ex)
+ {
+ System.err
+ .println("ERROR: Couldn't parse second integer in range element column selection string '"
+ + cl + "' - format is 'from-to'");
+ return;
+ }
+ if (from >= 0 && to >= 0)
+ {
+ // valid range
+ if (from < to)
+ {
+ int t = to;
+ to = from;
+ to = t;
+ }
+ if (!seset)
+ {
+ start = from;
+ end = to;
+ seset = true;
+ }
+ else
+ {
+ // comment to prevent range extension
+ if (start > from)
+ {
+ start = from;
+ }
+ if (end < to)
+ {
+ end = to;
+ }
+ }
+ for (int r = from; r <= to; r++)
+ {
+ if (r >= 0 && r < alw)
+ {
+ csel.addElement(r);
+ }
+ }
+ if (debug)
+ {
+ System.err.println("Range '" + cl + "' deparsed as [" + from
+ + "," + to + "]");
+ }
+ }
+ else
+ {
+ System.err.println("ERROR: Invalid Range '" + cl
+ + "' deparsed as [" + from + "," + to + "]");
+ }
+ }
+ else
+ {
+ int r = -1;
+ try
+ {
+ r = new Integer(cl).intValue();
+ r--;
+ } catch (NumberFormatException ex)
+ {
+ if (cl.toLowerCase().equals("sequence"))
+ {
+ // we are in the dataset sequence's coordinate frame.
+ inseqpos = true;
+ }
+ else
+ {
+ System.err
+ .println("ERROR: Couldn't parse integer from point selection element of column selection string '"
+ + cl + "'");
+ return;
+ }
+ }
+ if (r >= 0 && r <= alw)
+ {
+ if (!seset)
+ {
+ start = r;
+ end = r;
+ seset = true;
+ }
+ else
+ {
+ // comment to prevent range extension
+ if (start > r)
+ {
+ start = r;
+ }
+ if (end < r)
+ {
+ end = r;
+ }
+ }
+ csel.addElement(r);
+ if (debug)
+ {
+ System.err.println("Point selection '" + cl
+ + "' deparsed as [" + r + "]");
+ }
+ }
+ else
+ {
+ System.err.println("ERROR: Invalid Point selection '" + cl
+ + "' deparsed as [" + r + "]");
+ }
+ }
+ }
+ }
+ if (seqsfound)
+ {
+ // we only propagate the selection when it was the null selection, or the
+ // given sequences were found in the alignment.
+ if (inseqpos && sel.getSize() > 0)
+ {
+ // assume first sequence provides reference frame ?
+ SequenceI rs = sel.getSequenceAt(0);
+ start = rs.findIndex(start);
+ end = rs.findIndex(end);
+ if (csel != null)
+ {
+ Vector cs = csel.getSelected();
+ csel.clear();
+ for (int csi = 0, csiS = cs.size(); csi < csiS; csi++)
+ {
+ csel.addElement(rs.findIndex(((Integer) cs.elementAt(csi))
+ .intValue()));
+ }
+ }
+ }
+ sel.setStartRes(start);
+ sel.setEndRes(end);
+ EventQueue.invokeLater(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ alf.select(sel, csel);
+ }
+ });
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.bin.JalviewLiteJsApi#getSelectedSequencesAsAlignment(java.lang.
+ * String, java.lang.String)
+ */
+ public String getSelectedSequencesAsAlignment(String format, String suffix)
+ {
+ return getSelectedSequencesAsAlignmentFrom(getDefaultTargetFrame(),
+ format, suffix);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.bin.JalviewLiteJsApi#getSelectedSequencesAsAlignmentFrom(jalview
+ * .appletgui.AlignFrame, java.lang.String, java.lang.String)
+ */
+ public String getSelectedSequencesAsAlignmentFrom(AlignFrame alf,
+ String format, String suffix)
+ {
+ try
+ {
+ boolean seqlimits = suffix.equalsIgnoreCase("true");
+ if (alf.viewport.getSelectionGroup() != null)
+ {
+ // JBPNote: getSelectionAsNewSequence behaviour has changed - this
+ // method now returns a full copy of sequence data
+ // TODO consider using getSequenceSelection instead here
+ String reply = new AppletFormatAdapter().formatSequences(format,
+ new Alignment(alf.viewport.getSelectionAsNewSequence()),
+ seqlimits);
+ return reply;
+ }
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ return "Error retrieving alignment in " + format + " format. ";
+ }
+ return "";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#getAlignmentOrder()
+ */
+ public String getAlignmentOrder()
+ {
+ return getAlignmentOrderFrom(getDefaultTargetFrame());
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.bin.JalviewLiteJsApi#getAlignmentOrderFrom(jalview.appletgui.AlignFrame
+ * )
+ */
+ public String getAlignmentOrderFrom(AlignFrame alf)
+ {
+ return getAlignmentOrderFrom(alf, separator);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.bin.JalviewLiteJsApi#getAlignmentOrderFrom(jalview.appletgui.AlignFrame
+ * , java.lang.String)
+ */
+ public String getAlignmentOrderFrom(AlignFrame alf, String sep)
+ {
+ AlignmentI alorder = alf.getAlignViewport().getAlignment();
+ String[] order = new String[alorder.getHeight()];
+ for (int i = 0; i < order.length; i++)
+ {
+ order[i] = alorder.getSequenceAt(i).getName();
+ }
+ return arrayToSeparatorList(order);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#orderBy(java.lang.String,
+ * java.lang.String)
+ */
+ public String orderBy(String order, String undoName)
+ {
+ return orderBy(order, undoName, separator);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#orderBy(java.lang.String,
+ * java.lang.String, java.lang.String)
+ */
+ public String orderBy(String order, String undoName, String sep)
+ {
+ return orderAlignmentBy(getDefaultTargetFrame(), order, undoName, sep);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.bin.JalviewLiteJsApi#orderAlignmentBy(jalview.appletgui.AlignFrame,
+ * java.lang.String, java.lang.String, java.lang.String)
+ */
+ public String orderAlignmentBy(AlignFrame alf, String order,
+ String undoName, String sep)
+ {
+ String[] ids = separatorListToArray(order, sep);
+ SequenceI[] sqs = null;
+ if (ids != null && ids.length > 0)
+ {
+ jalview.analysis.SequenceIdMatcher matcher = new jalview.analysis.SequenceIdMatcher(
+ alf.viewport.getAlignment().getSequencesArray());
+ int s = 0;
+ sqs = new SequenceI[ids.length];
+ for (int i = 0; i < ids.length; i++)
+ {
+ if (ids[i].trim().length() == 0)
+ {
+ continue;
+ }
+ SequenceI sq = matcher.findIdMatch(ids[i]);
+ if (sq != null)
+ {
+ sqs[s++] = sq;
+ }
+ }
+ if (s > 0)
+ {
+ SequenceI[] sqq = new SequenceI[s];
+ System.arraycopy(sqs, 0, sqq, 0, s);
+ sqs = sqq;
+ }
+ else
+ {
+ sqs = null;
+ }
+ }
+ if (sqs == null)
+ {
+ return "";
+ }
+ ;
+ final AlignmentOrder aorder = new AlignmentOrder(sqs);
+
+ if (undoName != null && undoName.trim().length() == 0)
+ {
+ undoName = null;
+ }
+ final String _undoName = undoName;
+ // TODO: deal with synchronization here: cannot raise any events until after
+ // this has returned.
+ return alf.sortBy(aorder, _undoName) ? "true" : "";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#getAlignment(java.lang.String)
+ */
+ public String getAlignment(String format)
+ {
+ return getAlignmentFrom(getDefaultTargetFrame(), format, "true");
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.bin.JalviewLiteJsApi#getAlignmentFrom(jalview.appletgui.AlignFrame,
+ * java.lang.String)
+ */
+ public String getAlignmentFrom(AlignFrame alf, String format)
+ {
+ return getAlignmentFrom(alf, format, "true");
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#getAlignment(java.lang.String,
+ * java.lang.String)
+ */
+ public String getAlignment(String format, String suffix)
+ {
+ return getAlignmentFrom(getDefaultTargetFrame(), format, suffix);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.bin.JalviewLiteJsApi#getAlignmentFrom(jalview.appletgui.AlignFrame,
+ * java.lang.String, java.lang.String)
+ */
+ public String getAlignmentFrom(AlignFrame alf, String format,
+ String suffix)
+ {
+ try
+ {
+ boolean seqlimits = suffix.equalsIgnoreCase("true");
+
+ String reply = new AppletFormatAdapter().formatSequences(format,
+ alf.viewport.getAlignment(), seqlimits);
+ return reply;
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ return "Error retrieving alignment in " + format + " format. ";
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#loadAnnotation(java.lang.String)
+ */
+ public void loadAnnotation(String annotation)
+ {
+ loadAnnotationFrom(getDefaultTargetFrame(), annotation);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.bin.JalviewLiteJsApi#loadAnnotationFrom(jalview.appletgui.AlignFrame
+ * , java.lang.String)
+ */
+ public void loadAnnotationFrom(AlignFrame alf, String annotation)
+ {
+ if (new AnnotationFile().readAnnotationFile(alf.getAlignViewport()
+ .getAlignment(), annotation, AppletFormatAdapter.PASTE))
+ {
+ alf.alignPanel.fontChanged();
+ alf.alignPanel.setScrollValues(0, 0);
+ }
+ else
+ {
+ alf.parseFeaturesFile(annotation, AppletFormatAdapter.PASTE);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#loadAnnotation(java.lang.String)
+ */
+ public void loadFeatures(String features, boolean autoenabledisplay)
+ {
+ loadFeaturesFrom(getDefaultTargetFrame(), features, autoenabledisplay);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.bin.JalviewLiteJsApi#loadAnnotationFrom(jalview.appletgui.AlignFrame
+ * , java.lang.String)
+ */
+ public boolean loadFeaturesFrom(AlignFrame alf, String features,
+ boolean autoenabledisplay)
+ {
+ return alf.parseFeaturesFile(features, AppletFormatAdapter.PASTE,
+ autoenabledisplay);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#getFeatures(java.lang.String)
+ */
+ public String getFeatures(String format)
+ {
+ return getFeaturesFrom(getDefaultTargetFrame(), format);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.bin.JalviewLiteJsApi#getFeaturesFrom(jalview.appletgui.AlignFrame,
+ * java.lang.String)
+ */
+ public String getFeaturesFrom(AlignFrame alf, String format)
+ {
+ return alf.outputFeatures(false, format);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#getAnnotation()
+ */
+ public String getAnnotation()
+ {
+ return getAnnotationFrom(getDefaultTargetFrame());
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.bin.JalviewLiteJsApi#getAnnotationFrom(jalview.appletgui.AlignFrame
+ * )
+ */
+ public String getAnnotationFrom(AlignFrame alf)
+ {
+ return alf.outputAnnotations(false);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#newView()
+ */
+ public AlignFrame newView()
+ {
+ return newViewFrom(getDefaultTargetFrame());
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#newView(java.lang.String)
+ */
+ public AlignFrame newView(String name)
+ {
+ return newViewFrom(getDefaultTargetFrame(), name);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#newViewFrom(jalview.appletgui.AlignFrame)
+ */
+ public AlignFrame newViewFrom(AlignFrame alf)
+ {
+ return alf.newView(null);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#newViewFrom(jalview.appletgui.AlignFrame,
+ * java.lang.String)
+ */
+ public AlignFrame newViewFrom(AlignFrame alf, String name)
+ {
+ return alf.newView(name);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#loadAlignment(java.lang.String,
+ * java.lang.String)
+ */
+ public AlignFrame loadAlignment(String text, String title)
+ {
+ Alignment al = null;
+
+ String format = new IdentifyFile().Identify(text,
+ AppletFormatAdapter.PASTE);
+ try
+ {
+ al = new AppletFormatAdapter().readFile(text,
+ AppletFormatAdapter.PASTE, format);
+ if (al.getHeight() > 0)
+ {
+ return new AlignFrame(al, this, title, false);
+ }
+ } catch (java.io.IOException ex)
+ {
+ ex.printStackTrace();
+ }
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#setMouseoverListener(java.lang.String)
+ */
+ public void setMouseoverListener(String listener)
+ {
+ setMouseoverListener(currentAlignFrame, listener);
+ }
+
+ private Vector<jalview.javascript.JSFunctionExec> javascriptListeners = new Vector<jalview.javascript.JSFunctionExec>();
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.bin.JalviewLiteJsApi#setMouseoverListener(jalview.appletgui.AlignFrame
+ * , java.lang.String)
+ */
+ public void setMouseoverListener(AlignFrame af, String listener)
+ {
+ if (listener != null)
+ {
+ listener = listener.trim();
+ if (listener.length() == 0)
+ {
+ System.err
+ .println("jalview Javascript error: Ignoring empty function for mouseover listener.");
+ return;
+ }
+ }
+ jalview.javascript.MouseOverListener mol = new jalview.javascript.MouseOverListener(
+ this, af, listener);
+ javascriptListeners.addElement(mol);
+ StructureSelectionManager.getStructureSelectionManager(this)
+ .addStructureViewerListener(mol);
+ if (debug)
+ {
+ System.err.println("Added a mouseover listener for "
+ + ((af == null) ? "All frames" : "Just views for "
+ + af.getAlignViewport().getSequenceSetId()));
+ System.err.println("There are now " + javascriptListeners.size()
+ + " listeners in total.");
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#setSelectionListener(java.lang.String)
+ */
+ public void setSelectionListener(String listener)
+ {
+ setSelectionListener(null, listener);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.bin.JalviewLiteJsApi#setSelectionListener(jalview.appletgui.AlignFrame
+ * , java.lang.String)
+ */
+ public void setSelectionListener(AlignFrame af, String listener)
+ {
+ if (listener != null)
+ {
+ listener = listener.trim();
+ if (listener.length() == 0)
+ {
+ System.err
+ .println("jalview Javascript error: Ignoring empty function for selection listener.");
+ return;
+ }
+ }
+ jalview.javascript.JsSelectionSender mol = new jalview.javascript.JsSelectionSender(
+ this, af, listener);
+ javascriptListeners.addElement(mol);
+ StructureSelectionManager.getStructureSelectionManager(this)
+ .addSelectionListener(mol);
+ if (debug)
+ {
+ System.err.println("Added a selection listener for "
+ + ((af == null) ? "All frames" : "Just views for "
+ + af.getAlignViewport().getSequenceSetId()));
+ System.err.println("There are now " + javascriptListeners.size()
+ + " listeners in total.");
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#setStructureListener(java.lang.String,
+ * java.lang.String)
+ */
+ public void setStructureListener(String listener, String modelSet)
+ {
+ if (listener != null)
+ {
+ listener = listener.trim();
+ if (listener.length() == 0)
+ {
+ System.err
+ .println("jalview Javascript error: Ignoring empty function for selection listener.");
+ return;
+ }
+ }
+ jalview.javascript.MouseOverStructureListener mol = new jalview.javascript.MouseOverStructureListener(
+ this, listener, separatorListToArray(modelSet));
+ javascriptListeners.addElement(mol);
+ StructureSelectionManager.getStructureSelectionManager(this)
+ .addStructureViewerListener(mol);
+ if (debug)
+ {
+ System.err.println("Added a javascript structure viewer listener '"
+ + listener + "'");
+ System.err.println("There are now " + javascriptListeners.size()
+ + " listeners in total.");
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.bin.JalviewLiteJsApi#removeJavascriptListener(jalview.appletgui
+ * .AlignFrame, java.lang.String)
+ */
+ public void removeJavascriptListener(AlignFrame af, String listener)
+ {
+ if (listener != null)
+ {
+ listener = listener.trim();
+ if (listener.length() == 0)
+ {
+ listener = null;
+ }
+ }
+ boolean rprt = false;
+ for (int ms = 0, msSize = javascriptListeners.size(); ms < msSize;)
+ {
+ Object lstn = javascriptListeners.elementAt(ms);
+ JsCallBack lstner = (JsCallBack) lstn;
+ if ((af == null || lstner.getAlignFrame() == af)
+ && (listener == null || lstner.getListenerFunction().equals(
+ listener)))
+ {
+ javascriptListeners.removeElement(lstner);
+ msSize--;
+ if (lstner instanceof SelectionListener)
+ {
+ StructureSelectionManager.getStructureSelectionManager(this)
+ .removeSelectionListener((SelectionListener) lstner);
+ }
+ else
+ {
+ StructureSelectionManager.getStructureSelectionManager(this)
+ .removeStructureViewerListener(lstner, null);
+ }
+ rprt = debug;
+ if (debug)
+ {
+ System.err.println("Removed listener '" + listener + "'");
+ }
+ }
+ else
+ {
+ ms++;
+ }
+ }
+ if (rprt)
+ {
+ System.err.println("There are now " + javascriptListeners.size()
+ + " listeners in total.");
+ }
+ }
+
+ public void stop()
+ {
+ System.err.println("Applet " + getName() + " stop().");
+ tidyUp();
+ }
+
+ public void destroy()
+ {
+ System.err.println("Applet " + getName() + " destroy().");
+ tidyUp();
+ }
+
+ private void tidyUp()
+ {
+ removeAll();
+ if (currentAlignFrame != null && currentAlignFrame.viewport != null
+ && currentAlignFrame.viewport.applet != null)
+ {
+ AlignViewport av = currentAlignFrame.viewport;
+ currentAlignFrame.closeMenuItem_actionPerformed();
+ av.applet = null;
+ currentAlignFrame = null;
+ }
+ if (javascriptListeners != null)
+ {
+ while (javascriptListeners.size() > 0)
+ {
+ jalview.javascript.JSFunctionExec mol = javascriptListeners
+ .elementAt(0);
+ javascriptListeners.removeElement(mol);
+ if (mol instanceof SelectionListener)
+ {
+ StructureSelectionManager.getStructureSelectionManager(this)
+ .removeSelectionListener((SelectionListener) mol);
+ }
+ else
+ {
+ StructureSelectionManager.getStructureSelectionManager(this)
+ .removeStructureViewerListener(mol, null);
+ }
+ mol.jvlite = null;
+ }
+ }
+ if (jsFunctionExec != null)
+ {
+ jsFunctionExec.stopQueue();
+ jsFunctionExec.jvlite = null;
+ }
+ initialAlignFrame = null;
+ jsFunctionExec = null;
+ javascriptListeners = null;
+ StructureSelectionManager.release(this);
+ }
+
+ private jalview.javascript.JSFunctionExec jsFunctionExec;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#mouseOverStructure(java.lang.String,
+ * java.lang.String, java.lang.String)
+ */
+ public void mouseOverStructure(final String pdbResNum,
+ final String chain, final String pdbfile)
+ {
+ final StructureSelectionManagerProvider me = this;
+ java.awt.EventQueue.invokeLater(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ try
+ {
+ StructureSelectionManager.getStructureSelectionManager(me)
+ .mouseOverStructure(new Integer(pdbResNum).intValue(),
+ chain, pdbfile);
+ if (debug)
+ {
+ System.err.println("mouseOver for '" + pdbResNum
+ + "' in chain '" + chain + "' in structure '" + pdbfile
+ + "'");
+ }
+ } catch (NumberFormatException e)
+ {
+ System.err.println("Ignoring invalid residue number string '"
+ + pdbResNum + "'");
+ }
+
+ }
+ });
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.bin.JalviewLiteJsApi#scrollViewToIn(jalview.appletgui.AlignFrame,
+ * java.lang.String, java.lang.String)
+ */
+ public void scrollViewToIn(final AlignFrame alf, final String topRow,
+ final String leftHandColumn)
+ {
+ java.awt.EventQueue.invokeLater(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ try
+ {
+ alf.scrollTo(new Integer(topRow).intValue(), new Integer(
+ leftHandColumn).intValue());
+
+ } catch (Exception ex)
+ {
+ System.err.println("Couldn't parse integer arguments (topRow='"
+ + topRow + "' and leftHandColumn='" + leftHandColumn
+ + "')");
+ ex.printStackTrace();
+ }
+ }
+ });
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.javascript.JalviewLiteJsApi#scrollViewToRowIn(jalview.appletgui
+ * .AlignFrame, java.lang.String)
+ */
+ @Override
+ public void scrollViewToRowIn(final AlignFrame alf, final String topRow)
+ {
+
+ java.awt.EventQueue.invokeLater(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ try
+ {
+ alf.scrollToRow(new Integer(topRow).intValue());
+
+ } catch (Exception ex)
+ {
+ System.err.println("Couldn't parse integer arguments (topRow='"
+ + topRow + "')");
+ ex.printStackTrace();
+ }
+
+ }
+ });
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.javascript.JalviewLiteJsApi#scrollViewToColumnIn(jalview.appletgui
+ * .AlignFrame, java.lang.String)
+ */
+ @Override
+ public void scrollViewToColumnIn(final AlignFrame alf,
+ final String leftHandColumn)
+ {
+ java.awt.EventQueue.invokeLater(new Runnable()
+ {
+
+ @Override
+ public void run()
+ {
+ try
+ {
+ alf.scrollToColumn(new Integer(leftHandColumn).intValue());
+
+ } catch (Exception ex)
+ {
+ System.err
+ .println("Couldn't parse integer arguments (leftHandColumn='"
+ + leftHandColumn + "')");
+ ex.printStackTrace();
+ }
+ }
+ });
+
+ }
+
+ // //////////////////////////////////////////////
+ // //////////////////////////////////////////////
+
+ public static int lastFrameX = 200;
+
+ public static int lastFrameY = 200;
+
+ boolean fileFound = true;
+
+ String file = "No file";
+
+ Button launcher = new Button("Start Jalview");
+
+ /**
+ * The currentAlignFrame is static, it will change if and when the user
+ * selects a new window. Note that it will *never* point back to the embedded
+ * AlignFrame if the applet is started as embedded on the page and then
+ * afterwards a new view is created.
+ */
+ public AlignFrame currentAlignFrame = null;
+
+ /**
+ * This is the first frame to be displayed, and does not change. API calls
+ * will default to this instance if currentAlignFrame is null.
+ */
+ AlignFrame initialAlignFrame = null;
+
+ boolean embedded = false;
+
+ private boolean checkForJmol = true;
+
+ private boolean checkedForJmol = false; // ensure we don't check for jmol
+
+ // every time the app is re-inited
+
+ public boolean jmolAvailable = false;
+
+ private boolean alignPdbStructures = false;
+
+ /**
+ * use an external structure viewer exclusively (no jmols or MCViews will be
+ * opened by JalviewLite itself)
+ */
+ public boolean useXtrnalSviewer = false;
+
+ public static boolean debug = false;
+
+ static String builddate = null, version = null;
+
+ private static void initBuildDetails()
+ {
+ if (builddate == null)
+ {
+ builddate = "unknown";
+ version = "test";
+ java.net.URL url = JalviewLite.class
+ .getResource("/.build_properties");
+ if (url != null)
+ {
+ try
+ {
+ BufferedReader reader = new BufferedReader(new InputStreamReader(
+ url.openStream()));
+ String line;
+ while ((line = reader.readLine()) != null)
+ {
+ if (line.indexOf("VERSION") > -1)
+ {
+ version = line.substring(line.indexOf("=") + 1);
+ }
+ if (line.indexOf("BUILD_DATE") > -1)
+ {
+ builddate = line.substring(line.indexOf("=") + 1);
+ }
+ }
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+ }
+ }
+
+ public static String getBuildDate()
+ {
+ initBuildDetails();
+ return builddate;
+ }
+
+ public static String getVersion()
+ {
+ initBuildDetails();
+ return version;
+ }
+
+ // public JSObject scriptObject = null;
+
+ /**
+ * init method for Jalview Applet
+ */
+ public void init()
+ {
+ // remove any handlers that might be hanging around from an earlier instance
+ try
+ {
+ if (debug)
+ {
+ System.err.println("Applet context is '"
+ + getAppletContext().getClass().toString() + "'");
+ }
+ JSObject scriptObject = JSObject.getWindow(this);
+ if (debug && scriptObject != null)
+ {
+ System.err.println("Applet has Javascript callback support.");
+ }
+
+ } catch (Exception ex)
+ {
+ System.err
+ .println("Warning: No JalviewLite javascript callbacks available.");
+ if (debug)
+ {
+ ex.printStackTrace();
+ }
+ }
+ /**
+ * turn on extra applet debugging
+ */
+ String dbg = getParameter("debug");
+ if (dbg != null)
+ {
+ debug = dbg.toLowerCase().equals("true");
+ }
+ if (debug)
+ {
+
+ System.err.println("JalviewLite Version " + getVersion());
+ System.err.println("Build Date : " + getBuildDate());
+
+ }
+ String externalsviewer = getParameter("externalstructureviewer");
+ if (externalsviewer != null)
+ {
+ useXtrnalSviewer = externalsviewer.trim().toLowerCase()
+ .equals("true");
+ }
+ /**
+ * if true disable the check for jmol
+ */
+ String chkforJmol = getParameter("nojmol");
+ if (chkforJmol != null)
+ {
+ checkForJmol = !chkforJmol.equals("true");
+ }
+ /**
+ * get the separator parameter if present
+ */
+ String sep = getParameter("separator");
+ if (sep != null)
+ {
+ if (sep.length() > 0)
+ {
+ separator = sep;
+ if (debug)
+ {
+ System.err.println("Separator set to '" + separator + "'");
+ }
+ }
+ else
+ {
+ throw new Error(
+ "Invalid separator parameter - must be non-zero length");
+ }
+ }
+ int r = 255;
+ int g = 255;
+ int b = 255;
+ String param = getParameter("RGB");
+
+ if (param != null)
+ {
+ try
+ {
+ r = Integer.parseInt(param.substring(0, 2), 16);
+ g = Integer.parseInt(param.substring(2, 4), 16);
+ b = Integer.parseInt(param.substring(4, 6), 16);
+ } catch (Exception ex)
+ {
+ r = 255;
+ g = 255;
+ b = 255;
+ }
+ }
+ param = getParameter("label");
+ if (param != null)
+ {
+ launcher.setLabel(param);
+ }
+
+ setBackground(new Color(r, g, b));
+
+ file = getParameter("file");
+
+ if (file == null)
+ {
+ // Maybe the sequences are added as parameters
+ StringBuffer data = new StringBuffer("PASTE");
+ int i = 1;
+ while ((file = getParameter("sequence" + i)) != null)
+ {
+ data.append(file.toString() + "\n");
+ i++;
+ }
+ if (data.length() > 5)
+ {
+ file = data.toString();
+ }
+ }
+
+ final JalviewLite jvapplet = this;
+ if (getParameter("embedded") != null
+ && getParameter("embedded").equalsIgnoreCase("true"))
+ {
+ // Launch as embedded applet in page
+ embedded = true;
+ LoadingThread loader = new LoadingThread(file, jvapplet);
+ loader.start();
+ }
+ else if (file != null)
+ {
+ if (getParameter("showbutton") == null
+ || !getParameter("showbutton").equalsIgnoreCase("false"))
+ {
+ // Add the JalviewLite 'Button' to the page
+ add(launcher);
+ launcher.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ LoadingThread loader = new LoadingThread(file, jvapplet);
+ loader.start();
+ }
+ });
+ }
+ else
+ {
+ // Open jalviewLite immediately.
+ LoadingThread loader = new LoadingThread(file, jvapplet);
+ loader.start();
+ }
+ }
+ else
+ {
+ // jalview initialisation with no alignment. loadAlignment() method can
+ // still be called to open new alignments.
+ file = "NO FILE";
+ fileFound = false;
+ // callInitCallback();
+ }
+ }
+
+ private void callInitCallback()
+ {
+ String initjscallback = getParameter("oninit");
+ if (initjscallback == null)
+ {
+ return;
+ }
+ initjscallback = initjscallback.trim();
+ if (initjscallback.length() > 0)
+ {
+ JSObject scriptObject = null;
+ try
+ {
+ scriptObject = JSObject.getWindow(this);
+ } catch (Exception ex)
+ {
+ }
+ ;
+ if (scriptObject != null)
+ {
+ try
+ {
+ // do onInit with the JS executor thread
+ new JSFunctionExec(this).executeJavascriptFunction(true,
+ initjscallback, null, "Calling oninit callback '"
+ + initjscallback + "'.");
+ } catch (Exception e)
+ {
+ System.err.println("Exception when executing _oninit callback '"
+ + initjscallback + "'.");
+ e.printStackTrace();
+ }
+ }
+ else
+ {
+ System.err.println("Not executing _oninit callback '"
+ + initjscallback + "' - no scripting allowed.");
+ }
+ }
+ }
+
+ /**
+ * Initialises and displays a new java.awt.Frame
+ *
+ * @param frame
+ * java.awt.Frame to be displayed
+ * @param title
+ * title of new frame
+ * @param width
+ * width if new frame
+ * @param height
+ * height of new frame
+ */
+ public static void addFrame(final Frame frame, String title, int width,
+ int height)
+ {
+ frame.setLocation(lastFrameX, lastFrameY);
+ lastFrameX += 40;
+ lastFrameY += 40;
+ frame.setSize(width, height);
+ frame.setTitle(title);
+ frame.addWindowListener(new WindowAdapter()
+ {
+ public void windowClosing(WindowEvent e)
+ {
+ if (frame instanceof AlignFrame)
+ {
+ AlignViewport vp = ((AlignFrame) frame).viewport;
+ ((AlignFrame) frame).closeMenuItem_actionPerformed();
+ if (vp.applet.currentAlignFrame == frame)
+ {
+ vp.applet.currentAlignFrame = null;
+ }
+ vp.applet = null;
+ vp = null;
+
+ }
+ lastFrameX -= 40;
+ lastFrameY -= 40;
+ if (frame instanceof EmbmenuFrame)
+ {
+ ((EmbmenuFrame) frame).destroyMenus();
+ }
+ frame.setMenuBar(null);
+ frame.dispose();
+ }
+
+ public void windowActivated(WindowEvent e)
+ {
+ if (frame instanceof AlignFrame)
+ {
+ ((AlignFrame) frame).viewport.applet.currentAlignFrame = (AlignFrame) frame;
+ if (debug)
+ {
+ System.err.println("Activated window " + frame);
+ }
+ }
+ // be good.
+ super.windowActivated(e);
+ }
+ /*
+ * Probably not necessary to do this - see TODO above. (non-Javadoc)
+ *
+ * @see
+ * java.awt.event.WindowAdapter#windowDeactivated(java.awt.event.WindowEvent
+ * )
+ *
+ * public void windowDeactivated(WindowEvent e) { if (currentAlignFrame ==
+ * frame) { currentAlignFrame = null; if (debug) {
+ * System.err.println("Deactivated window "+frame); } }
+ * super.windowDeactivated(e); }
+ */
+ });
+ frame.setVisible(true);
+ }
+
+ /**
+ * This paints the background surrounding the "Launch Jalview button" <br>
+ * <br>
+ * If file given in parameter not found, displays error message
+ *
+ * @param g
+ * graphics context
+ */
+ public void paint(Graphics g)
+ {
+ if (!fileFound)
+ {
+ g.setColor(new Color(200, 200, 200));
+ g.setColor(Color.cyan);
+ g.fillRect(0, 0, getSize().width, getSize().height);
+ g.setColor(Color.red);
+ g.drawString("Jalview can't open file", 5, 15);
+ g.drawString("\"" + file + "\"", 5, 30);
+ }
+ else if (embedded)
+ {
+ g.setColor(Color.black);
+ g.setFont(new Font("Arial", Font.BOLD, 24));
+ g.drawString("Jalview Applet", 50, getSize().height / 2 - 30);
+ g.drawString("Loading Data...", 50, getSize().height / 2);
+ }
+ }
+
+ /**
+ * get all components associated with the applet of the given type
+ *
+ * @param class1
+ * @return
+ */
+ public Vector getAppletWindow(Class class1)
+ {
+ Vector wnds = new Vector();
+ Component[] cmp = getComponents();
+ if (cmp != null)
+ {
+ for (int i = 0; i < cmp.length; i++)
+ {
+ if (class1.isAssignableFrom(cmp[i].getClass()))
+ {
+ wnds.addElement(cmp);
+ }
+ }
+ }
+ return wnds;
+ }
+
+ class LoadJmolThread extends Thread
+ {
+ private boolean running = false;
+
+ public void run()
+ {
+ if (running || checkedForJmol)
+ {
+ return;
+ }
+ running = true;
+ if (checkForJmol)
+ {
+ try
+ {
+ if (!System.getProperty("java.version").startsWith("1.1"))
+ {
+ Class.forName("org.jmol.adapter.smarter.SmarterJmolAdapter");
+ jmolAvailable = true;
+ }
+ if (!jmolAvailable)
+ {
+ System.out
+ .println("Jmol not available - Using MCview for structures");
+ }
+ } catch (java.lang.ClassNotFoundException ex)
+ {
+ }
+ }
+ else
+ {
+ jmolAvailable = false;
+ if (debug)
+ {
+ System.err
+ .println("Skipping Jmol check. Will use MCView (probably)");
+ }
+ }
+ checkedForJmol = true;
+ running = false;
+ }
+
+ public boolean notFinished()
+ {
+ return running || !checkedForJmol;
+ }
+ }
+
+ class LoadingThread extends Thread
+ {
+ /**
+ * State variable: File source
+ */
+ String file;
+
+ /**
+ * State variable: protocol for access to file source
+ */
+ String protocol;
+
+ /**
+ * State variable: format of file source
+ */
+ String format;
+
+ String _file;
+
+ JalviewLite applet;
+
+ private void dbgMsg(String msg)
+ {
+ if (applet.debug)
+ {
+ System.err.println(msg);
+ }
+ }
+
+ /**
+ * update the protocol state variable for accessing the datasource located
+ * by file.
+ *
+ * @param file
+ * @return possibly updated datasource string
+ */
+ public String setProtocolState(String file)
+ {
+ if (file.startsWith("PASTE"))
+ {
+ file = file.substring(5);
+ protocol = AppletFormatAdapter.PASTE;
+ }
+ else if (inArchive(file))
+ {
+ protocol = AppletFormatAdapter.CLASSLOADER;
+ }
+ else
+ {
+ file = addProtocol(file);
+ protocol = AppletFormatAdapter.URL;
+ }
+ dbgMsg("Protocol identified as '" + protocol + "'");
+ return file;
+ }
+
+ public LoadingThread(String _file, JalviewLite _applet)
+ {
+ this._file = _file;
+ applet = _applet;
+ }
+
+ public void run()
+ {
+ LoadJmolThread jmolchecker = new LoadJmolThread();
+ jmolchecker.start();
+ while (jmolchecker.notFinished())
+ {
+ // wait around until the Jmol check is complete.
+ try
+ {
+ Thread.sleep(2);
+ } catch (Exception e)
+ {
+ }
+ ;
+ }
+ startLoading();
+ // applet.callInitCallback();
+ }
+
+ private void startLoading()
+ {
+ AlignFrame newAlignFrame;
+ dbgMsg("Loading thread started with:\n>>file\n" + _file + ">>endfile");
+ file = setProtocolState(_file);
+
+ format = new jalview.io.IdentifyFile().Identify(file, protocol);
+ dbgMsg("File identified as '" + format + "'");
+ dbgMsg("Loading started.");
+ Alignment al = null;
+ try
+ {
+ al = new AppletFormatAdapter().readFile(file, protocol, format);
+ } catch (java.io.IOException ex)
+ {
+ dbgMsg("File load exception.");
+ ex.printStackTrace();
+ if (debug)
+ {
+ try
+ {
+ FileParse fp = new FileParse(file, protocol);
+ String ln = null;
+ dbgMsg(">>>Dumping contents of '" + file + "' " + "("
+ + protocol + ")");
+ while ((ln = fp.nextLine()) != null)
+ {
+ dbgMsg(ln);
+ }
+ dbgMsg(">>>Dump finished.");
+ } catch (Exception e)
+ {
+ System.err
+ .println("Exception when trying to dump the content of the file parameter.");
+ e.printStackTrace();
+ }
+ }
+ }
+ if ((al != null) && (al.getHeight() > 0))
+ {
+ dbgMsg("Successfully loaded file.");
+ newAlignFrame = new AlignFrame(al, applet, file, embedded);
+ if (initialAlignFrame == null)
+ {
+ initialAlignFrame = newAlignFrame;
+ }
+ // update the focus.
+ currentAlignFrame = newAlignFrame;
+
+ if (protocol == jalview.io.AppletFormatAdapter.PASTE)
+ {
+ newAlignFrame.setTitle("Sequences from "
+ + applet.getDocumentBase());
+ }
+
+ newAlignFrame.statusBar.setText("Successfully loaded file " + file);
+
+ String treeFile = applet.getParameter("tree");
+ if (treeFile == null)
+ {
+ treeFile = applet.getParameter("treeFile");
+ }
+
+ if (treeFile != null)
+ {
+ try
+ {
+ treeFile = setProtocolState(treeFile);
+ /*
+ * if (inArchive(treeFile)) { protocol =
+ * AppletFormatAdapter.CLASSLOADER; } else { protocol =
+ * AppletFormatAdapter.URL; treeFile = addProtocol(treeFile); }
+ */
+ jalview.io.NewickFile fin = new jalview.io.NewickFile(treeFile,
+ protocol);
+
+ fin.parse();
+
+ if (fin.getTree() != null)
+ {
+ newAlignFrame.loadTree(fin, treeFile);
+ dbgMsg("Successfuly imported tree.");
+ }
+ else
+ {
+ dbgMsg("Tree parameter did not resolve to a valid tree.");
+ }
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ /*
+ * Try to load T-Coffee score file
+ */
+ String sScoreFile = applet.getParameter("scoreFile");
+ if (sScoreFile != null && !"".equals(sScoreFile))
+ {
+ try
+ {
+ if (debug)
+ {
+ System.err
+ .println("Attempting to load T-COFFEE score file from the scoreFile parameter");
+ }
+ if (!newAlignFrame.loadScoreFile(sScoreFile))
+ {
+ System.err
+ .println("Failed to parse T-COFFEE parameter as a valid score file ('"
+ + sScoreFile + "')");
+ }
+ } catch (Exception e)
+ {
+ System.err.printf("Cannot read score file: '%s'. Cause: %s \n",
+ sScoreFile, e.getMessage());
+ }
+ }
+
+ // ///////////////////////////
+ // modify display of features
+ // we do this before any features have been loaded, ensuring any hidden
+ // groups are hidden when features first displayed
+ //
+ // hide specific groups
+ //
+ String param = applet.getParameter("hidefeaturegroups");
+ if (param != null)
+ {
+ newAlignFrame.setFeatureGroupState(separatorListToArray(param),
+ false);
+ // applet.setFeatureGroupStateOn(newAlignFrame, param, false);
+ }
+ // show specific groups
+ param = applet.getParameter("showfeaturegroups");
+ if (param != null)
+ {
+ newAlignFrame.setFeatureGroupState(separatorListToArray(param),
+ true);
+ // applet.setFeatureGroupStateOn(newAlignFrame, param, true);
+ }
+ // and now load features
+ param = applet.getParameter("features");
+ if (param != null)
+ {
+ param = setProtocolState(param);
+
+ newAlignFrame.parseFeaturesFile(param, protocol);
+ }
+
+ param = applet.getParameter("showFeatureSettings");
+ if (param != null && param.equalsIgnoreCase("true"))
+ {
+ newAlignFrame.viewport.showSequenceFeatures(true);
+ new FeatureSettings(newAlignFrame.alignPanel);
+ }
+
+ param = applet.getParameter("annotations");
+ if (param != null)
+ {
+ param = setProtocolState(param);
+
+ if (new AnnotationFile().readAnnotationFile(
+ newAlignFrame.viewport.getAlignment(), param, protocol))
+ {
+ newAlignFrame.alignPanel.fontChanged();
+ newAlignFrame.alignPanel.setScrollValues(0, 0);
+ }
+ else
+ {
+ System.err
+ .println("Annotations were not added from annotation file '"
+ + param + "'");
+ }
+
+ }
+
+ param = applet.getParameter("jnetfile");
+ if (param != null)
+ {
+ try
+ {
+ param = setProtocolState(param);
+ jalview.io.JPredFile predictions = new jalview.io.JPredFile(
+ param, protocol);
+ JnetAnnotationMaker.add_annotation(predictions,
+ newAlignFrame.viewport.getAlignment(), 0, false); // false==do
+ // not
+ // add
+ // sequence
+ // profile
+ // from
+ // concise
+ // output
+ newAlignFrame.alignPanel.fontChanged();
+ newAlignFrame.alignPanel.setScrollValues(0, 0);
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+ /*
+ * <param name="alignpdbfiles" value="false/true"/> Undocumented for 2.6
+ * - related to JAL-434
+ */
+ applet.setAlignPdbStructures(getDefaultParameter("alignpdbfiles",
+ false));
+ /*
+ * <param name="PDBfile" value="1gaq.txt PDB|1GAQ|1GAQ|A PDB|1GAQ|1GAQ|B
+ * PDB|1GAQ|1GAQ|C">
+ *
+ * <param name="PDBfile2" value="1gaq.txt A=SEQA B=SEQB C=SEQB">
+ *
+ * <param name="PDBfile3" value="1q0o Q45135_9MICO">
+ */
+
+ int pdbFileCount = 0;
+ // Accumulate pdbs here if they are heading for the same view (if
+ // alignPdbStructures is true)
+ Vector pdbs = new Vector();
+ // create a lazy matcher if we're asked to
+ jalview.analysis.SequenceIdMatcher matcher = (applet
+ .getDefaultParameter("relaxedidmatch", false)) ? new jalview.analysis.SequenceIdMatcher(
+ newAlignFrame.getAlignViewport().getAlignment()
+ .getSequencesArray()) : null;
+
+ do
+ {
+ if (pdbFileCount > 0)
+ {
+ param = applet.getParameter("PDBFILE" + pdbFileCount);
+ }
+ else
+ {
+ param = applet.getParameter("PDBFILE");
+ }
+
+ if (param != null)
+ {
+ PDBEntry pdb = new PDBEntry();
+
+ String seqstring;
+ SequenceI[] seqs = null;
+ String[] chains = null;
+
+ StringTokenizer st = new StringTokenizer(param, " ");
+
+ if (st.countTokens() < 2)
+ {
+ String sequence = applet.getParameter("PDBSEQ");
+ if (sequence != null)
+ seqs = new SequenceI[]
+ { matcher == null ? (Sequence) newAlignFrame
+ .getAlignViewport().getAlignment()
+ .findName(sequence) : matcher.findIdMatch(sequence) };
+
+ }
+ else
+ {
+ param = st.nextToken();
+ Vector tmp = new Vector();
+ Vector tmp2 = new Vector();
+
+ while (st.hasMoreTokens())
+ {
+ seqstring = st.nextToken();
+ StringTokenizer st2 = new StringTokenizer(seqstring, "=");
+ if (st2.countTokens() > 1)
+ {
+ // This is the chain
+ tmp2.addElement(st2.nextToken());
+ seqstring = st2.nextToken();
+ }
+ tmp.addElement(matcher == null ? (Sequence) newAlignFrame
+ .getAlignViewport().getAlignment()
+ .findName(seqstring) : matcher
+ .findIdMatch(seqstring));
+ }
+
+ seqs = new SequenceI[tmp.size()];
+ tmp.copyInto(seqs);
+ if (tmp2.size() == tmp.size())
+ {
+ chains = new String[tmp2.size()];
+ tmp2.copyInto(chains);
+ }
+ }
+ param = setProtocolState(param);
+
+ if (// !jmolAvailable
+ // &&
+ protocol == AppletFormatAdapter.CLASSLOADER
+ && !useXtrnalSviewer)
+ {
+ // Re: JAL-357 : the bug isn't a problem if we are using an
+ // external viewer!
+ // TODO: verify this Re:
+ // https://mantis.lifesci.dundee.ac.uk/view.php?id=36605
+ // This exception preserves the current behaviour where, even if
+ // the local pdb file was identified in the class loader
+ protocol = AppletFormatAdapter.URL; // this is probably NOT
+ // CORRECT!
+ param = addProtocol(param); //
+ }
+
+ pdb.setFile(param);
+
+ if (seqs != null)
+ {
+ for (int i = 0; i < seqs.length; i++)
+ {
+ if (seqs[i] != null)
+ {
+ ((Sequence) seqs[i]).addPDBId(pdb);
+ }
+ else
+ {
+ if (JalviewLite.debug)
+ {
+ // this may not really be a problem but we give a warning
+ // anyway
+ System.err
+ .println("Warning: Possible input parsing error: Null sequence for attachment of PDB (sequence "
+ + i + ")");
+ }
+ }
+ }
+
+ if (!alignPdbStructures)
+ {
+ newAlignFrame.newStructureView(applet, pdb, seqs, chains,
+ protocol);
+ }
+ else
+ {
+ pdbs.addElement(new Object[]
+ { pdb, seqs, chains, new String(protocol) });
+ }
+ }
+ }
+
+ pdbFileCount++;
+ } while (param != null || pdbFileCount < 10);
+ if (pdbs.size() > 0)
+ {
+ SequenceI[][] seqs = new SequenceI[pdbs.size()][];
+ PDBEntry[] pdb = new PDBEntry[pdbs.size()];
+ String[][] chains = new String[pdbs.size()][];
+ String[] protocols = new String[pdbs.size()];
+ for (int pdbsi = 0, pdbsiSize = pdbs.size(); pdbsi < pdbsiSize; pdbsi++)
+ {
+ Object[] o = (Object[]) pdbs.elementAt(pdbsi);
+ pdb[pdbsi] = (PDBEntry) o[0];
+ seqs[pdbsi] = (SequenceI[]) o[1];
+ chains[pdbsi] = (String[]) o[2];
+ protocols[pdbsi] = (String) o[3];
+ }
+ newAlignFrame.alignedStructureView(applet, pdb, seqs, chains,
+ protocols);
+
+ }
+ }
+ else
+ {
+ fileFound = false;
+ applet.remove(launcher);
+ applet.repaint();
+ }
+ callInitCallback();
+ }
+
+ /**
+ * Discovers whether the given file is in the Applet Archive
+ *
+ * @param file
+ * String
+ * @return boolean
+ */
+ boolean inArchive(String file)
+ {
+ // This might throw a security exception in certain browsers
+ // Netscape Communicator for instance.
+ try
+ {
+ boolean rtn = (getClass().getResourceAsStream("/" + file) != null);
+ if (debug)
+ {
+ System.err.println("Resource '" + file + "' was "
+ + (rtn ? "" : "not") + " located by classloader.");
+ }
+ return rtn;
+ } catch (Exception ex)
+ {
+ System.out.println("Exception checking resources: " + file + " "
+ + ex);
+ return false;
+ }
+ }
+
+ String addProtocol(String file)
+ {
+ if (file.indexOf("://") == -1)
+ {
+ String fl = applet.resolveUrlForLocalOrAbsolute(file,
+ getDocumentBase());
+ try
+ {
+ if (new java.net.URL(fl).openStream() != null)
+ {
+ if (debug)
+ {
+ System.err.println("Prepended document base for resource: '"
+ + file + "'");
+ }
+ return fl;
+ }
+ } catch (Exception x)
+ {
+ }
+ ;
+ fl = applet.resolveUrlForLocalOrAbsolute(file, getCodeBase());
+ try
+ {
+ if (new java.net.URL(fl).openStream() != null)
+ {
+ if (debug)
+ {
+ System.err.println("Prepended codebase for resource: '"
+ + file + "'");
+ }
+ return fl;
+ }
+ } catch (Exception x)
+ {
+ }
+ ;
+
+ }
+
+ return file;
+ }
+ }
+
+ /**
+ * @return the default alignFrame acted on by the public applet methods. May
+ * return null with an error message on System.err indicating the
+ * fact.
+ */
+ public AlignFrame getDefaultTargetFrame()
+ {
+ if (currentAlignFrame != null)
+ {
+ return currentAlignFrame;
+ }
+ if (initialAlignFrame != null)
+ {
+ return initialAlignFrame;
+ }
+ System.err
+ .println("Implementation error: Jalview Applet API cannot work out which AlignFrame to use.");
+ return null;
+ }
+
+ /**
+ * separator used for separatorList
+ */
+ protected String separator = "" + ((char) 0x00AC); // the default used to be
+ // '|' but many sequence
+ // IDS include pipes.
+
+ /**
+ * set to enable the URL based javascript execution mechanism
+ */
+ public boolean jsfallbackEnabled = false;
+
+ /**
+ * parse the string into a list
+ *
+ * @param list
+ * @return elements separated by separator
+ */
+ public String[] separatorListToArray(String list)
+ {
+ return separatorListToArray(list, separator);
+ }
+
+ /**
+ * parse the string into a list
+ *
+ * @param list
+ * @param separator
+ * @return elements separated by separator
+ */
+ public String[] separatorListToArray(String list, String separator)
+ {
+ // note separator local variable intentionally masks object field
+ int seplen = separator.length();
+ if (list == null || list.equals("") || list.equals(separator))
+ return null;
+ java.util.Vector jv = new Vector();
+ int cp = 0, pos;
+ while ((pos = list.indexOf(separator, cp)) > cp)
+ {
+ jv.addElement(list.substring(cp, pos));
+ cp = pos + seplen;
+ }
+ if (cp < list.length())
+ {
+ String c = list.substring(cp);
+ if (!c.equals(separator))
+ {
+ jv.addElement(c);
+ }
+ }
+ if (jv.size() > 0)
+ {
+ String[] v = new String[jv.size()];
+ for (int i = 0; i < v.length; i++)
+ {
+ v[i] = (String) jv.elementAt(i);
+ }
+ jv.removeAllElements();
+ if (debug)
+ {
+ System.err.println("Array from '" + separator
+ + "' separated List:\n" + v.length);
+ for (int i = 0; i < v.length; i++)
+ {
+ System.err.println("item " + i + " '" + v[i] + "'");
+ }
+ }
+ return v;
+ }
+ if (debug)
+ {
+ System.err.println("Empty Array from '" + separator
+ + "' separated List");
+ }
+ return null;
+ }
+
+ /**
+ * concatenate the list with separator
+ *
+ * @param list
+ * @return concatenated string
+ */
+ public String arrayToSeparatorList(String[] list)
+ {
+ return arrayToSeparatorList(list, separator);
+ }
+
+ /**
+ * concatenate the list with separator
+ *
+ * @param list
+ * @param separator
+ * @return concatenated string
+ */
+ public String arrayToSeparatorList(String[] list, String separator)
+ {
+ StringBuffer v = new StringBuffer();
+ if (list != null && list.length > 0)
+ {
+ for (int i = 0, iSize = list.length; i < iSize; i++)
+ {
+ if (list[i] != null)
+ {
+ if (i > 0)
+ {
+ v.append(separator);
+ }
+ v.append(list[i]);
+ }
+ }
+ if (debug)
+ {
+ System.err.println("Returning '" + separator
+ + "' separated List:\n");
+ System.err.println(v);
+ }
+ return v.toString();
+ }
+ if (debug)
+ {
+ System.err.println("Returning empty '" + separator
+ + "' separated List\n");
+ }
+ return "" + separator;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#getFeatureGroups()
+ */
+ public String getFeatureGroups()
+ {
+ String lst = arrayToSeparatorList(getDefaultTargetFrame()
+ .getFeatureGroups());
+ return lst;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.bin.JalviewLiteJsApi#getFeatureGroupsOn(jalview.appletgui.AlignFrame
+ * )
+ */
+ public String getFeatureGroupsOn(AlignFrame alf)
+ {
+ String lst = arrayToSeparatorList(alf.getFeatureGroups());
+ return lst;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#getFeatureGroupsOfState(boolean)
+ */
+ public String getFeatureGroupsOfState(boolean visible)
+ {
+ return arrayToSeparatorList(getDefaultTargetFrame()
+ .getFeatureGroupsOfState(visible));
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.bin.JalviewLiteJsApi#getFeatureGroupsOfStateOn(jalview.appletgui
+ * .AlignFrame, boolean)
+ */
+ public String getFeatureGroupsOfStateOn(AlignFrame alf, boolean visible)
+ {
+ return arrayToSeparatorList(alf.getFeatureGroupsOfState(visible));
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#setFeatureGroupStateOn(jalview.appletgui.
+ * AlignFrame, java.lang.String, boolean)
+ */
+ public void setFeatureGroupStateOn(final AlignFrame alf,
+ final String groups, boolean state)
+ {
+ final boolean st = state;// !(state==null || state.equals("") ||
+ // state.toLowerCase().equals("false"));
+ java.awt.EventQueue.invokeLater(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ alf.setFeatureGroupState(separatorListToArray(groups), st);
+ }
+ });
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#setFeatureGroupState(java.lang.String,
+ * boolean)
+ */
+ public void setFeatureGroupState(String groups, boolean state)
+ {
+ setFeatureGroupStateOn(getDefaultTargetFrame(), groups, state);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#getSeparator()
+ */
+ public String getSeparator()
+ {
+ return separator;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#setSeparator(java.lang.String)
+ */
+ public void setSeparator(String separator)
+ {
+ if (separator == null || separator.length() < 1)
+ {
+ // reset to default
+ separator = "" + ((char) 0x00AC);
+ }
+ this.separator = separator;
+ if (debug)
+ {
+ System.err.println("Default Separator now: '" + separator + "'");
+ }
+ }
+
+ /**
+ * get boolean value of applet parameter 'name' and return default if
+ * parameter is not set
+ *
+ * @param name
+ * name of paremeter
+ * @param def
+ * the value to return otherwise
+ * @return true or false
+ */
+ public boolean getDefaultParameter(String name, boolean def)
+ {
+ String stn;
+ if ((stn = getParameter(name)) == null)
+ {
+ return def;
+ }
+ if (stn.toLowerCase().equals("true"))
+ {
+ return true;
+ }
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#addPdbFile(jalview.appletgui.AlignFrame,
+ * java.lang.String, java.lang.String, java.lang.String)
+ */
+ public boolean addPdbFile(AlignFrame alFrame, String sequenceId,
+ String pdbEntryString, String pdbFile)
+ {
+ return alFrame.addPdbFile(sequenceId, pdbEntryString, pdbFile);
+ }
+
+ protected void setAlignPdbStructures(boolean alignPdbStructures)
+ {
+ this.alignPdbStructures = alignPdbStructures;
+ }
+
+ public boolean isAlignPdbStructures()
+ {
+ return alignPdbStructures;
+ }
+
+ public void start()
+ {
+ // callInitCallback();
+ }
+
+ private Hashtable<String, long[]> jshashes = new Hashtable<String, long[]>();
+
+ private Hashtable<String, Hashtable<String, String[]>> jsmessages = new Hashtable<String, Hashtable<String, String[]>>();
+
+ public void setJsMessageSet(String messageclass, String viewId,
+ String[] colcommands)
+ {
+ Hashtable<String, String[]> msgset = jsmessages.get(messageclass);
+ if (msgset == null)
+ {
+ msgset = new Hashtable<String, String[]>();
+ jsmessages.put(messageclass, msgset);
+ }
+ msgset.put(viewId, colcommands);
+ long[] l = new long[colcommands.length];
+ for (int i = 0; i < colcommands.length; i++)
+ {
+ l[i] = colcommands[i].hashCode();
+ }
+ jshashes.put(messageclass + "|" + viewId, l);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.bin.JalviewLiteJsApi#getJsMessage(java.lang.String,
+ * java.lang.String)
+ */
+ public String getJsMessage(String messageclass, String viewId)
+ {
+ Hashtable<String, String[]> msgset = jsmessages.get(messageclass);
+ if (msgset != null)
+ {
+ String[] msgs = msgset.get(viewId);
+ if (msgs != null)
+ {
+ for (int i = 0; i < msgs.length; i++)
+ {
+ if (msgs[i] != null)
+ {
+ String m = msgs[i];
+ msgs[i] = null;
+ return m;
+ }
+ }
+ }
+ }
+ return "";
+ }
+
+ public boolean isJsMessageSetChanged(String string, String string2,
+ String[] colcommands)
+ {
+ long[] l = jshashes.get(string + "|" + string2);
+ if (l == null && colcommands != null)
+ {
+ return true;
+ }
+ for (int i = 0; i < colcommands.length; i++)
+ {
+ if (l[i] != colcommands[i].hashCode())
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private Vector jsExecQueue = new Vector();
+
+ public Vector getJsExecQueue()
+ {
+ return jsExecQueue;
+ }
+
+ public void setExecutor(JSFunctionExec jsFunctionExec2)
+ {
+ jsFunctionExec = jsFunctionExec2;
+ }
+
+ /**
+ * return the given colour value parameter or the given default if parameter
+ * not given
+ *
+ * @param colparam
+ * @param defcolour
+ * @return
+ */
+ public Color getDefaultColourParameter(String colparam, Color defcolour)
+ {
+ String colprop = getParameter(colparam);
+ if (colprop == null || colprop.trim().length() == 0)
+ {
+ return defcolour;
+ }
+ Color col = jalview.schemes.ColourSchemeProperty
+ .getAWTColorFromName(colprop);
+ if (col == null)
+ {
+ try
+ {
+ col = new jalview.schemes.UserColourScheme(colprop).findColour('A');
+ } catch (Exception ex)
+ {
+ System.err.println("Couldn't parse '" + colprop
+ + "' as a colour for " + colparam);
+ col = null;
+ }
+ }
+ return (col == null) ? defcolour : col;
+
+ }
+
+ public void openJalviewHelpUrl()
+ {
+ String helpUrl = getParameter("jalviewhelpurl");
+ if (helpUrl == null || helpUrl.trim().length() < 5)
+ {
+ helpUrl = "http://www.jalview.org/help.html";
+ }
+ showURL(helpUrl, "HELP");
+ }
+
+ /**
+ * form a complete URL given a path to a resource and a reference location on
+ * the same server
+ *
+ * @param url
+ * - an absolute path on the same server as localref or a document
+ * located relative to localref
+ * @param localref
+ * - a URL on the same server as url
+ * @return a complete URL for the resource located by url
+ */
+ private String resolveUrlForLocalOrAbsolute(String url, URL localref)
+ {
+ String codebase = localref.toString();
+ if (url.indexOf("/") == 0)
+ {
+ url = codebase.substring(0, codebase.length()
+ - localref.getFile().length())
+ + url;
+ }
+ else
+ {
+ url = localref + url;
+ }
+ return url;
+ }
+
+ /**
+ * open a URL in the browser - resolving it according to relative refs and
+ * coping with javascript: protocol if necessary.
+ *
+ * @param url
+ * @param target
+ */
+ public void showURL(String url, String target)
+ {
+ try
+ {
+ if (url.indexOf(":") == -1)
+ {
+ // TODO: verify (Bas Vroling bug) prepend codebase or server URL to
+ // form valid URL
+ // Should really use docbase, not codebase.
+ URL prepend;
+ url = resolveUrlForLocalOrAbsolute(
+ url,
+ prepend = getDefaultParameter("resolvetocodebase", false) ? getDocumentBase()
+ : getCodeBase());
+ if (debug)
+ {
+ System.err
+ .println("Show url (prepended "
+ + prepend
+ + " - toggle resolvetocodebase if code/docbase resolution is wrong): "
+ + url);
+ }
+ }
+ else
+ {
+ if (debug)
+ {
+ System.err.println("Show url: " + url);
+ }
+ }
+ if (url.indexOf("javascript:") == 0)
+ {
+ // no target for the javascript context
+ getAppletContext().showDocument(new java.net.URL(url));
+ }
+ else
+ {
+ getAppletContext().showDocument(new java.net.URL(url), target);
+ }
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ /**
+ * bind structures in a viewer to any matching sequences in an alignFrame (use
+ * sequenceIds to limit scope of search to specific sequences)
+ *
+ * @param alFrame
+ * @param viewer
+ * @param sequenceIds
+ * @return TODO: consider making an exception structure for indicating when
+ * binding fails public SequenceStructureBinding
+ * addStructureViewInstance( AlignFrame alFrame, Object viewer, String
+ * sequenceIds) {
+ *
+ * if (sequenceIds != null && sequenceIds.length() > 0) { return
+ * alFrame.addStructureViewInstance(viewer,
+ * separatorListToArray(sequenceIds)); } else { return
+ * alFrame.addStructureViewInstance(viewer, null); } // return null; }
+ */
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.binding;
//---------------------------------/
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
package jalview.commands;
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.datamodel;\r
-\r
-import java.util.Enumeration;\r
-import java.util.Vector;\r
-\r
-import jalview.util.MapList;\r
-\r
-/**\r
- * Stores mapping between the columns of a protein alignment and a DNA alignment\r
- * and a list of individual codon to amino acid mappings between sequences.\r
- */\r
-\r
-public class AlignedCodonFrame\r
-{\r
- /**\r
- * array of nucleotide positions for aligned codons at column of aligned\r
- * proteins.\r
- */\r
- public int[][] codons = null;\r
-\r
- /**\r
- * width of protein sequence alignement implicit assertion that codons.length\r
- * >= aaWidth\r
- */\r
- public int aaWidth = 0;\r
-\r
- /**\r
- * initialise codon frame with a nominal alignment width\r
- * \r
- * @param aWidth\r
- */\r
- public AlignedCodonFrame(int aWidth)\r
- {\r
- if (aWidth <= 0)\r
- {\r
- codons = null;\r
- return;\r
- }\r
- codons = new int[aWidth][];\r
- for (int res = 0; res < aWidth; res++)\r
- codons[res] = null;\r
- }\r
-\r
- /**\r
- * ensure that codons array is at least as wide as aslen residues\r
- * \r
- * @param aslen\r
- * @return (possibly newly expanded) codon array\r
- */\r
- public int[][] checkCodonFrameWidth(int aslen)\r
- {\r
- if (codons.length <= aslen + 1)\r
- {\r
- // probably never have to do this ?\r
- int[][] c = new int[codons.length + 10][];\r
- for (int i = 0; i < codons.length; i++)\r
- {\r
- c[i] = codons[i];\r
- codons[i] = null;\r
- }\r
- codons = c;\r
- }\r
- return codons;\r
- }\r
-\r
- /**\r
- * @return width of aligned translated amino acid residues\r
- */\r
- public int getaaWidth()\r
- {\r
- return aaWidth;\r
- }\r
-\r
- /**\r
- * TODO: not an ideal solution - we reference the aligned amino acid sequences\r
- * in order to make insertions on them Better would be dnaAlignment and\r
- * aaAlignment reference....\r
- */\r
- Vector a_aaSeqs = new Vector();\r
-\r
- /**\r
- * increase aaWidth by one and insert a new aligned codon position space at\r
- * aspos.\r
- * \r
- * @param aspos\r
- */\r
- public void insertAAGap(int aspos, char gapCharacter)\r
- {\r
- // this aa appears before the aligned codons at aspos - so shift them in\r
- // each pair of mapped sequences\r
- aaWidth++;\r
- if (a_aaSeqs != null)\r
- {\r
- // we actually have to modify the aligned sequences here, so use the\r
- // a_aaSeqs vector\r
- Enumeration sq = a_aaSeqs.elements();\r
- while (sq.hasMoreElements())\r
- {\r
- ((SequenceI) sq.nextElement()).insertCharAt(aspos, gapCharacter);\r
- }\r
- }\r
- checkCodonFrameWidth(aspos);\r
- if (aspos < aaWidth)\r
- {\r
- aaWidth++;\r
- System.arraycopy(codons, aspos, codons, aspos + 1, aaWidth - aspos);\r
- codons[aspos] = null; // clear so new codon position can be marked.\r
- }\r
- }\r
-\r
- public void setAaWidth(int aapos)\r
- {\r
- aaWidth = aapos;\r
- }\r
-\r
- /**\r
- * tied array of na Sequence objects.\r
- */\r
- SequenceI[] dnaSeqs = null;\r
-\r
- /**\r
- * tied array of Mappings to protein sequence Objects and SequenceI[]\r
- * aaSeqs=null; MapLists where eac maps from the corresponding dnaSeqs element\r
- * to corresponding aaSeqs element\r
- */\r
- Mapping[] dnaToProt = null;\r
-\r
- /**\r
- * add a mapping between the dataset sequences for the associated dna and\r
- * protein sequence objects\r
- * \r
- * @param dnaseq\r
- * @param aaseq\r
- * @param map\r
- */\r
- public void addMap(SequenceI dnaseq, SequenceI aaseq, MapList map)\r
- {\r
- int nlen = 1;\r
- if (dnaSeqs != null)\r
- {\r
- nlen = dnaSeqs.length + 1;\r
- }\r
- SequenceI[] ndna = new SequenceI[nlen];\r
- Mapping[] ndtp = new Mapping[nlen];\r
- if (dnaSeqs != null)\r
- {\r
- System.arraycopy(dnaSeqs, 0, ndna, 0, dnaSeqs.length);\r
- System.arraycopy(dnaToProt, 0, ndtp, 0, dnaSeqs.length);\r
- }\r
- dnaSeqs = ndna;\r
- dnaToProt = ndtp;\r
- nlen--;\r
- dnaSeqs[nlen] = (dnaseq.getDatasetSequence() == null) ? dnaseq : dnaseq\r
- .getDatasetSequence();\r
- Mapping mp = new Mapping(map);\r
- // JBPNote DEBUG! THIS !\r
- // dnaseq.transferAnnotation(aaseq, mp);\r
- // aaseq.transferAnnotation(dnaseq, new Mapping(map.getInverse()));\r
- mp.to = (aaseq.getDatasetSequence() == null) ? aaseq : aaseq\r
- .getDatasetSequence();\r
- a_aaSeqs.addElement(aaseq);\r
- dnaToProt[nlen] = mp;\r
- }\r
-\r
- public SequenceI[] getdnaSeqs()\r
- {\r
- return dnaSeqs;\r
- }\r
-\r
- public SequenceI[] getAaSeqs()\r
- {\r
- if (dnaToProt == null)\r
- return null;\r
- SequenceI[] sqs = new SequenceI[dnaToProt.length];\r
- for (int sz = 0; sz < dnaToProt.length; sz++)\r
- {\r
- sqs[sz] = dnaToProt[sz].to;\r
- }\r
- return sqs;\r
- }\r
-\r
- public MapList[] getdnaToProt()\r
- {\r
- if (dnaToProt == null)\r
- return null;\r
- MapList[] sqs = new MapList[dnaToProt.length];\r
- for (int sz = 0; sz < dnaToProt.length; sz++)\r
- {\r
- sqs[sz] = dnaToProt[sz].map;\r
- }\r
- return sqs;\r
- }\r
-\r
- public Mapping[] getProtMappings()\r
- {\r
- return dnaToProt;\r
- }\r
-\r
- /**\r
- * \r
- * @param sequenceRef\r
- * @return null or corresponding aaSeq entry for dnaSeq entry\r
- */\r
- public SequenceI getAaForDnaSeq(SequenceI dnaSeqRef)\r
- {\r
- if (dnaSeqs == null)\r
- {\r
- return null;\r
- }\r
- SequenceI dnads = dnaSeqRef.getDatasetSequence();\r
- for (int ds = 0; ds < dnaSeqs.length; ds++)\r
- {\r
- if (dnaSeqs[ds] == dnaSeqRef || dnaSeqs[ds] == dnads)\r
- return dnaToProt[ds].to;\r
- }\r
- return null;\r
- }\r
-\r
- /**\r
- * \r
- * @param sequenceRef\r
- * @return null or corresponding aaSeq entry for dnaSeq entry\r
- */\r
- public SequenceI getDnaForAaSeq(SequenceI aaSeqRef)\r
- {\r
- if (dnaToProt == null)\r
- {\r
- return null;\r
- }\r
- SequenceI aads = aaSeqRef.getDatasetSequence();\r
- for (int as = 0; as < dnaToProt.length; as++)\r
- {\r
- if (dnaToProt[as].to == aaSeqRef || dnaToProt[as].to == aads)\r
- return dnaSeqs[as];\r
- }\r
- return null;\r
- }\r
-\r
- /**\r
- * test to see if codon frame involves seq in any way\r
- * \r
- * @param seq\r
- * a nucleotide or protein sequence\r
- * @return true if a mapping exists to or from this sequence to any translated\r
- * sequence\r
- */\r
- public boolean involvesSequence(SequenceI seq)\r
- {\r
- return getAaForDnaSeq(seq) != null || getDnaForAaSeq(seq) != null;\r
- }\r
-\r
- /**\r
- * Add search results for regions in other sequences that translate or are\r
- * translated from a particular position in seq\r
- * \r
- * @param seq\r
- * @param index\r
- * position in seq\r
- * @param results\r
- * where highlighted regions go\r
- */\r
- public void markMappedRegion(SequenceI seq, int index,\r
- SearchResults results)\r
- {\r
- if (dnaToProt == null)\r
- {\r
- return;\r
- }\r
- int[] codon;\r
- SequenceI ds = seq.getDatasetSequence();\r
- for (int mi = 0; mi < dnaToProt.length; mi++)\r
- {\r
- if (dnaSeqs[mi] == seq || dnaSeqs[mi] == ds)\r
- {\r
- // DEBUG System.err.println("dna pos "+index);\r
- codon = dnaToProt[mi].map.locateInTo(index, index);\r
- if (codon != null)\r
- {\r
- for (int i = 0; i < codon.length; i += 2)\r
- {\r
- results.addResult(dnaToProt[mi].to, codon[i], codon[i + 1]);\r
- }\r
- }\r
- }\r
- else if (dnaToProt[mi].to == seq || dnaToProt[mi].to == ds)\r
- {\r
- // DEBUG System.err.println("aa pos "+index);\r
- {\r
- codon = dnaToProt[mi].map.locateInFrom(index, index);\r
- if (codon != null)\r
- {\r
- for (int i = 0; i < codon.length; i += 2)\r
- {\r
- results.addResult(dnaSeqs[mi], codon[i], codon[i + 1]);\r
- }\r
- }\r
- }\r
- }\r
- }\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.datamodel;
+
+import java.util.Enumeration;
+import java.util.Vector;
+
+import jalview.util.MapList;
+
+/**
+ * Stores mapping between the columns of a protein alignment and a DNA alignment
+ * and a list of individual codon to amino acid mappings between sequences.
+ */
+
+public class AlignedCodonFrame
+{
+ /**
+ * array of nucleotide positions for aligned codons at column of aligned
+ * proteins.
+ */
+ public int[][] codons = null;
+
+ /**
+ * width of protein sequence alignement implicit assertion that codons.length
+ * >= aaWidth
+ */
+ public int aaWidth = 0;
+
+ /**
+ * initialise codon frame with a nominal alignment width
+ *
+ * @param aWidth
+ */
+ public AlignedCodonFrame(int aWidth)
+ {
+ if (aWidth <= 0)
+ {
+ codons = null;
+ return;
+ }
+ codons = new int[aWidth][];
+ for (int res = 0; res < aWidth; res++)
+ codons[res] = null;
+ }
+
+ /**
+ * ensure that codons array is at least as wide as aslen residues
+ *
+ * @param aslen
+ * @return (possibly newly expanded) codon array
+ */
+ public int[][] checkCodonFrameWidth(int aslen)
+ {
+ if (codons.length <= aslen + 1)
+ {
+ // probably never have to do this ?
+ int[][] c = new int[codons.length + 10][];
+ for (int i = 0; i < codons.length; i++)
+ {
+ c[i] = codons[i];
+ codons[i] = null;
+ }
+ codons = c;
+ }
+ return codons;
+ }
+
+ /**
+ * @return width of aligned translated amino acid residues
+ */
+ public int getaaWidth()
+ {
+ return aaWidth;
+ }
+
+ /**
+ * TODO: not an ideal solution - we reference the aligned amino acid sequences
+ * in order to make insertions on them Better would be dnaAlignment and
+ * aaAlignment reference....
+ */
+ Vector a_aaSeqs = new Vector();
+
+ /**
+ * increase aaWidth by one and insert a new aligned codon position space at
+ * aspos.
+ *
+ * @param aspos
+ */
+ public void insertAAGap(int aspos, char gapCharacter)
+ {
+ // this aa appears before the aligned codons at aspos - so shift them in
+ // each pair of mapped sequences
+ aaWidth++;
+ if (a_aaSeqs != null)
+ {
+ // we actually have to modify the aligned sequences here, so use the
+ // a_aaSeqs vector
+ Enumeration sq = a_aaSeqs.elements();
+ while (sq.hasMoreElements())
+ {
+ ((SequenceI) sq.nextElement()).insertCharAt(aspos, gapCharacter);
+ }
+ }
+ checkCodonFrameWidth(aspos);
+ if (aspos < aaWidth)
+ {
+ aaWidth++;
+ System.arraycopy(codons, aspos, codons, aspos + 1, aaWidth - aspos);
+ codons[aspos] = null; // clear so new codon position can be marked.
+ }
+ }
+
+ public void setAaWidth(int aapos)
+ {
+ aaWidth = aapos;
+ }
+
+ /**
+ * tied array of na Sequence objects.
+ */
+ SequenceI[] dnaSeqs = null;
+
+ /**
+ * tied array of Mappings to protein sequence Objects and SequenceI[]
+ * aaSeqs=null; MapLists where eac maps from the corresponding dnaSeqs element
+ * to corresponding aaSeqs element
+ */
+ Mapping[] dnaToProt = null;
+
+ /**
+ * add a mapping between the dataset sequences for the associated dna and
+ * protein sequence objects
+ *
+ * @param dnaseq
+ * @param aaseq
+ * @param map
+ */
+ public void addMap(SequenceI dnaseq, SequenceI aaseq, MapList map)
+ {
+ int nlen = 1;
+ if (dnaSeqs != null)
+ {
+ nlen = dnaSeqs.length + 1;
+ }
+ SequenceI[] ndna = new SequenceI[nlen];
+ Mapping[] ndtp = new Mapping[nlen];
+ if (dnaSeqs != null)
+ {
+ System.arraycopy(dnaSeqs, 0, ndna, 0, dnaSeqs.length);
+ System.arraycopy(dnaToProt, 0, ndtp, 0, dnaSeqs.length);
+ }
+ dnaSeqs = ndna;
+ dnaToProt = ndtp;
+ nlen--;
+ dnaSeqs[nlen] = (dnaseq.getDatasetSequence() == null) ? dnaseq : dnaseq
+ .getDatasetSequence();
+ Mapping mp = new Mapping(map);
+ // JBPNote DEBUG! THIS !
+ // dnaseq.transferAnnotation(aaseq, mp);
+ // aaseq.transferAnnotation(dnaseq, new Mapping(map.getInverse()));
+ mp.to = (aaseq.getDatasetSequence() == null) ? aaseq : aaseq
+ .getDatasetSequence();
+ a_aaSeqs.addElement(aaseq);
+ dnaToProt[nlen] = mp;
+ }
+
+ public SequenceI[] getdnaSeqs()
+ {
+ return dnaSeqs;
+ }
+
+ public SequenceI[] getAaSeqs()
+ {
+ if (dnaToProt == null)
+ return null;
+ SequenceI[] sqs = new SequenceI[dnaToProt.length];
+ for (int sz = 0; sz < dnaToProt.length; sz++)
+ {
+ sqs[sz] = dnaToProt[sz].to;
+ }
+ return sqs;
+ }
+
+ public MapList[] getdnaToProt()
+ {
+ if (dnaToProt == null)
+ return null;
+ MapList[] sqs = new MapList[dnaToProt.length];
+ for (int sz = 0; sz < dnaToProt.length; sz++)
+ {
+ sqs[sz] = dnaToProt[sz].map;
+ }
+ return sqs;
+ }
+
+ public Mapping[] getProtMappings()
+ {
+ return dnaToProt;
+ }
+
+ /**
+ *
+ * @param sequenceRef
+ * @return null or corresponding aaSeq entry for dnaSeq entry
+ */
+ public SequenceI getAaForDnaSeq(SequenceI dnaSeqRef)
+ {
+ if (dnaSeqs == null)
+ {
+ return null;
+ }
+ SequenceI dnads = dnaSeqRef.getDatasetSequence();
+ for (int ds = 0; ds < dnaSeqs.length; ds++)
+ {
+ if (dnaSeqs[ds] == dnaSeqRef || dnaSeqs[ds] == dnads)
+ return dnaToProt[ds].to;
+ }
+ return null;
+ }
+
+ /**
+ *
+ * @param sequenceRef
+ * @return null or corresponding aaSeq entry for dnaSeq entry
+ */
+ public SequenceI getDnaForAaSeq(SequenceI aaSeqRef)
+ {
+ if (dnaToProt == null)
+ {
+ return null;
+ }
+ SequenceI aads = aaSeqRef.getDatasetSequence();
+ for (int as = 0; as < dnaToProt.length; as++)
+ {
+ if (dnaToProt[as].to == aaSeqRef || dnaToProt[as].to == aads)
+ return dnaSeqs[as];
+ }
+ return null;
+ }
+
+ /**
+ * test to see if codon frame involves seq in any way
+ *
+ * @param seq
+ * a nucleotide or protein sequence
+ * @return true if a mapping exists to or from this sequence to any translated
+ * sequence
+ */
+ public boolean involvesSequence(SequenceI seq)
+ {
+ return getAaForDnaSeq(seq) != null || getDnaForAaSeq(seq) != null;
+ }
+
+ /**
+ * Add search results for regions in other sequences that translate or are
+ * translated from a particular position in seq
+ *
+ * @param seq
+ * @param index
+ * position in seq
+ * @param results
+ * where highlighted regions go
+ */
+ public void markMappedRegion(SequenceI seq, int index,
+ SearchResults results)
+ {
+ if (dnaToProt == null)
+ {
+ return;
+ }
+ int[] codon;
+ SequenceI ds = seq.getDatasetSequence();
+ for (int mi = 0; mi < dnaToProt.length; mi++)
+ {
+ if (dnaSeqs[mi] == seq || dnaSeqs[mi] == ds)
+ {
+ // DEBUG System.err.println("dna pos "+index);
+ codon = dnaToProt[mi].map.locateInTo(index, index);
+ if (codon != null)
+ {
+ for (int i = 0; i < codon.length; i += 2)
+ {
+ results.addResult(dnaToProt[mi].to, codon[i], codon[i + 1]);
+ }
+ }
+ }
+ else if (dnaToProt[mi].to == seq || dnaToProt[mi].to == ds)
+ {
+ // DEBUG System.err.println("aa pos "+index);
+ {
+ codon = dnaToProt[mi].map.locateInFrom(index, index);
+ if (codon != null)
+ {
+ for (int i = 0; i < codon.length; i += 2)
+ {
+ results.addResult(dnaSeqs[mi], codon[i], codon[i + 1]);
+ }
+ }
+ }
+ }
+ }
+ }
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
package jalview.datamodel;
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
package jalview.datamodel;
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.datamodel;\r
-\r
-import jalview.util.ShiftList;\r
-\r
-import java.io.PrintStream;\r
-import java.util.Enumeration;\r
-import java.util.List;\r
-import java.util.Vector;\r
-\r
-/**\r
- * Transient object compactly representing a 'view' of an alignment - with\r
- * discontinuities marked. Extended in Jalview 2.7 to optionally record sequence\r
- * groups and specific selected regions on the alignment.\r
- */\r
-public class AlignmentView\r
-{\r
- private SeqCigar[] sequences = null;\r
-\r
- private int[] contigs = null;\r
-\r
- private int width = 0;\r
-\r
- private int firstCol = 0;\r
-\r
- /**\r
- * one or more ScGroup objects, which are referenced by each seqCigar's group\r
- * membership\r
- */\r
- private Vector scGroups;\r
-\r
- /**\r
- * Group defined over SeqCigars. Unlike AlignmentI associated groups, each\r
- * SequenceGroup hold just the essential properties for the group, but no\r
- * references to the sequences involved. SeqCigars hold references to the\r
- * seuqenceGroup entities themselves.\r
- */\r
- private class ScGroup\r
- {\r
- public Vector seqs;\r
-\r
- public SequenceGroup sg;\r
-\r
- ScGroup()\r
- {\r
- seqs = new Vector();\r
- }\r
- }\r
-\r
- /**\r
- * vector of selected seqCigars. This vector is also referenced by each\r
- * seqCigar contained in it.\r
- */\r
- private Vector selected;\r
-\r
- /**\r
- * Construct an alignmentView from a live jalview alignment view. Note -\r
- * hidden rows will be excluded from alignmentView Note: JAL-1179\r
- * \r
- * @param alignment\r
- * - alignment as referenced by an AlignViewport\r
- * @param columnSelection\r
- * -\r
- * @param selection\r
- * @param hasHiddenColumns\r
- * - mark the hidden columns in columnSelection as hidden in the view\r
- * @param selectedRegionOnly\r
- * - when set, only include the selected region in the view,\r
- * otherwise just mark the selected region on the constructed view.\r
- * @param recordGroups\r
- * - when set, any groups on the given alignment will be marked on\r
- * the view\r
- */\r
- public AlignmentView(AlignmentI alignment,\r
- ColumnSelection columnSelection, SequenceGroup selection,\r
- boolean hasHiddenColumns, boolean selectedRegionOnly,\r
- boolean recordGroups)\r
- {\r
- // refactored from AlignViewport.getAlignmentView(selectedOnly);\r
- this(new jalview.datamodel.CigarArray(alignment,\r
- (hasHiddenColumns ? columnSelection : null),\r
- (selectedRegionOnly ? selection : null)),\r
- (selectedRegionOnly && selection != null) ? selection\r
- .getStartRes() : 0);\r
- // walk down SeqCigar array and Alignment Array - optionally restricted by\r
- // selected region.\r
- // test group membership for each sequence in each group, store membership\r
- // and record non-empty groups in group list.\r
- // record / sub-select selected region on the alignment view\r
- SequenceI[] selseqs;\r
- if (selection != null && selection.getSize() > 0)\r
- {\r
- List<SequenceI> sel = selection.getSequences(null);\r
- this.selected = new Vector();\r
- selseqs = selection\r
- .getSequencesInOrder(alignment, selectedRegionOnly);\r
- }\r
- else\r
- {\r
- selseqs = alignment.getSequencesArray();\r
- }\r
-\r
- // get the alignment's group list and make a copy\r
- Vector grps = new Vector();\r
- List<SequenceGroup> gg = alignment.getGroups();\r
- grps.addAll(gg);\r
- ScGroup[] sgrps = null;\r
- boolean addedgps[] = null;\r
- if (grps != null)\r
- {\r
- SequenceGroup sg;\r
- if (selection != null && selectedRegionOnly)\r
- {\r
- // trim annotation to the region being stored.\r
- // strip out any groups that do not actually intersect with the\r
- // visible and selected region\r
- int ssel = selection.getStartRes(), esel = selection.getEndRes();\r
- Vector isg = new Vector();\r
- Enumeration en = grps.elements();\r
- while (en.hasMoreElements())\r
- {\r
- sg = (SequenceGroup) en.nextElement();\r
-\r
- if (!(sg.getStartRes() > esel || sg.getEndRes() < ssel))\r
- {\r
- // adjust bounds of new group, if necessary.\r
- if (sg.getStartRes() < ssel)\r
- {\r
- sg.setStartRes(ssel);\r
- }\r
- if (sg.getEndRes() > esel)\r
- {\r
- sg.setEndRes(esel);\r
- }\r
- sg.setStartRes(sg.getStartRes() - ssel + 1);\r
- sg.setEndRes(sg.getEndRes() - ssel + 1);\r
-\r
- isg.addElement(sg);\r
- }\r
- }\r
- grps = isg;\r
- }\r
-\r
- sgrps = new ScGroup[grps.size()];\r
- addedgps = new boolean[grps.size()];\r
- for (int g = 0; g < sgrps.length; g++)\r
- {\r
- sg = (SequenceGroup) grps.elementAt(g);\r
- sgrps[g] = new ScGroup();\r
- sgrps[g].sg = new SequenceGroup(sg);\r
- addedgps[g] = false;\r
- grps.setElementAt(sg.getSequences(null), g);\r
- }\r
- // grps now contains vectors (should be sets) for each group, so we can\r
- // track when we've done with the group\r
- }\r
- int csi = 0;\r
- for (int i = 0; i < selseqs.length; i++)\r
- {\r
- if (selseqs[i] != null)\r
- {\r
- if (selection != null && selection.getSize() > 0\r
- && !selectedRegionOnly)\r
- {\r
- sequences[csi].setGroupMembership(selected);\r
- selected.addElement(sequences[csi]);\r
- }\r
- if (grps != null)\r
- {\r
- for (int sg = 0; sg < sgrps.length; sg++)\r
- {\r
- if (((Vector) grps.elementAt(sg)).contains(selseqs[i]))\r
- {\r
- sequences[csi].setGroupMembership(sgrps[sg]);\r
- sgrps[sg].sg.deleteSequence(selseqs[i], false);\r
- sgrps[sg].seqs.addElement(sequences[csi]);\r
- if (!addedgps[sg])\r
- {\r
- if (scGroups == null)\r
- {\r
- scGroups = new Vector();\r
- }\r
- addedgps[sg] = true;\r
- scGroups.addElement(sgrps[sg]);\r
- }\r
- }\r
- }\r
- }\r
- csi++;\r
- }\r
- }\r
- // finally, delete the remaining sequences (if any) not selected\r
- for (int sg = 0; sg < sgrps.length; sg++)\r
- {\r
- SequenceI[] sqs = sgrps[sg].sg.getSequencesAsArray(null);\r
- for (int si = 0; si < sqs.length; si++)\r
- {\r
- sgrps[sg].sg.deleteSequence(sqs[si], false);\r
- }\r
- sgrps[sg] = null;\r
- }\r
- }\r
-\r
- /**\r
- * construct an alignmentView from a SeqCigarArray. Errors are thrown if the\r
- * seqcigararray.isSeqCigarArray() flag is not set.\r
- */\r
- public AlignmentView(CigarArray seqcigararray)\r
- {\r
- if (!seqcigararray.isSeqCigarArray())\r
- {\r
- throw new Error(\r
- "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\r
- * 'firstcol' column of some reference alignment\r
- * \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\r
- * regions\r
- * \r
- * @param gapCharacter\r
- * 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
- * return the visible alignment corresponding to this view. Sequences in this\r
- * alignment are edited versions of the parent sequences - where hidden\r
- * regions have been removed. NOTE: the sequence data in this alignment is not\r
- * complete!\r
- * \r
- * @param c\r
- * @return\r
- */\r
- public AlignmentI getVisibleAlignment(char c)\r
- {\r
- SequenceI[] aln = getVisibleSeqs(c);\r
-\r
- AlignmentI vcal = new Alignment(aln);\r
- addPrunedGroupsInOrder(vcal, -1, -1, true);\r
- return vcal;\r
- }\r
-\r
- /**\r
- * add groups from view to the given alignment\r
- * \r
- * @param vcal\r
- * @param gstart\r
- * -1 or 0 to width-1\r
- * @param gend\r
- * -1 or gstart to width-1\r
- * @param viscontigs\r
- * - true if vcal is alignment of the visible regions of the view\r
- * (e.g. as returned from getVisibleAlignment)\r
- */\r
- private void addPrunedGroupsInOrder(AlignmentI vcal, int gstart,\r
- int gend, boolean viscontigs)\r
- {\r
- boolean r = false;\r
- if (gstart > -1 && gstart <= gend)\r
- {\r
- r = true;\r
- }\r
-\r
- SequenceI[] aln = vcal.getSequencesArray();\r
- {\r
- /**\r
- * prune any groups to the visible coordinates of the alignment.\r
- */\r
- {\r
- int nvg = (scGroups != null) ? scGroups.size() : 0;\r
- if (nvg > 0)\r
- {\r
- SequenceGroup[] nsg = new SequenceGroup[nvg];\r
- for (int g = 0; g < nvg; g++)\r
- {\r
- SequenceGroup sg = ((ScGroup) scGroups.elementAt(g)).sg;\r
- if (r)\r
- {\r
- if (sg.getStartRes() > gend || sg.getEndRes() < gstart)\r
- {\r
- // Skip this group\r
- nsg[g] = null;\r
- continue;\r
- }\r
- }\r
-\r
- // clone group properties\r
- nsg[g] = new SequenceGroup(sg);\r
-\r
- // may need to shift/trim start and end ?\r
- if (r && !viscontigs)\r
- {\r
- // Not fully tested code - routine not yet called with\r
- // viscontigs==false\r
- if (nsg[g].getStartRes() < gstart)\r
- {\r
- nsg[g].setStartRes(0);\r
- }\r
- else\r
- {\r
- nsg[g].setStartRes(nsg[g].getStartRes() - gstart);\r
- nsg[g].setEndRes(nsg[g].getEndRes() - gstart);\r
- }\r
- if (nsg[g].getEndRes() > (gend - gstart))\r
- {\r
- nsg[g].setEndRes(gend - gstart);\r
- }\r
- }\r
- }\r
- if (viscontigs)\r
- {\r
- // prune groups to cover just the visible positions between\r
- // gstart/gend.\r
- if (contigs != null)\r
- {\r
- int p = 0;\r
- ShiftList prune = new ShiftList();\r
- if (r)\r
- {\r
- // adjust for start of alignment within visible window.\r
- prune.addShift(gstart, -gstart); //\r
- }\r
- for (int h = 0; h < contigs.length; h += 3)\r
- {\r
- {\r
- prune.addShift(p + contigs[h + 1], contigs[h + 2]\r
- - contigs[h + 1]);\r
- }\r
- p = contigs[h + 1] + contigs[h + 2];\r
- }\r
- for (int g = 0; g < nsg.length; g++)\r
- {\r
- if (nsg[g] != null)\r
- {\r
- int s = nsg[g].getStartRes(), t = nsg[g].getEndRes();\r
- int w = 1 + t - s;\r
- if (r)\r
- {\r
- if (s < gstart)\r
- {\r
- s = gstart;\r
- }\r
- if (t > gend)\r
- {\r
- t = gend;\r
- }\r
- }\r
- s = prune.shift(s);\r
- t = prune.shift(t);\r
- nsg[g].setStartRes(s);\r
- nsg[g].setEndRes(t);\r
- }\r
- }\r
- }\r
- }\r
-\r
- for (int nsq = 0; nsq < aln.length; nsq++)\r
- {\r
- for (int g = 0; g < nvg; g++)\r
- {\r
- if (nsg[g] != null\r
- && sequences[nsq].isMemberOf(scGroups.elementAt(g)))\r
- {\r
- nsg[g].addSequence(aln[nsq], false);\r
- }\r
- }\r
- }\r
- for (int g = 0; g < nvg; g++)\r
- {\r
- if (nsg[g] != null && nsg[g].getSize() > 0)\r
- {\r
- vcal.addGroup(nsg[g]);\r
- }\r
- nsg[g] = null;\r
- }\r
- }\r
- }\r
- }\r
- }\r
-\r
- /**\r
- * generate sequence array corresponding to the visible parts of the\r
- * alignment.\r
- * \r
- * @param c\r
- * @return\r
- */\r
- private SequenceI[] getVisibleSeqs(char c)\r
- {\r
- SequenceI[] aln = new SequenceI[sequences.length];\r
- for (int i = 0, j = sequences.length; i < j; i++)\r
- {\r
- aln[i] = sequences[i].getSeq('-');\r
- }\r
- // Remove hidden regions from sequence objects.\r
- String seqs[] = getSequenceStrings('-');\r
- for (int i = 0, j = aln.length; i < j; i++)\r
- {\r
- aln[i].setSequence(seqs[i]);\r
- }\r
- return aln;\r
- }\r
-\r
- /**\r
- * creates new alignment objects for all contiguous visible segments\r
- * \r
- * @param c\r
- * @param start\r
- * @param end\r
- * @param regionOfInterest\r
- * specify which sequences to include (or null to include all\r
- * sequences)\r
- * @return AlignmentI[] - all alignments where each sequence is a subsequence\r
- * constructed from visible contig regions of view\r
- */\r
- public AlignmentI[] getVisibleContigAlignments(char c)\r
- {\r
- int nvc = 0;\r
- int[] vcontigs = getVisibleContigs();\r
- SequenceI[][] contigviews = getVisibleContigs(c);\r
- AlignmentI[] vcals = new AlignmentI[contigviews.length];\r
- for (nvc = 0; nvc < contigviews.length; nvc++)\r
- {\r
- vcals[nvc] = new Alignment(contigviews[nvc]);\r
- if (scGroups != null && scGroups.size() > 0)\r
- {\r
- addPrunedGroupsInOrder(vcals[nvc], vcontigs[nvc * 2],\r
- vcontigs[nvc * 2 + 1], true);\r
- }\r
- }\r
- return vcals;\r
- }\r
-\r
- /**\r
- * get an array of visible sequence strings for a view on an alignment using\r
- * the given gap character\r
- * \r
- * @param c\r
- * 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
- * \r
- * @param gapCharacter\r
- * 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\r
- // (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(\r
- start, 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\r
- * sub alignments\r
- * \r
- * @param nvismsa\r
- * SequenceI[][]\r
- * @param orders\r
- * AlignmentOrder[] corresponding to each SequenceI[] block.\r
- * @return Object[]\r
- */\r
- public Object[] getUpdatedView(SequenceI[][] nvismsa,\r
- AlignmentOrder[] orders, 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 "\r
- + j + " (" + mseq.length\r
- + ") and the original view ("\r
- + sequences.length + ")");\r
- }\r
- swidth = mseq[0].getLength(); // JBPNote: could ensure padded\r
- // 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]\r
- .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, 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]\r
- .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)\r
- .getSubSequence(contigs[contig + 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]\r
- - 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, 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]\r
- .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
- { alignment, columnselection };\r
- }\r
- else\r
- {\r
- if (nvismsa.length != 1)\r
- {\r
- throw new Error(\r
- "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
- { 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\r
- * SequenceI.getSubSequence(vis_start, vis_end+1) to recover visible sequence\r
- * from underlying alignment.\r
- * \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\r
- // (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
- { 0, width };\r
- }\r
- }\r
-\r
- /**\r
- * \r
- * @return position of first visible column of AlignmentView within its\r
- * parent's alignment reference frame\r
- */\r
- public int getAlignmentOrigin()\r
- {\r
- return firstCol;\r
- }\r
-\r
- /**\r
- * compute a deletion map for the current view according to the given\r
- * gap/match map\r
- * \r
- * @param gapMap\r
- * (as returned from SequenceI.gapMap())\r
- * @return int[] {intersection of visible regions with gapMap)\r
- */\r
- public int[] getVisibleContigMapFor(int[] gapMap)\r
- {\r
- int[] delMap = null;\r
- int[] viscontigs = getVisibleContigs();\r
- int spos = 0;\r
- int i = 0;\r
- if (viscontigs != null)\r
- {\r
- // viscontigs maps from a subset of the gapMap to the gapMap, so it will\r
- // always be equal to or shorter than gapMap\r
- delMap = new int[gapMap.length];\r
- for (int contig = 0; contig < viscontigs.length; contig += 2)\r
- {\r
-\r
- while (spos < gapMap.length && gapMap[spos] < viscontigs[contig])\r
- {\r
- spos++;\r
- }\r
- while (spos < gapMap.length\r
- && gapMap[spos] <= viscontigs[contig + 1])\r
- {\r
- delMap[i++] = spos++;\r
- }\r
- }\r
- int tmap[] = new int[i];\r
- System.arraycopy(delMap, 0, tmap, 0, i);\r
- delMap = tmap;\r
- }\r
- return delMap;\r
- }\r
-\r
- /**\r
- * apply the getSeq(gc) method to each sequence cigar, and return the array of\r
- * edited sequences, optionally with hidden regions removed.\r
- * \r
- * @param gc\r
- * gap character to use for insertions\r
- * @param delete\r
- * remove hidden regions from sequences. Note: currently implemented\r
- * in a memory inefficient way - space needed is 2*result set for\r
- * deletion\r
- * \r
- * @return SequenceI[]\r
- */\r
- public SequenceI[] getEditedSequences(char gc, boolean delete)\r
- {\r
- SeqCigar[] msf = getSequences();\r
- SequenceI[] aln = new SequenceI[msf.length];\r
- for (int i = 0, j = msf.length; i < j; i++)\r
- {\r
- aln[i] = msf[i].getSeq(gc);\r
- }\r
- if (delete)\r
- {\r
- String[] sqs = getSequenceStrings(gc);\r
- for (int i = 0; i < sqs.length; i++)\r
- {\r
- aln[i].setSequence(sqs[i]);\r
- sqs[i] = null;\r
- }\r
- }\r
- return aln;\r
- }\r
-\r
- public static void summariseAlignmentView(AlignmentView view,\r
- PrintStream os)\r
- {\r
- os.print("View has " + view.sequences.length + " of which ");\r
- if (view.selected == null)\r
- {\r
- os.print("None");\r
- }\r
- else\r
- {\r
- os.print(" " + view.selected.size());\r
- }\r
- os.println(" are selected.");\r
- os.print("View is " + view.getWidth() + " columns wide");\r
- int viswid = 0;\r
- int[] contigs = view.getContigs();\r
- if (contigs != null)\r
- {\r
- viswid = view.width;\r
- for (int i = 0; i < contigs.length; i += 3)\r
- {\r
- viswid += contigs[i + 2];\r
- }\r
- os.println("with " + viswid + " visible columns spread over "\r
- + contigs.length / 3 + " regions.");\r
- }\r
- else\r
- {\r
- viswid = view.width;\r
- os.println(".");\r
- }\r
- if (view.scGroups != null)\r
- {\r
- os.println("There are " + view.scGroups.size()\r
- + " groups defined on the view.");\r
- for (int g = 0; g < view.scGroups.size(); g++)\r
- {\r
- ScGroup sgr = (ScGroup) view.scGroups.elementAt(g);\r
- os.println("Group " + g + ": Name = " + sgr.sg.getName()\r
- + " Contains " + sgr.seqs.size() + " Seqs.");\r
- os.println("This group runs from " + sgr.sg.getStartRes() + " to "\r
- + sgr.sg.getEndRes());\r
- for (int s = 0; s < sgr.seqs.size(); s++)\r
- {\r
- if (!((SeqCigar) sgr.seqs.elementAt(s)).isMemberOf(sgr))\r
- {\r
- os.println("** WARNING: sequence "\r
- + ((SeqCigar) sgr.seqs.elementAt(s)).toString()\r
- + " is not marked as member of group.");\r
- }\r
- }\r
- }\r
- AlignmentI visal = view.getVisibleAlignment('-');\r
- if (visal != null)\r
- {\r
- os.println("Vis. alignment is " + visal.getWidth()\r
- + " wide and has " + visal.getHeight() + " seqs.");\r
- if (visal.getGroups() != null && visal.getGroups().size() > 0)\r
- {\r
-\r
- int i = 1;\r
- for (SequenceGroup sg : visal.getGroups())\r
- {\r
- os.println("Group " + (i++) + " begins at column "\r
- + sg.getStartRes() + " and ends at " + sg.getEndRes());\r
- }\r
- }\r
- }\r
- }\r
- }\r
-\r
- public static void testSelectionViews(AlignmentI alignment,\r
- ColumnSelection csel, SequenceGroup selection)\r
- {\r
- System.out.println("Testing standard view creation:\n");\r
- AlignmentView view = null;\r
- try\r
- {\r
- System.out\r
- .println("View with no hidden columns, no limit to selection, no groups to be collected:");\r
- view = new AlignmentView(alignment, csel, selection, false, false,\r
- false);\r
- summariseAlignmentView(view, System.out);\r
-\r
- } catch (Exception e)\r
- {\r
- e.printStackTrace();\r
- System.err\r
- .println("Failed to generate alignment with selection but no groups marked.");\r
- }\r
- try\r
- {\r
- System.out\r
- .println("View with no hidden columns, no limit to selection, and all groups to be collected:");\r
- view = new AlignmentView(alignment, csel, selection, false, false,\r
- true);\r
- summariseAlignmentView(view, System.out);\r
- } catch (Exception e)\r
- {\r
- e.printStackTrace();\r
- System.err\r
- .println("Failed to generate alignment with selection marked but no groups marked.");\r
- }\r
- try\r
- {\r
- System.out\r
- .println("View with no hidden columns, limited to selection and no groups to be collected:");\r
- view = new AlignmentView(alignment, csel, selection, false, true,\r
- false);\r
- summariseAlignmentView(view, System.out);\r
- } catch (Exception e)\r
- {\r
- e.printStackTrace();\r
- System.err\r
- .println("Failed to generate alignment with selection restricted but no groups marked.");\r
- }\r
- try\r
- {\r
- System.out\r
- .println("View with no hidden columns, limited to selection, and all groups to be collected:");\r
- view = new AlignmentView(alignment, csel, selection, false, true,\r
- true);\r
- summariseAlignmentView(view, System.out);\r
- } catch (Exception e)\r
- {\r
- e.printStackTrace();\r
- System.err\r
- .println("Failed to generate alignment with selection restricted and groups marked.");\r
- }\r
- try\r
- {\r
- System.out\r
- .println("View *with* hidden columns, no limit to selection, no groups to be collected:");\r
- view = new AlignmentView(alignment, csel, selection, true, false,\r
- false);\r
- summariseAlignmentView(view, System.out);\r
- } catch (Exception e)\r
- {\r
- e.printStackTrace();\r
- System.err\r
- .println("Failed to generate alignment with selection but no groups marked.");\r
- }\r
- try\r
- {\r
- System.out\r
- .println("View *with* hidden columns, no limit to selection, and all groups to be collected:");\r
- view = new AlignmentView(alignment, csel, selection, true, false,\r
- true);\r
- summariseAlignmentView(view, System.out);\r
- } catch (Exception e)\r
- {\r
- e.printStackTrace();\r
- System.err\r
- .println("Failed to generate alignment with selection marked but no groups marked.");\r
- }\r
- try\r
- {\r
- System.out\r
- .println("View *with* hidden columns, limited to selection and no groups to be collected:");\r
- view = new AlignmentView(alignment, csel, selection, true, true,\r
- false);\r
- summariseAlignmentView(view, System.out);\r
- } catch (Exception e)\r
- {\r
- e.printStackTrace();\r
- System.err\r
- .println("Failed to generate alignment with selection restricted but no groups marked.");\r
- }\r
- try\r
- {\r
- System.out\r
- .println("View *with* hidden columns, limited to selection, and all groups to be collected:");\r
- view = new AlignmentView(alignment, csel, selection, true, true, true);\r
- summariseAlignmentView(view, System.out);\r
- } catch (Exception e)\r
- {\r
- e.printStackTrace();\r
- System.err\r
- .println("Failed to generate alignment with selection restricted and groups marked.");\r
- }\r
-\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.datamodel;
+
+import jalview.util.ShiftList;
+
+import java.io.PrintStream;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.Vector;
+
+/**
+ * Transient object compactly representing a 'view' of an alignment - with
+ * discontinuities marked. Extended in Jalview 2.7 to optionally record sequence
+ * groups and specific selected regions on the alignment.
+ */
+public class AlignmentView
+{
+ private SeqCigar[] sequences = null;
+
+ private int[] contigs = null;
+
+ private int width = 0;
+
+ private int firstCol = 0;
+
+ /**
+ * one or more ScGroup objects, which are referenced by each seqCigar's group
+ * membership
+ */
+ private Vector scGroups;
+
+ /**
+ * Group defined over SeqCigars. Unlike AlignmentI associated groups, each
+ * SequenceGroup hold just the essential properties for the group, but no
+ * references to the sequences involved. SeqCigars hold references to the
+ * seuqenceGroup entities themselves.
+ */
+ private class ScGroup
+ {
+ public Vector seqs;
+
+ public SequenceGroup sg;
+
+ ScGroup()
+ {
+ seqs = new Vector();
+ }
+ }
+
+ /**
+ * vector of selected seqCigars. This vector is also referenced by each
+ * seqCigar contained in it.
+ */
+ private Vector selected;
+
+ /**
+ * Construct an alignmentView from a live jalview alignment view. Note -
+ * hidden rows will be excluded from alignmentView Note: JAL-1179
+ *
+ * @param alignment
+ * - alignment as referenced by an AlignViewport
+ * @param columnSelection
+ * -
+ * @param selection
+ * @param hasHiddenColumns
+ * - mark the hidden columns in columnSelection as hidden in the view
+ * @param selectedRegionOnly
+ * - when set, only include the selected region in the view,
+ * otherwise just mark the selected region on the constructed view.
+ * @param recordGroups
+ * - when set, any groups on the given alignment will be marked on
+ * the view
+ */
+ public AlignmentView(AlignmentI alignment,
+ ColumnSelection columnSelection, SequenceGroup selection,
+ boolean hasHiddenColumns, boolean selectedRegionOnly,
+ boolean recordGroups)
+ {
+ // refactored from AlignViewport.getAlignmentView(selectedOnly);
+ this(new jalview.datamodel.CigarArray(alignment,
+ (hasHiddenColumns ? columnSelection : null),
+ (selectedRegionOnly ? selection : null)),
+ (selectedRegionOnly && selection != null) ? selection
+ .getStartRes() : 0);
+ // walk down SeqCigar array and Alignment Array - optionally restricted by
+ // selected region.
+ // test group membership for each sequence in each group, store membership
+ // and record non-empty groups in group list.
+ // record / sub-select selected region on the alignment view
+ SequenceI[] selseqs;
+ if (selection != null && selection.getSize() > 0)
+ {
+ List<SequenceI> sel = selection.getSequences(null);
+ this.selected = new Vector();
+ selseqs = selection
+ .getSequencesInOrder(alignment, selectedRegionOnly);
+ }
+ else
+ {
+ selseqs = alignment.getSequencesArray();
+ }
+
+ // get the alignment's group list and make a copy
+ Vector grps = new Vector();
+ List<SequenceGroup> gg = alignment.getGroups();
+ grps.addAll(gg);
+ ScGroup[] sgrps = null;
+ boolean addedgps[] = null;
+ if (grps != null)
+ {
+ SequenceGroup sg;
+ if (selection != null && selectedRegionOnly)
+ {
+ // trim annotation to the region being stored.
+ // strip out any groups that do not actually intersect with the
+ // visible and selected region
+ int ssel = selection.getStartRes(), esel = selection.getEndRes();
+ Vector isg = new Vector();
+ Enumeration en = grps.elements();
+ while (en.hasMoreElements())
+ {
+ sg = (SequenceGroup) en.nextElement();
+
+ if (!(sg.getStartRes() > esel || sg.getEndRes() < ssel))
+ {
+ // adjust bounds of new group, if necessary.
+ if (sg.getStartRes() < ssel)
+ {
+ sg.setStartRes(ssel);
+ }
+ if (sg.getEndRes() > esel)
+ {
+ sg.setEndRes(esel);
+ }
+ sg.setStartRes(sg.getStartRes() - ssel + 1);
+ sg.setEndRes(sg.getEndRes() - ssel + 1);
+
+ isg.addElement(sg);
+ }
+ }
+ grps = isg;
+ }
+
+ sgrps = new ScGroup[grps.size()];
+ addedgps = new boolean[grps.size()];
+ for (int g = 0; g < sgrps.length; g++)
+ {
+ sg = (SequenceGroup) grps.elementAt(g);
+ sgrps[g] = new ScGroup();
+ sgrps[g].sg = new SequenceGroup(sg);
+ addedgps[g] = false;
+ grps.setElementAt(sg.getSequences(null), g);
+ }
+ // grps now contains vectors (should be sets) for each group, so we can
+ // track when we've done with the group
+ }
+ int csi = 0;
+ for (int i = 0; i < selseqs.length; i++)
+ {
+ if (selseqs[i] != null)
+ {
+ if (selection != null && selection.getSize() > 0
+ && !selectedRegionOnly)
+ {
+ sequences[csi].setGroupMembership(selected);
+ selected.addElement(sequences[csi]);
+ }
+ if (grps != null)
+ {
+ for (int sg = 0; sg < sgrps.length; sg++)
+ {
+ if (((Vector) grps.elementAt(sg)).contains(selseqs[i]))
+ {
+ sequences[csi].setGroupMembership(sgrps[sg]);
+ sgrps[sg].sg.deleteSequence(selseqs[i], false);
+ sgrps[sg].seqs.addElement(sequences[csi]);
+ if (!addedgps[sg])
+ {
+ if (scGroups == null)
+ {
+ scGroups = new Vector();
+ }
+ addedgps[sg] = true;
+ scGroups.addElement(sgrps[sg]);
+ }
+ }
+ }
+ }
+ csi++;
+ }
+ }
+ // finally, delete the remaining sequences (if any) not selected
+ for (int sg = 0; sg < sgrps.length; sg++)
+ {
+ SequenceI[] sqs = sgrps[sg].sg.getSequencesAsArray(null);
+ for (int si = 0; si < sqs.length; si++)
+ {
+ sgrps[sg].sg.deleteSequence(sqs[si], false);
+ }
+ sgrps[sg] = null;
+ }
+ }
+
+ /**
+ * construct an alignmentView from a SeqCigarArray. Errors are thrown if the
+ * seqcigararray.isSeqCigarArray() flag is not set.
+ */
+ 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 };
+ }
+
+ /**
+ * return the visible alignment corresponding to this view. Sequences in this
+ * alignment are edited versions of the parent sequences - where hidden
+ * regions have been removed. NOTE: the sequence data in this alignment is not
+ * complete!
+ *
+ * @param c
+ * @return
+ */
+ public AlignmentI getVisibleAlignment(char c)
+ {
+ SequenceI[] aln = getVisibleSeqs(c);
+
+ AlignmentI vcal = new Alignment(aln);
+ addPrunedGroupsInOrder(vcal, -1, -1, true);
+ return vcal;
+ }
+
+ /**
+ * add groups from view to the given alignment
+ *
+ * @param vcal
+ * @param gstart
+ * -1 or 0 to width-1
+ * @param gend
+ * -1 or gstart to width-1
+ * @param viscontigs
+ * - true if vcal is alignment of the visible regions of the view
+ * (e.g. as returned from getVisibleAlignment)
+ */
+ private void addPrunedGroupsInOrder(AlignmentI vcal, int gstart,
+ int gend, boolean viscontigs)
+ {
+ boolean r = false;
+ if (gstart > -1 && gstart <= gend)
+ {
+ r = true;
+ }
+
+ SequenceI[] aln = vcal.getSequencesArray();
+ {
+ /**
+ * prune any groups to the visible coordinates of the alignment.
+ */
+ {
+ int nvg = (scGroups != null) ? scGroups.size() : 0;
+ if (nvg > 0)
+ {
+ SequenceGroup[] nsg = new SequenceGroup[nvg];
+ for (int g = 0; g < nvg; g++)
+ {
+ SequenceGroup sg = ((ScGroup) scGroups.elementAt(g)).sg;
+ if (r)
+ {
+ if (sg.getStartRes() > gend || sg.getEndRes() < gstart)
+ {
+ // Skip this group
+ nsg[g] = null;
+ continue;
+ }
+ }
+
+ // clone group properties
+ nsg[g] = new SequenceGroup(sg);
+
+ // may need to shift/trim start and end ?
+ if (r && !viscontigs)
+ {
+ // Not fully tested code - routine not yet called with
+ // viscontigs==false
+ if (nsg[g].getStartRes() < gstart)
+ {
+ nsg[g].setStartRes(0);
+ }
+ else
+ {
+ nsg[g].setStartRes(nsg[g].getStartRes() - gstart);
+ nsg[g].setEndRes(nsg[g].getEndRes() - gstart);
+ }
+ if (nsg[g].getEndRes() > (gend - gstart))
+ {
+ nsg[g].setEndRes(gend - gstart);
+ }
+ }
+ }
+ if (viscontigs)
+ {
+ // prune groups to cover just the visible positions between
+ // gstart/gend.
+ if (contigs != null)
+ {
+ int p = 0;
+ ShiftList prune = new ShiftList();
+ if (r)
+ {
+ // adjust for start of alignment within visible window.
+ prune.addShift(gstart, -gstart); //
+ }
+ for (int h = 0; h < contigs.length; h += 3)
+ {
+ {
+ prune.addShift(p + contigs[h + 1], contigs[h + 2]
+ - contigs[h + 1]);
+ }
+ p = contigs[h + 1] + contigs[h + 2];
+ }
+ for (int g = 0; g < nsg.length; g++)
+ {
+ if (nsg[g] != null)
+ {
+ int s = nsg[g].getStartRes(), t = nsg[g].getEndRes();
+ int w = 1 + t - s;
+ if (r)
+ {
+ if (s < gstart)
+ {
+ s = gstart;
+ }
+ if (t > gend)
+ {
+ t = gend;
+ }
+ }
+ s = prune.shift(s);
+ t = prune.shift(t);
+ nsg[g].setStartRes(s);
+ nsg[g].setEndRes(t);
+ }
+ }
+ }
+ }
+
+ for (int nsq = 0; nsq < aln.length; nsq++)
+ {
+ for (int g = 0; g < nvg; g++)
+ {
+ if (nsg[g] != null
+ && sequences[nsq].isMemberOf(scGroups.elementAt(g)))
+ {
+ nsg[g].addSequence(aln[nsq], false);
+ }
+ }
+ }
+ for (int g = 0; g < nvg; g++)
+ {
+ if (nsg[g] != null && nsg[g].getSize() > 0)
+ {
+ vcal.addGroup(nsg[g]);
+ }
+ nsg[g] = null;
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * generate sequence array corresponding to the visible parts of the
+ * alignment.
+ *
+ * @param c
+ * @return
+ */
+ private SequenceI[] getVisibleSeqs(char c)
+ {
+ SequenceI[] aln = new SequenceI[sequences.length];
+ for (int i = 0, j = sequences.length; i < j; i++)
+ {
+ aln[i] = sequences[i].getSeq('-');
+ }
+ // Remove hidden regions from sequence objects.
+ String seqs[] = getSequenceStrings('-');
+ for (int i = 0, j = aln.length; i < j; i++)
+ {
+ aln[i].setSequence(seqs[i]);
+ }
+ return aln;
+ }
+
+ /**
+ * creates new alignment objects for all contiguous visible segments
+ *
+ * @param c
+ * @param start
+ * @param end
+ * @param regionOfInterest
+ * specify which sequences to include (or null to include all
+ * sequences)
+ * @return AlignmentI[] - all alignments where each sequence is a subsequence
+ * constructed from visible contig regions of view
+ */
+ public AlignmentI[] getVisibleContigAlignments(char c)
+ {
+ int nvc = 0;
+ int[] vcontigs = getVisibleContigs();
+ SequenceI[][] contigviews = getVisibleContigs(c);
+ AlignmentI[] vcals = new AlignmentI[contigviews.length];
+ for (nvc = 0; nvc < contigviews.length; nvc++)
+ {
+ vcals[nvc] = new Alignment(contigviews[nvc]);
+ if (scGroups != null && scGroups.size() > 0)
+ {
+ addPrunedGroupsInOrder(vcals[nvc], vcontigs[nvc * 2],
+ vcontigs[nvc * 2 + 1], true);
+ }
+ }
+ return vcals;
+ }
+
+ /**
+ * get an array of visible sequence strings for a view on an alignment using
+ * the given gap character
+ *
+ * @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()
+ {
+ return firstCol;
+ }
+
+ /**
+ * compute a deletion map for the current view according to the given
+ * gap/match map
+ *
+ * @param gapMap
+ * (as returned from SequenceI.gapMap())
+ * @return int[] {intersection of visible regions with gapMap)
+ */
+ public int[] getVisibleContigMapFor(int[] gapMap)
+ {
+ int[] delMap = null;
+ int[] viscontigs = getVisibleContigs();
+ int spos = 0;
+ int i = 0;
+ if (viscontigs != null)
+ {
+ // viscontigs maps from a subset of the gapMap to the gapMap, so it will
+ // always be equal to or shorter than gapMap
+ delMap = new int[gapMap.length];
+ for (int contig = 0; contig < viscontigs.length; contig += 2)
+ {
+
+ while (spos < gapMap.length && gapMap[spos] < viscontigs[contig])
+ {
+ spos++;
+ }
+ while (spos < gapMap.length
+ && gapMap[spos] <= viscontigs[contig + 1])
+ {
+ delMap[i++] = spos++;
+ }
+ }
+ int tmap[] = new int[i];
+ System.arraycopy(delMap, 0, tmap, 0, i);
+ delMap = tmap;
+ }
+ return delMap;
+ }
+
+ /**
+ * apply the getSeq(gc) method to each sequence cigar, and return the array of
+ * edited sequences, optionally with hidden regions removed.
+ *
+ * @param gc
+ * gap character to use for insertions
+ * @param delete
+ * remove hidden regions from sequences. Note: currently implemented
+ * in a memory inefficient way - space needed is 2*result set for
+ * deletion
+ *
+ * @return SequenceI[]
+ */
+ public SequenceI[] getEditedSequences(char gc, boolean delete)
+ {
+ SeqCigar[] msf = getSequences();
+ SequenceI[] aln = new SequenceI[msf.length];
+ for (int i = 0, j = msf.length; i < j; i++)
+ {
+ aln[i] = msf[i].getSeq(gc);
+ }
+ if (delete)
+ {
+ String[] sqs = getSequenceStrings(gc);
+ for (int i = 0; i < sqs.length; i++)
+ {
+ aln[i].setSequence(sqs[i]);
+ sqs[i] = null;
+ }
+ }
+ return aln;
+ }
+
+ public static void summariseAlignmentView(AlignmentView view,
+ PrintStream os)
+ {
+ os.print("View has " + view.sequences.length + " of which ");
+ if (view.selected == null)
+ {
+ os.print("None");
+ }
+ else
+ {
+ os.print(" " + view.selected.size());
+ }
+ os.println(" are selected.");
+ os.print("View is " + view.getWidth() + " columns wide");
+ int viswid = 0;
+ int[] contigs = view.getContigs();
+ if (contigs != null)
+ {
+ viswid = view.width;
+ for (int i = 0; i < contigs.length; i += 3)
+ {
+ viswid += contigs[i + 2];
+ }
+ os.println("with " + viswid + " visible columns spread over "
+ + contigs.length / 3 + " regions.");
+ }
+ else
+ {
+ viswid = view.width;
+ os.println(".");
+ }
+ if (view.scGroups != null)
+ {
+ os.println("There are " + view.scGroups.size()
+ + " groups defined on the view.");
+ for (int g = 0; g < view.scGroups.size(); g++)
+ {
+ ScGroup sgr = (ScGroup) view.scGroups.elementAt(g);
+ os.println("Group " + g + ": Name = " + sgr.sg.getName()
+ + " Contains " + sgr.seqs.size() + " Seqs.");
+ os.println("This group runs from " + sgr.sg.getStartRes() + " to "
+ + sgr.sg.getEndRes());
+ for (int s = 0; s < sgr.seqs.size(); s++)
+ {
+ if (!((SeqCigar) sgr.seqs.elementAt(s)).isMemberOf(sgr))
+ {
+ os.println("** WARNING: sequence "
+ + ((SeqCigar) sgr.seqs.elementAt(s)).toString()
+ + " is not marked as member of group.");
+ }
+ }
+ }
+ AlignmentI visal = view.getVisibleAlignment('-');
+ if (visal != null)
+ {
+ os.println("Vis. alignment is " + visal.getWidth()
+ + " wide and has " + visal.getHeight() + " seqs.");
+ if (visal.getGroups() != null && visal.getGroups().size() > 0)
+ {
+
+ int i = 1;
+ for (SequenceGroup sg : visal.getGroups())
+ {
+ os.println("Group " + (i++) + " begins at column "
+ + sg.getStartRes() + " and ends at " + sg.getEndRes());
+ }
+ }
+ }
+ }
+ }
+
+ public static void testSelectionViews(AlignmentI alignment,
+ ColumnSelection csel, SequenceGroup selection)
+ {
+ System.out.println("Testing standard view creation:\n");
+ AlignmentView view = null;
+ try
+ {
+ System.out
+ .println("View with no hidden columns, no limit to selection, no groups to be collected:");
+ view = new AlignmentView(alignment, csel, selection, false, false,
+ false);
+ summariseAlignmentView(view, System.out);
+
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ System.err
+ .println("Failed to generate alignment with selection but no groups marked.");
+ }
+ try
+ {
+ System.out
+ .println("View with no hidden columns, no limit to selection, and all groups to be collected:");
+ view = new AlignmentView(alignment, csel, selection, false, false,
+ true);
+ summariseAlignmentView(view, System.out);
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ System.err
+ .println("Failed to generate alignment with selection marked but no groups marked.");
+ }
+ try
+ {
+ System.out
+ .println("View with no hidden columns, limited to selection and no groups to be collected:");
+ view = new AlignmentView(alignment, csel, selection, false, true,
+ false);
+ summariseAlignmentView(view, System.out);
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ System.err
+ .println("Failed to generate alignment with selection restricted but no groups marked.");
+ }
+ try
+ {
+ System.out
+ .println("View with no hidden columns, limited to selection, and all groups to be collected:");
+ view = new AlignmentView(alignment, csel, selection, false, true,
+ true);
+ summariseAlignmentView(view, System.out);
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ System.err
+ .println("Failed to generate alignment with selection restricted and groups marked.");
+ }
+ try
+ {
+ System.out
+ .println("View *with* hidden columns, no limit to selection, no groups to be collected:");
+ view = new AlignmentView(alignment, csel, selection, true, false,
+ false);
+ summariseAlignmentView(view, System.out);
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ System.err
+ .println("Failed to generate alignment with selection but no groups marked.");
+ }
+ try
+ {
+ System.out
+ .println("View *with* hidden columns, no limit to selection, and all groups to be collected:");
+ view = new AlignmentView(alignment, csel, selection, true, false,
+ true);
+ summariseAlignmentView(view, System.out);
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ System.err
+ .println("Failed to generate alignment with selection marked but no groups marked.");
+ }
+ try
+ {
+ System.out
+ .println("View *with* hidden columns, limited to selection and no groups to be collected:");
+ view = new AlignmentView(alignment, csel, selection, true, true,
+ false);
+ summariseAlignmentView(view, System.out);
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ System.err
+ .println("Failed to generate alignment with selection restricted but no groups marked.");
+ }
+ try
+ {
+ System.out
+ .println("View *with* hidden columns, limited to selection, and all groups to be collected:");
+ view = new AlignmentView(alignment, csel, selection, true, true, true);
+ summariseAlignmentView(view, System.out);
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ System.err
+ .println("Failed to generate alignment with selection restricted and groups marked.");
+ }
+
+ }
+}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
package jalview.datamodel;
public interface AnnotatedCollectionI extends SequenceCollectionI
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.datamodel;\r
-\r
-import java.util.Vector;\r
-\r
-public class CigarArray extends CigarBase\r
-{\r
- /**\r
- * Do CIGAR operations on a set of sequences from many other cigars BAD THINGS\r
- * WILL HAPPEN IF A CIGARARRAY IS PASSED TO A CIGARARRAY or a CIGARCIGAR is\r
- * given a CIGARARRAY to insert gaps into.\r
- */\r
- /**\r
- * array of subject cigars\r
- */\r
- public CigarSimple refCigars[] = null;\r
-\r
- private boolean seqcigararray = false;\r
-\r
- private CigarArray()\r
- {\r
- super();\r
- }\r
-\r
- /**\r
- * isSeqCigarArray()\r
- * \r
- * @return boolean true if all refCigars resolve to a SeqCigar or a CigarCigar\r
- */\r
- public boolean isSeqCigarArray()\r
- {\r
- return seqcigararray;\r
- }\r
-\r
- /**\r
- * Apply CIGAR operations to several cigars in parallel will throw an error if\r
- * any of cigar are actually CigarArrays.\r
- * \r
- * @param cigar\r
- * Cigar[]\r
- */\r
- public CigarArray(CigarSimple[] cigars)\r
- {\r
- super();\r
- seqcigararray = true;\r
- if (cigars != null && cigars.length > 0)\r
- {\r
- refCigars = new CigarSimple[cigars.length];\r
- for (int c = 0; c < cigars.length; c++)\r
- {\r
- refCigars[c] = cigars[c];\r
- if (!((cigars[c] instanceof SeqCigar) || cigars[c] instanceof CigarCigar))\r
- {\r
- seqcigararray = false;\r
- }\r
- }\r
- }\r
- }\r
-\r
- /**\r
- * construct a cigar array from the current alignment, or just the subset of\r
- * the current alignment specified by selectionGroup. Any columns marked as\r
- * hidden in columnSelection will be marked as deleted in the array.\r
- * \r
- * @param alignment\r
- * @param columnSelection\r
- * @param selectionGroup\r
- */\r
- public CigarArray(AlignmentI alignment, ColumnSelection columnSelection,\r
- SequenceGroup selectionGroup)\r
- {\r
- this(constructSeqCigarArray(alignment, selectionGroup));\r
- constructFromAlignment(alignment,\r
- columnSelection != null ? columnSelection.getHiddenColumns()\r
- : null, selectionGroup);\r
- }\r
-\r
- private static int[] _calcStartEndBounds(AlignmentI alignment,\r
- SequenceGroup selectionGroup)\r
- {\r
- int[] startend = new int[]\r
- { 0, 0, 0 };\r
- if (selectionGroup != null)\r
- {\r
- startend[0] = selectionGroup.getSize();\r
- startend[1] = selectionGroup.getStartRes();\r
- startend[2] = selectionGroup.getEndRes(); // inclusive for start and end\r
- // in\r
- // SeqCigar constructor\r
- }\r
- else\r
- {\r
- startend[0] = alignment.getHeight();\r
- startend[2] = alignment.getWidth() - 1;\r
- }\r
- return startend;\r
- }\r
-\r
- public static SeqCigar[] constructSeqCigarArray(AlignmentI alignment,\r
- SequenceGroup selectionGroup)\r
- {\r
- SequenceI[] seqs = null;\r
- int i, iSize;\r
- int _startend[] = _calcStartEndBounds(alignment, selectionGroup);\r
- int start = _startend[1], end = _startend[2];\r
- if (selectionGroup != null)\r
- {\r
- iSize = selectionGroup.getSize();\r
- seqs = selectionGroup.getSequencesInOrder(alignment);\r
- start = selectionGroup.getStartRes();\r
- end = selectionGroup.getEndRes(); // inclusive for start and end in\r
- // SeqCigar constructor\r
- }\r
- else\r
- {\r
- iSize = alignment.getHeight();\r
- seqs = alignment.getSequencesArray();\r
- end = alignment.getWidth() - 1;\r
- }\r
- SeqCigar[] selseqs = new SeqCigar[iSize];\r
- for (i = 0; i < iSize; i++)\r
- {\r
- selseqs[i] = new SeqCigar(seqs[i], start, end);\r
- }\r
- return selseqs;\r
- }\r
-\r
- /**\r
- * internal constructor function - called by CigarArray(AlignmentI, ...);\r
- * \r
- * @param alignment\r
- * @param columnSelection\r
- * - vector of visible regions as returned from\r
- * columnSelection.getHiddenColumns()\r
- * @param selectionGroup\r
- */\r
- private void constructFromAlignment(AlignmentI alignment,\r
- Vector columnSelection, SequenceGroup selectionGroup)\r
- {\r
- int[] _startend = _calcStartEndBounds(alignment, selectionGroup);\r
- int start = _startend[1], end = _startend[2];\r
- // now construct the CigarArray operations\r
- if (columnSelection != null)\r
- {\r
- int[] region;\r
- int hideStart, hideEnd;\r
- int last = start;\r
- for (int j = 0; last < end & j < columnSelection.size(); j++)\r
- {\r
- region = (int[]) columnSelection.elementAt(j);\r
- hideStart = region[0];\r
- hideEnd = region[1];\r
- // edit hidden regions to selection range\r
- if (hideStart < last)\r
- {\r
- if (hideEnd > last)\r
- {\r
- hideStart = last;\r
- }\r
- else\r
- {\r
- continue;\r
- }\r
- }\r
-\r
- if (hideStart > end)\r
- {\r
- break;\r
- }\r
-\r
- if (hideEnd > end)\r
- {\r
- hideEnd = end;\r
- }\r
-\r
- if (hideStart > hideEnd)\r
- {\r
- break;\r
- }\r
- /**\r
- * form operations...\r
- */\r
- if (last < hideStart)\r
- {\r
- addOperation(CigarArray.M, hideStart - last);\r
- }\r
- addOperation(CigarArray.D, 1 + hideEnd - hideStart);\r
- last = hideEnd + 1;\r
- }\r
- // Final match if necessary.\r
- if (last < end)\r
- {\r
- addOperation(CigarArray.M, end - last + 1);\r
- }\r
- }\r
- else\r
- {\r
- addOperation(CigarArray.M, end - start + 1);\r
- }\r
- }\r
-\r
- /**\r
- * @see Cigar.getSequenceAndDeletions\r
- * @param GapChar\r
- * char\r
- * @return Object[][]\r
- */\r
- protected Object[][] getArrayofSequenceAndDeletions(char GapChar)\r
- {\r
- if (refCigars == null || refCigars.length == 0 || length == 0)\r
- {\r
- return null;\r
- }\r
- Object[][] sqanddels = new Object[refCigars.length][];\r
- for (int c = 0; c < refCigars.length; c++)\r
- {\r
- String refString = refCigars[c].getSequenceString(GapChar);\r
- if (refString != null)\r
- {\r
- sqanddels[c] = getSequenceAndDeletions(refString, GapChar);\r
- }\r
- else\r
- {\r
- sqanddels[c] = null;\r
- }\r
- }\r
- return sqanddels;\r
- }\r
-\r
- /**\r
- * NOTE: this is an improper sequence string function\r
- * \r
- * @return String formed by newline concatenated results of applying CIGAR\r
- * operations to each reference object in turn.\r
- * @param GapChar\r
- * char\r
- * @return '\n' separated strings (empty results included as \n\n)\r
- */\r
- public String getSequenceString(char GapChar)\r
- {\r
- if (length == 0 || refCigars == null)\r
- {\r
- return "";\r
- }\r
- StringBuffer seqStrings = new StringBuffer();\r
- Object[][] sqanddels = getArrayofSequenceAndDeletions(GapChar);\r
- for (int c = 0; c < refCigars.length; c++)\r
- {\r
- if (sqanddels[c] != null)\r
- {\r
- seqStrings.append((String) sqanddels[c][0]);\r
- sqanddels[c][0] = null;\r
- }\r
- seqStrings.append('\n');\r
- }\r
- return seqStrings.toString();\r
- }\r
-\r
- /**\r
- * return string results of applying cigar string to all reference cigars\r
- * \r
- * @param GapChar\r
- * char\r
- * @return String[]\r
- */\r
- public String[] getSequenceStrings(char GapChar)\r
- {\r
-\r
- if (length == 0 || refCigars == null || refCigars.length == 0)\r
- {\r
- return null;\r
- }\r
- Object[][] sqanddels = getArrayofSequenceAndDeletions(GapChar);\r
- String[] seqs = new String[sqanddels.length];\r
- for (int c = 0; c < refCigars.length; c++)\r
- {\r
- seqs[c] = (String) sqanddels[c][0];\r
- }\r
- return seqs;\r
- }\r
-\r
- /**\r
- * Combines the CigarArray cigar operations with the operations in each\r
- * reference cigar - creating a new reference cigar\r
- * \r
- * @return Cigar[]\r
- * \r
- * public CigarBase[] getEditedCigars() {\r
- * \r
- * return new CigarBase[] {}; }\r
- */\r
- /**\r
- * applyDeletions edits underlying refCigars to propagate deleted regions, and\r
- * removes deletion operations from CigarArray operation list.\r
- * \r
- * @return int[] position after deletion occured and range of deletion in\r
- * cigarArray or null if none occured\r
- */\r
- public int[] applyDeletions()\r
- {\r
- java.util.Vector delpos = null;\r
- if (length == 0)\r
- {\r
- return null;\r
- }\r
- int cursor = 0; // range counter for deletions\r
- int vcursor = 0; // visible column index\r
- int offset = 0; // shift in visible column index as deletions are made\r
- int i = 0;\r
- while (i < length)\r
- {\r
- if (operation[i] != D)\r
- {\r
- if (operation[i] == M)\r
- {\r
- cursor += range[i];\r
- }\r
- vcursor += range[i++];\r
- }\r
- else\r
- {\r
- if (delpos == null)\r
- {\r
- delpos = new java.util.Vector();\r
- }\r
- int delstart = cursor, delend = cursor + range[i] - 1; // inclusive\r
- delpos.addElement(new int[]\r
- { vcursor + offset, range[i] }); // index of right hand column after\r
- // hidden region boundary\r
- offset += range[i] - 1; // shift in visible column coordinates\r
- System.arraycopy(operation, i + 1, operation, i, length - i);\r
- System.arraycopy(range, i + 1, range, i, length - i);\r
- length--;\r
- /*\r
- * int dmax=0; for (int s=0; s<refCigars.length; s++) { int d =\r
- * refCigars[s].deleteRange(delstart, delend); if (d>dmax) dmax=d; }\r
- * offset+=dmax; // shift in visible column coordinates\r
- */\r
- for (int s = 0; s < refCigars.length; s++)\r
- {\r
- int d = refCigars[s].deleteRange(delstart, delend);\r
- }\r
-\r
- }\r
- }\r
- if (delpos != null)\r
- {\r
- int[] pos = new int[delpos.size() * 2];\r
- for (int k = 0, l = delpos.size(); k < l; k++)\r
- {\r
- int[] dr = ((int[]) delpos.elementAt(k));\r
- pos[k * 2] = dr[0];\r
- pos[k * 2 + 1] = dr[1];\r
- delpos.setElementAt(null, k);\r
- }\r
- delpos = null;\r
- return pos;\r
- }\r
- return null;\r
- }\r
-\r
- /**\r
- * \r
- * @return SeqCigar[] or null if CigarArray is not a SeqCigarArray (ie it does\r
- * not resolve to set of seqCigars)\r
- */\r
- public SeqCigar[] getSeqCigarArray()\r
- {\r
- if (!isSeqCigarArray())\r
- {\r
- return null;\r
- }\r
- SeqCigar[] sa = new SeqCigar[refCigars.length];\r
- for (int i = 0; i < refCigars.length; i++)\r
- {\r
- sa[i] = (SeqCigar) refCigars[i];\r
- }\r
- return sa;\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.datamodel;
+
+import java.util.Vector;
+
+public class CigarArray extends CigarBase
+{
+ /**
+ * Do CIGAR operations on a set of sequences from many other cigars BAD THINGS
+ * WILL HAPPEN IF A CIGARARRAY IS PASSED TO A CIGARARRAY or a CIGARCIGAR is
+ * given a CIGARARRAY to insert gaps into.
+ */
+ /**
+ * array of subject cigars
+ */
+ public CigarSimple refCigars[] = null;
+
+ private boolean seqcigararray = false;
+
+ private CigarArray()
+ {
+ super();
+ }
+
+ /**
+ * isSeqCigarArray()
+ *
+ * @return boolean true if all refCigars resolve to a SeqCigar or a CigarCigar
+ */
+ public boolean isSeqCigarArray()
+ {
+ return seqcigararray;
+ }
+
+ /**
+ * Apply CIGAR operations to several cigars in parallel will throw an error if
+ * any of cigar are actually CigarArrays.
+ *
+ * @param cigar
+ * Cigar[]
+ */
+ public CigarArray(CigarSimple[] cigars)
+ {
+ super();
+ seqcigararray = true;
+ if (cigars != null && cigars.length > 0)
+ {
+ refCigars = new CigarSimple[cigars.length];
+ for (int c = 0; c < cigars.length; c++)
+ {
+ refCigars[c] = cigars[c];
+ if (!((cigars[c] instanceof SeqCigar) || cigars[c] instanceof CigarCigar))
+ {
+ seqcigararray = false;
+ }
+ }
+ }
+ }
+
+ /**
+ * construct a cigar array from the current alignment, or just the subset of
+ * the current alignment specified by selectionGroup. Any columns marked as
+ * hidden in columnSelection will be marked as deleted in the array.
+ *
+ * @param alignment
+ * @param columnSelection
+ * @param selectionGroup
+ */
+ public CigarArray(AlignmentI alignment, ColumnSelection columnSelection,
+ SequenceGroup selectionGroup)
+ {
+ this(constructSeqCigarArray(alignment, selectionGroup));
+ constructFromAlignment(alignment,
+ columnSelection != null ? columnSelection.getHiddenColumns()
+ : null, selectionGroup);
+ }
+
+ private static int[] _calcStartEndBounds(AlignmentI alignment,
+ SequenceGroup selectionGroup)
+ {
+ int[] startend = new int[]
+ { 0, 0, 0 };
+ if (selectionGroup != null)
+ {
+ startend[0] = selectionGroup.getSize();
+ startend[1] = selectionGroup.getStartRes();
+ startend[2] = selectionGroup.getEndRes(); // inclusive for start and end
+ // in
+ // SeqCigar constructor
+ }
+ else
+ {
+ startend[0] = alignment.getHeight();
+ startend[2] = alignment.getWidth() - 1;
+ }
+ return startend;
+ }
+
+ public static SeqCigar[] constructSeqCigarArray(AlignmentI alignment,
+ SequenceGroup selectionGroup)
+ {
+ SequenceI[] seqs = null;
+ int i, iSize;
+ int _startend[] = _calcStartEndBounds(alignment, selectionGroup);
+ int start = _startend[1], end = _startend[2];
+ if (selectionGroup != null)
+ {
+ iSize = selectionGroup.getSize();
+ seqs = selectionGroup.getSequencesInOrder(alignment);
+ start = selectionGroup.getStartRes();
+ end = selectionGroup.getEndRes(); // inclusive for start and end in
+ // SeqCigar constructor
+ }
+ else
+ {
+ iSize = alignment.getHeight();
+ seqs = alignment.getSequencesArray();
+ end = alignment.getWidth() - 1;
+ }
+ SeqCigar[] selseqs = new SeqCigar[iSize];
+ for (i = 0; i < iSize; i++)
+ {
+ selseqs[i] = new SeqCigar(seqs[i], start, end);
+ }
+ return selseqs;
+ }
+
+ /**
+ * internal constructor function - called by CigarArray(AlignmentI, ...);
+ *
+ * @param alignment
+ * @param columnSelection
+ * - vector of visible regions as returned from
+ * columnSelection.getHiddenColumns()
+ * @param selectionGroup
+ */
+ private void constructFromAlignment(AlignmentI alignment,
+ Vector columnSelection, SequenceGroup selectionGroup)
+ {
+ int[] _startend = _calcStartEndBounds(alignment, selectionGroup);
+ int start = _startend[1], end = _startend[2];
+ // now construct the CigarArray operations
+ if (columnSelection != null)
+ {
+ int[] region;
+ int hideStart, hideEnd;
+ int last = start;
+ for (int j = 0; last < end & j < columnSelection.size(); j++)
+ {
+ region = (int[]) columnSelection.elementAt(j);
+ hideStart = region[0];
+ hideEnd = region[1];
+ // edit hidden regions to selection range
+ if (hideStart < last)
+ {
+ if (hideEnd > last)
+ {
+ hideStart = last;
+ }
+ else
+ {
+ continue;
+ }
+ }
+
+ if (hideStart > end)
+ {
+ break;
+ }
+
+ if (hideEnd > end)
+ {
+ hideEnd = end;
+ }
+
+ if (hideStart > hideEnd)
+ {
+ break;
+ }
+ /**
+ * form operations...
+ */
+ if (last < hideStart)
+ {
+ addOperation(CigarArray.M, hideStart - last);
+ }
+ addOperation(CigarArray.D, 1 + hideEnd - hideStart);
+ last = hideEnd + 1;
+ }
+ // Final match if necessary.
+ if (last < end)
+ {
+ addOperation(CigarArray.M, end - last + 1);
+ }
+ }
+ else
+ {
+ addOperation(CigarArray.M, end - start + 1);
+ }
+ }
+
+ /**
+ * @see Cigar.getSequenceAndDeletions
+ * @param GapChar
+ * char
+ * @return Object[][]
+ */
+ protected Object[][] getArrayofSequenceAndDeletions(char GapChar)
+ {
+ if (refCigars == null || refCigars.length == 0 || length == 0)
+ {
+ return null;
+ }
+ Object[][] sqanddels = new Object[refCigars.length][];
+ for (int c = 0; c < refCigars.length; c++)
+ {
+ String refString = refCigars[c].getSequenceString(GapChar);
+ if (refString != null)
+ {
+ sqanddels[c] = getSequenceAndDeletions(refString, GapChar);
+ }
+ else
+ {
+ sqanddels[c] = null;
+ }
+ }
+ return sqanddels;
+ }
+
+ /**
+ * NOTE: this is an improper sequence string function
+ *
+ * @return String formed by newline concatenated results of applying CIGAR
+ * operations to each reference object in turn.
+ * @param GapChar
+ * char
+ * @return '\n' separated strings (empty results included as \n\n)
+ */
+ public String getSequenceString(char GapChar)
+ {
+ if (length == 0 || refCigars == null)
+ {
+ return "";
+ }
+ StringBuffer seqStrings = new StringBuffer();
+ Object[][] sqanddels = getArrayofSequenceAndDeletions(GapChar);
+ for (int c = 0; c < refCigars.length; c++)
+ {
+ if (sqanddels[c] != null)
+ {
+ seqStrings.append((String) sqanddels[c][0]);
+ sqanddels[c][0] = null;
+ }
+ seqStrings.append('\n');
+ }
+ return seqStrings.toString();
+ }
+
+ /**
+ * return string results of applying cigar string to all reference cigars
+ *
+ * @param GapChar
+ * char
+ * @return String[]
+ */
+ public String[] getSequenceStrings(char GapChar)
+ {
+
+ if (length == 0 || refCigars == null || refCigars.length == 0)
+ {
+ return null;
+ }
+ Object[][] sqanddels = getArrayofSequenceAndDeletions(GapChar);
+ String[] seqs = new String[sqanddels.length];
+ for (int c = 0; c < refCigars.length; c++)
+ {
+ seqs[c] = (String) sqanddels[c][0];
+ }
+ return seqs;
+ }
+
+ /**
+ * Combines the CigarArray cigar operations with the operations in each
+ * reference cigar - creating a new reference cigar
+ *
+ * @return Cigar[]
+ *
+ * public CigarBase[] getEditedCigars() {
+ *
+ * return new CigarBase[] {}; }
+ */
+ /**
+ * applyDeletions edits underlying refCigars to propagate deleted regions, and
+ * removes deletion operations from CigarArray operation list.
+ *
+ * @return int[] position after deletion occured and range of deletion in
+ * cigarArray or null if none occured
+ */
+ public int[] applyDeletions()
+ {
+ java.util.Vector delpos = null;
+ if (length == 0)
+ {
+ return null;
+ }
+ int cursor = 0; // range counter for deletions
+ int vcursor = 0; // visible column index
+ int offset = 0; // shift in visible column index as deletions are made
+ int i = 0;
+ while (i < length)
+ {
+ if (operation[i] != D)
+ {
+ if (operation[i] == M)
+ {
+ cursor += range[i];
+ }
+ vcursor += range[i++];
+ }
+ else
+ {
+ if (delpos == null)
+ {
+ delpos = new java.util.Vector();
+ }
+ int delstart = cursor, delend = cursor + range[i] - 1; // inclusive
+ delpos.addElement(new int[]
+ { vcursor + offset, range[i] }); // index of right hand column after
+ // hidden region boundary
+ offset += range[i] - 1; // shift in visible column coordinates
+ System.arraycopy(operation, i + 1, operation, i, length - i);
+ System.arraycopy(range, i + 1, range, i, length - i);
+ length--;
+ /*
+ * int dmax=0; for (int s=0; s<refCigars.length; s++) { int d =
+ * refCigars[s].deleteRange(delstart, delend); if (d>dmax) dmax=d; }
+ * offset+=dmax; // shift in visible column coordinates
+ */
+ for (int s = 0; s < refCigars.length; s++)
+ {
+ int d = refCigars[s].deleteRange(delstart, delend);
+ }
+
+ }
+ }
+ if (delpos != null)
+ {
+ int[] pos = new int[delpos.size() * 2];
+ for (int k = 0, l = delpos.size(); k < l; k++)
+ {
+ int[] dr = ((int[]) delpos.elementAt(k));
+ pos[k * 2] = dr[0];
+ pos[k * 2 + 1] = dr[1];
+ delpos.setElementAt(null, k);
+ }
+ delpos = null;
+ return pos;
+ }
+ return null;
+ }
+
+ /**
+ *
+ * @return SeqCigar[] or null if CigarArray is not a SeqCigarArray (ie it does
+ * not resolve to set of seqCigars)
+ */
+ public SeqCigar[] getSeqCigarArray()
+ {
+ if (!isSeqCigarArray())
+ {
+ return null;
+ }
+ SeqCigar[] sa = new SeqCigar[refCigars.length];
+ for (int i = 0; i < refCigars.length; i++)
+ {
+ sa[i] = (SeqCigar) refCigars[i];
+ }
+ return sa;
+ }
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.datamodel;\r
-\r
-import java.util.*;\r
-\r
-public abstract class CigarBase\r
-{\r
- /**\r
- * Base class for compact idiosyncratic representation of gaps and aligned\r
- * residues Regards to Tom Oldfield for his DynamicArray class. 17th July 2006\r
- * Not thread safe.\r
- */\r
- public CigarBase()\r
- {\r
- // nothing to be done (probably)\r
- }\r
-\r
- protected int length = 0;\r
-\r
- protected int _inc_length = 10; // extension range for addition of new\r
-\r
- // operations\r
-\r
- protected char[] operation = null;\r
-\r
- protected int[] range = null;\r
-\r
- /**\r
- * Range of Hidden residues in seq (translated as deleted in seq)\r
- */\r
- public static final char D = 'D';\r
-\r
- /**\r
- * Range of insertions to seq\r
- */\r
- public static final char I = 'I';\r
-\r
- /**\r
- * Range of aligned residues\r
- */\r
- public static final char M = 'M';\r
-\r
- static protected final char _case_shift = 'a' - 'A';\r
-\r
- /**\r
- * Ugly function to get edited sequence string, start and end symbol positions\r
- * and the deletion regions as an array of int pairs May return null for an\r
- * empty cigar string. May return null for deletion ranges if there are none.\r
- * \r
- * @param reference\r
- * - the symbol sequence to apply the cigar operations to (or null if\r
- * no sequence)\r
- * @param GapChar\r
- * - the symbol to use for Insert operations\r
- * @return Object[] { String, int[] {start, startcol, end, endcol}, int[][3]\r
- * {start, end, col} or null} the gapped sequence, first and last\r
- * residue index, and the deletion ranges on the reference sequence\r
- */\r
- public Object[] getSequenceAndDeletions(String reference, char GapChar)\r
- {\r
- int rlength = 0;\r
- int[][] deletions = new int[length][];\r
- int[][] trunc_deletions = null;\r
- StringBuffer sq = new StringBuffer();\r
- int cursor = 0, alcursor = 0, start = 0, startpos = 0, end = 0, endpos = 0, delcount = -1;\r
- boolean consecutive_del = false;\r
- if (length == 0)\r
- {\r
- return null;\r
- }\r
- if (reference != null)\r
- {\r
- rlength = reference.length();\r
- }\r
- boolean modstart = true;\r
- for (int i = 0; i < length; i++)\r
- {\r
- switch (operation[i])\r
- {\r
- case D:\r
- if (!consecutive_del)\r
- {\r
- deletions[++delcount] = new int[]\r
- { cursor, 0, alcursor };\r
- }\r
- cursor += range[i];\r
- deletions[delcount][1] = cursor - 1;\r
- consecutive_del = true;\r
- break;\r
- case I:\r
- consecutive_del = false;\r
- for (int r = 0; r < range[i]; r++)\r
- {\r
- sq.append(GapChar);\r
- alcursor++;\r
- }\r
- break;\r
- case M:\r
- consecutive_del = false;\r
- if (modstart)\r
- {\r
- start = cursor;\r
- startpos = alcursor;\r
- modstart = false;\r
- }\r
- if (reference != null)\r
- {\r
- int sbend = cursor + range[i];\r
- if (sbend > rlength)\r
- {\r
- sq.append(reference.substring(cursor, rlength));\r
- while (sbend-- >= rlength)\r
- {\r
- sq.append(GapChar);\r
- }\r
- }\r
- else\r
- {\r
- sq.append(reference.substring(cursor, sbend));\r
- }\r
- }\r
- alcursor += range[i];\r
- cursor += range[i];\r
- end = cursor - 1;\r
- endpos = alcursor;\r
- break;\r
- default:\r
- throw new Error("Unknown SeqCigar operation '" + operation[i] + "'");\r
- }\r
- }\r
- if (++delcount > 0)\r
- {\r
- trunc_deletions = new int[delcount][];\r
- System.arraycopy(deletions, 0, trunc_deletions, 0, delcount);\r
- }\r
- deletions = null;\r
- return new Object[]\r
- { ((reference != null) ? sq.toString() : null), new int[]\r
- { start, startpos, end, endpos }, trunc_deletions };\r
- }\r
-\r
- protected void compact_operations()\r
- {\r
- int i = 1;\r
- if (operation == null)\r
- {\r
- return;\r
- }\r
- char last = operation[0];\r
- while (i < length)\r
- {\r
- if (last == operation[i])\r
- {\r
- range[i - 1] += range[i];\r
- int r = length - i;\r
- if (r > 0)\r
- {\r
- System.arraycopy(range, i + 1, range, i, r);\r
- System.arraycopy(operation, i + 1, operation, i, r);\r
- }\r
- length--;\r
- }\r
- else\r
- {\r
- last = operation[i++];\r
- }\r
- }\r
- }\r
-\r
- /**\r
- * turn a cigar string into a series of operation range pairs\r
- * \r
- * @param cigarString\r
- * String\r
- * @return object[] {char[] operation, int[] range}\r
- * @throws java.lang.Exception\r
- * for improperly formated cigar strings or ones with unknown\r
- * operations\r
- */\r
- public static Object[] parseCigarString(String cigarString)\r
- throws Exception\r
- {\r
- int ops = 0;\r
- for (int i = 0, l = cigarString.length(); i < l; i++)\r
- {\r
- char c = cigarString.charAt(i);\r
- if (c == M || c == (M - _case_shift) || c == I\r
- || c == (I - _case_shift) || c == D || c == (D - _case_shift))\r
- {\r
- ops++;\r
- }\r
- }\r
- char[] operation = new char[ops];\r
- int[] range = new int[ops];\r
- int op = 0;\r
- int i = 0, l = cigarString.length();\r
- while (i < l)\r
- {\r
- char c;\r
- int j = i;\r
- do\r
- {\r
- c = cigarString.charAt(j++);\r
- } while (c >= '0' && c <= '9' && j < l);\r
- if (j >= l && c >= '0' && c <= '9')\r
- {\r
- throw new Exception("Unterminated cigar string.");\r
- }\r
- try\r
- {\r
- String rangeint = cigarString.substring(i, j - 1);\r
- range[op] = Integer.parseInt(rangeint);\r
- i = j;\r
- } catch (Exception e)\r
- {\r
- throw new Error("Implementation bug in parseCigarString");\r
- }\r
- if (c >= 'a' && c <= 'z')\r
- {\r
- c -= _case_shift;\r
- }\r
- if ((c == M || c == I || c == D))\r
- {\r
- operation[op++] = c;\r
- }\r
- else\r
- {\r
- throw new Exception("Unexpected operation '" + c\r
- + "' in cigar string (position " + i + " in '"\r
- + cigarString + "'");\r
- }\r
- }\r
- return new Object[]\r
- { operation, range };\r
- }\r
-\r
- /**\r
- * add an operation to cigar string\r
- * \r
- * @param op\r
- * char\r
- * @param range\r
- * int\r
- */\r
- public void addOperation(char op, int range)\r
- {\r
- if (op >= 'a' && op <= 'z')\r
- {\r
- op -= _case_shift;\r
- }\r
- if (op != M && op != D && op != I)\r
- {\r
- throw new Error("Implementation error. Invalid operation string.");\r
- }\r
- if (range == 0)\r
- {\r
- return; // No Operation to add.\r
- }\r
- if (range < 0)\r
- {\r
- throw new Error(\r
- "Invalid range string (must be zero or positive number)");\r
- }\r
- int lngth = 0;\r
- if (operation == null)\r
- {\r
- this.operation = new char[_inc_length];\r
- this.range = new int[_inc_length];\r
- }\r
- if (length + 1 == operation.length)\r
- {\r
- char[] ops = this.operation;\r
- this.operation = new char[length + 1 + _inc_length];\r
- System.arraycopy(ops, 0, this.operation, 0, length);\r
- ops = null;\r
- int[] rng = this.range;\r
- this.range = new int[length + 1 + _inc_length];\r
- System.arraycopy(rng, 0, this.range, 0, length);\r
- rng = null;\r
- }\r
- if ((length > 0) && (operation[length - 1] == op))\r
- {\r
- length--; // modify existing operation.\r
- }\r
- else\r
- {\r
- this.range[length] = 0; // reset range\r
- }\r
- this.operation[length] = op;\r
- this.range[length++] += range;\r
- }\r
-\r
- /**\r
- * semi-efficient insert an operation on the current cigar string set at\r
- * column pos (from 1) NOTE: Insertion operations simply extend width of cigar\r
- * result - affecting registration of alignment Deletion ops will shorten\r
- * length of result - and affect registration of alignment Match ops will also\r
- * affect length of result - affecting registration of alignment (ie\r
- * "10M".insert(4,I,3)->"4M3I3M") - (replace?) (ie\r
- * "10M".insert(4,D,3)->"4M3D3M") - (shortens alignment) (ie\r
- * "5I5M".insert(4,I,3)->"8I5M") - real insertion (ie\r
- * "5I5M".insert(4,D,3)->"4I2D3M") - shortens aligment - I's are removed, Ms\r
- * changed to Ds (ie "10M".insert(4,M,3)->"13M") - lengthens - Is changed to\r
- * M, Ds changed to M. (ie "5I5M".insert(4,M,3)->"4I8M") - effectively shifts\r
- * sequence left by 1 residue and extends it by 3 (\r
- * "10D5M".insert(-1,M,3)->"3M7D5M") ( "10D5M".insert(0,M,3)->"7D8M") (\r
- * "10D5M".insert(1,M,3)->"10D8M") ( "1M10D5M".insert(0,M,3)->"1M10D8M") (\r
- * "1M10D5M".insert(1,M,3)->"\r
- * \r
- * if pos is beyond width - I operations are added before the operation\r
- * \r
- * @param pos\r
- * int -1, 0-length of visible region, or greater to append new ops\r
- * (with insertions in between)\r
- * @param op\r
- * char\r
- * @param range\r
- * int public void addOperationAt(int pos, char op, int range) { int\r
- * cursor = -1; // mark the position for the current operation being\r
- * edited. int o = 0; boolean last_d = false; // previous op was a\r
- * deletion. if (pos < -1) throw new\r
- * Error("pos<-1 is not supported."); while (o<length) { if\r
- * (operation[o] != D) { if ( (cursor + this.range[o]) < pos) {\r
- * cursor += this.range[o]; o++; last_d=false; } else { break; } }\r
- * else { last_d=true; o++; } } if (o==length) { // must insert more\r
- * operations before pos if (pos-cursor>0) addInsertion(pos-cursor);\r
- * // then just add the new operation. Regardless of what it is.\r
- * addOperation(op, range); } else { int diff = pos - cursor;\r
- * \r
- * int e_length = length-o; // new edit operation array length. //\r
- * diff<0 - can only happen before first insertion or match. -\r
- * affects op and all following // dif==0 - only when at first\r
- * position of existing op - // diff>0 - must preserve some existing\r
- * operations int[] e_range = new int[e_length];\r
- * System.arraycopy(this.range, o, e_range, 0, e_length); char[] e_op\r
- * = new char[e_length]; System.arraycopy(this.operation, o, e_op, 0,\r
- * e_length); length = o; // can now use add_operation to extend\r
- * list. int e_o=0; // current operation being edited. switch (op) {\r
- * case M: switch (e_op[e_o]) { case M: if (last_d && diff <= 0) { //\r
- * reduce D's, if possible if (range<=this.range[o-1]) { this.range[o\r
- * - 1] -= range; } else { this.range[o-1]=0; } if\r
- * (this.range[o-1]==0) o--; // lose this op. } e_range[e_o] +=\r
- * range; // just add more matched residues break; case I: // change\r
- * from insertion to match if (last_d && diff<=0) { // reduce D's, if\r
- * possible if (range<=this.range[o-1]) { this.range[o - 1] -= range;\r
- * } else { this.range[o-1]=0; } if (this.range[o-1]==0) o--; // lose\r
- * this op. } e_range[e_o] break; default: throw new Inp }\r
- * \r
- * break; case I: break; case D: } break; default: throw new\r
- * Error("Implementation Error: Unknown operation in addOperation!");\r
- * } // finally, add remaining ops. while (e_o<e_length) {\r
- * addOperation(e_op[e_o], e_range[e_o]); e_o++; } } }\r
- */\r
- /**\r
- * Mark residues from start to end (inclusive) as deleted from the alignment,\r
- * and removes any insertions.\r
- * \r
- * @param start\r
- * int\r
- * @param end\r
- * int\r
- * @return deleted int - number of symbols marked as deleted\r
- */\r
- public int deleteRange(int start, int end)\r
- {\r
- int deleted = 0;\r
- if (length == 0)\r
- {\r
- // nothing to do here\r
- return deleted;\r
- }\r
- if (start < 0 || start > end)\r
- {\r
- throw new Error(\r
- "Implementation Error: deleteRange out of bounds: start must be non-negative and less than end.");\r
- }\r
- // find beginning\r
- int cursor = 0; // mark the position for the current operation being edited.\r
- int rlength = 1 + end - start; // number of positions to delete\r
- int oldlen = length;\r
- int o = 0;\r
- boolean editing = false;\r
- char[] oldops = operation;\r
- int[] oldrange = range;\r
- length = 0;\r
- operation = null;\r
- range = null;\r
- compact_operations();\r
- while (o < oldlen && cursor <= end && rlength > 0)\r
- {\r
- if (oldops[o] == D)\r
- {\r
- // absorbed into new deleted region.\r
- addDeleted(oldrange[o++]);\r
- continue;\r
- }\r
-\r
- int remain = oldrange[o]; // number of op characters left to edit\r
- if (!editing)\r
- {\r
- if ((cursor + remain) <= start)\r
- {\r
- addOperation(oldops[o], oldrange[o]);\r
- cursor += oldrange[o++];\r
- continue; // next operation\r
- }\r
- editing = true;\r
- // add operations before hidden region\r
- if (start - cursor > 0)\r
- {\r
- addOperation(oldops[o], start - cursor);\r
- remain -= start - cursor;\r
- }\r
- }\r
- // start inserting new ops\r
- if (o < oldlen && editing && rlength > 0 && remain > 0)\r
- {\r
- switch (oldops[o])\r
- {\r
- case M:\r
- if (rlength > remain)\r
- {\r
- addDeleted(remain);\r
- deleted += remain;\r
- }\r
- else\r
- {\r
- deleted += rlength;\r
- addDeleted(rlength);\r
- if (remain - rlength > 0)\r
- {\r
- this.addOperation(M, remain - rlength); // add remaining back.\r
- }\r
- rlength = 0;\r
- remain = 0;\r
- }\r
- break;\r
- case I:\r
- if (remain - rlength > 0)\r
- {\r
- // only remove some gaps\r
- addInsertion(remain - rlength);\r
- rlength = 0;\r
- }\r
- break;\r
- case D:\r
- throw new Error("Implementation error."); // do nothing;\r
- default:\r
- throw new Error("Implementation Error! Unknown operation '"\r
- + oldops[o] + "'");\r
- }\r
- rlength -= remain;\r
- remain = oldrange[++o]; // number of op characters left to edit\r
- }\r
- }\r
- // add remaining\r
- while (o < oldlen)\r
- {\r
- addOperation(oldops[o], oldrange[o++]);\r
- }\r
- // if (cursor<(start+1)) {\r
- // ran out of ops - nothing to do here ?\r
- // addInsertion(start-cursor);\r
- // }\r
- return deleted;\r
- }\r
-\r
- /**\r
- * Deleted regions mean that there will be discontinuous sequence numbering in\r
- * the sequence returned by getSeq(char).\r
- * \r
- * @return true if there deletions\r
- */\r
- public boolean hasDeletedRegions()\r
- {\r
- for (int i = 0; i < length; i++)\r
- {\r
- if (operation[i] == D)\r
- {\r
- return true;\r
- }\r
- }\r
- return false;\r
- }\r
-\r
- /**\r
- * enumerate the ranges on seq that are marked as deleted in this cigar\r
- * \r
- * @return int[] { vis_start, sym_start, length }\r
- */\r
- public int[] getDeletedRegions()\r
- {\r
- if (length == 0)\r
- {\r
- return null;\r
- }\r
- Vector dr = new Vector();\r
- int cursor = 0, vcursor = 0;\r
- for (int i = 0; i < length; i++)\r
- {\r
- switch (operation[i])\r
- {\r
- case M:\r
- cursor += range[i];\r
- case I:\r
- vcursor += range[i];\r
- break;\r
- case D:\r
- dr.addElement(new int[]\r
- { vcursor, cursor, range[i] });\r
- cursor += range[i];\r
- }\r
- }\r
- if (dr.size() == 0)\r
- {\r
- return null;\r
- }\r
- int[] delregions = new int[dr.size() * 3];\r
- for (int i = 0, l = dr.size(); i < l; i++)\r
- {\r
- int[] reg = (int[]) dr.elementAt(i);\r
- delregions[i * 3] = reg[0];\r
- delregions[i * 3 + 1] = reg[1];\r
- delregions[i * 3 + 2] = reg[2];\r
- }\r
- return delregions;\r
- }\r
-\r
- /**\r
- * sum of ranges in cigar string\r
- * \r
- * @return int number of residues hidden, matched, or gaps inserted into\r
- * sequence\r
- */\r
- public int getFullWidth()\r
- {\r
- int w = 0;\r
- if (range != null)\r
- {\r
- for (int i = 0; i < length; i++)\r
- {\r
- w += range[i];\r
- }\r
- }\r
- return w;\r
- }\r
-\r
- /**\r
- * Visible length of aligned sequence\r
- * \r
- * @return int length of including gaps and less hidden regions\r
- */\r
- public int getWidth()\r
- {\r
- int w = 0;\r
- if (range != null)\r
- {\r
- for (int i = 0; i < length; i++)\r
- {\r
- if (operation[i] == M || operation[i] == I)\r
- {\r
- w += range[i];\r
- }\r
- }\r
- }\r
- return w;\r
- }\r
-\r
- /**\r
- * mark a range of inserted residues\r
- * \r
- * @param range\r
- * int\r
- */\r
- public void addInsertion(int range)\r
- {\r
- this.addOperation(I, range);\r
- }\r
-\r
- /**\r
- * mark the next range residues as hidden (not aligned) or deleted\r
- * \r
- * @param range\r
- * int\r
- */\r
- public void addDeleted(int range)\r
- {\r
- this.addOperation(D, range);\r
- }\r
-\r
- /**\r
- * Modifies operation list to delete columns from start to end (inclusive)\r
- * editing will remove insertion operations, and convert matches to deletions\r
- * \r
- * @param start\r
- * alignment column\r
- * @param end\r
- * alignment column\r
- * @return boolean true if residues were marked as deleted. public boolean\r
- * deleteRange(int start, int end) { boolean deleted = false; int op =\r
- * 0, prevop = -1, firstm = -1, lastm = -1, postop = -1; int width =\r
- * 0; // zero'th column if (length > 0) { // find operation bracketing\r
- * start of the range do { if (operation[op] != D) { width +=\r
- * range[prevop = op]; } op++; } while (op < length && width < start);\r
- * } if (width < start) { // run off end - add more operations up to\r
- * deletion. addInsertion(start - width); } else { // edit existing\r
- * operations. op = prevop; width -= range[prevop]; int[] oldrange =\r
- * range; char[] oldops = operation; range = new int[oldrange.length];\r
- * operation = new char[oldops.length]; if (op < length) { do { if\r
- * (operation[op] != D) { width += range[postop = op]; } op++; } while\r
- * (op < length && width <= end); } } if (deleted == true) {\r
- * addDeleted(end - start + 1); } return deleted; }\r
- */\r
- /**\r
- * Return an ENSEMBL style cigar string where D may indicates excluded parts\r
- * of seq\r
- * \r
- * @return String of form ([0-9]+[IMD])+\r
- */\r
- public String getCigarstring()\r
- {\r
- StringBuffer cigarString = new StringBuffer();\r
- for (int i = 0; i < length; i++)\r
- {\r
- cigarString.append("" + range[i]);\r
- cigarString.append(operation[i]);\r
- }\r
- return cigarString.toString();\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.datamodel;
+
+import java.util.*;
+
+public abstract class CigarBase
+{
+ /**
+ * Base class for compact idiosyncratic representation of gaps and aligned
+ * residues Regards to Tom Oldfield for his DynamicArray class. 17th July 2006
+ * Not thread safe.
+ */
+ public CigarBase()
+ {
+ // nothing to be done (probably)
+ }
+
+ protected int length = 0;
+
+ protected int _inc_length = 10; // extension range for addition of new
+
+ // operations
+
+ protected char[] operation = null;
+
+ protected int[] range = null;
+
+ /**
+ * Range of Hidden residues in seq (translated as deleted in seq)
+ */
+ public static final char D = 'D';
+
+ /**
+ * Range of insertions to seq
+ */
+ public static final char I = 'I';
+
+ /**
+ * Range of aligned residues
+ */
+ public static final char M = 'M';
+
+ static protected final char _case_shift = 'a' - 'A';
+
+ /**
+ * Ugly function to get edited sequence string, start and end symbol positions
+ * and the deletion regions as an array of int pairs May return null for an
+ * empty cigar string. May return null for deletion ranges if there are none.
+ *
+ * @param reference
+ * - the symbol sequence to apply the cigar operations to (or null if
+ * no sequence)
+ * @param GapChar
+ * - the symbol to use for Insert operations
+ * @return Object[] { String, int[] {start, startcol, end, endcol}, int[][3]
+ * {start, end, col} or null} the gapped sequence, first and last
+ * residue index, and the deletion ranges on the reference sequence
+ */
+ public Object[] getSequenceAndDeletions(String reference, char GapChar)
+ {
+ int rlength = 0;
+ int[][] deletions = new int[length][];
+ int[][] trunc_deletions = null;
+ StringBuffer sq = new StringBuffer();
+ int cursor = 0, alcursor = 0, start = 0, startpos = 0, end = 0, endpos = 0, delcount = -1;
+ boolean consecutive_del = false;
+ if (length == 0)
+ {
+ return null;
+ }
+ if (reference != null)
+ {
+ rlength = reference.length();
+ }
+ boolean modstart = true;
+ for (int i = 0; i < length; i++)
+ {
+ switch (operation[i])
+ {
+ case D:
+ if (!consecutive_del)
+ {
+ deletions[++delcount] = new int[]
+ { cursor, 0, alcursor };
+ }
+ cursor += range[i];
+ deletions[delcount][1] = cursor - 1;
+ consecutive_del = true;
+ break;
+ case I:
+ consecutive_del = false;
+ for (int r = 0; r < range[i]; r++)
+ {
+ sq.append(GapChar);
+ alcursor++;
+ }
+ break;
+ case M:
+ consecutive_del = false;
+ if (modstart)
+ {
+ start = cursor;
+ startpos = alcursor;
+ modstart = false;
+ }
+ if (reference != null)
+ {
+ int sbend = cursor + range[i];
+ if (sbend > rlength)
+ {
+ sq.append(reference.substring(cursor, rlength));
+ while (sbend-- >= rlength)
+ {
+ sq.append(GapChar);
+ }
+ }
+ else
+ {
+ sq.append(reference.substring(cursor, sbend));
+ }
+ }
+ alcursor += range[i];
+ cursor += range[i];
+ end = cursor - 1;
+ endpos = alcursor;
+ break;
+ default:
+ throw new Error("Unknown SeqCigar operation '" + operation[i] + "'");
+ }
+ }
+ if (++delcount > 0)
+ {
+ trunc_deletions = new int[delcount][];
+ System.arraycopy(deletions, 0, trunc_deletions, 0, delcount);
+ }
+ deletions = null;
+ return new Object[]
+ { ((reference != null) ? sq.toString() : null), new int[]
+ { start, startpos, end, endpos }, trunc_deletions };
+ }
+
+ protected void compact_operations()
+ {
+ int i = 1;
+ if (operation == null)
+ {
+ return;
+ }
+ char last = operation[0];
+ while (i < length)
+ {
+ if (last == operation[i])
+ {
+ range[i - 1] += range[i];
+ int r = length - i;
+ if (r > 0)
+ {
+ System.arraycopy(range, i + 1, range, i, r);
+ System.arraycopy(operation, i + 1, operation, i, r);
+ }
+ length--;
+ }
+ else
+ {
+ last = operation[i++];
+ }
+ }
+ }
+
+ /**
+ * turn a cigar string into a series of operation range pairs
+ *
+ * @param cigarString
+ * String
+ * @return object[] {char[] operation, int[] range}
+ * @throws java.lang.Exception
+ * for improperly formated cigar strings or ones with unknown
+ * operations
+ */
+ public static Object[] parseCigarString(String cigarString)
+ throws Exception
+ {
+ int ops = 0;
+ for (int i = 0, l = cigarString.length(); i < l; i++)
+ {
+ char c = cigarString.charAt(i);
+ if (c == M || c == (M - _case_shift) || c == I
+ || c == (I - _case_shift) || c == D || c == (D - _case_shift))
+ {
+ ops++;
+ }
+ }
+ char[] operation = new char[ops];
+ int[] range = new int[ops];
+ int op = 0;
+ int i = 0, l = cigarString.length();
+ while (i < l)
+ {
+ char c;
+ int j = i;
+ do
+ {
+ c = cigarString.charAt(j++);
+ } while (c >= '0' && c <= '9' && j < l);
+ if (j >= l && c >= '0' && c <= '9')
+ {
+ throw new Exception("Unterminated cigar string.");
+ }
+ try
+ {
+ String rangeint = cigarString.substring(i, j - 1);
+ range[op] = Integer.parseInt(rangeint);
+ i = j;
+ } catch (Exception e)
+ {
+ throw new Error("Implementation bug in parseCigarString");
+ }
+ if (c >= 'a' && c <= 'z')
+ {
+ c -= _case_shift;
+ }
+ if ((c == M || c == I || c == D))
+ {
+ operation[op++] = c;
+ }
+ else
+ {
+ throw new Exception("Unexpected operation '" + c
+ + "' in cigar string (position " + i + " in '"
+ + cigarString + "'");
+ }
+ }
+ return new Object[]
+ { operation, range };
+ }
+
+ /**
+ * add an operation to cigar string
+ *
+ * @param op
+ * char
+ * @param range
+ * int
+ */
+ public void addOperation(char op, int range)
+ {
+ if (op >= 'a' && op <= 'z')
+ {
+ op -= _case_shift;
+ }
+ if (op != M && op != D && op != I)
+ {
+ throw new Error("Implementation error. Invalid operation string.");
+ }
+ if (range == 0)
+ {
+ return; // No Operation to add.
+ }
+ if (range < 0)
+ {
+ throw new Error(
+ "Invalid range string (must be zero or positive number)");
+ }
+ int lngth = 0;
+ if (operation == null)
+ {
+ this.operation = new char[_inc_length];
+ this.range = new int[_inc_length];
+ }
+ if (length + 1 == operation.length)
+ {
+ char[] ops = this.operation;
+ this.operation = new char[length + 1 + _inc_length];
+ System.arraycopy(ops, 0, this.operation, 0, length);
+ ops = null;
+ int[] rng = this.range;
+ this.range = new int[length + 1 + _inc_length];
+ System.arraycopy(rng, 0, this.range, 0, length);
+ rng = null;
+ }
+ if ((length > 0) && (operation[length - 1] == op))
+ {
+ length--; // modify existing operation.
+ }
+ else
+ {
+ this.range[length] = 0; // reset range
+ }
+ this.operation[length] = op;
+ this.range[length++] += range;
+ }
+
+ /**
+ * semi-efficient insert an operation on the current cigar string set at
+ * column pos (from 1) NOTE: Insertion operations simply extend width of cigar
+ * result - affecting registration of alignment Deletion ops will shorten
+ * length of result - and affect registration of alignment Match ops will also
+ * affect length of result - affecting registration of alignment (ie
+ * "10M".insert(4,I,3)->"4M3I3M") - (replace?) (ie
+ * "10M".insert(4,D,3)->"4M3D3M") - (shortens alignment) (ie
+ * "5I5M".insert(4,I,3)->"8I5M") - real insertion (ie
+ * "5I5M".insert(4,D,3)->"4I2D3M") - shortens aligment - I's are removed, Ms
+ * changed to Ds (ie "10M".insert(4,M,3)->"13M") - lengthens - Is changed to
+ * M, Ds changed to M. (ie "5I5M".insert(4,M,3)->"4I8M") - effectively shifts
+ * sequence left by 1 residue and extends it by 3 (
+ * "10D5M".insert(-1,M,3)->"3M7D5M") ( "10D5M".insert(0,M,3)->"7D8M") (
+ * "10D5M".insert(1,M,3)->"10D8M") ( "1M10D5M".insert(0,M,3)->"1M10D8M") (
+ * "1M10D5M".insert(1,M,3)->"
+ *
+ * if pos is beyond width - I operations are added before the operation
+ *
+ * @param pos
+ * int -1, 0-length of visible region, or greater to append new ops
+ * (with insertions in between)
+ * @param op
+ * char
+ * @param range
+ * int public void addOperationAt(int pos, char op, int range) { int
+ * cursor = -1; // mark the position for the current operation being
+ * edited. int o = 0; boolean last_d = false; // previous op was a
+ * deletion. if (pos < -1) throw new
+ * Error("pos<-1 is not supported."); while (o<length) { if
+ * (operation[o] != D) { if ( (cursor + this.range[o]) < pos) {
+ * cursor += this.range[o]; o++; last_d=false; } else { break; } }
+ * else { last_d=true; o++; } } if (o==length) { // must insert more
+ * operations before pos if (pos-cursor>0) addInsertion(pos-cursor);
+ * // then just add the new operation. Regardless of what it is.
+ * addOperation(op, range); } else { int diff = pos - cursor;
+ *
+ * int e_length = length-o; // new edit operation array length. //
+ * diff<0 - can only happen before first insertion or match. -
+ * affects op and all following // dif==0 - only when at first
+ * position of existing op - // diff>0 - must preserve some existing
+ * operations int[] e_range = new int[e_length];
+ * System.arraycopy(this.range, o, e_range, 0, e_length); char[] e_op
+ * = new char[e_length]; System.arraycopy(this.operation, o, e_op, 0,
+ * e_length); length = o; // can now use add_operation to extend
+ * list. int e_o=0; // current operation being edited. switch (op) {
+ * case M: switch (e_op[e_o]) { case M: if (last_d && diff <= 0) { //
+ * reduce D's, if possible if (range<=this.range[o-1]) { this.range[o
+ * - 1] -= range; } else { this.range[o-1]=0; } if
+ * (this.range[o-1]==0) o--; // lose this op. } e_range[e_o] +=
+ * range; // just add more matched residues break; case I: // change
+ * from insertion to match if (last_d && diff<=0) { // reduce D's, if
+ * possible if (range<=this.range[o-1]) { this.range[o - 1] -= range;
+ * } else { this.range[o-1]=0; } if (this.range[o-1]==0) o--; // lose
+ * this op. } e_range[e_o] break; default: throw new Inp }
+ *
+ * break; case I: break; case D: } break; default: throw new
+ * Error("Implementation Error: Unknown operation in addOperation!");
+ * } // finally, add remaining ops. while (e_o<e_length) {
+ * addOperation(e_op[e_o], e_range[e_o]); e_o++; } } }
+ */
+ /**
+ * Mark residues from start to end (inclusive) as deleted from the alignment,
+ * and removes any insertions.
+ *
+ * @param start
+ * int
+ * @param end
+ * int
+ * @return deleted int - number of symbols marked as deleted
+ */
+ public int deleteRange(int start, int end)
+ {
+ int deleted = 0;
+ if (length == 0)
+ {
+ // nothing to do here
+ return deleted;
+ }
+ if (start < 0 || start > end)
+ {
+ throw new Error(
+ "Implementation Error: deleteRange out of bounds: start must be non-negative and less than end.");
+ }
+ // find beginning
+ int cursor = 0; // mark the position for the current operation being edited.
+ int rlength = 1 + end - start; // number of positions to delete
+ int oldlen = length;
+ int o = 0;
+ boolean editing = false;
+ char[] oldops = operation;
+ int[] oldrange = range;
+ length = 0;
+ operation = null;
+ range = null;
+ compact_operations();
+ while (o < oldlen && cursor <= end && rlength > 0)
+ {
+ if (oldops[o] == D)
+ {
+ // absorbed into new deleted region.
+ addDeleted(oldrange[o++]);
+ continue;
+ }
+
+ int remain = oldrange[o]; // number of op characters left to edit
+ if (!editing)
+ {
+ if ((cursor + remain) <= start)
+ {
+ addOperation(oldops[o], oldrange[o]);
+ cursor += oldrange[o++];
+ continue; // next operation
+ }
+ editing = true;
+ // add operations before hidden region
+ if (start - cursor > 0)
+ {
+ addOperation(oldops[o], start - cursor);
+ remain -= start - cursor;
+ }
+ }
+ // start inserting new ops
+ if (o < oldlen && editing && rlength > 0 && remain > 0)
+ {
+ switch (oldops[o])
+ {
+ case M:
+ if (rlength > remain)
+ {
+ addDeleted(remain);
+ deleted += remain;
+ }
+ else
+ {
+ deleted += rlength;
+ addDeleted(rlength);
+ if (remain - rlength > 0)
+ {
+ this.addOperation(M, remain - rlength); // add remaining back.
+ }
+ rlength = 0;
+ remain = 0;
+ }
+ break;
+ case I:
+ if (remain - rlength > 0)
+ {
+ // only remove some gaps
+ addInsertion(remain - rlength);
+ rlength = 0;
+ }
+ break;
+ case D:
+ throw new Error("Implementation error."); // do nothing;
+ default:
+ throw new Error("Implementation Error! Unknown operation '"
+ + oldops[o] + "'");
+ }
+ rlength -= remain;
+ remain = oldrange[++o]; // number of op characters left to edit
+ }
+ }
+ // add remaining
+ while (o < oldlen)
+ {
+ addOperation(oldops[o], oldrange[o++]);
+ }
+ // if (cursor<(start+1)) {
+ // ran out of ops - nothing to do here ?
+ // addInsertion(start-cursor);
+ // }
+ return deleted;
+ }
+
+ /**
+ * Deleted regions mean that there will be discontinuous sequence numbering in
+ * the sequence returned by getSeq(char).
+ *
+ * @return true if there deletions
+ */
+ public boolean hasDeletedRegions()
+ {
+ for (int i = 0; i < length; i++)
+ {
+ if (operation[i] == D)
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * enumerate the ranges on seq that are marked as deleted in this cigar
+ *
+ * @return int[] { vis_start, sym_start, length }
+ */
+ public int[] getDeletedRegions()
+ {
+ if (length == 0)
+ {
+ return null;
+ }
+ Vector dr = new Vector();
+ int cursor = 0, vcursor = 0;
+ for (int i = 0; i < length; i++)
+ {
+ switch (operation[i])
+ {
+ case M:
+ cursor += range[i];
+ case I:
+ vcursor += range[i];
+ break;
+ case D:
+ dr.addElement(new int[]
+ { vcursor, cursor, range[i] });
+ cursor += range[i];
+ }
+ }
+ if (dr.size() == 0)
+ {
+ return null;
+ }
+ int[] delregions = new int[dr.size() * 3];
+ for (int i = 0, l = dr.size(); i < l; i++)
+ {
+ int[] reg = (int[]) dr.elementAt(i);
+ delregions[i * 3] = reg[0];
+ delregions[i * 3 + 1] = reg[1];
+ delregions[i * 3 + 2] = reg[2];
+ }
+ return delregions;
+ }
+
+ /**
+ * sum of ranges in cigar string
+ *
+ * @return int number of residues hidden, matched, or gaps inserted into
+ * sequence
+ */
+ public int getFullWidth()
+ {
+ int w = 0;
+ if (range != null)
+ {
+ for (int i = 0; i < length; i++)
+ {
+ w += range[i];
+ }
+ }
+ return w;
+ }
+
+ /**
+ * Visible length of aligned sequence
+ *
+ * @return int length of including gaps and less hidden regions
+ */
+ public int getWidth()
+ {
+ int w = 0;
+ if (range != null)
+ {
+ for (int i = 0; i < length; i++)
+ {
+ if (operation[i] == M || operation[i] == I)
+ {
+ w += range[i];
+ }
+ }
+ }
+ return w;
+ }
+
+ /**
+ * mark a range of inserted residues
+ *
+ * @param range
+ * int
+ */
+ public void addInsertion(int range)
+ {
+ this.addOperation(I, range);
+ }
+
+ /**
+ * mark the next range residues as hidden (not aligned) or deleted
+ *
+ * @param range
+ * int
+ */
+ public void addDeleted(int range)
+ {
+ this.addOperation(D, range);
+ }
+
+ /**
+ * Modifies operation list to delete columns from start to end (inclusive)
+ * editing will remove insertion operations, and convert matches to deletions
+ *
+ * @param start
+ * alignment column
+ * @param end
+ * alignment column
+ * @return boolean true if residues were marked as deleted. public boolean
+ * deleteRange(int start, int end) { boolean deleted = false; int op =
+ * 0, prevop = -1, firstm = -1, lastm = -1, postop = -1; int width =
+ * 0; // zero'th column if (length > 0) { // find operation bracketing
+ * start of the range do { if (operation[op] != D) { width +=
+ * range[prevop = op]; } op++; } while (op < length && width < start);
+ * } if (width < start) { // run off end - add more operations up to
+ * deletion. addInsertion(start - width); } else { // edit existing
+ * operations. op = prevop; width -= range[prevop]; int[] oldrange =
+ * range; char[] oldops = operation; range = new int[oldrange.length];
+ * operation = new char[oldops.length]; if (op < length) { do { if
+ * (operation[op] != D) { width += range[postop = op]; } op++; } while
+ * (op < length && width <= end); } } if (deleted == true) {
+ * addDeleted(end - start + 1); } return deleted; }
+ */
+ /**
+ * Return an ENSEMBL style cigar string where D may indicates excluded parts
+ * of seq
+ *
+ * @return String of form ([0-9]+[IMD])+
+ */
+ public String getCigarstring()
+ {
+ StringBuffer cigarString = new StringBuffer();
+ for (int i = 0; i < length; i++)
+ {
+ cigarString.append("" + range[i]);
+ cigarString.append(operation[i]);
+ }
+ return cigarString.toString();
+ }
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.datamodel;\r
-\r
-public class CigarCigar extends CigarSimple\r
-{\r
- SeqCigar refCigar;\r
-\r
- /**\r
- * Apply CIGAR operations to the result of another cigar\r
- * \r
- * @param cigar\r
- * 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\r
- * 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) ? "" : (String) getSequenceAndDeletions(\r
- refString, GapChar)[0];\r
- }\r
- else\r
- {\r
- return null;\r
- }\r
- }\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.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.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.datamodel;\r
-\r
-public abstract class CigarSimple extends CigarBase\r
-{\r
- /**\r
- * Return a symbol sequence with edits (gaps, insertions and deletions)\r
- * applied\r
- * \r
- * @param GapChar\r
- * char\r
- * @return String\r
- */\r
- public abstract String getSequenceString(char GapChar);\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.datamodel;
+
+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.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.datamodel;\r
-\r
-import java.util.*;\r
-\r
-import jalview.util.*;\r
-\r
-/**\r
- * NOTE: Columns are zero based.\r
- */\r
-public class ColumnSelection\r
-{\r
- Vector selected = new Vector();\r
-\r
- // Vector of int [] {startCol, endCol}\r
- Vector hiddenColumns;\r
-\r
- /**\r
- * Add a column to the selection\r
- * \r
- * @param col\r
- * index of column\r
- */\r
- public void addElement(int col)\r
- {\r
- Integer column = new Integer(col);\r
- if (!selected.contains(column))\r
- {\r
- selected.addElement(column);\r
- }\r
- }\r
-\r
- /**\r
- * clears column selection\r
- */\r
- public void clear()\r
- {\r
- selected.removeAllElements();\r
- }\r
-\r
- /**\r
- * removes col from selection\r
- * \r
- * @param col\r
- * index of column to be removed\r
- */\r
- public void removeElement(int col)\r
- {\r
- Integer colInt = new Integer(col);\r
-\r
- if (selected.contains(colInt))\r
- {\r
- selected.removeElement(colInt);\r
- }\r
- }\r
-\r
- /**\r
- * removes a range of columns from the selection\r
- * \r
- * @param start\r
- * int - first column in range to be removed\r
- * @param end\r
- * int - last col\r
- */\r
- public void removeElements(int start, int end)\r
- {\r
- Integer colInt;\r
- for (int i = start; i < end; i++)\r
- {\r
- colInt = new Integer(i);\r
- if (selected.contains(colInt))\r
- {\r
- selected.removeElement(colInt);\r
- }\r
- }\r
- }\r
-\r
- /**\r
- * \r
- * @return Vector containing selected columns as Integers\r
- */\r
- public Vector getSelected()\r
- {\r
- return selected;\r
- }\r
-\r
- /**\r
- * \r
- * @param col\r
- * index to search for in column selection\r
- * \r
- * @return true if Integer(col) is in selection.\r
- */\r
- public boolean contains(int col)\r
- {\r
- return selected.contains(new Integer(col));\r
- }\r
-\r
- /**\r
- * Column number at position i in selection\r
- * \r
- * @param i\r
- * index into selected columns\r
- * \r
- * @return column number in alignment\r
- */\r
- public int columnAt(int i)\r
- {\r
- return ((Integer) selected.elementAt(i)).intValue();\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- * \r
- * @return DOCUMENT ME!\r
- */\r
- public int size()\r
- {\r
- return selected.size();\r
- }\r
-\r
- /**\r
- * rightmost selected column\r
- * \r
- * @return rightmost column in alignment that is selected\r
- */\r
- public int getMax()\r
- {\r
- int max = -1;\r
-\r
- for (int i = 0; i < selected.size(); i++)\r
- {\r
- if (columnAt(i) > max)\r
- {\r
- max = columnAt(i);\r
- }\r
- }\r
-\r
- return max;\r
- }\r
-\r
- /**\r
- * Leftmost column in selection\r
- * \r
- * @return column index of leftmost column in selection\r
- */\r
- public int getMin()\r
- {\r
- int min = 1000000000;\r
-\r
- for (int i = 0; i < selected.size(); i++)\r
- {\r
- if (columnAt(i) < min)\r
- {\r
- min = columnAt(i);\r
- }\r
- }\r
-\r
- return min;\r
- }\r
-\r
- /**\r
- * propagate shift in alignment columns to column selection\r
- * \r
- * @param start\r
- * beginning of edit\r
- * @param left\r
- * shift in edit (+ve for removal, or -ve for inserts)\r
- */\r
- public Vector compensateForEdit(int start, int change)\r
- {\r
- Vector deletedHiddenColumns = null;\r
- for (int i = 0; i < size(); i++)\r
- {\r
- int temp = columnAt(i);\r
-\r
- if (temp >= start)\r
- {\r
- selected.setElementAt(new Integer(temp - change), i);\r
- }\r
- }\r
-\r
- if (hiddenColumns != null)\r
- {\r
- deletedHiddenColumns = new Vector();\r
- int hSize = hiddenColumns.size();\r
- for (int i = 0; i < hSize; i++)\r
- {\r
- int[] region = (int[]) hiddenColumns.elementAt(i);\r
- if (region[0] > start && start + change > region[1])\r
- {\r
- deletedHiddenColumns.addElement(hiddenColumns.elementAt(i));\r
-\r
- hiddenColumns.removeElementAt(i);\r
- i--;\r
- hSize--;\r
- continue;\r
- }\r
-\r
- if (region[0] > start)\r
- {\r
- region[0] -= change;\r
- region[1] -= change;\r
- }\r
-\r
- if (region[0] < 0)\r
- {\r
- region[0] = 0;\r
- }\r
-\r
- }\r
-\r
- this.revealHiddenColumns(0);\r
- }\r
-\r
- return deletedHiddenColumns;\r
- }\r
-\r
- /**\r
- * propagate shift in alignment columns to column selection special version of\r
- * compensateForEdit - allowing for edits within hidden regions\r
- * \r
- * @param start\r
- * beginning of edit\r
- * @param left\r
- * shift in edit (+ve for removal, or -ve for inserts)\r
- */\r
- private void compensateForDelEdits(int start, int change)\r
- {\r
- for (int i = 0; i < size(); i++)\r
- {\r
- int temp = columnAt(i);\r
-\r
- if (temp >= start)\r
- {\r
- selected.setElementAt(new Integer(temp - change), i);\r
- }\r
- }\r
-\r
- if (hiddenColumns != null)\r
- {\r
- for (int i = 0; i < hiddenColumns.size(); i++)\r
- {\r
- int[] region = (int[]) hiddenColumns.elementAt(i);\r
- if (region[0] >= start)\r
- {\r
- region[0] -= change;\r
- }\r
- if (region[1] >= start)\r
- {\r
- region[1] -= change;\r
- }\r
- if (region[1] < region[0])\r
- {\r
- hiddenColumns.removeElementAt(i--);\r
- }\r
-\r
- if (region[0] < 0)\r
- {\r
- region[0] = 0;\r
- }\r
- if (region[1] < 0)\r
- {\r
- region[1] = 0;\r
- }\r
- }\r
- }\r
- }\r
-\r
- /**\r
- * Adjust hidden column boundaries based on a series of column additions or\r
- * deletions in visible regions.\r
- * \r
- * @param shiftrecord\r
- * @return\r
- */\r
- public ShiftList compensateForEdits(ShiftList shiftrecord)\r
- {\r
- if (shiftrecord != null)\r
- {\r
- Vector shifts = shiftrecord.shifts;\r
- if (shifts != null && shifts.size() > 0)\r
- {\r
- int shifted = 0;\r
- for (int i = 0, j = shifts.size(); i < j; i++)\r
- {\r
- int[] sh = (int[]) shifts.elementAt(i);\r
- // compensateForEdit(shifted+sh[0], sh[1]);\r
- compensateForDelEdits(shifted + sh[0], sh[1]);\r
- shifted -= sh[1];\r
- }\r
- }\r
- return shiftrecord.getInverse();\r
- }\r
- return null;\r
- }\r
-\r
- /**\r
- * removes intersection of position,length ranges in deletions from the\r
- * start,end regions marked in intervals.\r
- * \r
- * @param deletions\r
- * @param intervals\r
- * @return\r
- */\r
- private boolean pruneIntervalVector(Vector deletions, Vector intervals)\r
- {\r
- boolean pruned = false;\r
- int i = 0, j = intervals.size() - 1, s = 0, t = deletions.size() - 1;\r
- int hr[] = (int[]) intervals.elementAt(i);\r
- int sr[] = (int[]) deletions.elementAt(s);\r
- while (i <= j && s <= t)\r
- {\r
- boolean trailinghn = hr[1] >= sr[0];\r
- if (!trailinghn)\r
- {\r
- if (i < j)\r
- {\r
- hr = (int[]) intervals.elementAt(++i);\r
- }\r
- else\r
- {\r
- i++;\r
- }\r
- continue;\r
- }\r
- int endshift = sr[0] + sr[1]; // deletion ranges - -ve means an insert\r
- if (endshift < hr[0] || endshift < sr[0])\r
- { // leadinghc disjoint or not a deletion\r
- if (s < t)\r
- {\r
- sr = (int[]) deletions.elementAt(++s);\r
- }\r
- else\r
- {\r
- s++;\r
- }\r
- continue;\r
- }\r
- boolean leadinghn = hr[0] >= sr[0];\r
- boolean leadinghc = hr[0] < endshift;\r
- boolean trailinghc = hr[1] < endshift;\r
- if (leadinghn)\r
- {\r
- if (trailinghc)\r
- { // deleted hidden region.\r
- intervals.removeElementAt(i);\r
- pruned = true;\r
- j--;\r
- if (i <= j)\r
- {\r
- hr = (int[]) intervals.elementAt(i);\r
- }\r
- continue;\r
- }\r
- if (leadinghc)\r
- {\r
- hr[0] = endshift; // clip c terminal region\r
- leadinghn = !leadinghn;\r
- pruned = true;\r
- }\r
- }\r
- if (!leadinghn)\r
- {\r
- if (trailinghc)\r
- {\r
- if (trailinghn)\r
- {\r
- hr[1] = sr[0] - 1;\r
- pruned = true;\r
- }\r
- }\r
- else\r
- {\r
- // sr contained in hr\r
- if (s < t)\r
- {\r
- sr = (int[]) deletions.elementAt(++s);\r
- }\r
- else\r
- {\r
- s++;\r
- }\r
- continue;\r
- }\r
- }\r
- }\r
- return pruned; // true if any interval was removed or modified by\r
- // operations.\r
- }\r
-\r
- private boolean pruneColumnList(Vector deletion, Vector list)\r
- {\r
- int s = 0, t = deletion.size();\r
- int[] sr = (int[]) list.elementAt(s++);\r
- boolean pruned = false;\r
- int i = 0, j = list.size();\r
- while (i < j && s <= t)\r
- {\r
- int c = ((Integer) list.elementAt(i++)).intValue();\r
- if (sr[0] <= c)\r
- {\r
- if (sr[1] + sr[0] >= c)\r
- { // sr[1] -ve means inseriton.\r
- list.removeElementAt(--i);\r
- j--;\r
- }\r
- else\r
- {\r
- if (s < t)\r
- {\r
- sr = (int[]) deletion.elementAt(s);\r
- }\r
- s++;\r
- }\r
- }\r
- }\r
- return pruned;\r
- }\r
-\r
- /**\r
- * remove any hiddenColumns or selected columns and shift remaining based on a\r
- * series of position, range deletions.\r
- * \r
- * @param deletions\r
- */\r
- public void pruneDeletions(ShiftList deletions)\r
- {\r
- if (deletions != null)\r
- {\r
- Vector shifts = deletions.shifts;\r
- if (shifts != null && shifts.size() > 0)\r
- {\r
- // delete any intervals intersecting.\r
- if (hiddenColumns != null)\r
- {\r
- pruneIntervalVector(shifts, hiddenColumns);\r
- if (hiddenColumns != null && hiddenColumns.size() == 0)\r
- {\r
- hiddenColumns = null;\r
- }\r
- }\r
- if (selected != null && selected.size() > 0)\r
- {\r
- pruneColumnList(shifts, selected);\r
- if (selected != null && selected.size() == 0)\r
- {\r
- selected = null;\r
- }\r
- }\r
- // and shift the rest.\r
- this.compensateForEdits(deletions);\r
- }\r
- }\r
- }\r
-\r
- /**\r
- * This Method is used to return all the HiddenColumn regions less than the\r
- * given index.\r
- * \r
- * @param end\r
- * int\r
- * @return Vector\r
- */\r
- public Vector getHiddenColumns()\r
- {\r
- return hiddenColumns;\r
- }\r
-\r
- /**\r
- * Return absolute column index for a visible column index\r
- * \r
- * @param column\r
- * int column index in alignment view\r
- * @return alignment column index for column\r
- */\r
- public int adjustForHiddenColumns(int column)\r
- {\r
- int result = column;\r
- if (hiddenColumns != null)\r
- {\r
- for (int i = 0; i < hiddenColumns.size(); i++)\r
- {\r
- int[] region = (int[]) hiddenColumns.elementAt(i);\r
- if (result >= region[0])\r
- {\r
- result += region[1] - region[0] + 1;\r
- }\r
- }\r
- }\r
- return result;\r
- }\r
-\r
- /**\r
- * Use this method to find out where a column will appear in the visible\r
- * alignment when hidden columns exist. If the column is not visible, then the\r
- * left-most visible column will always be returned.\r
- * \r
- * @param hiddenColumn\r
- * int\r
- * @return int\r
- */\r
- public int findColumnPosition(int hiddenColumn)\r
- {\r
- int result = hiddenColumn;\r
- if (hiddenColumns != null)\r
- {\r
- int index = 0;\r
- int[] region;\r
- do\r
- {\r
- region = (int[]) hiddenColumns.elementAt(index++);\r
- if (hiddenColumn > region[1])\r
- {\r
- result -= region[1] + 1 - region[0];\r
- }\r
- } while ((hiddenColumn > region[1]) && (index < hiddenColumns.size()));\r
- if (hiddenColumn > region[0] && hiddenColumn < region[1])\r
- {\r
- return region[0] + hiddenColumn - result;\r
- }\r
- }\r
- return result; // return the shifted position after removing hidden columns.\r
- }\r
-\r
- /**\r
- * Use this method to determine where the next hiddenRegion starts\r
- */\r
- public int findHiddenRegionPosition(int hiddenRegion)\r
- {\r
- int result = 0;\r
- if (hiddenColumns != null)\r
- {\r
- int index = 0;\r
- int gaps = 0;\r
- do\r
- {\r
- int[] region = (int[]) hiddenColumns.elementAt(index);\r
- if (hiddenRegion == 0)\r
- {\r
- return region[0];\r
- }\r
-\r
- gaps += region[1] + 1 - region[0];\r
- result = region[1] + 1;\r
- index++;\r
- } while (index < hiddenRegion + 1);\r
-\r
- result -= gaps;\r
- }\r
-\r
- return result;\r
- }\r
-\r
- /**\r
- * THis method returns the rightmost limit of a region of an alignment with\r
- * hidden columns. In otherwords, the next hidden column.\r
- * \r
- * @param index\r
- * int\r
- */\r
- public int getHiddenBoundaryRight(int alPos)\r
- {\r
- if (hiddenColumns != null)\r
- {\r
- int index = 0;\r
- do\r
- {\r
- int[] region = (int[]) hiddenColumns.elementAt(index);\r
- if (alPos < region[0])\r
- {\r
- return region[0];\r
- }\r
-\r
- index++;\r
- } while (index < hiddenColumns.size());\r
- }\r
-\r
- return alPos;\r
-\r
- }\r
-\r
- /**\r
- * This method returns the leftmost limit of a region of an alignment with\r
- * hidden columns. In otherwords, the previous hidden column.\r
- * \r
- * @param index\r
- * int\r
- */\r
- public int getHiddenBoundaryLeft(int alPos)\r
- {\r
- if (hiddenColumns != null)\r
- {\r
- int index = hiddenColumns.size() - 1;\r
- do\r
- {\r
- int[] region = (int[]) hiddenColumns.elementAt(index);\r
- if (alPos > region[1])\r
- {\r
- return region[1];\r
- }\r
-\r
- index--;\r
- } while (index > -1);\r
- }\r
-\r
- return alPos;\r
-\r
- }\r
-\r
- public void hideSelectedColumns()\r
- {\r
- while (size() > 0)\r
- {\r
- int column = ((Integer) getSelected().firstElement()).intValue();\r
- hideColumns(column);\r
- }\r
-\r
- }\r
-\r
- public void hideColumns(int start, int end)\r
- {\r
- if (hiddenColumns == null)\r
- {\r
- hiddenColumns = new Vector();\r
- }\r
-\r
- boolean added = false;\r
- boolean overlap = false;\r
-\r
- for (int i = 0; i < hiddenColumns.size(); i++)\r
- {\r
- int[] region = (int[]) hiddenColumns.elementAt(i);\r
- if (start <= region[1] && end >= region[0])\r
- {\r
- hiddenColumns.removeElementAt(i);\r
- overlap = true;\r
- break;\r
- }\r
- else if (end < region[0] && start < region[0])\r
- {\r
- hiddenColumns.insertElementAt(new int[]\r
- { start, end }, i);\r
- added = true;\r
- break;\r
- }\r
- }\r
-\r
- if (overlap)\r
- {\r
- hideColumns(start, end);\r
- }\r
- else if (!added)\r
- {\r
- hiddenColumns.addElement(new int[]\r
- { start, end });\r
- }\r
-\r
- }\r
-\r
- /**\r
- * This method will find a range of selected columns around the column\r
- * specified\r
- * \r
- * @param res\r
- * int\r
- */\r
- public void hideColumns(int col)\r
- {\r
- // First find out range of columns to hide\r
- int min = col, max = col + 1;\r
- while (contains(min))\r
- {\r
- removeElement(min);\r
- min--;\r
- }\r
-\r
- while (contains(max))\r
- {\r
- removeElement(max);\r
- max++;\r
- }\r
-\r
- min++;\r
- max--;\r
- if (min > max)\r
- {\r
- min = max;\r
- }\r
-\r
- hideColumns(min, max);\r
- }\r
-\r
- public void revealAllHiddenColumns()\r
- {\r
- if (hiddenColumns != null)\r
- {\r
- for (int i = 0; i < hiddenColumns.size(); i++)\r
- {\r
- int[] region = (int[]) hiddenColumns.elementAt(i);\r
- for (int j = region[0]; j < region[1] + 1; j++)\r
- {\r
- addElement(j);\r
- }\r
- }\r
- }\r
-\r
- hiddenColumns = null;\r
- }\r
-\r
- public void revealHiddenColumns(int res)\r
- {\r
- for (int i = 0; i < hiddenColumns.size(); i++)\r
- {\r
- int[] region = (int[]) hiddenColumns.elementAt(i);\r
- if (res == region[0])\r
- {\r
- for (int j = region[0]; j < region[1] + 1; j++)\r
- {\r
- addElement(j);\r
- }\r
-\r
- hiddenColumns.removeElement(region);\r
- break;\r
- }\r
- }\r
- if (hiddenColumns.size() == 0)\r
- {\r
- hiddenColumns = null;\r
- }\r
- }\r
-\r
- public boolean isVisible(int column)\r
- {\r
- if (hiddenColumns != null)\r
- for (int i = 0; i < hiddenColumns.size(); i++)\r
- {\r
- int[] region = (int[]) hiddenColumns.elementAt(i);\r
- if (column >= region[0] && column <= region[1])\r
- {\r
- return false;\r
- }\r
- }\r
-\r
- return true;\r
- }\r
-\r
- /**\r
- * Copy constructor\r
- * \r
- * @param copy\r
- */\r
- public ColumnSelection(ColumnSelection copy)\r
- {\r
- if (copy != null)\r
- {\r
- if (copy.selected != null)\r
- {\r
- selected = new Vector();\r
- for (int i = 0, j = copy.selected.size(); i < j; i++)\r
- {\r
- selected.addElement(copy.selected.elementAt(i));\r
- }\r
- }\r
- if (copy.hiddenColumns != null)\r
- {\r
- hiddenColumns = new Vector(copy.hiddenColumns.size());\r
- for (int i = 0, j = copy.hiddenColumns.size(); i < j; i++)\r
- {\r
- int[] rh, cp;\r
- rh = (int[]) copy.hiddenColumns.elementAt(i);\r
- if (rh != null)\r
- {\r
- cp = new int[rh.length];\r
- System.arraycopy(rh, 0, cp, 0, rh.length);\r
- hiddenColumns.addElement(cp);\r
- }\r
- }\r
- }\r
- }\r
- }\r
-\r
- /**\r
- * ColumnSelection\r
- */\r
- public ColumnSelection()\r
- {\r
- }\r
-\r
- public String[] getVisibleSequenceStrings(int start, int end,\r
- SequenceI[] seqs)\r
- {\r
- int i, iSize = seqs.length;\r
- String selection[] = new String[iSize];\r
- if (hiddenColumns != null && hiddenColumns.size() > 0)\r
- {\r
- for (i = 0; i < iSize; i++)\r
- {\r
- StringBuffer visibleSeq = new StringBuffer();\r
- Vector regions = getHiddenColumns();\r
-\r
- int blockStart = start, blockEnd = end;\r
- int[] region;\r
- int hideStart, hideEnd;\r
-\r
- for (int j = 0; j < regions.size(); j++)\r
- {\r
- region = (int[]) regions.elementAt(j);\r
- hideStart = region[0];\r
- hideEnd = region[1];\r
-\r
- if (hideStart < start)\r
- {\r
- continue;\r
- }\r
-\r
- blockStart = Math.min(blockStart, hideEnd + 1);\r
- blockEnd = Math.min(blockEnd, hideStart);\r
-\r
- if (blockStart > blockEnd)\r
- {\r
- break;\r
- }\r
-\r
- visibleSeq.append(seqs[i].getSequence(blockStart, blockEnd));\r
-\r
- blockStart = hideEnd + 1;\r
- blockEnd = end;\r
- }\r
-\r
- if (end > blockStart)\r
- {\r
- visibleSeq.append(seqs[i].getSequence(blockStart, end));\r
- }\r
-\r
- selection[i] = visibleSeq.toString();\r
- }\r
- }\r
- else\r
- {\r
- for (i = 0; i < iSize; i++)\r
- {\r
- selection[i] = seqs[i].getSequenceAsString(start, end);\r
- }\r
- }\r
-\r
- return selection;\r
- }\r
-\r
- /**\r
- * return all visible segments between the given start and end boundaries\r
- * \r
- * @param start\r
- * (first column inclusive from 0)\r
- * @param end\r
- * (last column - not inclusive)\r
- * @return int[] {i_start, i_end, ..} where intervals lie in\r
- * start<=i_start<=i_end<end\r
- */\r
- public int[] getVisibleContigs(int start, int end)\r
- {\r
- if (hiddenColumns != null && hiddenColumns.size() > 0)\r
- {\r
- Vector visiblecontigs = new Vector();\r
- Vector regions = getHiddenColumns();\r
-\r
- int vstart = start;\r
- int[] region;\r
- int hideStart, hideEnd;\r
-\r
- for (int j = 0; vstart < end && j < regions.size(); j++)\r
- {\r
- region = (int[]) regions.elementAt(j);\r
- hideStart = region[0];\r
- hideEnd = region[1];\r
-\r
- if (hideEnd < vstart)\r
- {\r
- continue;\r
- }\r
- if (hideStart > vstart)\r
- {\r
- visiblecontigs.addElement(new int[]\r
- { vstart, hideStart - 1 });\r
- }\r
- vstart = hideEnd + 1;\r
- }\r
-\r
- if (vstart < end)\r
- {\r
- visiblecontigs.addElement(new int[]\r
- { vstart, end - 1 });\r
- }\r
- int[] vcontigs = new int[visiblecontigs.size() * 2];\r
- for (int i = 0, j = visiblecontigs.size(); i < j; i++)\r
- {\r
- int[] vc = (int[]) visiblecontigs.elementAt(i);\r
- visiblecontigs.setElementAt(null, i);\r
- vcontigs[i * 2] = vc[0];\r
- vcontigs[i * 2 + 1] = vc[1];\r
- }\r
- visiblecontigs.removeAllElements();\r
- return vcontigs;\r
- }\r
- else\r
- {\r
- return new int[]\r
- { start, end - 1 };\r
- }\r
- }\r
-\r
- /**\r
- * delete any columns in alignmentAnnotation that are hidden (including\r
- * sequence associated annotation).\r
- * \r
- * @param alignmentAnnotation\r
- */\r
- public void makeVisibleAnnotation(AlignmentAnnotation alignmentAnnotation)\r
- {\r
- makeVisibleAnnotation(-1, -1, alignmentAnnotation);\r
- }\r
-\r
- /**\r
- * delete any columns in alignmentAnnotation that are hidden (including\r
- * sequence associated annotation).\r
- * \r
- * @param start\r
- * remove any annotation to the right of this column\r
- * @param end\r
- * remove any annotation to the left of this column\r
- * @param alignmentAnnotation\r
- * the annotation to operate on\r
- */\r
- public void makeVisibleAnnotation(int start, int end,\r
- AlignmentAnnotation alignmentAnnotation)\r
- {\r
- if (alignmentAnnotation.annotations == null)\r
- {\r
- return;\r
- }\r
- if (start == end && end == -1)\r
- {\r
- start = 0;\r
- end = alignmentAnnotation.annotations.length;\r
- }\r
- if (hiddenColumns != null && hiddenColumns.size() > 0)\r
- {\r
- // then mangle the alignmentAnnotation annotation array\r
- Vector annels = new Vector();\r
- Annotation[] els = null;\r
- Vector regions = getHiddenColumns();\r
- int blockStart = start, blockEnd = end;\r
- int[] region;\r
- int hideStart, hideEnd, w = 0;\r
-\r
- for (int j = 0; j < regions.size(); j++)\r
- {\r
- region = (int[]) regions.elementAt(j);\r
- hideStart = region[0];\r
- hideEnd = region[1];\r
-\r
- if (hideStart < start)\r
- {\r
- continue;\r
- }\r
-\r
- blockStart = Math.min(blockStart, hideEnd + 1);\r
- blockEnd = Math.min(blockEnd, hideStart);\r
-\r
- if (blockStart > blockEnd)\r
- {\r
- break;\r
- }\r
-\r
- annels.addElement(els = new Annotation[blockEnd - blockStart]);\r
- System.arraycopy(alignmentAnnotation.annotations, blockStart, els,\r
- 0, els.length);\r
- w += els.length;\r
- blockStart = hideEnd + 1;\r
- blockEnd = end;\r
- }\r
-\r
- if (end > blockStart)\r
- {\r
- annels.addElement(els = new Annotation[end - blockStart + 1]);\r
- if ((els.length + blockStart) <= alignmentAnnotation.annotations.length)\r
- {\r
- // copy just the visible segment of the annotation row\r
- System.arraycopy(alignmentAnnotation.annotations, blockStart,\r
- els, 0, els.length);\r
- }\r
- else\r
- {\r
- // copy to the end of the annotation row\r
- System.arraycopy(alignmentAnnotation.annotations, blockStart,\r
- els, 0,\r
- (alignmentAnnotation.annotations.length - blockStart));\r
- }\r
- w += els.length;\r
- }\r
- if (w == 0)\r
- return;\r
- Enumeration e = annels.elements();\r
- alignmentAnnotation.annotations = new Annotation[w];\r
- w = 0;\r
- while (e.hasMoreElements())\r
- {\r
- Annotation[] chnk = (Annotation[]) e.nextElement();\r
- System.arraycopy(chnk, 0, alignmentAnnotation.annotations, w,\r
- chnk.length);\r
- w += chnk.length;\r
- }\r
- }\r
- else\r
- {\r
- alignmentAnnotation.restrict(start, end);\r
- }\r
- }\r
-\r
- /**\r
- * Invert the column selection from first to end-1. leaves hiddenColumns\r
- * untouched (and unselected)\r
- * \r
- * @param first\r
- * @param end\r
- */\r
- public void invertColumnSelection(int first, int width)\r
- {\r
- boolean hasHidden = hiddenColumns != null && hiddenColumns.size() > 0;\r
- for (int i = first; i < width; i++)\r
- {\r
- if (contains(i))\r
- {\r
- removeElement(i);\r
- }\r
- else\r
- {\r
- if (!hasHidden || isVisible(i))\r
- {\r
- addElement(i);\r
- }\r
- }\r
- }\r
- }\r
-\r
- /**\r
- * add in any unselected columns from the given column selection, excluding\r
- * any that are hidden.\r
- * \r
- * @param colsel\r
- */\r
- public void addElementsFrom(ColumnSelection colsel)\r
- {\r
- if (colsel != null && colsel.size() > 0)\r
- {\r
- Enumeration e = colsel.getSelected().elements();\r
- while (e.hasMoreElements())\r
- {\r
- Object eo = e.nextElement();\r
- if (hiddenColumns != null && isVisible(((Integer) eo).intValue()))\r
- {\r
- if (!selected.contains(eo))\r
- {\r
- selected.addElement(eo);\r
- }\r
- }\r
- }\r
- }\r
- }\r
-\r
- /**\r
- * set the selected columns the given column selection, excluding any columns\r
- * that are hidden.\r
- * \r
- * @param colsel\r
- */\r
- public void setElementsFrom(ColumnSelection colsel)\r
- {\r
- selected = new Vector();\r
- if (colsel.selected != null && colsel.selected.size() > 0)\r
- {\r
- if (hiddenColumns != null && hiddenColumns.size() > 0)\r
- {\r
- // only select visible columns in this columns selection\r
- selected = new Vector();\r
- addElementsFrom(colsel);\r
- }\r
- else\r
- {\r
- // add everything regardless\r
- Enumeration en = colsel.selected.elements();\r
- while (en.hasMoreElements())\r
- {\r
- selected.addElement(en.nextElement());\r
- }\r
- }\r
- }\r
- }\r
-\r
- /**\r
- * Add gaps into the sequences aligned to profileseq under the given\r
- * AlignmentView\r
- * \r
- * @param profileseq\r
- * @param al\r
- * - alignment to have gaps inserted into it\r
- * @param input\r
- * - alignment view where sequence corresponding to profileseq is\r
- * first entry\r
- * @return new Column selection for new alignment view, with insertions into\r
- * profileseq marked as hidden.\r
- */\r
- public static ColumnSelection propagateInsertions(SequenceI profileseq,\r
- Alignment al, AlignmentView input)\r
- {\r
- int profsqpos = 0;\r
-\r
- // return propagateInsertions(profileseq, al, )\r
- char gc = al.getGapCharacter();\r
- Object[] alandcolsel = input.getAlignmentAndColumnSelection(gc);\r
- ColumnSelection nview = (ColumnSelection) alandcolsel[1];\r
- SequenceI origseq = ((SequenceI[]) alandcolsel[0])[profsqpos];\r
- nview.propagateInsertions(profileseq, al, origseq);\r
- return nview;\r
- }\r
-\r
- /**\r
- * \r
- * @param profileseq\r
- * - sequence in al which corresponds to origseq\r
- * @param al\r
- * - alignment which is to have gaps inserted into it\r
- * @param origseq\r
- * - sequence corresponding to profileseq which defines gap map for\r
- * modifying al\r
- */\r
- public void propagateInsertions(SequenceI profileseq, AlignmentI al,\r
- SequenceI origseq)\r
- {\r
- char gc = al.getGapCharacter();\r
- // recover mapping between sequence's non-gap positions and positions\r
- // mapping to view.\r
- pruneDeletions(ShiftList.parseMap(origseq.gapMap()));\r
- int[] viscontigs = getVisibleContigs(0, profileseq.getLength());\r
- int spos = 0;\r
- int offset = 0;\r
- // input.pruneDeletions(ShiftList.parseMap(((SequenceI[])\r
- // alandcolsel[0])[0].gapMap()))\r
- // add profile to visible contigs\r
- for (int v = 0; v < viscontigs.length; v += 2)\r
- {\r
- if (viscontigs[v] > spos)\r
- {\r
- StringBuffer sb = new StringBuffer();\r
- for (int s = 0, ns = viscontigs[v] - spos; s < ns; s++)\r
- {\r
- sb.append(gc);\r
- }\r
- for (int s = 0, ns = al.getHeight(); s < ns; s++)\r
- {\r
- SequenceI sqobj = al.getSequenceAt(s);\r
- if (sqobj != profileseq)\r
- {\r
- String sq = al.getSequenceAt(s).getSequenceAsString();\r
- if (sq.length() <= spos + offset)\r
- {\r
- // pad sequence\r
- int diff = spos + offset - sq.length() - 1;\r
- if (diff > 0)\r
- {\r
- // pad gaps\r
- sq = sq + sb;\r
- while ((diff = spos + offset - sq.length() - 1) > 0)\r
- {\r
- // sq = sq\r
- // + ((diff >= sb.length()) ? sb.toString() : sb\r
- // .substring(0, diff));\r
- if (diff >= sb.length())\r
- {\r
- sq += sb.toString();\r
- }\r
- else\r
- {\r
- char[] buf = new char[diff];\r
- sb.getChars(0, diff, buf, 0);\r
- sq += buf.toString();\r
- }\r
- }\r
- }\r
- sq += sb.toString();\r
- }\r
- else\r
- {\r
- al.getSequenceAt(s).setSequence(\r
- sq.substring(0, spos + offset) + sb.toString()\r
- + sq.substring(spos + offset));\r
- }\r
- }\r
- }\r
- // offset+=sb.length();\r
- }\r
- spos = viscontigs[v + 1] + 1;\r
- }\r
- if ((offset + spos) < profileseq.getLength())\r
- {\r
- // pad the final region with gaps.\r
- StringBuffer sb = new StringBuffer();\r
- for (int s = 0, ns = profileseq.getLength() - spos - offset; s < ns; s++)\r
- {\r
- sb.append(gc);\r
- }\r
- for (int s = 0, ns = al.getHeight(); s < ns; s++)\r
- {\r
- SequenceI sqobj = al.getSequenceAt(s);\r
- if (sqobj == profileseq)\r
- {\r
- continue;\r
- }\r
- String sq = sqobj.getSequenceAsString();\r
- // pad sequence\r
- int diff = origseq.getLength() - sq.length();\r
- while (diff > 0)\r
- {\r
- // sq = sq\r
- // + ((diff >= sb.length()) ? sb.toString() : sb\r
- // .substring(0, diff));\r
- if (diff >= sb.length())\r
- {\r
- sq += sb.toString();\r
- }\r
- else\r
- {\r
- char[] buf = new char[diff];\r
- sb.getChars(0, diff, buf, 0);\r
- sq += buf.toString();\r
- }\r
- diff = origseq.getLength() - sq.length();\r
- }\r
- }\r
- }\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.datamodel;
+
+import java.util.*;
+
+import jalview.util.*;
+
+/**
+ * NOTE: Columns are zero based.
+ */
+public class ColumnSelection
+{
+ Vector selected = new Vector();
+
+ // Vector of int [] {startCol, endCol}
+ Vector hiddenColumns;
+
+ /**
+ * Add a column to the selection
+ *
+ * @param col
+ * index of column
+ */
+ public void addElement(int col)
+ {
+ Integer column = new Integer(col);
+ if (!selected.contains(column))
+ {
+ selected.addElement(column);
+ }
+ }
+
+ /**
+ * clears column selection
+ */
+ public void clear()
+ {
+ selected.removeAllElements();
+ }
+
+ /**
+ * removes col from selection
+ *
+ * @param col
+ * index of column to be removed
+ */
+ public void removeElement(int col)
+ {
+ Integer colInt = new Integer(col);
+
+ if (selected.contains(colInt))
+ {
+ selected.removeElement(colInt);
+ }
+ }
+
+ /**
+ * removes a range of columns from the selection
+ *
+ * @param start
+ * int - first column in range to be removed
+ * @param end
+ * int - last col
+ */
+ public void removeElements(int start, int end)
+ {
+ Integer colInt;
+ for (int i = start; i < end; i++)
+ {
+ colInt = new Integer(i);
+ if (selected.contains(colInt))
+ {
+ selected.removeElement(colInt);
+ }
+ }
+ }
+
+ /**
+ *
+ * @return Vector containing selected columns as Integers
+ */
+ public Vector getSelected()
+ {
+ return selected;
+ }
+
+ /**
+ *
+ * @param col
+ * index to search for in column selection
+ *
+ * @return true if Integer(col) is in selection.
+ */
+ public boolean contains(int col)
+ {
+ return selected.contains(new Integer(col));
+ }
+
+ /**
+ * Column number at position i in selection
+ *
+ * @param i
+ * index into selected columns
+ *
+ * @return column number in alignment
+ */
+ public int columnAt(int i)
+ {
+ return ((Integer) selected.elementAt(i)).intValue();
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public int size()
+ {
+ return selected.size();
+ }
+
+ /**
+ * rightmost selected column
+ *
+ * @return rightmost column in alignment that is selected
+ */
+ public int getMax()
+ {
+ int max = -1;
+
+ for (int i = 0; i < selected.size(); i++)
+ {
+ if (columnAt(i) > max)
+ {
+ max = columnAt(i);
+ }
+ }
+
+ return max;
+ }
+
+ /**
+ * Leftmost column in selection
+ *
+ * @return column index of leftmost column in selection
+ */
+ public int getMin()
+ {
+ int min = 1000000000;
+
+ for (int i = 0; i < selected.size(); i++)
+ {
+ if (columnAt(i) < min)
+ {
+ min = columnAt(i);
+ }
+ }
+
+ return min;
+ }
+
+ /**
+ * propagate shift in alignment columns to column selection
+ *
+ * @param start
+ * beginning of edit
+ * @param left
+ * shift in edit (+ve for removal, or -ve for inserts)
+ */
+ public Vector compensateForEdit(int start, int change)
+ {
+ Vector deletedHiddenColumns = null;
+ for (int i = 0; i < size(); i++)
+ {
+ int temp = columnAt(i);
+
+ if (temp >= start)
+ {
+ selected.setElementAt(new Integer(temp - change), i);
+ }
+ }
+
+ if (hiddenColumns != null)
+ {
+ deletedHiddenColumns = new Vector();
+ int hSize = hiddenColumns.size();
+ for (int i = 0; i < hSize; i++)
+ {
+ int[] region = (int[]) hiddenColumns.elementAt(i);
+ if (region[0] > start && start + change > region[1])
+ {
+ deletedHiddenColumns.addElement(hiddenColumns.elementAt(i));
+
+ hiddenColumns.removeElementAt(i);
+ i--;
+ hSize--;
+ continue;
+ }
+
+ if (region[0] > start)
+ {
+ region[0] -= change;
+ region[1] -= change;
+ }
+
+ if (region[0] < 0)
+ {
+ region[0] = 0;
+ }
+
+ }
+
+ this.revealHiddenColumns(0);
+ }
+
+ return deletedHiddenColumns;
+ }
+
+ /**
+ * propagate shift in alignment columns to column selection special version of
+ * compensateForEdit - allowing for edits within hidden regions
+ *
+ * @param start
+ * beginning of edit
+ * @param left
+ * shift in edit (+ve for removal, or -ve for inserts)
+ */
+ private void compensateForDelEdits(int start, int change)
+ {
+ for (int i = 0; i < size(); i++)
+ {
+ int temp = columnAt(i);
+
+ if (temp >= start)
+ {
+ selected.setElementAt(new Integer(temp - change), i);
+ }
+ }
+
+ if (hiddenColumns != null)
+ {
+ for (int i = 0; i < hiddenColumns.size(); i++)
+ {
+ int[] region = (int[]) hiddenColumns.elementAt(i);
+ if (region[0] >= start)
+ {
+ region[0] -= change;
+ }
+ if (region[1] >= start)
+ {
+ region[1] -= change;
+ }
+ if (region[1] < region[0])
+ {
+ hiddenColumns.removeElementAt(i--);
+ }
+
+ if (region[0] < 0)
+ {
+ region[0] = 0;
+ }
+ if (region[1] < 0)
+ {
+ region[1] = 0;
+ }
+ }
+ }
+ }
+
+ /**
+ * Adjust hidden column boundaries based on a series of column additions or
+ * deletions in visible regions.
+ *
+ * @param shiftrecord
+ * @return
+ */
+ public ShiftList compensateForEdits(ShiftList shiftrecord)
+ {
+ if (shiftrecord != null)
+ {
+ Vector shifts = shiftrecord.shifts;
+ if (shifts != null && shifts.size() > 0)
+ {
+ int shifted = 0;
+ for (int i = 0, j = shifts.size(); i < j; i++)
+ {
+ int[] sh = (int[]) shifts.elementAt(i);
+ // compensateForEdit(shifted+sh[0], sh[1]);
+ compensateForDelEdits(shifted + sh[0], sh[1]);
+ shifted -= sh[1];
+ }
+ }
+ return shiftrecord.getInverse();
+ }
+ return null;
+ }
+
+ /**
+ * removes intersection of position,length ranges in deletions from the
+ * start,end regions marked in intervals.
+ *
+ * @param deletions
+ * @param intervals
+ * @return
+ */
+ private boolean pruneIntervalVector(Vector deletions, Vector intervals)
+ {
+ boolean pruned = false;
+ int i = 0, j = intervals.size() - 1, s = 0, t = deletions.size() - 1;
+ int hr[] = (int[]) intervals.elementAt(i);
+ int sr[] = (int[]) deletions.elementAt(s);
+ while (i <= j && s <= t)
+ {
+ boolean trailinghn = hr[1] >= sr[0];
+ if (!trailinghn)
+ {
+ if (i < j)
+ {
+ hr = (int[]) intervals.elementAt(++i);
+ }
+ else
+ {
+ i++;
+ }
+ continue;
+ }
+ int endshift = sr[0] + sr[1]; // deletion ranges - -ve means an insert
+ if (endshift < hr[0] || endshift < sr[0])
+ { // leadinghc disjoint or not a deletion
+ if (s < t)
+ {
+ sr = (int[]) deletions.elementAt(++s);
+ }
+ else
+ {
+ s++;
+ }
+ continue;
+ }
+ boolean leadinghn = hr[0] >= sr[0];
+ boolean leadinghc = hr[0] < endshift;
+ boolean trailinghc = hr[1] < endshift;
+ if (leadinghn)
+ {
+ if (trailinghc)
+ { // deleted hidden region.
+ intervals.removeElementAt(i);
+ pruned = true;
+ j--;
+ if (i <= j)
+ {
+ hr = (int[]) intervals.elementAt(i);
+ }
+ continue;
+ }
+ if (leadinghc)
+ {
+ hr[0] = endshift; // clip c terminal region
+ leadinghn = !leadinghn;
+ pruned = true;
+ }
+ }
+ if (!leadinghn)
+ {
+ if (trailinghc)
+ {
+ if (trailinghn)
+ {
+ hr[1] = sr[0] - 1;
+ pruned = true;
+ }
+ }
+ else
+ {
+ // sr contained in hr
+ if (s < t)
+ {
+ sr = (int[]) deletions.elementAt(++s);
+ }
+ else
+ {
+ s++;
+ }
+ continue;
+ }
+ }
+ }
+ return pruned; // true if any interval was removed or modified by
+ // operations.
+ }
+
+ private boolean pruneColumnList(Vector deletion, Vector list)
+ {
+ int s = 0, t = deletion.size();
+ int[] sr = (int[]) list.elementAt(s++);
+ boolean pruned = false;
+ int i = 0, j = list.size();
+ while (i < j && s <= t)
+ {
+ int c = ((Integer) list.elementAt(i++)).intValue();
+ if (sr[0] <= c)
+ {
+ if (sr[1] + sr[0] >= c)
+ { // sr[1] -ve means inseriton.
+ list.removeElementAt(--i);
+ j--;
+ }
+ else
+ {
+ if (s < t)
+ {
+ sr = (int[]) deletion.elementAt(s);
+ }
+ s++;
+ }
+ }
+ }
+ return pruned;
+ }
+
+ /**
+ * remove any hiddenColumns or selected columns and shift remaining based on a
+ * series of position, range deletions.
+ *
+ * @param deletions
+ */
+ public void pruneDeletions(ShiftList deletions)
+ {
+ if (deletions != null)
+ {
+ Vector shifts = deletions.shifts;
+ if (shifts != null && shifts.size() > 0)
+ {
+ // delete any intervals intersecting.
+ if (hiddenColumns != null)
+ {
+ pruneIntervalVector(shifts, hiddenColumns);
+ if (hiddenColumns != null && hiddenColumns.size() == 0)
+ {
+ hiddenColumns = null;
+ }
+ }
+ if (selected != null && selected.size() > 0)
+ {
+ pruneColumnList(shifts, selected);
+ if (selected != null && selected.size() == 0)
+ {
+ selected = null;
+ }
+ }
+ // and shift the rest.
+ this.compensateForEdits(deletions);
+ }
+ }
+ }
+
+ /**
+ * This Method is used to return all the HiddenColumn regions less than the
+ * given index.
+ *
+ * @param end
+ * int
+ * @return Vector
+ */
+ public Vector getHiddenColumns()
+ {
+ return hiddenColumns;
+ }
+
+ /**
+ * Return absolute column index for a visible column index
+ *
+ * @param column
+ * int column index in alignment view
+ * @return alignment column index for column
+ */
+ public int adjustForHiddenColumns(int column)
+ {
+ int result = column;
+ if (hiddenColumns != null)
+ {
+ for (int i = 0; i < hiddenColumns.size(); i++)
+ {
+ int[] region = (int[]) hiddenColumns.elementAt(i);
+ if (result >= region[0])
+ {
+ result += region[1] - region[0] + 1;
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Use this method to find out where a column will appear in the visible
+ * alignment when hidden columns exist. If the column is not visible, then the
+ * left-most visible column will always be returned.
+ *
+ * @param hiddenColumn
+ * int
+ * @return int
+ */
+ public int findColumnPosition(int hiddenColumn)
+ {
+ int result = hiddenColumn;
+ if (hiddenColumns != null)
+ {
+ int index = 0;
+ int[] region;
+ do
+ {
+ region = (int[]) hiddenColumns.elementAt(index++);
+ if (hiddenColumn > region[1])
+ {
+ result -= region[1] + 1 - region[0];
+ }
+ } while ((hiddenColumn > region[1]) && (index < hiddenColumns.size()));
+ if (hiddenColumn > region[0] && hiddenColumn < region[1])
+ {
+ return region[0] + hiddenColumn - result;
+ }
+ }
+ return result; // return the shifted position after removing hidden columns.
+ }
+
+ /**
+ * Use this method to determine where the next hiddenRegion starts
+ */
+ public int findHiddenRegionPosition(int hiddenRegion)
+ {
+ int result = 0;
+ if (hiddenColumns != null)
+ {
+ int index = 0;
+ int gaps = 0;
+ do
+ {
+ int[] region = (int[]) hiddenColumns.elementAt(index);
+ if (hiddenRegion == 0)
+ {
+ return region[0];
+ }
+
+ gaps += region[1] + 1 - region[0];
+ result = region[1] + 1;
+ index++;
+ } while (index < hiddenRegion + 1);
+
+ result -= gaps;
+ }
+
+ return result;
+ }
+
+ /**
+ * THis method returns the rightmost limit of a region of an alignment with
+ * hidden columns. In otherwords, the next hidden column.
+ *
+ * @param index
+ * int
+ */
+ public int getHiddenBoundaryRight(int alPos)
+ {
+ if (hiddenColumns != null)
+ {
+ int index = 0;
+ do
+ {
+ int[] region = (int[]) hiddenColumns.elementAt(index);
+ if (alPos < region[0])
+ {
+ return region[0];
+ }
+
+ index++;
+ } while (index < hiddenColumns.size());
+ }
+
+ return alPos;
+
+ }
+
+ /**
+ * This method returns the leftmost limit of a region of an alignment with
+ * hidden columns. In otherwords, the previous hidden column.
+ *
+ * @param index
+ * int
+ */
+ public int getHiddenBoundaryLeft(int alPos)
+ {
+ if (hiddenColumns != null)
+ {
+ int index = hiddenColumns.size() - 1;
+ do
+ {
+ int[] region = (int[]) hiddenColumns.elementAt(index);
+ if (alPos > region[1])
+ {
+ return region[1];
+ }
+
+ index--;
+ } while (index > -1);
+ }
+
+ return alPos;
+
+ }
+
+ public void hideSelectedColumns()
+ {
+ while (size() > 0)
+ {
+ int column = ((Integer) getSelected().firstElement()).intValue();
+ hideColumns(column);
+ }
+
+ }
+
+ public void hideColumns(int start, int end)
+ {
+ if (hiddenColumns == null)
+ {
+ hiddenColumns = new Vector();
+ }
+
+ boolean added = false;
+ boolean overlap = false;
+
+ for (int i = 0; i < hiddenColumns.size(); i++)
+ {
+ int[] region = (int[]) hiddenColumns.elementAt(i);
+ if (start <= region[1] && end >= region[0])
+ {
+ hiddenColumns.removeElementAt(i);
+ overlap = true;
+ break;
+ }
+ else if (end < region[0] && start < region[0])
+ {
+ hiddenColumns.insertElementAt(new int[]
+ { start, end }, i);
+ added = true;
+ break;
+ }
+ }
+
+ if (overlap)
+ {
+ hideColumns(start, end);
+ }
+ else if (!added)
+ {
+ hiddenColumns.addElement(new int[]
+ { start, end });
+ }
+
+ }
+
+ /**
+ * This method will find a range of selected columns around the column
+ * specified
+ *
+ * @param res
+ * int
+ */
+ public void hideColumns(int col)
+ {
+ // First find out range of columns to hide
+ int min = col, max = col + 1;
+ while (contains(min))
+ {
+ removeElement(min);
+ min--;
+ }
+
+ while (contains(max))
+ {
+ removeElement(max);
+ max++;
+ }
+
+ min++;
+ max--;
+ if (min > max)
+ {
+ min = max;
+ }
+
+ hideColumns(min, max);
+ }
+
+ public void revealAllHiddenColumns()
+ {
+ if (hiddenColumns != null)
+ {
+ for (int i = 0; i < hiddenColumns.size(); i++)
+ {
+ int[] region = (int[]) hiddenColumns.elementAt(i);
+ for (int j = region[0]; j < region[1] + 1; j++)
+ {
+ addElement(j);
+ }
+ }
+ }
+
+ hiddenColumns = null;
+ }
+
+ public void revealHiddenColumns(int res)
+ {
+ for (int i = 0; i < hiddenColumns.size(); i++)
+ {
+ int[] region = (int[]) hiddenColumns.elementAt(i);
+ if (res == region[0])
+ {
+ for (int j = region[0]; j < region[1] + 1; j++)
+ {
+ addElement(j);
+ }
+
+ hiddenColumns.removeElement(region);
+ break;
+ }
+ }
+ if (hiddenColumns.size() == 0)
+ {
+ hiddenColumns = null;
+ }
+ }
+
+ public boolean isVisible(int column)
+ {
+ if (hiddenColumns != null)
+ for (int i = 0; i < hiddenColumns.size(); i++)
+ {
+ int[] region = (int[]) hiddenColumns.elementAt(i);
+ if (column >= region[0] && column <= region[1])
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * Copy constructor
+ *
+ * @param copy
+ */
+ public ColumnSelection(ColumnSelection copy)
+ {
+ if (copy != null)
+ {
+ if (copy.selected != null)
+ {
+ selected = new Vector();
+ for (int i = 0, j = copy.selected.size(); i < j; i++)
+ {
+ selected.addElement(copy.selected.elementAt(i));
+ }
+ }
+ if (copy.hiddenColumns != null)
+ {
+ hiddenColumns = new Vector(copy.hiddenColumns.size());
+ for (int i = 0, j = copy.hiddenColumns.size(); i < j; i++)
+ {
+ int[] rh, cp;
+ rh = (int[]) copy.hiddenColumns.elementAt(i);
+ if (rh != null)
+ {
+ cp = new int[rh.length];
+ System.arraycopy(rh, 0, cp, 0, rh.length);
+ hiddenColumns.addElement(cp);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * ColumnSelection
+ */
+ public ColumnSelection()
+ {
+ }
+
+ public String[] getVisibleSequenceStrings(int start, int end,
+ SequenceI[] seqs)
+ {
+ int i, iSize = seqs.length;
+ String selection[] = new String[iSize];
+ if (hiddenColumns != null && hiddenColumns.size() > 0)
+ {
+ for (i = 0; i < iSize; i++)
+ {
+ StringBuffer visibleSeq = new StringBuffer();
+ Vector regions = getHiddenColumns();
+
+ int blockStart = start, blockEnd = end;
+ int[] region;
+ int hideStart, hideEnd;
+
+ for (int j = 0; j < regions.size(); j++)
+ {
+ region = (int[]) regions.elementAt(j);
+ hideStart = region[0];
+ hideEnd = region[1];
+
+ if (hideStart < start)
+ {
+ continue;
+ }
+
+ blockStart = Math.min(blockStart, hideEnd + 1);
+ blockEnd = Math.min(blockEnd, hideStart);
+
+ if (blockStart > blockEnd)
+ {
+ break;
+ }
+
+ visibleSeq.append(seqs[i].getSequence(blockStart, blockEnd));
+
+ blockStart = hideEnd + 1;
+ blockEnd = end;
+ }
+
+ if (end > blockStart)
+ {
+ visibleSeq.append(seqs[i].getSequence(blockStart, end));
+ }
+
+ selection[i] = visibleSeq.toString();
+ }
+ }
+ else
+ {
+ for (i = 0; i < iSize; i++)
+ {
+ selection[i] = seqs[i].getSequenceAsString(start, end);
+ }
+ }
+
+ return selection;
+ }
+
+ /**
+ * return all visible segments between the given start and end boundaries
+ *
+ * @param start
+ * (first column inclusive from 0)
+ * @param end
+ * (last column - not inclusive)
+ * @return int[] {i_start, i_end, ..} where intervals lie in
+ * start<=i_start<=i_end<end
+ */
+ public int[] getVisibleContigs(int start, int end)
+ {
+ if (hiddenColumns != null && hiddenColumns.size() > 0)
+ {
+ Vector visiblecontigs = new Vector();
+ Vector regions = getHiddenColumns();
+
+ int vstart = start;
+ int[] region;
+ int hideStart, hideEnd;
+
+ for (int j = 0; vstart < end && j < regions.size(); j++)
+ {
+ region = (int[]) regions.elementAt(j);
+ hideStart = region[0];
+ hideEnd = region[1];
+
+ if (hideEnd < vstart)
+ {
+ continue;
+ }
+ if (hideStart > vstart)
+ {
+ visiblecontigs.addElement(new int[]
+ { vstart, hideStart - 1 });
+ }
+ vstart = hideEnd + 1;
+ }
+
+ if (vstart < end)
+ {
+ visiblecontigs.addElement(new int[]
+ { vstart, end - 1 });
+ }
+ int[] vcontigs = new int[visiblecontigs.size() * 2];
+ for (int i = 0, j = visiblecontigs.size(); i < j; i++)
+ {
+ int[] vc = (int[]) visiblecontigs.elementAt(i);
+ visiblecontigs.setElementAt(null, i);
+ vcontigs[i * 2] = vc[0];
+ vcontigs[i * 2 + 1] = vc[1];
+ }
+ visiblecontigs.removeAllElements();
+ return vcontigs;
+ }
+ else
+ {
+ return new int[]
+ { start, end - 1 };
+ }
+ }
+
+ /**
+ * delete any columns in alignmentAnnotation that are hidden (including
+ * sequence associated annotation).
+ *
+ * @param alignmentAnnotation
+ */
+ public void makeVisibleAnnotation(AlignmentAnnotation alignmentAnnotation)
+ {
+ makeVisibleAnnotation(-1, -1, alignmentAnnotation);
+ }
+
+ /**
+ * delete any columns in alignmentAnnotation that are hidden (including
+ * sequence associated annotation).
+ *
+ * @param start
+ * remove any annotation to the right of this column
+ * @param end
+ * remove any annotation to the left of this column
+ * @param alignmentAnnotation
+ * the annotation to operate on
+ */
+ public void makeVisibleAnnotation(int start, int end,
+ AlignmentAnnotation alignmentAnnotation)
+ {
+ if (alignmentAnnotation.annotations == null)
+ {
+ return;
+ }
+ if (start == end && end == -1)
+ {
+ start = 0;
+ end = alignmentAnnotation.annotations.length;
+ }
+ if (hiddenColumns != null && hiddenColumns.size() > 0)
+ {
+ // then mangle the alignmentAnnotation annotation array
+ Vector annels = new Vector();
+ Annotation[] els = null;
+ Vector regions = getHiddenColumns();
+ int blockStart = start, blockEnd = end;
+ int[] region;
+ int hideStart, hideEnd, w = 0;
+
+ for (int j = 0; j < regions.size(); j++)
+ {
+ region = (int[]) regions.elementAt(j);
+ hideStart = region[0];
+ hideEnd = region[1];
+
+ if (hideStart < start)
+ {
+ continue;
+ }
+
+ blockStart = Math.min(blockStart, hideEnd + 1);
+ blockEnd = Math.min(blockEnd, hideStart);
+
+ if (blockStart > blockEnd)
+ {
+ break;
+ }
+
+ annels.addElement(els = new Annotation[blockEnd - blockStart]);
+ System.arraycopy(alignmentAnnotation.annotations, blockStart, els,
+ 0, els.length);
+ w += els.length;
+ blockStart = hideEnd + 1;
+ blockEnd = end;
+ }
+
+ if (end > blockStart)
+ {
+ annels.addElement(els = new Annotation[end - blockStart + 1]);
+ if ((els.length + blockStart) <= alignmentAnnotation.annotations.length)
+ {
+ // copy just the visible segment of the annotation row
+ System.arraycopy(alignmentAnnotation.annotations, blockStart,
+ els, 0, els.length);
+ }
+ else
+ {
+ // copy to the end of the annotation row
+ System.arraycopy(alignmentAnnotation.annotations, blockStart,
+ els, 0,
+ (alignmentAnnotation.annotations.length - blockStart));
+ }
+ w += els.length;
+ }
+ if (w == 0)
+ return;
+ Enumeration e = annels.elements();
+ alignmentAnnotation.annotations = new Annotation[w];
+ w = 0;
+ while (e.hasMoreElements())
+ {
+ Annotation[] chnk = (Annotation[]) e.nextElement();
+ System.arraycopy(chnk, 0, alignmentAnnotation.annotations, w,
+ chnk.length);
+ w += chnk.length;
+ }
+ }
+ else
+ {
+ alignmentAnnotation.restrict(start, end);
+ }
+ }
+
+ /**
+ * Invert the column selection from first to end-1. leaves hiddenColumns
+ * untouched (and unselected)
+ *
+ * @param first
+ * @param end
+ */
+ public void invertColumnSelection(int first, int width)
+ {
+ boolean hasHidden = hiddenColumns != null && hiddenColumns.size() > 0;
+ for (int i = first; i < width; i++)
+ {
+ if (contains(i))
+ {
+ removeElement(i);
+ }
+ else
+ {
+ if (!hasHidden || isVisible(i))
+ {
+ addElement(i);
+ }
+ }
+ }
+ }
+
+ /**
+ * add in any unselected columns from the given column selection, excluding
+ * any that are hidden.
+ *
+ * @param colsel
+ */
+ public void addElementsFrom(ColumnSelection colsel)
+ {
+ if (colsel != null && colsel.size() > 0)
+ {
+ Enumeration e = colsel.getSelected().elements();
+ while (e.hasMoreElements())
+ {
+ Object eo = e.nextElement();
+ if (hiddenColumns != null && isVisible(((Integer) eo).intValue()))
+ {
+ if (!selected.contains(eo))
+ {
+ selected.addElement(eo);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * set the selected columns the given column selection, excluding any columns
+ * that are hidden.
+ *
+ * @param colsel
+ */
+ public void setElementsFrom(ColumnSelection colsel)
+ {
+ selected = new Vector();
+ if (colsel.selected != null && colsel.selected.size() > 0)
+ {
+ if (hiddenColumns != null && hiddenColumns.size() > 0)
+ {
+ // only select visible columns in this columns selection
+ selected = new Vector();
+ addElementsFrom(colsel);
+ }
+ else
+ {
+ // add everything regardless
+ Enumeration en = colsel.selected.elements();
+ while (en.hasMoreElements())
+ {
+ selected.addElement(en.nextElement());
+ }
+ }
+ }
+ }
+
+ /**
+ * Add gaps into the sequences aligned to profileseq under the given
+ * AlignmentView
+ *
+ * @param profileseq
+ * @param al
+ * - alignment to have gaps inserted into it
+ * @param input
+ * - alignment view where sequence corresponding to profileseq is
+ * first entry
+ * @return new Column selection for new alignment view, with insertions into
+ * profileseq marked as hidden.
+ */
+ public static ColumnSelection propagateInsertions(SequenceI profileseq,
+ Alignment al, AlignmentView input)
+ {
+ int profsqpos = 0;
+
+ // return propagateInsertions(profileseq, al, )
+ char gc = al.getGapCharacter();
+ Object[] alandcolsel = input.getAlignmentAndColumnSelection(gc);
+ ColumnSelection nview = (ColumnSelection) alandcolsel[1];
+ SequenceI origseq = ((SequenceI[]) alandcolsel[0])[profsqpos];
+ nview.propagateInsertions(profileseq, al, origseq);
+ return nview;
+ }
+
+ /**
+ *
+ * @param profileseq
+ * - sequence in al which corresponds to origseq
+ * @param al
+ * - alignment which is to have gaps inserted into it
+ * @param origseq
+ * - sequence corresponding to profileseq which defines gap map for
+ * modifying al
+ */
+ public void propagateInsertions(SequenceI profileseq, AlignmentI al,
+ SequenceI origseq)
+ {
+ char gc = al.getGapCharacter();
+ // recover mapping between sequence's non-gap positions and positions
+ // mapping to view.
+ pruneDeletions(ShiftList.parseMap(origseq.gapMap()));
+ int[] viscontigs = getVisibleContigs(0, profileseq.getLength());
+ int spos = 0;
+ int offset = 0;
+ // input.pruneDeletions(ShiftList.parseMap(((SequenceI[])
+ // alandcolsel[0])[0].gapMap()))
+ // add profile to visible contigs
+ for (int v = 0; v < viscontigs.length; v += 2)
+ {
+ if (viscontigs[v] > spos)
+ {
+ StringBuffer sb = new StringBuffer();
+ for (int s = 0, ns = viscontigs[v] - spos; s < ns; s++)
+ {
+ sb.append(gc);
+ }
+ for (int s = 0, ns = al.getHeight(); s < ns; s++)
+ {
+ SequenceI sqobj = al.getSequenceAt(s);
+ if (sqobj != profileseq)
+ {
+ String sq = al.getSequenceAt(s).getSequenceAsString();
+ if (sq.length() <= spos + offset)
+ {
+ // pad sequence
+ int diff = spos + offset - sq.length() - 1;
+ if (diff > 0)
+ {
+ // pad gaps
+ sq = sq + sb;
+ while ((diff = spos + offset - sq.length() - 1) > 0)
+ {
+ // sq = sq
+ // + ((diff >= sb.length()) ? sb.toString() : sb
+ // .substring(0, diff));
+ if (diff >= sb.length())
+ {
+ sq += sb.toString();
+ }
+ else
+ {
+ char[] buf = new char[diff];
+ sb.getChars(0, diff, buf, 0);
+ sq += buf.toString();
+ }
+ }
+ }
+ sq += sb.toString();
+ }
+ else
+ {
+ al.getSequenceAt(s).setSequence(
+ sq.substring(0, spos + offset) + sb.toString()
+ + sq.substring(spos + offset));
+ }
+ }
+ }
+ // offset+=sb.length();
+ }
+ spos = viscontigs[v + 1] + 1;
+ }
+ if ((offset + spos) < profileseq.getLength())
+ {
+ // pad the final region with gaps.
+ StringBuffer sb = new StringBuffer();
+ for (int s = 0, ns = profileseq.getLength() - spos - offset; s < ns; s++)
+ {
+ sb.append(gc);
+ }
+ for (int s = 0, ns = al.getHeight(); s < ns; s++)
+ {
+ SequenceI sqobj = al.getSequenceAt(s);
+ if (sqobj == profileseq)
+ {
+ continue;
+ }
+ String sq = sqobj.getSequenceAsString();
+ // pad sequence
+ int diff = origseq.getLength() - sq.length();
+ while (diff > 0)
+ {
+ // sq = sq
+ // + ((diff >= sb.length()) ? sb.toString() : sb
+ // .substring(0, diff));
+ if (diff >= sb.length())
+ {
+ sq += sb.toString();
+ }
+ else
+ {
+ char[] buf = new char[diff];
+ sb.getChars(0, diff, buf, 0);
+ sq += buf.toString();
+ }
+ diff = origseq.getLength() - sq.length();
+ }
+ }
+ }
+ }
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.datamodel;\r
-\r
-/**\r
- * Defines internal constants for unambiguous annotation of DbRefEntry source\r
- * strings and describing the data retrieved from external database sources (see\r
- * jalview.ws.DbSourcProxy)\r
- * \r
- * @author JimP\r
- * \r
- */\r
-public class DBRefSource\r
-{\r
- /**\r
- * UNIPROT Accession Number\r
- */\r
- public static String UNIPROT = "UNIPROT";\r
-\r
- /**\r
- * UNIPROT Entry Name\r
- */\r
- public static String UP_NAME = "UNIPROT_NAME";\r
-\r
- /**\r
- * Uniprot Knowledgebase/TrEMBL as served from EMBL protein products.\r
- */\r
- public static final String UNIPROTKB = "UniProtKB/TrEMBL";\r
-\r
- /**\r
- * PDB Entry Code\r
- */\r
- public static String PDB = "PDB";\r
-\r
- /**\r
- * EMBL ID\r
- */\r
- public static String EMBL = "EMBL";\r
-\r
- /**\r
- * EMBLCDS ID\r
- */\r
- public static String EMBLCDS = "EMBLCDS";\r
-\r
- /**\r
- * PFAM ID\r
- */\r
- public static String PFAM = "PFAM";\r
-\r
- /**\r
- * RFAM ID\r
- */\r
- public static String RFAM = "RFAM";\r
-\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 =\r
- { EMBL, EMBLCDS, GENEDB };\r
-\r
- public static final String[] CODINGDBS =\r
- { EMBLCDS, GENEDB };\r
-\r
- public static final String[] PROTEINDBS =\r
- { UNIPROT, PDB, UNIPROTKB };\r
-\r
- public static final String[] PROTEINSEQ =\r
- { UNIPROT, UNIPROTKB };\r
-\r
- public static final String[] PROTEINSTR =\r
- { PDB };\r
-\r
- public static final String[] DOMAINDBS =\r
- { PFAM, RFAM };\r
-\r
- /**\r
- * set of unique DBRefSource property constants. These could be used to\r
- * reconstruct the above groupings\r
- */\r
- public static final Object SEQDB = "SQ";\r
-\r
- /**\r
- * database of nucleic acid sequences\r
- */\r
- public static final Object DNASEQDB = "NASQ";\r
-\r
- /**\r
- * database of amino acid sequences\r
- */\r
- public static final Object PROTSEQDB = "PROTSQ";\r
-\r
- /**\r
- * database of cDNA sequences\r
- */\r
- public static final Object CODINGSEQDB = "CODING";\r
-\r
- /**\r
- * database of na sequences with exon annotation\r
- */\r
- public static final Object DNACODINGSEQDB = "XONCODING";\r
-\r
- /**\r
- * DB returns several sequences associated with a protein/nucleotide domain\r
- */\r
- public static final Object DOMAINDB = "DOMAIN";\r
-\r
- /**\r
- * DB query can take multiple accession codes concatenated by a separator.\r
- * Value of property indicates maximum number of accession codes to send at a\r
- * time.\r
- */\r
- public static final Object MULTIACC = "MULTIACC";\r
-\r
- /**\r
- * DB query returns an alignment for each accession provided.\r
- */\r
- public static final Object ALIGNMENTDB = "ALIGNMENTS";\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.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";
+
+ /**
+ * RFAM ID
+ */
+ public static String RFAM = "RFAM";
+
+ /**
+ * 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, RFAM };
+
+ /**
+ * 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/nucleotide 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";
+
+ /**
+ * DB query returns an alignment for each accession provided.
+ */
+ public static final Object ALIGNMENTDB = "ALIGNMENTS";
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.datamodel;\r
-\r
-/**\r
- * A set of feature property constants used by jalview\r
- * \r
- * @author JimP\r
- * \r
- */\r
-public class FeatureProperties\r
-{\r
-\r
- public static final String EXONPOS = "exon number";\r
-\r
- public static final String EXONPRODUCT = "product";\r
-\r
- /**\r
- * lookup feature type for a particular database to see if its a coding region\r
- * feature\r
- * \r
- * @param dbrefsource\r
- * @param string\r
- * @return\r
- */\r
- public static boolean isCodingFeature(String dbrefsource, String type)\r
- {\r
- return ((dbrefsource == null\r
- || dbrefsource.equalsIgnoreCase(DBRefSource.EMBL) || dbrefsource\r
- .equalsIgnoreCase(DBRefSource.EMBLCDS)) && type\r
- .equalsIgnoreCase("CDS"));\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.datamodel;
+
+/**
+ * A set of feature property constants used by jalview
+ *
+ * @author JimP
+ *
+ */
+public class FeatureProperties
+{
+
+ public static final String EXONPOS = "exon number";
+
+ public static final String EXONPRODUCT = "product";
+
+ /**
+ * lookup feature type for a particular database to see if its a coding region
+ * feature
+ *
+ * @param dbrefsource
+ * @param string
+ * @return
+ */
+ public static boolean isCodingFeature(String dbrefsource, String type)
+ {
+ return ((dbrefsource == null
+ || dbrefsource.equalsIgnoreCase(DBRefSource.EMBL) || dbrefsource
+ .equalsIgnoreCase(DBRefSource.EMBLCDS)) && type
+ .equalsIgnoreCase("CDS"));
+ }
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
package jalview.datamodel;
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
package jalview.datamodel;
import java.util.List;
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.datamodel;\r
-\r
-public class UniprotProteinName\r
-{\r
- /**\r
- * internal content storage\r
- */\r
- private java.util.Vector names;\r
-\r
- public void setName(java.util.Vector names)\r
- {\r
- this.names = names;\r
- }\r
-\r
- public java.util.Vector getName()\r
- {\r
- return names;\r
- }\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.datamodel;
+
+public class UniprotProteinName
+{
+ /**
+ * internal content storage
+ */
+ private java.util.Vector names;
+
+ public void setName(java.util.Vector names)
+ {
+ this.names = names;
+ }
+
+ public java.util.Vector getName()
+ {
+ return names;
+ }
+
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.ext.jmol;\r
-\r
-import jalview.api.AlignmentViewPanel;\r
-import jalview.api.FeatureRenderer;\r
-import jalview.api.SequenceRenderer;\r
-import jalview.api.SequenceStructureBinding;\r
-import jalview.api.StructureSelectionManagerProvider;\r
-import jalview.datamodel.AlignmentI;\r
-import jalview.datamodel.ColumnSelection;\r
-import jalview.datamodel.PDBEntry;\r
-import jalview.datamodel.SequenceI;\r
-import jalview.io.AppletFormatAdapter;\r
-import jalview.schemes.ColourSchemeI;\r
-import jalview.schemes.ResidueProperties;\r
-import jalview.structure.StructureListener;\r
-import jalview.structure.StructureMapping;\r
-import jalview.structure.StructureSelectionManager;\r
-\r
-import java.awt.Color;\r
-import java.awt.Container;\r
-import java.awt.event.ComponentEvent;\r
-import java.awt.event.ComponentListener;\r
-import java.io.File;\r
-import java.net.URL;\r
-import java.security.AccessControlException;\r
-import java.util.Enumeration;\r
-import java.util.Hashtable;\r
-import java.util.Map;\r
-import java.util.Vector;\r
-\r
-import org.jmol.adapter.smarter.SmarterJmolAdapter;\r
-import org.jmol.api.JmolAppConsoleInterface;\r
-import org.jmol.api.JmolSelectionListener;\r
-import org.jmol.api.JmolStatusListener;\r
-import org.jmol.api.JmolViewer;\r
-import org.jmol.constant.EnumCallback;\r
-import org.jmol.popup.JmolPopup;\r
-\r
-public abstract class JalviewJmolBinding implements StructureListener,\r
- JmolStatusListener, SequenceStructureBinding,\r
- JmolSelectionListener, ComponentListener,\r
- StructureSelectionManagerProvider\r
-\r
-{\r
- /**\r
- * set if Jmol state is being restored from some source - instructs binding\r
- * not to apply default display style when structure set is updated for first\r
- * time.\r
- */\r
- private boolean loadingFromArchive = false;\r
-\r
- /**\r
- * state flag used to check if the Jmol viewer's paint method can be called\r
- */\r
- private boolean finishedInit = false;\r
-\r
- public boolean isFinishedInit()\r
- {\r
- return finishedInit;\r
- }\r
-\r
- public void setFinishedInit(boolean finishedInit)\r
- {\r
- this.finishedInit = finishedInit;\r
- }\r
-\r
- boolean allChainsSelected = false;\r
-\r
- /**\r
- * when true, try to search the associated datamodel for sequences that are\r
- * associated with any unknown structures in the Jmol view.\r
- */\r
- private boolean associateNewStructs = false;\r
-\r
- Vector atomsPicked = new Vector();\r
-\r
- public Vector chainNames;\r
-\r
- Hashtable chainFile;\r
-\r
- /**\r
- * array of target chains for seuqences - tied to pdbentry and sequence[]\r
- */\r
- protected String[][] chains;\r
-\r
- boolean colourBySequence = true;\r
-\r
- StringBuffer eval = new StringBuffer();\r
-\r
- public String fileLoadingError;\r
-\r
- /**\r
- * the default or current model displayed if the model cannot be identified\r
- * from the selection message\r
- */\r
- int frameNo = 0;\r
-\r
- protected JmolPopup jmolpopup;\r
-\r
- String lastCommand;\r
-\r
- String lastMessage;\r
-\r
- boolean loadedInline;\r
-\r
- /**\r
- * current set of model filenames loaded in the Jmol instance\r
- */\r
- String[] modelFileNames = null;\r
-\r
- public PDBEntry[] pdbentry;\r
-\r
- /**\r
- * datasource protocol for access to PDBEntrylatest\r
- */\r
- String protocol = null;\r
-\r
- StringBuffer resetLastRes = new StringBuffer();\r
-\r
- /**\r
- * sequences mapped to each pdbentry\r
- */\r
- public SequenceI[][] sequence;\r
-\r
- public StructureSelectionManager ssm;\r
-\r
- public JmolViewer viewer;\r
-\r
- public JalviewJmolBinding(StructureSelectionManager ssm,\r
- PDBEntry[] pdbentry, SequenceI[][] sequenceIs, String[][] chains,\r
- String protocol)\r
- {\r
- this.ssm = ssm;\r
- this.sequence = sequenceIs;\r
- this.chains = chains;\r
- this.pdbentry = pdbentry;\r
- this.protocol = protocol;\r
- if (chains == null)\r
- {\r
- this.chains = new String[pdbentry.length][];\r
- }\r
- /*\r
- * viewer = JmolViewer.allocateViewer(renderPanel, new SmarterJmolAdapter(),\r
- * "jalviewJmol", ap.av.applet .getDocumentBase(),\r
- * ap.av.applet.getCodeBase(), "", this);\r
- * \r
- * jmolpopup = JmolPopup.newJmolPopup(viewer, true, "Jmol", true);\r
- */\r
- }\r
-\r
- public JalviewJmolBinding(StructureSelectionManager ssm,\r
- JmolViewer viewer2)\r
- {\r
- this.ssm = ssm;\r
- viewer = viewer2;\r
- viewer.setJmolStatusListener(this);\r
- viewer.addSelectionListener(this);\r
- }\r
-\r
- /**\r
- * construct a title string for the viewer window based on the data jalview\r
- * knows about\r
- * \r
- * @return\r
- */\r
- public String getViewerTitle()\r
- {\r
- if (sequence == null || pdbentry == null || sequence.length < 1\r
- || pdbentry.length < 1 || sequence[0].length < 1)\r
- {\r
- return ("Jalview Jmol Window");\r
- }\r
- // TODO: give a more informative title when multiple structures are\r
- // displayed.\r
- StringBuffer title = new StringBuffer(sequence[0][0].getName() + ":"\r
- + pdbentry[0].getId());\r
-\r
- if (pdbentry[0].getProperty() != null)\r
- {\r
- if (pdbentry[0].getProperty().get("method") != null)\r
- {\r
- title.append(" Method: ");\r
- title.append(pdbentry[0].getProperty().get("method"));\r
- }\r
- if (pdbentry[0].getProperty().get("chains") != null)\r
- {\r
- title.append(" Chain:");\r
- title.append(pdbentry[0].getProperty().get("chains"));\r
- }\r
- }\r
- return title.toString();\r
- }\r
-\r
- /**\r
- * prepare the view for a given set of models/chains. chainList contains\r
- * strings of the form 'pdbfilename:Chaincode'\r
- * \r
- * @param chainList\r
- * list of chains to make visible\r
- */\r
- public void centerViewer(Vector chainList)\r
- {\r
- StringBuffer cmd = new StringBuffer();\r
- String lbl;\r
- int mlength, p;\r
- for (int i = 0, iSize = chainList.size(); i < iSize; i++)\r
- {\r
- mlength = 0;\r
- lbl = (String) chainList.elementAt(i);\r
- do\r
- {\r
- p = mlength;\r
- mlength = lbl.indexOf(":", p);\r
- } while (p < mlength && mlength < (lbl.length() - 2));\r
- // TODO: lookup each pdb id and recover proper model number for it.\r
- cmd.append(":" + lbl.substring(mlength + 1) + " /"\r
- + (1 + getModelNum((String) chainFile.get(lbl))) + " or ");\r
- }\r
- if (cmd.length() > 0)\r
- cmd.setLength(cmd.length() - 4);\r
- evalStateCommand("select *;restrict " + cmd + ";cartoon;center " + cmd);\r
- }\r
-\r
- public void closeViewer()\r
- {\r
- viewer.setModeMouse(org.jmol.viewer.JmolConstants.MOUSE_NONE);\r
- // remove listeners for all structures in viewer\r
- ssm.removeStructureViewerListener(this, this.getPdbFile());\r
- // and shut down jmol\r
- viewer.evalStringQuiet("zap");\r
- viewer.setJmolStatusListener(null);\r
- lastCommand = null;\r
- viewer = null;\r
- releaseUIResources();\r
- }\r
-\r
- /**\r
- * called by JalviewJmolbinding after closeViewer is called - release any\r
- * resources and references so they can be garbage collected.\r
- */\r
- protected abstract void releaseUIResources();\r
-\r
- public void colourByChain()\r
- {\r
- colourBySequence = false;\r
- // TODO: colour by chain should colour each chain distinctly across all\r
- // visible models\r
- // TODO: http://issues.jalview.org/browse/JAL-628\r
- evalStateCommand("select *;color chain");\r
- }\r
-\r
- public void colourByCharge()\r
- {\r
- colourBySequence = false;\r
- evalStateCommand("select *;color white;select ASP,GLU;color red;"\r
- + "select LYS,ARG;color blue;select CYS;color yellow");\r
- }\r
-\r
- /**\r
- * superpose the structures associated with sequences in the alignment\r
- * according to their corresponding positions.\r
- */\r
- public void superposeStructures(AlignmentI alignment)\r
- {\r
- superposeStructures(alignment, -1, null);\r
- }\r
-\r
- /**\r
- * superpose the structures associated with sequences in the alignment\r
- * according to their corresponding positions. ded)\r
- * \r
- * @param refStructure\r
- * - select which pdb file to use as reference (default is -1 - the\r
- * first structure in the alignment)\r
- */\r
- public void superposeStructures(AlignmentI alignment, int refStructure)\r
- {\r
- superposeStructures(alignment, refStructure, null);\r
- }\r
-\r
- /**\r
- * superpose the structures associated with sequences in the alignment\r
- * according to their corresponding positions. ded)\r
- * \r
- * @param refStructure\r
- * - select which pdb file to use as reference (default is -1 - the\r
- * first structure in the alignment)\r
- * @param hiddenCols\r
- * TODO\r
- */\r
- public void superposeStructures(AlignmentI alignment, int refStructure,\r
- ColumnSelection hiddenCols)\r
- {\r
- superposeStructures(new AlignmentI[]\r
- { alignment }, new int[]\r
- { refStructure }, new ColumnSelection[]\r
- { hiddenCols });\r
- }\r
-\r
- public void superposeStructures(AlignmentI[] _alignment,\r
- int[] _refStructure, ColumnSelection[] _hiddenCols)\r
- {\r
- String[] files = getPdbFile();\r
- StringBuffer selectioncom = new StringBuffer();\r
- assert (_alignment.length == _refStructure.length && _alignment.length != _hiddenCols.length);\r
- // union of all aligned positions are collected together.\r
- for (int a = 0; a < _alignment.length; a++)\r
- {\r
- int refStructure = _refStructure[a];\r
- AlignmentI alignment = _alignment[a];\r
- ColumnSelection hiddenCols = _hiddenCols[a];\r
- if (a > 0\r
- && selectioncom.length() > 0\r
- && !selectioncom.substring(selectioncom.length() - 1).equals(\r
- "|"))\r
- {\r
- selectioncom.append("|");\r
- }\r
- // process this alignment\r
- if (refStructure >= files.length)\r
- {\r
- System.err.println("Invalid reference structure value "\r
- + refStructure);\r
- refStructure = -1;\r
- }\r
- if (refStructure < -1)\r
- {\r
- refStructure = -1;\r
- }\r
- StringBuffer command = new StringBuffer();\r
-\r
- boolean matched[] = new boolean[alignment.getWidth()];\r
- for (int m = 0; m < matched.length; m++)\r
- {\r
-\r
- matched[m] = (hiddenCols != null) ? hiddenCols.isVisible(m) : true;\r
- }\r
-\r
- int commonrpositions[][] = new int[files.length][alignment.getWidth()];\r
- String isel[] = new String[files.length];\r
- // reference structure - all others are superposed in it\r
- String[] targetC = new String[files.length];\r
- String[] chainNames = new String[files.length];\r
- for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++)\r
- {\r
- StructureMapping[] mapping = ssm.getMapping(files[pdbfnum]);\r
- // RACE CONDITION - getMapping only returns Jmol loaded filenames once\r
- // Jmol callback has completed.\r
- if (mapping == null || mapping.length < 1)\r
- continue;\r
-\r
- int lastPos = -1;\r
- for (int s = 0; s < sequence[pdbfnum].length; s++)\r
- {\r
- for (int sp, m = 0; m < mapping.length; m++)\r
- {\r
- if (mapping[m].getSequence() == sequence[pdbfnum][s]\r
- && (sp = alignment.findIndex(sequence[pdbfnum][s])) > -1)\r
- {\r
- if (refStructure == -1)\r
- {\r
- refStructure = pdbfnum;\r
- }\r
- SequenceI asp = alignment.getSequenceAt(sp);\r
- for (int r = 0; r < matched.length; r++)\r
- {\r
- if (!matched[r])\r
- {\r
- continue;\r
- }\r
- matched[r] = false; // assume this is not a good site\r
- if (r >= asp.getLength())\r
- {\r
- continue;\r
- }\r
-\r
- if (jalview.util.Comparison.isGap(asp.getCharAt(r)))\r
- {\r
- // no mapping to gaps in sequence\r
- continue;\r
- }\r
- int t = asp.findPosition(r); // sequence position\r
- int apos = mapping[m].getAtomNum(t);\r
- int pos = mapping[m].getPDBResNum(t);\r
-\r
- if (pos < 1 || pos == lastPos)\r
- {\r
- // can't align unmapped sequence\r
- continue;\r
- }\r
- matched[r] = true; // this is a good ite\r
- lastPos = pos;\r
- // just record this residue position\r
- commonrpositions[pdbfnum][r] = pos;\r
- }\r
- // create model selection suffix\r
- isel[pdbfnum] = "/" + (pdbfnum + 1) + ".1";\r
- if (mapping[m].getChain() == null\r
- || mapping[m].getChain().trim().length() == 0)\r
- {\r
- targetC[pdbfnum] = "";\r
- }\r
- else\r
- {\r
- targetC[pdbfnum] = ":" + mapping[m].getChain();\r
- }\r
- chainNames[pdbfnum] = mapping[m].getPdbId()\r
- + targetC[pdbfnum];\r
- // move on to next pdb file\r
- s = sequence[pdbfnum].length;\r
- break;\r
- }\r
- }\r
- }\r
- }\r
- String[] selcom = new String[files.length];\r
- int nmatched = 0;\r
- // generate select statements to select regions to superimpose structures\r
- {\r
- for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++)\r
- {\r
- String chainCd = targetC[pdbfnum];\r
- int lpos = -1;\r
- boolean run = false;\r
- StringBuffer molsel = new StringBuffer();\r
- molsel.append("{");\r
- for (int r = 0; r < matched.length; r++)\r
- {\r
- if (matched[r])\r
- {\r
- if (pdbfnum == 0)\r
- {\r
- nmatched++;\r
- }\r
- if (lpos != commonrpositions[pdbfnum][r] - 1)\r
- {\r
- // discontinuity\r
- if (lpos != -1)\r
- {\r
- molsel.append(lpos);\r
- molsel.append(chainCd);\r
- // molsel.append("} {");\r
- molsel.append("|");\r
- }\r
- }\r
- else\r
- {\r
- // continuous run - and lpos >-1\r
- if (!run)\r
- {\r
- // at the beginning, so add dash\r
- molsel.append(lpos);\r
- molsel.append("-");\r
- }\r
- run = true;\r
- }\r
- lpos = commonrpositions[pdbfnum][r];\r
- // molsel.append(lpos);\r
- }\r
- }\r
- // add final selection phrase\r
- if (lpos != -1)\r
- {\r
- molsel.append(lpos);\r
- molsel.append(chainCd);\r
- molsel.append("}");\r
- }\r
- selcom[pdbfnum] = molsel.toString();\r
- selectioncom.append("((");\r
- selectioncom.append(selcom[pdbfnum].substring(1,\r
- selcom[pdbfnum].length() - 1));\r
- selectioncom.append(" )& ");\r
- selectioncom.append(pdbfnum + 1);\r
- selectioncom.append(".1)");\r
- if (pdbfnum < files.length - 1)\r
- {\r
- selectioncom.append("|");\r
- }\r
- }\r
- }\r
- // TODO: consider bailing if nmatched less than 4 because superposition\r
- // not\r
- // well defined.\r
- // TODO: refactor superposable position search (above) from jmol selection\r
- // construction (below)\r
- for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++)\r
- {\r
- if (pdbfnum == refStructure)\r
- {\r
- continue;\r
- }\r
- command.append("echo ");\r
- command.append("\"Superposing (");\r
- command.append(chainNames[pdbfnum]);\r
- command.append(") against reference (");\r
- command.append(chainNames[refStructure]);\r
- command.append(")\";\ncompare ");\r
- command.append("{");\r
- command.append(1 + pdbfnum);\r
- command.append(".1} {");\r
- command.append(1 + refStructure);\r
- command.append(".1} SUBSET {*.CA | *.P} ATOMS ");\r
-\r
- // form the matched pair strings\r
- String sep = "";\r
- for (int s = 0; s < 2; s++)\r
- {\r
- command.append(selcom[(s == 0 ? pdbfnum : refStructure)]);\r
- }\r
- command.append(" ROTATE TRANSLATE;\n");\r
- }\r
- System.out.println("Select regions:\n" + selectioncom.toString());\r
- evalStateCommand("select *; cartoons off; backbone; select ("\r
- + selectioncom.toString() + "); cartoons; ");\r
- // selcom.append("; ribbons; ");\r
- System.out.println("Superimpose command(s):\n" + command.toString());\r
-\r
- evalStateCommand(command.toString());\r
- }\r
- if (selectioncom.length() > 0)\r
- {// finally, mark all regions that were superposed.\r
- if (selectioncom.substring(selectioncom.length() - 1).equals("|"))\r
- {\r
- selectioncom.setLength(selectioncom.length() - 1);\r
- }\r
- System.out.println("Select regions:\n" + selectioncom.toString());\r
- evalStateCommand("select *; cartoons off; backbone; select ("\r
- + selectioncom.toString() + "); cartoons; ");\r
- // evalStateCommand("select *; backbone; select "+selcom.toString()+"; cartoons; center "+selcom.toString());\r
- }\r
- }\r
-\r
- public void evalStateCommand(String command)\r
- {\r
- jmolHistory(false);\r
- if (lastCommand == null || !lastCommand.equals(command))\r
- {\r
- viewer.evalStringQuiet(command + "\n");\r
- }\r
- jmolHistory(true);\r
- lastCommand = command;\r
- }\r
-\r
- /**\r
- * colour any structures associated with sequences in the given alignment\r
- * using the getFeatureRenderer() and getSequenceRenderer() renderers but only\r
- * if colourBySequence is enabled.\r
- */\r
- public void colourBySequence(boolean showFeatures,\r
- jalview.api.AlignmentViewPanel alignmentv)\r
- {\r
- if (!colourBySequence)\r
- return;\r
- if (ssm == null)\r
- {\r
- return;\r
- }\r
- String[] files = getPdbFile();\r
-\r
- SequenceRenderer sr = getSequenceRenderer(alignmentv);\r
-\r
- FeatureRenderer fr = null;\r
- if (showFeatures)\r
- {\r
- fr = getFeatureRenderer(alignmentv);\r
- }\r
- AlignmentI alignment = alignmentv.getAlignment();\r
-\r
- for (jalview.structure.StructureMappingcommandSet cpdbbyseq : JmolCommands\r
- .getColourBySequenceCommand(ssm, files, sequence, sr, fr,\r
- alignment))\r
- for (String cbyseq : cpdbbyseq.commands)\r
- {\r
- evalStateCommand(cbyseq);\r
- }\r
- }\r
-\r
- public boolean isColourBySequence()\r
- {\r
- return colourBySequence;\r
- }\r
-\r
- public void setColourBySequence(boolean colourBySequence)\r
- {\r
- this.colourBySequence = colourBySequence;\r
- }\r
-\r
- public void createImage(String file, String type, int quality)\r
- {\r
- System.out.println("JMOL CREATE IMAGE");\r
- }\r
-\r
- public String createImage(String fileName, String type,\r
- Object textOrBytes, int quality)\r
- {\r
- System.out.println("JMOL CREATE IMAGE");\r
- return null;\r
- }\r
-\r
- public String eval(String strEval)\r
- {\r
- // System.out.println(strEval);\r
- // "# 'eval' is implemented only for the applet.";\r
- return null;\r
- }\r
-\r
- // End StructureListener\r
- // //////////////////////////\r
-\r
- public float[][] functionXY(String functionName, int x, int y)\r
- {\r
- return null;\r
- }\r
-\r
- public float[][][] functionXYZ(String functionName, int nx, int ny, int nz)\r
- {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
- public Color getColour(int atomIndex, int pdbResNum, String chain,\r
- String pdbfile)\r
- {\r
- if (getModelNum(pdbfile) < 0)\r
- return null;\r
- // TODO: verify atomIndex is selecting correct model.\r
- return new Color(viewer.getAtomArgb(atomIndex));\r
- }\r
-\r
- /**\r
- * returns the current featureRenderer that should be used to colour the\r
- * structures\r
- * \r
- * @param alignment\r
- * \r
- * @return\r
- */\r
- public abstract FeatureRenderer getFeatureRenderer(\r
- AlignmentViewPanel alignment);\r
-\r
- /**\r
- * instruct the Jalview binding to update the pdbentries vector if necessary\r
- * prior to matching the jmol view's contents to the list of structure files\r
- * Jalview knows about.\r
- */\r
- public abstract void refreshPdbEntries();\r
-\r
- private int getModelNum(String modelFileName)\r
- {\r
- String[] mfn = getPdbFile();\r
- if (mfn == null)\r
- {\r
- return -1;\r
- }\r
- for (int i = 0; i < mfn.length; i++)\r
- {\r
- if (mfn[i].equalsIgnoreCase(modelFileName))\r
- return i;\r
- }\r
- return -1;\r
- }\r
-\r
- /**\r
- * map between index of model filename returned from getPdbFile and the first\r
- * index of models from this file in the viewer. Note - this is not trimmed -\r
- * use getPdbFile to get number of unique models.\r
- */\r
- private int _modelFileNameMap[];\r
-\r
- // ////////////////////////////////\r
- // /StructureListener\r
- public synchronized String[] getPdbFile()\r
- {\r
- if (viewer == null)\r
- {\r
- return new String[0];\r
- }\r
- if (modelFileNames == null)\r
- {\r
-\r
- String mset[] = new String[viewer.getModelCount()];\r
- _modelFileNameMap = new int[mset.length];\r
- int j = 1;\r
- String m = viewer.getModelFileName(0);\r
- if (m != null)\r
- {\r
- try\r
- {\r
- mset[0] = new File(m).getAbsolutePath();\r
- } catch (AccessControlException x)\r
- {\r
- // usually not allowed to do this in applet, so keep raw handle\r
- mset[0] = m;\r
- // System.err.println("jmolBinding: Using local file string from Jmol: "+m);\r
- }\r
- }\r
- for (int i = 1; i < mset.length; i++)\r
- {\r
- m = viewer.getModelFileName(i);\r
- if (m != null)\r
- {\r
- try\r
- {\r
- mset[j] = new File(m).getAbsolutePath();\r
- } catch (AccessControlException x)\r
- {\r
- // usually not allowed to do this in applet, so keep raw handle\r
- mset[j] = m;\r
- // System.err.println("jmolBinding: Using local file string from Jmol: "+m);\r
- }\r
- }\r
- _modelFileNameMap[j] = i; // record the model index for the filename\r
- // skip any additional models in the same file (NMR structures)\r
- if ((mset[j] == null ? mset[j] != mset[j - 1]\r
- : (mset[j - 1] == null || !mset[j].equals(mset[j - 1]))))\r
- {\r
- j++;\r
- }\r
- }\r
- modelFileNames = new String[j];\r
- System.arraycopy(mset, 0, modelFileNames, 0, j);\r
- }\r
- return modelFileNames;\r
- }\r
-\r
- /**\r
- * map from string to applet\r
- */\r
- public Map getRegistryInfo()\r
- {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
- /**\r
- * returns the current sequenceRenderer that should be used to colour the\r
- * structures\r
- * \r
- * @param alignment\r
- * \r
- * @return\r
- */\r
- public abstract SequenceRenderer getSequenceRenderer(\r
- AlignmentViewPanel alignment);\r
-\r
- // ///////////////////////////////\r
- // JmolStatusListener\r
-\r
- public void handlePopupMenu(int x, int y)\r
- {\r
- jmolpopup.show(x, y);\r
- }\r
-\r
- // jmol/ssm only\r
- public void highlightAtom(int atomIndex, int pdbResNum, String chain,\r
- String pdbfile)\r
- {\r
- if (modelFileNames == null)\r
- {\r
- return;\r
- }\r
-\r
- // look up file model number for this pdbfile\r
- int mdlNum = 0;\r
- String fn;\r
- // may need to adjust for URLencoding here - we don't worry about that yet.\r
- while (mdlNum < modelFileNames.length\r
- && !pdbfile.equals(modelFileNames[mdlNum]))\r
- {\r
- // System.out.println("nomatch:"+pdbfile+"\nmodelfn:"+fn);\r
- mdlNum++;\r
- }\r
- if (mdlNum == modelFileNames.length)\r
- {\r
- return;\r
- }\r
-\r
- jmolHistory(false);\r
- // if (!pdbfile.equals(pdbentry.getFile()))\r
- // return;\r
- if (resetLastRes.length() > 0)\r
- {\r
- viewer.evalStringQuiet(resetLastRes.toString());\r
- }\r
-\r
- eval.setLength(0);\r
- eval.append("select " + pdbResNum); // +modelNum\r
-\r
- resetLastRes.setLength(0);\r
- resetLastRes.append("select " + pdbResNum); // +modelNum\r
-\r
- eval.append(":");\r
- resetLastRes.append(":");\r
- if (!chain.equals(" "))\r
- {\r
- eval.append(chain);\r
- resetLastRes.append(chain);\r
- }\r
- {\r
- eval.append(" /" + (mdlNum + 1));\r
- resetLastRes.append("/" + (mdlNum + 1));\r
- }\r
- eval.append(";wireframe 100;" + eval.toString() + " and not hetero;");\r
-\r
- resetLastRes.append(";wireframe 0;" + resetLastRes.toString()\r
- + " and not hetero; spacefill 0;");\r
-\r
- eval.append("spacefill 200;select none");\r
-\r
- viewer.evalStringQuiet(eval.toString());\r
- jmolHistory(true);\r
-\r
- }\r
-\r
- boolean debug = true;\r
-\r
- private void jmolHistory(boolean enable)\r
- {\r
- viewer.evalStringQuiet("History " + ((debug || enable) ? "on" : "off"));\r
- }\r
-\r
- public void loadInline(String string)\r
- {\r
- loadedInline = true;\r
- // TODO: re JAL-623\r
- // viewer.loadInline(strModel, isAppend);\r
- // could do this:\r
- // construct fake fullPathName and fileName so we can identify the file\r
- // later.\r
- // Then, construct pass a reader for the string to Jmol.\r
- // ((org.jmol.Viewer.Viewer) viewer).loadModelFromFile(fullPathName,\r
- // fileName, null, reader, false, null, null, 0);\r
- viewer.openStringInline(string);\r
- }\r
-\r
- public void mouseOverStructure(int atomIndex, String strInfo)\r
- {\r
- int pdbResNum;\r
- int alocsep = strInfo.indexOf("^");\r
- int mdlSep = strInfo.indexOf("/");\r
- int chainSeparator = strInfo.indexOf(":"), chainSeparator1 = -1;\r
-\r
- if (chainSeparator == -1)\r
- {\r
- chainSeparator = strInfo.indexOf(".");\r
- if (mdlSep > -1 && mdlSep < chainSeparator)\r
- {\r
- chainSeparator1 = chainSeparator;\r
- chainSeparator = mdlSep;\r
- }\r
- }\r
- // handle insertion codes\r
- if (alocsep != -1)\r
- {\r
- pdbResNum = Integer.parseInt(strInfo.substring(\r
- strInfo.indexOf("]") + 1, alocsep));\r
-\r
- }\r
- else\r
- {\r
- pdbResNum = Integer.parseInt(strInfo.substring(\r
- strInfo.indexOf("]") + 1, chainSeparator));\r
- }\r
- String chainId;\r
-\r
- if (strInfo.indexOf(":") > -1)\r
- chainId = strInfo.substring(strInfo.indexOf(":") + 1,\r
- strInfo.indexOf("."));\r
- else\r
- {\r
- chainId = " ";\r
- }\r
-\r
- String pdbfilename = modelFileNames[frameNo]; // default is first or current\r
- // model\r
- if (mdlSep > -1)\r
- {\r
- if (chainSeparator1 == -1)\r
- {\r
- chainSeparator1 = strInfo.indexOf(".", mdlSep);\r
- }\r
- String mdlId = (chainSeparator1 > -1) ? strInfo.substring(mdlSep + 1,\r
- chainSeparator1) : strInfo.substring(mdlSep + 1);\r
- try\r
- {\r
- // recover PDB filename for the model hovered over.\r
- int _mp = _modelFileNameMap.length - 1, mnumber = new Integer(mdlId)\r
- .intValue() - 1;\r
- while (mnumber < _modelFileNameMap[_mp])\r
- {\r
- _mp--;\r
- }\r
- pdbfilename = modelFileNames[_mp];\r
- if (pdbfilename == null)\r
- {\r
- pdbfilename = new File(viewer.getModelFileName(mnumber))\r
- .getAbsolutePath();\r
- }\r
-\r
- } catch (Exception e)\r
- {\r
- }\r
- ;\r
- }\r
- if (lastMessage == null || !lastMessage.equals(strInfo))\r
- ssm.mouseOverStructure(pdbResNum, chainId, pdbfilename);\r
-\r
- lastMessage = strInfo;\r
- }\r
-\r
- public void notifyAtomHovered(int atomIndex, String strInfo, String data)\r
- {\r
- if (data != null)\r
- {\r
- System.err.println("Ignoring additional hover info: " + data\r
- + " (other info: '" + strInfo + "' pos " + atomIndex + ")");\r
- }\r
- mouseOverStructure(atomIndex, strInfo);\r
- }\r
-\r
- /*\r
- * { if (history != null && strStatus != null &&\r
- * !strStatus.equals("Script completed")) { history.append("\n" + strStatus);\r
- * } }\r
- */\r
-\r
- public void notifyAtomPicked(int atomIndex, String strInfo, String strData)\r
- {\r
- /**\r
- * this implements the toggle label behaviour copied from the original\r
- * structure viewer, MCView\r
- */\r
- if (strData != null)\r
- {\r
- System.err.println("Ignoring additional pick data string " + strData);\r
- }\r
- int chainSeparator = strInfo.indexOf(":");\r
- int p = 0;\r
- if (chainSeparator == -1)\r
- chainSeparator = strInfo.indexOf(".");\r
-\r
- String picked = strInfo.substring(strInfo.indexOf("]") + 1,\r
- chainSeparator);\r
- String mdlString = "";\r
- if ((p = strInfo.indexOf(":")) > -1)\r
- picked += strInfo.substring(p + 1, strInfo.indexOf("."));\r
-\r
- if ((p = strInfo.indexOf("/")) > -1)\r
- {\r
- mdlString += strInfo.substring(p, strInfo.indexOf(" #"));\r
- }\r
- picked = "((" + picked + ".CA" + mdlString + ")|(" + picked + ".P"\r
- + mdlString + "))";\r
- jmolHistory(false);\r
-\r
- if (!atomsPicked.contains(picked))\r
- {\r
- viewer.evalStringQuiet("select " + picked + ";label %n %r:%c");\r
- atomsPicked.addElement(picked);\r
- }\r
- else\r
- {\r
- viewer.evalString("select " + picked + ";label off");\r
- atomsPicked.removeElement(picked);\r
- }\r
- jmolHistory(true);\r
- // TODO: in application this happens\r
- //\r
- // if (scriptWindow != null)\r
- // {\r
- // scriptWindow.sendConsoleMessage(strInfo);\r
- // scriptWindow.sendConsoleMessage("\n");\r
- // }\r
-\r
- }\r
-\r
- @Override\r
- public void notifyCallback(EnumCallback type, Object[] data)\r
- {\r
- try\r
- {\r
- switch (type)\r
- {\r
- case LOADSTRUCT:\r
- notifyFileLoaded((String) data[1], (String) data[2],\r
- (String) data[3], (String) data[4],\r
- ((Integer) data[5]).intValue());\r
-\r
- break;\r
- case PICK:\r
- notifyAtomPicked(((Integer) data[2]).intValue(), (String) data[1],\r
- (String) data[0]);\r
- // also highlight in alignment\r
- case HOVER:\r
- notifyAtomHovered(((Integer) data[2]).intValue(), (String) data[1],\r
- (String) data[0]);\r
- break;\r
- case SCRIPT:\r
- notifyScriptTermination((String) data[2],\r
- ((Integer) data[3]).intValue());\r
- break;\r
- case ECHO:\r
- sendConsoleEcho((String) data[1]);\r
- break;\r
- case MESSAGE:\r
- sendConsoleMessage((data == null) ? ((String) null)\r
- : (String) data[1]);\r
- break;\r
- case ERROR:\r
- // System.err.println("Ignoring error callback.");\r
- break;\r
- case SYNC:\r
- case RESIZE:\r
- refreshGUI();\r
- break;\r
- case MEASURE:\r
-\r
- case CLICK:\r
- default:\r
- System.err.println("Unhandled callback " + type + " "\r
- + data[1].toString());\r
- break;\r
- }\r
- } catch (Exception e)\r
- {\r
- System.err.println("Squashed Jmol callback handler error:");\r
- e.printStackTrace();\r
- }\r
- }\r
-\r
- @Override\r
- public boolean notifyEnabled(EnumCallback callbackPick)\r
- {\r
- switch (callbackPick)\r
- {\r
- case ECHO:\r
- case LOADSTRUCT:\r
- case MEASURE:\r
- case MESSAGE:\r
- case PICK:\r
- case SCRIPT:\r
- case HOVER:\r
- case ERROR:\r
- return true;\r
- case RESIZE:\r
- case SYNC:\r
- case CLICK:\r
- case ANIMFRAME:\r
- case MINIMIZATION:\r
- }\r
- return false;\r
- }\r
-\r
- // incremented every time a load notification is successfully handled -\r
- // lightweight mechanism for other threads to detect when they can start\r
- // referrring to new structures.\r
- private long loadNotifiesHandled = 0;\r
-\r
- public long getLoadNotifiesHandled()\r
- {\r
- return loadNotifiesHandled;\r
- }\r
-\r
- public void notifyFileLoaded(String fullPathName, String fileName2,\r
- String modelName, String errorMsg, int modelParts)\r
- {\r
- if (errorMsg != null)\r
- {\r
- fileLoadingError = errorMsg;\r
- refreshGUI();\r
- return;\r
- }\r
- // TODO: deal sensibly with models loaded inLine:\r
- // modelName will be null, as will fullPathName.\r
-\r
- // the rest of this routine ignores the arguments, and simply interrogates\r
- // the Jmol view to find out what structures it contains, and adds them to\r
- // the structure selection manager.\r
- fileLoadingError = null;\r
- String[] oldmodels = modelFileNames;\r
- modelFileNames = null;\r
- chainNames = new Vector();\r
- chainFile = new Hashtable();\r
- boolean notifyLoaded = false;\r
- String[] modelfilenames = getPdbFile();\r
- // first check if we've lost any structures\r
- if (oldmodels != null && oldmodels.length > 0)\r
- {\r
- int oldm = 0;\r
- for (int i = 0; i < oldmodels.length; i++)\r
- {\r
- for (int n = 0; n < modelfilenames.length; n++)\r
- {\r
- if (modelfilenames[n] == oldmodels[i])\r
- {\r
- oldmodels[i] = null;\r
- break;\r
- }\r
- }\r
- if (oldmodels[i] != null)\r
- {\r
- oldm++;\r
- }\r
- }\r
- if (oldm > 0)\r
- {\r
- String[] oldmfn = new String[oldm];\r
- oldm = 0;\r
- for (int i = 0; i < oldmodels.length; i++)\r
- {\r
- if (oldmodels[i] != null)\r
- {\r
- oldmfn[oldm++] = oldmodels[i];\r
- }\r
- }\r
- // deregister the Jmol instance for these structures - we'll add\r
- // ourselves again at the end for the current structure set.\r
- ssm.removeStructureViewerListener(this, oldmfn);\r
- }\r
- }\r
- refreshPdbEntries();\r
- for (int modelnum = 0; modelnum < modelfilenames.length; modelnum++)\r
- {\r
- String fileName = modelfilenames[modelnum];\r
- boolean foundEntry = false;\r
- MCview.PDBfile pdb = null;\r
- String pdbfile = null, pdbfhash = null;\r
- // model was probably loaded inline - so check the pdb file hashcode\r
- if (loadedInline)\r
- {\r
- // calculate essential attributes for the pdb data imported inline.\r
- // prolly need to resolve modelnumber properly - for now just use our\r
- // 'best guess'\r
- pdbfile = viewer.getData("" + (1 + _modelFileNameMap[modelnum])\r
- + ".0", "PDB");\r
- pdbfhash = "" + pdbfile.hashCode();\r
- }\r
- if (pdbentry != null)\r
- {\r
- // search pdbentries and sequences to find correct pdbentry for this\r
- // model\r
- for (int pe = 0; pe < pdbentry.length; pe++)\r
- {\r
- boolean matches = false;\r
- if (fileName == null)\r
- {\r
- if (false)\r
- // see JAL-623 - need method of matching pasted data up\r
- {\r
- pdb = ssm.setMapping(sequence[pe], chains[pe], pdbfile,\r
- AppletFormatAdapter.PASTE);\r
- pdbentry[modelnum].setFile("INLINE" + pdb.id);\r
- matches = true;\r
- foundEntry = true;\r
- }\r
- }\r
- else\r
- {\r
- File fl;\r
- if (matches = (fl = new File(pdbentry[pe].getFile()))\r
- .equals(new File(fileName)))\r
- {\r
- foundEntry = true;\r
- // TODO: Jmol can in principle retrieve from CLASSLOADER but\r
- // this\r
- // needs\r
- // to be tested. See mantis bug\r
- // https://mantis.lifesci.dundee.ac.uk/view.php?id=36605\r
- String protocol = AppletFormatAdapter.URL;\r
- try\r
- {\r
- if (fl.exists())\r
- {\r
- protocol = AppletFormatAdapter.FILE;\r
- }\r
- } catch (Exception e)\r
- {\r
- } catch (Error e)\r
- {\r
- }\r
- // Explicitly map to the filename used by Jmol ;\r
- pdb = ssm.setMapping(sequence[pe], chains[pe], fileName,\r
- protocol);\r
- // pdbentry[pe].getFile(), protocol);\r
-\r
- }\r
- }\r
- if (matches)\r
- {\r
- // add an entry for every chain in the model\r
- for (int i = 0; i < pdb.chains.size(); i++)\r
- {\r
- String chid = new String(pdb.id + ":"\r
- + ((MCview.PDBChain) pdb.chains.elementAt(i)).id);\r
- chainFile.put(chid, fileName);\r
- chainNames.addElement(chid);\r
- }\r
- notifyLoaded = true;\r
- }\r
- }\r
- }\r
- if (!foundEntry && associateNewStructs)\r
- {\r
- // this is a foreign pdb file that jalview doesn't know about - add\r
- // it to the dataset and try to find a home - either on a matching\r
- // sequence or as a new sequence.\r
- String pdbcontent = viewer.getData("/" + (modelnum + 1) + ".1",\r
- "PDB");\r
- // parse pdb file into a chain, etc.\r
- // locate best match for pdb in associated views and add mapping to\r
- // ssm\r
- // if properly registered then\r
- notifyLoaded = true;\r
-\r
- }\r
- }\r
- // FILE LOADED OK\r
- // so finally, update the jmol bits and pieces\r
- if (jmolpopup != null)\r
- {\r
- // potential for deadlock here:\r
- // jmolpopup.updateComputedMenus();\r
- }\r
- if (!isLoadingFromArchive())\r
- {\r
- viewer.evalStringQuiet("model 0; select backbone;restrict;cartoon;wireframe off;spacefill off");\r
- }\r
- // register ourselves as a listener and notify the gui that it needs to\r
- // update itself.\r
- ssm.addStructureViewerListener(this);\r
- if (notifyLoaded)\r
- {\r
- FeatureRenderer fr = getFeatureRenderer(null);\r
- if (fr != null)\r
- {\r
- fr.featuresAdded();\r
- }\r
- refreshGUI();\r
- loadNotifiesHandled++;\r
- }\r
- setLoadingFromArchive(false);\r
- }\r
-\r
- public void notifyNewPickingModeMeasurement(int iatom, String strMeasure)\r
- {\r
- notifyAtomPicked(iatom, strMeasure, null);\r
- }\r
-\r
- public abstract void notifyScriptTermination(String strStatus,\r
- int msWalltime);\r
-\r
- /**\r
- * display a message echoed from the jmol viewer\r
- * \r
- * @param strEcho\r
- */\r
- public abstract void sendConsoleEcho(String strEcho); /*\r
- * { showConsole(true);\r
- * \r
- * history.append("\n" +\r
- * strEcho); }\r
- */\r
-\r
- // /End JmolStatusListener\r
- // /////////////////////////////\r
-\r
- /**\r
- * @param strStatus\r
- * status message - usually the response received after a script\r
- * executed\r
- */\r
- public abstract void sendConsoleMessage(String strStatus);\r
-\r
- public void setCallbackFunction(String callbackType,\r
- String callbackFunction)\r
- {\r
- System.err.println("Ignoring set-callback request to associate "\r
- + callbackType + " with function " + callbackFunction);\r
-\r
- }\r
-\r
- public void setJalviewColourScheme(ColourSchemeI cs)\r
- {\r
- colourBySequence = false;\r
-\r
- if (cs == null)\r
- return;\r
-\r
- String res;\r
- int index;\r
- Color col;\r
- jmolHistory(false);\r
- // TODO: Switch between nucleotide or aa selection expressions\r
- Enumeration en = ResidueProperties.aa3Hash.keys();\r
- StringBuffer command = new StringBuffer("select *;color white;");\r
- while (en.hasMoreElements())\r
- {\r
- res = en.nextElement().toString();\r
- index = ((Integer) ResidueProperties.aa3Hash.get(res)).intValue();\r
- if (index > 20)\r
- continue;\r
-\r
- col = cs.findColour(ResidueProperties.aa[index].charAt(0));\r
-\r
- command.append("select " + res + ";color[" + col.getRed() + ","\r
- + col.getGreen() + "," + col.getBlue() + "];");\r
- }\r
-\r
- evalStateCommand(command.toString());\r
- jmolHistory(true);\r
- }\r
-\r
- public void showHelp()\r
- {\r
- showUrl("http://jmol.sourceforge.net/docs/JmolUserGuide/", "jmolHelp");\r
- }\r
-\r
- /**\r
- * open the URL somehow\r
- * \r
- * @param target\r
- */\r
- public abstract void showUrl(String url, String target);\r
-\r
- /**\r
- * called when the binding thinks the UI needs to be refreshed after a Jmol\r
- * state change. this could be because structures were loaded, or because an\r
- * error has occured.\r
- */\r
- public abstract void refreshGUI();\r
-\r
- /**\r
- * called to show or hide the associated console window container.\r
- * \r
- * @param show\r
- */\r
- public abstract void showConsole(boolean show);\r
-\r
- /**\r
- * @param renderPanel\r
- * @param jmolfileio\r
- * - when true will initialise jmol's file IO system (should be false\r
- * in applet context)\r
- * @param htmlName\r
- * @param documentBase\r
- * @param codeBase\r
- * @param commandOptions\r
- */\r
- public void allocateViewer(Container renderPanel, boolean jmolfileio,\r
- String htmlName, URL documentBase, URL codeBase,\r
- String commandOptions)\r
- {\r
- allocateViewer(renderPanel, jmolfileio, htmlName, documentBase,\r
- codeBase, commandOptions, null, null);\r
- }\r
-\r
- /**\r
- * \r
- * @param renderPanel\r
- * @param jmolfileio\r
- * - when true will initialise jmol's file IO system (should be false\r
- * in applet context)\r
- * @param htmlName\r
- * @param documentBase\r
- * @param codeBase\r
- * @param commandOptions\r
- * @param consolePanel\r
- * - panel to contain Jmol console\r
- * @param buttonsToShow\r
- * - buttons to show on the console, in ordr\r
- */\r
- public void allocateViewer(Container renderPanel, boolean jmolfileio,\r
- String htmlName, URL documentBase, URL codeBase,\r
- String commandOptions, final Container consolePanel,\r
- String buttonsToShow)\r
- {\r
- if (commandOptions == null)\r
- {\r
- commandOptions = "";\r
- }\r
- viewer = JmolViewer.allocateViewer(renderPanel,\r
- (jmolfileio ? new SmarterJmolAdapter() : null), htmlName\r
- + ((Object) this).toString(), documentBase, codeBase,\r
- commandOptions, this);\r
-\r
- console = createJmolConsole(viewer, consolePanel, buttonsToShow);\r
- if (consolePanel != null)\r
- {\r
- consolePanel.addComponentListener(this);\r
-\r
- }\r
-\r
- }\r
-\r
- protected abstract JmolAppConsoleInterface createJmolConsole(\r
- JmolViewer viewer2, Container consolePanel, String buttonsToShow);\r
-\r
- protected org.jmol.api.JmolAppConsoleInterface console = null;\r
-\r
- public void componentResized(ComponentEvent e)\r
- {\r
-\r
- }\r
-\r
- public void componentMoved(ComponentEvent e)\r
- {\r
-\r
- }\r
-\r
- public void componentShown(ComponentEvent e)\r
- {\r
- showConsole(true);\r
- }\r
-\r
- public void componentHidden(ComponentEvent e)\r
- {\r
- showConsole(false);\r
- }\r
-\r
- public void setLoadingFromArchive(boolean loadingFromArchive)\r
- {\r
- this.loadingFromArchive = loadingFromArchive;\r
- }\r
-\r
- public boolean isLoadingFromArchive()\r
- {\r
- return loadingFromArchive;\r
- }\r
-\r
- public void setBackgroundColour(java.awt.Color col)\r
- {\r
- jmolHistory(false);\r
- viewer.evalStringQuiet("background [" + col.getRed() + ","\r
- + col.getGreen() + "," + col.getBlue() + "];");\r
- jmolHistory(true);\r
- }\r
-\r
- /**\r
- * add structures and any known sequence associations\r
- * \r
- * @returns the pdb entries added to the current set.\r
- */\r
- public synchronized PDBEntry[] addSequenceAndChain(PDBEntry[] pdbe,\r
- SequenceI[][] seq, String[][] chns)\r
- {\r
- int pe = -1;\r
- Vector v = new Vector();\r
- Vector rtn = new Vector();\r
- for (int i = 0; i < pdbentry.length; i++)\r
- {\r
- v.addElement(pdbentry[i]);\r
- }\r
- for (int i = 0; i < pdbe.length; i++)\r
- {\r
- int r = v.indexOf(pdbe[i]);\r
- if (r == -1 || r >= pdbentry.length)\r
- {\r
- rtn.addElement(new int[]\r
- { v.size(), i });\r
- v.addElement(pdbe[i]);\r
- }\r
- else\r
- {\r
- // just make sure the sequence/chain entries are all up to date\r
- addSequenceAndChain(r, seq[i], chns[i]);\r
- }\r
- }\r
- pdbe = new PDBEntry[v.size()];\r
- v.copyInto(pdbe);\r
- pdbentry = pdbe;\r
- if (rtn.size() > 0)\r
- {\r
- // expand the tied seuqence[] and string[] arrays\r
- SequenceI[][] sqs = new SequenceI[pdbentry.length][];\r
- String[][] sch = new String[pdbentry.length][];\r
- System.arraycopy(sequence, 0, sqs, 0, sequence.length);\r
- System.arraycopy(chains, 0, sch, 0, this.chains.length);\r
- sequence = sqs;\r
- chains = sch;\r
- pdbe = new PDBEntry[rtn.size()];\r
- for (int r = 0; r < pdbe.length; r++)\r
- {\r
- int[] stri = ((int[]) rtn.elementAt(r));\r
- // record the pdb file as a new addition\r
- pdbe[r] = pdbentry[stri[0]];\r
- // and add the new sequence/chain entries\r
- addSequenceAndChain(stri[0], seq[stri[1]], chns[stri[1]]);\r
- }\r
- }\r
- else\r
- {\r
- pdbe = null;\r
- }\r
- return pdbe;\r
- }\r
-\r
- public void addSequence(int pe, SequenceI[] seq)\r
- {\r
- // add sequences to the pe'th pdbentry's seuqence set.\r
- addSequenceAndChain(pe, seq, null);\r
- }\r
-\r
- private void addSequenceAndChain(int pe, SequenceI[] seq, String[] tchain)\r
- {\r
- if (pe < 0 || pe >= pdbentry.length)\r
- {\r
- throw new Error(\r
- "Implementation error - no corresponding pdbentry (for index "\r
- + pe + ") to add sequences mappings to");\r
- }\r
- final String nullChain = "TheNullChain";\r
- Vector s = new Vector();\r
- Vector c = new Vector();\r
- if (chains == null)\r
- {\r
- chains = new String[pdbentry.length][];\r
- }\r
- if (sequence[pe] != null)\r
- {\r
- for (int i = 0; i < sequence[pe].length; i++)\r
- {\r
- s.addElement(sequence[pe][i]);\r
- if (chains[pe] != null)\r
- {\r
- if (i < chains[pe].length)\r
- {\r
- c.addElement(chains[pe][i]);\r
- }\r
- else\r
- {\r
- c.addElement(nullChain);\r
- }\r
- }\r
- else\r
- {\r
- if (tchain != null && tchain.length > 0)\r
- {\r
- c.addElement(nullChain);\r
- }\r
- }\r
- }\r
- }\r
- for (int i = 0; i < seq.length; i++)\r
- {\r
- if (!s.contains(seq[i]))\r
- {\r
- s.addElement(seq[i]);\r
- if (tchain != null && i < tchain.length)\r
- {\r
- c.addElement(tchain[i] == null ? nullChain : tchain[i]);\r
- }\r
- }\r
- }\r
- SequenceI[] tmp = new SequenceI[s.size()];\r
- s.copyInto(tmp);\r
- sequence[pe] = tmp;\r
- if (c.size() > 0)\r
- {\r
- String[] tch = new String[c.size()];\r
- c.copyInto(tch);\r
- for (int i = 0; i < tch.length; i++)\r
- {\r
- if (tch[i] == nullChain)\r
- {\r
- tch[i] = null;\r
- }\r
- }\r
- chains[pe] = tch;\r
- }\r
- else\r
- {\r
- chains[pe] = null;\r
- }\r
- }\r
-\r
- /**\r
- * \r
- * @param pdbfile\r
- * @return text report of alignment between pdbfile and any associated\r
- * alignment sequences\r
- */\r
- public String printMapping(String pdbfile)\r
- {\r
- return ssm.printMapping(pdbfile);\r
- }\r
-\r
- @Override\r
- public void resizeInnerPanel(String data)\r
- {\r
- // Jalview doesn't honour resize panel requests\r
-\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.ext.jmol;
+
+import jalview.api.AlignmentViewPanel;
+import jalview.api.FeatureRenderer;
+import jalview.api.SequenceRenderer;
+import jalview.api.SequenceStructureBinding;
+import jalview.api.StructureSelectionManagerProvider;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.PDBEntry;
+import jalview.datamodel.SequenceI;
+import jalview.io.AppletFormatAdapter;
+import jalview.schemes.ColourSchemeI;
+import jalview.schemes.ResidueProperties;
+import jalview.structure.StructureListener;
+import jalview.structure.StructureMapping;
+import jalview.structure.StructureSelectionManager;
+
+import java.awt.Color;
+import java.awt.Container;
+import java.awt.event.ComponentEvent;
+import java.awt.event.ComponentListener;
+import java.io.File;
+import java.net.URL;
+import java.security.AccessControlException;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.Vector;
+
+import org.jmol.adapter.smarter.SmarterJmolAdapter;
+import org.jmol.api.JmolAppConsoleInterface;
+import org.jmol.api.JmolSelectionListener;
+import org.jmol.api.JmolStatusListener;
+import org.jmol.api.JmolViewer;
+import org.jmol.constant.EnumCallback;
+import org.jmol.popup.JmolPopup;
+
+public abstract class JalviewJmolBinding implements StructureListener,
+ JmolStatusListener, SequenceStructureBinding,
+ JmolSelectionListener, ComponentListener,
+ StructureSelectionManagerProvider
+
+{
+ /**
+ * set if Jmol state is being restored from some source - instructs binding
+ * not to apply default display style when structure set is updated for first
+ * time.
+ */
+ private boolean loadingFromArchive = false;
+
+ /**
+ * state flag used to check if the Jmol viewer's paint method can be called
+ */
+ private boolean finishedInit = false;
+
+ public boolean isFinishedInit()
+ {
+ return finishedInit;
+ }
+
+ public void setFinishedInit(boolean finishedInit)
+ {
+ this.finishedInit = finishedInit;
+ }
+
+ boolean allChainsSelected = false;
+
+ /**
+ * when true, try to search the associated datamodel for sequences that are
+ * associated with any unknown structures in the Jmol view.
+ */
+ private boolean associateNewStructs = false;
+
+ Vector atomsPicked = new Vector();
+
+ public Vector chainNames;
+
+ Hashtable chainFile;
+
+ /**
+ * array of target chains for seuqences - tied to pdbentry and sequence[]
+ */
+ protected String[][] chains;
+
+ boolean colourBySequence = true;
+
+ StringBuffer eval = new StringBuffer();
+
+ public String fileLoadingError;
+
+ /**
+ * the default or current model displayed if the model cannot be identified
+ * from the selection message
+ */
+ int frameNo = 0;
+
+ protected JmolPopup jmolpopup;
+
+ String lastCommand;
+
+ String lastMessage;
+
+ boolean loadedInline;
+
+ /**
+ * current set of model filenames loaded in the Jmol instance
+ */
+ String[] modelFileNames = null;
+
+ public PDBEntry[] pdbentry;
+
+ /**
+ * datasource protocol for access to PDBEntrylatest
+ */
+ String protocol = null;
+
+ StringBuffer resetLastRes = new StringBuffer();
+
+ /**
+ * sequences mapped to each pdbentry
+ */
+ public SequenceI[][] sequence;
+
+ public StructureSelectionManager ssm;
+
+ public JmolViewer viewer;
+
+ public JalviewJmolBinding(StructureSelectionManager ssm,
+ PDBEntry[] pdbentry, SequenceI[][] sequenceIs, String[][] chains,
+ String protocol)
+ {
+ this.ssm = ssm;
+ this.sequence = sequenceIs;
+ this.chains = chains;
+ this.pdbentry = pdbentry;
+ this.protocol = protocol;
+ if (chains == null)
+ {
+ this.chains = new String[pdbentry.length][];
+ }
+ /*
+ * viewer = JmolViewer.allocateViewer(renderPanel, new SmarterJmolAdapter(),
+ * "jalviewJmol", ap.av.applet .getDocumentBase(),
+ * ap.av.applet.getCodeBase(), "", this);
+ *
+ * jmolpopup = JmolPopup.newJmolPopup(viewer, true, "Jmol", true);
+ */
+ }
+
+ public JalviewJmolBinding(StructureSelectionManager ssm,
+ JmolViewer viewer2)
+ {
+ this.ssm = ssm;
+ viewer = viewer2;
+ viewer.setJmolStatusListener(this);
+ viewer.addSelectionListener(this);
+ }
+
+ /**
+ * construct a title string for the viewer window based on the data jalview
+ * knows about
+ *
+ * @return
+ */
+ public String getViewerTitle()
+ {
+ if (sequence == null || pdbentry == null || sequence.length < 1
+ || pdbentry.length < 1 || sequence[0].length < 1)
+ {
+ return ("Jalview Jmol Window");
+ }
+ // TODO: give a more informative title when multiple structures are
+ // displayed.
+ StringBuffer title = new StringBuffer(sequence[0][0].getName() + ":"
+ + pdbentry[0].getId());
+
+ if (pdbentry[0].getProperty() != null)
+ {
+ if (pdbentry[0].getProperty().get("method") != null)
+ {
+ title.append(" Method: ");
+ title.append(pdbentry[0].getProperty().get("method"));
+ }
+ if (pdbentry[0].getProperty().get("chains") != null)
+ {
+ title.append(" Chain:");
+ title.append(pdbentry[0].getProperty().get("chains"));
+ }
+ }
+ return title.toString();
+ }
+
+ /**
+ * prepare the view for a given set of models/chains. chainList contains
+ * strings of the form 'pdbfilename:Chaincode'
+ *
+ * @param chainList
+ * list of chains to make visible
+ */
+ public void centerViewer(Vector chainList)
+ {
+ StringBuffer cmd = new StringBuffer();
+ String lbl;
+ int mlength, p;
+ for (int i = 0, iSize = chainList.size(); i < iSize; i++)
+ {
+ mlength = 0;
+ lbl = (String) chainList.elementAt(i);
+ do
+ {
+ p = mlength;
+ mlength = lbl.indexOf(":", p);
+ } while (p < mlength && mlength < (lbl.length() - 2));
+ // TODO: lookup each pdb id and recover proper model number for it.
+ cmd.append(":" + lbl.substring(mlength + 1) + " /"
+ + (1 + getModelNum((String) chainFile.get(lbl))) + " or ");
+ }
+ if (cmd.length() > 0)
+ cmd.setLength(cmd.length() - 4);
+ evalStateCommand("select *;restrict " + cmd + ";cartoon;center " + cmd);
+ }
+
+ public void closeViewer()
+ {
+ viewer.setModeMouse(org.jmol.viewer.JmolConstants.MOUSE_NONE);
+ // remove listeners for all structures in viewer
+ ssm.removeStructureViewerListener(this, this.getPdbFile());
+ // and shut down jmol
+ viewer.evalStringQuiet("zap");
+ viewer.setJmolStatusListener(null);
+ lastCommand = null;
+ viewer = null;
+ releaseUIResources();
+ }
+
+ /**
+ * called by JalviewJmolbinding after closeViewer is called - release any
+ * resources and references so they can be garbage collected.
+ */
+ protected abstract void releaseUIResources();
+
+ public void colourByChain()
+ {
+ colourBySequence = false;
+ // TODO: colour by chain should colour each chain distinctly across all
+ // visible models
+ // TODO: http://issues.jalview.org/browse/JAL-628
+ evalStateCommand("select *;color chain");
+ }
+
+ public void colourByCharge()
+ {
+ colourBySequence = false;
+ evalStateCommand("select *;color white;select ASP,GLU;color red;"
+ + "select LYS,ARG;color blue;select CYS;color yellow");
+ }
+
+ /**
+ * superpose the structures associated with sequences in the alignment
+ * according to their corresponding positions.
+ */
+ public void superposeStructures(AlignmentI alignment)
+ {
+ superposeStructures(alignment, -1, null);
+ }
+
+ /**
+ * superpose the structures associated with sequences in the alignment
+ * according to their corresponding positions. ded)
+ *
+ * @param refStructure
+ * - select which pdb file to use as reference (default is -1 - the
+ * first structure in the alignment)
+ */
+ public void superposeStructures(AlignmentI alignment, int refStructure)
+ {
+ superposeStructures(alignment, refStructure, null);
+ }
+
+ /**
+ * superpose the structures associated with sequences in the alignment
+ * according to their corresponding positions. ded)
+ *
+ * @param refStructure
+ * - select which pdb file to use as reference (default is -1 - the
+ * first structure in the alignment)
+ * @param hiddenCols
+ * TODO
+ */
+ public void superposeStructures(AlignmentI alignment, int refStructure,
+ ColumnSelection hiddenCols)
+ {
+ superposeStructures(new AlignmentI[]
+ { alignment }, new int[]
+ { refStructure }, new ColumnSelection[]
+ { hiddenCols });
+ }
+
+ public void superposeStructures(AlignmentI[] _alignment,
+ int[] _refStructure, ColumnSelection[] _hiddenCols)
+ {
+ String[] files = getPdbFile();
+ StringBuffer selectioncom = new StringBuffer();
+ assert (_alignment.length == _refStructure.length && _alignment.length != _hiddenCols.length);
+ // union of all aligned positions are collected together.
+ for (int a = 0; a < _alignment.length; a++)
+ {
+ int refStructure = _refStructure[a];
+ AlignmentI alignment = _alignment[a];
+ ColumnSelection hiddenCols = _hiddenCols[a];
+ if (a > 0
+ && selectioncom.length() > 0
+ && !selectioncom.substring(selectioncom.length() - 1).equals(
+ "|"))
+ {
+ selectioncom.append("|");
+ }
+ // process this alignment
+ if (refStructure >= files.length)
+ {
+ System.err.println("Invalid reference structure value "
+ + refStructure);
+ refStructure = -1;
+ }
+ if (refStructure < -1)
+ {
+ refStructure = -1;
+ }
+ StringBuffer command = new StringBuffer();
+
+ boolean matched[] = new boolean[alignment.getWidth()];
+ for (int m = 0; m < matched.length; m++)
+ {
+
+ matched[m] = (hiddenCols != null) ? hiddenCols.isVisible(m) : true;
+ }
+
+ int commonrpositions[][] = new int[files.length][alignment.getWidth()];
+ String isel[] = new String[files.length];
+ // reference structure - all others are superposed in it
+ String[] targetC = new String[files.length];
+ String[] chainNames = new String[files.length];
+ for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++)
+ {
+ StructureMapping[] mapping = ssm.getMapping(files[pdbfnum]);
+ // RACE CONDITION - getMapping only returns Jmol loaded filenames once
+ // Jmol callback has completed.
+ if (mapping == null || mapping.length < 1)
+ continue;
+
+ int lastPos = -1;
+ for (int s = 0; s < sequence[pdbfnum].length; s++)
+ {
+ for (int sp, m = 0; m < mapping.length; m++)
+ {
+ if (mapping[m].getSequence() == sequence[pdbfnum][s]
+ && (sp = alignment.findIndex(sequence[pdbfnum][s])) > -1)
+ {
+ if (refStructure == -1)
+ {
+ refStructure = pdbfnum;
+ }
+ SequenceI asp = alignment.getSequenceAt(sp);
+ for (int r = 0; r < matched.length; r++)
+ {
+ if (!matched[r])
+ {
+ continue;
+ }
+ matched[r] = false; // assume this is not a good site
+ if (r >= asp.getLength())
+ {
+ continue;
+ }
+
+ if (jalview.util.Comparison.isGap(asp.getCharAt(r)))
+ {
+ // no mapping to gaps in sequence
+ continue;
+ }
+ int t = asp.findPosition(r); // sequence position
+ int apos = mapping[m].getAtomNum(t);
+ int pos = mapping[m].getPDBResNum(t);
+
+ if (pos < 1 || pos == lastPos)
+ {
+ // can't align unmapped sequence
+ continue;
+ }
+ matched[r] = true; // this is a good ite
+ lastPos = pos;
+ // just record this residue position
+ commonrpositions[pdbfnum][r] = pos;
+ }
+ // create model selection suffix
+ isel[pdbfnum] = "/" + (pdbfnum + 1) + ".1";
+ if (mapping[m].getChain() == null
+ || mapping[m].getChain().trim().length() == 0)
+ {
+ targetC[pdbfnum] = "";
+ }
+ else
+ {
+ targetC[pdbfnum] = ":" + mapping[m].getChain();
+ }
+ chainNames[pdbfnum] = mapping[m].getPdbId()
+ + targetC[pdbfnum];
+ // move on to next pdb file
+ s = sequence[pdbfnum].length;
+ break;
+ }
+ }
+ }
+ }
+ String[] selcom = new String[files.length];
+ int nmatched = 0;
+ // generate select statements to select regions to superimpose structures
+ {
+ for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++)
+ {
+ String chainCd = targetC[pdbfnum];
+ int lpos = -1;
+ boolean run = false;
+ StringBuffer molsel = new StringBuffer();
+ molsel.append("{");
+ for (int r = 0; r < matched.length; r++)
+ {
+ if (matched[r])
+ {
+ if (pdbfnum == 0)
+ {
+ nmatched++;
+ }
+ if (lpos != commonrpositions[pdbfnum][r] - 1)
+ {
+ // discontinuity
+ if (lpos != -1)
+ {
+ molsel.append(lpos);
+ molsel.append(chainCd);
+ // molsel.append("} {");
+ molsel.append("|");
+ }
+ }
+ else
+ {
+ // continuous run - and lpos >-1
+ if (!run)
+ {
+ // at the beginning, so add dash
+ molsel.append(lpos);
+ molsel.append("-");
+ }
+ run = true;
+ }
+ lpos = commonrpositions[pdbfnum][r];
+ // molsel.append(lpos);
+ }
+ }
+ // add final selection phrase
+ if (lpos != -1)
+ {
+ molsel.append(lpos);
+ molsel.append(chainCd);
+ molsel.append("}");
+ }
+ selcom[pdbfnum] = molsel.toString();
+ selectioncom.append("((");
+ selectioncom.append(selcom[pdbfnum].substring(1,
+ selcom[pdbfnum].length() - 1));
+ selectioncom.append(" )& ");
+ selectioncom.append(pdbfnum + 1);
+ selectioncom.append(".1)");
+ if (pdbfnum < files.length - 1)
+ {
+ selectioncom.append("|");
+ }
+ }
+ }
+ // TODO: consider bailing if nmatched less than 4 because superposition
+ // not
+ // well defined.
+ // TODO: refactor superposable position search (above) from jmol selection
+ // construction (below)
+ for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++)
+ {
+ if (pdbfnum == refStructure)
+ {
+ continue;
+ }
+ command.append("echo ");
+ command.append("\"Superposing (");
+ command.append(chainNames[pdbfnum]);
+ command.append(") against reference (");
+ command.append(chainNames[refStructure]);
+ command.append(")\";\ncompare ");
+ command.append("{");
+ command.append(1 + pdbfnum);
+ command.append(".1} {");
+ command.append(1 + refStructure);
+ command.append(".1} SUBSET {*.CA | *.P} ATOMS ");
+
+ // form the matched pair strings
+ String sep = "";
+ for (int s = 0; s < 2; s++)
+ {
+ command.append(selcom[(s == 0 ? pdbfnum : refStructure)]);
+ }
+ command.append(" ROTATE TRANSLATE;\n");
+ }
+ System.out.println("Select regions:\n" + selectioncom.toString());
+ evalStateCommand("select *; cartoons off; backbone; select ("
+ + selectioncom.toString() + "); cartoons; ");
+ // selcom.append("; ribbons; ");
+ System.out.println("Superimpose command(s):\n" + command.toString());
+
+ evalStateCommand(command.toString());
+ }
+ if (selectioncom.length() > 0)
+ {// finally, mark all regions that were superposed.
+ if (selectioncom.substring(selectioncom.length() - 1).equals("|"))
+ {
+ selectioncom.setLength(selectioncom.length() - 1);
+ }
+ System.out.println("Select regions:\n" + selectioncom.toString());
+ evalStateCommand("select *; cartoons off; backbone; select ("
+ + selectioncom.toString() + "); cartoons; ");
+ // evalStateCommand("select *; backbone; select "+selcom.toString()+"; cartoons; center "+selcom.toString());
+ }
+ }
+
+ public void evalStateCommand(String command)
+ {
+ jmolHistory(false);
+ if (lastCommand == null || !lastCommand.equals(command))
+ {
+ viewer.evalStringQuiet(command + "\n");
+ }
+ jmolHistory(true);
+ lastCommand = command;
+ }
+
+ /**
+ * colour any structures associated with sequences in the given alignment
+ * using the getFeatureRenderer() and getSequenceRenderer() renderers but only
+ * if colourBySequence is enabled.
+ */
+ public void colourBySequence(boolean showFeatures,
+ jalview.api.AlignmentViewPanel alignmentv)
+ {
+ if (!colourBySequence)
+ return;
+ if (ssm == null)
+ {
+ return;
+ }
+ String[] files = getPdbFile();
+
+ SequenceRenderer sr = getSequenceRenderer(alignmentv);
+
+ FeatureRenderer fr = null;
+ if (showFeatures)
+ {
+ fr = getFeatureRenderer(alignmentv);
+ }
+ AlignmentI alignment = alignmentv.getAlignment();
+
+ for (jalview.structure.StructureMappingcommandSet cpdbbyseq : JmolCommands
+ .getColourBySequenceCommand(ssm, files, sequence, sr, fr,
+ alignment))
+ for (String cbyseq : cpdbbyseq.commands)
+ {
+ evalStateCommand(cbyseq);
+ }
+ }
+
+ public boolean isColourBySequence()
+ {
+ return colourBySequence;
+ }
+
+ public void setColourBySequence(boolean colourBySequence)
+ {
+ this.colourBySequence = colourBySequence;
+ }
+
+ public void createImage(String file, String type, int quality)
+ {
+ System.out.println("JMOL CREATE IMAGE");
+ }
+
+ public String createImage(String fileName, String type,
+ Object textOrBytes, int quality)
+ {
+ System.out.println("JMOL CREATE IMAGE");
+ return null;
+ }
+
+ public String eval(String strEval)
+ {
+ // System.out.println(strEval);
+ // "# 'eval' is implemented only for the applet.";
+ return null;
+ }
+
+ // End StructureListener
+ // //////////////////////////
+
+ public float[][] functionXY(String functionName, int x, int y)
+ {
+ return null;
+ }
+
+ public float[][][] functionXYZ(String functionName, int nx, int ny, int nz)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Color getColour(int atomIndex, int pdbResNum, String chain,
+ String pdbfile)
+ {
+ if (getModelNum(pdbfile) < 0)
+ return null;
+ // TODO: verify atomIndex is selecting correct model.
+ return new Color(viewer.getAtomArgb(atomIndex));
+ }
+
+ /**
+ * returns the current featureRenderer that should be used to colour the
+ * structures
+ *
+ * @param alignment
+ *
+ * @return
+ */
+ public abstract FeatureRenderer getFeatureRenderer(
+ AlignmentViewPanel alignment);
+
+ /**
+ * instruct the Jalview binding to update the pdbentries vector if necessary
+ * prior to matching the jmol view's contents to the list of structure files
+ * Jalview knows about.
+ */
+ public abstract void refreshPdbEntries();
+
+ private int getModelNum(String modelFileName)
+ {
+ String[] mfn = getPdbFile();
+ if (mfn == null)
+ {
+ return -1;
+ }
+ for (int i = 0; i < mfn.length; i++)
+ {
+ if (mfn[i].equalsIgnoreCase(modelFileName))
+ return i;
+ }
+ return -1;
+ }
+
+ /**
+ * map between index of model filename returned from getPdbFile and the first
+ * index of models from this file in the viewer. Note - this is not trimmed -
+ * use getPdbFile to get number of unique models.
+ */
+ private int _modelFileNameMap[];
+
+ // ////////////////////////////////
+ // /StructureListener
+ public synchronized String[] getPdbFile()
+ {
+ if (viewer == null)
+ {
+ return new String[0];
+ }
+ if (modelFileNames == null)
+ {
+
+ String mset[] = new String[viewer.getModelCount()];
+ _modelFileNameMap = new int[mset.length];
+ int j = 1;
+ String m = viewer.getModelFileName(0);
+ if (m != null)
+ {
+ try
+ {
+ mset[0] = new File(m).getAbsolutePath();
+ } catch (AccessControlException x)
+ {
+ // usually not allowed to do this in applet, so keep raw handle
+ mset[0] = m;
+ // System.err.println("jmolBinding: Using local file string from Jmol: "+m);
+ }
+ }
+ for (int i = 1; i < mset.length; i++)
+ {
+ m = viewer.getModelFileName(i);
+ if (m != null)
+ {
+ try
+ {
+ mset[j] = new File(m).getAbsolutePath();
+ } catch (AccessControlException x)
+ {
+ // usually not allowed to do this in applet, so keep raw handle
+ mset[j] = m;
+ // System.err.println("jmolBinding: Using local file string from Jmol: "+m);
+ }
+ }
+ _modelFileNameMap[j] = i; // record the model index for the filename
+ // skip any additional models in the same file (NMR structures)
+ if ((mset[j] == null ? mset[j] != mset[j - 1]
+ : (mset[j - 1] == null || !mset[j].equals(mset[j - 1]))))
+ {
+ j++;
+ }
+ }
+ modelFileNames = new String[j];
+ System.arraycopy(mset, 0, modelFileNames, 0, j);
+ }
+ return modelFileNames;
+ }
+
+ /**
+ * map from string to applet
+ */
+ public Map getRegistryInfo()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /**
+ * returns the current sequenceRenderer that should be used to colour the
+ * structures
+ *
+ * @param alignment
+ *
+ * @return
+ */
+ public abstract SequenceRenderer getSequenceRenderer(
+ AlignmentViewPanel alignment);
+
+ // ///////////////////////////////
+ // JmolStatusListener
+
+ public void handlePopupMenu(int x, int y)
+ {
+ jmolpopup.show(x, y);
+ }
+
+ // jmol/ssm only
+ public void highlightAtom(int atomIndex, int pdbResNum, String chain,
+ String pdbfile)
+ {
+ if (modelFileNames == null)
+ {
+ return;
+ }
+
+ // look up file model number for this pdbfile
+ int mdlNum = 0;
+ String fn;
+ // may need to adjust for URLencoding here - we don't worry about that yet.
+ while (mdlNum < modelFileNames.length
+ && !pdbfile.equals(modelFileNames[mdlNum]))
+ {
+ // System.out.println("nomatch:"+pdbfile+"\nmodelfn:"+fn);
+ mdlNum++;
+ }
+ if (mdlNum == modelFileNames.length)
+ {
+ return;
+ }
+
+ jmolHistory(false);
+ // if (!pdbfile.equals(pdbentry.getFile()))
+ // return;
+ if (resetLastRes.length() > 0)
+ {
+ viewer.evalStringQuiet(resetLastRes.toString());
+ }
+
+ eval.setLength(0);
+ eval.append("select " + pdbResNum); // +modelNum
+
+ resetLastRes.setLength(0);
+ resetLastRes.append("select " + pdbResNum); // +modelNum
+
+ eval.append(":");
+ resetLastRes.append(":");
+ if (!chain.equals(" "))
+ {
+ eval.append(chain);
+ resetLastRes.append(chain);
+ }
+ {
+ eval.append(" /" + (mdlNum + 1));
+ resetLastRes.append("/" + (mdlNum + 1));
+ }
+ eval.append(";wireframe 100;" + eval.toString() + " and not hetero;");
+
+ resetLastRes.append(";wireframe 0;" + resetLastRes.toString()
+ + " and not hetero; spacefill 0;");
+
+ eval.append("spacefill 200;select none");
+
+ viewer.evalStringQuiet(eval.toString());
+ jmolHistory(true);
+
+ }
+
+ boolean debug = true;
+
+ private void jmolHistory(boolean enable)
+ {
+ viewer.evalStringQuiet("History " + ((debug || enable) ? "on" : "off"));
+ }
+
+ public void loadInline(String string)
+ {
+ loadedInline = true;
+ // TODO: re JAL-623
+ // viewer.loadInline(strModel, isAppend);
+ // could do this:
+ // construct fake fullPathName and fileName so we can identify the file
+ // later.
+ // Then, construct pass a reader for the string to Jmol.
+ // ((org.jmol.Viewer.Viewer) viewer).loadModelFromFile(fullPathName,
+ // fileName, null, reader, false, null, null, 0);
+ viewer.openStringInline(string);
+ }
+
+ public void mouseOverStructure(int atomIndex, String strInfo)
+ {
+ int pdbResNum;
+ int alocsep = strInfo.indexOf("^");
+ int mdlSep = strInfo.indexOf("/");
+ int chainSeparator = strInfo.indexOf(":"), chainSeparator1 = -1;
+
+ if (chainSeparator == -1)
+ {
+ chainSeparator = strInfo.indexOf(".");
+ if (mdlSep > -1 && mdlSep < chainSeparator)
+ {
+ chainSeparator1 = chainSeparator;
+ chainSeparator = mdlSep;
+ }
+ }
+ // handle insertion codes
+ if (alocsep != -1)
+ {
+ pdbResNum = Integer.parseInt(strInfo.substring(
+ strInfo.indexOf("]") + 1, alocsep));
+
+ }
+ else
+ {
+ pdbResNum = Integer.parseInt(strInfo.substring(
+ strInfo.indexOf("]") + 1, chainSeparator));
+ }
+ String chainId;
+
+ if (strInfo.indexOf(":") > -1)
+ chainId = strInfo.substring(strInfo.indexOf(":") + 1,
+ strInfo.indexOf("."));
+ else
+ {
+ chainId = " ";
+ }
+
+ String pdbfilename = modelFileNames[frameNo]; // default is first or current
+ // model
+ if (mdlSep > -1)
+ {
+ if (chainSeparator1 == -1)
+ {
+ chainSeparator1 = strInfo.indexOf(".", mdlSep);
+ }
+ String mdlId = (chainSeparator1 > -1) ? strInfo.substring(mdlSep + 1,
+ chainSeparator1) : strInfo.substring(mdlSep + 1);
+ try
+ {
+ // recover PDB filename for the model hovered over.
+ int _mp = _modelFileNameMap.length - 1, mnumber = new Integer(mdlId)
+ .intValue() - 1;
+ while (mnumber < _modelFileNameMap[_mp])
+ {
+ _mp--;
+ }
+ pdbfilename = modelFileNames[_mp];
+ if (pdbfilename == null)
+ {
+ pdbfilename = new File(viewer.getModelFileName(mnumber))
+ .getAbsolutePath();
+ }
+
+ } catch (Exception e)
+ {
+ }
+ ;
+ }
+ if (lastMessage == null || !lastMessage.equals(strInfo))
+ ssm.mouseOverStructure(pdbResNum, chainId, pdbfilename);
+
+ lastMessage = strInfo;
+ }
+
+ public void notifyAtomHovered(int atomIndex, String strInfo, String data)
+ {
+ if (data != null)
+ {
+ System.err.println("Ignoring additional hover info: " + data
+ + " (other info: '" + strInfo + "' pos " + atomIndex + ")");
+ }
+ mouseOverStructure(atomIndex, strInfo);
+ }
+
+ /*
+ * { if (history != null && strStatus != null &&
+ * !strStatus.equals("Script completed")) { history.append("\n" + strStatus);
+ * } }
+ */
+
+ public void notifyAtomPicked(int atomIndex, String strInfo, String strData)
+ {
+ /**
+ * this implements the toggle label behaviour copied from the original
+ * structure viewer, MCView
+ */
+ if (strData != null)
+ {
+ System.err.println("Ignoring additional pick data string " + strData);
+ }
+ int chainSeparator = strInfo.indexOf(":");
+ int p = 0;
+ if (chainSeparator == -1)
+ chainSeparator = strInfo.indexOf(".");
+
+ String picked = strInfo.substring(strInfo.indexOf("]") + 1,
+ chainSeparator);
+ String mdlString = "";
+ if ((p = strInfo.indexOf(":")) > -1)
+ picked += strInfo.substring(p + 1, strInfo.indexOf("."));
+
+ if ((p = strInfo.indexOf("/")) > -1)
+ {
+ mdlString += strInfo.substring(p, strInfo.indexOf(" #"));
+ }
+ picked = "((" + picked + ".CA" + mdlString + ")|(" + picked + ".P"
+ + mdlString + "))";
+ jmolHistory(false);
+
+ if (!atomsPicked.contains(picked))
+ {
+ viewer.evalStringQuiet("select " + picked + ";label %n %r:%c");
+ atomsPicked.addElement(picked);
+ }
+ else
+ {
+ viewer.evalString("select " + picked + ";label off");
+ atomsPicked.removeElement(picked);
+ }
+ jmolHistory(true);
+ // TODO: in application this happens
+ //
+ // if (scriptWindow != null)
+ // {
+ // scriptWindow.sendConsoleMessage(strInfo);
+ // scriptWindow.sendConsoleMessage("\n");
+ // }
+
+ }
+
+ @Override
+ public void notifyCallback(EnumCallback type, Object[] data)
+ {
+ try
+ {
+ switch (type)
+ {
+ case LOADSTRUCT:
+ notifyFileLoaded((String) data[1], (String) data[2],
+ (String) data[3], (String) data[4],
+ ((Integer) data[5]).intValue());
+
+ break;
+ case PICK:
+ notifyAtomPicked(((Integer) data[2]).intValue(), (String) data[1],
+ (String) data[0]);
+ // also highlight in alignment
+ case HOVER:
+ notifyAtomHovered(((Integer) data[2]).intValue(), (String) data[1],
+ (String) data[0]);
+ break;
+ case SCRIPT:
+ notifyScriptTermination((String) data[2],
+ ((Integer) data[3]).intValue());
+ break;
+ case ECHO:
+ sendConsoleEcho((String) data[1]);
+ break;
+ case MESSAGE:
+ sendConsoleMessage((data == null) ? ((String) null)
+ : (String) data[1]);
+ break;
+ case ERROR:
+ // System.err.println("Ignoring error callback.");
+ break;
+ case SYNC:
+ case RESIZE:
+ refreshGUI();
+ break;
+ case MEASURE:
+
+ case CLICK:
+ default:
+ System.err.println("Unhandled callback " + type + " "
+ + data[1].toString());
+ break;
+ }
+ } catch (Exception e)
+ {
+ System.err.println("Squashed Jmol callback handler error:");
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public boolean notifyEnabled(EnumCallback callbackPick)
+ {
+ switch (callbackPick)
+ {
+ case ECHO:
+ case LOADSTRUCT:
+ case MEASURE:
+ case MESSAGE:
+ case PICK:
+ case SCRIPT:
+ case HOVER:
+ case ERROR:
+ return true;
+ case RESIZE:
+ case SYNC:
+ case CLICK:
+ case ANIMFRAME:
+ case MINIMIZATION:
+ }
+ return false;
+ }
+
+ // incremented every time a load notification is successfully handled -
+ // lightweight mechanism for other threads to detect when they can start
+ // referrring to new structures.
+ private long loadNotifiesHandled = 0;
+
+ public long getLoadNotifiesHandled()
+ {
+ return loadNotifiesHandled;
+ }
+
+ public void notifyFileLoaded(String fullPathName, String fileName2,
+ String modelName, String errorMsg, int modelParts)
+ {
+ if (errorMsg != null)
+ {
+ fileLoadingError = errorMsg;
+ refreshGUI();
+ return;
+ }
+ // TODO: deal sensibly with models loaded inLine:
+ // modelName will be null, as will fullPathName.
+
+ // the rest of this routine ignores the arguments, and simply interrogates
+ // the Jmol view to find out what structures it contains, and adds them to
+ // the structure selection manager.
+ fileLoadingError = null;
+ String[] oldmodels = modelFileNames;
+ modelFileNames = null;
+ chainNames = new Vector();
+ chainFile = new Hashtable();
+ boolean notifyLoaded = false;
+ String[] modelfilenames = getPdbFile();
+ // first check if we've lost any structures
+ if (oldmodels != null && oldmodels.length > 0)
+ {
+ int oldm = 0;
+ for (int i = 0; i < oldmodels.length; i++)
+ {
+ for (int n = 0; n < modelfilenames.length; n++)
+ {
+ if (modelfilenames[n] == oldmodels[i])
+ {
+ oldmodels[i] = null;
+ break;
+ }
+ }
+ if (oldmodels[i] != null)
+ {
+ oldm++;
+ }
+ }
+ if (oldm > 0)
+ {
+ String[] oldmfn = new String[oldm];
+ oldm = 0;
+ for (int i = 0; i < oldmodels.length; i++)
+ {
+ if (oldmodels[i] != null)
+ {
+ oldmfn[oldm++] = oldmodels[i];
+ }
+ }
+ // deregister the Jmol instance for these structures - we'll add
+ // ourselves again at the end for the current structure set.
+ ssm.removeStructureViewerListener(this, oldmfn);
+ }
+ }
+ refreshPdbEntries();
+ for (int modelnum = 0; modelnum < modelfilenames.length; modelnum++)
+ {
+ String fileName = modelfilenames[modelnum];
+ boolean foundEntry = false;
+ MCview.PDBfile pdb = null;
+ String pdbfile = null, pdbfhash = null;
+ // model was probably loaded inline - so check the pdb file hashcode
+ if (loadedInline)
+ {
+ // calculate essential attributes for the pdb data imported inline.
+ // prolly need to resolve modelnumber properly - for now just use our
+ // 'best guess'
+ pdbfile = viewer.getData("" + (1 + _modelFileNameMap[modelnum])
+ + ".0", "PDB");
+ pdbfhash = "" + pdbfile.hashCode();
+ }
+ if (pdbentry != null)
+ {
+ // search pdbentries and sequences to find correct pdbentry for this
+ // model
+ for (int pe = 0; pe < pdbentry.length; pe++)
+ {
+ boolean matches = false;
+ if (fileName == null)
+ {
+ if (false)
+ // see JAL-623 - need method of matching pasted data up
+ {
+ pdb = ssm.setMapping(sequence[pe], chains[pe], pdbfile,
+ AppletFormatAdapter.PASTE);
+ pdbentry[modelnum].setFile("INLINE" + pdb.id);
+ matches = true;
+ foundEntry = true;
+ }
+ }
+ else
+ {
+ File fl;
+ if (matches = (fl = new File(pdbentry[pe].getFile()))
+ .equals(new File(fileName)))
+ {
+ foundEntry = true;
+ // TODO: Jmol can in principle retrieve from CLASSLOADER but
+ // this
+ // needs
+ // to be tested. See mantis bug
+ // https://mantis.lifesci.dundee.ac.uk/view.php?id=36605
+ String protocol = AppletFormatAdapter.URL;
+ try
+ {
+ if (fl.exists())
+ {
+ protocol = AppletFormatAdapter.FILE;
+ }
+ } catch (Exception e)
+ {
+ } catch (Error e)
+ {
+ }
+ // Explicitly map to the filename used by Jmol ;
+ pdb = ssm.setMapping(sequence[pe], chains[pe], fileName,
+ protocol);
+ // pdbentry[pe].getFile(), protocol);
+
+ }
+ }
+ if (matches)
+ {
+ // add an entry for every chain in the model
+ for (int i = 0; i < pdb.chains.size(); i++)
+ {
+ String chid = new String(pdb.id + ":"
+ + ((MCview.PDBChain) pdb.chains.elementAt(i)).id);
+ chainFile.put(chid, fileName);
+ chainNames.addElement(chid);
+ }
+ notifyLoaded = true;
+ }
+ }
+ }
+ if (!foundEntry && associateNewStructs)
+ {
+ // this is a foreign pdb file that jalview doesn't know about - add
+ // it to the dataset and try to find a home - either on a matching
+ // sequence or as a new sequence.
+ String pdbcontent = viewer.getData("/" + (modelnum + 1) + ".1",
+ "PDB");
+ // parse pdb file into a chain, etc.
+ // locate best match for pdb in associated views and add mapping to
+ // ssm
+ // if properly registered then
+ notifyLoaded = true;
+
+ }
+ }
+ // FILE LOADED OK
+ // so finally, update the jmol bits and pieces
+ if (jmolpopup != null)
+ {
+ // potential for deadlock here:
+ // jmolpopup.updateComputedMenus();
+ }
+ if (!isLoadingFromArchive())
+ {
+ viewer.evalStringQuiet("model 0; select backbone;restrict;cartoon;wireframe off;spacefill off");
+ }
+ // register ourselves as a listener and notify the gui that it needs to
+ // update itself.
+ ssm.addStructureViewerListener(this);
+ if (notifyLoaded)
+ {
+ FeatureRenderer fr = getFeatureRenderer(null);
+ if (fr != null)
+ {
+ fr.featuresAdded();
+ }
+ refreshGUI();
+ loadNotifiesHandled++;
+ }
+ setLoadingFromArchive(false);
+ }
+
+ public void notifyNewPickingModeMeasurement(int iatom, String strMeasure)
+ {
+ notifyAtomPicked(iatom, strMeasure, null);
+ }
+
+ public abstract void notifyScriptTermination(String strStatus,
+ int msWalltime);
+
+ /**
+ * display a message echoed from the jmol viewer
+ *
+ * @param strEcho
+ */
+ public abstract void sendConsoleEcho(String strEcho); /*
+ * { showConsole(true);
+ *
+ * history.append("\n" +
+ * strEcho); }
+ */
+
+ // /End JmolStatusListener
+ // /////////////////////////////
+
+ /**
+ * @param strStatus
+ * status message - usually the response received after a script
+ * executed
+ */
+ public abstract void sendConsoleMessage(String strStatus);
+
+ public void setCallbackFunction(String callbackType,
+ String callbackFunction)
+ {
+ System.err.println("Ignoring set-callback request to associate "
+ + callbackType + " with function " + callbackFunction);
+
+ }
+
+ public void setJalviewColourScheme(ColourSchemeI cs)
+ {
+ colourBySequence = false;
+
+ if (cs == null)
+ return;
+
+ String res;
+ int index;
+ Color col;
+ jmolHistory(false);
+ // TODO: Switch between nucleotide or aa selection expressions
+ Enumeration en = ResidueProperties.aa3Hash.keys();
+ StringBuffer command = new StringBuffer("select *;color white;");
+ while (en.hasMoreElements())
+ {
+ res = en.nextElement().toString();
+ index = ((Integer) ResidueProperties.aa3Hash.get(res)).intValue();
+ if (index > 20)
+ continue;
+
+ col = cs.findColour(ResidueProperties.aa[index].charAt(0));
+
+ command.append("select " + res + ";color[" + col.getRed() + ","
+ + col.getGreen() + "," + col.getBlue() + "];");
+ }
+
+ evalStateCommand(command.toString());
+ jmolHistory(true);
+ }
+
+ public void showHelp()
+ {
+ showUrl("http://jmol.sourceforge.net/docs/JmolUserGuide/", "jmolHelp");
+ }
+
+ /**
+ * open the URL somehow
+ *
+ * @param target
+ */
+ public abstract void showUrl(String url, String target);
+
+ /**
+ * called when the binding thinks the UI needs to be refreshed after a Jmol
+ * state change. this could be because structures were loaded, or because an
+ * error has occured.
+ */
+ public abstract void refreshGUI();
+
+ /**
+ * called to show or hide the associated console window container.
+ *
+ * @param show
+ */
+ public abstract void showConsole(boolean show);
+
+ /**
+ * @param renderPanel
+ * @param jmolfileio
+ * - when true will initialise jmol's file IO system (should be false
+ * in applet context)
+ * @param htmlName
+ * @param documentBase
+ * @param codeBase
+ * @param commandOptions
+ */
+ public void allocateViewer(Container renderPanel, boolean jmolfileio,
+ String htmlName, URL documentBase, URL codeBase,
+ String commandOptions)
+ {
+ allocateViewer(renderPanel, jmolfileio, htmlName, documentBase,
+ codeBase, commandOptions, null, null);
+ }
+
+ /**
+ *
+ * @param renderPanel
+ * @param jmolfileio
+ * - when true will initialise jmol's file IO system (should be false
+ * in applet context)
+ * @param htmlName
+ * @param documentBase
+ * @param codeBase
+ * @param commandOptions
+ * @param consolePanel
+ * - panel to contain Jmol console
+ * @param buttonsToShow
+ * - buttons to show on the console, in ordr
+ */
+ public void allocateViewer(Container renderPanel, boolean jmolfileio,
+ String htmlName, URL documentBase, URL codeBase,
+ String commandOptions, final Container consolePanel,
+ String buttonsToShow)
+ {
+ if (commandOptions == null)
+ {
+ commandOptions = "";
+ }
+ viewer = JmolViewer.allocateViewer(renderPanel,
+ (jmolfileio ? new SmarterJmolAdapter() : null), htmlName
+ + ((Object) this).toString(), documentBase, codeBase,
+ commandOptions, this);
+
+ console = createJmolConsole(viewer, consolePanel, buttonsToShow);
+ if (consolePanel != null)
+ {
+ consolePanel.addComponentListener(this);
+
+ }
+
+ }
+
+ protected abstract JmolAppConsoleInterface createJmolConsole(
+ JmolViewer viewer2, Container consolePanel, String buttonsToShow);
+
+ protected org.jmol.api.JmolAppConsoleInterface console = null;
+
+ public void componentResized(ComponentEvent e)
+ {
+
+ }
+
+ public void componentMoved(ComponentEvent e)
+ {
+
+ }
+
+ public void componentShown(ComponentEvent e)
+ {
+ showConsole(true);
+ }
+
+ public void componentHidden(ComponentEvent e)
+ {
+ showConsole(false);
+ }
+
+ public void setLoadingFromArchive(boolean loadingFromArchive)
+ {
+ this.loadingFromArchive = loadingFromArchive;
+ }
+
+ public boolean isLoadingFromArchive()
+ {
+ return loadingFromArchive;
+ }
+
+ public void setBackgroundColour(java.awt.Color col)
+ {
+ jmolHistory(false);
+ viewer.evalStringQuiet("background [" + col.getRed() + ","
+ + col.getGreen() + "," + col.getBlue() + "];");
+ jmolHistory(true);
+ }
+
+ /**
+ * add structures and any known sequence associations
+ *
+ * @returns the pdb entries added to the current set.
+ */
+ public synchronized PDBEntry[] addSequenceAndChain(PDBEntry[] pdbe,
+ SequenceI[][] seq, String[][] chns)
+ {
+ int pe = -1;
+ Vector v = new Vector();
+ Vector rtn = new Vector();
+ for (int i = 0; i < pdbentry.length; i++)
+ {
+ v.addElement(pdbentry[i]);
+ }
+ for (int i = 0; i < pdbe.length; i++)
+ {
+ int r = v.indexOf(pdbe[i]);
+ if (r == -1 || r >= pdbentry.length)
+ {
+ rtn.addElement(new int[]
+ { v.size(), i });
+ v.addElement(pdbe[i]);
+ }
+ else
+ {
+ // just make sure the sequence/chain entries are all up to date
+ addSequenceAndChain(r, seq[i], chns[i]);
+ }
+ }
+ pdbe = new PDBEntry[v.size()];
+ v.copyInto(pdbe);
+ pdbentry = pdbe;
+ if (rtn.size() > 0)
+ {
+ // expand the tied seuqence[] and string[] arrays
+ SequenceI[][] sqs = new SequenceI[pdbentry.length][];
+ String[][] sch = new String[pdbentry.length][];
+ System.arraycopy(sequence, 0, sqs, 0, sequence.length);
+ System.arraycopy(chains, 0, sch, 0, this.chains.length);
+ sequence = sqs;
+ chains = sch;
+ pdbe = new PDBEntry[rtn.size()];
+ for (int r = 0; r < pdbe.length; r++)
+ {
+ int[] stri = ((int[]) rtn.elementAt(r));
+ // record the pdb file as a new addition
+ pdbe[r] = pdbentry[stri[0]];
+ // and add the new sequence/chain entries
+ addSequenceAndChain(stri[0], seq[stri[1]], chns[stri[1]]);
+ }
+ }
+ else
+ {
+ pdbe = null;
+ }
+ return pdbe;
+ }
+
+ public void addSequence(int pe, SequenceI[] seq)
+ {
+ // add sequences to the pe'th pdbentry's seuqence set.
+ addSequenceAndChain(pe, seq, null);
+ }
+
+ private void addSequenceAndChain(int pe, SequenceI[] seq, String[] tchain)
+ {
+ if (pe < 0 || pe >= pdbentry.length)
+ {
+ throw new Error(
+ "Implementation error - no corresponding pdbentry (for index "
+ + pe + ") to add sequences mappings to");
+ }
+ final String nullChain = "TheNullChain";
+ Vector s = new Vector();
+ Vector c = new Vector();
+ if (chains == null)
+ {
+ chains = new String[pdbentry.length][];
+ }
+ if (sequence[pe] != null)
+ {
+ for (int i = 0; i < sequence[pe].length; i++)
+ {
+ s.addElement(sequence[pe][i]);
+ if (chains[pe] != null)
+ {
+ if (i < chains[pe].length)
+ {
+ c.addElement(chains[pe][i]);
+ }
+ else
+ {
+ c.addElement(nullChain);
+ }
+ }
+ else
+ {
+ if (tchain != null && tchain.length > 0)
+ {
+ c.addElement(nullChain);
+ }
+ }
+ }
+ }
+ for (int i = 0; i < seq.length; i++)
+ {
+ if (!s.contains(seq[i]))
+ {
+ s.addElement(seq[i]);
+ if (tchain != null && i < tchain.length)
+ {
+ c.addElement(tchain[i] == null ? nullChain : tchain[i]);
+ }
+ }
+ }
+ SequenceI[] tmp = new SequenceI[s.size()];
+ s.copyInto(tmp);
+ sequence[pe] = tmp;
+ if (c.size() > 0)
+ {
+ String[] tch = new String[c.size()];
+ c.copyInto(tch);
+ for (int i = 0; i < tch.length; i++)
+ {
+ if (tch[i] == nullChain)
+ {
+ tch[i] = null;
+ }
+ }
+ chains[pe] = tch;
+ }
+ else
+ {
+ chains[pe] = null;
+ }
+ }
+
+ /**
+ *
+ * @param pdbfile
+ * @return text report of alignment between pdbfile and any associated
+ * alignment sequences
+ */
+ public String printMapping(String pdbfile)
+ {
+ return ssm.printMapping(pdbfile);
+ }
+
+ @Override
+ public void resizeInnerPanel(String data)
+ {
+ // Jalview doesn't honour resize panel requests
+
+ }
+}
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-/**
*
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
package jalview.ext.jmol;
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.ext.varna;\r
-\r
-import java.io.File;\r
-\r
-import java.net.URL;\r
-import java.util.*;\r
-import java.applet.Applet;\r
-import java.awt.*;\r
-import java.awt.event.*;\r
-\r
-import javax.swing.JPanel;\r
-\r
-import jalview.api.AlignmentViewPanel;\r
-import jalview.api.FeatureRenderer;\r
-import jalview.api.SequenceRenderer;\r
-import jalview.api.SequenceStructureBinding;\r
-import jalview.api.StructureSelectionManagerProvider;\r
-import jalview.datamodel.*;\r
-import jalview.structure.*;\r
-import jalview.io.*;\r
-\r
-import org.jmol.api.*;\r
-import org.jmol.adapter.smarter.SmarterJmolAdapter;\r
-\r
-import org.jmol.popup.*;\r
-import org.jmol.viewer.JmolConstants;\r
-import org.jmol.viewer.Viewer;\r
-\r
-import jalview.schemes.*;\r
-\r
-import fr.orsay.lri.varna.applications.*;\r
-\r
-public abstract class JalviewVarnaBinding implements StructureListener,\r
- SequenceStructureBinding, ComponentListener,\r
- StructureSelectionManagerProvider\r
-\r
-{\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.ext.varna;
+
+import java.io.File;
+
+import java.net.URL;
+import java.util.*;
+import java.applet.Applet;
+import java.awt.*;
+import java.awt.event.*;
+
+import javax.swing.JPanel;
+
+import jalview.api.AlignmentViewPanel;
+import jalview.api.FeatureRenderer;
+import jalview.api.SequenceRenderer;
+import jalview.api.SequenceStructureBinding;
+import jalview.api.StructureSelectionManagerProvider;
+import jalview.datamodel.*;
+import jalview.structure.*;
+import jalview.io.*;
+
+import org.jmol.api.*;
+import org.jmol.adapter.smarter.SmarterJmolAdapter;
+
+import org.jmol.popup.*;
+import org.jmol.viewer.JmolConstants;
+import org.jmol.viewer.Viewer;
+
+import jalview.schemes.*;
+
+import fr.orsay.lri.varna.applications.*;
+
+public abstract class JalviewVarnaBinding implements StructureListener,
+ SequenceStructureBinding, ComponentListener,
+ StructureSelectionManagerProvider
+
+{
+
+}
-/**\r
- * \r
- */\r
-package jalview.ext.varna;\r
-\r
-import jalview.api.FeatureRenderer;\r
-import jalview.api.SequenceRenderer;\r
-import jalview.datamodel.AlignmentI;\r
-import jalview.datamodel.SequenceI;\r
-import jalview.structure.StructureMapping;\r
-import jalview.structure.StructureSelectionManager;\r
-import jalview.util.Comparison;\r
-\r
-import java.awt.Color;\r
-import java.util.ArrayList;\r
-\r
-/**\r
- * Routines for generating Jmol commands for Jalview/Jmol binding another\r
- * cruisecontrol test.\r
- * \r
- * @author JimP\r
- * \r
- */\r
-public class VarnaCommands\r
-{\r
-\r
- /**\r
- * Jmol utility which constructs the commands to colour chains by the given\r
- * alignment\r
- * \r
- */\r
- public static String[] getColourBySequenceCommand(\r
- StructureSelectionManager ssm, String[] files,\r
- SequenceI[][] sequence, SequenceRenderer sr, FeatureRenderer fr,\r
- AlignmentI alignment)\r
- {\r
- ArrayList<String> str = new ArrayList<String>();\r
- StringBuffer command = new StringBuffer();\r
-\r
- for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++)\r
- {\r
- StructureMapping[] mapping = ssm.getMapping(files[pdbfnum]);\r
-\r
- if (mapping == null || mapping.length < 1)\r
- continue;\r
-\r
- int lastPos = -1;\r
- for (int s = 0; s < sequence[pdbfnum].length; s++)\r
- {\r
- for (int sp, m = 0; m < mapping.length; m++)\r
- {\r
- if (mapping[m].getSequence() == sequence[pdbfnum][s]\r
- && (sp = alignment.findIndex(sequence[pdbfnum][s])) > -1)\r
- {\r
- SequenceI asp = alignment.getSequenceAt(sp);\r
- for (int r = 0; r < asp.getLength(); r++)\r
- {\r
- // no mapping to gaps in sequence\r
- if (jalview.util.Comparison.isGap(asp.getCharAt(r)))\r
- {\r
- continue;\r
- }\r
- int pos = mapping[m].getPDBResNum(asp.findPosition(r));\r
-\r
- if (pos < 1 || pos == lastPos)\r
- continue;\r
-\r
- lastPos = pos;\r
-\r
- Color col = sr.getResidueBoxColour(sequence[pdbfnum][s], r);\r
-\r
- if (fr != null)\r
- col = fr.findFeatureColour(col, sequence[pdbfnum][s], r);\r
- String newSelcom = (mapping[m].getChain() != " " ? ":"\r
- + mapping[m].getChain() : "")\r
- + "/"\r
- + (pdbfnum + 1)\r
- + ".1"\r
- + ";color["\r
- + col.getRed()\r
- + ","\r
- + col.getGreen()\r
- + ","\r
- + col.getBlue() + "]";\r
- if (command.length() > newSelcom.length()\r
- && command.substring(\r
- command.length() - newSelcom.length())\r
- .equals(newSelcom))\r
- {\r
- command = VarnaCommands.condenseCommand(command, pos);\r
- continue;\r
- }\r
- // TODO: deal with case when buffer is too large for Jmol to parse\r
- // - execute command and flush\r
-\r
- command.append(";");\r
- if (command.length() > 51200)\r
- {\r
- // add another chunk\r
- str.add(command.toString());\r
- command.setLength(0);\r
- }\r
- command.append("select " + pos);\r
- command.append(newSelcom);\r
- }\r
- break;\r
- }\r
- }\r
- }\r
- }\r
- {\r
- // add final chunk\r
- str.add(command.toString());\r
- command.setLength(0);\r
- }\r
- return str.toArray(new String[str.size()]);\r
- }\r
-\r
- public static StringBuffer condenseCommand(StringBuffer command, int pos)\r
- {\r
-\r
- // work back to last 'select'\r
- int p = command.length(), q = p;\r
- do\r
- {\r
- p -= 6;\r
- if (p < 1)\r
- {\r
- p = 0;\r
- }\r
- ;\r
- } while ((q = command.indexOf("select", p)) == -1 && p > 0);\r
-\r
- StringBuffer sb = new StringBuffer(command.substring(0, q + 7));\r
-\r
- command = command.delete(0, q + 7);\r
-\r
- String start;\r
-\r
- if (command.indexOf("-") > -1)\r
- {\r
- start = command.substring(0, command.indexOf("-"));\r
- }\r
- else\r
- {\r
- start = command.substring(0, command.indexOf(":"));\r
- }\r
-\r
- sb.append(start + "-" + pos + command.substring(command.indexOf(":")));\r
-\r
- return sb;\r
- }\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.ext.varna;
+
+import jalview.api.FeatureRenderer;
+import jalview.api.SequenceRenderer;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.SequenceI;
+import jalview.structure.StructureMapping;
+import jalview.structure.StructureSelectionManager;
+import jalview.util.Comparison;
+
+import java.awt.Color;
+import java.util.ArrayList;
+
+/**
+ * Routines for generating Jmol commands for Jalview/Jmol binding another
+ * cruisecontrol test.
+ *
+ * @author JimP
+ *
+ */
+public class VarnaCommands
+{
+
+ /**
+ * Jmol utility which constructs the commands to colour chains by the given
+ * alignment
+ *
+ */
+ public static String[] getColourBySequenceCommand(
+ StructureSelectionManager ssm, String[] files,
+ SequenceI[][] sequence, SequenceRenderer sr, FeatureRenderer fr,
+ AlignmentI alignment)
+ {
+ ArrayList<String> str = new ArrayList<String>();
+ StringBuffer command = new StringBuffer();
+
+ for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++)
+ {
+ StructureMapping[] mapping = ssm.getMapping(files[pdbfnum]);
+
+ if (mapping == null || mapping.length < 1)
+ continue;
+
+ int lastPos = -1;
+ for (int s = 0; s < sequence[pdbfnum].length; s++)
+ {
+ for (int sp, m = 0; m < mapping.length; m++)
+ {
+ if (mapping[m].getSequence() == sequence[pdbfnum][s]
+ && (sp = alignment.findIndex(sequence[pdbfnum][s])) > -1)
+ {
+ SequenceI asp = alignment.getSequenceAt(sp);
+ for (int r = 0; r < asp.getLength(); r++)
+ {
+ // no mapping to gaps in sequence
+ if (jalview.util.Comparison.isGap(asp.getCharAt(r)))
+ {
+ continue;
+ }
+ int pos = mapping[m].getPDBResNum(asp.findPosition(r));
+
+ if (pos < 1 || pos == lastPos)
+ continue;
+
+ lastPos = pos;
+
+ Color col = sr.getResidueBoxColour(sequence[pdbfnum][s], r);
+
+ if (fr != null)
+ col = fr.findFeatureColour(col, sequence[pdbfnum][s], r);
+ String newSelcom = (mapping[m].getChain() != " " ? ":"
+ + mapping[m].getChain() : "")
+ + "/"
+ + (pdbfnum + 1)
+ + ".1"
+ + ";color["
+ + col.getRed()
+ + ","
+ + col.getGreen()
+ + ","
+ + col.getBlue() + "]";
+ if (command.length() > newSelcom.length()
+ && command.substring(
+ command.length() - newSelcom.length())
+ .equals(newSelcom))
+ {
+ command = VarnaCommands.condenseCommand(command, pos);
+ continue;
+ }
+ // TODO: deal with case when buffer is too large for Jmol to parse
+ // - execute command and flush
+
+ command.append(";");
+ if (command.length() > 51200)
+ {
+ // add another chunk
+ str.add(command.toString());
+ command.setLength(0);
+ }
+ command.append("select " + pos);
+ command.append(newSelcom);
+ }
+ break;
+ }
+ }
+ }
+ }
+ {
+ // add final chunk
+ str.add(command.toString());
+ command.setLength(0);
+ }
+ return str.toArray(new String[str.size()]);
+ }
+
+ public static StringBuffer condenseCommand(StringBuffer command, int pos)
+ {
+
+ // work back to last 'select'
+ int p = command.length(), q = p;
+ do
+ {
+ p -= 6;
+ if (p < 1)
+ {
+ p = 0;
+ }
+ ;
+ } while ((q = command.indexOf("select", p)) == -1 && p > 0);
+
+ StringBuffer sb = new StringBuffer(command.substring(0, q + 7));
+
+ command = command.delete(0, q + 7);
+
+ String start;
+
+ if (command.indexOf("-") > -1)
+ {
+ start = command.substring(0, command.indexOf("-"));
+ }
+ else
+ {
+ start = command.substring(0, command.indexOf(":"));
+ }
+
+ sb.append(start + "-" + pos + command.substring(command.indexOf(":")));
+
+ return sb;
+ }
+
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
package jalview.gui;
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.gui;\r
-\r
-import java.util.*;\r
-import java.util.List;\r
-\r
-import java.awt.*;\r
-import java.awt.event.*;\r
-import javax.swing.*;\r
-\r
-import jalview.datamodel.*;\r
-import jalview.io.*;\r
-\r
-/**\r
- * \r
- * GUI dialog for exporting features or alignment annotations depending upon\r
- * which method is called.\r
- * \r
- * @author AMW\r
- * \r
- */\r
-public class AnnotationExporter extends JPanel\r
-{\r
- JInternalFrame frame;\r
-\r
- AlignmentPanel ap;\r
-\r
- boolean features = true;\r
-\r
- AlignmentAnnotation[] annotations;\r
-\r
- List<SequenceGroup> sequenceGroups;\r
-\r
- Hashtable alignmentProperties;\r
-\r
- public AnnotationExporter()\r
- {\r
- try\r
- {\r
- jbInit();\r
- } catch (Exception ex)\r
- {\r
- ex.printStackTrace();\r
- }\r
-\r
- frame = new JInternalFrame();\r
- frame.setContentPane(this);\r
- frame.setLayer(JLayeredPane.PALETTE_LAYER);\r
- Desktop.addInternalFrame(frame, "", frame.getPreferredSize().width,\r
- frame.getPreferredSize().height);\r
- }\r
-\r
- public void exportFeatures(AlignmentPanel ap)\r
- {\r
- this.ap = ap;\r
- features = true;\r
- CSVFormat.setVisible(false);\r
- frame.setTitle("Export Features");\r
- }\r
-\r
- public void exportAnnotations(AlignmentPanel ap,\r
- AlignmentAnnotation[] annotations, List<SequenceGroup> list,\r
- Hashtable alProperties)\r
- {\r
- this.ap = ap;\r
- features = false;\r
- GFFFormat.setVisible(false);\r
- CSVFormat.setVisible(true);\r
- this.annotations = annotations;\r
- this.sequenceGroups = list;\r
- this.alignmentProperties = alProperties;\r
- frame.setTitle("Export Annotations");\r
- }\r
-\r
- public void toFile_actionPerformed(ActionEvent e)\r
- {\r
- JalviewFileChooser chooser = new JalviewFileChooser(\r
- jalview.bin.Cache.getProperty("LAST_DIRECTORY"));\r
-\r
- chooser.setFileView(new JalviewFileView());\r
- chooser.setDialogTitle(features ? "Save Features to File"\r
- : "Save Annotation to File");\r
- chooser.setToolTipText("Save");\r
-\r
- int value = chooser.showSaveDialog(this);\r
-\r
- if (value == JalviewFileChooser.APPROVE_OPTION)\r
- {\r
- String text = "No features found on alignment";\r
- if (features)\r
- {\r
- if (GFFFormat.isSelected())\r
- {\r
- text = new FeaturesFile().printGFFFormat(ap.av.getAlignment()\r
- .getDataset().getSequencesArray(),\r
- getDisplayedFeatureCols(), true, ap.av.isShowNpFeats());// ap.av.featuresDisplayed//);\r
- }\r
- else\r
- {\r
- text = new FeaturesFile().printJalviewFormat(ap.av.getAlignment()\r
- .getDataset().getSequencesArray(),\r
- getDisplayedFeatureCols(), true, ap.av.isShowNpFeats()); // ap.av.featuresDisplayed);\r
- }\r
- }\r
- else\r
- {\r
- if (CSVFormat.isSelected())\r
- {\r
- text = new AnnotationFile().printCSVAnnotations(annotations);\r
- }\r
- else\r
- {\r
- text = new AnnotationFile().printAnnotations(annotations,\r
- sequenceGroups, alignmentProperties);\r
- }\r
- }\r
-\r
- try\r
- {\r
- java.io.PrintWriter out = new java.io.PrintWriter(\r
- new java.io.FileWriter(chooser.getSelectedFile()));\r
-\r
- out.print(text);\r
- out.close();\r
- } catch (Exception ex)\r
- {\r
- ex.printStackTrace();\r
- }\r
- }\r
-\r
- close_actionPerformed(null);\r
- }\r
-\r
- public void toTextbox_actionPerformed(ActionEvent e)\r
- {\r
- String text = "No features found on alignment";\r
- if (features)\r
- {\r
- if (GFFFormat.isSelected())\r
- {\r
- text = new FeaturesFile().printGFFFormat(ap.av.getAlignment()\r
- .getDataset().getSequencesArray(),\r
- getDisplayedFeatureCols(), true, ap.av.isShowNpFeats());\r
- }\r
- else\r
- {\r
- text = new FeaturesFile().printJalviewFormat(ap.av.getAlignment()\r
- .getDataset().getSequencesArray(),\r
- getDisplayedFeatureCols(), true, ap.av.isShowNpFeats());\r
- }\r
- }\r
- else if (!features)\r
- {\r
- if (CSVFormat.isSelected())\r
- {\r
- text = new AnnotationFile().printCSVAnnotations(annotations);\r
- }\r
- else\r
- {\r
- text = new AnnotationFile().printAnnotations(annotations,\r
- sequenceGroups, alignmentProperties);\r
- }\r
- }\r
-\r
- CutAndPasteTransfer cap = new CutAndPasteTransfer();\r
- try\r
- {\r
- cap.setText(text);\r
- Desktop.addInternalFrame(cap, (features ? "Features for - "\r
- : "Annotations for - ") + ap.alignFrame.getTitle(), 600, 500);\r
- } catch (OutOfMemoryError oom)\r
- {\r
- new OOMWarning("generating "\r
- + (features ? "Features for - " : "Annotations for - ")\r
- + ap.alignFrame.getTitle(), oom);\r
- cap.dispose();\r
- }\r
-\r
- close_actionPerformed(null);\r
- }\r
-\r
- private Hashtable getDisplayedFeatureCols()\r
- {\r
- Hashtable fcols = new Hashtable();\r
- if (ap.av.featuresDisplayed == null)\r
- {\r
- return fcols;\r
- }\r
- Enumeration en = ap.av.featuresDisplayed.keys();\r
- FeatureRenderer fr = ap.seqPanel.seqCanvas.getFeatureRenderer(); // consider\r
- // higher\r
- // level\r
- // method ?\r
- while (en.hasMoreElements())\r
- {\r
- Object col = en.nextElement();\r
- fcols.put(col, fr.featureColours.get(col));\r
- }\r
- return fcols;\r
- }\r
-\r
- public void close_actionPerformed(ActionEvent e)\r
- {\r
- try\r
- {\r
- frame.setClosed(true);\r
- } catch (java.beans.PropertyVetoException ex)\r
- {\r
- }\r
- }\r
-\r
- private void jbInit() throws Exception\r
- {\r
- this.setLayout(new BorderLayout());\r
-\r
- toFile.setText("to File");\r
- toFile.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- toFile_actionPerformed(e);\r
- }\r
- });\r
- toTextbox.setText("to Textbox");\r
- toTextbox.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- toTextbox_actionPerformed(e);\r
- }\r
- });\r
- close.setText("Close");\r
- close.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- close_actionPerformed(e);\r
- }\r
- });\r
- jalviewFormat.setOpaque(false);\r
- jalviewFormat.setSelected(true);\r
- jalviewFormat.setText("Jalview");\r
- GFFFormat.setOpaque(false);\r
- GFFFormat.setText("GFF");\r
- CSVFormat.setOpaque(false);\r
- CSVFormat.setText("CSV(Spreadsheet)");\r
- jLabel1.setHorizontalAlignment(SwingConstants.TRAILING);\r
- jLabel1.setText("Format: ");\r
- this.setBackground(Color.white);\r
- jPanel3.setBorder(BorderFactory.createEtchedBorder());\r
- jPanel3.setOpaque(false);\r
- jPanel1.setOpaque(false);\r
- jPanel1.add(toFile);\r
- jPanel1.add(toTextbox);\r
- jPanel1.add(close);\r
- jPanel3.add(jLabel1);\r
- jPanel3.add(jalviewFormat);\r
- jPanel3.add(GFFFormat);\r
- jPanel3.add(CSVFormat);\r
- buttonGroup.add(jalviewFormat);\r
- buttonGroup.add(GFFFormat);\r
- buttonGroup.add(CSVFormat);\r
- this.add(jPanel3, BorderLayout.CENTER);\r
- this.add(jPanel1, BorderLayout.SOUTH);\r
- }\r
-\r
- JPanel jPanel1 = new JPanel();\r
-\r
- JButton toFile = new JButton();\r
-\r
- JButton toTextbox = new JButton();\r
-\r
- JButton close = new JButton();\r
-\r
- ButtonGroup buttonGroup = new ButtonGroup();\r
-\r
- JRadioButton jalviewFormat = new JRadioButton();\r
-\r
- JRadioButton GFFFormat = new JRadioButton();\r
-\r
- JRadioButton CSVFormat = new JRadioButton();\r
-\r
- JLabel jLabel1 = new JLabel();\r
-\r
- JPanel jPanel3 = new JPanel();\r
-\r
- FlowLayout flowLayout1 = new FlowLayout();\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.gui;
+
+import java.util.*;
+import java.util.List;
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+
+import jalview.datamodel.*;
+import jalview.io.*;
+
+/**
+ *
+ * GUI dialog for exporting features or alignment annotations depending upon
+ * which method is called.
+ *
+ * @author AMW
+ *
+ */
+public class AnnotationExporter extends JPanel
+{
+ JInternalFrame frame;
+
+ AlignmentPanel ap;
+
+ boolean features = true;
+
+ AlignmentAnnotation[] annotations;
+
+ List<SequenceGroup> sequenceGroups;
+
+ Hashtable alignmentProperties;
+
+ public AnnotationExporter()
+ {
+ try
+ {
+ jbInit();
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+
+ frame = new JInternalFrame();
+ frame.setContentPane(this);
+ frame.setLayer(JLayeredPane.PALETTE_LAYER);
+ Desktop.addInternalFrame(frame, "", frame.getPreferredSize().width,
+ frame.getPreferredSize().height);
+ }
+
+ public void exportFeatures(AlignmentPanel ap)
+ {
+ this.ap = ap;
+ features = true;
+ CSVFormat.setVisible(false);
+ frame.setTitle("Export Features");
+ }
+
+ public void exportAnnotations(AlignmentPanel ap,
+ AlignmentAnnotation[] annotations, List<SequenceGroup> list,
+ Hashtable alProperties)
+ {
+ this.ap = ap;
+ features = false;
+ GFFFormat.setVisible(false);
+ CSVFormat.setVisible(true);
+ this.annotations = annotations;
+ this.sequenceGroups = list;
+ this.alignmentProperties = alProperties;
+ frame.setTitle("Export Annotations");
+ }
+
+ public void toFile_actionPerformed(ActionEvent e)
+ {
+ JalviewFileChooser chooser = new JalviewFileChooser(
+ jalview.bin.Cache.getProperty("LAST_DIRECTORY"));
+
+ chooser.setFileView(new JalviewFileView());
+ chooser.setDialogTitle(features ? "Save Features to File"
+ : "Save Annotation to File");
+ chooser.setToolTipText("Save");
+
+ int value = chooser.showSaveDialog(this);
+
+ if (value == JalviewFileChooser.APPROVE_OPTION)
+ {
+ String text = "No features found on alignment";
+ if (features)
+ {
+ if (GFFFormat.isSelected())
+ {
+ text = new FeaturesFile().printGFFFormat(ap.av.getAlignment()
+ .getDataset().getSequencesArray(),
+ getDisplayedFeatureCols(), true, ap.av.isShowNpFeats());// ap.av.featuresDisplayed//);
+ }
+ else
+ {
+ text = new FeaturesFile().printJalviewFormat(ap.av.getAlignment()
+ .getDataset().getSequencesArray(),
+ getDisplayedFeatureCols(), true, ap.av.isShowNpFeats()); // ap.av.featuresDisplayed);
+ }
+ }
+ else
+ {
+ if (CSVFormat.isSelected())
+ {
+ text = new AnnotationFile().printCSVAnnotations(annotations);
+ }
+ else
+ {
+ text = new AnnotationFile().printAnnotations(annotations,
+ sequenceGroups, alignmentProperties);
+ }
+ }
+
+ try
+ {
+ java.io.PrintWriter out = new java.io.PrintWriter(
+ new java.io.FileWriter(chooser.getSelectedFile()));
+
+ out.print(text);
+ out.close();
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ close_actionPerformed(null);
+ }
+
+ public void toTextbox_actionPerformed(ActionEvent e)
+ {
+ String text = "No features found on alignment";
+ if (features)
+ {
+ if (GFFFormat.isSelected())
+ {
+ text = new FeaturesFile().printGFFFormat(ap.av.getAlignment()
+ .getDataset().getSequencesArray(),
+ getDisplayedFeatureCols(), true, ap.av.isShowNpFeats());
+ }
+ else
+ {
+ text = new FeaturesFile().printJalviewFormat(ap.av.getAlignment()
+ .getDataset().getSequencesArray(),
+ getDisplayedFeatureCols(), true, ap.av.isShowNpFeats());
+ }
+ }
+ else if (!features)
+ {
+ if (CSVFormat.isSelected())
+ {
+ text = new AnnotationFile().printCSVAnnotations(annotations);
+ }
+ else
+ {
+ text = new AnnotationFile().printAnnotations(annotations,
+ sequenceGroups, alignmentProperties);
+ }
+ }
+
+ CutAndPasteTransfer cap = new CutAndPasteTransfer();
+ try
+ {
+ cap.setText(text);
+ Desktop.addInternalFrame(cap, (features ? "Features for - "
+ : "Annotations for - ") + ap.alignFrame.getTitle(), 600, 500);
+ } catch (OutOfMemoryError oom)
+ {
+ new OOMWarning("generating "
+ + (features ? "Features for - " : "Annotations for - ")
+ + ap.alignFrame.getTitle(), oom);
+ cap.dispose();
+ }
+
+ close_actionPerformed(null);
+ }
+
+ private Hashtable getDisplayedFeatureCols()
+ {
+ Hashtable fcols = new Hashtable();
+ if (ap.av.featuresDisplayed == null)
+ {
+ return fcols;
+ }
+ Enumeration en = ap.av.featuresDisplayed.keys();
+ FeatureRenderer fr = ap.seqPanel.seqCanvas.getFeatureRenderer(); // consider
+ // higher
+ // level
+ // method ?
+ while (en.hasMoreElements())
+ {
+ Object col = en.nextElement();
+ fcols.put(col, fr.featureColours.get(col));
+ }
+ return fcols;
+ }
+
+ public void close_actionPerformed(ActionEvent e)
+ {
+ try
+ {
+ frame.setClosed(true);
+ } catch (java.beans.PropertyVetoException ex)
+ {
+ }
+ }
+
+ private void jbInit() throws Exception
+ {
+ this.setLayout(new BorderLayout());
+
+ toFile.setText("to File");
+ toFile.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ toFile_actionPerformed(e);
+ }
+ });
+ toTextbox.setText("to Textbox");
+ toTextbox.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ toTextbox_actionPerformed(e);
+ }
+ });
+ close.setText("Close");
+ close.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ close_actionPerformed(e);
+ }
+ });
+ jalviewFormat.setOpaque(false);
+ jalviewFormat.setSelected(true);
+ jalviewFormat.setText("Jalview");
+ GFFFormat.setOpaque(false);
+ GFFFormat.setText("GFF");
+ CSVFormat.setOpaque(false);
+ CSVFormat.setText("CSV(Spreadsheet)");
+ jLabel1.setHorizontalAlignment(SwingConstants.TRAILING);
+ jLabel1.setText("Format: ");
+ this.setBackground(Color.white);
+ jPanel3.setBorder(BorderFactory.createEtchedBorder());
+ jPanel3.setOpaque(false);
+ jPanel1.setOpaque(false);
+ jPanel1.add(toFile);
+ jPanel1.add(toTextbox);
+ jPanel1.add(close);
+ jPanel3.add(jLabel1);
+ jPanel3.add(jalviewFormat);
+ jPanel3.add(GFFFormat);
+ jPanel3.add(CSVFormat);
+ buttonGroup.add(jalviewFormat);
+ buttonGroup.add(GFFFormat);
+ buttonGroup.add(CSVFormat);
+ this.add(jPanel3, BorderLayout.CENTER);
+ this.add(jPanel1, BorderLayout.SOUTH);
+ }
+
+ JPanel jPanel1 = new JPanel();
+
+ JButton toFile = new JButton();
+
+ JButton toTextbox = new JButton();
+
+ JButton close = new JButton();
+
+ ButtonGroup buttonGroup = new ButtonGroup();
+
+ JRadioButton jalviewFormat = new JRadioButton();
+
+ JRadioButton GFFFormat = new JRadioButton();
+
+ JRadioButton CSVFormat = new JRadioButton();
+
+ JLabel jLabel1 = new JLabel();
+
+ JPanel jPanel3 = new JPanel();
+
+ FlowLayout flowLayout1 = new FlowLayout();
+
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
package jalview.gui;
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* AppVarnaBinding vab = new AppVarnaBinding(); vab.varnagui.set_seq(str);
* vab.varnagui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
* vab.varnagui.pack(); vab.varnagui.setVisible(true); } }
- */
\ No newline at end of file
+ */
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ */
package jalview.gui;
import javax.swing.JOptionPane;
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ */
package jalview.gui;
import jalview.bin.Cache;
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.gui;\r
-\r
-import jalview.jbgui.GDasSourceBrowser;\r
-import jalview.util.TableSorter;\r
-import jalview.ws.dbsources.das.api.DasSourceRegistryI;\r
-import jalview.ws.dbsources.das.api.jalviewSourceI;\r
-\r
-import java.awt.BorderLayout;\r
-import java.awt.event.ActionEvent;\r
-import java.awt.event.MouseAdapter;\r
-import java.awt.event.MouseEvent;\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-import java.util.Properties;\r
-import java.util.StringTokenizer;\r
-import java.util.Vector;\r
-\r
-import javax.swing.JCheckBox;\r
-import javax.swing.JLabel;\r
-import javax.swing.JOptionPane;\r
-import javax.swing.JPanel;\r
-import javax.swing.JTextField;\r
-import javax.swing.ListSelectionModel;\r
-import javax.swing.SwingUtilities;\r
-import javax.swing.event.ListSelectionEvent;\r
-import javax.swing.event.ListSelectionListener;\r
-import javax.swing.table.AbstractTableModel;\r
-\r
-import org.biodas.jdas.schema.sources.CAPABILITY;\r
-import org.biodas.jdas.schema.sources.COORDINATES;\r
-import org.biodas.jdas.schema.sources.PROP;\r
-import org.biodas.jdas.schema.sources.VERSION;\r
-\r
-public class DasSourceBrowser extends GDasSourceBrowser implements\r
- Runnable, ListSelectionListener\r
-{\r
- DasSourceRegistryI sourceRegistry = null;\r
-\r
- Vector<String> selectedSources;\r
-\r
- public DasSourceBrowser(FeatureSettings featureSettings)\r
- {\r
- fs = featureSettings;\r
- // TODO DasSourceRegistryProvider API\r
- sourceRegistry = jalview.bin.Cache.getDasSourceRegistry();\r
- String registry = sourceRegistry.getDasRegistryURL();\r
-\r
- registryURL.setText(registry);\r
-\r
- setSelectedFromProperties();\r
-\r
- displayFullDetails(null);\r
- table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);\r
-\r
- filter1.addListSelectionListener(this);\r
- filter2.addListSelectionListener(this);\r
- filter3.addListSelectionListener(this);\r
-\r
- // Ask to be notified of selection changes.\r
- ListSelectionModel rowSM = table.getSelectionModel();\r
- rowSM.addListSelectionListener(new ListSelectionListener()\r
- {\r
- public void valueChanged(ListSelectionEvent e)\r
- {\r
- ListSelectionModel lsm = (ListSelectionModel) e.getSource();\r
- if (!lsm.isSelectionEmpty())\r
- {\r
- int selectedRow = lsm.getMinSelectionIndex();\r
- displayFullDetails(table.getValueAt(selectedRow, 0).toString());\r
- }\r
- }\r
- });\r
-\r
- table.addMouseListener(new MouseAdapter()\r
- {\r
- public void mouseClicked(MouseEvent evt)\r
- {\r
- if (evt.getClickCount() == 2\r
- || SwingUtilities.isRightMouseButton(evt))\r
- {\r
- editRemoveLocalSource(evt);\r
- }\r
- }\r
- });\r
-\r
- if (sourceRegistry.getSources() != null)\r
- {\r
- init();\r
- }\r
- }\r
-\r
- FeatureSettings fs = null;\r
-\r
- private boolean loadingDasSources;\r
-\r
- public DasSourceBrowser()\r
- {\r
- this(null);\r
- }\r
-\r
- public void paintComponent(java.awt.Graphics g)\r
- {\r
- if (sourceRegistry == null)\r
- {\r
- Thread worker = new Thread(this);\r
- worker.start();\r
- }\r
- }\r
-\r
- void init()\r
- {\r
- List<jalviewSourceI> sources = sourceRegistry.getSources();\r
- int dSize = sources.size();\r
- Object[][] data = new Object[dSize][2];\r
- for (int i = 0; i < dSize; i++)\r
- {\r
- data[i][0] = sources.get(i).getTitle(); // what's equivalent of nickname\r
- data[i][1] = new Boolean(selectedSources.contains(sources.get(i)\r
- .getTitle()));\r
- }\r
-\r
- refreshTableData(data);\r
- setCapabilities(sourceRegistry);\r
-\r
- javax.swing.SwingUtilities.invokeLater(new Runnable()\r
- {\r
- public void run()\r
- {\r
- TableSorter sorter = (TableSorter) table.getModel();\r
- sorter.setSortingStatus(1, TableSorter.DESCENDING);\r
- sorter.setSortingStatus(1, TableSorter.NOT_SORTED);\r
- }\r
- });\r
-\r
- progressBar.setIndeterminate(false);\r
- progressBar.setVisible(false);\r
- addLocal.setVisible(true);\r
- refresh.setVisible(true);\r
- }\r
-\r
- public void refreshTableData(Object[][] data)\r
- {\r
- TableSorter sorter = new TableSorter(new DASTableModel(data));\r
- sorter.setTableHeader(table.getTableHeader());\r
- table.setModel(sorter);\r
- }\r
-\r
- void displayFullDetails(String nickName)\r
- {\r
-\r
- StringBuffer text = new StringBuffer(\r
- "<HTML><font size=\"2\" face=\"Verdana, Arial, Helvetica, sans-serif\">");\r
-\r
- if (nickName == null)\r
- {\r
- fullDetails.setText(text + "Select a DAS service from the table"\r
- + " to read a full description here.</font></html>");\r
- return;\r
- }\r
-\r
- int dSize = sourceRegistry.getSources().size();\r
- for (jalviewSourceI ds : sourceRegistry.getSources())\r
- {\r
- if (!ds.getTitle().equals(nickName))\r
- {\r
- continue;\r
- }\r
-\r
- VERSION latest = ds.getVersion();\r
- text.append("<font color=\"#0000FF\">Id:</font> " + ds.getUri()\r
- + "<br>");\r
- text.append("<font color=\"#0000FF\">Nickname:</font> "\r
- + ds.getTitle() + "<br>");\r
-\r
- text.append("<font color=\"#0000FF\">URL:</font> <a href=\""\r
- + ds.getSourceURL() + "\">" + ds.getSourceURL() + "</a>"\r
- + "<br>");\r
- if (!ds.isLocal())\r
- {\r
- if (ds.getDocHref() != null && ds.getDocHref().length() > 0)\r
- {\r
- text.append("<font color=\"#0000FF\">Site:</font> <a href=\""\r
- + ds.getDocHref() + "\">" + ds.getDocHref() + "</a>"\r
- + "<br>");\r
- }\r
-\r
- text.append("<font color=\"#0000FF\">Description:</font> "\r
- + ds.getDescription() + "<br>");\r
-\r
- text.append("<font color=\"#0000FF\">Admin Email:</font> <a href=\"mailto:"\r
- + ds.getEmail() + "\">" + ds.getEmail() + "</a>" + "<br>");\r
-\r
- text.append("<font color=\"#0000FF\">Registered at:</font> "\r
- + latest.getCreated() + "<br>");\r
-\r
- // TODO: Identify last successful test date\r
- // text.append("<font color=\"#0000FF\">Last successful test:</font> "\r
- // + latest.dasSources[i].getLeaseDate() + "<br>");\r
- }\r
- else\r
- {\r
- text.append("Source was added manually.<br/>");\r
- }\r
- text.append("<font color=\"#0000FF\">Labels:</font> ");\r
- boolean b = false;\r
- for (PROP labl : latest.getPROP())\r
- {\r
- if (labl.getName().equalsIgnoreCase("LABEL"))\r
- {\r
- if (b)\r
- {\r
- text.append(",");\r
- }\r
- text.append(" ");\r
-\r
- text.append(labl.getValue());\r
- b = true;\r
- }\r
- ;\r
- }\r
- text.append("<br>");\r
-\r
- text.append("<font color=\"#0000FF\">Capabilities:</font> ");\r
- CAPABILITY[] scap = latest.getCAPABILITY().toArray(new CAPABILITY[0]);\r
- for (int j = 0; j < scap.length; j++)\r
- {\r
- text.append(scap[j].getType());\r
- if (j < scap.length - 1)\r
- {\r
- text.append(", ");\r
- }\r
- }\r
- text.append("<br>");\r
-\r
- text.append("<font color=\"#0000FF\">Coordinates:</font>");\r
- int i = 1;\r
- for (COORDINATES dcs : latest.getCOORDINATES())\r
- {\r
- text.append("<br/>" + i++ + ". ");\r
- text.append(dcs.getAuthority() + " : " + dcs.getSource());\r
- if (dcs.getTaxid() != null && dcs.getTaxid().trim().length() > 0)\r
- {\r
- text.append(" [TaxId:" + dcs.getTaxid() + "]");\r
- }\r
- if (dcs.getVersion() != null\r
- && dcs.getVersion().trim().length() > 0)\r
- {\r
- {\r
- text.append(" {v. " + dcs.getVersion() + "}");\r
- }\r
- }\r
- text.append(" (<a href=\"" + dcs.getUri() + "\">" + dcs.getUri()\r
- + "</a>)");\r
- }\r
- text.append("</font></html>");\r
-\r
- break;\r
- }\r
-\r
- fullDetails.setText(text.toString());\r
- javax.swing.SwingUtilities.invokeLater(new Runnable()\r
- {\r
- public void run()\r
- {\r
- fullDetailsScrollpane.getVerticalScrollBar().setValue(0);\r
- }\r
- });\r
- }\r
-\r
- public void run()\r
- {\r
- loadingDasSources = true;\r
-\r
- addLocal.setVisible(false);\r
- refresh.setVisible(false);\r
- progressBar.setVisible(true);\r
- progressBar.setIndeterminate(true);\r
- setParentGuiEnabled(false);\r
- // Refresh the source list.\r
- sourceRegistry.refreshSources();\r
-\r
- init();\r
-\r
- setParentGuiEnabled(true);\r
- loadingDasSources = false;\r
-\r
- }\r
-\r
- private void setParentGuiEnabled(boolean b)\r
- {\r
- if (fs != null)\r
- {\r
- fs.fetchDAS.setEnabled(b);\r
- fs.saveDAS.setEnabled(b);\r
- }\r
- }\r
-\r
- public Vector<jalviewSourceI> getSelectedSources()\r
- {\r
- // wait around if we're still loading.\r
- while (sourceRegistry == null)\r
- {\r
- if (!loadingDasSources)\r
- {\r
- new Thread(this).start();\r
- try\r
- {\r
- Thread.sleep(5);\r
- } catch (Exception e)\r
- {\r
- }\r
- ;\r
- while (loadingDasSources)\r
- {\r
- try\r
- {\r
- Thread.sleep(5);\r
- } catch (Exception e)\r
- {\r
- }\r
- ;\r
- }\r
- ;\r
- }\r
- }\r
-\r
- Vector<jalviewSourceI> selected = new Vector<jalviewSourceI>();\r
- for (String source : selectedSources)\r
- {\r
- jalviewSourceI srce = sourceRegistry.getSource(source);\r
- if (srce != null)\r
- {\r
- selected.addElement(srce);\r
- }\r
- }\r
- return selected;\r
- }\r
-\r
- public void refresh_actionPerformed(ActionEvent e)\r
- {\r
- saveProperties(jalview.bin.Cache.applicationProperties);\r
-\r
- Thread worker = new Thread(this);\r
- worker.start();\r
- }\r
-\r
- private void setCapabilities(DasSourceRegistryI sourceRegistry2)\r
- {\r
- Vector<String> authority = new Vector<String>();\r
- Vector<String> type = new Vector<String>();\r
- Vector<String> label = new Vector<String>();\r
- Vector<String> taxIds = new Vector<String>();\r
- authority.add("Any");\r
- type.add("Any");\r
- label.add("Any");\r
-\r
- for (jalviewSourceI ds : sourceRegistry2.getSources())\r
- {\r
- VERSION latest = ds.getVersion();\r
-\r
- for (COORDINATES cs : latest.getCOORDINATES())\r
- {\r
- if (!type.contains(cs.getSource()))\r
- {\r
- type.add(cs.getSource()); // source==category\r
- }\r
-\r
- if (!authority.contains(cs.getAuthority()))\r
- {\r
- authority.add(cs.getAuthority());\r
- }\r
- }\r
-\r
- for (PROP slabel : latest.getPROP())\r
- {\r
- if (slabel.getName().equalsIgnoreCase("LABEL")\r
- && !label.contains(slabel.getValue()))\r
- {\r
- label.add(slabel.getValue());\r
- }\r
- }\r
-\r
- }\r
-\r
- filter1.setListData(authority);\r
- filter2.setListData(type);\r
- filter3.setListData(label);\r
- // filter4 taxIds\r
-\r
- javax.swing.SwingUtilities.invokeLater(new Runnable()\r
- {\r
- public void run()\r
- {\r
- filter1.setSelectedIndex(0);\r
- filter2.setSelectedIndex(0);\r
- filter3.setSelectedIndex(0);\r
- }\r
- });\r
- }\r
-\r
- public void amendLocal(boolean newSource)\r
- {\r
- String url = "http://localhost:8080/", nickname = "";\r
- boolean seqsrc = false;\r
- if (!newSource)\r
- {\r
- int selectedRow = table.getSelectionModel().getMinSelectionIndex();\r
- nickname = table.getValueAt(selectedRow, 0).toString();\r
- jalviewSourceI source = sourceRegistry.getSource(nickname);\r
- url = source.getUri();\r
- seqsrc = source.isSequenceSource();\r
- }\r
-\r
- JTextField nametf = new JTextField(nickname, 40);\r
- JTextField urltf = new JTextField(url, 40);\r
- JCheckBox seqs = new JCheckBox("Sequence Source");\r
- seqs.setSelected(seqsrc);\r
- JPanel panel = new JPanel(new BorderLayout());\r
- JPanel pane12 = new JPanel(new BorderLayout());\r
- pane12.add(new JLabel("Nickname: "), BorderLayout.CENTER);\r
- pane12.add(nametf, BorderLayout.EAST);\r
- panel.add(pane12, BorderLayout.NORTH);\r
- pane12 = new JPanel(new BorderLayout());\r
- pane12.add(new JLabel("URL: "), BorderLayout.NORTH);\r
- pane12.add(seqs, BorderLayout.SOUTH);\r
- pane12.add(urltf, BorderLayout.EAST);\r
- panel.add(pane12, BorderLayout.SOUTH);\r
-\r
- int reply = JOptionPane.showInternalConfirmDialog(Desktop.desktop,\r
- panel, "Enter Nickname & URL of Local DAS Source",\r
- JOptionPane.OK_CANCEL_OPTION);\r
-\r
- if (reply != JOptionPane.OK_OPTION)\r
- {\r
- return;\r
- }\r
-\r
- if (!urltf.getText().endsWith("/"))\r
- {\r
- urltf.setText(urltf.getText() + "/");\r
- }\r
-\r
- jalviewSourceI local = sourceRegistry.createLocalSource(\r
- urltf.getText(), nametf.getText(), seqs.isSelected(), true);\r
- List sources = sourceRegistry.getSources();\r
- int osize = sources.size();\r
- int size = osize + (newSource ? 1 : 0);\r
-\r
- Object[][] data = new Object[size][2];\r
- DASTableModel dtm = (table != null) ? (DASTableModel) ((TableSorter) table\r
- .getModel()).getTableModel() : null;\r
- for (int i = 0; i < osize; i++)\r
- {\r
- String osrc = (dtm == null || i >= osize) ? null : (String) dtm\r
- .getValueAt(i, 0);\r
- if (!newSource && osrc != null\r
- && dtm.getValueAt(i, 0).equals(nickname))\r
- {\r
- data[i][0] = local.getTitle();\r
- data[i][1] = new Boolean(true);\r
- }\r
- else\r
- {\r
- data[i][0] = osrc;\r
- data[i][1] = new Boolean(selectedSources.contains(osrc));\r
- }\r
- }\r
- // Always add a new source at the end\r
- if (newSource)\r
- {\r
- data[osize][0] = local.getTitle();\r
- data[osize][1] = new Boolean(true);\r
- selectedSources.add(local.getTitle());\r
- }\r
-\r
- refreshTableData(data);\r
-\r
- SwingUtilities.invokeLater(new Runnable()\r
- {\r
- public void run()\r
- {\r
- scrollPane.getVerticalScrollBar().setValue(\r
- scrollPane.getVerticalScrollBar().getMaximum());\r
- }\r
- });\r
-\r
- displayFullDetails(local.getTitle());\r
- }\r
-\r
- public void editRemoveLocalSource(MouseEvent evt)\r
- {\r
- int selectedRow = table.getSelectionModel().getMinSelectionIndex();\r
- if (selectedRow == -1)\r
- {\r
- return;\r
- }\r
-\r
- String nickname = table.getValueAt(selectedRow, 0).toString();\r
-\r
- if (!sourceRegistry.getSource(nickname).isLocal())\r
- {\r
- JOptionPane.showInternalMessageDialog(Desktop.desktop,\r
- "You can only edit or remove local DAS Sources!",\r
- "Public DAS source - not editable",\r
- JOptionPane.WARNING_MESSAGE);\r
- return;\r
- }\r
-\r
- Object[] options =\r
- { "Edit", "Remove", "Cancel" };\r
- int choice = JOptionPane.showInternalOptionDialog(Desktop.desktop,\r
- "Do you want to edit or remove " + nickname + "?",\r
- "Edit / Remove Local DAS Source",\r
- JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE,\r
- null, options, options[2]);\r
-\r
- switch (choice)\r
- {\r
- case 0:\r
- amendLocal(false);\r
- break;\r
- case 1:\r
- sourceRegistry.removeLocalSource(sourceRegistry.getSource(nickname));\r
- selectedSources.remove(nickname);\r
- Object[][] data = new Object[sourceRegistry.getSources().size()][2];\r
- int index = 0,\r
- l = table.getRowCount();\r
-\r
- for (int i = 0; i < l; i++)\r
- {\r
- String nm;\r
- if ((nm = (String) table.getValueAt(i, 0)).equals(nickname))\r
- {\r
- continue;\r
- }\r
- else\r
- {\r
- data[index][0] = nm;\r
- data[index][1] = new Boolean(selectedSources.contains(nm));\r
- index++;\r
- }\r
- }\r
- refreshTableData(data);\r
- SwingUtilities.invokeLater(new Runnable()\r
- {\r
- public void run()\r
- {\r
- scrollPane.getVerticalScrollBar().setValue(\r
- scrollPane.getVerticalScrollBar().getMaximum());\r
- }\r
- });\r
-\r
- break;\r
- }\r
- }\r
-\r
- public void valueChanged(ListSelectionEvent evt)\r
- {\r
- // Called when the MainTable selection changes\r
- if (evt.getValueIsAdjusting())\r
- {\r
- return;\r
- }\r
-\r
- displayFullDetails(null);\r
-\r
- // Filter the displayed data sources\r
-\r
- ArrayList names = new ArrayList();\r
- ArrayList selected = new ArrayList();\r
-\r
- // The features filter is not visible, but we must still\r
- // filter the das source list here.\r
- // July 2006 - only 6 sources fo not serve features\r
- Object[] dummyFeatureList = new Object[]\r
- { "features" };\r
- List<jalviewSourceI> srcs = sourceRegistry.getSources();\r
- for (jalviewSourceI ds : srcs)\r
- {\r
-\r
- VERSION v = ds.getVersion();\r
- List<COORDINATES> coords = v.getCOORDINATES();\r
- if (ds.isLocal()\r
- || ((coords == null || coords.size() == 0)\r
- && filter1.getSelectedIndex() == 0\r
- && filter2.getSelectedIndex() == 0 && filter3\r
- .getSelectedIndex() == 0))\r
- {\r
- // THIS IS A FIX FOR LOCAL SOURCES WHICH DO NOT\r
- // HAVE COORDINATE SYSTEMS, INFO WHICH AT PRESENT\r
- // IS ADDED FROM THE REGISTRY\r
- names.add(ds.getTitle());\r
- selected.add(new Boolean(selectedSources.contains(ds.getTitle())));\r
- continue;\r
- }\r
-\r
- if (!selectedInList(dummyFeatureList, ds.getCapabilityList(v))\r
- || !selectedInList(filter3.getSelectedValues(),\r
- ds.getLabelsFor(v)))\r
- {\r
- continue;\r
- }\r
-\r
- for (int j = 0; j < coords.size(); j++)\r
- {\r
- if (selectedInList(filter1.getSelectedValues(), new String[]\r
- { coords.get(j).getAuthority() })\r
- && selectedInList(filter2.getSelectedValues(), new String[]\r
- { coords.get(j).getSource() }))\r
- {\r
- names.add(ds.getTitle());\r
- selected.add(new Boolean(selectedSources.contains(ds.getTitle())));\r
- break;\r
- }\r
- }\r
- }\r
-\r
- int dSize = names.size();\r
- Object[][] data = new Object[dSize][2];\r
- for (int d = 0; d < dSize; d++)\r
- {\r
- data[d][0] = names.get(d);\r
- data[d][1] = selected.get(d);\r
- }\r
-\r
- refreshTableData(data);\r
- }\r
-\r
- private boolean selectedInList(Object[] selection, String[] items)\r
- {\r
- for (int i = 0; i < selection.length; i++)\r
- {\r
- if (selection[i].equals("Any"))\r
- {\r
- return true;\r
- }\r
- if (items == null || items.length == 0)\r
- {\r
- return false;\r
- }\r
- String sel = (items[0].startsWith("das1:") ? "das1:" : "")\r
- + selection[i];\r
- for (int j = 0; j < items.length; j++)\r
- {\r
- if (sel.equals(items[j]))\r
- {\r
- return true;\r
- }\r
- }\r
- }\r
-\r
- return false;\r
- }\r
-\r
- void setSelectedFromProperties()\r
- {\r
- String active = jalview.bin.Cache.getDefault("DAS_ACTIVE_SOURCE",\r
- "uniprot");\r
- StringTokenizer st = new StringTokenizer(active, "\t");\r
- selectedSources = new Vector();\r
- while (st.hasMoreTokens())\r
- {\r
- selectedSources.addElement(st.nextToken());\r
- }\r
- }\r
-\r
- public void reset_actionPerformed(ActionEvent e)\r
- {\r
- registryURL.setText(sourceRegistry.getDasRegistryURL());\r
- }\r
-\r
- /**\r
- * set the DAS source settings in the given jalview properties.\r
- * \r
- * @param properties\r
- */\r
- public void saveProperties(Properties properties)\r
- {\r
- if (registryURL.getText() == null || registryURL.getText().length() < 1)\r
- {\r
- properties.remove(jalview.bin.Cache.DAS_REGISTRY_URL);\r
- }\r
- else\r
- {\r
- properties.setProperty(jalview.bin.Cache.DAS_REGISTRY_URL,\r
- registryURL.getText());\r
- }\r
-\r
- StringBuffer sb = new StringBuffer();\r
- for (int r = 0; r < table.getModel().getRowCount(); r++)\r
- {\r
- if (((Boolean) table.getValueAt(r, 1)).booleanValue())\r
- {\r
- sb.append(table.getValueAt(r, 0) + "\t");\r
- }\r
- }\r
-\r
- properties.setProperty(jalview.bin.Cache.DAS_ACTIVE_SOURCE,\r
- sb.toString());\r
-\r
- String sourceprop = sourceRegistry.getLocalSourceString();\r
- properties.setProperty(jalview.bin.Cache.DAS_LOCAL_SOURCE, sourceprop);\r
- }\r
-\r
- class DASTableModel extends AbstractTableModel\r
- {\r
-\r
- public DASTableModel(Object[][] data)\r
- {\r
- this.data = data;\r
- }\r
-\r
- private String[] columnNames = new String[]\r
- { "Nickname", "Use Source" };\r
-\r
- private Object[][] data;\r
-\r
- public int getColumnCount()\r
- {\r
- return columnNames.length;\r
- }\r
-\r
- public int getRowCount()\r
- {\r
- return data.length;\r
- }\r
-\r
- public String getColumnName(int col)\r
- {\r
- return columnNames[col];\r
- }\r
-\r
- public Object getValueAt(int row, int col)\r
- {\r
- return data[row][col];\r
- }\r
-\r
- /*\r
- * JTable uses this method to determine the default renderer/ editor for\r
- * each cell. If we didn't implement this method, then the last column would\r
- * contain text ("true"/"false"), rather than a check box.\r
- */\r
- public Class getColumnClass(int c)\r
- {\r
- return getValueAt(0, c).getClass();\r
- }\r
-\r
- /*\r
- * Don't need to implement this method unless your table's editable.\r
- */\r
- public boolean isCellEditable(int row, int col)\r
- {\r
- // Note that the data/cell address is constant,\r
- // no matter where the cell appears onscreen.\r
- return col == 1;\r
-\r
- }\r
-\r
- /*\r
- * Don't need to implement this method unless your table's data can change.\r
- */\r
- public void setValueAt(Object value, int row, int col)\r
- {\r
- data[row][col] = value;\r
- fireTableCellUpdated(row, col);\r
-\r
- String name = getValueAt(row, 0).toString();\r
- boolean selected = ((Boolean) value).booleanValue();\r
-\r
- if (selectedSources.contains(name) && !selected)\r
- {\r
- selectedSources.remove(name);\r
- }\r
-\r
- if (!selectedSources.contains(name) && selected)\r
- {\r
- selectedSources.add(name);\r
- }\r
- }\r
- }\r
-\r
- public void initDasSources()\r
- {\r
-\r
- Thread thr = new Thread(new Runnable()\r
- {\r
- public void run()\r
- {\r
- // this actually initialises the das source list\r
- paintComponent(null); // yuk\r
- }\r
- });\r
- thr.start();\r
- while (loadingDasSources || sourceRegistry == null)\r
- {\r
- try\r
- {\r
- Thread.sleep(10);\r
- } catch (Exception e)\r
- {\r
- }\r
- ;\r
- }\r
- }\r
-\r
- /**\r
- * disable or enable the buttons on the source browser\r
- * \r
- * @param b\r
- */\r
- public void setGuiEnabled(boolean b)\r
- {\r
- refresh.setEnabled(b);\r
- addLocal.setEnabled(b);\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.gui;
+
+import jalview.jbgui.GDasSourceBrowser;
+import jalview.util.TableSorter;
+import jalview.ws.dbsources.das.api.DasSourceRegistryI;
+import jalview.ws.dbsources.das.api.jalviewSourceI;
+
+import java.awt.BorderLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+import javax.swing.JCheckBox;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+import javax.swing.ListSelectionModel;
+import javax.swing.SwingUtilities;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+import javax.swing.table.AbstractTableModel;
+
+import org.biodas.jdas.schema.sources.CAPABILITY;
+import org.biodas.jdas.schema.sources.COORDINATES;
+import org.biodas.jdas.schema.sources.PROP;
+import org.biodas.jdas.schema.sources.VERSION;
+
+public class DasSourceBrowser extends GDasSourceBrowser implements
+ Runnable, ListSelectionListener
+{
+ DasSourceRegistryI sourceRegistry = null;
+
+ Vector<String> selectedSources;
+
+ public DasSourceBrowser(FeatureSettings featureSettings)
+ {
+ fs = featureSettings;
+ // TODO DasSourceRegistryProvider API
+ sourceRegistry = jalview.bin.Cache.getDasSourceRegistry();
+ String registry = sourceRegistry.getDasRegistryURL();
+
+ registryURL.setText(registry);
+
+ setSelectedFromProperties();
+
+ displayFullDetails(null);
+ table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+
+ filter1.addListSelectionListener(this);
+ filter2.addListSelectionListener(this);
+ filter3.addListSelectionListener(this);
+
+ // Ask to be notified of selection changes.
+ ListSelectionModel rowSM = table.getSelectionModel();
+ rowSM.addListSelectionListener(new ListSelectionListener()
+ {
+ public void valueChanged(ListSelectionEvent e)
+ {
+ ListSelectionModel lsm = (ListSelectionModel) e.getSource();
+ if (!lsm.isSelectionEmpty())
+ {
+ int selectedRow = lsm.getMinSelectionIndex();
+ displayFullDetails(table.getValueAt(selectedRow, 0).toString());
+ }
+ }
+ });
+
+ table.addMouseListener(new MouseAdapter()
+ {
+ public void mouseClicked(MouseEvent evt)
+ {
+ if (evt.getClickCount() == 2
+ || SwingUtilities.isRightMouseButton(evt))
+ {
+ editRemoveLocalSource(evt);
+ }
+ }
+ });
+
+ if (sourceRegistry.getSources() != null)
+ {
+ init();
+ }
+ }
+
+ FeatureSettings fs = null;
+
+ private boolean loadingDasSources;
+
+ public DasSourceBrowser()
+ {
+ this(null);
+ }
+
+ public void paintComponent(java.awt.Graphics g)
+ {
+ if (sourceRegistry == null)
+ {
+ Thread worker = new Thread(this);
+ worker.start();
+ }
+ }
+
+ void init()
+ {
+ List<jalviewSourceI> sources = sourceRegistry.getSources();
+ int dSize = sources.size();
+ Object[][] data = new Object[dSize][2];
+ for (int i = 0; i < dSize; i++)
+ {
+ data[i][0] = sources.get(i).getTitle(); // what's equivalent of nickname
+ data[i][1] = new Boolean(selectedSources.contains(sources.get(i)
+ .getTitle()));
+ }
+
+ refreshTableData(data);
+ setCapabilities(sourceRegistry);
+
+ javax.swing.SwingUtilities.invokeLater(new Runnable()
+ {
+ public void run()
+ {
+ TableSorter sorter = (TableSorter) table.getModel();
+ sorter.setSortingStatus(1, TableSorter.DESCENDING);
+ sorter.setSortingStatus(1, TableSorter.NOT_SORTED);
+ }
+ });
+
+ progressBar.setIndeterminate(false);
+ progressBar.setVisible(false);
+ addLocal.setVisible(true);
+ refresh.setVisible(true);
+ }
+
+ public void refreshTableData(Object[][] data)
+ {
+ TableSorter sorter = new TableSorter(new DASTableModel(data));
+ sorter.setTableHeader(table.getTableHeader());
+ table.setModel(sorter);
+ }
+
+ void displayFullDetails(String nickName)
+ {
+
+ StringBuffer text = new StringBuffer(
+ "<HTML><font size=\"2\" face=\"Verdana, Arial, Helvetica, sans-serif\">");
+
+ if (nickName == null)
+ {
+ fullDetails.setText(text + "Select a DAS service from the table"
+ + " to read a full description here.</font></html>");
+ return;
+ }
+
+ int dSize = sourceRegistry.getSources().size();
+ for (jalviewSourceI ds : sourceRegistry.getSources())
+ {
+ if (!ds.getTitle().equals(nickName))
+ {
+ continue;
+ }
+
+ VERSION latest = ds.getVersion();
+ text.append("<font color=\"#0000FF\">Id:</font> " + ds.getUri()
+ + "<br>");
+ text.append("<font color=\"#0000FF\">Nickname:</font> "
+ + ds.getTitle() + "<br>");
+
+ text.append("<font color=\"#0000FF\">URL:</font> <a href=\""
+ + ds.getSourceURL() + "\">" + ds.getSourceURL() + "</a>"
+ + "<br>");
+ if (!ds.isLocal())
+ {
+ if (ds.getDocHref() != null && ds.getDocHref().length() > 0)
+ {
+ text.append("<font color=\"#0000FF\">Site:</font> <a href=\""
+ + ds.getDocHref() + "\">" + ds.getDocHref() + "</a>"
+ + "<br>");
+ }
+
+ text.append("<font color=\"#0000FF\">Description:</font> "
+ + ds.getDescription() + "<br>");
+
+ text.append("<font color=\"#0000FF\">Admin Email:</font> <a href=\"mailto:"
+ + ds.getEmail() + "\">" + ds.getEmail() + "</a>" + "<br>");
+
+ text.append("<font color=\"#0000FF\">Registered at:</font> "
+ + latest.getCreated() + "<br>");
+
+ // TODO: Identify last successful test date
+ // text.append("<font color=\"#0000FF\">Last successful test:</font> "
+ // + latest.dasSources[i].getLeaseDate() + "<br>");
+ }
+ else
+ {
+ text.append("Source was added manually.<br/>");
+ }
+ text.append("<font color=\"#0000FF\">Labels:</font> ");
+ boolean b = false;
+ for (PROP labl : latest.getPROP())
+ {
+ if (labl.getName().equalsIgnoreCase("LABEL"))
+ {
+ if (b)
+ {
+ text.append(",");
+ }
+ text.append(" ");
+
+ text.append(labl.getValue());
+ b = true;
+ }
+ ;
+ }
+ text.append("<br>");
+
+ text.append("<font color=\"#0000FF\">Capabilities:</font> ");
+ CAPABILITY[] scap = latest.getCAPABILITY().toArray(new CAPABILITY[0]);
+ for (int j = 0; j < scap.length; j++)
+ {
+ text.append(scap[j].getType());
+ if (j < scap.length - 1)
+ {
+ text.append(", ");
+ }
+ }
+ text.append("<br>");
+
+ text.append("<font color=\"#0000FF\">Coordinates:</font>");
+ int i = 1;
+ for (COORDINATES dcs : latest.getCOORDINATES())
+ {
+ text.append("<br/>" + i++ + ". ");
+ text.append(dcs.getAuthority() + " : " + dcs.getSource());
+ if (dcs.getTaxid() != null && dcs.getTaxid().trim().length() > 0)
+ {
+ text.append(" [TaxId:" + dcs.getTaxid() + "]");
+ }
+ if (dcs.getVersion() != null
+ && dcs.getVersion().trim().length() > 0)
+ {
+ {
+ text.append(" {v. " + dcs.getVersion() + "}");
+ }
+ }
+ text.append(" (<a href=\"" + dcs.getUri() + "\">" + dcs.getUri()
+ + "</a>)");
+ }
+ text.append("</font></html>");
+
+ break;
+ }
+
+ fullDetails.setText(text.toString());
+ javax.swing.SwingUtilities.invokeLater(new Runnable()
+ {
+ public void run()
+ {
+ fullDetailsScrollpane.getVerticalScrollBar().setValue(0);
+ }
+ });
+ }
+
+ public void run()
+ {
+ loadingDasSources = true;
+
+ addLocal.setVisible(false);
+ refresh.setVisible(false);
+ progressBar.setVisible(true);
+ progressBar.setIndeterminate(true);
+ setParentGuiEnabled(false);
+ // Refresh the source list.
+ sourceRegistry.refreshSources();
+
+ init();
+
+ setParentGuiEnabled(true);
+ loadingDasSources = false;
+
+ }
+
+ private void setParentGuiEnabled(boolean b)
+ {
+ if (fs != null)
+ {
+ fs.fetchDAS.setEnabled(b);
+ fs.saveDAS.setEnabled(b);
+ }
+ }
+
+ public Vector<jalviewSourceI> getSelectedSources()
+ {
+ // wait around if we're still loading.
+ while (sourceRegistry == null)
+ {
+ if (!loadingDasSources)
+ {
+ new Thread(this).start();
+ try
+ {
+ Thread.sleep(5);
+ } catch (Exception e)
+ {
+ }
+ ;
+ while (loadingDasSources)
+ {
+ try
+ {
+ Thread.sleep(5);
+ } catch (Exception e)
+ {
+ }
+ ;
+ }
+ ;
+ }
+ }
+
+ Vector<jalviewSourceI> selected = new Vector<jalviewSourceI>();
+ for (String source : selectedSources)
+ {
+ jalviewSourceI srce = sourceRegistry.getSource(source);
+ if (srce != null)
+ {
+ selected.addElement(srce);
+ }
+ }
+ return selected;
+ }
+
+ public void refresh_actionPerformed(ActionEvent e)
+ {
+ saveProperties(jalview.bin.Cache.applicationProperties);
+
+ Thread worker = new Thread(this);
+ worker.start();
+ }
+
+ private void setCapabilities(DasSourceRegistryI sourceRegistry2)
+ {
+ Vector<String> authority = new Vector<String>();
+ Vector<String> type = new Vector<String>();
+ Vector<String> label = new Vector<String>();
+ Vector<String> taxIds = new Vector<String>();
+ authority.add("Any");
+ type.add("Any");
+ label.add("Any");
+
+ for (jalviewSourceI ds : sourceRegistry2.getSources())
+ {
+ VERSION latest = ds.getVersion();
+
+ for (COORDINATES cs : latest.getCOORDINATES())
+ {
+ if (!type.contains(cs.getSource()))
+ {
+ type.add(cs.getSource()); // source==category
+ }
+
+ if (!authority.contains(cs.getAuthority()))
+ {
+ authority.add(cs.getAuthority());
+ }
+ }
+
+ for (PROP slabel : latest.getPROP())
+ {
+ if (slabel.getName().equalsIgnoreCase("LABEL")
+ && !label.contains(slabel.getValue()))
+ {
+ label.add(slabel.getValue());
+ }
+ }
+
+ }
+
+ filter1.setListData(authority);
+ filter2.setListData(type);
+ filter3.setListData(label);
+ // filter4 taxIds
+
+ javax.swing.SwingUtilities.invokeLater(new Runnable()
+ {
+ public void run()
+ {
+ filter1.setSelectedIndex(0);
+ filter2.setSelectedIndex(0);
+ filter3.setSelectedIndex(0);
+ }
+ });
+ }
+
+ public void amendLocal(boolean newSource)
+ {
+ String url = "http://localhost:8080/", nickname = "";
+ boolean seqsrc = false;
+ if (!newSource)
+ {
+ int selectedRow = table.getSelectionModel().getMinSelectionIndex();
+ nickname = table.getValueAt(selectedRow, 0).toString();
+ jalviewSourceI source = sourceRegistry.getSource(nickname);
+ url = source.getUri();
+ seqsrc = source.isSequenceSource();
+ }
+
+ JTextField nametf = new JTextField(nickname, 40);
+ JTextField urltf = new JTextField(url, 40);
+ JCheckBox seqs = new JCheckBox("Sequence Source");
+ seqs.setSelected(seqsrc);
+ JPanel panel = new JPanel(new BorderLayout());
+ JPanel pane12 = new JPanel(new BorderLayout());
+ pane12.add(new JLabel("Nickname: "), BorderLayout.CENTER);
+ pane12.add(nametf, BorderLayout.EAST);
+ panel.add(pane12, BorderLayout.NORTH);
+ pane12 = new JPanel(new BorderLayout());
+ pane12.add(new JLabel("URL: "), BorderLayout.NORTH);
+ pane12.add(seqs, BorderLayout.SOUTH);
+ pane12.add(urltf, BorderLayout.EAST);
+ panel.add(pane12, BorderLayout.SOUTH);
+
+ int reply = JOptionPane.showInternalConfirmDialog(Desktop.desktop,
+ panel, "Enter Nickname & URL of Local DAS Source",
+ JOptionPane.OK_CANCEL_OPTION);
+
+ if (reply != JOptionPane.OK_OPTION)
+ {
+ return;
+ }
+
+ if (!urltf.getText().endsWith("/"))
+ {
+ urltf.setText(urltf.getText() + "/");
+ }
+
+ jalviewSourceI local = sourceRegistry.createLocalSource(
+ urltf.getText(), nametf.getText(), seqs.isSelected(), true);
+ List sources = sourceRegistry.getSources();
+ int osize = sources.size();
+ int size = osize + (newSource ? 1 : 0);
+
+ Object[][] data = new Object[size][2];
+ DASTableModel dtm = (table != null) ? (DASTableModel) ((TableSorter) table
+ .getModel()).getTableModel() : null;
+ for (int i = 0; i < osize; i++)
+ {
+ String osrc = (dtm == null || i >= osize) ? null : (String) dtm
+ .getValueAt(i, 0);
+ if (!newSource && osrc != null
+ && dtm.getValueAt(i, 0).equals(nickname))
+ {
+ data[i][0] = local.getTitle();
+ data[i][1] = new Boolean(true);
+ }
+ else
+ {
+ data[i][0] = osrc;
+ data[i][1] = new Boolean(selectedSources.contains(osrc));
+ }
+ }
+ // Always add a new source at the end
+ if (newSource)
+ {
+ data[osize][0] = local.getTitle();
+ data[osize][1] = new Boolean(true);
+ selectedSources.add(local.getTitle());
+ }
+
+ refreshTableData(data);
+
+ SwingUtilities.invokeLater(new Runnable()
+ {
+ public void run()
+ {
+ scrollPane.getVerticalScrollBar().setValue(
+ scrollPane.getVerticalScrollBar().getMaximum());
+ }
+ });
+
+ displayFullDetails(local.getTitle());
+ }
+
+ public void editRemoveLocalSource(MouseEvent evt)
+ {
+ int selectedRow = table.getSelectionModel().getMinSelectionIndex();
+ if (selectedRow == -1)
+ {
+ return;
+ }
+
+ String nickname = table.getValueAt(selectedRow, 0).toString();
+
+ if (!sourceRegistry.getSource(nickname).isLocal())
+ {
+ JOptionPane.showInternalMessageDialog(Desktop.desktop,
+ "You can only edit or remove local DAS Sources!",
+ "Public DAS source - not editable",
+ JOptionPane.WARNING_MESSAGE);
+ return;
+ }
+
+ Object[] options =
+ { "Edit", "Remove", "Cancel" };
+ int choice = JOptionPane.showInternalOptionDialog(Desktop.desktop,
+ "Do you want to edit or remove " + nickname + "?",
+ "Edit / Remove Local DAS Source",
+ JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE,
+ null, options, options[2]);
+
+ switch (choice)
+ {
+ case 0:
+ amendLocal(false);
+ break;
+ case 1:
+ sourceRegistry.removeLocalSource(sourceRegistry.getSource(nickname));
+ selectedSources.remove(nickname);
+ Object[][] data = new Object[sourceRegistry.getSources().size()][2];
+ int index = 0,
+ l = table.getRowCount();
+
+ for (int i = 0; i < l; i++)
+ {
+ String nm;
+ if ((nm = (String) table.getValueAt(i, 0)).equals(nickname))
+ {
+ continue;
+ }
+ else
+ {
+ data[index][0] = nm;
+ data[index][1] = new Boolean(selectedSources.contains(nm));
+ index++;
+ }
+ }
+ refreshTableData(data);
+ SwingUtilities.invokeLater(new Runnable()
+ {
+ public void run()
+ {
+ scrollPane.getVerticalScrollBar().setValue(
+ scrollPane.getVerticalScrollBar().getMaximum());
+ }
+ });
+
+ break;
+ }
+ }
+
+ public void valueChanged(ListSelectionEvent evt)
+ {
+ // Called when the MainTable selection changes
+ if (evt.getValueIsAdjusting())
+ {
+ return;
+ }
+
+ displayFullDetails(null);
+
+ // Filter the displayed data sources
+
+ ArrayList names = new ArrayList();
+ ArrayList selected = new ArrayList();
+
+ // The features filter is not visible, but we must still
+ // filter the das source list here.
+ // July 2006 - only 6 sources fo not serve features
+ Object[] dummyFeatureList = new Object[]
+ { "features" };
+ List<jalviewSourceI> srcs = sourceRegistry.getSources();
+ for (jalviewSourceI ds : srcs)
+ {
+
+ VERSION v = ds.getVersion();
+ List<COORDINATES> coords = v.getCOORDINATES();
+ if (ds.isLocal()
+ || ((coords == null || coords.size() == 0)
+ && filter1.getSelectedIndex() == 0
+ && filter2.getSelectedIndex() == 0 && filter3
+ .getSelectedIndex() == 0))
+ {
+ // THIS IS A FIX FOR LOCAL SOURCES WHICH DO NOT
+ // HAVE COORDINATE SYSTEMS, INFO WHICH AT PRESENT
+ // IS ADDED FROM THE REGISTRY
+ names.add(ds.getTitle());
+ selected.add(new Boolean(selectedSources.contains(ds.getTitle())));
+ continue;
+ }
+
+ if (!selectedInList(dummyFeatureList, ds.getCapabilityList(v))
+ || !selectedInList(filter3.getSelectedValues(),
+ ds.getLabelsFor(v)))
+ {
+ continue;
+ }
+
+ for (int j = 0; j < coords.size(); j++)
+ {
+ if (selectedInList(filter1.getSelectedValues(), new String[]
+ { coords.get(j).getAuthority() })
+ && selectedInList(filter2.getSelectedValues(), new String[]
+ { coords.get(j).getSource() }))
+ {
+ names.add(ds.getTitle());
+ selected.add(new Boolean(selectedSources.contains(ds.getTitle())));
+ break;
+ }
+ }
+ }
+
+ int dSize = names.size();
+ Object[][] data = new Object[dSize][2];
+ for (int d = 0; d < dSize; d++)
+ {
+ data[d][0] = names.get(d);
+ data[d][1] = selected.get(d);
+ }
+
+ refreshTableData(data);
+ }
+
+ private boolean selectedInList(Object[] selection, String[] items)
+ {
+ for (int i = 0; i < selection.length; i++)
+ {
+ if (selection[i].equals("Any"))
+ {
+ return true;
+ }
+ if (items == null || items.length == 0)
+ {
+ return false;
+ }
+ String sel = (items[0].startsWith("das1:") ? "das1:" : "")
+ + selection[i];
+ for (int j = 0; j < items.length; j++)
+ {
+ if (sel.equals(items[j]))
+ {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ void setSelectedFromProperties()
+ {
+ String active = jalview.bin.Cache.getDefault("DAS_ACTIVE_SOURCE",
+ "uniprot");
+ StringTokenizer st = new StringTokenizer(active, "\t");
+ selectedSources = new Vector();
+ while (st.hasMoreTokens())
+ {
+ selectedSources.addElement(st.nextToken());
+ }
+ }
+
+ public void reset_actionPerformed(ActionEvent e)
+ {
+ registryURL.setText(sourceRegistry.getDasRegistryURL());
+ }
+
+ /**
+ * set the DAS source settings in the given jalview properties.
+ *
+ * @param properties
+ */
+ public void saveProperties(Properties properties)
+ {
+ if (registryURL.getText() == null || registryURL.getText().length() < 1)
+ {
+ properties.remove(jalview.bin.Cache.DAS_REGISTRY_URL);
+ }
+ else
+ {
+ properties.setProperty(jalview.bin.Cache.DAS_REGISTRY_URL,
+ registryURL.getText());
+ }
+
+ StringBuffer sb = new StringBuffer();
+ for (int r = 0; r < table.getModel().getRowCount(); r++)
+ {
+ if (((Boolean) table.getValueAt(r, 1)).booleanValue())
+ {
+ sb.append(table.getValueAt(r, 0) + "\t");
+ }
+ }
+
+ properties.setProperty(jalview.bin.Cache.DAS_ACTIVE_SOURCE,
+ sb.toString());
+
+ String sourceprop = sourceRegistry.getLocalSourceString();
+ properties.setProperty(jalview.bin.Cache.DAS_LOCAL_SOURCE, sourceprop);
+ }
+
+ class DASTableModel extends AbstractTableModel
+ {
+
+ public DASTableModel(Object[][] data)
+ {
+ this.data = data;
+ }
+
+ private String[] columnNames = new String[]
+ { "Nickname", "Use Source" };
+
+ private Object[][] data;
+
+ public int getColumnCount()
+ {
+ return columnNames.length;
+ }
+
+ public int getRowCount()
+ {
+ return data.length;
+ }
+
+ public String getColumnName(int col)
+ {
+ return columnNames[col];
+ }
+
+ public Object getValueAt(int row, int col)
+ {
+ return data[row][col];
+ }
+
+ /*
+ * JTable uses this method to determine the default renderer/ editor for
+ * each cell. If we didn't implement this method, then the last column would
+ * contain text ("true"/"false"), rather than a check box.
+ */
+ public Class getColumnClass(int c)
+ {
+ return getValueAt(0, c).getClass();
+ }
+
+ /*
+ * Don't need to implement this method unless your table's editable.
+ */
+ public boolean isCellEditable(int row, int col)
+ {
+ // Note that the data/cell address is constant,
+ // no matter where the cell appears onscreen.
+ return col == 1;
+
+ }
+
+ /*
+ * Don't need to implement this method unless your table's data can change.
+ */
+ public void setValueAt(Object value, int row, int col)
+ {
+ data[row][col] = value;
+ fireTableCellUpdated(row, col);
+
+ String name = getValueAt(row, 0).toString();
+ boolean selected = ((Boolean) value).booleanValue();
+
+ if (selectedSources.contains(name) && !selected)
+ {
+ selectedSources.remove(name);
+ }
+
+ if (!selectedSources.contains(name) && selected)
+ {
+ selectedSources.add(name);
+ }
+ }
+ }
+
+ public void initDasSources()
+ {
+
+ Thread thr = new Thread(new Runnable()
+ {
+ public void run()
+ {
+ // this actually initialises the das source list
+ paintComponent(null); // yuk
+ }
+ });
+ thr.start();
+ while (loadingDasSources || sourceRegistry == null)
+ {
+ try
+ {
+ Thread.sleep(10);
+ } catch (Exception e)
+ {
+ }
+ ;
+ }
+ }
+
+ /**
+ * disable or enable the buttons on the source browser
+ *
+ * @param b
+ */
+ public void setGuiEnabled(boolean b)
+ {
+ refresh.setEnabled(b);
+ addLocal.setEnabled(b);
+ }
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.gui;\r
-\r
-/**\r
- * Visual progress indicator interface.\r
- * \r
- * @author JimP\r
- * \r
- */\r
-public interface IProgressIndicator\r
-{\r
- /**\r
- * Visual indication of some operation taking place. On first call with a\r
- * particular ID an indicator with the given message is added. The indicator\r
- * is removed with a second call with same ID.\r
- * \r
- * @param message\r
- * - displayed message for operation\r
- * @param id\r
- * - unique handle for this indicator\r
- */\r
- public abstract void setProgressBar(String message, long id);\r
-\r
- /**\r
- * register a handler for the progress bar identified by id\r
- * \r
- * @param id\r
- * @param handler\r
- */\r
- public abstract void registerHandler(long id,\r
- IProgressIndicatorHandler handler);\r
-\r
- /**\r
- * \r
- * @return true if any progress bars are still active\r
- */\r
- boolean operationInProgress();\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.gui;
+
+/**
+ * Visual progress indicator interface.
+ *
+ * @author JimP
+ *
+ */
+public interface IProgressIndicator
+{
+ /**
+ * Visual indication of some operation taking place. On first call with a
+ * particular ID an indicator with the given message is added. The indicator
+ * is removed with a second call with same ID.
+ *
+ * @param message
+ * - displayed message for operation
+ * @param id
+ * - unique handle for this indicator
+ */
+ public abstract void setProgressBar(String message, long id);
+
+ /**
+ * register a handler for the progress bar identified by id
+ *
+ * @param id
+ * @param handler
+ */
+ public abstract void registerHandler(long id,
+ IProgressIndicatorHandler handler);
+
+ /**
+ *
+ * @return true if any progress bars are still active
+ */
+ boolean operationInProgress();
+
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.gui;\r
-\r
-public interface IProgressIndicatorHandler\r
-{\r
- /**\r
- * \r
- * @return true if a cancel button can be shown\r
- */\r
- public boolean canCancel();\r
-\r
- /**\r
- * Callback to cancel activity if the cancel button is pressed.\r
- * \r
- * @param id\r
- * @return true if activity was cancelled\r
- */\r
- public boolean cancelActivity(long id);\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.gui;
+
+public interface IProgressIndicatorHandler
+{
+ /**
+ *
+ * @return true if a cancel button can be shown
+ */
+ public boolean canCancel();
+
+ /**
+ * Callback to cancel activity if the cancel button is pressed.
+ *
+ * @param id
+ * @return true if activity was cancelled
+ */
+ public boolean cancelActivity(long id);
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
package jalview.gui;
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
package jalview.gui;
import jalview.bin.Cache;
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
package jalview.gui;
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.gui;\r
-\r
-import java.io.*;\r
-import java.net.*;\r
-import java.util.*;\r
-import java.util.jar.*;\r
-\r
-import javax.swing.*;\r
-\r
-import org.exolab.castor.xml.*;\r
-import jalview.binding.*;\r
-import jalview.schemes.*;\r
-import jalview.util.jarInputStreamProvider;\r
-\r
-/**\r
- * DOCUMENT ME!\r
- * \r
- * @author $author$\r
- * @version $Revision$\r
- */\r
-public class Jalview2XML_V1\r
-{\r
- boolean raiseGUI = true;\r
-\r
- public Jalview2XML_V1()\r
- {\r
-\r
- };\r
-\r
- public Jalview2XML_V1(boolean raiseGUI)\r
- {\r
- this.raiseGUI = raiseGUI;\r
- };\r
-\r
- jalview.schemes.UserColourScheme GetUserColourScheme(\r
- JalviewModelSequence jms, String id)\r
- {\r
- UserColours[] uc = jms.getUserColours();\r
- UserColours colours = null;\r
-\r
- for (int i = 0; i < uc.length; i++)\r
- {\r
- if (uc[i].getId().equals(id))\r
- {\r
- colours = uc[i];\r
-\r
- break;\r
- }\r
- }\r
-\r
- int csize = colours.getUserColourScheme().getColourCount();\r
- java.awt.Color[] newColours = new java.awt.Color[csize];\r
-\r
- for (int i = 0; i < csize; i++)\r
- {\r
- newColours[i] = new java.awt.Color(Integer.parseInt(colours\r
- .getUserColourScheme().getColour(i).getRGB(), 16));\r
- }\r
-\r
- return new jalview.schemes.UserColourScheme(newColours);\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- * \r
- * @param file\r
- * DOCUMENT ME!\r
- */\r
- public AlignFrame LoadJalviewAlign(final jarInputStreamProvider jprovider)\r
- {\r
- final String file = jprovider.getFilename();\r
- jalview.gui.AlignFrame af = null;\r
-\r
- try\r
- {\r
- JarInputStream jin = null;\r
- JarEntry jarentry = null;\r
- int entryCount = 1;\r
-\r
- do\r
- {\r
- jin = jprovider.getJarInputStream();\r
-\r
- for (int i = 0; i < entryCount; i++)\r
- {\r
- jarentry = jin.getNextJarEntry();\r
- }\r
-\r
- class NoDescIDResolver implements IDResolver\r
- {\r
- public Object resolve(String idref)\r
- {\r
- System.out.println(idref + " used");\r
- return null;\r
- }\r
- }\r
-\r
- if (jarentry != null)\r
- {\r
- InputStreamReader in = new InputStreamReader(jin, "UTF-8");\r
- JalviewModel object = new JalviewModel();\r
-\r
- object = (JalviewModel) object.unmarshal(in);\r
-\r
- af = LoadFromObject(object, file);\r
- entryCount++;\r
- }\r
- } while (jarentry != null);\r
- } catch (final java.net.UnknownHostException ex)\r
- {\r
- ex.printStackTrace();\r
- if (raiseGUI)\r
- {\r
- javax.swing.SwingUtilities.invokeLater(new Runnable()\r
- {\r
- public void run()\r
- {\r
-\r
- System.err.println("Couldn't locate Jalview XML file : " + ex\r
- + "\n");\r
- JOptionPane.showInternalMessageDialog(Desktop.desktop,\r
- "Couldn't locate " + file, "URL not found",\r
- JOptionPane.WARNING_MESSAGE);\r
- }\r
- });\r
- }\r
- ;\r
- } catch (Exception ex)\r
- {\r
- System.err.println("Exception whilst loading jalview XML file : ");\r
- ex.printStackTrace();\r
- if (raiseGUI)\r
- {\r
- javax.swing.SwingUtilities.invokeLater(new Runnable()\r
- {\r
- public void run()\r
- {\r
-\r
- JOptionPane.showInternalMessageDialog(Desktop.desktop,\r
- "Error loading " + file, "Error loading Jalview file",\r
- JOptionPane.WARNING_MESSAGE);\r
- }\r
- });\r
- }\r
- }\r
-\r
- return af;\r
- }\r
-\r
- AlignFrame LoadFromObject(JalviewModel object, String file)\r
- {\r
- Vector seqids = new Vector();\r
- SequenceSet vamsasSet = object.getVamsasModel().getSequenceSet(0);\r
- Sequence[] vamsasSeq = vamsasSet.getSequence();\r
-\r
- JalviewModelSequence jms = object.getJalviewModelSequence();\r
-\r
- // ////////////////////////////////\r
- // LOAD SEQUENCES\r
- jalview.datamodel.Sequence[] jseqs = new jalview.datamodel.Sequence[vamsasSeq.length];\r
- JSeq[] JSEQ = object.getJalviewModelSequence().getJSeq();\r
- for (int i = 0; i < vamsasSeq.length; i++)\r
- {\r
- jseqs[i] = new jalview.datamodel.Sequence(vamsasSeq[i].getName(),\r
- vamsasSeq[i].getSequence());\r
- jseqs[i].setStart(JSEQ[i].getStart());\r
- jseqs[i].setEnd(JSEQ[i].getEnd());\r
- seqids.add(jseqs[i]);\r
- }\r
-\r
- // /SequenceFeatures are added to the DatasetSequence,\r
- // so we must create the dataset before loading features\r
- // ///////////////////////////////\r
- jalview.datamodel.Alignment al = new jalview.datamodel.Alignment(jseqs);\r
- al.setDataset(null);\r
- // ///////////////////////////////\r
-\r
- for (int i = 0; i < vamsasSeq.length; i++)\r
- {\r
- if (JSEQ[i].getFeaturesCount() > 0)\r
- {\r
- Features[] features = JSEQ[i].getFeatures();\r
- for (int f = 0; f < features.length; f++)\r
- {\r
- jalview.datamodel.SequenceFeature sf = new jalview.datamodel.SequenceFeature(\r
- features[f].getType(), features[f].getDescription(),\r
- features[f].getStatus(), features[f].getBegin(),\r
- features[f].getEnd(), null);\r
-\r
- al.getSequenceAt(i).getDatasetSequence().addSequenceFeature(sf);\r
- }\r
- }\r
- if (JSEQ[i].getPdbidsCount() > 0)\r
- {\r
- Pdbids[] ids = JSEQ[i].getPdbids();\r
- for (int p = 0; p < ids.length; p++)\r
- {\r
- jalview.datamodel.PDBEntry entry = new jalview.datamodel.PDBEntry();\r
- entry.setId(ids[p].getId());\r
- entry.setType(ids[p].getType());\r
- al.getSequenceAt(i).getDatasetSequence().addPDBId(entry);\r
- }\r
-\r
- }\r
- }\r
-\r
- // ///////////////////////////////\r
- // ////////////////////////////////\r
- // LOAD ANNOTATIONS\r
- if (vamsasSet.getAnnotation() != null)\r
- {\r
- Annotation[] an = vamsasSet.getAnnotation();\r
-\r
- for (int i = 0; i < an.length; i++)\r
- {\r
- AnnotationElement[] ae = an[i].getAnnotationElement();\r
- jalview.datamodel.Annotation[] anot = new jalview.datamodel.Annotation[al\r
- .getWidth()];\r
-\r
- for (int aa = 0; aa < ae.length; aa++)\r
- {\r
- anot[ae[aa].getPosition()] = new jalview.datamodel.Annotation(\r
- ae[aa].getDisplayCharacter(), ae[aa].getDescription(),\r
- ae[aa].getSecondaryStructure().charAt(0),\r
- ae[aa].getValue());\r
- }\r
-\r
- jalview.datamodel.AlignmentAnnotation jaa = null;\r
-\r
- if (an[i].getGraph())\r
- {\r
- jaa = new jalview.datamodel.AlignmentAnnotation(an[i].getLabel(),\r
- an[i].getDescription(), anot, 0, 0,\r
- jalview.datamodel.AlignmentAnnotation.BAR_GRAPH);\r
- }\r
- else\r
- {\r
- jaa = new jalview.datamodel.AlignmentAnnotation(an[i].getLabel(),\r
- an[i].getDescription(), anot);\r
- }\r
-\r
- al.addAnnotation(jaa);\r
- }\r
- }\r
-\r
- // ///////////////////////////////\r
- // LOAD VIEWPORT\r
- Viewport[] views = jms.getViewport();\r
- Viewport view = views[0]; // DEAL WITH MULTIPLE VIEWPORTS LATER\r
-\r
- AlignFrame af = new AlignFrame(al, view.getWidth(), view.getHeight());\r
-\r
- af.setFileName(file, "Jalview");\r
-\r
- for (int i = 0; i < JSEQ.length; i++)\r
- {\r
- af.viewport.setSequenceColour(af.viewport.getAlignment()\r
- .getSequenceAt(i), new java.awt.Color(JSEQ[i].getColour()));\r
- }\r
-\r
- // af.changeColour() );\r
- // ///////////////////////\r
- // LOAD GROUPS\r
- if (jms.getJGroupCount() > 0)\r
- {\r
- JGroup[] groups = jms.getJGroup();\r
-\r
- for (int i = 0; i < groups.length; i++)\r
- {\r
- ColourSchemeI cs = null;\r
-\r
- if (groups[i].getColour() != null)\r
- {\r
- if (groups[i].getColour().startsWith("ucs"))\r
- {\r
- cs = GetUserColourScheme(jms, groups[i].getColour());\r
- }\r
- else\r
- {\r
- cs = ColourSchemeProperty.getColour(al, groups[i].getColour());\r
- }\r
-\r
- if (cs != null)\r
- {\r
- cs.setThreshold(groups[i].getPidThreshold(), true);\r
- }\r
-\r
- }\r
-\r
- Vector seqs = new Vector();\r
- int[] ids = groups[i].getSeq();\r
-\r
- for (int s = 0; s < ids.length; s++)\r
- {\r
- seqs.addElement((jalview.datamodel.SequenceI) seqids\r
- .elementAt(ids[s]));\r
- }\r
-\r
- jalview.datamodel.SequenceGroup sg = new jalview.datamodel.SequenceGroup(\r
- seqs, groups[i].getName(), cs, groups[i].getDisplayBoxes(),\r
- groups[i].getDisplayText(), groups[i].getColourText(),\r
- groups[i].getStart(), groups[i].getEnd());\r
-\r
- sg.setOutlineColour(new java.awt.Color(groups[i].getOutlineColour()));\r
-\r
- if (groups[i].getConsThreshold() != 0)\r
- {\r
- jalview.analysis.Conservation c = new jalview.analysis.Conservation(\r
- "All", ResidueProperties.propHash, 3,\r
- sg.getSequences(null), 0, sg.getWidth() - 1);\r
- c.calculate();\r
- c.verdict(false, 25);\r
- sg.cs.setConservation(c);\r
- }\r
-\r
- al.addGroup(sg);\r
- }\r
- }\r
-\r
- af.setBounds(view.getXpos(), view.getYpos(), view.getWidth(),\r
- view.getHeight());\r
- af.viewport.setStartRes(view.getStartRes());\r
- af.viewport.setStartSeq(view.getStartSeq());\r
- af.viewport.setShowAnnotation(view.getShowAnnotation());\r
- af.viewport.setAbovePIDThreshold(view.getPidSelected());\r
- af.viewport.setColourText(view.getShowColourText());\r
- af.viewport.setConservationSelected(view.getConservationSelected());\r
- af.viewport.setShowJVSuffix(view.getShowFullId());\r
- af.viewport.setFont(new java.awt.Font(view.getFontName(), view\r
- .getFontStyle(), view.getFontSize()));\r
- af.alignPanel.fontChanged();\r
-\r
- af.viewport.setRenderGaps(view.getRenderGaps());\r
- af.viewport.setWrapAlignment(view.getWrapAlignment());\r
- af.alignPanel.setWrapAlignment(view.getWrapAlignment());\r
- af.viewport.setShowAnnotation(view.getShowAnnotation());\r
- af.alignPanel.setAnnotationVisible(view.getShowAnnotation());\r
- af.viewport.setShowBoxes(view.getShowBoxes());\r
- af.viewport.setShowText(view.getShowText());\r
-\r
- ColourSchemeI cs = null;\r
-\r
- if (view.getBgColour() != null)\r
- {\r
- if (view.getBgColour().startsWith("ucs"))\r
- {\r
- cs = GetUserColourScheme(jms, view.getBgColour());\r
- }\r
- else\r
- {\r
- cs = ColourSchemeProperty.getColour(al, view.getBgColour());\r
- }\r
-\r
- if (cs != null)\r
- {\r
- cs.setThreshold(view.getPidThreshold(), true);\r
- cs.setConsensus(af.viewport.getSequenceConsensusHash());\r
- }\r
- }\r
-\r
- af.viewport.setGlobalColourScheme(cs);\r
- af.viewport.setColourAppliesToAllGroups(false);\r
- af.changeColour(cs);\r
- if (view.getConservationSelected() && cs != null)\r
- {\r
- cs.setConservationInc(view.getConsThreshold());\r
- }\r
-\r
- af.viewport.setColourAppliesToAllGroups(true);\r
- af.viewport.showSequenceFeatures = view.getShowSequenceFeatures();\r
-\r
- if (jms.getFeatureSettings() != null)\r
- {\r
- af.viewport.featuresDisplayed = new Hashtable();\r
- String[] renderOrder = new String[jms.getFeatureSettings()\r
- .getSettingCount()];\r
- for (int fs = 0; fs < jms.getFeatureSettings().getSettingCount(); fs++)\r
- {\r
- Setting setting = jms.getFeatureSettings().getSetting(fs);\r
-\r
- af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().setColour(\r
- setting.getType(), new java.awt.Color(setting.getColour()));\r
-\r
- renderOrder[fs] = setting.getType();\r
-\r
- if (setting.getDisplay())\r
- {\r
- af.viewport.featuresDisplayed.put(setting.getType(), new Integer(\r
- setting.getColour()));\r
- }\r
- }\r
- af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().renderOrder = renderOrder;\r
- }\r
-\r
- af.setMenusFromViewport(af.viewport);\r
-\r
- Desktop.addInternalFrame(af, view.getTitle(), view.getWidth(),\r
- view.getHeight());\r
-\r
- // LOAD TREES\r
- // /////////////////////////////////////\r
- if (jms.getTreeCount() > 0)\r
- {\r
- try\r
- {\r
- for (int t = 0; t < jms.getTreeCount(); t++)\r
- {\r
-\r
- Tree tree = jms.getTree(t);\r
-\r
- TreePanel tp = af.ShowNewickTree(\r
- new jalview.io.NewickFile(tree.getNewick()),\r
- tree.getTitle(), tree.getWidth(), tree.getHeight(),\r
- tree.getXpos(), tree.getYpos());\r
-\r
- tp.fitToWindow.setState(tree.getFitToWindow());\r
- tp.fitToWindow_actionPerformed(null);\r
-\r
- if (tree.getFontName() != null)\r
- {\r
- tp.setTreeFont(new java.awt.Font(tree.getFontName(), tree\r
- .getFontStyle(), tree.getFontSize()));\r
- }\r
- else\r
- {\r
- tp.setTreeFont(new java.awt.Font(view.getFontName(), view\r
- .getFontStyle(), tree.getFontSize()));\r
- }\r
-\r
- tp.showPlaceholders(tree.getMarkUnlinked());\r
- tp.showBootstrap(tree.getShowBootstrap());\r
- tp.showDistances(tree.getShowDistances());\r
-\r
- tp.treeCanvas.threshold = tree.getThreshold();\r
-\r
- if (tree.getCurrentTree())\r
- {\r
- af.viewport.setCurrentTree(tp.getTree());\r
- }\r
- }\r
-\r
- } catch (Exception ex)\r
- {\r
- ex.printStackTrace();\r
- }\r
-\r
- }\r
-\r
- return af;\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.gui;
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+import java.util.jar.*;
+
+import javax.swing.*;
+
+import org.exolab.castor.xml.*;
+import jalview.binding.*;
+import jalview.schemes.*;
+import jalview.util.jarInputStreamProvider;
+
+/**
+ * DOCUMENT ME!
+ *
+ * @author $author$
+ * @version $Revision$
+ */
+public class Jalview2XML_V1
+{
+ boolean raiseGUI = true;
+
+ public Jalview2XML_V1()
+ {
+
+ };
+
+ public Jalview2XML_V1(boolean raiseGUI)
+ {
+ this.raiseGUI = raiseGUI;
+ };
+
+ jalview.schemes.UserColourScheme GetUserColourScheme(
+ JalviewModelSequence jms, String id)
+ {
+ UserColours[] uc = jms.getUserColours();
+ UserColours colours = null;
+
+ for (int i = 0; i < uc.length; i++)
+ {
+ if (uc[i].getId().equals(id))
+ {
+ colours = uc[i];
+
+ break;
+ }
+ }
+
+ int csize = colours.getUserColourScheme().getColourCount();
+ java.awt.Color[] newColours = new java.awt.Color[csize];
+
+ for (int i = 0; i < csize; i++)
+ {
+ newColours[i] = new java.awt.Color(Integer.parseInt(colours
+ .getUserColourScheme().getColour(i).getRGB(), 16));
+ }
+
+ return new jalview.schemes.UserColourScheme(newColours);
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param file
+ * DOCUMENT ME!
+ */
+ public AlignFrame LoadJalviewAlign(final jarInputStreamProvider jprovider)
+ {
+ final String file = jprovider.getFilename();
+ jalview.gui.AlignFrame af = null;
+
+ try
+ {
+ JarInputStream jin = null;
+ JarEntry jarentry = null;
+ int entryCount = 1;
+
+ do
+ {
+ jin = jprovider.getJarInputStream();
+
+ for (int i = 0; i < entryCount; i++)
+ {
+ jarentry = jin.getNextJarEntry();
+ }
+
+ class NoDescIDResolver implements IDResolver
+ {
+ public Object resolve(String idref)
+ {
+ System.out.println(idref + " used");
+ return null;
+ }
+ }
+
+ if (jarentry != null)
+ {
+ InputStreamReader in = new InputStreamReader(jin, "UTF-8");
+ JalviewModel object = new JalviewModel();
+
+ object = (JalviewModel) object.unmarshal(in);
+
+ af = LoadFromObject(object, file);
+ entryCount++;
+ }
+ } while (jarentry != null);
+ } catch (final java.net.UnknownHostException ex)
+ {
+ ex.printStackTrace();
+ if (raiseGUI)
+ {
+ javax.swing.SwingUtilities.invokeLater(new Runnable()
+ {
+ public void run()
+ {
+
+ System.err.println("Couldn't locate Jalview XML file : " + ex
+ + "\n");
+ JOptionPane.showInternalMessageDialog(Desktop.desktop,
+ "Couldn't locate " + file, "URL not found",
+ JOptionPane.WARNING_MESSAGE);
+ }
+ });
+ }
+ ;
+ } catch (Exception ex)
+ {
+ System.err.println("Exception whilst loading jalview XML file : ");
+ ex.printStackTrace();
+ if (raiseGUI)
+ {
+ javax.swing.SwingUtilities.invokeLater(new Runnable()
+ {
+ public void run()
+ {
+
+ JOptionPane.showInternalMessageDialog(Desktop.desktop,
+ "Error loading " + file, "Error loading Jalview file",
+ JOptionPane.WARNING_MESSAGE);
+ }
+ });
+ }
+ }
+
+ return af;
+ }
+
+ AlignFrame LoadFromObject(JalviewModel object, String file)
+ {
+ Vector seqids = new Vector();
+ SequenceSet vamsasSet = object.getVamsasModel().getSequenceSet(0);
+ Sequence[] vamsasSeq = vamsasSet.getSequence();
+
+ JalviewModelSequence jms = object.getJalviewModelSequence();
+
+ // ////////////////////////////////
+ // LOAD SEQUENCES
+ jalview.datamodel.Sequence[] jseqs = new jalview.datamodel.Sequence[vamsasSeq.length];
+ JSeq[] JSEQ = object.getJalviewModelSequence().getJSeq();
+ for (int i = 0; i < vamsasSeq.length; i++)
+ {
+ jseqs[i] = new jalview.datamodel.Sequence(vamsasSeq[i].getName(),
+ vamsasSeq[i].getSequence());
+ jseqs[i].setStart(JSEQ[i].getStart());
+ jseqs[i].setEnd(JSEQ[i].getEnd());
+ seqids.add(jseqs[i]);
+ }
+
+ // /SequenceFeatures are added to the DatasetSequence,
+ // so we must create the dataset before loading features
+ // ///////////////////////////////
+ jalview.datamodel.Alignment al = new jalview.datamodel.Alignment(jseqs);
+ al.setDataset(null);
+ // ///////////////////////////////
+
+ for (int i = 0; i < vamsasSeq.length; i++)
+ {
+ if (JSEQ[i].getFeaturesCount() > 0)
+ {
+ Features[] features = JSEQ[i].getFeatures();
+ for (int f = 0; f < features.length; f++)
+ {
+ jalview.datamodel.SequenceFeature sf = new jalview.datamodel.SequenceFeature(
+ features[f].getType(), features[f].getDescription(),
+ features[f].getStatus(), features[f].getBegin(),
+ features[f].getEnd(), null);
+
+ al.getSequenceAt(i).getDatasetSequence().addSequenceFeature(sf);
+ }
+ }
+ if (JSEQ[i].getPdbidsCount() > 0)
+ {
+ Pdbids[] ids = JSEQ[i].getPdbids();
+ for (int p = 0; p < ids.length; p++)
+ {
+ jalview.datamodel.PDBEntry entry = new jalview.datamodel.PDBEntry();
+ entry.setId(ids[p].getId());
+ entry.setType(ids[p].getType());
+ al.getSequenceAt(i).getDatasetSequence().addPDBId(entry);
+ }
+
+ }
+ }
+
+ // ///////////////////////////////
+ // ////////////////////////////////
+ // LOAD ANNOTATIONS
+ if (vamsasSet.getAnnotation() != null)
+ {
+ Annotation[] an = vamsasSet.getAnnotation();
+
+ for (int i = 0; i < an.length; i++)
+ {
+ AnnotationElement[] ae = an[i].getAnnotationElement();
+ jalview.datamodel.Annotation[] anot = new jalview.datamodel.Annotation[al
+ .getWidth()];
+
+ for (int aa = 0; aa < ae.length; aa++)
+ {
+ anot[ae[aa].getPosition()] = new jalview.datamodel.Annotation(
+ ae[aa].getDisplayCharacter(), ae[aa].getDescription(),
+ ae[aa].getSecondaryStructure().charAt(0),
+ ae[aa].getValue());
+ }
+
+ jalview.datamodel.AlignmentAnnotation jaa = null;
+
+ if (an[i].getGraph())
+ {
+ jaa = new jalview.datamodel.AlignmentAnnotation(an[i].getLabel(),
+ an[i].getDescription(), anot, 0, 0,
+ jalview.datamodel.AlignmentAnnotation.BAR_GRAPH);
+ }
+ else
+ {
+ jaa = new jalview.datamodel.AlignmentAnnotation(an[i].getLabel(),
+ an[i].getDescription(), anot);
+ }
+
+ al.addAnnotation(jaa);
+ }
+ }
+
+ // ///////////////////////////////
+ // LOAD VIEWPORT
+ Viewport[] views = jms.getViewport();
+ Viewport view = views[0]; // DEAL WITH MULTIPLE VIEWPORTS LATER
+
+ AlignFrame af = new AlignFrame(al, view.getWidth(), view.getHeight());
+
+ af.setFileName(file, "Jalview");
+
+ for (int i = 0; i < JSEQ.length; i++)
+ {
+ af.viewport.setSequenceColour(af.viewport.getAlignment()
+ .getSequenceAt(i), new java.awt.Color(JSEQ[i].getColour()));
+ }
+
+ // af.changeColour() );
+ // ///////////////////////
+ // LOAD GROUPS
+ if (jms.getJGroupCount() > 0)
+ {
+ JGroup[] groups = jms.getJGroup();
+
+ for (int i = 0; i < groups.length; i++)
+ {
+ ColourSchemeI cs = null;
+
+ if (groups[i].getColour() != null)
+ {
+ if (groups[i].getColour().startsWith("ucs"))
+ {
+ cs = GetUserColourScheme(jms, groups[i].getColour());
+ }
+ else
+ {
+ cs = ColourSchemeProperty.getColour(al, groups[i].getColour());
+ }
+
+ if (cs != null)
+ {
+ cs.setThreshold(groups[i].getPidThreshold(), true);
+ }
+
+ }
+
+ Vector seqs = new Vector();
+ int[] ids = groups[i].getSeq();
+
+ for (int s = 0; s < ids.length; s++)
+ {
+ seqs.addElement((jalview.datamodel.SequenceI) seqids
+ .elementAt(ids[s]));
+ }
+
+ jalview.datamodel.SequenceGroup sg = new jalview.datamodel.SequenceGroup(
+ seqs, groups[i].getName(), cs, groups[i].getDisplayBoxes(),
+ groups[i].getDisplayText(), groups[i].getColourText(),
+ groups[i].getStart(), groups[i].getEnd());
+
+ sg.setOutlineColour(new java.awt.Color(groups[i].getOutlineColour()));
+
+ if (groups[i].getConsThreshold() != 0)
+ {
+ jalview.analysis.Conservation c = new jalview.analysis.Conservation(
+ "All", ResidueProperties.propHash, 3,
+ sg.getSequences(null), 0, sg.getWidth() - 1);
+ c.calculate();
+ c.verdict(false, 25);
+ sg.cs.setConservation(c);
+ }
+
+ al.addGroup(sg);
+ }
+ }
+
+ af.setBounds(view.getXpos(), view.getYpos(), view.getWidth(),
+ view.getHeight());
+ af.viewport.setStartRes(view.getStartRes());
+ af.viewport.setStartSeq(view.getStartSeq());
+ af.viewport.setShowAnnotation(view.getShowAnnotation());
+ af.viewport.setAbovePIDThreshold(view.getPidSelected());
+ af.viewport.setColourText(view.getShowColourText());
+ af.viewport.setConservationSelected(view.getConservationSelected());
+ af.viewport.setShowJVSuffix(view.getShowFullId());
+ af.viewport.setFont(new java.awt.Font(view.getFontName(), view
+ .getFontStyle(), view.getFontSize()));
+ af.alignPanel.fontChanged();
+
+ af.viewport.setRenderGaps(view.getRenderGaps());
+ af.viewport.setWrapAlignment(view.getWrapAlignment());
+ af.alignPanel.setWrapAlignment(view.getWrapAlignment());
+ af.viewport.setShowAnnotation(view.getShowAnnotation());
+ af.alignPanel.setAnnotationVisible(view.getShowAnnotation());
+ af.viewport.setShowBoxes(view.getShowBoxes());
+ af.viewport.setShowText(view.getShowText());
+
+ ColourSchemeI cs = null;
+
+ if (view.getBgColour() != null)
+ {
+ if (view.getBgColour().startsWith("ucs"))
+ {
+ cs = GetUserColourScheme(jms, view.getBgColour());
+ }
+ else
+ {
+ cs = ColourSchemeProperty.getColour(al, view.getBgColour());
+ }
+
+ if (cs != null)
+ {
+ cs.setThreshold(view.getPidThreshold(), true);
+ cs.setConsensus(af.viewport.getSequenceConsensusHash());
+ }
+ }
+
+ af.viewport.setGlobalColourScheme(cs);
+ af.viewport.setColourAppliesToAllGroups(false);
+ af.changeColour(cs);
+ if (view.getConservationSelected() && cs != null)
+ {
+ cs.setConservationInc(view.getConsThreshold());
+ }
+
+ af.viewport.setColourAppliesToAllGroups(true);
+ af.viewport.showSequenceFeatures = view.getShowSequenceFeatures();
+
+ if (jms.getFeatureSettings() != null)
+ {
+ af.viewport.featuresDisplayed = new Hashtable();
+ String[] renderOrder = new String[jms.getFeatureSettings()
+ .getSettingCount()];
+ for (int fs = 0; fs < jms.getFeatureSettings().getSettingCount(); fs++)
+ {
+ Setting setting = jms.getFeatureSettings().getSetting(fs);
+
+ af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().setColour(
+ setting.getType(), new java.awt.Color(setting.getColour()));
+
+ renderOrder[fs] = setting.getType();
+
+ if (setting.getDisplay())
+ {
+ af.viewport.featuresDisplayed.put(setting.getType(), new Integer(
+ setting.getColour()));
+ }
+ }
+ af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().renderOrder = renderOrder;
+ }
+
+ af.setMenusFromViewport(af.viewport);
+
+ Desktop.addInternalFrame(af, view.getTitle(), view.getWidth(),
+ view.getHeight());
+
+ // LOAD TREES
+ // /////////////////////////////////////
+ if (jms.getTreeCount() > 0)
+ {
+ try
+ {
+ for (int t = 0; t < jms.getTreeCount(); t++)
+ {
+
+ Tree tree = jms.getTree(t);
+
+ TreePanel tp = af.ShowNewickTree(
+ new jalview.io.NewickFile(tree.getNewick()),
+ tree.getTitle(), tree.getWidth(), tree.getHeight(),
+ tree.getXpos(), tree.getYpos());
+
+ tp.fitToWindow.setState(tree.getFitToWindow());
+ tp.fitToWindow_actionPerformed(null);
+
+ if (tree.getFontName() != null)
+ {
+ tp.setTreeFont(new java.awt.Font(tree.getFontName(), tree
+ .getFontStyle(), tree.getFontSize()));
+ }
+ else
+ {
+ tp.setTreeFont(new java.awt.Font(view.getFontName(), view
+ .getFontStyle(), tree.getFontSize()));
+ }
+
+ tp.showPlaceholders(tree.getMarkUnlinked());
+ tp.showBootstrap(tree.getShowBootstrap());
+ tp.showDistances(tree.getShowDistances());
+
+ tp.treeCanvas.threshold = tree.getThreshold();
+
+ if (tree.getCurrentTree())
+ {
+ af.viewport.setCurrentTree(tp.getTree());
+ }
+ }
+
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+
+ }
+
+ return af;
+ }
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ */
package jalview.gui;
import java.beans.PropertyChangeEvent;
changeSupport.removePropertyChangeListener(propertyName, listener);
}
-}
\ No newline at end of file
+}
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ */
package jalview.gui;
import java.awt.Container;
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.gui;\r
-\r
-import java.awt.Component;\r
-\r
-public class OOMWarning implements Runnable\r
-{\r
- String action = null;\r
-\r
- String instructions = "";\r
-\r
- public static boolean oomInprogress = false;\r
-\r
- Component desktop = null;\r
-\r
- /**\r
- * Raise an out of memory error.\r
- * \r
- * @param action\r
- * - what was going on when OutOfMemory exception occured.\r
- * @param instance\r
- * - Window where the dialog will appear\r
- * @param oomex\r
- * - the actual exception - to be written to stderr or debugger.\r
- */\r
- OOMWarning(final String action, final OutOfMemoryError oomex,\r
- final Component instance)\r
- {\r
- if (!oomInprogress)\r
- {\r
- oomInprogress = true;\r
- this.action = action;\r
- desktop = instance;\r
- if (oomex != null)\r
- {\r
- if (jalview.bin.Cache.log != null)\r
- {\r
- jalview.bin.Cache.log\r
- .error("Out of Memory when " + action, oomex);\r
- }\r
- else\r
- {\r
- System.err.println("Out of Memory when " + action);\r
- oomex.printStackTrace();\r
- }\r
- }\r
- javax.swing.SwingUtilities.invokeLater(this);\r
- System.gc();\r
- }\r
- }\r
-\r
- public OOMWarning(String string, OutOfMemoryError oomerror)\r
- {\r
- this(string, oomerror, Desktop.desktop);\r
- }\r
-\r
- public void run()\r
- {\r
- javax.swing.JOptionPane\r
- .showInternalMessageDialog(\r
- desktop,\r
- "Out of memory when "\r
- + action\r
- + "!!"\r
- + "\nSee help files for increasing Java Virtual Machine memory.",\r
- "Out of memory",\r
- javax.swing.JOptionPane.WARNING_MESSAGE);\r
- // hope that there's enough memory left that no more appear.\r
- oomInprogress = false;\r
- }\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.gui;
+
+import java.awt.Component;
+
+public class OOMWarning implements Runnable
+{
+ String action = null;
+
+ String instructions = "";
+
+ public static boolean oomInprogress = false;
+
+ Component desktop = null;
+
+ /**
+ * Raise an out of memory error.
+ *
+ * @param action
+ * - what was going on when OutOfMemory exception occured.
+ * @param instance
+ * - Window where the dialog will appear
+ * @param oomex
+ * - the actual exception - to be written to stderr or debugger.
+ */
+ OOMWarning(final String action, final OutOfMemoryError oomex,
+ final Component instance)
+ {
+ if (!oomInprogress)
+ {
+ oomInprogress = true;
+ this.action = action;
+ desktop = instance;
+ if (oomex != null)
+ {
+ if (jalview.bin.Cache.log != null)
+ {
+ jalview.bin.Cache.log
+ .error("Out of Memory when " + action, oomex);
+ }
+ else
+ {
+ System.err.println("Out of Memory when " + action);
+ oomex.printStackTrace();
+ }
+ }
+ javax.swing.SwingUtilities.invokeLater(this);
+ System.gc();
+ }
+ }
+
+ public OOMWarning(String string, OutOfMemoryError oomerror)
+ {
+ this(string, oomerror, Desktop.desktop);
+ }
+
+ public void run()
+ {
+ javax.swing.JOptionPane
+ .showInternalMessageDialog(
+ desktop,
+ "Out of memory when "
+ + action
+ + "!!"
+ + "\nSee help files for increasing Java Virtual Machine memory.",
+ "Out of memory",
+ javax.swing.JOptionPane.WARNING_MESSAGE);
+ // hope that there's enough memory left that no more appear.
+ oomInprogress = false;
+ }
+
+}
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ */
package jalview.gui;
import jalview.ws.params.ArgumentI;
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ */
package jalview.gui;
import jalview.gui.OptsAndParamsPage.ParamBox;
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
package jalview.gui;
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
package jalview.gui;
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ */
package jalview.gui;
import java.util.ArrayList;
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ */
package jalview.gui;
import jalview.io.packed.DataProvider.JvDataType;
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
+
package jalview.gui;
import java.util.*;
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
package jalview.gui;
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
Desktop.hyperlinkUpdate(e);
}
-}
\ No newline at end of file
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ */
+
package jalview.gui;
import java.awt.Component;
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.io;\r
-\r
-import java.io.*;\r
-import java.net.*;\r
-import java.util.*;\r
-\r
-import jalview.analysis.*;\r
-import jalview.datamodel.*;\r
-import jalview.schemes.*;\r
-\r
-public class AnnotationFile\r
-{\r
- public AnnotationFile()\r
- {\r
- init();\r
- }\r
-\r
- /**\r
- * character used to write newlines\r
- */\r
- protected String newline = System.getProperty("line.separator");\r
-\r
- /**\r
- * set new line string and reset the output buffer\r
- * \r
- * @param nl\r
- */\r
- public void setNewlineString(String nl)\r
- {\r
- newline = nl;\r
- init();\r
- }\r
-\r
- public String getNewlineString()\r
- {\r
- return newline;\r
- }\r
-\r
- StringBuffer text;\r
-\r
- private void init()\r
- {\r
- text = new StringBuffer("JALVIEW_ANNOTATION" + newline + "# Created: "\r
- + new java.util.Date() + newline + newline);\r
- refSeq = null;\r
- refSeqId = null;\r
- }\r
-\r
- /**\r
- * convenience method for pre-2.4 feature files which have no view, hidden\r
- * columns or hidden row keywords.\r
- * \r
- * @param annotations\r
- * @param list\r
- * @param properties\r
- * @return feature file as a string.\r
- */\r
- public String printAnnotations(AlignmentAnnotation[] annotations,\r
- List<SequenceGroup> list, Hashtable properties)\r
- {\r
- return printAnnotations(annotations, list, properties, null);\r
-\r
- }\r
-\r
- /**\r
- * hold all the information about a particular view definition read from or\r
- * written out in an annotations file.\r
- */\r
- public class ViewDef\r
- {\r
- public String viewname;\r
-\r
- public HiddenSequences hidseqs;\r
-\r
- public ColumnSelection hiddencols;\r
-\r
- public Vector visibleGroups;\r
-\r
- public Hashtable hiddenRepSeqs;\r
-\r
- public ViewDef(String viewname, HiddenSequences hidseqs,\r
- ColumnSelection hiddencols, Hashtable hiddenRepSeqs)\r
- {\r
- this.viewname = viewname;\r
- this.hidseqs = hidseqs;\r
- this.hiddencols = hiddencols;\r
- this.hiddenRepSeqs = hiddenRepSeqs;\r
- }\r
- }\r
-\r
- /**\r
- * Prepare an annotation file given a set of annotations, groups, alignment\r
- * properties and views.\r
- * \r
- * @param annotations\r
- * @param list\r
- * @param properties\r
- * @param views\r
- * @return annotation file\r
- */\r
- public String printAnnotations(AlignmentAnnotation[] annotations,\r
- List<SequenceGroup> list, Hashtable properties, ViewDef[] views)\r
- {\r
- // TODO: resolve views issue : annotationFile could contain visible region,\r
- // or full data + hidden region specifications for a view.\r
- if (annotations != null)\r
- {\r
- boolean oneColour = true;\r
- AlignmentAnnotation row;\r
- String comma;\r
- SequenceI refSeq = null;\r
- SequenceGroup refGroup = null;\r
-\r
- StringBuffer colours = new StringBuffer();\r
- StringBuffer graphLine = new StringBuffer();\r
- StringBuffer rowprops = new StringBuffer();\r
- Hashtable graphGroup = new Hashtable();\r
-\r
- java.awt.Color color;\r
-\r
- for (int i = 0; i < annotations.length; i++)\r
- {\r
- row = annotations[i];\r
-\r
- if (!row.visible && !row.hasScore())\r
- {\r
- continue;\r
- }\r
-\r
- color = null;\r
- oneColour = true;\r
-\r
- if (row.sequenceRef == null)\r
- {\r
- if (refSeq != null)\r
- {\r
- text.append(newline);\r
- text.append("SEQUENCE_REF\tALIGNMENT");\r
- text.append(newline);\r
- }\r
-\r
- refSeq = null;\r
- }\r
-\r
- else\r
- {\r
- if (refSeq == null || refSeq != row.sequenceRef)\r
- {\r
- refSeq = row.sequenceRef;\r
- text.append(newline);\r
- text.append("SEQUENCE_REF\t");\r
- text.append(refSeq.getName());\r
- text.append(newline);\r
- }\r
- }\r
- // mark any group references for the row\r
- if (row.groupRef == null)\r
- {\r
-\r
- if (refGroup != null)\r
- {\r
- text.append(newline);\r
- text.append("GROUP_REF\tALIGNMENT");\r
- text.append(newline);\r
- }\r
-\r
- refGroup = null;\r
- }\r
- else\r
- {\r
- if (refGroup == null || refGroup != row.groupRef)\r
- {\r
- refGroup = row.groupRef;\r
- text.append(newline);\r
- text.append("GROUP_REF\t");\r
- text.append(refGroup.getName());\r
- text.append(newline);\r
- }\r
- }\r
-\r
- boolean hasGlyphs = row.hasIcons, hasLabels = row.hasText, hasValues = row.hasScore, hasText = false;\r
- // lookahead to check what the annotation row object actually contains.\r
- for (int j = 0; row.annotations != null\r
- && j < row.annotations.length\r
- && (!hasGlyphs || !hasLabels || !hasValues); j++)\r
- {\r
- if (row.annotations[j] != null)\r
- {\r
- hasLabels |= (row.annotations[j].displayCharacter != null\r
- && row.annotations[j].displayCharacter.length() > 0 && !row.annotations[j].displayCharacter\r
- .equals(" "));\r
- hasGlyphs |= (row.annotations[j].secondaryStructure != 0 && row.annotations[j].secondaryStructure != ' ');\r
- hasValues |= (row.annotations[j].value != Float.NaN); // NaNs can't\r
- // be\r
- // rendered..\r
- hasText |= (row.annotations[j].description != null && row.annotations[j].description\r
- .length() > 0);\r
- }\r
- }\r
-\r
- if (row.graph == AlignmentAnnotation.NO_GRAPH)\r
- {\r
- text.append("NO_GRAPH\t");\r
- hasValues = false; // only secondary structure\r
- // hasLabels = false; // and annotation description string.\r
- }\r
- else\r
- {\r
- if (row.graph == AlignmentAnnotation.BAR_GRAPH)\r
- {\r
- text.append("BAR_GRAPH\t");\r
- hasGlyphs = false; // no secondary structure\r
-\r
- }\r
- else if (row.graph == AlignmentAnnotation.LINE_GRAPH)\r
- {\r
- hasGlyphs = false; // no secondary structure\r
- text.append("LINE_GRAPH\t");\r
- }\r
-\r
- if (row.getThreshold() != null)\r
- {\r
- graphLine.append("GRAPHLINE\t");\r
- graphLine.append(row.label);\r
- graphLine.append("\t");\r
- graphLine.append(row.getThreshold().value);\r
- graphLine.append("\t");\r
- graphLine.append(row.getThreshold().label);\r
- graphLine.append("\t");\r
- graphLine.append(jalview.util.Format.getHexString(row\r
- .getThreshold().colour));\r
- graphLine.append(newline);\r
- }\r
-\r
- if (row.graphGroup > -1)\r
- {\r
- String key = String.valueOf(row.graphGroup);\r
- if (graphGroup.containsKey(key))\r
- {\r
- graphGroup.put(key, graphGroup.get(key) + "\t" + row.label);\r
- }\r
- else\r
- {\r
- graphGroup.put(key, row.label);\r
- }\r
- }\r
- }\r
-\r
- text.append(row.label + "\t");\r
- if (row.description != null)\r
- {\r
- text.append(row.description + "\t");\r
- }\r
- for (int j = 0; row.annotations != null\r
- && j < row.annotations.length; j++)\r
- {\r
- if (refSeq != null\r
- && jalview.util.Comparison.isGap(refSeq.getCharAt(j)))\r
- {\r
- continue;\r
- }\r
-\r
- if (row.annotations[j] != null)\r
- {\r
- comma = "";\r
- if (hasGlyphs) // could be also hasGlyphs || ...\r
- {\r
-\r
- text.append(comma);\r
- if (row.annotations[j].secondaryStructure != ' ')\r
- {\r
- // only write out the field if its not whitespace.\r
- text.append(row.annotations[j].secondaryStructure);\r
- }\r
- comma = ",";\r
- }\r
- if (hasValues)\r
- {\r
- if (row.annotations[j].value != Float.NaN)\r
- {\r
- text.append(comma + row.annotations[j].value);\r
- }\r
- else\r
- {\r
- System.err.println("Skipping NaN - not valid value.");\r
- text.append(comma + 0f);// row.annotations[j].value);\r
- }\r
- comma = ",";\r
- }\r
- if (hasLabels)\r
- {\r
- // TODO: labels are emitted after values for bar graphs.\r
- if // empty labels are allowed, so\r
- (row.annotations[j].displayCharacter != null\r
- && row.annotations[j].displayCharacter.length() > 0\r
- && !row.annotations[j].displayCharacter.equals(" "))\r
- {\r
- text.append(comma + row.annotations[j].displayCharacter);\r
- comma = ",";\r
- }\r
- }\r
- if (hasText)\r
- {\r
- if (row.annotations[j].description != null\r
- && row.annotations[j].description.length() > 0\r
- && !row.annotations[j].description\r
- .equals(row.annotations[j].displayCharacter))\r
- {\r
- text.append(comma + row.annotations[j].description);\r
- comma = ",";\r
- }\r
- }\r
- if (color != null && !color.equals(row.annotations[j].colour))\r
- {\r
- oneColour = false;\r
- }\r
-\r
- color = row.annotations[j].colour;\r
-\r
- if (row.annotations[j].colour != null\r
- && row.annotations[j].colour != java.awt.Color.black)\r
- {\r
- text.append(comma\r
- + "["\r
- + jalview.util.Format\r
- .getHexString(row.annotations[j].colour)\r
- + "]");\r
- comma = ",";\r
- }\r
- }\r
- text.append("|");\r
- }\r
-\r
- if (row.hasScore())\r
- text.append("\t" + row.score);\r
-\r
- text.append(newline);\r
-\r
- if (color != null && color != java.awt.Color.black && oneColour)\r
- {\r
- colours.append("COLOUR\t");\r
- colours.append(row.label);\r
- colours.append("\t");\r
- colours.append(jalview.util.Format.getHexString(color));\r
- colours.append(newline);\r
- }\r
- if (row.scaleColLabel || row.showAllColLabels\r
- || row.centreColLabels)\r
- {\r
- rowprops.append("ROWPROPERTIES\t");\r
- rowprops.append(row.label);\r
- rowprops.append("\tscaletofit=");\r
- rowprops.append(row.scaleColLabel);\r
- rowprops.append("\tshowalllabs=");\r
- rowprops.append(row.showAllColLabels);\r
- rowprops.append("\tcentrelabs=");\r
- rowprops.append(row.centreColLabels);\r
- rowprops.append(newline);\r
- }\r
- }\r
-\r
- text.append(newline);\r
-\r
- text.append(colours.toString());\r
- text.append(graphLine.toString());\r
- if (graphGroup.size() > 0)\r
- {\r
- text.append("COMBINE\t");\r
- Enumeration en = graphGroup.elements();\r
- while (en.hasMoreElements())\r
- {\r
- text.append(en.nextElement());\r
- text.append(newline);\r
- }\r
- }\r
- text.append(rowprops.toString());\r
- }\r
-\r
- if (list != null)\r
- {\r
- printGroups(list);\r
- }\r
-\r
- if (properties != null)\r
- {\r
- text.append(newline);\r
- text.append(newline);\r
- text.append("ALIGNMENT");\r
- Enumeration en = properties.keys();\r
- while (en.hasMoreElements())\r
- {\r
- String key = en.nextElement().toString();\r
- text.append("\t");\r
- text.append(key);\r
- text.append("=");\r
- text.append(properties.get(key));\r
- }\r
- // TODO: output alignment visualization settings here if required\r
-\r
- }\r
-\r
- return text.toString();\r
- }\r
-\r
- public void printGroups(List<SequenceGroup> list)\r
- {\r
- SequenceI seqrep = null;\r
- for (SequenceGroup sg : list)\r
- {\r
- if (!sg.hasSeqrep())\r
- {\r
- text.append("SEQUENCE_GROUP\t" + sg.getName() + "\t"\r
- + (sg.getStartRes() + 1) + "\t" + (sg.getEndRes() + 1)\r
- + "\t" + "-1\t");\r
- seqrep = null;\r
- }\r
- else\r
- {\r
- seqrep = sg.getSeqrep();\r
- text.append("SEQUENCE_REF\t");\r
- text.append(seqrep.getName());\r
- text.append(newline);\r
- text.append("SEQUENCE_GROUP\t");\r
- text.append(sg.getName());\r
- text.append("\t");\r
- text.append((seqrep.findPosition(sg.getStartRes())));\r
- text.append("\t");\r
- text.append((seqrep.findPosition(sg.getEndRes())));\r
- text.append("\t");\r
- text.append("-1\t");\r
- }\r
- for (int s = 0; s < sg.getSize(); s++)\r
- {\r
- text.append(sg.getSequenceAt(s).getName());\r
- text.append("\t");\r
- }\r
- text.append(newline);\r
- text.append("PROPERTIES\t");\r
- text.append(sg.getName());\r
- text.append("\t");\r
-\r
- if (sg.getDescription() != null)\r
- {\r
- text.append("description=");\r
- text.append(sg.getDescription());\r
- text.append("\t");\r
- }\r
- if (sg.cs != null)\r
- {\r
- text.append("colour=");\r
- text.append(ColourSchemeProperty.getColourName(sg.cs));\r
- text.append("\t");\r
- if (sg.cs.getThreshold() != 0)\r
- {\r
- text.append("pidThreshold=");\r
- text.append(sg.cs.getThreshold());\r
- }\r
- if (sg.cs.conservationApplied())\r
- {\r
- text.append("consThreshold=");\r
- text.append(sg.cs.getConservationInc());\r
- text.append("\t");\r
- }\r
- }\r
- text.append("outlineColour=");\r
- text.append(jalview.util.Format.getHexString(sg.getOutlineColour()));\r
- text.append("\t");\r
-\r
- text.append("displayBoxes=");\r
- text.append(sg.getDisplayBoxes());\r
- text.append("\t");\r
- text.append("displayText=");\r
- text.append(sg.getDisplayText());\r
- text.append("\t");\r
- text.append("colourText=");\r
- text.append(sg.getColourText());\r
- text.append("\t");\r
- text.append("showUnconserved=");\r
- text.append(sg.getShowNonconserved());\r
- text.append("\t");\r
- if (sg.textColour != java.awt.Color.black)\r
- {\r
- text.append("textCol1=");\r
- text.append(jalview.util.Format.getHexString(sg.textColour));\r
- text.append("\t");\r
- }\r
- if (sg.textColour2 != java.awt.Color.white)\r
- {\r
- text.append("textCol2=");\r
- text.append(jalview.util.Format.getHexString(sg.textColour2));\r
- text.append("\t");\r
- }\r
- if (sg.thresholdTextColour != 0)\r
- {\r
- text.append("textColThreshold=");\r
- text.append(sg.thresholdTextColour);\r
- text.append("\t");\r
- }\r
- if (sg.idColour != null)\r
- {\r
- text.append("idColour=");\r
- text.append(jalview.util.Format.getHexString(sg.idColour));\r
- text.append("\t");\r
- }\r
- if (sg.isHidereps())\r
- {\r
- text.append("hide=true\t");\r
- }\r
- if (sg.isHideCols())\r
- {\r
- text.append("hidecols=true\t");\r
- }\r
- if (seqrep != null)\r
- {\r
- // terminate the last line and clear the sequence ref for the group\r
- text.append(newline);\r
- text.append("SEQUENCE_REF");\r
- }\r
- text.append(newline);\r
- text.append(newline);\r
-\r
- }\r
- }\r
-\r
- SequenceI refSeq = null;\r
-\r
- String refSeqId = null;\r
-\r
- public boolean readAnnotationFile(AlignmentI al, String file,\r
- String protocol)\r
- {\r
- BufferedReader in = null;\r
- try\r
- {\r
- if (protocol.equals(AppletFormatAdapter.FILE))\r
- {\r
- in = new BufferedReader(new FileReader(file));\r
- }\r
- else if (protocol.equals(AppletFormatAdapter.URL))\r
- {\r
- URL url = new URL(file);\r
- in = new BufferedReader(new InputStreamReader(url.openStream()));\r
- }\r
- else if (protocol.equals(AppletFormatAdapter.PASTE))\r
- {\r
- in = new BufferedReader(new StringReader(file));\r
- }\r
- else if (protocol.equals(AppletFormatAdapter.CLASSLOADER))\r
- {\r
- java.io.InputStream is = getClass().getResourceAsStream("/" + file);\r
- if (is != null)\r
- {\r
- in = new BufferedReader(new java.io.InputStreamReader(is));\r
- }\r
- }\r
- if (in != null)\r
- {\r
- return parseAnnotationFrom(al, in);\r
- }\r
-\r
- } catch (Exception ex)\r
- {\r
- ex.printStackTrace();\r
- System.out.println("Problem reading annotation file: " + ex);\r
- return false;\r
- }\r
- return false;\r
- }\r
-\r
- public boolean parseAnnotationFrom(AlignmentI al, BufferedReader in)\r
- throws Exception\r
- {\r
- boolean modified = false;\r
- String groupRef = null;\r
- Hashtable groupRefRows = new Hashtable();\r
-\r
- Hashtable autoAnnots = new Hashtable();\r
- {\r
- String line, label, description, token;\r
- int graphStyle, index;\r
- int refSeqIndex = 1;\r
- int existingAnnotations = 0;\r
- // when true - will add new rows regardless of whether they are duplicate\r
- // auto-annotation like consensus or conservation graphs\r
- boolean overrideAutoAnnot = false;\r
- if (al.getAlignmentAnnotation() != null)\r
- {\r
- existingAnnotations = al.getAlignmentAnnotation().length;\r
- if (existingAnnotations > 0)\r
- {\r
- AlignmentAnnotation[] aa = al.getAlignmentAnnotation();\r
- for (int aai = 0; aai < aa.length; aai++)\r
- {\r
- if (aa[aai].autoCalculated)\r
- {\r
- // make a note of the name and description\r
- autoAnnots.put(\r
- autoAnnotsKey(aa[aai], aa[aai].sequenceRef,\r
- (aa[aai].groupRef == null ? null\r
- : aa[aai].groupRef.getName())),\r
- new Integer(1));\r
- }\r
- }\r
- }\r
- }\r
-\r
- int alWidth = al.getWidth();\r
-\r
- StringTokenizer st;\r
- Annotation[] annotations;\r
- AlignmentAnnotation annotation = null;\r
-\r
- // First confirm this is an Annotation file\r
- boolean jvAnnotationFile = false;\r
- while ((line = in.readLine()) != null)\r
- {\r
- if (line.indexOf("#") == 0)\r
- {\r
- continue;\r
- }\r
-\r
- if (line.indexOf("JALVIEW_ANNOTATION") > -1)\r
- {\r
- jvAnnotationFile = true;\r
- break;\r
- }\r
- }\r
-\r
- if (!jvAnnotationFile)\r
- {\r
- in.close();\r
- return false;\r
- }\r
-\r
- while ((line = in.readLine()) != null)\r
- {\r
- if (line.indexOf("#") == 0\r
- || line.indexOf("JALVIEW_ANNOTATION") > -1\r
- || line.length() == 0)\r
- {\r
- continue;\r
- }\r
-\r
- st = new StringTokenizer(line, "\t");\r
- token = st.nextToken();\r
- if (token.equalsIgnoreCase("COLOUR"))\r
- {\r
- // TODO: use graduated colour def'n here too\r
- colourAnnotations(al, st.nextToken(), st.nextToken());\r
- modified = true;\r
- continue;\r
- }\r
-\r
- else if (token.equalsIgnoreCase("COMBINE"))\r
- {\r
- combineAnnotations(al, st);\r
- modified = true;\r
- continue;\r
- }\r
- else if (token.equalsIgnoreCase("ROWPROPERTIES"))\r
- {\r
- addRowProperties(al, st);\r
- modified = true;\r
- continue;\r
- }\r
- else if (token.equalsIgnoreCase("GRAPHLINE"))\r
- {\r
- addLine(al, st);\r
- modified = true;\r
- continue;\r
- }\r
-\r
- else if (token.equalsIgnoreCase("SEQUENCE_REF"))\r
- {\r
- if (st.hasMoreTokens())\r
- {\r
- refSeq = al.findName(refSeqId = st.nextToken());\r
- if (refSeq == null)\r
- {\r
- refSeqId = null;\r
- }\r
- try\r
- {\r
- refSeqIndex = Integer.parseInt(st.nextToken());\r
- if (refSeqIndex < 1)\r
- {\r
- refSeqIndex = 1;\r
- System.out\r
- .println("WARNING: SEQUENCE_REF index must be > 0 in AnnotationFile");\r
- }\r
- } catch (Exception ex)\r
- {\r
- refSeqIndex = 1;\r
- }\r
- }\r
- else\r
- {\r
- refSeq = null;\r
- refSeqId = null;\r
- }\r
- continue;\r
- }\r
- else if (token.equalsIgnoreCase("GROUP_REF"))\r
- {\r
- // Group references could be forward or backwards, so they are\r
- // resolved after the whole file is read in\r
- groupRef = null;\r
- if (st.hasMoreTokens())\r
- {\r
- groupRef = st.nextToken();\r
- if (groupRef.length() < 1)\r
- {\r
- groupRef = null; // empty string\r
- }\r
- else\r
- {\r
- if (groupRefRows.get(groupRef) == null)\r
- {\r
- groupRefRows.put(groupRef, new Vector());\r
- }\r
- }\r
- }\r
- continue;\r
- }\r
- else if (token.equalsIgnoreCase("SEQUENCE_GROUP"))\r
- {\r
- addGroup(al, st);\r
- continue;\r
- }\r
-\r
- else if (token.equalsIgnoreCase("PROPERTIES"))\r
- {\r
- addProperties(al, st);\r
- modified = true;\r
- continue;\r
- }\r
-\r
- else if (token.equalsIgnoreCase("BELOW_ALIGNMENT"))\r
- {\r
- setBelowAlignment(al, st);\r
- modified = true;\r
- continue;\r
- }\r
- else if (token.equalsIgnoreCase("ALIGNMENT"))\r
- {\r
- addAlignmentDetails(al, st);\r
- modified = true;\r
- continue;\r
- }\r
-\r
- // Parse out the annotation row\r
- graphStyle = AlignmentAnnotation.getGraphValueFromString(token);\r
- label = st.nextToken();\r
-\r
- index = 0;\r
- annotations = new Annotation[alWidth];\r
- description = null;\r
- float score = Float.NaN;\r
-\r
- if (st.hasMoreTokens())\r
- {\r
- line = st.nextToken();\r
-\r
- if (line.indexOf("|") == -1)\r
- {\r
- description = line;\r
- if (st.hasMoreTokens())\r
- line = st.nextToken();\r
- }\r
-\r
- if (st.hasMoreTokens())\r
- {\r
- // This must be the score\r
- score = Float.valueOf(st.nextToken()).floatValue();\r
- }\r
-\r
- st = new StringTokenizer(line, "|", true);\r
-\r
- boolean emptyColumn = true;\r
- boolean onlyOneElement = (st.countTokens() == 1);\r
-\r
- while (st.hasMoreElements() && index < alWidth)\r
- {\r
- token = st.nextToken().trim();\r
-\r
- if (onlyOneElement)\r
- {\r
- try\r
- {\r
- score = Float.valueOf(token).floatValue();\r
- break;\r
- } catch (NumberFormatException ex)\r
- {\r
- }\r
- }\r
-\r
- if (token.equals("|"))\r
- {\r
- if (emptyColumn)\r
- {\r
- index++;\r
- }\r
-\r
- emptyColumn = true;\r
- }\r
- else\r
- {\r
- annotations[index++] = parseAnnotation(token, graphStyle);\r
- emptyColumn = false;\r
- }\r
- }\r
-\r
- }\r
-\r
- annotation = new AlignmentAnnotation(label, description,\r
- (index == 0) ? null : annotations, 0, 0, graphStyle);\r
-\r
- annotation.score = score;\r
- if (!overrideAutoAnnot\r
- && autoAnnots.containsKey(autoAnnotsKey(annotation, refSeq,\r
- groupRef)))\r
- {\r
- // skip - we've already got an automatic annotation of this type.\r
- continue;\r
- }\r
- // otherwise add it!\r
- if (refSeq != null)\r
- {\r
-\r
- annotation.belowAlignment = false;\r
- // make a copy of refSeq so we can find other matches in the alignment\r
- SequenceI referedSeq = refSeq;\r
- do\r
- {\r
- // copy before we do any mapping business.\r
- // TODO: verify that undo/redo with 1:many sequence associated\r
- // annotations can be undone correctly\r
- AlignmentAnnotation ann = new AlignmentAnnotation(annotation);\r
- annotation\r
- .createSequenceMapping(referedSeq, refSeqIndex, false);\r
- annotation.adjustForAlignment();\r
- referedSeq.addAlignmentAnnotation(annotation);\r
- al.addAnnotation(annotation);\r
- al.setAnnotationIndex(annotation,\r
- al.getAlignmentAnnotation().length\r
- - existingAnnotations - 1);\r
- if (groupRef != null)\r
- {\r
- ((Vector) groupRefRows.get(groupRef)).addElement(annotation);\r
- }\r
- // and recover our virgin copy to use again if necessary.\r
- annotation = ann;\r
-\r
- } while (refSeqId != null\r
- && (referedSeq = al.findName(referedSeq, refSeqId, true)) != null);\r
- }\r
- else\r
- {\r
- al.addAnnotation(annotation);\r
- al.setAnnotationIndex(annotation,\r
- al.getAlignmentAnnotation().length - existingAnnotations\r
- - 1);\r
- if (groupRef != null)\r
- {\r
- ((Vector) groupRefRows.get(groupRef)).addElement(annotation);\r
- }\r
- }\r
- // and set modification flag\r
- modified = true;\r
- }\r
- // Finally, resolve the groupRefs\r
- Enumeration en = groupRefRows.keys();\r
-\r
- while (en.hasMoreElements())\r
- {\r
- groupRef = (String) en.nextElement();\r
- boolean matched = false;\r
- // Resolve group: TODO: add a getGroupByName method to alignments\r
- for (SequenceGroup theGroup : al.getGroups())\r
- {\r
- if (theGroup.getName().equals(groupRef))\r
- {\r
- if (matched)\r
- {\r
- // TODO: specify and implement duplication of alignment annotation\r
- // for multiple group references.\r
- System.err\r
- .println("Ignoring 1:many group reference mappings for group name '"\r
- + groupRef + "'");\r
- }\r
- else\r
- {\r
- matched = true;\r
- Vector rowset = (Vector) groupRefRows.get(groupRef);\r
- if (rowset != null && rowset.size() > 0)\r
- {\r
- AlignmentAnnotation alan = null;\r
- for (int elm = 0, elmSize = rowset.size(); elm < elmSize; elm++)\r
- {\r
- alan = (AlignmentAnnotation) rowset.elementAt(elm);\r
- alan.groupRef = theGroup;\r
- }\r
- }\r
- }\r
- }\r
- }\r
- ((Vector) groupRefRows.get(groupRef)).removeAllElements();\r
- }\r
- }\r
- return modified;\r
- }\r
-\r
- private Object autoAnnotsKey(AlignmentAnnotation annotation,\r
- SequenceI refSeq, String groupRef)\r
- {\r
- return annotation.graph + "\t" + annotation.label + "\t"\r
- + annotation.description + "\t"\r
- + (refSeq != null ? refSeq.getDisplayId(true) : "");\r
- }\r
-\r
- Annotation parseAnnotation(String string, int graphStyle)\r
- {\r
- boolean hasSymbols = (graphStyle == AlignmentAnnotation.NO_GRAPH); // don't\r
- // do the\r
- // glyph\r
- // test\r
- // if we\r
- // don't\r
- // want\r
- // secondary\r
- // structure\r
- String desc = null, displayChar = null;\r
- char ss = ' '; // secondaryStructure\r
- float value = 0;\r
- boolean parsedValue = false, dcset = false;\r
-\r
- // find colour here\r
- java.awt.Color colour = null;\r
- int i = string.indexOf("[");\r
- int j = string.indexOf("]");\r
- if (i > -1 && j > -1)\r
- {\r
- UserColourScheme ucs = new UserColourScheme();\r
-\r
- colour = ucs.getColourFromString(string.substring(i + 1, j));\r
- if (i > 0 && string.charAt(i - 1) == ',')\r
- {\r
- // clip the preceding comma as well\r
- i--;\r
- }\r
- string = string.substring(0, i) + string.substring(j + 1);\r
- }\r
-\r
- StringTokenizer st = new StringTokenizer(string, ",", true);\r
- String token;\r
- boolean seenContent = false;\r
- int pass = 0;\r
- while (st.hasMoreTokens())\r
- {\r
- pass++;\r
- token = st.nextToken().trim();\r
- if (token.equals(","))\r
- {\r
- if (!seenContent && parsedValue && !dcset)\r
- {\r
- // allow the value below the bar/line to be empty\r
- dcset = true;\r
- displayChar = " ";\r
- }\r
- seenContent = false;\r
- continue;\r
- }\r
- else\r
- {\r
- seenContent = true;\r
- }\r
-\r
- if (!parsedValue)\r
- {\r
- try\r
- {\r
- displayChar = token;\r
- // foo\r
- value = new Float(token).floatValue();\r
- parsedValue = true;\r
- continue;\r
- } catch (NumberFormatException ex)\r
- {\r
- }\r
- }\r
- else\r
- {\r
- if (token.length() == 1)\r
- {\r
- displayChar = token;\r
- }\r
- }\r
- if (hasSymbols\r
- && (token.equals("H") || token.equals("E")\r
- || token.equals("S") || token.equals(" ")))\r
- {\r
- // Either this character represents a helix or sheet\r
- // or an integer which can be displayed\r
- ss = token.charAt(0);\r
- if (displayChar.equals(token.substring(0, 1)))\r
- {\r
- displayChar = "";\r
- }\r
- }\r
- else if (desc == null || (parsedValue && pass > 2))\r
- {\r
- desc = token;\r
- }\r
-\r
- }\r
- // if (!dcset && string.charAt(string.length() - 1) == ',')\r
- // {\r
- // displayChar = " "; // empty display char symbol.\r
- // }\r
- if (displayChar != null && desc != null && desc.length() == 1)\r
- {\r
- if (displayChar.length() > 1)\r
- {\r
- // switch desc and displayChar - legacy support\r
- String tmp = displayChar;\r
- displayChar = desc;\r
- desc = tmp;\r
- }\r
- else\r
- {\r
- if (displayChar.equals(desc))\r
- {\r
- // duplicate label - hangover from the 'robust parser' above\r
- desc = null;\r
- }\r
- }\r
- }\r
- Annotation anot = new Annotation(displayChar, desc, ss, value);\r
-\r
- anot.colour = colour;\r
-\r
- return anot;\r
- }\r
-\r
- void colourAnnotations(AlignmentI al, String label, String colour)\r
- {\r
- UserColourScheme ucs = new UserColourScheme(colour);\r
- Annotation[] annotations;\r
- for (int i = 0; i < al.getAlignmentAnnotation().length; i++)\r
- {\r
- if (al.getAlignmentAnnotation()[i].label.equalsIgnoreCase(label))\r
- {\r
- annotations = al.getAlignmentAnnotation()[i].annotations;\r
- for (int j = 0; j < annotations.length; j++)\r
- {\r
- if (annotations[j] != null)\r
- {\r
- annotations[j].colour = ucs.findColour('A');\r
- }\r
- }\r
- }\r
- }\r
- }\r
-\r
- void combineAnnotations(AlignmentI al, StringTokenizer st)\r
- {\r
- int graphGroup = -1;\r
- String group = st.nextToken();\r
- // First make sure we are not overwriting the graphIndex\r
- if (al.getAlignmentAnnotation() != null)\r
- {\r
- for (int i = 0; i < al.getAlignmentAnnotation().length; i++)\r
- {\r
- if (al.getAlignmentAnnotation()[i].label.equalsIgnoreCase(group))\r
- {\r
- graphGroup = al.getAlignmentAnnotation()[i].graphGroup + 1;\r
- al.getAlignmentAnnotation()[i].graphGroup = graphGroup;\r
- break;\r
- }\r
- }\r
-\r
- // Now update groups\r
- while (st.hasMoreTokens())\r
- {\r
- group = st.nextToken();\r
- for (int i = 0; i < al.getAlignmentAnnotation().length; i++)\r
- {\r
- if (al.getAlignmentAnnotation()[i].label.equalsIgnoreCase(group))\r
- {\r
- al.getAlignmentAnnotation()[i].graphGroup = graphGroup;\r
- break;\r
- }\r
- }\r
- }\r
- }\r
- else\r
- {\r
- System.err\r
- .println("Couldn't combine annotations. None are added to alignment yet!");\r
- }\r
- }\r
-\r
- void addLine(AlignmentI al, StringTokenizer st)\r
- {\r
- String group = st.nextToken();\r
- AlignmentAnnotation annotation = null, alannot[] = al\r
- .getAlignmentAnnotation();\r
- if (alannot != null)\r
- {\r
- for (int i = 0; i < alannot.length; i++)\r
- {\r
- if (alannot[i].label.equalsIgnoreCase(group))\r
- {\r
- annotation = alannot[i];\r
- break;\r
- }\r
- }\r
- }\r
- if (annotation == null)\r
- {\r
- return;\r
- }\r
- float value = new Float(st.nextToken()).floatValue();\r
- String label = st.hasMoreTokens() ? st.nextToken() : null;\r
- java.awt.Color colour = null;\r
- if (st.hasMoreTokens())\r
- {\r
- UserColourScheme ucs = new UserColourScheme(st.nextToken());\r
- colour = ucs.findColour('A');\r
- }\r
-\r
- annotation.setThreshold(new GraphLine(value, label, colour));\r
- }\r
-\r
- void addGroup(AlignmentI al, StringTokenizer st)\r
- {\r
- SequenceGroup sg = new SequenceGroup();\r
- sg.setName(st.nextToken());\r
- String rng = "";\r
- try\r
- {\r
- rng = st.nextToken();\r
- if (rng.length() > 0 && !rng.startsWith("*"))\r
- {\r
- sg.setStartRes(Integer.parseInt(rng) - 1);\r
- }\r
- else\r
- {\r
- sg.setStartRes(0);\r
- }\r
- rng = st.nextToken();\r
- if (rng.length() > 0 && !rng.startsWith("*"))\r
- {\r
- sg.setEndRes(Integer.parseInt(rng) - 1);\r
- }\r
- else\r
- {\r
- sg.setEndRes(al.getWidth() - 1);\r
- }\r
- } catch (Exception e)\r
- {\r
- System.err\r
- .println("Couldn't parse Group Start or End Field as '*' or a valid column or sequence index: '"\r
- + rng + "' - assuming alignment width for group.");\r
- // assume group is full width\r
- sg.setStartRes(0);\r
- sg.setEndRes(al.getWidth() - 1);\r
- }\r
-\r
- String index = st.nextToken();\r
- if (index.equals("-1"))\r
- {\r
- while (st.hasMoreElements())\r
- {\r
- sg.addSequence(al.findName(st.nextToken()), false);\r
- }\r
- }\r
- else\r
- {\r
- StringTokenizer st2 = new StringTokenizer(index, ",");\r
-\r
- while (st2.hasMoreTokens())\r
- {\r
- String tmp = st2.nextToken();\r
- if (tmp.equals("*"))\r
- {\r
- for (int i = 0; i < al.getHeight(); i++)\r
- {\r
- sg.addSequence(al.getSequenceAt(i), false);\r
- }\r
- }\r
- else if (tmp.indexOf("-") >= 0)\r
- {\r
- StringTokenizer st3 = new StringTokenizer(tmp, "-");\r
-\r
- int start = (Integer.parseInt(st3.nextToken()));\r
- int end = (Integer.parseInt(st3.nextToken()));\r
-\r
- if (end > start)\r
- {\r
- for (int i = start; i <= end; i++)\r
- {\r
- sg.addSequence(al.getSequenceAt(i - 1), false);\r
- }\r
- }\r
- }\r
- else\r
- {\r
- sg.addSequence(al.getSequenceAt(Integer.parseInt(tmp) - 1), false);\r
- }\r
- }\r
- }\r
-\r
- if (refSeq != null)\r
- {\r
- sg.setStartRes(refSeq.findIndex(sg.getStartRes() + 1) - 1);\r
- sg.setEndRes(refSeq.findIndex(sg.getEndRes() + 1) - 1);\r
- sg.setSeqrep(refSeq);\r
- }\r
-\r
- if (sg.getSize() > 0)\r
- {\r
- al.addGroup(sg);\r
- }\r
- }\r
-\r
- void addRowProperties(AlignmentI al, StringTokenizer st)\r
- {\r
- String label = st.nextToken(), keyValue, key, value;\r
- boolean scaletofit = false, centerlab = false, showalllabs = false;\r
- while (st.hasMoreTokens())\r
- {\r
- keyValue = st.nextToken();\r
- key = keyValue.substring(0, keyValue.indexOf("="));\r
- value = keyValue.substring(keyValue.indexOf("=") + 1);\r
- if (key.equalsIgnoreCase("scaletofit"))\r
- {\r
- scaletofit = Boolean.valueOf(value).booleanValue();\r
- }\r
- if (key.equalsIgnoreCase("showalllabs"))\r
- {\r
- showalllabs = Boolean.valueOf(value).booleanValue();\r
- }\r
- if (key.equalsIgnoreCase("centrelabs"))\r
- {\r
- centerlab = Boolean.valueOf(value).booleanValue();\r
- }\r
- AlignmentAnnotation[] alr = al.getAlignmentAnnotation();\r
- if (alr != null)\r
- {\r
- for (int i = 0; i < alr.length; i++)\r
- {\r
- if (alr[i].label.equalsIgnoreCase(label))\r
- {\r
- alr[i].centreColLabels = centerlab;\r
- alr[i].scaleColLabel = scaletofit;\r
- alr[i].showAllColLabels = showalllabs;\r
- }\r
- }\r
- }\r
- }\r
- }\r
-\r
- void addProperties(AlignmentI al, StringTokenizer st)\r
- {\r
-\r
- // So far we have only added groups to the annotationHash,\r
- // the idea is in the future properties can be added to\r
- // alignments, other annotations etc\r
- if (al.getGroups() == null)\r
- {\r
- return;\r
- }\r
-\r
- String name = st.nextToken();\r
- SequenceGroup sg = null;\r
- for (SequenceGroup _sg : al.getGroups())\r
- {\r
- if ((sg = _sg).getName().equals(name))\r
- {\r
- break;\r
- }\r
- else\r
- {\r
- sg = null;\r
- }\r
- }\r
-\r
- if (sg != null)\r
- {\r
- String keyValue, key, value;\r
- ColourSchemeI def = sg.cs;\r
- sg.cs = null;\r
- while (st.hasMoreTokens())\r
- {\r
- keyValue = st.nextToken();\r
- key = keyValue.substring(0, keyValue.indexOf("="));\r
- value = keyValue.substring(keyValue.indexOf("=") + 1);\r
-\r
- if (key.equalsIgnoreCase("description"))\r
- {\r
- sg.setDescription(value);\r
- }\r
- else if (key.equalsIgnoreCase("colour"))\r
- {\r
- sg.cs = ColourSchemeProperty.getColour(al, value);\r
- }\r
- else if (key.equalsIgnoreCase("pidThreshold"))\r
- {\r
- sg.cs.setThreshold(Integer.parseInt(value), true);\r
-\r
- }\r
- else if (key.equalsIgnoreCase("consThreshold"))\r
- {\r
- sg.cs.setConservationInc(Integer.parseInt(value));\r
- Conservation c = new Conservation("Group",\r
- ResidueProperties.propHash, 3, sg.getSequences(null),\r
- sg.getStartRes(), sg.getEndRes() + 1);\r
-\r
- c.calculate();\r
- c.verdict(false, 25); // TODO: refer to conservation percent threshold\r
-\r
- sg.cs.setConservation(c);\r
-\r
- }\r
- else if (key.equalsIgnoreCase("outlineColour"))\r
- {\r
- sg.setOutlineColour(new UserColourScheme(value).findColour('A'));\r
- }\r
- else if (key.equalsIgnoreCase("displayBoxes"))\r
- {\r
- sg.setDisplayBoxes(Boolean.valueOf(value).booleanValue());\r
- }\r
- else if (key.equalsIgnoreCase("showUnconserved"))\r
- {\r
- sg.setShowNonconserved(Boolean.valueOf(value).booleanValue());\r
- }\r
- else if (key.equalsIgnoreCase("displayText"))\r
- {\r
- sg.setDisplayText(Boolean.valueOf(value).booleanValue());\r
- }\r
- else if (key.equalsIgnoreCase("colourText"))\r
- {\r
- sg.setColourText(Boolean.valueOf(value).booleanValue());\r
- }\r
- else if (key.equalsIgnoreCase("textCol1"))\r
- {\r
- sg.textColour = new UserColourScheme(value).findColour('A');\r
- }\r
- else if (key.equalsIgnoreCase("textCol2"))\r
- {\r
- sg.textColour2 = new UserColourScheme(value).findColour('A');\r
- }\r
- else if (key.equalsIgnoreCase("textColThreshold"))\r
- {\r
- sg.thresholdTextColour = Integer.parseInt(value);\r
- }\r
- else if (key.equalsIgnoreCase("idColour"))\r
- {\r
- // consider warning if colour doesn't resolve to a real colour\r
- sg.setIdColour((def = new UserColourScheme(value))\r
- .findColour('A'));\r
- }\r
- else if (key.equalsIgnoreCase("hide"))\r
- {\r
- // see bug https://mantis.lifesci.dundee.ac.uk/view.php?id=25847\r
- sg.setHidereps(true);\r
- }\r
- else if (key.equalsIgnoreCase("hidecols"))\r
- {\r
- // see bug https://mantis.lifesci.dundee.ac.uk/view.php?id=25847\r
- sg.setHideCols(true);\r
- }\r
- sg.recalcConservation();\r
- }\r
- if (sg.cs == null)\r
- {\r
- sg.cs = def;\r
- }\r
- }\r
- }\r
-\r
- void setBelowAlignment(AlignmentI al, StringTokenizer st)\r
- {\r
- String token;\r
- AlignmentAnnotation aa, ala[] = al.getAlignmentAnnotation();\r
- if (ala == null)\r
- {\r
- System.err\r
- .print("Warning - no annotation to set below for sequence associated annotation:");\r
- }\r
- while (st.hasMoreTokens())\r
- {\r
- token = st.nextToken();\r
- if (ala == null)\r
- {\r
- System.err.print(" " + token);\r
- }\r
- else\r
- {\r
- for (int i = 0; i < al.getAlignmentAnnotation().length; i++)\r
- {\r
- aa = al.getAlignmentAnnotation()[i];\r
- if (aa.sequenceRef == refSeq && aa.label.equals(token))\r
- {\r
- aa.belowAlignment = true;\r
- }\r
- }\r
- }\r
- }\r
- if (ala == null)\r
- {\r
- System.err.print("\n");\r
- }\r
- }\r
-\r
- void addAlignmentDetails(AlignmentI al, StringTokenizer st)\r
- {\r
- String keyValue, key, value;\r
- while (st.hasMoreTokens())\r
- {\r
- keyValue = st.nextToken();\r
- key = keyValue.substring(0, keyValue.indexOf("="));\r
- value = keyValue.substring(keyValue.indexOf("=") + 1);\r
- al.setProperty(key, value);\r
- }\r
- }\r
-\r
- /**\r
- * Write annotations as a CSV file of the form 'label, value, value, ...' for\r
- * each row.\r
- * \r
- * @param annotations\r
- * @return CSV file as a string.\r
- */\r
- public String printCSVAnnotations(AlignmentAnnotation[] annotations)\r
- {\r
- StringBuffer sp = new StringBuffer();\r
- for (int i = 0; i < annotations.length; i++)\r
- {\r
- String atos = annotations[i].toString();\r
- int p = 0;\r
- do\r
- {\r
- int cp = atos.indexOf("\n", p);\r
- sp.append(annotations[i].label);\r
- sp.append(",");\r
- if (cp > p)\r
- {\r
- sp.append(atos.substring(p, cp + 1));\r
- }\r
- else\r
- {\r
- sp.append(atos.substring(p));\r
- sp.append(newline);\r
- }\r
- p = cp + 1;\r
- } while (p > 0);\r
- }\r
- return sp.toString();\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.io;
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+
+import jalview.analysis.*;
+import jalview.datamodel.*;
+import jalview.schemes.*;
+
+public class AnnotationFile
+{
+ public AnnotationFile()
+ {
+ init();
+ }
+
+ /**
+ * character used to write newlines
+ */
+ protected String newline = System.getProperty("line.separator");
+
+ /**
+ * set new line string and reset the output buffer
+ *
+ * @param nl
+ */
+ public void setNewlineString(String nl)
+ {
+ newline = nl;
+ init();
+ }
+
+ public String getNewlineString()
+ {
+ return newline;
+ }
+
+ StringBuffer text;
+
+ private void init()
+ {
+ text = new StringBuffer("JALVIEW_ANNOTATION" + newline + "# Created: "
+ + new java.util.Date() + newline + newline);
+ refSeq = null;
+ refSeqId = null;
+ }
+
+ /**
+ * convenience method for pre-2.4 feature files which have no view, hidden
+ * columns or hidden row keywords.
+ *
+ * @param annotations
+ * @param list
+ * @param properties
+ * @return feature file as a string.
+ */
+ public String printAnnotations(AlignmentAnnotation[] annotations,
+ List<SequenceGroup> list, Hashtable properties)
+ {
+ return printAnnotations(annotations, list, properties, null);
+
+ }
+
+ /**
+ * hold all the information about a particular view definition read from or
+ * written out in an annotations file.
+ */
+ public class ViewDef
+ {
+ public String viewname;
+
+ public HiddenSequences hidseqs;
+
+ public ColumnSelection hiddencols;
+
+ public Vector visibleGroups;
+
+ public Hashtable hiddenRepSeqs;
+
+ public ViewDef(String viewname, HiddenSequences hidseqs,
+ ColumnSelection hiddencols, Hashtable hiddenRepSeqs)
+ {
+ this.viewname = viewname;
+ this.hidseqs = hidseqs;
+ this.hiddencols = hiddencols;
+ this.hiddenRepSeqs = hiddenRepSeqs;
+ }
+ }
+
+ /**
+ * Prepare an annotation file given a set of annotations, groups, alignment
+ * properties and views.
+ *
+ * @param annotations
+ * @param list
+ * @param properties
+ * @param views
+ * @return annotation file
+ */
+ public String printAnnotations(AlignmentAnnotation[] annotations,
+ List<SequenceGroup> list, Hashtable properties, ViewDef[] views)
+ {
+ // TODO: resolve views issue : annotationFile could contain visible region,
+ // or full data + hidden region specifications for a view.
+ if (annotations != null)
+ {
+ boolean oneColour = true;
+ AlignmentAnnotation row;
+ String comma;
+ SequenceI refSeq = null;
+ SequenceGroup refGroup = null;
+
+ StringBuffer colours = new StringBuffer();
+ StringBuffer graphLine = new StringBuffer();
+ StringBuffer rowprops = new StringBuffer();
+ Hashtable graphGroup = new Hashtable();
+
+ java.awt.Color color;
+
+ for (int i = 0; i < annotations.length; i++)
+ {
+ row = annotations[i];
+
+ if (!row.visible && !row.hasScore())
+ {
+ continue;
+ }
+
+ color = null;
+ oneColour = true;
+
+ if (row.sequenceRef == null)
+ {
+ if (refSeq != null)
+ {
+ text.append(newline);
+ text.append("SEQUENCE_REF\tALIGNMENT");
+ text.append(newline);
+ }
+
+ refSeq = null;
+ }
+
+ else
+ {
+ if (refSeq == null || refSeq != row.sequenceRef)
+ {
+ refSeq = row.sequenceRef;
+ text.append(newline);
+ text.append("SEQUENCE_REF\t");
+ text.append(refSeq.getName());
+ text.append(newline);
+ }
+ }
+ // mark any group references for the row
+ if (row.groupRef == null)
+ {
+
+ if (refGroup != null)
+ {
+ text.append(newline);
+ text.append("GROUP_REF\tALIGNMENT");
+ text.append(newline);
+ }
+
+ refGroup = null;
+ }
+ else
+ {
+ if (refGroup == null || refGroup != row.groupRef)
+ {
+ refGroup = row.groupRef;
+ text.append(newline);
+ text.append("GROUP_REF\t");
+ text.append(refGroup.getName());
+ text.append(newline);
+ }
+ }
+
+ boolean hasGlyphs = row.hasIcons, hasLabels = row.hasText, hasValues = row.hasScore, hasText = false;
+ // lookahead to check what the annotation row object actually contains.
+ for (int j = 0; row.annotations != null
+ && j < row.annotations.length
+ && (!hasGlyphs || !hasLabels || !hasValues); j++)
+ {
+ if (row.annotations[j] != null)
+ {
+ hasLabels |= (row.annotations[j].displayCharacter != null
+ && row.annotations[j].displayCharacter.length() > 0 && !row.annotations[j].displayCharacter
+ .equals(" "));
+ hasGlyphs |= (row.annotations[j].secondaryStructure != 0 && row.annotations[j].secondaryStructure != ' ');
+ hasValues |= (row.annotations[j].value != Float.NaN); // NaNs can't
+ // be
+ // rendered..
+ hasText |= (row.annotations[j].description != null && row.annotations[j].description
+ .length() > 0);
+ }
+ }
+
+ if (row.graph == AlignmentAnnotation.NO_GRAPH)
+ {
+ text.append("NO_GRAPH\t");
+ hasValues = false; // only secondary structure
+ // hasLabels = false; // and annotation description string.
+ }
+ else
+ {
+ if (row.graph == AlignmentAnnotation.BAR_GRAPH)
+ {
+ text.append("BAR_GRAPH\t");
+ hasGlyphs = false; // no secondary structure
+
+ }
+ else if (row.graph == AlignmentAnnotation.LINE_GRAPH)
+ {
+ hasGlyphs = false; // no secondary structure
+ text.append("LINE_GRAPH\t");
+ }
+
+ if (row.getThreshold() != null)
+ {
+ graphLine.append("GRAPHLINE\t");
+ graphLine.append(row.label);
+ graphLine.append("\t");
+ graphLine.append(row.getThreshold().value);
+ graphLine.append("\t");
+ graphLine.append(row.getThreshold().label);
+ graphLine.append("\t");
+ graphLine.append(jalview.util.Format.getHexString(row
+ .getThreshold().colour));
+ graphLine.append(newline);
+ }
+
+ if (row.graphGroup > -1)
+ {
+ String key = String.valueOf(row.graphGroup);
+ if (graphGroup.containsKey(key))
+ {
+ graphGroup.put(key, graphGroup.get(key) + "\t" + row.label);
+ }
+ else
+ {
+ graphGroup.put(key, row.label);
+ }
+ }
+ }
+
+ text.append(row.label + "\t");
+ if (row.description != null)
+ {
+ text.append(row.description + "\t");
+ }
+ for (int j = 0; row.annotations != null
+ && j < row.annotations.length; j++)
+ {
+ if (refSeq != null
+ && jalview.util.Comparison.isGap(refSeq.getCharAt(j)))
+ {
+ continue;
+ }
+
+ if (row.annotations[j] != null)
+ {
+ comma = "";
+ if (hasGlyphs) // could be also hasGlyphs || ...
+ {
+
+ text.append(comma);
+ if (row.annotations[j].secondaryStructure != ' ')
+ {
+ // only write out the field if its not whitespace.
+ text.append(row.annotations[j].secondaryStructure);
+ }
+ comma = ",";
+ }
+ if (hasValues)
+ {
+ if (row.annotations[j].value != Float.NaN)
+ {
+ text.append(comma + row.annotations[j].value);
+ }
+ else
+ {
+ System.err.println("Skipping NaN - not valid value.");
+ text.append(comma + 0f);// row.annotations[j].value);
+ }
+ comma = ",";
+ }
+ if (hasLabels)
+ {
+ // TODO: labels are emitted after values for bar graphs.
+ if // empty labels are allowed, so
+ (row.annotations[j].displayCharacter != null
+ && row.annotations[j].displayCharacter.length() > 0
+ && !row.annotations[j].displayCharacter.equals(" "))
+ {
+ text.append(comma + row.annotations[j].displayCharacter);
+ comma = ",";
+ }
+ }
+ if (hasText)
+ {
+ if (row.annotations[j].description != null
+ && row.annotations[j].description.length() > 0
+ && !row.annotations[j].description
+ .equals(row.annotations[j].displayCharacter))
+ {
+ text.append(comma + row.annotations[j].description);
+ comma = ",";
+ }
+ }
+ if (color != null && !color.equals(row.annotations[j].colour))
+ {
+ oneColour = false;
+ }
+
+ color = row.annotations[j].colour;
+
+ if (row.annotations[j].colour != null
+ && row.annotations[j].colour != java.awt.Color.black)
+ {
+ text.append(comma
+ + "["
+ + jalview.util.Format
+ .getHexString(row.annotations[j].colour)
+ + "]");
+ comma = ",";
+ }
+ }
+ text.append("|");
+ }
+
+ if (row.hasScore())
+ text.append("\t" + row.score);
+
+ text.append(newline);
+
+ if (color != null && color != java.awt.Color.black && oneColour)
+ {
+ colours.append("COLOUR\t");
+ colours.append(row.label);
+ colours.append("\t");
+ colours.append(jalview.util.Format.getHexString(color));
+ colours.append(newline);
+ }
+ if (row.scaleColLabel || row.showAllColLabels
+ || row.centreColLabels)
+ {
+ rowprops.append("ROWPROPERTIES\t");
+ rowprops.append(row.label);
+ rowprops.append("\tscaletofit=");
+ rowprops.append(row.scaleColLabel);
+ rowprops.append("\tshowalllabs=");
+ rowprops.append(row.showAllColLabels);
+ rowprops.append("\tcentrelabs=");
+ rowprops.append(row.centreColLabels);
+ rowprops.append(newline);
+ }
+ }
+
+ text.append(newline);
+
+ text.append(colours.toString());
+ text.append(graphLine.toString());
+ if (graphGroup.size() > 0)
+ {
+ text.append("COMBINE\t");
+ Enumeration en = graphGroup.elements();
+ while (en.hasMoreElements())
+ {
+ text.append(en.nextElement());
+ text.append(newline);
+ }
+ }
+ text.append(rowprops.toString());
+ }
+
+ if (list != null)
+ {
+ printGroups(list);
+ }
+
+ if (properties != null)
+ {
+ text.append(newline);
+ text.append(newline);
+ text.append("ALIGNMENT");
+ Enumeration en = properties.keys();
+ while (en.hasMoreElements())
+ {
+ String key = en.nextElement().toString();
+ text.append("\t");
+ text.append(key);
+ text.append("=");
+ text.append(properties.get(key));
+ }
+ // TODO: output alignment visualization settings here if required
+
+ }
+
+ return text.toString();
+ }
+
+ public void printGroups(List<SequenceGroup> list)
+ {
+ SequenceI seqrep = null;
+ for (SequenceGroup sg : list)
+ {
+ if (!sg.hasSeqrep())
+ {
+ text.append("SEQUENCE_GROUP\t" + sg.getName() + "\t"
+ + (sg.getStartRes() + 1) + "\t" + (sg.getEndRes() + 1)
+ + "\t" + "-1\t");
+ seqrep = null;
+ }
+ else
+ {
+ seqrep = sg.getSeqrep();
+ text.append("SEQUENCE_REF\t");
+ text.append(seqrep.getName());
+ text.append(newline);
+ text.append("SEQUENCE_GROUP\t");
+ text.append(sg.getName());
+ text.append("\t");
+ text.append((seqrep.findPosition(sg.getStartRes())));
+ text.append("\t");
+ text.append((seqrep.findPosition(sg.getEndRes())));
+ text.append("\t");
+ text.append("-1\t");
+ }
+ for (int s = 0; s < sg.getSize(); s++)
+ {
+ text.append(sg.getSequenceAt(s).getName());
+ text.append("\t");
+ }
+ text.append(newline);
+ text.append("PROPERTIES\t");
+ text.append(sg.getName());
+ text.append("\t");
+
+ if (sg.getDescription() != null)
+ {
+ text.append("description=");
+ text.append(sg.getDescription());
+ text.append("\t");
+ }
+ if (sg.cs != null)
+ {
+ text.append("colour=");
+ text.append(ColourSchemeProperty.getColourName(sg.cs));
+ text.append("\t");
+ if (sg.cs.getThreshold() != 0)
+ {
+ text.append("pidThreshold=");
+ text.append(sg.cs.getThreshold());
+ }
+ if (sg.cs.conservationApplied())
+ {
+ text.append("consThreshold=");
+ text.append(sg.cs.getConservationInc());
+ text.append("\t");
+ }
+ }
+ text.append("outlineColour=");
+ text.append(jalview.util.Format.getHexString(sg.getOutlineColour()));
+ text.append("\t");
+
+ text.append("displayBoxes=");
+ text.append(sg.getDisplayBoxes());
+ text.append("\t");
+ text.append("displayText=");
+ text.append(sg.getDisplayText());
+ text.append("\t");
+ text.append("colourText=");
+ text.append(sg.getColourText());
+ text.append("\t");
+ text.append("showUnconserved=");
+ text.append(sg.getShowNonconserved());
+ text.append("\t");
+ if (sg.textColour != java.awt.Color.black)
+ {
+ text.append("textCol1=");
+ text.append(jalview.util.Format.getHexString(sg.textColour));
+ text.append("\t");
+ }
+ if (sg.textColour2 != java.awt.Color.white)
+ {
+ text.append("textCol2=");
+ text.append(jalview.util.Format.getHexString(sg.textColour2));
+ text.append("\t");
+ }
+ if (sg.thresholdTextColour != 0)
+ {
+ text.append("textColThreshold=");
+ text.append(sg.thresholdTextColour);
+ text.append("\t");
+ }
+ if (sg.idColour != null)
+ {
+ text.append("idColour=");
+ text.append(jalview.util.Format.getHexString(sg.idColour));
+ text.append("\t");
+ }
+ if (sg.isHidereps())
+ {
+ text.append("hide=true\t");
+ }
+ if (sg.isHideCols())
+ {
+ text.append("hidecols=true\t");
+ }
+ if (seqrep != null)
+ {
+ // terminate the last line and clear the sequence ref for the group
+ text.append(newline);
+ text.append("SEQUENCE_REF");
+ }
+ text.append(newline);
+ text.append(newline);
+
+ }
+ }
+
+ SequenceI refSeq = null;
+
+ String refSeqId = null;
+
+ public boolean readAnnotationFile(AlignmentI al, String file,
+ String protocol)
+ {
+ BufferedReader in = null;
+ try
+ {
+ if (protocol.equals(AppletFormatAdapter.FILE))
+ {
+ in = new BufferedReader(new FileReader(file));
+ }
+ else if (protocol.equals(AppletFormatAdapter.URL))
+ {
+ URL url = new URL(file);
+ in = new BufferedReader(new InputStreamReader(url.openStream()));
+ }
+ else if (protocol.equals(AppletFormatAdapter.PASTE))
+ {
+ in = new BufferedReader(new StringReader(file));
+ }
+ else if (protocol.equals(AppletFormatAdapter.CLASSLOADER))
+ {
+ java.io.InputStream is = getClass().getResourceAsStream("/" + file);
+ if (is != null)
+ {
+ in = new BufferedReader(new java.io.InputStreamReader(is));
+ }
+ }
+ if (in != null)
+ {
+ return parseAnnotationFrom(al, in);
+ }
+
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ System.out.println("Problem reading annotation file: " + ex);
+ return false;
+ }
+ return false;
+ }
+
+ public boolean parseAnnotationFrom(AlignmentI al, BufferedReader in)
+ throws Exception
+ {
+ boolean modified = false;
+ String groupRef = null;
+ Hashtable groupRefRows = new Hashtable();
+
+ Hashtable autoAnnots = new Hashtable();
+ {
+ String line, label, description, token;
+ int graphStyle, index;
+ int refSeqIndex = 1;
+ int existingAnnotations = 0;
+ // when true - will add new rows regardless of whether they are duplicate
+ // auto-annotation like consensus or conservation graphs
+ boolean overrideAutoAnnot = false;
+ if (al.getAlignmentAnnotation() != null)
+ {
+ existingAnnotations = al.getAlignmentAnnotation().length;
+ if (existingAnnotations > 0)
+ {
+ AlignmentAnnotation[] aa = al.getAlignmentAnnotation();
+ for (int aai = 0; aai < aa.length; aai++)
+ {
+ if (aa[aai].autoCalculated)
+ {
+ // make a note of the name and description
+ autoAnnots.put(
+ autoAnnotsKey(aa[aai], aa[aai].sequenceRef,
+ (aa[aai].groupRef == null ? null
+ : aa[aai].groupRef.getName())),
+ new Integer(1));
+ }
+ }
+ }
+ }
+
+ int alWidth = al.getWidth();
+
+ StringTokenizer st;
+ Annotation[] annotations;
+ AlignmentAnnotation annotation = null;
+
+ // First confirm this is an Annotation file
+ boolean jvAnnotationFile = false;
+ while ((line = in.readLine()) != null)
+ {
+ if (line.indexOf("#") == 0)
+ {
+ continue;
+ }
+
+ if (line.indexOf("JALVIEW_ANNOTATION") > -1)
+ {
+ jvAnnotationFile = true;
+ break;
+ }
+ }
+
+ if (!jvAnnotationFile)
+ {
+ in.close();
+ return false;
+ }
+
+ while ((line = in.readLine()) != null)
+ {
+ if (line.indexOf("#") == 0
+ || line.indexOf("JALVIEW_ANNOTATION") > -1
+ || line.length() == 0)
+ {
+ continue;
+ }
+
+ st = new StringTokenizer(line, "\t");
+ token = st.nextToken();
+ if (token.equalsIgnoreCase("COLOUR"))
+ {
+ // TODO: use graduated colour def'n here too
+ colourAnnotations(al, st.nextToken(), st.nextToken());
+ modified = true;
+ continue;
+ }
+
+ else if (token.equalsIgnoreCase("COMBINE"))
+ {
+ combineAnnotations(al, st);
+ modified = true;
+ continue;
+ }
+ else if (token.equalsIgnoreCase("ROWPROPERTIES"))
+ {
+ addRowProperties(al, st);
+ modified = true;
+ continue;
+ }
+ else if (token.equalsIgnoreCase("GRAPHLINE"))
+ {
+ addLine(al, st);
+ modified = true;
+ continue;
+ }
+
+ else if (token.equalsIgnoreCase("SEQUENCE_REF"))
+ {
+ if (st.hasMoreTokens())
+ {
+ refSeq = al.findName(refSeqId = st.nextToken());
+ if (refSeq == null)
+ {
+ refSeqId = null;
+ }
+ try
+ {
+ refSeqIndex = Integer.parseInt(st.nextToken());
+ if (refSeqIndex < 1)
+ {
+ refSeqIndex = 1;
+ System.out
+ .println("WARNING: SEQUENCE_REF index must be > 0 in AnnotationFile");
+ }
+ } catch (Exception ex)
+ {
+ refSeqIndex = 1;
+ }
+ }
+ else
+ {
+ refSeq = null;
+ refSeqId = null;
+ }
+ continue;
+ }
+ else if (token.equalsIgnoreCase("GROUP_REF"))
+ {
+ // Group references could be forward or backwards, so they are
+ // resolved after the whole file is read in
+ groupRef = null;
+ if (st.hasMoreTokens())
+ {
+ groupRef = st.nextToken();
+ if (groupRef.length() < 1)
+ {
+ groupRef = null; // empty string
+ }
+ else
+ {
+ if (groupRefRows.get(groupRef) == null)
+ {
+ groupRefRows.put(groupRef, new Vector());
+ }
+ }
+ }
+ continue;
+ }
+ else if (token.equalsIgnoreCase("SEQUENCE_GROUP"))
+ {
+ addGroup(al, st);
+ continue;
+ }
+
+ else if (token.equalsIgnoreCase("PROPERTIES"))
+ {
+ addProperties(al, st);
+ modified = true;
+ continue;
+ }
+
+ else if (token.equalsIgnoreCase("BELOW_ALIGNMENT"))
+ {
+ setBelowAlignment(al, st);
+ modified = true;
+ continue;
+ }
+ else if (token.equalsIgnoreCase("ALIGNMENT"))
+ {
+ addAlignmentDetails(al, st);
+ modified = true;
+ continue;
+ }
+
+ // Parse out the annotation row
+ graphStyle = AlignmentAnnotation.getGraphValueFromString(token);
+ label = st.nextToken();
+
+ index = 0;
+ annotations = new Annotation[alWidth];
+ description = null;
+ float score = Float.NaN;
+
+ if (st.hasMoreTokens())
+ {
+ line = st.nextToken();
+
+ if (line.indexOf("|") == -1)
+ {
+ description = line;
+ if (st.hasMoreTokens())
+ line = st.nextToken();
+ }
+
+ if (st.hasMoreTokens())
+ {
+ // This must be the score
+ score = Float.valueOf(st.nextToken()).floatValue();
+ }
+
+ st = new StringTokenizer(line, "|", true);
+
+ boolean emptyColumn = true;
+ boolean onlyOneElement = (st.countTokens() == 1);
+
+ while (st.hasMoreElements() && index < alWidth)
+ {
+ token = st.nextToken().trim();
+
+ if (onlyOneElement)
+ {
+ try
+ {
+ score = Float.valueOf(token).floatValue();
+ break;
+ } catch (NumberFormatException ex)
+ {
+ }
+ }
+
+ if (token.equals("|"))
+ {
+ if (emptyColumn)
+ {
+ index++;
+ }
+
+ emptyColumn = true;
+ }
+ else
+ {
+ annotations[index++] = parseAnnotation(token, graphStyle);
+ emptyColumn = false;
+ }
+ }
+
+ }
+
+ annotation = new AlignmentAnnotation(label, description,
+ (index == 0) ? null : annotations, 0, 0, graphStyle);
+
+ annotation.score = score;
+ if (!overrideAutoAnnot
+ && autoAnnots.containsKey(autoAnnotsKey(annotation, refSeq,
+ groupRef)))
+ {
+ // skip - we've already got an automatic annotation of this type.
+ continue;
+ }
+ // otherwise add it!
+ if (refSeq != null)
+ {
+
+ annotation.belowAlignment = false;
+ // make a copy of refSeq so we can find other matches in the alignment
+ SequenceI referedSeq = refSeq;
+ do
+ {
+ // copy before we do any mapping business.
+ // TODO: verify that undo/redo with 1:many sequence associated
+ // annotations can be undone correctly
+ AlignmentAnnotation ann = new AlignmentAnnotation(annotation);
+ annotation
+ .createSequenceMapping(referedSeq, refSeqIndex, false);
+ annotation.adjustForAlignment();
+ referedSeq.addAlignmentAnnotation(annotation);
+ al.addAnnotation(annotation);
+ al.setAnnotationIndex(annotation,
+ al.getAlignmentAnnotation().length
+ - existingAnnotations - 1);
+ if (groupRef != null)
+ {
+ ((Vector) groupRefRows.get(groupRef)).addElement(annotation);
+ }
+ // and recover our virgin copy to use again if necessary.
+ annotation = ann;
+
+ } while (refSeqId != null
+ && (referedSeq = al.findName(referedSeq, refSeqId, true)) != null);
+ }
+ else
+ {
+ al.addAnnotation(annotation);
+ al.setAnnotationIndex(annotation,
+ al.getAlignmentAnnotation().length - existingAnnotations
+ - 1);
+ if (groupRef != null)
+ {
+ ((Vector) groupRefRows.get(groupRef)).addElement(annotation);
+ }
+ }
+ // and set modification flag
+ modified = true;
+ }
+ // Finally, resolve the groupRefs
+ Enumeration en = groupRefRows.keys();
+
+ while (en.hasMoreElements())
+ {
+ groupRef = (String) en.nextElement();
+ boolean matched = false;
+ // Resolve group: TODO: add a getGroupByName method to alignments
+ for (SequenceGroup theGroup : al.getGroups())
+ {
+ if (theGroup.getName().equals(groupRef))
+ {
+ if (matched)
+ {
+ // TODO: specify and implement duplication of alignment annotation
+ // for multiple group references.
+ System.err
+ .println("Ignoring 1:many group reference mappings for group name '"
+ + groupRef + "'");
+ }
+ else
+ {
+ matched = true;
+ Vector rowset = (Vector) groupRefRows.get(groupRef);
+ if (rowset != null && rowset.size() > 0)
+ {
+ AlignmentAnnotation alan = null;
+ for (int elm = 0, elmSize = rowset.size(); elm < elmSize; elm++)
+ {
+ alan = (AlignmentAnnotation) rowset.elementAt(elm);
+ alan.groupRef = theGroup;
+ }
+ }
+ }
+ }
+ }
+ ((Vector) groupRefRows.get(groupRef)).removeAllElements();
+ }
+ }
+ return modified;
+ }
+
+ private Object autoAnnotsKey(AlignmentAnnotation annotation,
+ SequenceI refSeq, String groupRef)
+ {
+ return annotation.graph + "\t" + annotation.label + "\t"
+ + annotation.description + "\t"
+ + (refSeq != null ? refSeq.getDisplayId(true) : "");
+ }
+
+ Annotation parseAnnotation(String string, int graphStyle)
+ {
+ boolean hasSymbols = (graphStyle == AlignmentAnnotation.NO_GRAPH); // don't
+ // do the
+ // glyph
+ // test
+ // if we
+ // don't
+ // want
+ // secondary
+ // structure
+ String desc = null, displayChar = null;
+ char ss = ' '; // secondaryStructure
+ float value = 0;
+ boolean parsedValue = false, dcset = false;
+
+ // find colour here
+ java.awt.Color colour = null;
+ int i = string.indexOf("[");
+ int j = string.indexOf("]");
+ if (i > -1 && j > -1)
+ {
+ UserColourScheme ucs = new UserColourScheme();
+
+ colour = ucs.getColourFromString(string.substring(i + 1, j));
+ if (i > 0 && string.charAt(i - 1) == ',')
+ {
+ // clip the preceding comma as well
+ i--;
+ }
+ string = string.substring(0, i) + string.substring(j + 1);
+ }
+
+ StringTokenizer st = new StringTokenizer(string, ",", true);
+ String token;
+ boolean seenContent = false;
+ int pass = 0;
+ while (st.hasMoreTokens())
+ {
+ pass++;
+ token = st.nextToken().trim();
+ if (token.equals(","))
+ {
+ if (!seenContent && parsedValue && !dcset)
+ {
+ // allow the value below the bar/line to be empty
+ dcset = true;
+ displayChar = " ";
+ }
+ seenContent = false;
+ continue;
+ }
+ else
+ {
+ seenContent = true;
+ }
+
+ if (!parsedValue)
+ {
+ try
+ {
+ displayChar = token;
+ // foo
+ value = new Float(token).floatValue();
+ parsedValue = true;
+ continue;
+ } catch (NumberFormatException ex)
+ {
+ }
+ }
+ else
+ {
+ if (token.length() == 1)
+ {
+ displayChar = token;
+ }
+ }
+ if (hasSymbols
+ && (token.equals("H") || token.equals("E")
+ || token.equals("S") || token.equals(" ")))
+ {
+ // Either this character represents a helix or sheet
+ // or an integer which can be displayed
+ ss = token.charAt(0);
+ if (displayChar.equals(token.substring(0, 1)))
+ {
+ displayChar = "";
+ }
+ }
+ else if (desc == null || (parsedValue && pass > 2))
+ {
+ desc = token;
+ }
+
+ }
+ // if (!dcset && string.charAt(string.length() - 1) == ',')
+ // {
+ // displayChar = " "; // empty display char symbol.
+ // }
+ if (displayChar != null && desc != null && desc.length() == 1)
+ {
+ if (displayChar.length() > 1)
+ {
+ // switch desc and displayChar - legacy support
+ String tmp = displayChar;
+ displayChar = desc;
+ desc = tmp;
+ }
+ else
+ {
+ if (displayChar.equals(desc))
+ {
+ // duplicate label - hangover from the 'robust parser' above
+ desc = null;
+ }
+ }
+ }
+ Annotation anot = new Annotation(displayChar, desc, ss, value);
+
+ anot.colour = colour;
+
+ return anot;
+ }
+
+ void colourAnnotations(AlignmentI al, String label, String colour)
+ {
+ UserColourScheme ucs = new UserColourScheme(colour);
+ Annotation[] annotations;
+ for (int i = 0; i < al.getAlignmentAnnotation().length; i++)
+ {
+ if (al.getAlignmentAnnotation()[i].label.equalsIgnoreCase(label))
+ {
+ annotations = al.getAlignmentAnnotation()[i].annotations;
+ for (int j = 0; j < annotations.length; j++)
+ {
+ if (annotations[j] != null)
+ {
+ annotations[j].colour = ucs.findColour('A');
+ }
+ }
+ }
+ }
+ }
+
+ void combineAnnotations(AlignmentI al, StringTokenizer st)
+ {
+ int graphGroup = -1;
+ String group = st.nextToken();
+ // First make sure we are not overwriting the graphIndex
+ if (al.getAlignmentAnnotation() != null)
+ {
+ for (int i = 0; i < al.getAlignmentAnnotation().length; i++)
+ {
+ if (al.getAlignmentAnnotation()[i].label.equalsIgnoreCase(group))
+ {
+ graphGroup = al.getAlignmentAnnotation()[i].graphGroup + 1;
+ al.getAlignmentAnnotation()[i].graphGroup = graphGroup;
+ break;
+ }
+ }
+
+ // Now update groups
+ while (st.hasMoreTokens())
+ {
+ group = st.nextToken();
+ for (int i = 0; i < al.getAlignmentAnnotation().length; i++)
+ {
+ if (al.getAlignmentAnnotation()[i].label.equalsIgnoreCase(group))
+ {
+ al.getAlignmentAnnotation()[i].graphGroup = graphGroup;
+ break;
+ }
+ }
+ }
+ }
+ else
+ {
+ System.err
+ .println("Couldn't combine annotations. None are added to alignment yet!");
+ }
+ }
+
+ void addLine(AlignmentI al, StringTokenizer st)
+ {
+ String group = st.nextToken();
+ AlignmentAnnotation annotation = null, alannot[] = al
+ .getAlignmentAnnotation();
+ if (alannot != null)
+ {
+ for (int i = 0; i < alannot.length; i++)
+ {
+ if (alannot[i].label.equalsIgnoreCase(group))
+ {
+ annotation = alannot[i];
+ break;
+ }
+ }
+ }
+ if (annotation == null)
+ {
+ return;
+ }
+ float value = new Float(st.nextToken()).floatValue();
+ String label = st.hasMoreTokens() ? st.nextToken() : null;
+ java.awt.Color colour = null;
+ if (st.hasMoreTokens())
+ {
+ UserColourScheme ucs = new UserColourScheme(st.nextToken());
+ colour = ucs.findColour('A');
+ }
+
+ annotation.setThreshold(new GraphLine(value, label, colour));
+ }
+
+ void addGroup(AlignmentI al, StringTokenizer st)
+ {
+ SequenceGroup sg = new SequenceGroup();
+ sg.setName(st.nextToken());
+ String rng = "";
+ try
+ {
+ rng = st.nextToken();
+ if (rng.length() > 0 && !rng.startsWith("*"))
+ {
+ sg.setStartRes(Integer.parseInt(rng) - 1);
+ }
+ else
+ {
+ sg.setStartRes(0);
+ }
+ rng = st.nextToken();
+ if (rng.length() > 0 && !rng.startsWith("*"))
+ {
+ sg.setEndRes(Integer.parseInt(rng) - 1);
+ }
+ else
+ {
+ sg.setEndRes(al.getWidth() - 1);
+ }
+ } catch (Exception e)
+ {
+ System.err
+ .println("Couldn't parse Group Start or End Field as '*' or a valid column or sequence index: '"
+ + rng + "' - assuming alignment width for group.");
+ // assume group is full width
+ sg.setStartRes(0);
+ sg.setEndRes(al.getWidth() - 1);
+ }
+
+ String index = st.nextToken();
+ if (index.equals("-1"))
+ {
+ while (st.hasMoreElements())
+ {
+ sg.addSequence(al.findName(st.nextToken()), false);
+ }
+ }
+ else
+ {
+ StringTokenizer st2 = new StringTokenizer(index, ",");
+
+ while (st2.hasMoreTokens())
+ {
+ String tmp = st2.nextToken();
+ if (tmp.equals("*"))
+ {
+ for (int i = 0; i < al.getHeight(); i++)
+ {
+ sg.addSequence(al.getSequenceAt(i), false);
+ }
+ }
+ else if (tmp.indexOf("-") >= 0)
+ {
+ StringTokenizer st3 = new StringTokenizer(tmp, "-");
+
+ int start = (Integer.parseInt(st3.nextToken()));
+ int end = (Integer.parseInt(st3.nextToken()));
+
+ if (end > start)
+ {
+ for (int i = start; i <= end; i++)
+ {
+ sg.addSequence(al.getSequenceAt(i - 1), false);
+ }
+ }
+ }
+ else
+ {
+ sg.addSequence(al.getSequenceAt(Integer.parseInt(tmp) - 1), false);
+ }
+ }
+ }
+
+ if (refSeq != null)
+ {
+ sg.setStartRes(refSeq.findIndex(sg.getStartRes() + 1) - 1);
+ sg.setEndRes(refSeq.findIndex(sg.getEndRes() + 1) - 1);
+ sg.setSeqrep(refSeq);
+ }
+
+ if (sg.getSize() > 0)
+ {
+ al.addGroup(sg);
+ }
+ }
+
+ void addRowProperties(AlignmentI al, StringTokenizer st)
+ {
+ String label = st.nextToken(), keyValue, key, value;
+ boolean scaletofit = false, centerlab = false, showalllabs = false;
+ while (st.hasMoreTokens())
+ {
+ keyValue = st.nextToken();
+ key = keyValue.substring(0, keyValue.indexOf("="));
+ value = keyValue.substring(keyValue.indexOf("=") + 1);
+ if (key.equalsIgnoreCase("scaletofit"))
+ {
+ scaletofit = Boolean.valueOf(value).booleanValue();
+ }
+ if (key.equalsIgnoreCase("showalllabs"))
+ {
+ showalllabs = Boolean.valueOf(value).booleanValue();
+ }
+ if (key.equalsIgnoreCase("centrelabs"))
+ {
+ centerlab = Boolean.valueOf(value).booleanValue();
+ }
+ AlignmentAnnotation[] alr = al.getAlignmentAnnotation();
+ if (alr != null)
+ {
+ for (int i = 0; i < alr.length; i++)
+ {
+ if (alr[i].label.equalsIgnoreCase(label))
+ {
+ alr[i].centreColLabels = centerlab;
+ alr[i].scaleColLabel = scaletofit;
+ alr[i].showAllColLabels = showalllabs;
+ }
+ }
+ }
+ }
+ }
+
+ void addProperties(AlignmentI al, StringTokenizer st)
+ {
+
+ // So far we have only added groups to the annotationHash,
+ // the idea is in the future properties can be added to
+ // alignments, other annotations etc
+ if (al.getGroups() == null)
+ {
+ return;
+ }
+
+ String name = st.nextToken();
+ SequenceGroup sg = null;
+ for (SequenceGroup _sg : al.getGroups())
+ {
+ if ((sg = _sg).getName().equals(name))
+ {
+ break;
+ }
+ else
+ {
+ sg = null;
+ }
+ }
+
+ if (sg != null)
+ {
+ String keyValue, key, value;
+ ColourSchemeI def = sg.cs;
+ sg.cs = null;
+ while (st.hasMoreTokens())
+ {
+ keyValue = st.nextToken();
+ key = keyValue.substring(0, keyValue.indexOf("="));
+ value = keyValue.substring(keyValue.indexOf("=") + 1);
+
+ if (key.equalsIgnoreCase("description"))
+ {
+ sg.setDescription(value);
+ }
+ else if (key.equalsIgnoreCase("colour"))
+ {
+ sg.cs = ColourSchemeProperty.getColour(al, value);
+ }
+ else if (key.equalsIgnoreCase("pidThreshold"))
+ {
+ sg.cs.setThreshold(Integer.parseInt(value), true);
+
+ }
+ else if (key.equalsIgnoreCase("consThreshold"))
+ {
+ sg.cs.setConservationInc(Integer.parseInt(value));
+ Conservation c = new Conservation("Group",
+ ResidueProperties.propHash, 3, sg.getSequences(null),
+ sg.getStartRes(), sg.getEndRes() + 1);
+
+ c.calculate();
+ c.verdict(false, 25); // TODO: refer to conservation percent threshold
+
+ sg.cs.setConservation(c);
+
+ }
+ else if (key.equalsIgnoreCase("outlineColour"))
+ {
+ sg.setOutlineColour(new UserColourScheme(value).findColour('A'));
+ }
+ else if (key.equalsIgnoreCase("displayBoxes"))
+ {
+ sg.setDisplayBoxes(Boolean.valueOf(value).booleanValue());
+ }
+ else if (key.equalsIgnoreCase("showUnconserved"))
+ {
+ sg.setShowNonconserved(Boolean.valueOf(value).booleanValue());
+ }
+ else if (key.equalsIgnoreCase("displayText"))
+ {
+ sg.setDisplayText(Boolean.valueOf(value).booleanValue());
+ }
+ else if (key.equalsIgnoreCase("colourText"))
+ {
+ sg.setColourText(Boolean.valueOf(value).booleanValue());
+ }
+ else if (key.equalsIgnoreCase("textCol1"))
+ {
+ sg.textColour = new UserColourScheme(value).findColour('A');
+ }
+ else if (key.equalsIgnoreCase("textCol2"))
+ {
+ sg.textColour2 = new UserColourScheme(value).findColour('A');
+ }
+ else if (key.equalsIgnoreCase("textColThreshold"))
+ {
+ sg.thresholdTextColour = Integer.parseInt(value);
+ }
+ else if (key.equalsIgnoreCase("idColour"))
+ {
+ // consider warning if colour doesn't resolve to a real colour
+ sg.setIdColour((def = new UserColourScheme(value))
+ .findColour('A'));
+ }
+ else if (key.equalsIgnoreCase("hide"))
+ {
+ // see bug https://mantis.lifesci.dundee.ac.uk/view.php?id=25847
+ sg.setHidereps(true);
+ }
+ else if (key.equalsIgnoreCase("hidecols"))
+ {
+ // see bug https://mantis.lifesci.dundee.ac.uk/view.php?id=25847
+ sg.setHideCols(true);
+ }
+ sg.recalcConservation();
+ }
+ if (sg.cs == null)
+ {
+ sg.cs = def;
+ }
+ }
+ }
+
+ void setBelowAlignment(AlignmentI al, StringTokenizer st)
+ {
+ String token;
+ AlignmentAnnotation aa, ala[] = al.getAlignmentAnnotation();
+ if (ala == null)
+ {
+ System.err
+ .print("Warning - no annotation to set below for sequence associated annotation:");
+ }
+ while (st.hasMoreTokens())
+ {
+ token = st.nextToken();
+ if (ala == null)
+ {
+ System.err.print(" " + token);
+ }
+ else
+ {
+ for (int i = 0; i < al.getAlignmentAnnotation().length; i++)
+ {
+ aa = al.getAlignmentAnnotation()[i];
+ if (aa.sequenceRef == refSeq && aa.label.equals(token))
+ {
+ aa.belowAlignment = true;
+ }
+ }
+ }
+ }
+ if (ala == null)
+ {
+ System.err.print("\n");
+ }
+ }
+
+ void addAlignmentDetails(AlignmentI al, StringTokenizer st)
+ {
+ String keyValue, key, value;
+ while (st.hasMoreTokens())
+ {
+ keyValue = st.nextToken();
+ key = keyValue.substring(0, keyValue.indexOf("="));
+ value = keyValue.substring(keyValue.indexOf("=") + 1);
+ al.setProperty(key, value);
+ }
+ }
+
+ /**
+ * Write annotations as a CSV file of the form 'label, value, value, ...' for
+ * each row.
+ *
+ * @param annotations
+ * @return CSV file as a string.
+ */
+ public String printCSVAnnotations(AlignmentAnnotation[] annotations)
+ {
+ StringBuffer sp = new StringBuffer();
+ for (int i = 0; i < annotations.length; i++)
+ {
+ String atos = annotations[i].toString();
+ int p = 0;
+ do
+ {
+ int cp = atos.indexOf("\n", p);
+ sp.append(annotations[i].label);
+ sp.append(",");
+ if (cp > p)
+ {
+ sp.append(atos.substring(p, cp + 1));
+ }
+ else
+ {
+ sp.append(atos.substring(p));
+ sp.append(newline);
+ }
+ p = cp + 1;
+ } while (p > 0);
+ }
+ return sp.toString();
+ }
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.io;\r
-\r
-/**\r
- * Read or write a CLANS style score matrix file.\r
- */\r
-\r
-public class ClansFile extends FileParse\r
-{\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.io;
+
+/**
+ * Read or write a CLANS style score matrix file.
+ */
+
+public class ClansFile extends FileParse
+{
+
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.io;\r
-\r
-import java.io.IOException;\r
-\r
-/**\r
- * jalview flatfile for io of sequence ID mapping data\r
- * DATABASE\t<nickname>\t<name>\t<version>... properties?jdbc, url, handler\r
- * DBREF\r
- * <seqID>\tDBID\taccno\t|seqstart,seqend,start,end...|\t|dbstart,dbend,...|\r
- * \r
- */\r
-public class DBRefFile extends AlignFile\r
-{\r
-\r
- public void parse() throws IOException\r
- {\r
- // TODO Auto-generated method stub\r
-\r
- }\r
-\r
- public String print()\r
- {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.io;
+
+import java.io.IOException;
+
+/**
+ * jalview flatfile for io of sequence ID mapping data
+ * DATABASE\t<nickname>\t<name>\t<version>... properties?jdbc, url, handler
+ * DBREF
+ * <seqID>\tDBID\taccno\t|seqstart,seqend,start,end...|\t|dbstart,dbend,...|
+ *
+ */
+public class DBRefFile extends AlignFile
+{
+
+ public void parse() throws IOException
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public String print()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.io;\r
-\r
-import java.io.*;\r
-import java.util.*;\r
-\r
-import jalview.analysis.SequenceIdMatcher;\r
-import jalview.datamodel.*;\r
-import jalview.schemes.*;\r
-import jalview.util.Format;\r
-\r
-/**\r
- * Parse and create Jalview Features files Detects GFF format features files and\r
- * parses. Does not implement standard print() - call specific printFeatures or\r
- * printGFF. Uses AlignmentI.findSequence(String id) to find the sequence object\r
- * for the features annotation - this normally works on an exact match.\r
- * \r
- * @author AMW\r
- * @version $Revision$\r
- */\r
-public class FeaturesFile extends AlignFile\r
-{\r
- /**\r
- * work around for GFF interpretation bug where source string becomes\r
- * description rather than a group\r
- */\r
- private boolean doGffSource = true;\r
-\r
- /**\r
- * Creates a new FeaturesFile object.\r
- */\r
- public FeaturesFile()\r
- {\r
- }\r
-\r
- /**\r
- * Creates a new FeaturesFile object.\r
- * \r
- * @param inFile\r
- * DOCUMENT ME!\r
- * @param type\r
- * DOCUMENT ME!\r
- * \r
- * @throws IOException\r
- * DOCUMENT ME!\r
- */\r
- public FeaturesFile(String inFile, String type) throws IOException\r
- {\r
- super(inFile, type);\r
- }\r
-\r
- public FeaturesFile(FileParse source) throws IOException\r
- {\r
- super(source);\r
- }\r
-\r
- /**\r
- * Parse GFF or sequence features file using case-independent matching,\r
- * discarding URLs\r
- * \r
- * @param align\r
- * - alignment/dataset containing sequences that are to be annotated\r
- * @param colours\r
- * - hashtable to store feature colour definitions\r
- * @param removeHTML\r
- * - process html strings into plain text\r
- * @return true if features were added\r
- */\r
- public boolean parse(AlignmentI align, Hashtable colours,\r
- boolean removeHTML)\r
- {\r
- return parse(align, colours, null, removeHTML, false);\r
- }\r
-\r
- /**\r
- * Parse GFF or sequence features file optionally using case-independent\r
- * matching, discarding URLs\r
- * \r
- * @param align\r
- * - alignment/dataset containing sequences that are to be annotated\r
- * @param colours\r
- * - hashtable to store feature colour definitions\r
- * @param removeHTML\r
- * - process html strings into plain text\r
- * @param relaxedIdmatching\r
- * - when true, ID matches to compound sequence IDs are allowed\r
- * @return true if features were added\r
- */\r
- public boolean parse(AlignmentI align, Map colours, boolean removeHTML,\r
- boolean relaxedIdMatching)\r
- {\r
- return parse(align, colours, null, removeHTML, relaxedIdMatching);\r
- }\r
-\r
- /**\r
- * Parse GFF or sequence features file optionally using case-independent\r
- * matching\r
- * \r
- * @param align\r
- * - alignment/dataset containing sequences that are to be annotated\r
- * @param colours\r
- * - hashtable to store feature colour definitions\r
- * @param featureLink\r
- * - hashtable to store associated URLs\r
- * @param removeHTML\r
- * - process html strings into plain text\r
- * @return true if features were added\r
- */\r
- public boolean parse(AlignmentI align, Map colours, Map featureLink,\r
- boolean removeHTML)\r
- {\r
- return parse(align, colours, featureLink, removeHTML, false);\r
- }\r
-\r
- /**\r
- * /** Parse GFF or sequence features file\r
- * \r
- * @param align\r
- * - alignment/dataset containing sequences that are to be annotated\r
- * @param colours\r
- * - hashtable to store feature colour definitions\r
- * @param featureLink\r
- * - hashtable to store associated URLs\r
- * @param removeHTML\r
- * - process html strings into plain text\r
- * @param relaxedIdmatching\r
- * - when true, ID matches to compound sequence IDs are allowed\r
- * @return true if features were added\r
- */\r
- public boolean parse(AlignmentI align, Map colours, Map featureLink,\r
- boolean removeHTML, boolean relaxedIdmatching)\r
- {\r
-\r
- String line = null;\r
- try\r
- {\r
- SequenceI seq = null;\r
- String type, desc, token = null;\r
-\r
- int index, start, end;\r
- float score;\r
- StringTokenizer st;\r
- SequenceFeature sf;\r
- String featureGroup = null, groupLink = null;\r
- Map typeLink = new Hashtable();\r
- /**\r
- * when true, assume GFF style features rather than Jalview style.\r
- */\r
- boolean GFFFile = true;\r
- while ((line = nextLine()) != null)\r
- {\r
- if (line.startsWith("#"))\r
- {\r
- continue;\r
- }\r
-\r
- st = new StringTokenizer(line, "\t");\r
- if (st.countTokens() == 1)\r
- {\r
- if (line.trim().equalsIgnoreCase("GFF"))\r
- {\r
- // Start parsing file as if it might be GFF again.\r
- GFFFile = true;\r
- continue;\r
- }\r
- }\r
- if (st.countTokens() > 1 && st.countTokens() < 4)\r
- {\r
- GFFFile = false;\r
- type = st.nextToken();\r
- if (type.equalsIgnoreCase("startgroup"))\r
- {\r
- featureGroup = st.nextToken();\r
- if (st.hasMoreElements())\r
- {\r
- groupLink = st.nextToken();\r
- featureLink.put(featureGroup, groupLink);\r
- }\r
- }\r
- else if (type.equalsIgnoreCase("endgroup"))\r
- {\r
- // We should check whether this is the current group,\r
- // but at present theres no way of showing more than 1 group\r
- st.nextToken();\r
- featureGroup = null;\r
- groupLink = null;\r
- }\r
- else\r
- {\r
- Object colour = null;\r
- String colscheme = st.nextToken();\r
- if (colscheme.indexOf("|") > -1\r
- || colscheme.trim().equalsIgnoreCase("label"))\r
- {\r
- // Parse '|' separated graduated colourscheme fields:\r
- // [label|][mincolour|maxcolour|[absolute|]minvalue|maxvalue|thresholdtype|thresholdvalue]\r
- // can either provide 'label' only, first is optional, next two\r
- // colors are required (but may be\r
- // left blank), next is optional, nxt two min/max are required.\r
- // first is either 'label'\r
- // first/second and third are both hexadecimal or word equivalent\r
- // colour.\r
- // next two are values parsed as floats.\r
- // fifth is either 'above','below', or 'none'.\r
- // sixth is a float value and only required when fifth is either\r
- // 'above' or 'below'.\r
- StringTokenizer gcol = new StringTokenizer(colscheme, "|",\r
- true);\r
- // set defaults\r
- int threshtype = AnnotationColourGradient.NO_THRESHOLD;\r
- float min = Float.MIN_VALUE, max = Float.MAX_VALUE, threshval = Float.NaN;\r
- boolean labelCol = false;\r
- // Parse spec line\r
- String mincol = gcol.nextToken();\r
- if (mincol == "|")\r
- {\r
- System.err\r
- .println("Expected either 'label' or a colour specification in the line: "\r
- + line);\r
- continue;\r
- }\r
- String maxcol = null;\r
- if (mincol.toLowerCase().indexOf("label") == 0)\r
- {\r
- labelCol = true;\r
- mincol = (gcol.hasMoreTokens() ? gcol.nextToken() : null); // skip\r
- // '|'\r
- mincol = (gcol.hasMoreTokens() ? gcol.nextToken() : null);\r
- }\r
- String abso = null, minval, maxval;\r
- if (mincol != null)\r
- {\r
- // at least four more tokens\r
- if (mincol.equals("|"))\r
- {\r
- mincol = "";\r
- }\r
- else\r
- {\r
- gcol.nextToken(); // skip next '|'\r
- }\r
- // continue parsing rest of line\r
- maxcol = gcol.nextToken();\r
- if (maxcol.equals("|"))\r
- {\r
- maxcol = "";\r
- }\r
- else\r
- {\r
- gcol.nextToken(); // skip next '|'\r
- }\r
- abso = gcol.nextToken();\r
- gcol.nextToken(); // skip next '|'\r
- if (abso.toLowerCase().indexOf("abso") != 0)\r
- {\r
- minval = abso;\r
- abso = null;\r
- }\r
- else\r
- {\r
- minval = gcol.nextToken();\r
- gcol.nextToken(); // skip next '|'\r
- }\r
- maxval = gcol.nextToken();\r
- if (gcol.hasMoreTokens())\r
- {\r
- gcol.nextToken(); // skip next '|'\r
- }\r
- try\r
- {\r
- if (minval.length() > 0)\r
- {\r
- min = new Float(minval).floatValue();\r
- }\r
- } catch (Exception e)\r
- {\r
- System.err\r
- .println("Couldn't parse the minimum value for graduated colour for type ("\r
- + colscheme\r
- + ") - did you misspell 'auto' for the optional automatic colour switch ?");\r
- e.printStackTrace();\r
- }\r
- try\r
- {\r
- if (maxval.length() > 0)\r
- {\r
- max = new Float(maxval).floatValue();\r
- }\r
- } catch (Exception e)\r
- {\r
- System.err\r
- .println("Couldn't parse the maximum value for graduated colour for type ("\r
- + colscheme + ")");\r
- e.printStackTrace();\r
- }\r
- }\r
- else\r
- {\r
- // add in some dummy min/max colours for the label-only\r
- // colourscheme.\r
- mincol = "FFFFFF";\r
- maxcol = "000000";\r
- }\r
- try\r
- {\r
- colour = new jalview.schemes.GraduatedColor(\r
- new UserColourScheme(mincol).findColour('A'),\r
- new UserColourScheme(maxcol).findColour('A'), min,\r
- max);\r
- } catch (Exception e)\r
- {\r
- System.err\r
- .println("Couldn't parse the graduated colour scheme ("\r
- + colscheme + ")");\r
- e.printStackTrace();\r
- }\r
- if (colour != null)\r
- {\r
- ((jalview.schemes.GraduatedColor) colour)\r
- .setColourByLabel(labelCol);\r
- ((jalview.schemes.GraduatedColor) colour)\r
- .setAutoScaled(abso == null);\r
- // add in any additional parameters\r
- String ttype = null, tval = null;\r
- if (gcol.hasMoreTokens())\r
- {\r
- // threshold type and possibly a threshold value\r
- ttype = gcol.nextToken();\r
- if (ttype.toLowerCase().startsWith("below"))\r
- {\r
- ((jalview.schemes.GraduatedColor) colour)\r
- .setThreshType(AnnotationColourGradient.BELOW_THRESHOLD);\r
- }\r
- else if (ttype.toLowerCase().startsWith("above"))\r
- {\r
- ((jalview.schemes.GraduatedColor) colour)\r
- .setThreshType(AnnotationColourGradient.ABOVE_THRESHOLD);\r
- }\r
- else\r
- {\r
- ((jalview.schemes.GraduatedColor) colour)\r
- .setThreshType(AnnotationColourGradient.NO_THRESHOLD);\r
- if (!ttype.toLowerCase().startsWith("no"))\r
- {\r
- System.err\r
- .println("Ignoring unrecognised threshold type : "\r
- + ttype);\r
- }\r
- }\r
- }\r
- if (((GraduatedColor) colour).getThreshType() != AnnotationColourGradient.NO_THRESHOLD)\r
- {\r
- try\r
- {\r
- gcol.nextToken();\r
- tval = gcol.nextToken();\r
- ((jalview.schemes.GraduatedColor) colour)\r
- .setThresh(new Float(tval).floatValue());\r
- } catch (Exception e)\r
- {\r
- System.err\r
- .println("Couldn't parse threshold value as a float: ("\r
- + tval + ")");\r
- e.printStackTrace();\r
- }\r
- }\r
- // parse the thresh-is-min token ?\r
- if (gcol.hasMoreTokens())\r
- {\r
- System.err\r
- .println("Ignoring additional tokens in parameters in graduated colour specification\n");\r
- while (gcol.hasMoreTokens())\r
- {\r
- System.err.println("|" + gcol.nextToken());\r
- }\r
- System.err.println("\n");\r
- }\r
- }\r
- }\r
- else\r
- {\r
- UserColourScheme ucs = new UserColourScheme(colscheme);\r
- colour = ucs.findColour('A');\r
- }\r
- if (colour != null)\r
- {\r
- colours.put(type, colour);\r
- }\r
- if (st.hasMoreElements())\r
- {\r
- String link = st.nextToken();\r
- typeLink.put(type, link);\r
- if (featureLink == null)\r
- {\r
- featureLink = new Hashtable();\r
- }\r
- featureLink.put(type, link);\r
- }\r
- }\r
- continue;\r
- }\r
- String seqId = "";\r
- while (st.hasMoreElements())\r
- {\r
-\r
- if (GFFFile)\r
- {\r
- // Still possible this is an old Jalview file,\r
- // which does not have type colours at the beginning\r
- seqId = token = st.nextToken();\r
- seq = findName(align, seqId, relaxedIdmatching);\r
- if (seq != null)\r
- {\r
- desc = st.nextToken();\r
- String group = null;\r
- if (doGffSource && desc.indexOf(' ') == -1)\r
- {\r
- // could also be a source term rather than description line\r
- group = new String(desc);\r
- }\r
- type = st.nextToken();\r
- try\r
- {\r
- String stt = st.nextToken();\r
- if (stt.length() == 0 || stt.equals("-"))\r
- {\r
- start = 0;\r
- }\r
- else\r
- {\r
- start = Integer.parseInt(stt);\r
- }\r
- } catch (NumberFormatException ex)\r
- {\r
- start = 0;\r
- }\r
- try\r
- {\r
- String stt = st.nextToken();\r
- if (stt.length() == 0 || stt.equals("-"))\r
- {\r
- end = 0;\r
- }\r
- else\r
- {\r
- end = Integer.parseInt(stt);\r
- }\r
- } catch (NumberFormatException ex)\r
- {\r
- end = 0;\r
- }\r
- // TODO: decide if non positional feature assertion for input data\r
- // where end==0 is generally valid\r
- if (end == 0)\r
- {\r
- // treat as non-positional feature, regardless.\r
- start = 0;\r
- }\r
- try\r
- {\r
- score = new Float(st.nextToken()).floatValue();\r
- } catch (NumberFormatException ex)\r
- {\r
- score = 0;\r
- }\r
-\r
- sf = new SequenceFeature(type, desc, start, end, score, group);\r
-\r
- try\r
- {\r
- sf.setValue("STRAND", st.nextToken());\r
- sf.setValue("FRAME", st.nextToken());\r
- } catch (Exception ex)\r
- {\r
- }\r
-\r
- if (st.hasMoreTokens())\r
- {\r
- StringBuffer attributes = new StringBuffer();\r
- while (st.hasMoreTokens())\r
- {\r
- attributes.append("\t" + st.nextElement());\r
- }\r
- // TODO validate and split GFF2 attributes field ? parse out\r
- // ([A-Za-z][A-Za-z0-9_]*) <value> ; and add as\r
- // sf.setValue(attrib, val);\r
- sf.setValue("ATTRIBUTES", attributes.toString());\r
- }\r
-\r
- seq.addSequenceFeature(sf);\r
- while ((seq = align.findName(seq, seqId, true)) != null)\r
- {\r
- seq.addSequenceFeature(new SequenceFeature(sf));\r
- }\r
- break;\r
- }\r
- }\r
-\r
- if (GFFFile && seq == null)\r
- {\r
- desc = token;\r
- }\r
- else\r
- {\r
- desc = st.nextToken();\r
- }\r
- if (!st.hasMoreTokens())\r
- {\r
- System.err\r
- .println("DEBUG: Run out of tokens when trying to identify the destination for the feature.. giving up.");\r
- // in all probability, this isn't a file we understand, so bail\r
- // quietly.\r
- return false;\r
- }\r
-\r
- token = st.nextToken();\r
-\r
- if (!token.equals("ID_NOT_SPECIFIED"))\r
- {\r
- seq = findName(align, seqId = token, relaxedIdmatching);\r
- st.nextToken();\r
- }\r
- else\r
- {\r
- seqId = null;\r
- try\r
- {\r
- index = Integer.parseInt(st.nextToken());\r
- seq = align.getSequenceAt(index);\r
- } catch (NumberFormatException ex)\r
- {\r
- seq = null;\r
- }\r
- }\r
-\r
- if (seq == null)\r
- {\r
- System.out.println("Sequence not found: " + line);\r
- break;\r
- }\r
-\r
- start = Integer.parseInt(st.nextToken());\r
- end = Integer.parseInt(st.nextToken());\r
-\r
- type = st.nextToken();\r
-\r
- if (!colours.containsKey(type))\r
- {\r
- // Probably the old style groups file\r
- UserColourScheme ucs = new UserColourScheme(type);\r
- colours.put(type, ucs.findColour('A'));\r
- }\r
- sf = new SequenceFeature(type, desc, "", start, end, featureGroup);\r
- if (st.hasMoreTokens())\r
- {\r
- try\r
- {\r
- score = new Float(st.nextToken()).floatValue();\r
- // update colourgradient bounds if allowed to\r
- } catch (NumberFormatException ex)\r
- {\r
- score = 0;\r
- }\r
- sf.setScore(score);\r
- }\r
- if (groupLink != null && removeHTML)\r
- {\r
- sf.addLink(groupLink);\r
- sf.description += "%LINK%";\r
- }\r
- if (typeLink.containsKey(type) && removeHTML)\r
- {\r
- sf.addLink(typeLink.get(type).toString());\r
- sf.description += "%LINK%";\r
- }\r
-\r
- parseDescriptionHTML(sf, removeHTML);\r
-\r
- seq.addSequenceFeature(sf);\r
-\r
- while (seqId != null\r
- && (seq = align.findName(seq, seqId, false)) != null)\r
- {\r
- seq.addSequenceFeature(new SequenceFeature(sf));\r
- }\r
- // If we got here, its not a GFFFile\r
- GFFFile = false;\r
- }\r
- }\r
- resetMatcher();\r
- } catch (Exception ex)\r
- {\r
- System.out.println(line);\r
- System.out.println("Error parsing feature file: " + ex + "\n" + line);\r
- ex.printStackTrace(System.err);\r
- resetMatcher();\r
- return false;\r
- }\r
-\r
- return true;\r
- }\r
-\r
- private AlignmentI lastmatchedAl = null;\r
-\r
- private SequenceIdMatcher matcher = null;\r
-\r
- /**\r
- * clear any temporary handles used to speed up ID matching\r
- */\r
- private void resetMatcher()\r
- {\r
- lastmatchedAl = null;\r
- matcher = null;\r
- }\r
-\r
- private SequenceI findName(AlignmentI align, String seqId,\r
- boolean relaxedIdMatching)\r
- {\r
- SequenceI match = null;\r
- if (relaxedIdMatching)\r
- {\r
- if (lastmatchedAl != align)\r
- {\r
- matcher = new SequenceIdMatcher(\r
- (lastmatchedAl = align).getSequencesArray());\r
- }\r
- match = matcher.findIdMatch(seqId);\r
- }\r
- else\r
- {\r
- match = align.findName(seqId, true);\r
- }\r
- return match;\r
- }\r
-\r
- public void parseDescriptionHTML(SequenceFeature sf, boolean removeHTML)\r
- {\r
- if (sf.getDescription() == null)\r
- {\r
- return;\r
- }\r
- jalview.util.ParseHtmlBodyAndLinks parsed = new jalview.util.ParseHtmlBodyAndLinks(\r
- sf.getDescription(), removeHTML, newline);\r
-\r
- sf.description = (removeHTML) ? parsed.getNonHtmlContent()\r
- : sf.description;\r
- for (String link : parsed.getLinks())\r
- {\r
- sf.addLink(link);\r
- }\r
-\r
- }\r
-\r
- /**\r
- * generate a features file for seqs includes non-pos features by default.\r
- * \r
- * @param seqs\r
- * source of sequence features\r
- * @param visible\r
- * hash of feature types and colours\r
- * @return features file contents\r
- */\r
- public String printJalviewFormat(SequenceI[] seqs, Hashtable visible)\r
- {\r
- return printJalviewFormat(seqs, visible, true, true);\r
- }\r
-\r
- /**\r
- * generate a features file for seqs with colours from visible (if any)\r
- * \r
- * @param seqs\r
- * source of features\r
- * @param visible\r
- * hash of Colours for each feature type\r
- * @param visOnly\r
- * when true only feature types in 'visible' will be output\r
- * @param nonpos\r
- * indicates if non-positional features should be output (regardless\r
- * of group or type)\r
- * @return features file contents\r
- */\r
- public String printJalviewFormat(SequenceI[] seqs, Hashtable visible,\r
- boolean visOnly, boolean nonpos)\r
- {\r
- StringBuffer out = new StringBuffer();\r
- SequenceFeature[] next;\r
- boolean featuresGen = false;\r
- if (visOnly && !nonpos && (visible == null || visible.size() < 1))\r
- {\r
- // no point continuing.\r
- return "No Features Visible";\r
- }\r
-\r
- if (visible != null && visOnly)\r
- {\r
- // write feature colours only if we're given them and we are generating\r
- // viewed features\r
- // TODO: decide if feature links should also be written here ?\r
- Enumeration en = visible.keys();\r
- String type, color;\r
- while (en.hasMoreElements())\r
- {\r
- type = en.nextElement().toString();\r
-\r
- if (visible.get(type) instanceof GraduatedColor)\r
- {\r
- GraduatedColor gc = (GraduatedColor) visible.get(type);\r
- color = (gc.isColourByLabel() ? "label|" : "")\r
- + Format.getHexString(gc.getMinColor()) + "|"\r
- + Format.getHexString(gc.getMaxColor())\r
- + (gc.isAutoScale() ? "|" : "|abso|") + gc.getMin() + "|"\r
- + gc.getMax() + "|";\r
- if (gc.getThreshType() != AnnotationColourGradient.NO_THRESHOLD)\r
- {\r
- if (gc.getThreshType() == AnnotationColourGradient.BELOW_THRESHOLD)\r
- {\r
- color += "below";\r
- }\r
- else\r
- {\r
- if (gc.getThreshType() != AnnotationColourGradient.ABOVE_THRESHOLD)\r
- {\r
- System.err.println("WARNING: Unsupported threshold type ("\r
- + gc.getThreshType() + ") : Assuming 'above'");\r
- }\r
- color += "above";\r
- }\r
- // add the value\r
- color += "|" + gc.getThresh();\r
- }\r
- else\r
- {\r
- color += "none";\r
- }\r
- }\r
- else if (visible.get(type) instanceof java.awt.Color)\r
- {\r
- color = Format.getHexString((java.awt.Color) visible.get(type));\r
- }\r
- else\r
- {\r
- // legacy support for integer objects containing colour triplet values\r
- color = Format.getHexString(new java.awt.Color(Integer\r
- .parseInt(visible.get(type).toString())));\r
- }\r
- out.append(type);\r
- out.append("\t");\r
- out.append(color);\r
- out.append(newline);\r
- }\r
- }\r
- // Work out which groups are both present and visible\r
- Vector groups = new Vector();\r
- int groupIndex = 0;\r
- boolean isnonpos = false;\r
-\r
- for (int i = 0; i < seqs.length; i++)\r
- {\r
- next = seqs[i].getSequenceFeatures();\r
- if (next != null)\r
- {\r
- for (int j = 0; j < next.length; j++)\r
- {\r
- isnonpos = next[j].begin == 0 && next[j].end == 0;\r
- if ((!nonpos && isnonpos)\r
- || (!isnonpos && visOnly && !visible\r
- .containsKey(next[j].type)))\r
- {\r
- continue;\r
- }\r
-\r
- if (next[j].featureGroup != null\r
- && !groups.contains(next[j].featureGroup))\r
- {\r
- groups.addElement(next[j].featureGroup);\r
- }\r
- }\r
- }\r
- }\r
-\r
- String group = null;\r
- do\r
- {\r
-\r
- if (groups.size() > 0 && groupIndex < groups.size())\r
- {\r
- group = groups.elementAt(groupIndex).toString();\r
- out.append(newline);\r
- out.append("STARTGROUP\t");\r
- out.append(group);\r
- out.append(newline);\r
- }\r
- else\r
- {\r
- group = null;\r
- }\r
-\r
- for (int i = 0; i < seqs.length; i++)\r
- {\r
- next = seqs[i].getSequenceFeatures();\r
- if (next != null)\r
- {\r
- for (int j = 0; j < next.length; j++)\r
- {\r
- isnonpos = next[j].begin == 0 && next[j].end == 0;\r
- if ((!nonpos && isnonpos)\r
- || (!isnonpos && visOnly && !visible\r
- .containsKey(next[j].type)))\r
- {\r
- // skip if feature is nonpos and we ignore them or if we only\r
- // output visible and it isn't non-pos and it's not visible\r
- continue;\r
- }\r
-\r
- if (group != null\r
- && (next[j].featureGroup == null || !next[j].featureGroup\r
- .equals(group)))\r
- {\r
- continue;\r
- }\r
-\r
- if (group == null && next[j].featureGroup != null)\r
- {\r
- continue;\r
- }\r
- // we have features to output\r
- featuresGen = true;\r
- if (next[j].description == null\r
- || next[j].description.equals(""))\r
- {\r
- out.append(next[j].type + "\t");\r
- }\r
- else\r
- {\r
- if (next[j].links != null\r
- && next[j].getDescription().indexOf("<html>") == -1)\r
- {\r
- out.append("<html>");\r
- }\r
-\r
- out.append(next[j].description + " ");\r
- if (next[j].links != null)\r
- {\r
- for (int l = 0; l < next[j].links.size(); l++)\r
- {\r
- String label = next[j].links.elementAt(l).toString();\r
- String href = label.substring(label.indexOf("|") + 1);\r
- label = label.substring(0, label.indexOf("|"));\r
-\r
- if (next[j].description.indexOf(href) == -1)\r
- {\r
- out.append("<a href=\"" + href + "\">" + label + "</a>");\r
- }\r
- }\r
-\r
- if (next[j].getDescription().indexOf("</html>") == -1)\r
- {\r
- out.append("</html>");\r
- }\r
- }\r
-\r
- out.append("\t");\r
- }\r
- out.append(seqs[i].getName());\r
- out.append("\t-1\t");\r
- out.append(next[j].begin);\r
- out.append("\t");\r
- out.append(next[j].end);\r
- out.append("\t");\r
- out.append(next[j].type);\r
- if (next[j].score != Float.NaN)\r
- {\r
- out.append("\t");\r
- out.append(next[j].score);\r
- }\r
- out.append(newline);\r
- }\r
- }\r
- }\r
-\r
- if (group != null)\r
- {\r
- out.append("ENDGROUP\t");\r
- out.append(group);\r
- out.append(newline);\r
- groupIndex++;\r
- }\r
- else\r
- {\r
- break;\r
- }\r
-\r
- } while (groupIndex < groups.size() + 1);\r
-\r
- if (!featuresGen)\r
- {\r
- return "No Features Visible";\r
- }\r
-\r
- return out.toString();\r
- }\r
-\r
- /**\r
- * generate a gff file for sequence features includes non-pos features by\r
- * default.\r
- * \r
- * @param seqs\r
- * @param visible\r
- * @return\r
- */\r
- public String printGFFFormat(SequenceI[] seqs, Hashtable visible)\r
- {\r
- return printGFFFormat(seqs, visible, true, true);\r
- }\r
-\r
- public String printGFFFormat(SequenceI[] seqs, Hashtable visible,\r
- boolean visOnly, boolean nonpos)\r
- {\r
- StringBuffer out = new StringBuffer();\r
- SequenceFeature[] next;\r
- String source;\r
- boolean isnonpos;\r
- for (int i = 0; i < seqs.length; i++)\r
- {\r
- if (seqs[i].getSequenceFeatures() != null)\r
- {\r
- next = seqs[i].getSequenceFeatures();\r
- for (int j = 0; j < next.length; j++)\r
- {\r
- isnonpos = next[j].begin == 0 && next[j].end == 0;\r
- if ((!nonpos && isnonpos)\r
- || (!isnonpos && visOnly && !visible\r
- .containsKey(next[j].type)))\r
- {\r
- continue;\r
- }\r
-\r
- source = next[j].featureGroup;\r
- if (source == null)\r
- {\r
- source = next[j].getDescription();\r
- }\r
-\r
- out.append(seqs[i].getName());\r
- out.append("\t");\r
- out.append(source);\r
- out.append("\t");\r
- out.append(next[j].type);\r
- out.append("\t");\r
- out.append(next[j].begin);\r
- out.append("\t");\r
- out.append(next[j].end);\r
- out.append("\t");\r
- out.append(next[j].score);\r
- out.append("\t");\r
-\r
- if (next[j].getValue("STRAND") != null)\r
- {\r
- out.append(next[j].getValue("STRAND"));\r
- out.append("\t");\r
- }\r
- else\r
- {\r
- out.append(".\t");\r
- }\r
-\r
- if (next[j].getValue("FRAME") != null)\r
- {\r
- out.append(next[j].getValue("FRAME"));\r
- }\r
- else\r
- {\r
- out.append(".");\r
- }\r
- // TODO: verify/check GFF - should there be a /t here before attribute\r
- // output ?\r
-\r
- if (next[j].getValue("ATTRIBUTES") != null)\r
- {\r
- out.append(next[j].getValue("ATTRIBUTES"));\r
- }\r
-\r
- out.append(newline);\r
-\r
- }\r
- }\r
- }\r
-\r
- return out.toString();\r
- }\r
-\r
- /**\r
- * this is only for the benefit of object polymorphism - method does nothing.\r
- */\r
- public void parse()\r
- {\r
- // IGNORED\r
- }\r
-\r
- /**\r
- * this is only for the benefit of object polymorphism - method does nothing.\r
- * \r
- * @return error message\r
- */\r
- public String print()\r
- {\r
- return "USE printGFFFormat() or printJalviewFormat()";\r
- }\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.io;
+
+import java.io.*;
+import java.util.*;
+
+import jalview.analysis.SequenceIdMatcher;
+import jalview.datamodel.*;
+import jalview.schemes.*;
+import jalview.util.Format;
+
+/**
+ * Parse and create Jalview Features files Detects GFF format features files and
+ * parses. Does not implement standard print() - call specific printFeatures or
+ * printGFF. Uses AlignmentI.findSequence(String id) to find the sequence object
+ * for the features annotation - this normally works on an exact match.
+ *
+ * @author AMW
+ * @version $Revision$
+ */
+public class FeaturesFile extends AlignFile
+{
+ /**
+ * work around for GFF interpretation bug where source string becomes
+ * description rather than a group
+ */
+ private boolean doGffSource = true;
+
+ /**
+ * Creates a new FeaturesFile object.
+ */
+ public FeaturesFile()
+ {
+ }
+
+ /**
+ * Creates a new FeaturesFile object.
+ *
+ * @param inFile
+ * DOCUMENT ME!
+ * @param type
+ * DOCUMENT ME!
+ *
+ * @throws IOException
+ * DOCUMENT ME!
+ */
+ public FeaturesFile(String inFile, String type) throws IOException
+ {
+ super(inFile, type);
+ }
+
+ public FeaturesFile(FileParse source) throws IOException
+ {
+ super(source);
+ }
+
+ /**
+ * Parse GFF or sequence features file using case-independent matching,
+ * discarding URLs
+ *
+ * @param align
+ * - alignment/dataset containing sequences that are to be annotated
+ * @param colours
+ * - hashtable to store feature colour definitions
+ * @param removeHTML
+ * - process html strings into plain text
+ * @return true if features were added
+ */
+ public boolean parse(AlignmentI align, Hashtable colours,
+ boolean removeHTML)
+ {
+ return parse(align, colours, null, removeHTML, false);
+ }
+
+ /**
+ * Parse GFF or sequence features file optionally using case-independent
+ * matching, discarding URLs
+ *
+ * @param align
+ * - alignment/dataset containing sequences that are to be annotated
+ * @param colours
+ * - hashtable to store feature colour definitions
+ * @param removeHTML
+ * - process html strings into plain text
+ * @param relaxedIdmatching
+ * - when true, ID matches to compound sequence IDs are allowed
+ * @return true if features were added
+ */
+ public boolean parse(AlignmentI align, Map colours, boolean removeHTML,
+ boolean relaxedIdMatching)
+ {
+ return parse(align, colours, null, removeHTML, relaxedIdMatching);
+ }
+
+ /**
+ * Parse GFF or sequence features file optionally using case-independent
+ * matching
+ *
+ * @param align
+ * - alignment/dataset containing sequences that are to be annotated
+ * @param colours
+ * - hashtable to store feature colour definitions
+ * @param featureLink
+ * - hashtable to store associated URLs
+ * @param removeHTML
+ * - process html strings into plain text
+ * @return true if features were added
+ */
+ public boolean parse(AlignmentI align, Map colours, Map featureLink,
+ boolean removeHTML)
+ {
+ return parse(align, colours, featureLink, removeHTML, false);
+ }
+
+ /**
+ * /** Parse GFF or sequence features file
+ *
+ * @param align
+ * - alignment/dataset containing sequences that are to be annotated
+ * @param colours
+ * - hashtable to store feature colour definitions
+ * @param featureLink
+ * - hashtable to store associated URLs
+ * @param removeHTML
+ * - process html strings into plain text
+ * @param relaxedIdmatching
+ * - when true, ID matches to compound sequence IDs are allowed
+ * @return true if features were added
+ */
+ public boolean parse(AlignmentI align, Map colours, Map featureLink,
+ boolean removeHTML, boolean relaxedIdmatching)
+ {
+
+ String line = null;
+ try
+ {
+ SequenceI seq = null;
+ String type, desc, token = null;
+
+ int index, start, end;
+ float score;
+ StringTokenizer st;
+ SequenceFeature sf;
+ String featureGroup = null, groupLink = null;
+ Map typeLink = new Hashtable();
+ /**
+ * when true, assume GFF style features rather than Jalview style.
+ */
+ boolean GFFFile = true;
+ while ((line = nextLine()) != null)
+ {
+ if (line.startsWith("#"))
+ {
+ continue;
+ }
+
+ st = new StringTokenizer(line, "\t");
+ if (st.countTokens() == 1)
+ {
+ if (line.trim().equalsIgnoreCase("GFF"))
+ {
+ // Start parsing file as if it might be GFF again.
+ GFFFile = true;
+ continue;
+ }
+ }
+ if (st.countTokens() > 1 && st.countTokens() < 4)
+ {
+ GFFFile = false;
+ type = st.nextToken();
+ if (type.equalsIgnoreCase("startgroup"))
+ {
+ featureGroup = st.nextToken();
+ if (st.hasMoreElements())
+ {
+ groupLink = st.nextToken();
+ featureLink.put(featureGroup, groupLink);
+ }
+ }
+ else if (type.equalsIgnoreCase("endgroup"))
+ {
+ // We should check whether this is the current group,
+ // but at present theres no way of showing more than 1 group
+ st.nextToken();
+ featureGroup = null;
+ groupLink = null;
+ }
+ else
+ {
+ Object colour = null;
+ String colscheme = st.nextToken();
+ if (colscheme.indexOf("|") > -1
+ || colscheme.trim().equalsIgnoreCase("label"))
+ {
+ // Parse '|' separated graduated colourscheme fields:
+ // [label|][mincolour|maxcolour|[absolute|]minvalue|maxvalue|thresholdtype|thresholdvalue]
+ // can either provide 'label' only, first is optional, next two
+ // colors are required (but may be
+ // left blank), next is optional, nxt two min/max are required.
+ // first is either 'label'
+ // first/second and third are both hexadecimal or word equivalent
+ // colour.
+ // next two are values parsed as floats.
+ // fifth is either 'above','below', or 'none'.
+ // sixth is a float value and only required when fifth is either
+ // 'above' or 'below'.
+ StringTokenizer gcol = new StringTokenizer(colscheme, "|",
+ true);
+ // set defaults
+ int threshtype = AnnotationColourGradient.NO_THRESHOLD;
+ float min = Float.MIN_VALUE, max = Float.MAX_VALUE, threshval = Float.NaN;
+ boolean labelCol = false;
+ // Parse spec line
+ String mincol = gcol.nextToken();
+ if (mincol == "|")
+ {
+ System.err
+ .println("Expected either 'label' or a colour specification in the line: "
+ + line);
+ continue;
+ }
+ String maxcol = null;
+ if (mincol.toLowerCase().indexOf("label") == 0)
+ {
+ labelCol = true;
+ mincol = (gcol.hasMoreTokens() ? gcol.nextToken() : null); // skip
+ // '|'
+ mincol = (gcol.hasMoreTokens() ? gcol.nextToken() : null);
+ }
+ String abso = null, minval, maxval;
+ if (mincol != null)
+ {
+ // at least four more tokens
+ if (mincol.equals("|"))
+ {
+ mincol = "";
+ }
+ else
+ {
+ gcol.nextToken(); // skip next '|'
+ }
+ // continue parsing rest of line
+ maxcol = gcol.nextToken();
+ if (maxcol.equals("|"))
+ {
+ maxcol = "";
+ }
+ else
+ {
+ gcol.nextToken(); // skip next '|'
+ }
+ abso = gcol.nextToken();
+ gcol.nextToken(); // skip next '|'
+ if (abso.toLowerCase().indexOf("abso") != 0)
+ {
+ minval = abso;
+ abso = null;
+ }
+ else
+ {
+ minval = gcol.nextToken();
+ gcol.nextToken(); // skip next '|'
+ }
+ maxval = gcol.nextToken();
+ if (gcol.hasMoreTokens())
+ {
+ gcol.nextToken(); // skip next '|'
+ }
+ try
+ {
+ if (minval.length() > 0)
+ {
+ min = new Float(minval).floatValue();
+ }
+ } catch (Exception e)
+ {
+ System.err
+ .println("Couldn't parse the minimum value for graduated colour for type ("
+ + colscheme
+ + ") - did you misspell 'auto' for the optional automatic colour switch ?");
+ e.printStackTrace();
+ }
+ try
+ {
+ if (maxval.length() > 0)
+ {
+ max = new Float(maxval).floatValue();
+ }
+ } catch (Exception e)
+ {
+ System.err
+ .println("Couldn't parse the maximum value for graduated colour for type ("
+ + colscheme + ")");
+ e.printStackTrace();
+ }
+ }
+ else
+ {
+ // add in some dummy min/max colours for the label-only
+ // colourscheme.
+ mincol = "FFFFFF";
+ maxcol = "000000";
+ }
+ try
+ {
+ colour = new jalview.schemes.GraduatedColor(
+ new UserColourScheme(mincol).findColour('A'),
+ new UserColourScheme(maxcol).findColour('A'), min,
+ max);
+ } catch (Exception e)
+ {
+ System.err
+ .println("Couldn't parse the graduated colour scheme ("
+ + colscheme + ")");
+ e.printStackTrace();
+ }
+ if (colour != null)
+ {
+ ((jalview.schemes.GraduatedColor) colour)
+ .setColourByLabel(labelCol);
+ ((jalview.schemes.GraduatedColor) colour)
+ .setAutoScaled(abso == null);
+ // add in any additional parameters
+ String ttype = null, tval = null;
+ if (gcol.hasMoreTokens())
+ {
+ // threshold type and possibly a threshold value
+ ttype = gcol.nextToken();
+ if (ttype.toLowerCase().startsWith("below"))
+ {
+ ((jalview.schemes.GraduatedColor) colour)
+ .setThreshType(AnnotationColourGradient.BELOW_THRESHOLD);
+ }
+ else if (ttype.toLowerCase().startsWith("above"))
+ {
+ ((jalview.schemes.GraduatedColor) colour)
+ .setThreshType(AnnotationColourGradient.ABOVE_THRESHOLD);
+ }
+ else
+ {
+ ((jalview.schemes.GraduatedColor) colour)
+ .setThreshType(AnnotationColourGradient.NO_THRESHOLD);
+ if (!ttype.toLowerCase().startsWith("no"))
+ {
+ System.err
+ .println("Ignoring unrecognised threshold type : "
+ + ttype);
+ }
+ }
+ }
+ if (((GraduatedColor) colour).getThreshType() != AnnotationColourGradient.NO_THRESHOLD)
+ {
+ try
+ {
+ gcol.nextToken();
+ tval = gcol.nextToken();
+ ((jalview.schemes.GraduatedColor) colour)
+ .setThresh(new Float(tval).floatValue());
+ } catch (Exception e)
+ {
+ System.err
+ .println("Couldn't parse threshold value as a float: ("
+ + tval + ")");
+ e.printStackTrace();
+ }
+ }
+ // parse the thresh-is-min token ?
+ if (gcol.hasMoreTokens())
+ {
+ System.err
+ .println("Ignoring additional tokens in parameters in graduated colour specification\n");
+ while (gcol.hasMoreTokens())
+ {
+ System.err.println("|" + gcol.nextToken());
+ }
+ System.err.println("\n");
+ }
+ }
+ }
+ else
+ {
+ UserColourScheme ucs = new UserColourScheme(colscheme);
+ colour = ucs.findColour('A');
+ }
+ if (colour != null)
+ {
+ colours.put(type, colour);
+ }
+ if (st.hasMoreElements())
+ {
+ String link = st.nextToken();
+ typeLink.put(type, link);
+ if (featureLink == null)
+ {
+ featureLink = new Hashtable();
+ }
+ featureLink.put(type, link);
+ }
+ }
+ continue;
+ }
+ String seqId = "";
+ while (st.hasMoreElements())
+ {
+
+ if (GFFFile)
+ {
+ // Still possible this is an old Jalview file,
+ // which does not have type colours at the beginning
+ seqId = token = st.nextToken();
+ seq = findName(align, seqId, relaxedIdmatching);
+ if (seq != null)
+ {
+ desc = st.nextToken();
+ String group = null;
+ if (doGffSource && desc.indexOf(' ') == -1)
+ {
+ // could also be a source term rather than description line
+ group = new String(desc);
+ }
+ type = st.nextToken();
+ try
+ {
+ String stt = st.nextToken();
+ if (stt.length() == 0 || stt.equals("-"))
+ {
+ start = 0;
+ }
+ else
+ {
+ start = Integer.parseInt(stt);
+ }
+ } catch (NumberFormatException ex)
+ {
+ start = 0;
+ }
+ try
+ {
+ String stt = st.nextToken();
+ if (stt.length() == 0 || stt.equals("-"))
+ {
+ end = 0;
+ }
+ else
+ {
+ end = Integer.parseInt(stt);
+ }
+ } catch (NumberFormatException ex)
+ {
+ end = 0;
+ }
+ // TODO: decide if non positional feature assertion for input data
+ // where end==0 is generally valid
+ if (end == 0)
+ {
+ // treat as non-positional feature, regardless.
+ start = 0;
+ }
+ try
+ {
+ score = new Float(st.nextToken()).floatValue();
+ } catch (NumberFormatException ex)
+ {
+ score = 0;
+ }
+
+ sf = new SequenceFeature(type, desc, start, end, score, group);
+
+ try
+ {
+ sf.setValue("STRAND", st.nextToken());
+ sf.setValue("FRAME", st.nextToken());
+ } catch (Exception ex)
+ {
+ }
+
+ if (st.hasMoreTokens())
+ {
+ StringBuffer attributes = new StringBuffer();
+ while (st.hasMoreTokens())
+ {
+ attributes.append("\t" + st.nextElement());
+ }
+ // TODO validate and split GFF2 attributes field ? parse out
+ // ([A-Za-z][A-Za-z0-9_]*) <value> ; and add as
+ // sf.setValue(attrib, val);
+ sf.setValue("ATTRIBUTES", attributes.toString());
+ }
+
+ seq.addSequenceFeature(sf);
+ while ((seq = align.findName(seq, seqId, true)) != null)
+ {
+ seq.addSequenceFeature(new SequenceFeature(sf));
+ }
+ break;
+ }
+ }
+
+ if (GFFFile && seq == null)
+ {
+ desc = token;
+ }
+ else
+ {
+ desc = st.nextToken();
+ }
+ if (!st.hasMoreTokens())
+ {
+ System.err
+ .println("DEBUG: Run out of tokens when trying to identify the destination for the feature.. giving up.");
+ // in all probability, this isn't a file we understand, so bail
+ // quietly.
+ return false;
+ }
+
+ token = st.nextToken();
+
+ if (!token.equals("ID_NOT_SPECIFIED"))
+ {
+ seq = findName(align, seqId = token, relaxedIdmatching);
+ st.nextToken();
+ }
+ else
+ {
+ seqId = null;
+ try
+ {
+ index = Integer.parseInt(st.nextToken());
+ seq = align.getSequenceAt(index);
+ } catch (NumberFormatException ex)
+ {
+ seq = null;
+ }
+ }
+
+ if (seq == null)
+ {
+ System.out.println("Sequence not found: " + line);
+ break;
+ }
+
+ start = Integer.parseInt(st.nextToken());
+ end = Integer.parseInt(st.nextToken());
+
+ type = st.nextToken();
+
+ if (!colours.containsKey(type))
+ {
+ // Probably the old style groups file
+ UserColourScheme ucs = new UserColourScheme(type);
+ colours.put(type, ucs.findColour('A'));
+ }
+ sf = new SequenceFeature(type, desc, "", start, end, featureGroup);
+ if (st.hasMoreTokens())
+ {
+ try
+ {
+ score = new Float(st.nextToken()).floatValue();
+ // update colourgradient bounds if allowed to
+ } catch (NumberFormatException ex)
+ {
+ score = 0;
+ }
+ sf.setScore(score);
+ }
+ if (groupLink != null && removeHTML)
+ {
+ sf.addLink(groupLink);
+ sf.description += "%LINK%";
+ }
+ if (typeLink.containsKey(type) && removeHTML)
+ {
+ sf.addLink(typeLink.get(type).toString());
+ sf.description += "%LINK%";
+ }
+
+ parseDescriptionHTML(sf, removeHTML);
+
+ seq.addSequenceFeature(sf);
+
+ while (seqId != null
+ && (seq = align.findName(seq, seqId, false)) != null)
+ {
+ seq.addSequenceFeature(new SequenceFeature(sf));
+ }
+ // If we got here, its not a GFFFile
+ GFFFile = false;
+ }
+ }
+ resetMatcher();
+ } catch (Exception ex)
+ {
+ System.out.println(line);
+ System.out.println("Error parsing feature file: " + ex + "\n" + line);
+ ex.printStackTrace(System.err);
+ resetMatcher();
+ return false;
+ }
+
+ return true;
+ }
+
+ private AlignmentI lastmatchedAl = null;
+
+ private SequenceIdMatcher matcher = null;
+
+ /**
+ * clear any temporary handles used to speed up ID matching
+ */
+ private void resetMatcher()
+ {
+ lastmatchedAl = null;
+ matcher = null;
+ }
+
+ private SequenceI findName(AlignmentI align, String seqId,
+ boolean relaxedIdMatching)
+ {
+ SequenceI match = null;
+ if (relaxedIdMatching)
+ {
+ if (lastmatchedAl != align)
+ {
+ matcher = new SequenceIdMatcher(
+ (lastmatchedAl = align).getSequencesArray());
+ }
+ match = matcher.findIdMatch(seqId);
+ }
+ else
+ {
+ match = align.findName(seqId, true);
+ }
+ return match;
+ }
+
+ public void parseDescriptionHTML(SequenceFeature sf, boolean removeHTML)
+ {
+ if (sf.getDescription() == null)
+ {
+ return;
+ }
+ jalview.util.ParseHtmlBodyAndLinks parsed = new jalview.util.ParseHtmlBodyAndLinks(
+ sf.getDescription(), removeHTML, newline);
+
+ sf.description = (removeHTML) ? parsed.getNonHtmlContent()
+ : sf.description;
+ for (String link : parsed.getLinks())
+ {
+ sf.addLink(link);
+ }
+
+ }
+
+ /**
+ * generate a features file for seqs includes non-pos features by default.
+ *
+ * @param seqs
+ * source of sequence features
+ * @param visible
+ * hash of feature types and colours
+ * @return features file contents
+ */
+ public String printJalviewFormat(SequenceI[] seqs, Hashtable visible)
+ {
+ return printJalviewFormat(seqs, visible, true, true);
+ }
+
+ /**
+ * generate a features file for seqs with colours from visible (if any)
+ *
+ * @param seqs
+ * source of features
+ * @param visible
+ * hash of Colours for each feature type
+ * @param visOnly
+ * when true only feature types in 'visible' will be output
+ * @param nonpos
+ * indicates if non-positional features should be output (regardless
+ * of group or type)
+ * @return features file contents
+ */
+ public String printJalviewFormat(SequenceI[] seqs, Hashtable visible,
+ boolean visOnly, boolean nonpos)
+ {
+ StringBuffer out = new StringBuffer();
+ SequenceFeature[] next;
+ boolean featuresGen = false;
+ if (visOnly && !nonpos && (visible == null || visible.size() < 1))
+ {
+ // no point continuing.
+ return "No Features Visible";
+ }
+
+ if (visible != null && visOnly)
+ {
+ // write feature colours only if we're given them and we are generating
+ // viewed features
+ // TODO: decide if feature links should also be written here ?
+ Enumeration en = visible.keys();
+ String type, color;
+ while (en.hasMoreElements())
+ {
+ type = en.nextElement().toString();
+
+ if (visible.get(type) instanceof GraduatedColor)
+ {
+ GraduatedColor gc = (GraduatedColor) visible.get(type);
+ color = (gc.isColourByLabel() ? "label|" : "")
+ + Format.getHexString(gc.getMinColor()) + "|"
+ + Format.getHexString(gc.getMaxColor())
+ + (gc.isAutoScale() ? "|" : "|abso|") + gc.getMin() + "|"
+ + gc.getMax() + "|";
+ if (gc.getThreshType() != AnnotationColourGradient.NO_THRESHOLD)
+ {
+ if (gc.getThreshType() == AnnotationColourGradient.BELOW_THRESHOLD)
+ {
+ color += "below";
+ }
+ else
+ {
+ if (gc.getThreshType() != AnnotationColourGradient.ABOVE_THRESHOLD)
+ {
+ System.err.println("WARNING: Unsupported threshold type ("
+ + gc.getThreshType() + ") : Assuming 'above'");
+ }
+ color += "above";
+ }
+ // add the value
+ color += "|" + gc.getThresh();
+ }
+ else
+ {
+ color += "none";
+ }
+ }
+ else if (visible.get(type) instanceof java.awt.Color)
+ {
+ color = Format.getHexString((java.awt.Color) visible.get(type));
+ }
+ else
+ {
+ // legacy support for integer objects containing colour triplet values
+ color = Format.getHexString(new java.awt.Color(Integer
+ .parseInt(visible.get(type).toString())));
+ }
+ out.append(type);
+ out.append("\t");
+ out.append(color);
+ out.append(newline);
+ }
+ }
+ // Work out which groups are both present and visible
+ Vector groups = new Vector();
+ int groupIndex = 0;
+ boolean isnonpos = false;
+
+ for (int i = 0; i < seqs.length; i++)
+ {
+ next = seqs[i].getSequenceFeatures();
+ if (next != null)
+ {
+ for (int j = 0; j < next.length; j++)
+ {
+ isnonpos = next[j].begin == 0 && next[j].end == 0;
+ if ((!nonpos && isnonpos)
+ || (!isnonpos && visOnly && !visible
+ .containsKey(next[j].type)))
+ {
+ continue;
+ }
+
+ if (next[j].featureGroup != null
+ && !groups.contains(next[j].featureGroup))
+ {
+ groups.addElement(next[j].featureGroup);
+ }
+ }
+ }
+ }
+
+ String group = null;
+ do
+ {
+
+ if (groups.size() > 0 && groupIndex < groups.size())
+ {
+ group = groups.elementAt(groupIndex).toString();
+ out.append(newline);
+ out.append("STARTGROUP\t");
+ out.append(group);
+ out.append(newline);
+ }
+ else
+ {
+ group = null;
+ }
+
+ for (int i = 0; i < seqs.length; i++)
+ {
+ next = seqs[i].getSequenceFeatures();
+ if (next != null)
+ {
+ for (int j = 0; j < next.length; j++)
+ {
+ isnonpos = next[j].begin == 0 && next[j].end == 0;
+ if ((!nonpos && isnonpos)
+ || (!isnonpos && visOnly && !visible
+ .containsKey(next[j].type)))
+ {
+ // skip if feature is nonpos and we ignore them or if we only
+ // output visible and it isn't non-pos and it's not visible
+ continue;
+ }
+
+ if (group != null
+ && (next[j].featureGroup == null || !next[j].featureGroup
+ .equals(group)))
+ {
+ continue;
+ }
+
+ if (group == null && next[j].featureGroup != null)
+ {
+ continue;
+ }
+ // we have features to output
+ featuresGen = true;
+ if (next[j].description == null
+ || next[j].description.equals(""))
+ {
+ out.append(next[j].type + "\t");
+ }
+ else
+ {
+ if (next[j].links != null
+ && next[j].getDescription().indexOf("<html>") == -1)
+ {
+ out.append("<html>");
+ }
+
+ out.append(next[j].description + " ");
+ if (next[j].links != null)
+ {
+ for (int l = 0; l < next[j].links.size(); l++)
+ {
+ String label = next[j].links.elementAt(l).toString();
+ String href = label.substring(label.indexOf("|") + 1);
+ label = label.substring(0, label.indexOf("|"));
+
+ if (next[j].description.indexOf(href) == -1)
+ {
+ out.append("<a href=\"" + href + "\">" + label + "</a>");
+ }
+ }
+
+ if (next[j].getDescription().indexOf("</html>") == -1)
+ {
+ out.append("</html>");
+ }
+ }
+
+ out.append("\t");
+ }
+ out.append(seqs[i].getName());
+ out.append("\t-1\t");
+ out.append(next[j].begin);
+ out.append("\t");
+ out.append(next[j].end);
+ out.append("\t");
+ out.append(next[j].type);
+ if (next[j].score != Float.NaN)
+ {
+ out.append("\t");
+ out.append(next[j].score);
+ }
+ out.append(newline);
+ }
+ }
+ }
+
+ if (group != null)
+ {
+ out.append("ENDGROUP\t");
+ out.append(group);
+ out.append(newline);
+ groupIndex++;
+ }
+ else
+ {
+ break;
+ }
+
+ } while (groupIndex < groups.size() + 1);
+
+ if (!featuresGen)
+ {
+ return "No Features Visible";
+ }
+
+ return out.toString();
+ }
+
+ /**
+ * generate a gff file for sequence features includes non-pos features by
+ * default.
+ *
+ * @param seqs
+ * @param visible
+ * @return
+ */
+ public String printGFFFormat(SequenceI[] seqs, Hashtable visible)
+ {
+ return printGFFFormat(seqs, visible, true, true);
+ }
+
+ public String printGFFFormat(SequenceI[] seqs, Hashtable visible,
+ boolean visOnly, boolean nonpos)
+ {
+ StringBuffer out = new StringBuffer();
+ SequenceFeature[] next;
+ String source;
+ boolean isnonpos;
+ for (int i = 0; i < seqs.length; i++)
+ {
+ if (seqs[i].getSequenceFeatures() != null)
+ {
+ next = seqs[i].getSequenceFeatures();
+ for (int j = 0; j < next.length; j++)
+ {
+ isnonpos = next[j].begin == 0 && next[j].end == 0;
+ if ((!nonpos && isnonpos)
+ || (!isnonpos && visOnly && !visible
+ .containsKey(next[j].type)))
+ {
+ continue;
+ }
+
+ source = next[j].featureGroup;
+ if (source == null)
+ {
+ source = next[j].getDescription();
+ }
+
+ out.append(seqs[i].getName());
+ out.append("\t");
+ out.append(source);
+ out.append("\t");
+ out.append(next[j].type);
+ out.append("\t");
+ out.append(next[j].begin);
+ out.append("\t");
+ out.append(next[j].end);
+ out.append("\t");
+ out.append(next[j].score);
+ out.append("\t");
+
+ if (next[j].getValue("STRAND") != null)
+ {
+ out.append(next[j].getValue("STRAND"));
+ out.append("\t");
+ }
+ else
+ {
+ out.append(".\t");
+ }
+
+ if (next[j].getValue("FRAME") != null)
+ {
+ out.append(next[j].getValue("FRAME"));
+ }
+ else
+ {
+ out.append(".");
+ }
+ // TODO: verify/check GFF - should there be a /t here before attribute
+ // output ?
+
+ if (next[j].getValue("ATTRIBUTES") != null)
+ {
+ out.append(next[j].getValue("ATTRIBUTES"));
+ }
+
+ out.append(newline);
+
+ }
+ }
+ }
+
+ return out.toString();
+ }
+
+ /**
+ * this is only for the benefit of object polymorphism - method does nothing.
+ */
+ public void parse()
+ {
+ // IGNORED
+ }
+
+ /**
+ * this is only for the benefit of object polymorphism - method does nothing.
+ *
+ * @return error message
+ */
+ public String print()
+ {
+ return "USE printGFFFormat() or printJalviewFormat()";
+ }
+
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.io;\r
-\r
-import java.io.IOException;\r
-\r
-/**\r
- * IO for asymmetric matrix with arbitrary dimension with labels, as displayed\r
- * by PCA viewer. Form is: tab separated entity defs header line TITLE\ttitle\r
- * DESC\tdesc PROPERTY\t<id or empty for whole matrix>\tname\ttype\tvalue\r
- * ROW\tRow i label (ID)/tPrinciple text/tprinciple description/t...\r
- * COLUMN\t(similar, optional).. .. <float>\t<float>...(column-wise data for row\r
- * i)\r
- */\r
-\r
-public class MatrixFile extends FileParse\r
-{\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.io;
+
+import java.io.IOException;
+
+/**
+ * IO for asymmetric matrix with arbitrary dimension with labels, as displayed
+ * by PCA viewer. Form is: tab separated entity defs header line TITLE\ttitle
+ * DESC\tdesc PROPERTY\t<id or empty for whole matrix>\tname\ttype\tvalue
+ * ROW\tRow i label (ID)/tPrinciple text/tprinciple description/t...
+ * COLUMN\t(similar, optional).. .. <float>\t<float>...(column-wise data for row
+ * i)
+ */
+
+public class MatrixFile extends FileParse
+{
+
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
package jalview.io;
import java.util.ArrayList;
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-/*\r
- * This extension was written by Benjamin Schuster-Boeckler at sanger.ac.uk\r
- */\r
-package jalview.io;\r
-\r
-import java.io.*;\r
-import java.util.*;\r
-\r
-import com.stevesoft.pat.*;\r
-import jalview.datamodel.*;\r
-import jalview.analysis.Rna;\r
-\r
-// import org.apache.log4j.*;\r
-\r
-/**\r
- * This class is supposed to parse a Stockholm format file into Jalview There\r
- * are TODOs in this class: we do not know what the database source and version\r
- * is for the file when parsing the #GS= AC tag which associates accessions with\r
- * sequences. Database references are also not parsed correctly: a separate\r
- * reference string parser must be added to parse the database reference form\r
- * into Jalview's local representation.\r
- * \r
- * @author bsb at sanger.ac.uk\r
- * @version 0.3 + jalview mods\r
- * \r
- */\r
-public class StockholmFile extends AlignFile\r
-{\r
- // static Logger logger = Logger.getLogger("jalview.io.StockholmFile");\r
-\r
- public StockholmFile()\r
- {\r
- }\r
-\r
- public StockholmFile(String inFile, String type) throws IOException\r
- {\r
- super(inFile, type);\r
- }\r
-\r
- public StockholmFile(FileParse source) throws IOException\r
- {\r
- super(source);\r
- }\r
-\r
- public void initData()\r
- {\r
- super.initData();\r
- }\r
-\r
- /**\r
- * Parse a file in Stockholm format into Jalview's data model. The file has to\r
- * be passed at construction time\r
- * \r
- * @throws IOException\r
- * If there is an error with the input file\r
- */\r
- public void parse() throws IOException\r
- {\r
- StringBuffer treeString = new StringBuffer();\r
- String treeName = null;\r
- // --------------- Variable Definitions -------------------\r
- String line;\r
- String version;\r
- // String id;\r
- Hashtable seqAnn = new Hashtable(); // Sequence related annotations\r
- Hashtable seqs = new Hashtable();\r
- Regex p, r, rend, s, x;\r
-\r
- // Temporary line for processing RNA annotation\r
- // String RNAannot = "";\r
-\r
- // ------------------ Parsing File ----------------------\r
- // First, we have to check that this file has STOCKHOLM format, i.e. the\r
- // first line must match\r
- r = new Regex("# STOCKHOLM ([\\d\\.]+)");\r
- if (!r.search(nextLine()))\r
- {\r
- throw new IOException(\r
- "This file is not in valid STOCKHOLM format: First line does not contain '# STOCKHOLM'");\r
- }\r
- else\r
- {\r
- version = r.stringMatched(1);\r
- // logger.debug("Stockholm version: " + version);\r
- }\r
-\r
- // We define some Regexes here that will be used regularily later\r
- rend = new Regex("^\\s*\\/\\/"); // Find the end of an alignment\r
- p = new Regex("(\\S+)\\/(\\d+)\\-(\\d+)"); // split sequence id in\r
- // id/from/to\r
- s = new Regex("(\\S+)\\s+(\\S*)\\s+(.*)"); // Parses annotation subtype\r
- r = new Regex("#=(G[FSRC]?)\\s+(.*)"); // Finds any annotation line\r
- x = new Regex("(\\S+)\\s+(\\S+)"); // split id from sequence\r
-\r
- // Convert all bracket types to parentheses (necessary for passing to VARNA)\r
- Regex openparen = new Regex("(<|\\[)", "(");\r
- Regex closeparen = new Regex("(>|\\])", ")");\r
-\r
- // Detect if file is RNA by looking for bracket types\r
- Regex detectbrackets = new Regex("(<|>|\\[|\\]|\\(|\\))");\r
-\r
- rend.optimize();\r
- p.optimize();\r
- s.optimize();\r
- r.optimize();\r
- x.optimize();\r
- openparen.optimize();\r
- closeparen.optimize();\r
-\r
- while ((line = nextLine()) != null)\r
- {\r
- if (line.length() == 0)\r
- {\r
- continue;\r
- }\r
- if (rend.search(line))\r
- {\r
- // End of the alignment, pass stuff back\r
-\r
- this.noSeqs = seqs.size();\r
- // logger.debug("Number of sequences: " + this.noSeqs);\r
- Enumeration accs = seqs.keys();\r
- while (accs.hasMoreElements())\r
- {\r
- String acc = (String) accs.nextElement();\r
- // logger.debug("Processing sequence " + acc);\r
- String seq = (String) seqs.remove(acc);\r
- if (maxLength < seq.length())\r
- {\r
- maxLength = seq.length();\r
- }\r
- int start = 1;\r
- int end = -1;\r
- String sid = acc;\r
- /*\r
- * Retrieve hash of annotations for this accession Associate\r
- * Annotation with accession\r
- */\r
- Hashtable accAnnotations = null;\r
-\r
- if (seqAnn != null && seqAnn.containsKey(acc))\r
- {\r
- accAnnotations = (Hashtable) seqAnn.remove(acc);\r
- // TODO: add structures to sequence\r
- }\r
-\r
- // Split accession in id and from/to\r
- if (p.search(acc))\r
- {\r
- sid = p.stringMatched(1);\r
- start = Integer.parseInt(p.stringMatched(2));\r
- end = Integer.parseInt(p.stringMatched(3));\r
- }\r
- // logger.debug(sid + ", " + start + ", " + end);\r
-\r
- Sequence seqO = new Sequence(sid, seq, start, end);\r
- // Add Description (if any)\r
- if (accAnnotations != null && accAnnotations.containsKey("DE"))\r
- {\r
- String desc = (String) accAnnotations.get("DE");\r
- seqO.setDescription((desc == null) ? "" : desc);\r
- }\r
- // Add DB References (if any)\r
- if (accAnnotations != null && accAnnotations.containsKey("DR"))\r
- {\r
- String dbr = (String) accAnnotations.get("DR");\r
- if (dbr != null && dbr.indexOf(";") > -1)\r
- {\r
- String src = dbr.substring(0, dbr.indexOf(";"));\r
- String acn = dbr.substring(dbr.indexOf(";") + 1);\r
- jalview.util.DBRefUtils.parseToDbRef(seqO, src, "0", acn);\r
- // seqO.addDBRef(dbref);\r
- }\r
- }\r
- if (accAnnotations != null && accAnnotations.containsKey("SS"))\r
- {\r
- Vector v = (Vector) accAnnotations.get("SS");\r
-\r
- for (int i = 0; i < v.size(); i++)\r
- {\r
- AlignmentAnnotation an = (AlignmentAnnotation) v.elementAt(i);\r
- seqO.addAlignmentAnnotation(an);\r
- // annotations.add(an);\r
- }\r
- }\r
-\r
- Hashtable features = null;\r
- // We need to adjust the positions of all features to account for gaps\r
- try\r
- {\r
- features = (Hashtable) accAnnotations.remove("features");\r
- } catch (java.lang.NullPointerException e)\r
- {\r
- // loggerwarn("Getting Features for " + acc + ": " +\r
- // e.getMessage());\r
- // continue;\r
- }\r
- // if we have features\r
- if (features != null)\r
- {\r
- int posmap[] = seqO.findPositionMap();\r
- Enumeration i = features.keys();\r
- while (i.hasMoreElements())\r
- {\r
- // TODO: parse out secondary structure annotation as annotation\r
- // row\r
- // TODO: parse out scores as annotation row\r
- // TODO: map coding region to core jalview feature types\r
- String type = i.nextElement().toString();\r
- Hashtable content = (Hashtable) features.remove(type);\r
- Enumeration j = content.keys();\r
- while (j.hasMoreElements())\r
- {\r
- String desc = j.nextElement().toString();\r
- String ns = content.get(desc).toString();\r
- char[] byChar = ns.toCharArray();\r
- for (int k = 0; k < byChar.length; k++)\r
- {\r
- char c = byChar[k];\r
- if (!(c == ' ' || c == '_' || c == '-' || c == '.')) // PFAM\r
- // uses\r
- // '.'\r
- // for\r
- // feature\r
- // background\r
- {\r
- int new_pos = posmap[k]; // look up nearest seqeunce\r
- // position to this column\r
- SequenceFeature feat = new SequenceFeature(type, desc,\r
- new_pos, new_pos, 0f, null);\r
-\r
- seqO.addSequenceFeature(feat);\r
- }\r
- }\r
- }\r
-\r
- }\r
-\r
- }\r
- // garbage collect\r
-\r
- // logger.debug("Adding seq " + acc + " from " + start + " to " + end\r
- // + ": " + seq);\r
- this.seqs.addElement(seqO);\r
- }\r
- return; // finished parsing this segment of source\r
- }\r
- else if (!r.search(line))\r
- {\r
- // System.err.println("Found sequence line: " + line);\r
-\r
- // Split sequence in sequence and accession parts\r
- if (!x.search(line))\r
- {\r
- // logger.error("Could not parse sequence line: " + line);\r
- throw new IOException("Could not parse sequence line: " + line);\r
- }\r
- String ns = (String) seqs.get(x.stringMatched(1));\r
- if (ns == null)\r
- {\r
- ns = "";\r
- }\r
- ns += x.stringMatched(2);\r
-\r
- seqs.put(x.stringMatched(1), ns);\r
- }\r
- else\r
- {\r
- String annType = r.stringMatched(1);\r
- String annContent = r.stringMatched(2);\r
-\r
- // System.err.println("type:" + annType + " content: " + annContent);\r
-\r
- if (annType.equals("GF"))\r
- {\r
- /*\r
- * Generic per-File annotation, free text Magic features: #=GF NH\r
- * <tree in New Hampshire eXtended format> #=GF TN <Unique identifier\r
- * for the next tree> Pfam descriptions: 7. DESCRIPTION OF FIELDS\r
- * \r
- * Compulsory fields: ------------------\r
- * \r
- * AC Accession number: Accession number in form PFxxxxx.version or\r
- * PBxxxxxx. ID Identification: One word name for family. DE\r
- * Definition: Short description of family. AU Author: Authors of the\r
- * entry. SE Source of seed: The source suggesting the seed members\r
- * belong to one family. GA Gathering method: Search threshold to\r
- * build the full alignment. TC Trusted Cutoff: Lowest sequence score\r
- * and domain score of match in the full alignment. NC Noise Cutoff:\r
- * Highest sequence score and domain score of match not in full\r
- * alignment. TP Type: Type of family -- presently Family, Domain,\r
- * Motif or Repeat. SQ Sequence: Number of sequences in alignment. AM\r
- * Alignment Method The order ls and fs hits are aligned to the model\r
- * to build the full align. // End of alignment.\r
- * \r
- * Optional fields: ----------------\r
- * \r
- * DC Database Comment: Comment about database reference. DR Database\r
- * Reference: Reference to external database. RC Reference Comment:\r
- * Comment about literature reference. RN Reference Number: Reference\r
- * Number. RM Reference Medline: Eight digit medline UI number. RT\r
- * Reference Title: Reference Title. RA Reference Author: Reference\r
- * Author RL Reference Location: Journal location. PI Previous\r
- * identifier: Record of all previous ID lines. KW Keywords: Keywords.\r
- * CC Comment: Comments. NE Pfam accession: Indicates a nested domain.\r
- * NL Location: Location of nested domains - sequence ID, start and\r
- * end of insert.\r
- * \r
- * Obsolete fields: ----------- AL Alignment method of seed: The\r
- * method used to align the seed members.\r
- */\r
- // Let's save the annotations, maybe we'll be able to do something\r
- // with them later...\r
- Regex an = new Regex("(\\w+)\\s*(.*)");\r
- if (an.search(annContent))\r
- {\r
- if (an.stringMatched(1).equals("NH"))\r
- {\r
- treeString.append(an.stringMatched(2));\r
- }\r
- else if (an.stringMatched(1).equals("TN"))\r
- {\r
- if (treeString.length() > 0)\r
- {\r
- if (treeName == null)\r
- {\r
- treeName = "Tree " + (getTreeCount() + 1);\r
- }\r
- addNewickTree(treeName, treeString.toString());\r
- }\r
- treeName = an.stringMatched(2);\r
- treeString = new StringBuffer();\r
- }\r
- setAlignmentProperty(an.stringMatched(1), an.stringMatched(2));\r
- }\r
- }\r
- else if (annType.equals("GS"))\r
- {\r
- // Generic per-Sequence annotation, free text\r
- /*\r
- * Pfam uses these features: Feature Description ---------------------\r
- * ----------- AC <accession> ACcession number DE <freetext>\r
- * DEscription DR <db>; <accession>; Database Reference OS <organism>\r
- * OrganiSm (species) OC <clade> Organism Classification (clade, etc.)\r
- * LO <look> Look (Color, etc.)\r
- */\r
- if (s.search(annContent))\r
- {\r
- String acc = s.stringMatched(1);\r
- String type = s.stringMatched(2);\r
- String content = s.stringMatched(3);\r
- // TODO: store DR in a vector.\r
- // TODO: store AC according to generic file db annotation.\r
- Hashtable ann;\r
- if (seqAnn.containsKey(acc))\r
- {\r
- ann = (Hashtable) seqAnn.get(acc);\r
- }\r
- else\r
- {\r
- ann = new Hashtable();\r
- }\r
- ann.put(type, content);\r
- seqAnn.put(acc, ann);\r
- }\r
- else\r
- {\r
- throw new IOException("Error parsing " + line);\r
- }\r
- }\r
- else if (annType.equals("GC"))\r
- {\r
- // Generic per-Column annotation, exactly 1 char per column\r
- // always need a label.\r
- if (x.search(annContent))\r
- {\r
- // parse out and create alignment annotation directly.\r
- parseAnnotationRow(annotations, x.stringMatched(1),\r
- x.stringMatched(2));\r
- }\r
- }\r
- else if (annType.equals("GR"))\r
- {\r
- // Generic per-Sequence AND per-Column markup, exactly 1 char per\r
- // column\r
- /*\r
- * Feature Description Markup letters ------- -----------\r
- * -------------- SS Secondary Structure [HGIEBTSCX] SA Surface\r
- * Accessibility [0-9X] (0=0%-10%; ...; 9=90%-100%) TM TransMembrane\r
- * [Mio] PP Posterior Probability [0-9*] (0=0.00-0.05; 1=0.05-0.15;\r
- * *=0.95-1.00) LI LIgand binding [*] AS Active Site [*] IN INtron (in\r
- * or after) [0-2]\r
- */\r
- if (s.search(annContent))\r
- {\r
- String acc = s.stringMatched(1);\r
- String type = s.stringMatched(2);\r
- String seq = new String(s.stringMatched(3));\r
- String description = null;\r
- // Check for additional information about the current annotation\r
- // We use a simple string tokenizer here for speed\r
- StringTokenizer sep = new StringTokenizer(seq, " \t");\r
- description = sep.nextToken();\r
- if (sep.hasMoreTokens())\r
- {\r
- seq = sep.nextToken();\r
- }\r
- else\r
- {\r
- seq = description;\r
- description = new String();\r
- }\r
- // sequence id with from-to fields\r
-\r
- Hashtable ann;\r
- // Get an object with all the annotations for this sequence\r
- if (seqAnn.containsKey(acc))\r
- {\r
- // logger.debug("Found annotations for " + acc);\r
- ann = (Hashtable) seqAnn.get(acc);\r
- }\r
- else\r
- {\r
- // logger.debug("Creating new annotations holder for " + acc);\r
- ann = new Hashtable();\r
- seqAnn.put(acc, ann);\r
- }\r
- // TODO test structure, call parseAnnotationRow with vector from\r
- // hashtable for specific sequence\r
- Hashtable features;\r
- // Get an object with all the content for an annotation\r
- if (ann.containsKey("features"))\r
- {\r
- // logger.debug("Found features for " + acc);\r
- features = (Hashtable) ann.get("features");\r
- }\r
- else\r
- {\r
- // logger.debug("Creating new features holder for " + acc);\r
- features = new Hashtable();\r
- ann.put("features", features);\r
- }\r
-\r
- Hashtable content;\r
- if (features.containsKey(this.id2type(type)))\r
- {\r
- // logger.debug("Found content for " + this.id2type(type));\r
- content = (Hashtable) features.get(this.id2type(type));\r
- }\r
- else\r
- {\r
- // logger.debug("Creating new content holder for " +\r
- // this.id2type(type));\r
- content = new Hashtable();\r
- features.put(this.id2type(type), content);\r
- }\r
- String ns = (String) content.get(description);\r
- if (ns == null)\r
- {\r
- ns = "";\r
- }\r
- ns += seq;\r
- content.put(description, ns);\r
-\r
- if (type.equals("SS"))\r
- {\r
- Hashtable strucAnn;\r
- if (seqAnn.containsKey(acc))\r
- {\r
- strucAnn = (Hashtable) seqAnn.get(acc);\r
- }\r
- else\r
- {\r
- strucAnn = new Hashtable();\r
- }\r
-\r
- Vector newStruc = new Vector();\r
- parseAnnotationRow(newStruc, type, ns);\r
-\r
- strucAnn.put(type, newStruc);\r
- seqAnn.put(acc, strucAnn);\r
- }\r
- }\r
- else\r
- {\r
- System.err\r
- .println("Warning - couldn't parse sequence annotation row line:\n"\r
- + line);\r
- // throw new IOException("Error parsing " + line);\r
- }\r
- }\r
- else\r
- {\r
- throw new IOException("Unknown annotation detected: " + annType\r
- + " " + annContent);\r
- }\r
- }\r
- }\r
- if (treeString.length() > 0)\r
- {\r
- if (treeName == null)\r
- {\r
- treeName = "Tree " + (1 + getTreeCount());\r
- }\r
- addNewickTree(treeName, treeString.toString());\r
- }\r
- }\r
-\r
- protected static AlignmentAnnotation parseAnnotationRow(\r
- Vector annotation, String label, String annots)\r
- {\r
- String convert1, convert2 = null;\r
-\r
- // Convert all bracket types to parentheses\r
- Regex openparen = new Regex("(<|\\[)", "(");\r
- Regex closeparen = new Regex("(>|\\])", ")");\r
-\r
- // Detect if file is RNA by looking for bracket types\r
- Regex detectbrackets = new Regex("(<|>|\\[|\\]|\\(|\\))");\r
-\r
- convert1 = openparen.replaceAll(annots);\r
- convert2 = closeparen.replaceAll(convert1);\r
- annots = convert2;\r
-\r
- String type = (label.indexOf("_cons") == label.length() - 5) ? label\r
- .substring(0, label.length() - 5) : label;\r
- boolean ss = false;\r
- type = id2type(type);\r
- if (type.equals("secondary structure"))\r
- {\r
- ss = true;\r
- }\r
- // decide on secondary structure or not.\r
- Annotation[] els = new Annotation[annots.length()];\r
- for (int i = 0; i < annots.length(); i++)\r
- {\r
- String pos = annots.substring(i, i + 1);\r
- Annotation ann;\r
- ann = new Annotation(pos, "", ' ', 0f); // 0f is 'valid' null - will not\r
- // be written out\r
- if (ss)\r
- {\r
- if (detectbrackets.search(pos))\r
- {\r
- ann.secondaryStructure = jalview.schemes.ResidueProperties\r
- .getRNASecStrucState(pos).charAt(0);\r
- }\r
- else\r
- {\r
- ann.secondaryStructure = jalview.schemes.ResidueProperties\r
- .getDssp3state(pos).charAt(0);\r
- }\r
-\r
- if (ann.secondaryStructure == pos.charAt(0) || pos.charAt(0) == 'C')\r
- {\r
- ann.displayCharacter = ""; // null; // " ";\r
- }\r
- else\r
- {\r
- ann.displayCharacter = " " + ann.displayCharacter;\r
- }\r
- }\r
-\r
- els[i] = ann;\r
- }\r
- AlignmentAnnotation annot = null;\r
- Enumeration e = annotation.elements();\r
- while (e.hasMoreElements())\r
- {\r
- annot = (AlignmentAnnotation) e.nextElement();\r
- if (annot.label.equals(type))\r
- break;\r
- annot = null;\r
- }\r
- if (annot == null)\r
- {\r
- annot = new AlignmentAnnotation(type, type, els);\r
- annotation.addElement(annot);\r
- }\r
- else\r
- {\r
- Annotation[] anns = new Annotation[annot.annotations.length\r
- + els.length];\r
- System.arraycopy(annot.annotations, 0, anns, 0,\r
- annot.annotations.length);\r
- System.arraycopy(els, 0, anns, annot.annotations.length, els.length);\r
- annot.annotations = anns;\r
- // System.out.println("else: ");\r
- }\r
- return annot;\r
- }\r
-\r
- public static String print(SequenceI[] s)\r
- {\r
- return "not yet implemented";\r
- }\r
-\r
- public String print()\r
- {\r
- return print(getSeqsAsArray());\r
- }\r
-\r
- private static Hashtable typeIds = null;\r
- static\r
- {\r
- if (typeIds == null)\r
- {\r
- typeIds = new Hashtable();\r
- typeIds.put("SS", "secondary structure");\r
- typeIds.put("SA", "surface accessibility");\r
- typeIds.put("TM", "transmembrane");\r
- typeIds.put("PP", "posterior probability");\r
- typeIds.put("LI", "ligand binding");\r
- typeIds.put("AS", "active site");\r
- typeIds.put("IN", "intron");\r
- typeIds.put("IR", "interacting residue");\r
- typeIds.put("AC", "accession");\r
- typeIds.put("OS", "organism");\r
- typeIds.put("CL", "class");\r
- typeIds.put("DE", "description");\r
- typeIds.put("DR", "reference");\r
- typeIds.put("LO", "look");\r
- typeIds.put("RF", "reference positions");\r
-\r
- }\r
- }\r
-\r
- protected static String id2type(String id)\r
- {\r
- if (typeIds.containsKey(id))\r
- {\r
- return (String) typeIds.get(id);\r
- }\r
- System.err.println("Warning : Unknown Stockholm annotation type code "\r
- + id);\r
- return id;\r
- }\r
- /**\r
- * //ssline is complete secondary structure line private AlignmentAnnotation\r
- * addHelices(Vector annotation, String label, String ssline) {\r
- * \r
- * // decide on secondary structure or not. Annotation[] els = new\r
- * Annotation[ssline.length()]; for (int i = 0; i < ssline.length(); i++) {\r
- * String pos = ssline.substring(i, i + 1); Annotation ann; ann = new\r
- * Annotation(pos, "", ' ', 0f); // 0f is 'valid' null - will not\r
- * \r
- * ann.secondaryStructure =\r
- * jalview.schemes.ResidueProperties.getRNAssState(pos).charAt(0);\r
- * \r
- * ann.displayCharacter = "x" + ann.displayCharacter;\r
- * \r
- * System.out.println(ann.displayCharacter);\r
- * \r
- * els[i] = ann; } AlignmentAnnotation helicesAnnot = null; Enumeration e =\r
- * annotation.elements(); while (e.hasMoreElements()) { helicesAnnot =\r
- * (AlignmentAnnotation) e.nextElement(); if (helicesAnnot.label.equals(type))\r
- * break; helicesAnnot = null; } if (helicesAnnot == null) { helicesAnnot =\r
- * new AlignmentAnnotation(type, type, els);\r
- * annotation.addElement(helicesAnnot); } else { Annotation[] anns = new\r
- * Annotation[helicesAnnot.annotations.length + els.length];\r
- * System.arraycopy(helicesAnnot.annotations, 0, anns, 0,\r
- * helicesAnnot.annotations.length); System.arraycopy(els, 0, anns,\r
- * helicesAnnot.annotations.length, els.length); helicesAnnot.annotations =\r
- * anns; }\r
- * \r
- * helicesAnnot.features = Rna.GetBasePairs(ssline);\r
- * Rna.HelixMap(helicesAnnot.features);\r
- * \r
- * \r
- * return helicesAnnot; }\r
- */\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+/*
+ * This extension was written by Benjamin Schuster-Boeckler at sanger.ac.uk
+ */
+package jalview.io;
+
+import java.io.*;
+import java.util.*;
+
+import com.stevesoft.pat.*;
+import jalview.datamodel.*;
+import jalview.analysis.Rna;
+
+// import org.apache.log4j.*;
+
+/**
+ * This class is supposed to parse a Stockholm format file into Jalview There
+ * are TODOs in this class: we do not know what the database source and version
+ * is for the file when parsing the #GS= AC tag which associates accessions with
+ * sequences. Database references are also not parsed correctly: a separate
+ * reference string parser must be added to parse the database reference form
+ * into Jalview's local representation.
+ *
+ * @author bsb at sanger.ac.uk
+ * @version 0.3 + jalview mods
+ *
+ */
+public class StockholmFile extends AlignFile
+{
+ // static Logger logger = Logger.getLogger("jalview.io.StockholmFile");
+
+ public StockholmFile()
+ {
+ }
+
+ public StockholmFile(String inFile, String type) throws IOException
+ {
+ super(inFile, type);
+ }
+
+ public StockholmFile(FileParse source) throws IOException
+ {
+ super(source);
+ }
+
+ public void initData()
+ {
+ super.initData();
+ }
+
+ /**
+ * Parse a file in Stockholm format into Jalview's data model. The file has to
+ * be passed at construction time
+ *
+ * @throws IOException
+ * If there is an error with the input file
+ */
+ public void parse() throws IOException
+ {
+ StringBuffer treeString = new StringBuffer();
+ String treeName = null;
+ // --------------- Variable Definitions -------------------
+ String line;
+ String version;
+ // String id;
+ Hashtable seqAnn = new Hashtable(); // Sequence related annotations
+ Hashtable seqs = new Hashtable();
+ Regex p, r, rend, s, x;
+
+ // Temporary line for processing RNA annotation
+ // String RNAannot = "";
+
+ // ------------------ Parsing File ----------------------
+ // First, we have to check that this file has STOCKHOLM format, i.e. the
+ // first line must match
+ r = new Regex("# STOCKHOLM ([\\d\\.]+)");
+ if (!r.search(nextLine()))
+ {
+ throw new IOException(
+ "This file is not in valid STOCKHOLM format: First line does not contain '# STOCKHOLM'");
+ }
+ else
+ {
+ version = r.stringMatched(1);
+ // logger.debug("Stockholm version: " + version);
+ }
+
+ // We define some Regexes here that will be used regularily later
+ rend = new Regex("^\\s*\\/\\/"); // Find the end of an alignment
+ p = new Regex("(\\S+)\\/(\\d+)\\-(\\d+)"); // split sequence id in
+ // id/from/to
+ s = new Regex("(\\S+)\\s+(\\S*)\\s+(.*)"); // Parses annotation subtype
+ r = new Regex("#=(G[FSRC]?)\\s+(.*)"); // Finds any annotation line
+ x = new Regex("(\\S+)\\s+(\\S+)"); // split id from sequence
+
+ // Convert all bracket types to parentheses (necessary for passing to VARNA)
+ Regex openparen = new Regex("(<|\\[)", "(");
+ Regex closeparen = new Regex("(>|\\])", ")");
+
+ // Detect if file is RNA by looking for bracket types
+ Regex detectbrackets = new Regex("(<|>|\\[|\\]|\\(|\\))");
+
+ rend.optimize();
+ p.optimize();
+ s.optimize();
+ r.optimize();
+ x.optimize();
+ openparen.optimize();
+ closeparen.optimize();
+
+ while ((line = nextLine()) != null)
+ {
+ if (line.length() == 0)
+ {
+ continue;
+ }
+ if (rend.search(line))
+ {
+ // End of the alignment, pass stuff back
+
+ this.noSeqs = seqs.size();
+ // logger.debug("Number of sequences: " + this.noSeqs);
+ Enumeration accs = seqs.keys();
+ while (accs.hasMoreElements())
+ {
+ String acc = (String) accs.nextElement();
+ // logger.debug("Processing sequence " + acc);
+ String seq = (String) seqs.remove(acc);
+ if (maxLength < seq.length())
+ {
+ maxLength = seq.length();
+ }
+ int start = 1;
+ int end = -1;
+ String sid = acc;
+ /*
+ * Retrieve hash of annotations for this accession Associate
+ * Annotation with accession
+ */
+ Hashtable accAnnotations = null;
+
+ if (seqAnn != null && seqAnn.containsKey(acc))
+ {
+ accAnnotations = (Hashtable) seqAnn.remove(acc);
+ // TODO: add structures to sequence
+ }
+
+ // Split accession in id and from/to
+ if (p.search(acc))
+ {
+ sid = p.stringMatched(1);
+ start = Integer.parseInt(p.stringMatched(2));
+ end = Integer.parseInt(p.stringMatched(3));
+ }
+ // logger.debug(sid + ", " + start + ", " + end);
+
+ Sequence seqO = new Sequence(sid, seq, start, end);
+ // Add Description (if any)
+ if (accAnnotations != null && accAnnotations.containsKey("DE"))
+ {
+ String desc = (String) accAnnotations.get("DE");
+ seqO.setDescription((desc == null) ? "" : desc);
+ }
+ // Add DB References (if any)
+ if (accAnnotations != null && accAnnotations.containsKey("DR"))
+ {
+ String dbr = (String) accAnnotations.get("DR");
+ if (dbr != null && dbr.indexOf(";") > -1)
+ {
+ String src = dbr.substring(0, dbr.indexOf(";"));
+ String acn = dbr.substring(dbr.indexOf(";") + 1);
+ jalview.util.DBRefUtils.parseToDbRef(seqO, src, "0", acn);
+ // seqO.addDBRef(dbref);
+ }
+ }
+ if (accAnnotations != null && accAnnotations.containsKey("SS"))
+ {
+ Vector v = (Vector) accAnnotations.get("SS");
+
+ for (int i = 0; i < v.size(); i++)
+ {
+ AlignmentAnnotation an = (AlignmentAnnotation) v.elementAt(i);
+ seqO.addAlignmentAnnotation(an);
+ // annotations.add(an);
+ }
+ }
+
+ Hashtable features = null;
+ // We need to adjust the positions of all features to account for gaps
+ try
+ {
+ features = (Hashtable) accAnnotations.remove("features");
+ } catch (java.lang.NullPointerException e)
+ {
+ // loggerwarn("Getting Features for " + acc + ": " +
+ // e.getMessage());
+ // continue;
+ }
+ // if we have features
+ if (features != null)
+ {
+ int posmap[] = seqO.findPositionMap();
+ Enumeration i = features.keys();
+ while (i.hasMoreElements())
+ {
+ // TODO: parse out secondary structure annotation as annotation
+ // row
+ // TODO: parse out scores as annotation row
+ // TODO: map coding region to core jalview feature types
+ String type = i.nextElement().toString();
+ Hashtable content = (Hashtable) features.remove(type);
+ Enumeration j = content.keys();
+ while (j.hasMoreElements())
+ {
+ String desc = j.nextElement().toString();
+ String ns = content.get(desc).toString();
+ char[] byChar = ns.toCharArray();
+ for (int k = 0; k < byChar.length; k++)
+ {
+ char c = byChar[k];
+ if (!(c == ' ' || c == '_' || c == '-' || c == '.')) // PFAM
+ // uses
+ // '.'
+ // for
+ // feature
+ // background
+ {
+ int new_pos = posmap[k]; // look up nearest seqeunce
+ // position to this column
+ SequenceFeature feat = new SequenceFeature(type, desc,
+ new_pos, new_pos, 0f, null);
+
+ seqO.addSequenceFeature(feat);
+ }
+ }
+ }
+
+ }
+
+ }
+ // garbage collect
+
+ // logger.debug("Adding seq " + acc + " from " + start + " to " + end
+ // + ": " + seq);
+ this.seqs.addElement(seqO);
+ }
+ return; // finished parsing this segment of source
+ }
+ else if (!r.search(line))
+ {
+ // System.err.println("Found sequence line: " + line);
+
+ // Split sequence in sequence and accession parts
+ if (!x.search(line))
+ {
+ // logger.error("Could not parse sequence line: " + line);
+ throw new IOException("Could not parse sequence line: " + line);
+ }
+ String ns = (String) seqs.get(x.stringMatched(1));
+ if (ns == null)
+ {
+ ns = "";
+ }
+ ns += x.stringMatched(2);
+
+ seqs.put(x.stringMatched(1), ns);
+ }
+ else
+ {
+ String annType = r.stringMatched(1);
+ String annContent = r.stringMatched(2);
+
+ // System.err.println("type:" + annType + " content: " + annContent);
+
+ if (annType.equals("GF"))
+ {
+ /*
+ * Generic per-File annotation, free text Magic features: #=GF NH
+ * <tree in New Hampshire eXtended format> #=GF TN <Unique identifier
+ * for the next tree> Pfam descriptions: 7. DESCRIPTION OF FIELDS
+ *
+ * Compulsory fields: ------------------
+ *
+ * AC Accession number: Accession number in form PFxxxxx.version or
+ * PBxxxxxx. ID Identification: One word name for family. DE
+ * Definition: Short description of family. AU Author: Authors of the
+ * entry. SE Source of seed: The source suggesting the seed members
+ * belong to one family. GA Gathering method: Search threshold to
+ * build the full alignment. TC Trusted Cutoff: Lowest sequence score
+ * and domain score of match in the full alignment. NC Noise Cutoff:
+ * Highest sequence score and domain score of match not in full
+ * alignment. TP Type: Type of family -- presently Family, Domain,
+ * Motif or Repeat. SQ Sequence: Number of sequences in alignment. AM
+ * Alignment Method The order ls and fs hits are aligned to the model
+ * to build the full align. // End of alignment.
+ *
+ * Optional fields: ----------------
+ *
+ * DC Database Comment: Comment about database reference. DR Database
+ * Reference: Reference to external database. RC Reference Comment:
+ * Comment about literature reference. RN Reference Number: Reference
+ * Number. RM Reference Medline: Eight digit medline UI number. RT
+ * Reference Title: Reference Title. RA Reference Author: Reference
+ * Author RL Reference Location: Journal location. PI Previous
+ * identifier: Record of all previous ID lines. KW Keywords: Keywords.
+ * CC Comment: Comments. NE Pfam accession: Indicates a nested domain.
+ * NL Location: Location of nested domains - sequence ID, start and
+ * end of insert.
+ *
+ * Obsolete fields: ----------- AL Alignment method of seed: The
+ * method used to align the seed members.
+ */
+ // Let's save the annotations, maybe we'll be able to do something
+ // with them later...
+ Regex an = new Regex("(\\w+)\\s*(.*)");
+ if (an.search(annContent))
+ {
+ if (an.stringMatched(1).equals("NH"))
+ {
+ treeString.append(an.stringMatched(2));
+ }
+ else if (an.stringMatched(1).equals("TN"))
+ {
+ if (treeString.length() > 0)
+ {
+ if (treeName == null)
+ {
+ treeName = "Tree " + (getTreeCount() + 1);
+ }
+ addNewickTree(treeName, treeString.toString());
+ }
+ treeName = an.stringMatched(2);
+ treeString = new StringBuffer();
+ }
+ setAlignmentProperty(an.stringMatched(1), an.stringMatched(2));
+ }
+ }
+ else if (annType.equals("GS"))
+ {
+ // Generic per-Sequence annotation, free text
+ /*
+ * Pfam uses these features: Feature Description ---------------------
+ * ----------- AC <accession> ACcession number DE <freetext>
+ * DEscription DR <db>; <accession>; Database Reference OS <organism>
+ * OrganiSm (species) OC <clade> Organism Classification (clade, etc.)
+ * LO <look> Look (Color, etc.)
+ */
+ if (s.search(annContent))
+ {
+ String acc = s.stringMatched(1);
+ String type = s.stringMatched(2);
+ String content = s.stringMatched(3);
+ // TODO: store DR in a vector.
+ // TODO: store AC according to generic file db annotation.
+ Hashtable ann;
+ if (seqAnn.containsKey(acc))
+ {
+ ann = (Hashtable) seqAnn.get(acc);
+ }
+ else
+ {
+ ann = new Hashtable();
+ }
+ ann.put(type, content);
+ seqAnn.put(acc, ann);
+ }
+ else
+ {
+ throw new IOException("Error parsing " + line);
+ }
+ }
+ else if (annType.equals("GC"))
+ {
+ // Generic per-Column annotation, exactly 1 char per column
+ // always need a label.
+ if (x.search(annContent))
+ {
+ // parse out and create alignment annotation directly.
+ parseAnnotationRow(annotations, x.stringMatched(1),
+ x.stringMatched(2));
+ }
+ }
+ else if (annType.equals("GR"))
+ {
+ // Generic per-Sequence AND per-Column markup, exactly 1 char per
+ // column
+ /*
+ * Feature Description Markup letters ------- -----------
+ * -------------- SS Secondary Structure [HGIEBTSCX] SA Surface
+ * Accessibility [0-9X] (0=0%-10%; ...; 9=90%-100%) TM TransMembrane
+ * [Mio] PP Posterior Probability [0-9*] (0=0.00-0.05; 1=0.05-0.15;
+ * *=0.95-1.00) LI LIgand binding [*] AS Active Site [*] IN INtron (in
+ * or after) [0-2]
+ */
+ if (s.search(annContent))
+ {
+ String acc = s.stringMatched(1);
+ String type = s.stringMatched(2);
+ String seq = new String(s.stringMatched(3));
+ String description = null;
+ // Check for additional information about the current annotation
+ // We use a simple string tokenizer here for speed
+ StringTokenizer sep = new StringTokenizer(seq, " \t");
+ description = sep.nextToken();
+ if (sep.hasMoreTokens())
+ {
+ seq = sep.nextToken();
+ }
+ else
+ {
+ seq = description;
+ description = new String();
+ }
+ // sequence id with from-to fields
+
+ Hashtable ann;
+ // Get an object with all the annotations for this sequence
+ if (seqAnn.containsKey(acc))
+ {
+ // logger.debug("Found annotations for " + acc);
+ ann = (Hashtable) seqAnn.get(acc);
+ }
+ else
+ {
+ // logger.debug("Creating new annotations holder for " + acc);
+ ann = new Hashtable();
+ seqAnn.put(acc, ann);
+ }
+ // TODO test structure, call parseAnnotationRow with vector from
+ // hashtable for specific sequence
+ Hashtable features;
+ // Get an object with all the content for an annotation
+ if (ann.containsKey("features"))
+ {
+ // logger.debug("Found features for " + acc);
+ features = (Hashtable) ann.get("features");
+ }
+ else
+ {
+ // logger.debug("Creating new features holder for " + acc);
+ features = new Hashtable();
+ ann.put("features", features);
+ }
+
+ Hashtable content;
+ if (features.containsKey(this.id2type(type)))
+ {
+ // logger.debug("Found content for " + this.id2type(type));
+ content = (Hashtable) features.get(this.id2type(type));
+ }
+ else
+ {
+ // logger.debug("Creating new content holder for " +
+ // this.id2type(type));
+ content = new Hashtable();
+ features.put(this.id2type(type), content);
+ }
+ String ns = (String) content.get(description);
+ if (ns == null)
+ {
+ ns = "";
+ }
+ ns += seq;
+ content.put(description, ns);
+
+ if (type.equals("SS"))
+ {
+ Hashtable strucAnn;
+ if (seqAnn.containsKey(acc))
+ {
+ strucAnn = (Hashtable) seqAnn.get(acc);
+ }
+ else
+ {
+ strucAnn = new Hashtable();
+ }
+
+ Vector newStruc = new Vector();
+ parseAnnotationRow(newStruc, type, ns);
+
+ strucAnn.put(type, newStruc);
+ seqAnn.put(acc, strucAnn);
+ }
+ }
+ else
+ {
+ System.err
+ .println("Warning - couldn't parse sequence annotation row line:\n"
+ + line);
+ // throw new IOException("Error parsing " + line);
+ }
+ }
+ else
+ {
+ throw new IOException("Unknown annotation detected: " + annType
+ + " " + annContent);
+ }
+ }
+ }
+ if (treeString.length() > 0)
+ {
+ if (treeName == null)
+ {
+ treeName = "Tree " + (1 + getTreeCount());
+ }
+ addNewickTree(treeName, treeString.toString());
+ }
+ }
+
+ protected static AlignmentAnnotation parseAnnotationRow(
+ Vector annotation, String label, String annots)
+ {
+ String convert1, convert2 = null;
+
+ // Convert all bracket types to parentheses
+ Regex openparen = new Regex("(<|\\[)", "(");
+ Regex closeparen = new Regex("(>|\\])", ")");
+
+ // Detect if file is RNA by looking for bracket types
+ Regex detectbrackets = new Regex("(<|>|\\[|\\]|\\(|\\))");
+
+ convert1 = openparen.replaceAll(annots);
+ convert2 = closeparen.replaceAll(convert1);
+ annots = convert2;
+
+ String type = (label.indexOf("_cons") == label.length() - 5) ? label
+ .substring(0, label.length() - 5) : label;
+ boolean ss = false;
+ type = id2type(type);
+ if (type.equals("secondary structure"))
+ {
+ ss = true;
+ }
+ // decide on secondary structure or not.
+ Annotation[] els = new Annotation[annots.length()];
+ for (int i = 0; i < annots.length(); i++)
+ {
+ String pos = annots.substring(i, i + 1);
+ Annotation ann;
+ ann = new Annotation(pos, "", ' ', 0f); // 0f is 'valid' null - will not
+ // be written out
+ if (ss)
+ {
+ if (detectbrackets.search(pos))
+ {
+ ann.secondaryStructure = jalview.schemes.ResidueProperties
+ .getRNASecStrucState(pos).charAt(0);
+ }
+ else
+ {
+ ann.secondaryStructure = jalview.schemes.ResidueProperties
+ .getDssp3state(pos).charAt(0);
+ }
+
+ if (ann.secondaryStructure == pos.charAt(0) || pos.charAt(0) == 'C')
+ {
+ ann.displayCharacter = ""; // null; // " ";
+ }
+ else
+ {
+ ann.displayCharacter = " " + ann.displayCharacter;
+ }
+ }
+
+ els[i] = ann;
+ }
+ AlignmentAnnotation annot = null;
+ Enumeration e = annotation.elements();
+ while (e.hasMoreElements())
+ {
+ annot = (AlignmentAnnotation) e.nextElement();
+ if (annot.label.equals(type))
+ break;
+ annot = null;
+ }
+ if (annot == null)
+ {
+ annot = new AlignmentAnnotation(type, type, els);
+ annotation.addElement(annot);
+ }
+ else
+ {
+ Annotation[] anns = new Annotation[annot.annotations.length
+ + els.length];
+ System.arraycopy(annot.annotations, 0, anns, 0,
+ annot.annotations.length);
+ System.arraycopy(els, 0, anns, annot.annotations.length, els.length);
+ annot.annotations = anns;
+ // System.out.println("else: ");
+ }
+ return annot;
+ }
+
+ public static String print(SequenceI[] s)
+ {
+ return "not yet implemented";
+ }
+
+ public String print()
+ {
+ return print(getSeqsAsArray());
+ }
+
+ private static Hashtable typeIds = null;
+ static
+ {
+ if (typeIds == null)
+ {
+ typeIds = new Hashtable();
+ typeIds.put("SS", "secondary structure");
+ typeIds.put("SA", "surface accessibility");
+ typeIds.put("TM", "transmembrane");
+ typeIds.put("PP", "posterior probability");
+ typeIds.put("LI", "ligand binding");
+ typeIds.put("AS", "active site");
+ typeIds.put("IN", "intron");
+ typeIds.put("IR", "interacting residue");
+ typeIds.put("AC", "accession");
+ typeIds.put("OS", "organism");
+ typeIds.put("CL", "class");
+ typeIds.put("DE", "description");
+ typeIds.put("DR", "reference");
+ typeIds.put("LO", "look");
+ typeIds.put("RF", "reference positions");
+
+ }
+ }
+
+ protected static String id2type(String id)
+ {
+ if (typeIds.containsKey(id))
+ {
+ return (String) typeIds.get(id);
+ }
+ System.err.println("Warning : Unknown Stockholm annotation type code "
+ + id);
+ return id;
+ }
+ /**
+ * //ssline is complete secondary structure line private AlignmentAnnotation
+ * addHelices(Vector annotation, String label, String ssline) {
+ *
+ * // decide on secondary structure or not. Annotation[] els = new
+ * Annotation[ssline.length()]; for (int i = 0; i < ssline.length(); i++) {
+ * String pos = ssline.substring(i, i + 1); Annotation ann; ann = new
+ * Annotation(pos, "", ' ', 0f); // 0f is 'valid' null - will not
+ *
+ * ann.secondaryStructure =
+ * jalview.schemes.ResidueProperties.getRNAssState(pos).charAt(0);
+ *
+ * ann.displayCharacter = "x" + ann.displayCharacter;
+ *
+ * System.out.println(ann.displayCharacter);
+ *
+ * els[i] = ann; } AlignmentAnnotation helicesAnnot = null; Enumeration e =
+ * annotation.elements(); while (e.hasMoreElements()) { helicesAnnot =
+ * (AlignmentAnnotation) e.nextElement(); if (helicesAnnot.label.equals(type))
+ * break; helicesAnnot = null; } if (helicesAnnot == null) { helicesAnnot =
+ * new AlignmentAnnotation(type, type, els);
+ * annotation.addElement(helicesAnnot); } else { Annotation[] anns = new
+ * Annotation[helicesAnnot.annotations.length + els.length];
+ * System.arraycopy(helicesAnnot.annotations, 0, anns, 0,
+ * helicesAnnot.annotations.length); System.arraycopy(els, 0, anns,
+ * helicesAnnot.annotations.length, els.length); helicesAnnot.annotations =
+ * anns; }
+ *
+ * helicesAnnot.features = Rna.GetBasePairs(ssline);
+ * Rna.HelixMap(helicesAnnot.features);
+ *
+ *
+ * return helicesAnnot; }
+ */
+}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
package jalview.io;
import jalview.analysis.SequenceIdMatcher;
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
package jalview.io;
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ */
+
package jalview.io.packed;
/**
* @return
*/
DataProvider.JvDataType getType();
-}
\ No newline at end of file
+}
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ */
+
package jalview.io.packed;
import jalview.datamodel.AlignmentI;
{
getLastAlignmentSet().updateSetModified(modified);
}
-}
\ No newline at end of file
+}
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ */
package jalview.io.packed;
import jalview.datamodel.AlignmentI;
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ */
package jalview.io.packed;
import jalview.io.FileParse;
return jvtype;
}
-}
\ No newline at end of file
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.io.vamsas;\r
-\r
-import jalview.datamodel.AlignmentI;\r
-import jalview.datamodel.DBRefEntry;\r
-import jalview.datamodel.SequenceI;\r
-import jalview.io.VamsasAppDatastore;\r
-import uk.ac.vamsas.objects.core.DataSet;\r
-import uk.ac.vamsas.objects.core.DbRef;\r
-import uk.ac.vamsas.objects.core.Sequence;\r
-\r
-/**\r
- * synchronize a vamsas dataset sequence with a jalview dataset sequence. This\r
- * class deals with all sequence features and database references associated\r
- * with the jalview sequence.\r
- * \r
- * @author JimP\r
- * \r
- */\r
-public class Datasetsequence extends DatastoreItem\r
-{\r
- String dict;\r
-\r
- private DataSet dataset;\r
-\r
- // private AlignmentI jvdset;\r
-\r
- public Datasetsequence(VamsasAppDatastore vamsasAppDatastore,\r
- SequenceI sq, String dict, DataSet dataset)\r
- {\r
- super(vamsasAppDatastore, sq, uk.ac.vamsas.objects.core.Sequence.class);\r
- this.dataset = dataset;\r
- // this.jvdset = jvdset;\r
- this.dict = dict;\r
- doSync();\r
- }\r
-\r
- public Datasetsequence(VamsasAppDatastore vamsasAppDatastore,\r
- Sequence vdseq)\r
- {\r
- super(vamsasAppDatastore, vdseq, SequenceI.class);\r
- doJvUpdate();\r
- }\r
-\r
- public void addFromDocument()\r
- {\r
- Sequence vseq = (Sequence) vobj;\r
- SequenceI dsseq = new jalview.datamodel.Sequence(vseq.getName(),\r
- vseq.getSequence(), (int) vseq.getStart(), (int) vseq.getEnd());\r
- dsseq.setDescription(vseq.getDescription());\r
- bindjvvobj(dsseq, vseq);\r
- dsseq.setVamsasId(vseq.getVorbaId().getId());\r
- jvobj = dsseq;\r
- modified = true;\r
- }\r
-\r
- public void updateFromDoc()\r
- {\r
- Sequence sq = (Sequence) vobj;\r
- SequenceI sequence = (SequenceI) jvobj;\r
- if (!sequence.getSequenceAsString().equals(sq.getSequence()))\r
- {\r
- log.warn("Potential Client Error ! - mismatch of dataset sequence: and jalview internal dataset sequence.");\r
- }\r
- else\r
- {\r
- // verify and update principal attributes.\r
- if (sequence.getDescription() != null\r
- && (sequence.getDescription() == null || !sequence\r
- .getDescription().equals(sq.getDescription())))\r
- {\r
- sequence.setDescription(sq.getDescription());\r
- modified = true;\r
- }\r
- if (sequence.getSequence() == null\r
- || !sequence.getSequenceAsString().equals(sq.getSequence()))\r
- {\r
- if (sequence.getStart() != sq.getStart()\r
- || sequence.getEnd() != sq.getEnd())\r
- {\r
- // update modified sequence.\r
- sequence.setSequence(sq.getSequence());\r
- sequence.setStart((int) sq.getStart());\r
- sequence.setEnd((int) sq.getEnd());\r
- modified = true;\r
- }\r
- }\r
- if (!sequence.getName().equals(sq.getName()))\r
- {\r
- sequence.setName(sq.getName());\r
- modified = true;\r
- }\r
- modified |= updateJvDbRefs();\r
- // updateJvFeatures();\r
- }\r
- }\r
-\r
- /*\r
- * private void updateJvFeatures() { Sequence vsq = (Sequence) vobj;\r
- * \r
- * // add or update any new features/references on dataset sequence if\r
- * (vsq.getgetSequenceFeatures() != null) { int sfSize =\r
- * sq.getSequenceFeatures().length;\r
- * \r
- * for (int sf = 0; sf < sfSize; sf++) { new\r
- * jalview.io.vamsas.Sequencefeature(datastore,\r
- * (jalview.datamodel.SequenceFeature) sq .getSequenceFeatures()[sf], dataset,\r
- * (Sequence) vobj); } } }\r
- */\r
- private boolean updateSqFeatures()\r
- {\r
- boolean modified = false;\r
- SequenceI sq = (SequenceI) jvobj;\r
-\r
- // add or update any new features/references on dataset sequence\r
- if (sq.getSequenceFeatures() != null)\r
- {\r
- int sfSize = sq.getSequenceFeatures().length;\r
-\r
- for (int sf = 0; sf < sfSize; sf++)\r
- {\r
- modified |= new jalview.io.vamsas.Sequencefeature(datastore,\r
- (jalview.datamodel.SequenceFeature) sq\r
- .getSequenceFeatures()[sf], dataset,\r
- (Sequence) vobj).docWasUpdated();\r
- }\r
- }\r
- return modified;\r
- }\r
-\r
- public void addToDocument()\r
- {\r
- SequenceI sq = (SequenceI) jvobj;\r
- Sequence sequence = new Sequence();\r
- bindjvvobj(sq, sequence);\r
- sq.setVamsasId(sequence.getVorbaId().getId());\r
- sequence.setSequence(sq.getSequenceAsString());\r
- sequence.setDictionary(dict);\r
- sequence.setName(sq.getName());\r
- sequence.setStart(sq.getStart());\r
- sequence.setEnd(sq.getEnd());\r
- sequence.setDescription(sq.getDescription());\r
- dataset.addSequence(sequence);\r
- vobj = sequence;\r
- updateSqFeatures();\r
- updateDbRefs();// sq,(Sequence) vobj, dataset);\r
- }\r
-\r
- /**\r
- * sync database references from jv to document\r
- * \r
- * @return true if document was modified\r
- */\r
- private boolean updateDbRefs()\r
- {\r
- boolean modifiedthedoc = false;\r
- SequenceI sq = (SequenceI) jvobj;\r
-\r
- if (sq.getDatasetSequence() == null && sq.getDBRef() != null)\r
- {\r
- // only sync database references for dataset sequences\r
- DBRefEntry[] entries = sq.getDBRef();\r
- // jalview.datamodel.DBRefEntry dbentry;\r
- for (int db = 0; db < entries.length; db++)\r
- {\r
- modifiedthedoc |= new jalview.io.vamsas.Dbref(datastore,\r
- // dbentry =\r
- entries[db], sq, (Sequence) vobj, dataset).docWasUpdated();\r
-\r
- }\r
-\r
- }\r
- return modifiedthedoc;\r
- }\r
-\r
- /**\r
- * sync database references from document to jv sequence\r
- * \r
- * @return true if local sequence refs were modified\r
- */\r
- private boolean updateJvDbRefs()\r
- {\r
- boolean modifiedtheseq = false;\r
- SequenceI sq = (SequenceI) jvobj;\r
- Sequence vsq = (Sequence) vobj;\r
- if (vsq.getDbRefCount() > 0)\r
- {\r
- // only sync database references for dataset sequences\r
- DbRef[] entries = vsq.getDbRef();\r
- // DbRef dbentry;\r
- for (int db = 0; db < entries.length; db++)\r
- {\r
- modifiedtheseq |= new jalview.io.vamsas.Dbref(datastore,\r
- // dbentry =\r
- entries[db], vsq, sq).jvWasUpdated();\r
- }\r
- }\r
- return modifiedtheseq;\r
- }\r
-\r
- public void conflict()\r
- {\r
- log.warn("Conflict in dataset sequence update to document. Overwriting document");\r
- // TODO: could try to import from document data to jalview first. and then\r
- updateToDoc();\r
- }\r
-\r
- boolean modified = false;\r
-\r
- public void updateToDoc()\r
- {\r
- SequenceI sq = (SequenceI) jvobj;\r
- Sequence sequence = (Sequence) vobj;\r
- // verify and update principal attributes.\r
- if (sequence.getDescription() != null\r
- && (sequence.getDescription() == null || !sequence\r
- .getDescription().equals(sq.getDescription())))\r
- {\r
- sequence.setDescription(sq.getDescription());\r
- modified = true;\r
- }\r
- if (sequence.getSequence() == null\r
- || !sequence.getSequence().equals(sq.getSequenceAsString()))\r
- {\r
- if (sequence.getStart() != sq.getStart()\r
- || sequence.getEnd() != sq.getEnd())\r
- {\r
- // update modified sequence.\r
- sequence.setSequence(sq.getSequenceAsString());\r
- sequence.setStart(sq.getStart());\r
- sequence.setEnd(sq.getEnd());\r
- modified = true;\r
- }\r
- }\r
- if (!dict.equals(sequence.getDictionary()))\r
- {\r
- sequence.setDictionary(dict);\r
- modified = true;\r
- }\r
- if (!sequence.getName().equals(sq.getName()))\r
- {\r
- sequence.setName(sq.getName());\r
- modified = true;\r
- }\r
- modified |= updateDbRefs();\r
- modified |= updateSqFeatures();\r
- }\r
-\r
- /**\r
- * (probably could just do vobj.isModified(), but..)\r
- * \r
- * @return true if document's dataset sequence was modified\r
- */\r
- public boolean getModified()\r
- {\r
- return modified;\r
- }\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.io.vamsas;
+
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.DBRefEntry;
+import jalview.datamodel.SequenceI;
+import jalview.io.VamsasAppDatastore;
+import uk.ac.vamsas.objects.core.DataSet;
+import uk.ac.vamsas.objects.core.DbRef;
+import uk.ac.vamsas.objects.core.Sequence;
+
+/**
+ * synchronize a vamsas dataset sequence with a jalview dataset sequence. This
+ * class deals with all sequence features and database references associated
+ * with the jalview sequence.
+ *
+ * @author JimP
+ *
+ */
+public class Datasetsequence extends DatastoreItem
+{
+ String dict;
+
+ private DataSet dataset;
+
+ // private AlignmentI jvdset;
+
+ public Datasetsequence(VamsasAppDatastore vamsasAppDatastore,
+ SequenceI sq, String dict, DataSet dataset)
+ {
+ super(vamsasAppDatastore, sq, uk.ac.vamsas.objects.core.Sequence.class);
+ this.dataset = dataset;
+ // this.jvdset = jvdset;
+ this.dict = dict;
+ doSync();
+ }
+
+ public Datasetsequence(VamsasAppDatastore vamsasAppDatastore,
+ Sequence vdseq)
+ {
+ super(vamsasAppDatastore, vdseq, SequenceI.class);
+ doJvUpdate();
+ }
+
+ public void addFromDocument()
+ {
+ Sequence vseq = (Sequence) vobj;
+ SequenceI dsseq = new jalview.datamodel.Sequence(vseq.getName(),
+ vseq.getSequence(), (int) vseq.getStart(), (int) vseq.getEnd());
+ dsseq.setDescription(vseq.getDescription());
+ bindjvvobj(dsseq, vseq);
+ dsseq.setVamsasId(vseq.getVorbaId().getId());
+ jvobj = dsseq;
+ modified = true;
+ }
+
+ public void updateFromDoc()
+ {
+ Sequence sq = (Sequence) vobj;
+ SequenceI sequence = (SequenceI) jvobj;
+ if (!sequence.getSequenceAsString().equals(sq.getSequence()))
+ {
+ log.warn("Potential Client Error ! - mismatch of dataset sequence: and jalview internal dataset sequence.");
+ }
+ else
+ {
+ // verify and update principal attributes.
+ if (sequence.getDescription() != null
+ && (sequence.getDescription() == null || !sequence
+ .getDescription().equals(sq.getDescription())))
+ {
+ sequence.setDescription(sq.getDescription());
+ modified = true;
+ }
+ if (sequence.getSequence() == null
+ || !sequence.getSequenceAsString().equals(sq.getSequence()))
+ {
+ if (sequence.getStart() != sq.getStart()
+ || sequence.getEnd() != sq.getEnd())
+ {
+ // update modified sequence.
+ sequence.setSequence(sq.getSequence());
+ sequence.setStart((int) sq.getStart());
+ sequence.setEnd((int) sq.getEnd());
+ modified = true;
+ }
+ }
+ if (!sequence.getName().equals(sq.getName()))
+ {
+ sequence.setName(sq.getName());
+ modified = true;
+ }
+ modified |= updateJvDbRefs();
+ // updateJvFeatures();
+ }
+ }
+
+ /*
+ * private void updateJvFeatures() { Sequence vsq = (Sequence) vobj;
+ *
+ * // add or update any new features/references on dataset sequence if
+ * (vsq.getgetSequenceFeatures() != null) { int sfSize =
+ * sq.getSequenceFeatures().length;
+ *
+ * for (int sf = 0; sf < sfSize; sf++) { new
+ * jalview.io.vamsas.Sequencefeature(datastore,
+ * (jalview.datamodel.SequenceFeature) sq .getSequenceFeatures()[sf], dataset,
+ * (Sequence) vobj); } } }
+ */
+ private boolean updateSqFeatures()
+ {
+ boolean modified = false;
+ SequenceI sq = (SequenceI) jvobj;
+
+ // add or update any new features/references on dataset sequence
+ if (sq.getSequenceFeatures() != null)
+ {
+ int sfSize = sq.getSequenceFeatures().length;
+
+ for (int sf = 0; sf < sfSize; sf++)
+ {
+ modified |= new jalview.io.vamsas.Sequencefeature(datastore,
+ (jalview.datamodel.SequenceFeature) sq
+ .getSequenceFeatures()[sf], dataset,
+ (Sequence) vobj).docWasUpdated();
+ }
+ }
+ return modified;
+ }
+
+ public void addToDocument()
+ {
+ SequenceI sq = (SequenceI) jvobj;
+ Sequence sequence = new Sequence();
+ bindjvvobj(sq, sequence);
+ sq.setVamsasId(sequence.getVorbaId().getId());
+ sequence.setSequence(sq.getSequenceAsString());
+ sequence.setDictionary(dict);
+ sequence.setName(sq.getName());
+ sequence.setStart(sq.getStart());
+ sequence.setEnd(sq.getEnd());
+ sequence.setDescription(sq.getDescription());
+ dataset.addSequence(sequence);
+ vobj = sequence;
+ updateSqFeatures();
+ updateDbRefs();// sq,(Sequence) vobj, dataset);
+ }
+
+ /**
+ * sync database references from jv to document
+ *
+ * @return true if document was modified
+ */
+ private boolean updateDbRefs()
+ {
+ boolean modifiedthedoc = false;
+ SequenceI sq = (SequenceI) jvobj;
+
+ if (sq.getDatasetSequence() == null && sq.getDBRef() != null)
+ {
+ // only sync database references for dataset sequences
+ DBRefEntry[] entries = sq.getDBRef();
+ // jalview.datamodel.DBRefEntry dbentry;
+ for (int db = 0; db < entries.length; db++)
+ {
+ modifiedthedoc |= new jalview.io.vamsas.Dbref(datastore,
+ // dbentry =
+ entries[db], sq, (Sequence) vobj, dataset).docWasUpdated();
+
+ }
+
+ }
+ return modifiedthedoc;
+ }
+
+ /**
+ * sync database references from document to jv sequence
+ *
+ * @return true if local sequence refs were modified
+ */
+ private boolean updateJvDbRefs()
+ {
+ boolean modifiedtheseq = false;
+ SequenceI sq = (SequenceI) jvobj;
+ Sequence vsq = (Sequence) vobj;
+ if (vsq.getDbRefCount() > 0)
+ {
+ // only sync database references for dataset sequences
+ DbRef[] entries = vsq.getDbRef();
+ // DbRef dbentry;
+ for (int db = 0; db < entries.length; db++)
+ {
+ modifiedtheseq |= new jalview.io.vamsas.Dbref(datastore,
+ // dbentry =
+ entries[db], vsq, sq).jvWasUpdated();
+ }
+ }
+ return modifiedtheseq;
+ }
+
+ public void conflict()
+ {
+ log.warn("Conflict in dataset sequence update to document. Overwriting document");
+ // TODO: could try to import from document data to jalview first. and then
+ updateToDoc();
+ }
+
+ boolean modified = false;
+
+ public void updateToDoc()
+ {
+ SequenceI sq = (SequenceI) jvobj;
+ Sequence sequence = (Sequence) vobj;
+ // verify and update principal attributes.
+ if (sequence.getDescription() != null
+ && (sequence.getDescription() == null || !sequence
+ .getDescription().equals(sq.getDescription())))
+ {
+ sequence.setDescription(sq.getDescription());
+ modified = true;
+ }
+ if (sequence.getSequence() == null
+ || !sequence.getSequence().equals(sq.getSequenceAsString()))
+ {
+ if (sequence.getStart() != sq.getStart()
+ || sequence.getEnd() != sq.getEnd())
+ {
+ // update modified sequence.
+ sequence.setSequence(sq.getSequenceAsString());
+ sequence.setStart(sq.getStart());
+ sequence.setEnd(sq.getEnd());
+ modified = true;
+ }
+ }
+ if (!dict.equals(sequence.getDictionary()))
+ {
+ sequence.setDictionary(dict);
+ modified = true;
+ }
+ if (!sequence.getName().equals(sq.getName()))
+ {
+ sequence.setName(sq.getName());
+ modified = true;
+ }
+ modified |= updateDbRefs();
+ modified |= updateSqFeatures();
+ }
+
+ /**
+ * (probably could just do vobj.isModified(), but..)
+ *
+ * @return true if document's dataset sequence was modified
+ */
+ public boolean getModified()
+ {
+ return modified;
+ }
+
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.io.vamsas;\r
-\r
-import java.util.Enumeration;\r
-import java.util.Vector;\r
-\r
-import uk.ac.vamsas.objects.core.DataSet;\r
-import uk.ac.vamsas.objects.core.DataSetAnnotations;\r
-import uk.ac.vamsas.objects.core.Link;\r
-import uk.ac.vamsas.objects.core.Property;\r
-import uk.ac.vamsas.objects.core.Provenance;\r
-import uk.ac.vamsas.objects.core.RangeAnnotation;\r
-import uk.ac.vamsas.objects.core.Score;\r
-import uk.ac.vamsas.objects.core.Seg;\r
-import uk.ac.vamsas.objects.core.Sequence;\r
-import uk.ac.vamsas.objects.utils.Properties;\r
-import jalview.bin.Cache;\r
-import jalview.datamodel.SequenceFeature;\r
-import jalview.datamodel.SequenceI;\r
-import jalview.io.VamsasAppDatastore;\r
-import jalview.util.UrlLink;\r
-\r
-/**\r
- * @author JimP\r
- * \r
- */\r
-public class Sequencefeature extends Rangetype\r
-{\r
-\r
- uk.ac.vamsas.objects.core.DataSet dataset;\r
-\r
- uk.ac.vamsas.objects.core.Sequence sequence;\r
-\r
- private SequenceI dsSeq;\r
-\r
- public Sequencefeature(VamsasAppDatastore vamsasAppDatastore,\r
- SequenceFeature sequenceFeature,\r
- uk.ac.vamsas.objects.core.DataSet dataset,\r
- uk.ac.vamsas.objects.core.Sequence sequence)\r
- {\r
- super(vamsasAppDatastore, sequenceFeature, DataSetAnnotations.class);\r
- this.dataset = dataset;\r
- this.sequence = sequence;\r
- doSync();\r
- }\r
-\r
- public Sequencefeature(VamsasAppDatastore vamsasAppDatastore,\r
- DataSetAnnotations dseta, SequenceI dsSeq)\r
- {\r
- super(vamsasAppDatastore, dseta,\r
- jalview.datamodel.SequenceFeature.class);\r
- this.dsSeq = dsSeq;\r
- doJvUpdate();\r
- }\r
-\r
- public void addToDocument()\r
- {\r
- DataSetAnnotations dsa = (DataSetAnnotations) vobj;\r
- jalview.datamodel.SequenceFeature feature = (jalview.datamodel.SequenceFeature) jvobj;\r
- dsa = (DataSetAnnotations) getDSAnnotationFromJalview(\r
- new DataSetAnnotations(), feature);\r
- if (dsa.getProvenance() == null)\r
- {\r
- dsa.setProvenance(new Provenance());\r
- }\r
- addProvenance(dsa.getProvenance(), "created"); // JBPNote - need\r
- // to update\r
- dsa.addSeqRef(sequence); // we have just created this annotation\r
- // - so safe to use this\r
- bindjvvobj(feature, dsa);\r
- dataset.addDataSetAnnotations(dsa);\r
- }\r
-\r
- public void addFromDocument()\r
- {\r
- DataSetAnnotations dsa = (DataSetAnnotations) vobj;\r
- if (dsa.getSeqRefCount() != 1)\r
- {\r
- Cache.log\r
- .warn("Not binding "\r
- + dsa.getVorbaId()\r
- + " to Sequence Feature - has multiple dataset sequence references.");\r
- return;\r
- }\r
- jalview.datamodel.SequenceFeature sf = (jalview.datamodel.SequenceFeature) jvobj;\r
- dsSeq.addSequenceFeature(sf = getJalviewSeqFeature(dsa));\r
- jvobj = sf;\r
- bindjvvobj(sf, dsa);\r
- }\r
-\r
- public void conflict()\r
- {\r
- log.warn("Untested sequencefeature conflict code");\r
- DataSetAnnotations dsa = (DataSetAnnotations) vobj;\r
- jalview.datamodel.SequenceFeature feature = (jalview.datamodel.SequenceFeature) jvobj;\r
- jalview.datamodel.SequenceFeature sf = getJalviewSeqFeature(dsa);\r
- replaceJvObjMapping(feature, sf); // switch binding of dsa from old feature\r
- // to newly created feature\r
- dsSeq.addSequenceFeature(sf); // add new imported feature\r
- addToDocument(); // and create a new feature in the document\r
- }\r
-\r
- public void updateToDoc()\r
- {\r
- DataSetAnnotations dsa = (DataSetAnnotations) vobj;\r
- jalview.datamodel.SequenceFeature feature = (jalview.datamodel.SequenceFeature) jvobj;\r
- if (dsa.getSeqRefCount() != 1)\r
- {\r
- replaceJvObjMapping(feature, null);\r
- Cache.log\r
- .warn("Binding of annotation to jalview feature has changed. Removing binding and recreating.");\r
- doSync(); // re-verify bindings.\r
- }\r
- else\r
- {\r
- // Sync the features from Jalview\r
- long oldref = dsa.get__last_hash();\r
- getDSAnnotationFromJalview(dsa, feature);\r
- if (oldref != dsa.hashCode())\r
- {\r
- Cache.log\r
- .debug("Updated dataset sequence annotation from feature.");\r
- addProvenance(dsa.getProvenance(), "modified");\r
- }\r
- }\r
-\r
- }\r
-\r
- public void updateFromDoc()\r
- {\r
- DataSetAnnotations dsa = (DataSetAnnotations) vobj;\r
- jalview.datamodel.SequenceFeature feature = (jalview.datamodel.SequenceFeature) jvobj;\r
- if (dsa.getSeqRefCount() != 1)\r
- {\r
- // conflicting update from document - we cannot map this feature anymore.\r
- replaceJvObjMapping(feature, null);\r
- Cache.log\r
- .warn("annotation ("\r
- + dsa.getVorbaId()\r
- + " bound to jalview feature cannot be mapped. Removing binding, deleting feature, and deleting feature.");\r
- // - consider deleting the feature ?\r
- dsSeq.deleteFeature(feature);\r
- // doSync();\r
- }\r
- else\r
- {\r
- // Sync the features to Jalview - easiest to delete and add the feature\r
- // again\r
- jalview.datamodel.SequenceFeature newsf = getJalviewSeqFeature(dsa);\r
- dsSeq.deleteFeature(feature);\r
- replaceJvObjMapping(feature, newsf);\r
- dsSeq.addSequenceFeature(newsf);\r
- if (feature.otherDetails != null)\r
- {\r
- // TODO later: leave this to finalise method ?\r
- feature.otherDetails.clear();\r
- }\r
- }\r
- }\r
-\r
- /**\r
- * correctly create/update a RangeAnnotation from a jalview sequence feature\r
- * TODO: refactor to a method in jalview.io.vamsas.RangeAnnotation class\r
- * \r
- * @param dsa\r
- * (typically DataSetAnnotations or AlignmentSequenceAnnotation)\r
- * @param feature\r
- * (the feature to be mapped from)\r
- * @return\r
- */\r
- private RangeAnnotation getDSAnnotationFromJalview(RangeAnnotation dsa,\r
- jalview.datamodel.SequenceFeature feature)\r
- {\r
- dsa.setType(feature.getType());\r
- Seg vSeg = new Seg();\r
- vSeg.setStart(feature.getBegin());\r
- vSeg.setEnd(feature.getEnd());\r
- vSeg.setInclusive(true);\r
- if (dsa.getSegCount() > 1)\r
- {\r
- Cache.log\r
- .debug("About to destroy complex annotation in vamsas document mapped to sequence feature ("\r
- + dsa.getVorbaId() + ")");\r
- }\r
- dsa.setSeg(new Seg[]\r
- { vSeg });\r
- dsa.setDescription(feature.getDescription());\r
- dsa.setStatus(feature.getStatus());\r
- if (feature.links != null && feature.links.size() > 0)\r
- {\r
- for (int i = 0, iSize = feature.links.size(); i < iSize; i++)\r
- {\r
- String link = (String) feature.links.elementAt(i);\r
- UrlLink ulink = new UrlLink(link);\r
- if (ulink.isValid())\r
- {\r
- // We only add static links to the document.\r
- Link vLink = new Link();\r
- vLink.setContent(ulink.getLabel());\r
- vLink.setHref(ulink.getTarget());\r
- dsa.addLink(vLink);\r
- }\r
- }\r
- }\r
- dsa.setGroup(feature.getFeatureGroup());\r
- if (feature.getScore() != Float.NaN)\r
- {\r
- Score fscore = new Score();\r
- dsa.setScore(new Score[]\r
- { fscore });\r
- fscore.setContent(feature.getScore());\r
- fscore.setName(feature.getType());\r
- }\r
- if (feature.otherDetails != null)\r
- {\r
- Enumeration iter = feature.otherDetails.keys();\r
- Vector props = dsa.getPropertyAsReference();\r
- while (iter.hasMoreElements())\r
- {\r
- String key = (String) iter.nextElement();\r
- if (!key.equalsIgnoreCase("score")\r
- && !key.equalsIgnoreCase("status"))\r
- {\r
- Property nprop = new Property();\r
- nprop.setName(key);\r
- Object vlu = feature.getValue(key);\r
- nprop.setContent(feature.getValue(key).toString());\r
- boolean valid = false;\r
- if (vlu instanceof String)\r
- {\r
- nprop.setType(uk.ac.vamsas.objects.utils.Properties.STRINGTYPE);\r
- valid = true;\r
- }\r
- else if (vlu instanceof Integer)\r
- {\r
- valid = true;\r
- nprop.setType(uk.ac.vamsas.objects.utils.Properties.INTEGERTYPE);\r
- }\r
- else if (vlu instanceof Float)\r
- {\r
- nprop.setType(uk.ac.vamsas.objects.utils.Properties.FLOATTYPE);\r
- valid = true;\r
- }\r
- if (valid)\r
- {\r
- if (props != null)\r
- {\r
- uk.ac.vamsas.objects.utils.Properties.addOrReplace(props,\r
- nprop);\r
- }\r
- else\r
- {\r
- dsa.addProperty(nprop);\r
- }\r
- }\r
- }\r
- }\r
- }\r
- return dsa;\r
- }\r
-\r
- private SequenceFeature getJalviewSeqFeature(RangeAnnotation dseta)\r
- {\r
- int[] se = getBounds(dseta);\r
- SequenceFeature sf = new jalview.datamodel.SequenceFeature(\r
- dseta.getType(), dseta.getDescription(), dseta.getStatus(),\r
- se[0], se[1], dseta.getGroup());\r
- if (dseta.getLinkCount() > 0)\r
- {\r
- Link[] links = dseta.getLink();\r
- for (int i = 0; i < links.length; i++)\r
- {\r
- // TODO: use URLLink parsing/validation here.\r
- sf.addLink(links[i].getContent() + "|" + links[i].getHref());\r
- }\r
- }\r
- if (dseta.getScoreCount() > 0)\r
- {\r
- Enumeration scr = dseta.enumerateScore();\r
- while (scr.hasMoreElements())\r
- {\r
- Score score = (Score) scr.nextElement();\r
- if (score.getName().equals(sf.getType()))\r
- {\r
- sf.setScore(score.getContent());\r
- }\r
- else\r
- {\r
- sf.setValue(score.getName(), "" + score.getContent());\r
- }\r
- }\r
- }\r
- // other details\r
- Enumeration props = dseta.enumerateProperty();\r
- while (props.hasMoreElements())\r
- {\r
- Property p = (Property) props.nextElement();\r
- Object val = null;\r
- if (Properties.isValid(p))\r
- {\r
- if (Properties.isString(p))\r
- {\r
- val = p.getContent();\r
- }\r
- if (Properties.isBoolean(p))\r
- {\r
- try\r
- {\r
- val = new Boolean(p.getContent());\r
- } catch (Exception e)\r
- {\r
- }\r
- }\r
- if (Properties.isFloat(p))\r
- {\r
- try\r
- {\r
- val = new Float(p.getContent());\r
-\r
- } catch (Exception e)\r
- {\r
- }\r
- }\r
- if (Properties.isInteger(p))\r
- {\r
- try\r
- {\r
- val = new Integer(p.getContent());\r
- } catch (Exception e)\r
- {\r
- }\r
- }\r
- if (val != null)\r
- {\r
- sf.setValue(p.getName(), val);\r
- }\r
- }\r
- }\r
-\r
- return sf;\r
- }\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.io.vamsas;
+
+import java.util.Enumeration;
+import java.util.Vector;
+
+import uk.ac.vamsas.objects.core.DataSet;
+import uk.ac.vamsas.objects.core.DataSetAnnotations;
+import uk.ac.vamsas.objects.core.Link;
+import uk.ac.vamsas.objects.core.Property;
+import uk.ac.vamsas.objects.core.Provenance;
+import uk.ac.vamsas.objects.core.RangeAnnotation;
+import uk.ac.vamsas.objects.core.Score;
+import uk.ac.vamsas.objects.core.Seg;
+import uk.ac.vamsas.objects.core.Sequence;
+import uk.ac.vamsas.objects.utils.Properties;
+import jalview.bin.Cache;
+import jalview.datamodel.SequenceFeature;
+import jalview.datamodel.SequenceI;
+import jalview.io.VamsasAppDatastore;
+import jalview.util.UrlLink;
+
+/**
+ * @author JimP
+ *
+ */
+public class Sequencefeature extends Rangetype
+{
+
+ uk.ac.vamsas.objects.core.DataSet dataset;
+
+ uk.ac.vamsas.objects.core.Sequence sequence;
+
+ private SequenceI dsSeq;
+
+ public Sequencefeature(VamsasAppDatastore vamsasAppDatastore,
+ SequenceFeature sequenceFeature,
+ uk.ac.vamsas.objects.core.DataSet dataset,
+ uk.ac.vamsas.objects.core.Sequence sequence)
+ {
+ super(vamsasAppDatastore, sequenceFeature, DataSetAnnotations.class);
+ this.dataset = dataset;
+ this.sequence = sequence;
+ doSync();
+ }
+
+ public Sequencefeature(VamsasAppDatastore vamsasAppDatastore,
+ DataSetAnnotations dseta, SequenceI dsSeq)
+ {
+ super(vamsasAppDatastore, dseta,
+ jalview.datamodel.SequenceFeature.class);
+ this.dsSeq = dsSeq;
+ doJvUpdate();
+ }
+
+ public void addToDocument()
+ {
+ DataSetAnnotations dsa = (DataSetAnnotations) vobj;
+ jalview.datamodel.SequenceFeature feature = (jalview.datamodel.SequenceFeature) jvobj;
+ dsa = (DataSetAnnotations) getDSAnnotationFromJalview(
+ new DataSetAnnotations(), feature);
+ if (dsa.getProvenance() == null)
+ {
+ dsa.setProvenance(new Provenance());
+ }
+ addProvenance(dsa.getProvenance(), "created"); // JBPNote - need
+ // to update
+ dsa.addSeqRef(sequence); // we have just created this annotation
+ // - so safe to use this
+ bindjvvobj(feature, dsa);
+ dataset.addDataSetAnnotations(dsa);
+ }
+
+ public void addFromDocument()
+ {
+ DataSetAnnotations dsa = (DataSetAnnotations) vobj;
+ if (dsa.getSeqRefCount() != 1)
+ {
+ Cache.log
+ .warn("Not binding "
+ + dsa.getVorbaId()
+ + " to Sequence Feature - has multiple dataset sequence references.");
+ return;
+ }
+ jalview.datamodel.SequenceFeature sf = (jalview.datamodel.SequenceFeature) jvobj;
+ dsSeq.addSequenceFeature(sf = getJalviewSeqFeature(dsa));
+ jvobj = sf;
+ bindjvvobj(sf, dsa);
+ }
+
+ public void conflict()
+ {
+ log.warn("Untested sequencefeature conflict code");
+ DataSetAnnotations dsa = (DataSetAnnotations) vobj;
+ jalview.datamodel.SequenceFeature feature = (jalview.datamodel.SequenceFeature) jvobj;
+ jalview.datamodel.SequenceFeature sf = getJalviewSeqFeature(dsa);
+ replaceJvObjMapping(feature, sf); // switch binding of dsa from old feature
+ // to newly created feature
+ dsSeq.addSequenceFeature(sf); // add new imported feature
+ addToDocument(); // and create a new feature in the document
+ }
+
+ public void updateToDoc()
+ {
+ DataSetAnnotations dsa = (DataSetAnnotations) vobj;
+ jalview.datamodel.SequenceFeature feature = (jalview.datamodel.SequenceFeature) jvobj;
+ if (dsa.getSeqRefCount() != 1)
+ {
+ replaceJvObjMapping(feature, null);
+ Cache.log
+ .warn("Binding of annotation to jalview feature has changed. Removing binding and recreating.");
+ doSync(); // re-verify bindings.
+ }
+ else
+ {
+ // Sync the features from Jalview
+ long oldref = dsa.get__last_hash();
+ getDSAnnotationFromJalview(dsa, feature);
+ if (oldref != dsa.hashCode())
+ {
+ Cache.log
+ .debug("Updated dataset sequence annotation from feature.");
+ addProvenance(dsa.getProvenance(), "modified");
+ }
+ }
+
+ }
+
+ public void updateFromDoc()
+ {
+ DataSetAnnotations dsa = (DataSetAnnotations) vobj;
+ jalview.datamodel.SequenceFeature feature = (jalview.datamodel.SequenceFeature) jvobj;
+ if (dsa.getSeqRefCount() != 1)
+ {
+ // conflicting update from document - we cannot map this feature anymore.
+ replaceJvObjMapping(feature, null);
+ Cache.log
+ .warn("annotation ("
+ + dsa.getVorbaId()
+ + " bound to jalview feature cannot be mapped. Removing binding, deleting feature, and deleting feature.");
+ // - consider deleting the feature ?
+ dsSeq.deleteFeature(feature);
+ // doSync();
+ }
+ else
+ {
+ // Sync the features to Jalview - easiest to delete and add the feature
+ // again
+ jalview.datamodel.SequenceFeature newsf = getJalviewSeqFeature(dsa);
+ dsSeq.deleteFeature(feature);
+ replaceJvObjMapping(feature, newsf);
+ dsSeq.addSequenceFeature(newsf);
+ if (feature.otherDetails != null)
+ {
+ // TODO later: leave this to finalise method ?
+ feature.otherDetails.clear();
+ }
+ }
+ }
+
+ /**
+ * correctly create/update a RangeAnnotation from a jalview sequence feature
+ * TODO: refactor to a method in jalview.io.vamsas.RangeAnnotation class
+ *
+ * @param dsa
+ * (typically DataSetAnnotations or AlignmentSequenceAnnotation)
+ * @param feature
+ * (the feature to be mapped from)
+ * @return
+ */
+ private RangeAnnotation getDSAnnotationFromJalview(RangeAnnotation dsa,
+ jalview.datamodel.SequenceFeature feature)
+ {
+ dsa.setType(feature.getType());
+ Seg vSeg = new Seg();
+ vSeg.setStart(feature.getBegin());
+ vSeg.setEnd(feature.getEnd());
+ vSeg.setInclusive(true);
+ if (dsa.getSegCount() > 1)
+ {
+ Cache.log
+ .debug("About to destroy complex annotation in vamsas document mapped to sequence feature ("
+ + dsa.getVorbaId() + ")");
+ }
+ dsa.setSeg(new Seg[]
+ { vSeg });
+ dsa.setDescription(feature.getDescription());
+ dsa.setStatus(feature.getStatus());
+ if (feature.links != null && feature.links.size() > 0)
+ {
+ for (int i = 0, iSize = feature.links.size(); i < iSize; i++)
+ {
+ String link = (String) feature.links.elementAt(i);
+ UrlLink ulink = new UrlLink(link);
+ if (ulink.isValid())
+ {
+ // We only add static links to the document.
+ Link vLink = new Link();
+ vLink.setContent(ulink.getLabel());
+ vLink.setHref(ulink.getTarget());
+ dsa.addLink(vLink);
+ }
+ }
+ }
+ dsa.setGroup(feature.getFeatureGroup());
+ if (feature.getScore() != Float.NaN)
+ {
+ Score fscore = new Score();
+ dsa.setScore(new Score[]
+ { fscore });
+ fscore.setContent(feature.getScore());
+ fscore.setName(feature.getType());
+ }
+ if (feature.otherDetails != null)
+ {
+ Enumeration iter = feature.otherDetails.keys();
+ Vector props = dsa.getPropertyAsReference();
+ while (iter.hasMoreElements())
+ {
+ String key = (String) iter.nextElement();
+ if (!key.equalsIgnoreCase("score")
+ && !key.equalsIgnoreCase("status"))
+ {
+ Property nprop = new Property();
+ nprop.setName(key);
+ Object vlu = feature.getValue(key);
+ nprop.setContent(feature.getValue(key).toString());
+ boolean valid = false;
+ if (vlu instanceof String)
+ {
+ nprop.setType(uk.ac.vamsas.objects.utils.Properties.STRINGTYPE);
+ valid = true;
+ }
+ else if (vlu instanceof Integer)
+ {
+ valid = true;
+ nprop.setType(uk.ac.vamsas.objects.utils.Properties.INTEGERTYPE);
+ }
+ else if (vlu instanceof Float)
+ {
+ nprop.setType(uk.ac.vamsas.objects.utils.Properties.FLOATTYPE);
+ valid = true;
+ }
+ if (valid)
+ {
+ if (props != null)
+ {
+ uk.ac.vamsas.objects.utils.Properties.addOrReplace(props,
+ nprop);
+ }
+ else
+ {
+ dsa.addProperty(nprop);
+ }
+ }
+ }
+ }
+ }
+ return dsa;
+ }
+
+ private SequenceFeature getJalviewSeqFeature(RangeAnnotation dseta)
+ {
+ int[] se = getBounds(dseta);
+ SequenceFeature sf = new jalview.datamodel.SequenceFeature(
+ dseta.getType(), dseta.getDescription(), dseta.getStatus(),
+ se[0], se[1], dseta.getGroup());
+ if (dseta.getLinkCount() > 0)
+ {
+ Link[] links = dseta.getLink();
+ for (int i = 0; i < links.length; i++)
+ {
+ // TODO: use URLLink parsing/validation here.
+ sf.addLink(links[i].getContent() + "|" + links[i].getHref());
+ }
+ }
+ if (dseta.getScoreCount() > 0)
+ {
+ Enumeration scr = dseta.enumerateScore();
+ while (scr.hasMoreElements())
+ {
+ Score score = (Score) scr.nextElement();
+ if (score.getName().equals(sf.getType()))
+ {
+ sf.setScore(score.getContent());
+ }
+ else
+ {
+ sf.setValue(score.getName(), "" + score.getContent());
+ }
+ }
+ }
+ // other details
+ Enumeration props = dseta.enumerateProperty();
+ while (props.hasMoreElements())
+ {
+ Property p = (Property) props.nextElement();
+ Object val = null;
+ if (Properties.isValid(p))
+ {
+ if (Properties.isString(p))
+ {
+ val = p.getContent();
+ }
+ if (Properties.isBoolean(p))
+ {
+ try
+ {
+ val = new Boolean(p.getContent());
+ } catch (Exception e)
+ {
+ }
+ }
+ if (Properties.isFloat(p))
+ {
+ try
+ {
+ val = new Float(p.getContent());
+
+ } catch (Exception e)
+ {
+ }
+ }
+ if (Properties.isInteger(p))
+ {
+ try
+ {
+ val = new Integer(p.getContent());
+ } catch (Exception e)
+ {
+ }
+ }
+ if (val != null)
+ {
+ sf.setValue(p.getName(), val);
+ }
+ }
+ }
+
+ return sf;
+ }
+
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
package jalview.io.vamsas;
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ */
package jalview.javascript;
import java.net.URL;
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ */
package jalview.javascript;
import jalview.appletgui.AlignFrame;
*/
public abstract String getJsMessage(String messageclass, String viewId);
-}
\ No newline at end of file
+}
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-package jalview.javascript;
+ */package jalview.javascript;
public interface JsCallBack
{
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ */
package jalview.javascript;
import java.net.URL;
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ */
package jalview.javascript;
import java.util.Vector;
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ */
package jalview.javascript;
import java.awt.Color;
* <li>mouseover: javascript function called with arguments
*
* <pre>
- * ['mouseover',String(pdb file URI), String(pdb file chain ID), String(residue\r
+ * ['mouseover',String(pdb file URI), String(pdb file chain ID), String(residue
* number moused over), String(atom index corresponding to residue)]
* </pre>
*
* <li>colourstruct: javascript function called with arguments
*
* <pre>
- * ['colourstruct',String(alignment view id),String(number of javascript message\r
- * chunks to collect),String(length of first chunk in set of messages - or zero\r
+ * ['colourstruct',String(alignment view id),String(number of javascript message
+ * chunks to collect),String(length of first chunk in set of messages - or zero
* for null message)]
* </pre>
*
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\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
-\r
-public class GDasSourceBrowser extends JPanel\r
-{\r
- public GDasSourceBrowser()\r
- {\r
- try\r
- {\r
- jbInit();\r
- } catch (Exception ex)\r
- {\r
- ex.printStackTrace();\r
- }\r
- }\r
-\r
- private void jbInit() throws Exception\r
- {\r
- this.setLayout(gridBagLayout1);\r
- refresh.setText("Refresh Available Sources");\r
- refresh.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- refresh_actionPerformed(e);\r
- }\r
- });\r
- progressBar.setPreferredSize(new Dimension(450, 20));\r
- progressBar.setString("");\r
- scrollPane.setBorder(titledBorder1);\r
- scrollPane.setBorder(BorderFactory.createEtchedBorder());\r
- fullDetailsScrollpane.setBorder(BorderFactory.createEtchedBorder());\r
- fullDetails.addHyperlinkListener(new HyperlinkListener()\r
- {\r
- public void hyperlinkUpdate(HyperlinkEvent e)\r
- {\r
- fullDetails_hyperlinkUpdate(e);\r
- }\r
- });\r
- fullDetails.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));\r
- fullDetails.setEditable(false);\r
- registryLabel.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));\r
- registryLabel.setHorizontalAlignment(SwingConstants.TRAILING);\r
- registryLabel.setText("Use Registry");\r
- addLocal.setText("Add Local Source");\r
- addLocal.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- amendLocal(true);\r
- }\r
- });\r
- jPanel1.setLayout(flowLayout1);\r
- jPanel1.setMinimumSize(new Dimension(596, 30));\r
- jPanel1.setPreferredSize(new Dimension(596, 30));\r
- jScrollPane2.setBorder(titledBorder3);\r
- jScrollPane3.setBorder(titledBorder4);\r
- jScrollPane4.setBorder(titledBorder5);\r
- titledBorder2\r
- .setTitleFont(new java.awt.Font("Verdana", Font.PLAIN, 10));\r
- titledBorder3\r
- .setTitleFont(new java.awt.Font("Verdana", Font.PLAIN, 10));\r
- titledBorder4\r
- .setTitleFont(new java.awt.Font("Verdana", Font.PLAIN, 10));\r
- filter1.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));\r
- filter2.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));\r
- filter3.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));\r
- table.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));\r
- reset.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));\r
- reset.setMargin(new Insets(2, 2, 2, 2));\r
- reset.setText("Reset");\r
- reset.addActionListener(new ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- reset_actionPerformed(e);\r
- }\r
- });\r
- jPanel2.setLayout(borderLayout1);\r
- borderLayout1.setHgap(5);\r
- registryURL.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));\r
- scrollPane.getViewport().add(table);\r
- fullDetailsScrollpane.getViewport().add(fullDetails);\r
- jScrollPane3.getViewport().add(filter2);\r
- jScrollPane4.getViewport().add(filter3);\r
- jPanel1.add(refresh, null);\r
- jPanel1.add(addLocal, null);\r
- jPanel1.add(progressBar, null);\r
- jScrollPane2.getViewport().add(filter1);\r
- this.add(jPanel1, new GridBagConstraints(0, 3, 3, 1, 1.0, 1.0,\r
- GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,\r
- new Insets(0, 0, 0, 0), 0, 0));\r
- this.add(fullDetailsScrollpane, new GridBagConstraints(1, 0, 2, 1, 1.0,\r
- 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,\r
- new Insets(3, 0, 0, 3), 240, 130));\r
- this.add(scrollPane, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,\r
- GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(\r
- 3, 2, 0, 0), 150, 130));\r
- jPanel2.add(registryLabel, java.awt.BorderLayout.WEST);\r
- jPanel2.add(registryURL, java.awt.BorderLayout.CENTER);\r
- jPanel2.add(reset, java.awt.BorderLayout.EAST);\r
- this.add(jPanel2, new GridBagConstraints(0, 2, 3, 1, 0.0, 0.0,\r
- GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,\r
- new Insets(5, 10, 0, 10), 339, 0));\r
- this.add(jScrollPane2, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0,\r
- GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(\r
- 0, 0, 0, 60), 80, 60));\r
- this.add(jScrollPane4, new GridBagConstraints(2, 1, 1, 1, 1.0, 1.0,\r
- GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(\r
- 0, -80, 0, 0), 80, 60));\r
- this.add(jScrollPane3, new GridBagConstraints(1, 1, 1, 1, 1.0, 1.0,\r
- GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(\r
- 0, -60, 0, 80), 80, 60));\r
- }\r
-\r
- protected JTable table = new JTable();\r
-\r
- protected JEditorPane fullDetails = new JEditorPane("text/html", "");\r
-\r
- TitledBorder titledBorder1 = new TitledBorder("Available DAS Sources");\r
-\r
- protected JButton refresh = new JButton();\r
-\r
- protected JProgressBar progressBar = new JProgressBar();\r
-\r
- protected JScrollPane scrollPane = new JScrollPane();\r
-\r
- TitledBorder titledBorder2 = new TitledBorder("Full Details");\r
-\r
- protected JScrollPane fullDetailsScrollpane = new JScrollPane();\r
-\r
- protected JList filter1 = new JList();\r
-\r
- protected JList filter2 = new JList();\r
-\r
- protected JList filter3 = new JList();\r
-\r
- JScrollPane jScrollPane2 = new JScrollPane();\r
-\r
- JScrollPane jScrollPane3 = new JScrollPane();\r
-\r
- JScrollPane jScrollPane4 = new JScrollPane();\r
-\r
- protected JTextField registryURL = new JTextField();\r
-\r
- protected JLabel registryLabel = new JLabel();\r
-\r
- protected JButton addLocal = new JButton();\r
-\r
- JPanel jPanel1 = new JPanel();\r
-\r
- FlowLayout flowLayout1 = new FlowLayout();\r
-\r
- GridBagLayout gridBagLayout1 = new GridBagLayout();\r
-\r
- TitledBorder titledBorder3 = new TitledBorder("Authority:");\r
-\r
- TitledBorder titledBorder4 = new TitledBorder("Type:");\r
-\r
- TitledBorder titledBorder5 = new TitledBorder("Label:");\r
-\r
- JButton reset = new JButton();\r
-\r
- JPanel jPanel2 = new JPanel();\r
-\r
- BorderLayout borderLayout1 = new BorderLayout();\r
-\r
- public void refresh_actionPerformed(ActionEvent e)\r
- {\r
-\r
- }\r
-\r
- public void fullDetails_hyperlinkUpdate(HyperlinkEvent e)\r
- {\r
- try\r
- {\r
-\r
- if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED)\r
- {\r
- jalview.util.BrowserLauncher.openURL(e.getURL().toString());\r
- }\r
- } catch (Exception ex)\r
- {\r
- System.out.println(e.getURL());\r
- ex.printStackTrace();\r
- }\r
- }\r
-\r
- public void amendLocal(boolean newSource)\r
- {\r
-\r
- }\r
-\r
- public void reset_actionPerformed(ActionEvent e)\r
- {\r
-\r
- }\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.jbgui;
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.border.*;
+import javax.swing.event.*;
+
+public class GDasSourceBrowser extends JPanel
+{
+ public GDasSourceBrowser()
+ {
+ try
+ {
+ jbInit();
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ private void jbInit() throws Exception
+ {
+ this.setLayout(gridBagLayout1);
+ refresh.setText("Refresh Available Sources");
+ refresh.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ refresh_actionPerformed(e);
+ }
+ });
+ progressBar.setPreferredSize(new Dimension(450, 20));
+ progressBar.setString("");
+ scrollPane.setBorder(titledBorder1);
+ scrollPane.setBorder(BorderFactory.createEtchedBorder());
+ fullDetailsScrollpane.setBorder(BorderFactory.createEtchedBorder());
+ fullDetails.addHyperlinkListener(new HyperlinkListener()
+ {
+ public void hyperlinkUpdate(HyperlinkEvent e)
+ {
+ fullDetails_hyperlinkUpdate(e);
+ }
+ });
+ fullDetails.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
+ fullDetails.setEditable(false);
+ registryLabel.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
+ registryLabel.setHorizontalAlignment(SwingConstants.TRAILING);
+ registryLabel.setText("Use Registry");
+ addLocal.setText("Add Local Source");
+ addLocal.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ amendLocal(true);
+ }
+ });
+ jPanel1.setLayout(flowLayout1);
+ jPanel1.setMinimumSize(new Dimension(596, 30));
+ jPanel1.setPreferredSize(new Dimension(596, 30));
+ jScrollPane2.setBorder(titledBorder3);
+ jScrollPane3.setBorder(titledBorder4);
+ jScrollPane4.setBorder(titledBorder5);
+ titledBorder2
+ .setTitleFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
+ titledBorder3
+ .setTitleFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
+ titledBorder4
+ .setTitleFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
+ filter1.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
+ filter2.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
+ filter3.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
+ table.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
+ reset.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
+ reset.setMargin(new Insets(2, 2, 2, 2));
+ reset.setText("Reset");
+ reset.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ reset_actionPerformed(e);
+ }
+ });
+ jPanel2.setLayout(borderLayout1);
+ borderLayout1.setHgap(5);
+ registryURL.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
+ scrollPane.getViewport().add(table);
+ fullDetailsScrollpane.getViewport().add(fullDetails);
+ jScrollPane3.getViewport().add(filter2);
+ jScrollPane4.getViewport().add(filter3);
+ jPanel1.add(refresh, null);
+ jPanel1.add(addLocal, null);
+ jPanel1.add(progressBar, null);
+ jScrollPane2.getViewport().add(filter1);
+ this.add(jPanel1, new GridBagConstraints(0, 3, 3, 1, 1.0, 1.0,
+ GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
+ new Insets(0, 0, 0, 0), 0, 0));
+ this.add(fullDetailsScrollpane, new GridBagConstraints(1, 0, 2, 1, 1.0,
+ 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
+ new Insets(3, 0, 0, 3), 240, 130));
+ this.add(scrollPane, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
+ GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(
+ 3, 2, 0, 0), 150, 130));
+ jPanel2.add(registryLabel, java.awt.BorderLayout.WEST);
+ jPanel2.add(registryURL, java.awt.BorderLayout.CENTER);
+ jPanel2.add(reset, java.awt.BorderLayout.EAST);
+ this.add(jPanel2, new GridBagConstraints(0, 2, 3, 1, 0.0, 0.0,
+ GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
+ new Insets(5, 10, 0, 10), 339, 0));
+ this.add(jScrollPane2, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0,
+ GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(
+ 0, 0, 0, 60), 80, 60));
+ this.add(jScrollPane4, new GridBagConstraints(2, 1, 1, 1, 1.0, 1.0,
+ GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(
+ 0, -80, 0, 0), 80, 60));
+ this.add(jScrollPane3, new GridBagConstraints(1, 1, 1, 1, 1.0, 1.0,
+ GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(
+ 0, -60, 0, 80), 80, 60));
+ }
+
+ protected JTable table = new JTable();
+
+ protected JEditorPane fullDetails = new JEditorPane("text/html", "");
+
+ TitledBorder titledBorder1 = new TitledBorder("Available DAS Sources");
+
+ protected JButton refresh = new JButton();
+
+ protected JProgressBar progressBar = new JProgressBar();
+
+ protected JScrollPane scrollPane = new JScrollPane();
+
+ TitledBorder titledBorder2 = new TitledBorder("Full Details");
+
+ protected JScrollPane fullDetailsScrollpane = new JScrollPane();
+
+ protected JList filter1 = new JList();
+
+ protected JList filter2 = new JList();
+
+ protected JList filter3 = new JList();
+
+ JScrollPane jScrollPane2 = new JScrollPane();
+
+ JScrollPane jScrollPane3 = new JScrollPane();
+
+ JScrollPane jScrollPane4 = new JScrollPane();
+
+ protected JTextField registryURL = new JTextField();
+
+ protected JLabel registryLabel = new JLabel();
+
+ protected JButton addLocal = new JButton();
+
+ JPanel jPanel1 = new JPanel();
+
+ FlowLayout flowLayout1 = new FlowLayout();
+
+ GridBagLayout gridBagLayout1 = new GridBagLayout();
+
+ TitledBorder titledBorder3 = new TitledBorder("Authority:");
+
+ TitledBorder titledBorder4 = new TitledBorder("Type:");
+
+ TitledBorder titledBorder5 = new TitledBorder("Label:");
+
+ JButton reset = new JButton();
+
+ JPanel jPanel2 = new JPanel();
+
+ BorderLayout borderLayout1 = new BorderLayout();
+
+ public void refresh_actionPerformed(ActionEvent e)
+ {
+
+ }
+
+ public void fullDetails_hyperlinkUpdate(HyperlinkEvent e)
+ {
+ try
+ {
+
+ if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED)
+ {
+ jalview.util.BrowserLauncher.openURL(e.getURL().toString());
+ }
+ } catch (Exception ex)
+ {
+ System.out.println(e.getURL());
+ ex.printStackTrace();
+ }
+ }
+
+ public void amendLocal(boolean newSource)
+ {
+
+ }
+
+ public void reset_actionPerformed(ActionEvent e)
+ {
+
+ }
+
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ */
package jalview.jbgui;
import java.awt.Dimension;
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ */
package jalview.jbgui;
import jalview.gui.JvSwingUtils;
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
package jalview.renderer;
import jalview.analysis.AAFrequency;
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
package jalview.renderer;
import java.awt.FontMetrics;
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2;
/**
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2.descriptors;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2.descriptors;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2.descriptors;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2.descriptors;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2.descriptors;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2.descriptors;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2.descriptors;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2.descriptors;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2.descriptors;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2.descriptors;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2.descriptors;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2.descriptors;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2.descriptors;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2.descriptors;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2.descriptors;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2.descriptors;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2.descriptors;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2.descriptors;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2.descriptors;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2.descriptors;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2.descriptors;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2.descriptors;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2.descriptors;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2.descriptors;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2.descriptors;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2.descriptors;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2.descriptors;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2.descriptors;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2.descriptors;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2.descriptors;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2.descriptors;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2.descriptors;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2.descriptors;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2.descriptors;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2.descriptors;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2.descriptors;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2.descriptors;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2.descriptors;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2.descriptors;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2.descriptors;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2.descriptors;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2.descriptors;
//---------------------------------/
/*
- * 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.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.schemabinding.version2.descriptors;
//---------------------------------/
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
package jalview.schemes;
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.schemes;\r
-\r
-public class ScoreMatrix\r
-{\r
- String name;\r
-\r
- /**\r
- * reference to integer score matrix\r
- */\r
- int[][] matrix;\r
-\r
- /**\r
- * 0 for Protein Score matrix. 1 for dna score matrix\r
- */\r
- int type;\r
-\r
- ScoreMatrix(String name, int[][] matrix, int type)\r
- {\r
- this.matrix = matrix;\r
- this.type = type;\r
- }\r
-\r
- public boolean isDNA()\r
- {\r
- return type == 1;\r
- }\r
-\r
- public boolean isProtein()\r
- {\r
- return type == 0;\r
- }\r
-\r
- public int[][] getMatrix()\r
- {\r
- return matrix;\r
- }\r
-\r
- /**\r
- * \r
- * @param A1\r
- * @param A2\r
- * @return score for substituting first char in A1 with first char in A2\r
- */\r
- public int getPairwiseScore(String A1, String A2)\r
- {\r
- return getPairwiseScore(A1.charAt(0), A2.charAt(0));\r
- }\r
-\r
- public int getPairwiseScore(char c, char d)\r
- {\r
- int pog = 0;\r
-\r
- try\r
- {\r
- int a = (type == 0) ? ResidueProperties.aaIndex[c]\r
- : ResidueProperties.nucleotideIndex[c];\r
- int b = (type == 0) ? ResidueProperties.aaIndex[d]\r
- : ResidueProperties.nucleotideIndex[d];\r
-\r
- pog = matrix[a][b];\r
- } catch (Exception e)\r
- {\r
- // System.out.println("Unknown residue in " + A1 + " " + A2);\r
- }\r
-\r
- return pog;\r
- }\r
-\r
- /**\r
- * pretty print the matrix\r
- */\r
- public String toString()\r
- {\r
- return outputMatrix(false);\r
- }\r
-\r
- public String outputMatrix(boolean html)\r
- {\r
- StringBuffer sb = new StringBuffer();\r
- int[] symbols = (type == 0) ? ResidueProperties.aaIndex\r
- : ResidueProperties.nucleotideIndex;\r
- int symMax = (type == 0) ? ResidueProperties.maxProteinIndex\r
- : ResidueProperties.maxNucleotideIndex;\r
- boolean header = true;\r
- if (html)\r
- {\r
- sb.append("<table>");\r
- }\r
- for (char sym = 'A'; sym <= 'Z'; sym++)\r
- {\r
- if (symbols[sym] >= 0 && symbols[sym] < symMax)\r
- {\r
- if (header)\r
- {\r
- sb.append(html ? "<tr><td></td>" : "");\r
- for (char sym2 = 'A'; sym2 <= 'Z'; sym2++)\r
- {\r
- if (symbols[sym2] >= 0 && symbols[sym2] < symMax)\r
- {\r
- sb.append((html ? "<td> " : "\t") + sym2\r
- + (html ? " </td>" : ""));\r
- }\r
- }\r
- header = false;\r
- sb.append(html ? "</tr>\n" : "\n");\r
- }\r
- if (html)\r
- {\r
- sb.append("<tr>");\r
- }\r
- sb.append((html ? "<td>" : "") + sym + (html ? "</td>" : ""));\r
- for (char sym2 = 'A'; sym2 <= 'Z'; sym2++)\r
- {\r
- if (symbols[sym2] >= 0 && symbols[sym2] < symMax)\r
- {\r
- sb.append((html ? "<td>" : "\t")\r
- + matrix[symbols[sym]][symbols[sym2]]\r
- + (html ? "</td>" : ""));\r
- }\r
- }\r
- sb.append(html ? "</tr>\n" : "\n");\r
- }\r
- }\r
- if (html)\r
- {\r
- sb.append("</table>");\r
- }\r
- return sb.toString();\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.schemes;
+
+public class ScoreMatrix
+{
+ String name;
+
+ /**
+ * reference to integer score matrix
+ */
+ int[][] matrix;
+
+ /**
+ * 0 for Protein Score matrix. 1 for dna score matrix
+ */
+ int type;
+
+ ScoreMatrix(String name, int[][] matrix, int type)
+ {
+ this.matrix = matrix;
+ this.type = type;
+ }
+
+ public boolean isDNA()
+ {
+ return type == 1;
+ }
+
+ public boolean isProtein()
+ {
+ return type == 0;
+ }
+
+ public int[][] getMatrix()
+ {
+ return matrix;
+ }
+
+ /**
+ *
+ * @param A1
+ * @param A2
+ * @return score for substituting first char in A1 with first char in A2
+ */
+ public int getPairwiseScore(String A1, String A2)
+ {
+ return getPairwiseScore(A1.charAt(0), A2.charAt(0));
+ }
+
+ public int getPairwiseScore(char c, char d)
+ {
+ int pog = 0;
+
+ try
+ {
+ int a = (type == 0) ? ResidueProperties.aaIndex[c]
+ : ResidueProperties.nucleotideIndex[c];
+ int b = (type == 0) ? ResidueProperties.aaIndex[d]
+ : ResidueProperties.nucleotideIndex[d];
+
+ pog = matrix[a][b];
+ } catch (Exception e)
+ {
+ // System.out.println("Unknown residue in " + A1 + " " + A2);
+ }
+
+ return pog;
+ }
+
+ /**
+ * pretty print the matrix
+ */
+ public String toString()
+ {
+ return outputMatrix(false);
+ }
+
+ public String outputMatrix(boolean html)
+ {
+ StringBuffer sb = new StringBuffer();
+ int[] symbols = (type == 0) ? ResidueProperties.aaIndex
+ : ResidueProperties.nucleotideIndex;
+ int symMax = (type == 0) ? ResidueProperties.maxProteinIndex
+ : ResidueProperties.maxNucleotideIndex;
+ boolean header = true;
+ if (html)
+ {
+ sb.append("<table>");
+ }
+ for (char sym = 'A'; sym <= 'Z'; sym++)
+ {
+ if (symbols[sym] >= 0 && symbols[sym] < symMax)
+ {
+ if (header)
+ {
+ sb.append(html ? "<tr><td></td>" : "");
+ for (char sym2 = 'A'; sym2 <= 'Z'; sym2++)
+ {
+ if (symbols[sym2] >= 0 && symbols[sym2] < symMax)
+ {
+ sb.append((html ? "<td> " : "\t") + sym2
+ + (html ? " </td>" : ""));
+ }
+ }
+ header = false;
+ sb.append(html ? "</tr>\n" : "\n");
+ }
+ if (html)
+ {
+ sb.append("<tr>");
+ }
+ sb.append((html ? "<td>" : "") + sym + (html ? "</td>" : ""));
+ for (char sym2 = 'A'; sym2 <= 'Z'; sym2++)
+ {
+ if (symbols[sym2] >= 0 && symbols[sym2] < symMax)
+ {
+ sb.append((html ? "<td>" : "\t")
+ + matrix[symbols[sym]][symbols[sym2]]
+ + (html ? "</td>" : ""));
+ }
+ }
+ sb.append(html ? "</tr>\n" : "\n");
+ }
+ }
+ if (html)
+ {
+ sb.append("</table>");
+ }
+ return sb.toString();
+ }
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
package jalview.schemes;
import jalview.analysis.SequenceIdMatcher;
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ */
package jalview.structure;
import jalview.api.AlignmentViewPanel;
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ */
package jalview.structure;
/**
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.structure;\r
-\r
-import jalview.datamodel.SequenceI;\r
-\r
-/**\r
- * The vamsasListener allows peers to receive mouseOver events from any Jalview\r
- * alignment window.\r
- * \r
- * @author JimP\r
- * \r
- * @history Version 1 released for Jalview 2.4.\r
- * @history Version 2 mouseOver refactored to include an additional parameter\r
- * allowing the source of the event to be passed to the handler.\r
- * \r
- * \r
- */\r
-public interface VamsasListener\r
-{\r
- public void mouseOver(SequenceI seq, int index, VamsasSource source);\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.structure;
+
+import jalview.datamodel.SequenceI;
+
+/**
+ * The vamsasListener allows peers to receive mouseOver events from any Jalview
+ * alignment window.
+ *
+ * @author JimP
+ *
+ * @history Version 1 released for Jalview 2.4.
+ * @history Version 2 mouseOver refactored to include an additional parameter
+ * allowing the source of the event to be passed to the handler.
+ *
+ *
+ */
+public interface VamsasListener
+{
+ public void mouseOver(SequenceI seq, int index, VamsasSource source);
+}
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ */
package jalview.structure;
/**
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
*
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
/**
* author: Lauren Michelle Lui
*/
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ */
package jalview.util;
import java.util.ArrayList;
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.util;\r
-\r
-/**\r
- * System platform information used by Applet and Application\r
- * \r
- * @author Jim Procter\r
- */\r
-public class Platform\r
-{\r
- /**\r
- * sorry folks - Macs really are different\r
- * \r
- * @return true if we do things in a special way.\r
- */\r
- public boolean isAMac()\r
- {\r
- return java.lang.System.getProperty("os.name").indexOf("Mac") > -1;\r
-\r
- }\r
-\r
- public boolean isHeadless()\r
- {\r
- String hdls = java.lang.System.getProperty("java.awt.headless");\r
-\r
- return hdls != null && hdls.equals("true");\r
- }\r
-\r
- /**\r
- * \r
- * @return nominal maximum command line length for this platform\r
- */\r
- public static int getMaxCommandLineLength()\r
- {\r
- // TODO: determine nominal limits for most platforms.\r
- return 2046; // this is the max length for a windows NT system.\r
- }\r
-\r
- /**\r
- * escape a string according to the local platform's escape character\r
- * \r
- * @param file\r
- * @return escaped file\r
- */\r
- public static String escapeString(String file)\r
- {\r
- StringBuffer f = new StringBuffer();\r
- int p = 0, lastp = 0;\r
- while ((p = file.indexOf('\\', lastp)) > -1)\r
- {\r
- f.append(file.subSequence(lastp, p));\r
- f.append("\\\\");\r
- lastp = p + 1;\r
- }\r
- f.append(file.substring(lastp));\r
- return f.toString();\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.util;
+
+/**
+ * System platform information used by Applet and Application
+ *
+ * @author Jim Procter
+ */
+public class Platform
+{
+ /**
+ * sorry folks - Macs really are different
+ *
+ * @return true if we do things in a special way.
+ */
+ public boolean isAMac()
+ {
+ return java.lang.System.getProperty("os.name").indexOf("Mac") > -1;
+
+ }
+
+ public boolean isHeadless()
+ {
+ String hdls = java.lang.System.getProperty("java.awt.headless");
+
+ return hdls != null && hdls.equals("true");
+ }
+
+ /**
+ *
+ * @return nominal maximum command line length for this platform
+ */
+ public static int getMaxCommandLineLength()
+ {
+ // TODO: determine nominal limits for most platforms.
+ return 2046; // this is the max length for a windows NT system.
+ }
+
+ /**
+ * escape a string according to the local platform's escape character
+ *
+ * @param file
+ * @return escaped file
+ */
+ public static String escapeString(String file)
+ {
+ StringBuffer f = new StringBuffer();
+ int p = 0, lastp = 0;
+ while ((p = file.indexOf('\\', lastp)) > -1)
+ {
+ f.append(file.subSequence(lastp, p));
+ f.append("\\\\");
+ lastp = p + 1;
+ }
+ f.append(file.substring(lastp));
+ return f.toString();
+ }
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.util;\r
-\r
-import java.util.*;\r
-\r
-/**\r
- * ShiftList Simple way of mapping a linear series to a new linear range with\r
- * new points introduced. Use at your own risk! Now growing to be used for\r
- * interval ranges (position, offset) storing deletions/insertions\r
- */\r
-public class ShiftList\r
-{\r
- public Vector shifts;\r
-\r
- public ShiftList()\r
- {\r
- shifts = new Vector();\r
- }\r
-\r
- /**\r
- * addShift\r
- * \r
- * @param pos\r
- * start position for shift (in original reference frame)\r
- * @param shift\r
- * length of shift\r
- */\r
- public void addShift(int pos, int shift)\r
- {\r
- int sidx = 0;\r
- int[] rshift = null;\r
- while (sidx < shifts.size()\r
- && (rshift = (int[]) shifts.elementAt(sidx))[0] < pos)\r
- {\r
- sidx++;\r
- }\r
- if (sidx == shifts.size())\r
- {\r
- shifts.insertElementAt(new int[]\r
- { pos, shift }, sidx);\r
- }\r
- else\r
- {\r
- rshift[1] += shift;\r
- }\r
- }\r
-\r
- /**\r
- * shift\r
- * \r
- * @param pos\r
- * int\r
- * @return int shifted position\r
- */\r
- public int shift(int pos)\r
- {\r
- if (shifts.size() == 0)\r
- {\r
- return pos;\r
- }\r
- int shifted = pos;\r
- int sidx = 0;\r
- int rshift[];\r
- while (sidx < shifts.size()\r
- && (rshift = ((int[]) shifts.elementAt(sidx++)))[0] <= pos)\r
- {\r
- shifted += rshift[1];\r
- }\r
- return shifted;\r
- }\r
-\r
- /**\r
- * clear all shifts\r
- */\r
- public void clear()\r
- {\r
- shifts.removeAllElements();\r
- }\r
-\r
- /**\r
- * invert the shifts\r
- * \r
- * @return ShiftList with inverse shift operations\r
- */\r
- public ShiftList getInverse()\r
- {\r
- ShiftList inverse = new ShiftList();\r
- if (shifts != null)\r
- {\r
- for (int i = 0, j = shifts.size(); i < j; i++)\r
- {\r
- int[] sh = (int[]) shifts.elementAt(i);\r
- if (sh != null)\r
- {\r
- inverse.shifts.addElement(new int[]\r
- { sh[0], -sh[1] });\r
- }\r
- }\r
- }\r
- return inverse;\r
- }\r
-\r
- /**\r
- * parse a 1d map of position 1<i<n to L<pos[i]<N such as that returned from\r
- * SequenceI.gapMap()\r
- * \r
- * @param gapMap\r
- * @return shifts from map index to mapped position\r
- */\r
- public static ShiftList parseMap(int[] gapMap)\r
- {\r
- ShiftList shiftList = null;\r
- if (gapMap != null && gapMap.length > 0)\r
- {\r
- shiftList = new ShiftList();\r
- for (int i = 0, p = 0; i < gapMap.length; p++, i++)\r
- {\r
- if (p != gapMap[i])\r
- {\r
- shiftList.addShift(p, gapMap[i] - p);\r
- p = gapMap[i];\r
- }\r
- }\r
- }\r
- return shiftList;\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.util;
+
+import java.util.*;
+
+/**
+ * ShiftList Simple way of mapping a linear series to a new linear range with
+ * new points introduced. Use at your own risk! Now growing to be used for
+ * interval ranges (position, offset) storing deletions/insertions
+ */
+public class ShiftList
+{
+ public Vector shifts;
+
+ public ShiftList()
+ {
+ shifts = new Vector();
+ }
+
+ /**
+ * addShift
+ *
+ * @param pos
+ * start position for shift (in original reference frame)
+ * @param shift
+ * length of shift
+ */
+ public void addShift(int pos, int shift)
+ {
+ int sidx = 0;
+ int[] rshift = null;
+ while (sidx < shifts.size()
+ && (rshift = (int[]) shifts.elementAt(sidx))[0] < pos)
+ {
+ sidx++;
+ }
+ if (sidx == shifts.size())
+ {
+ shifts.insertElementAt(new int[]
+ { pos, shift }, sidx);
+ }
+ else
+ {
+ rshift[1] += shift;
+ }
+ }
+
+ /**
+ * shift
+ *
+ * @param pos
+ * int
+ * @return int shifted position
+ */
+ public int shift(int pos)
+ {
+ if (shifts.size() == 0)
+ {
+ return pos;
+ }
+ int shifted = pos;
+ int sidx = 0;
+ int rshift[];
+ while (sidx < shifts.size()
+ && (rshift = ((int[]) shifts.elementAt(sidx++)))[0] <= pos)
+ {
+ shifted += rshift[1];
+ }
+ return shifted;
+ }
+
+ /**
+ * clear all shifts
+ */
+ public void clear()
+ {
+ shifts.removeAllElements();
+ }
+
+ /**
+ * invert the shifts
+ *
+ * @return ShiftList with inverse shift operations
+ */
+ public ShiftList getInverse()
+ {
+ ShiftList inverse = new ShiftList();
+ if (shifts != null)
+ {
+ for (int i = 0, j = shifts.size(); i < j; i++)
+ {
+ int[] sh = (int[]) shifts.elementAt(i);
+ if (sh != null)
+ {
+ inverse.shifts.addElement(new int[]
+ { sh[0], -sh[1] });
+ }
+ }
+ }
+ return inverse;
+ }
+
+ /**
+ * parse a 1d map of position 1<i<n to L<pos[i]<N such as that returned from
+ * SequenceI.gapMap()
+ *
+ * @param gapMap
+ * @return shifts from map index to mapped position
+ */
+ public static ShiftList parseMap(int[] gapMap)
+ {
+ ShiftList shiftList = null;
+ if (gapMap != null && gapMap.length > 0)
+ {
+ shiftList = new ShiftList();
+ for (int i = 0, p = 0; i < gapMap.length; p++, i++)
+ {
+ if (p != gapMap[i])
+ {
+ shiftList.addShift(p, gapMap[i] - p);
+ p = gapMap[i];
+ }
+ }
+ }
+ return shiftList;
+ }
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.util;\r
-\r
-import java.util.*;\r
-import java.util.List;\r
-\r
-import java.awt.*;\r
-import java.awt.event.*;\r
-import javax.swing.*;\r
-import javax.swing.event.*;\r
-import javax.swing.table.*;\r
-\r
-/**\r
- * TableSorter is a decorator for TableModels; adding sorting functionality to a\r
- * supplied TableModel. TableSorter does not store or copy the data in its\r
- * TableModel; instead it maintains a map from the row indexes of the view to\r
- * the row indexes of the model. As requests are made of the sorter (like\r
- * getValueAt(row, col)) they are passed to the underlying model after the row\r
- * numbers have been translated via the internal mapping array. This way, the\r
- * TableSorter appears to hold another copy of the table with the rows in a\r
- * different order.\r
- * <p/>\r
- * TableSorter registers itself as a listener to the underlying model, just as\r
- * the JTable itself would. Events recieved from the model are examined,\r
- * sometimes manipulated (typically widened), and then passed on to the\r
- * TableSorter's listeners (typically the JTable). If a change to the model has\r
- * invalidated the order of TableSorter's rows, a note of this is made and the\r
- * sorter will resort the rows the next time a value is requested.\r
- * <p/>\r
- * When the tableHeader property is set, either by using the setTableHeader()\r
- * method or the two argument constructor, the table header may be used as a\r
- * complete UI for TableSorter. The default renderer of the tableHeader is\r
- * decorated with a renderer that indicates the sorting status of each column.\r
- * In addition, a mouse listener is installed with the following behavior:\r
- * <ul>\r
- * <li>Mouse-click: Clears the sorting status of all other columns and advances\r
- * the sorting status of that column through three values: {NOT_SORTED,\r
- * ASCENDING, DESCENDING} (then back to NOT_SORTED again).\r
- * <li>SHIFT-mouse-click: Clears the sorting status of all other columns and\r
- * cycles the sorting status of the column through the same three values, in the\r
- * opposite order: {NOT_SORTED, DESCENDING, ASCENDING}.\r
- * <li>CONTROL-mouse-click and CONTROL-SHIFT-mouse-click: as above except that\r
- * the changes to the column do not cancel the statuses of columns that are\r
- * already sorting - giving a way to initiate a compound sort.\r
- * </ul>\r
- * <p/>\r
- * This is a long overdue rewrite of a class of the same name that first\r
- * appeared in the swing table demos in 1997.\r
- * \r
- * @author Philip Milne\r
- * @author Brendon McLean\r
- * @author Dan van Enckevort\r
- * @author Parwinder Sekhon\r
- * @version 2.0 02/27/04\r
- */\r
-\r
-public class TableSorter extends AbstractTableModel\r
-{\r
- protected TableModel tableModel;\r
-\r
- public static final int DESCENDING = -1;\r
-\r
- public static final int NOT_SORTED = 0;\r
-\r
- public static final int ASCENDING = 1;\r
-\r
- private static Directive EMPTY_DIRECTIVE = new Directive(-1, NOT_SORTED);\r
-\r
- public static final Comparator COMPARABLE_COMAPRATOR = new Comparator()\r
- {\r
- public int compare(Object o1, Object o2)\r
- {\r
- return ((Comparable) o1).compareTo(o2);\r
- }\r
- };\r
-\r
- public static final Comparator LEXICAL_COMPARATOR = new Comparator()\r
- {\r
- public int compare(Object o1, Object o2)\r
- {\r
- return o1.toString().compareTo(o2.toString());\r
- }\r
- };\r
-\r
- private Row[] viewToModel;\r
-\r
- private int[] modelToView;\r
-\r
- private JTableHeader tableHeader;\r
-\r
- private MouseListener mouseListener;\r
-\r
- private TableModelListener tableModelListener;\r
-\r
- private Map columnComparators = new HashMap();\r
-\r
- private List sortingColumns = new ArrayList();\r
-\r
- public TableSorter()\r
- {\r
- this.mouseListener = new MouseHandler();\r
- this.tableModelListener = new TableModelHandler();\r
- }\r
-\r
- public TableSorter(TableModel tableModel)\r
- {\r
- this();\r
- setTableModel(tableModel);\r
- }\r
-\r
- public TableSorter(TableModel tableModel, JTableHeader tableHeader)\r
- {\r
- this();\r
- setTableHeader(tableHeader);\r
- setTableModel(tableModel);\r
- }\r
-\r
- private void clearSortingState()\r
- {\r
- viewToModel = null;\r
- modelToView = null;\r
- }\r
-\r
- public TableModel getTableModel()\r
- {\r
- return tableModel;\r
- }\r
-\r
- public void setTableModel(TableModel tableModel)\r
- {\r
- if (this.tableModel != null)\r
- {\r
- this.tableModel.removeTableModelListener(tableModelListener);\r
- }\r
-\r
- this.tableModel = tableModel;\r
- if (this.tableModel != null)\r
- {\r
- this.tableModel.addTableModelListener(tableModelListener);\r
- }\r
-\r
- clearSortingState();\r
- fireTableStructureChanged();\r
- }\r
-\r
- public JTableHeader getTableHeader()\r
- {\r
- return tableHeader;\r
- }\r
-\r
- public void setTableHeader(JTableHeader tableHeader)\r
- {\r
- if (this.tableHeader != null)\r
- {\r
- this.tableHeader.removeMouseListener(mouseListener);\r
- TableCellRenderer defaultRenderer = this.tableHeader\r
- .getDefaultRenderer();\r
- if (defaultRenderer instanceof SortableHeaderRenderer)\r
- {\r
- this.tableHeader\r
- .setDefaultRenderer(((SortableHeaderRenderer) defaultRenderer).tableCellRenderer);\r
- }\r
- }\r
- this.tableHeader = tableHeader;\r
- if (this.tableHeader != null)\r
- {\r
- this.tableHeader.addMouseListener(mouseListener);\r
- this.tableHeader.setDefaultRenderer(new SortableHeaderRenderer(\r
- this.tableHeader.getDefaultRenderer()));\r
- }\r
- }\r
-\r
- public boolean isSorting()\r
- {\r
- return sortingColumns.size() != 0;\r
- }\r
-\r
- private Directive getDirective(int column)\r
- {\r
- for (int i = 0; i < sortingColumns.size(); i++)\r
- {\r
- Directive directive = (Directive) sortingColumns.get(i);\r
- if (directive.column == column)\r
- {\r
- return directive;\r
- }\r
- }\r
- return EMPTY_DIRECTIVE;\r
- }\r
-\r
- public int getSortingStatus(int column)\r
- {\r
- return getDirective(column).direction;\r
- }\r
-\r
- private void sortingStatusChanged()\r
- {\r
- clearSortingState();\r
- fireTableDataChanged();\r
- if (tableHeader != null)\r
- {\r
- tableHeader.repaint();\r
- }\r
- }\r
-\r
- public void setSortingStatus(int column, int status)\r
- {\r
- Directive directive = getDirective(column);\r
- if (directive != EMPTY_DIRECTIVE)\r
- {\r
- sortingColumns.remove(directive);\r
- }\r
- if (status != NOT_SORTED)\r
- {\r
- sortingColumns.add(new Directive(column, status));\r
- }\r
- sortingStatusChanged();\r
- }\r
-\r
- protected Icon getHeaderRendererIcon(int column, int size)\r
- {\r
- Directive directive = getDirective(column);\r
- if (directive == EMPTY_DIRECTIVE)\r
- {\r
- return null;\r
- }\r
- return new Arrow(directive.direction == DESCENDING, size,\r
- sortingColumns.indexOf(directive));\r
- }\r
-\r
- private void cancelSorting()\r
- {\r
- sortingColumns.clear();\r
- sortingStatusChanged();\r
- }\r
-\r
- public void setColumnComparator(Class type, Comparator comparator)\r
- {\r
- if (comparator == null)\r
- {\r
- columnComparators.remove(type);\r
- }\r
- else\r
- {\r
- columnComparators.put(type, comparator);\r
- }\r
- }\r
-\r
- protected Comparator getComparator(int column)\r
- {\r
- Class columnType = tableModel.getColumnClass(column);\r
- Comparator comparator = (Comparator) columnComparators.get(columnType);\r
- if (comparator != null)\r
- {\r
- return comparator;\r
- }\r
- if (Comparable.class.isAssignableFrom(columnType))\r
- {\r
- return COMPARABLE_COMAPRATOR;\r
- }\r
- return LEXICAL_COMPARATOR;\r
- }\r
-\r
- private Row[] getViewToModel()\r
- {\r
- if (viewToModel == null)\r
- {\r
- int tableModelRowCount = tableModel.getRowCount();\r
- viewToModel = new Row[tableModelRowCount];\r
- for (int row = 0; row < tableModelRowCount; row++)\r
- {\r
- viewToModel[row] = new Row(row);\r
- }\r
-\r
- if (isSorting())\r
- {\r
- Arrays.sort(viewToModel);\r
- }\r
- }\r
- return viewToModel;\r
- }\r
-\r
- public int modelIndex(int viewIndex)\r
- {\r
- return getViewToModel()[viewIndex].modelIndex;\r
- }\r
-\r
- private int[] getModelToView()\r
- {\r
- if (modelToView == null)\r
- {\r
- int n = getViewToModel().length;\r
- modelToView = new int[n];\r
- for (int i = 0; i < n; i++)\r
- {\r
- modelToView[modelIndex(i)] = i;\r
- }\r
- }\r
- return modelToView;\r
- }\r
-\r
- // TableModel interface methods\r
-\r
- public int getRowCount()\r
- {\r
- return (tableModel == null) ? 0 : tableModel.getRowCount();\r
- }\r
-\r
- public int getColumnCount()\r
- {\r
- return (tableModel == null) ? 0 : tableModel.getColumnCount();\r
- }\r
-\r
- public String getColumnName(int column)\r
- {\r
- return tableModel.getColumnName(column);\r
- }\r
-\r
- public Class getColumnClass(int column)\r
- {\r
- return tableModel.getColumnClass(column);\r
- }\r
-\r
- public boolean isCellEditable(int row, int column)\r
- {\r
- return tableModel.isCellEditable(modelIndex(row), column);\r
- }\r
-\r
- public Object getValueAt(int row, int column)\r
- {\r
- return tableModel.getValueAt(modelIndex(row), column);\r
- }\r
-\r
- public void setValueAt(Object aValue, int row, int column)\r
- {\r
- tableModel.setValueAt(aValue, modelIndex(row), column);\r
- }\r
-\r
- // Helper classes\r
-\r
- private class Row implements Comparable\r
- {\r
- private int modelIndex;\r
-\r
- public Row(int index)\r
- {\r
- this.modelIndex = index;\r
- }\r
-\r
- public int compareTo(Object o)\r
- {\r
- int row1 = modelIndex;\r
- int row2 = ((Row) o).modelIndex;\r
-\r
- for (Iterator it = sortingColumns.iterator(); it.hasNext();)\r
- {\r
- Directive directive = (Directive) it.next();\r
- int column = directive.column;\r
- Object o1 = tableModel.getValueAt(row1, column);\r
- Object o2 = tableModel.getValueAt(row2, column);\r
-\r
- int comparison = 0;\r
- // Define null less than everything, except null.\r
- if (o1 == null && o2 == null)\r
- {\r
- comparison = 0;\r
- }\r
- else if (o1 == null)\r
- {\r
- comparison = -1;\r
- }\r
- else if (o2 == null)\r
- {\r
- comparison = 1;\r
- }\r
- else\r
- {\r
- comparison = getComparator(column).compare(o1, o2);\r
- }\r
- if (comparison != 0)\r
- {\r
- return directive.direction == DESCENDING ? -comparison\r
- : comparison;\r
- }\r
- }\r
- return 0;\r
- }\r
- }\r
-\r
- private class TableModelHandler implements TableModelListener\r
- {\r
- public void tableChanged(TableModelEvent e)\r
- {\r
- // If we're not sorting by anything, just pass the event along.\r
- if (!isSorting())\r
- {\r
- clearSortingState();\r
- fireTableChanged(e);\r
- return;\r
- }\r
-\r
- // If the table structure has changed, cancel the sorting; the\r
- // sorting columns may have been either moved or deleted from\r
- // the model.\r
- if (e.getFirstRow() == TableModelEvent.HEADER_ROW)\r
- {\r
- cancelSorting();\r
- fireTableChanged(e);\r
- return;\r
- }\r
-\r
- // We can map a cell event through to the view without widening\r
- // when the following conditions apply:\r
- //\r
- // a) all the changes are on one row (e.getFirstRow() == e.getLastRow())\r
- // and,\r
- // b) all the changes are in one column (column !=\r
- // TableModelEvent.ALL_COLUMNS) and,\r
- // c) we are not sorting on that column (getSortingStatus(column) ==\r
- // NOT_SORTED) and,\r
- // d) a reverse lookup will not trigger a sort (modelToView != null)\r
- //\r
- // Note: INSERT and DELETE events fail this test as they have column ==\r
- // ALL_COLUMNS.\r
- //\r
- // The last check, for (modelToView != null) is to see if modelToView\r
- // is already allocated. If we don't do this check; sorting can become\r
- // a performance bottleneck for applications where cells\r
- // change rapidly in different parts of the table. If cells\r
- // change alternately in the sorting column and then outside of\r
- // it this class can end up re-sorting on alternate cell updates -\r
- // which can be a performance problem for large tables. The last\r
- // clause avoids this problem.\r
- int column = e.getColumn();\r
- if (e.getFirstRow() == e.getLastRow()\r
- && column != TableModelEvent.ALL_COLUMNS\r
- && getSortingStatus(column) == NOT_SORTED\r
- && modelToView != null)\r
- {\r
- int viewIndex = getModelToView()[e.getFirstRow()];\r
- fireTableChanged(new TableModelEvent(TableSorter.this, viewIndex,\r
- viewIndex, column, e.getType()));\r
- return;\r
- }\r
-\r
- // Something has happened to the data that may have invalidated the row\r
- // order.\r
- clearSortingState();\r
- fireTableDataChanged();\r
- return;\r
- }\r
- }\r
-\r
- private class MouseHandler extends MouseAdapter\r
- {\r
- public void mouseClicked(MouseEvent e)\r
- {\r
- JTableHeader h = (JTableHeader) e.getSource();\r
- TableColumnModel columnModel = h.getColumnModel();\r
- int viewColumn = columnModel.getColumnIndexAtX(e.getX());\r
- int column = columnModel.getColumn(viewColumn).getModelIndex();\r
- if (column != -1)\r
- {\r
- int status = getSortingStatus(column);\r
- if (!e.isControlDown())\r
- {\r
- cancelSorting();\r
- }\r
- // Cycle the sorting states through {NOT_SORTED, ASCENDING, DESCENDING}\r
- // or\r
- // {NOT_SORTED, DESCENDING, ASCENDING} depending on whether shift is\r
- // pressed.\r
- status = status + (e.isShiftDown() ? -1 : 1);\r
- status = (status + 4) % 3 - 1; // signed mod, returning {-1, 0, 1}\r
- setSortingStatus(column, status);\r
- }\r
- }\r
- }\r
-\r
- private static class Arrow implements Icon\r
- {\r
- private boolean descending;\r
-\r
- private int size;\r
-\r
- private int priority;\r
-\r
- public Arrow(boolean descending, int size, int priority)\r
- {\r
- this.descending = descending;\r
- this.size = size;\r
- this.priority = priority;\r
- }\r
-\r
- public void paintIcon(Component c, Graphics g, int x, int y)\r
- {\r
- Color color = c == null ? Color.GRAY : c.getBackground();\r
- // In a compound sort, make each succesive triangle 20%\r
- // smaller than the previous one.\r
- int dx = (int) (size / 2 * Math.pow(0.8, priority));\r
- int dy = descending ? dx : -dx;\r
- // Align icon (roughly) with font baseline.\r
- y = y + 5 * size / 6 + (descending ? -dy : 0);\r
- int shift = descending ? 1 : -1;\r
- g.translate(x, y);\r
-\r
- // Right diagonal.\r
- g.setColor(color.darker());\r
- g.drawLine(dx / 2, dy, 0, 0);\r
- g.drawLine(dx / 2, dy + shift, 0, shift);\r
-\r
- // Left diagonal.\r
- g.setColor(color.brighter());\r
- g.drawLine(dx / 2, dy, dx, 0);\r
- g.drawLine(dx / 2, dy + shift, dx, shift);\r
-\r
- // Horizontal line.\r
- if (descending)\r
- {\r
- g.setColor(color.darker().darker());\r
- }\r
- else\r
- {\r
- g.setColor(color.brighter().brighter());\r
- }\r
- g.drawLine(dx, 0, 0, 0);\r
-\r
- g.setColor(color);\r
- g.translate(-x, -y);\r
- }\r
-\r
- public int getIconWidth()\r
- {\r
- return size;\r
- }\r
-\r
- public int getIconHeight()\r
- {\r
- return size;\r
- }\r
- }\r
-\r
- private class SortableHeaderRenderer implements TableCellRenderer\r
- {\r
- private TableCellRenderer tableCellRenderer;\r
-\r
- public SortableHeaderRenderer(TableCellRenderer tableCellRenderer)\r
- {\r
- this.tableCellRenderer = tableCellRenderer;\r
- }\r
-\r
- public Component getTableCellRendererComponent(JTable table,\r
- Object value, boolean isSelected, boolean hasFocus, int row,\r
- int column)\r
- {\r
- Component c = tableCellRenderer.getTableCellRendererComponent(table,\r
- value, isSelected, hasFocus, row, column);\r
- if (c instanceof JLabel)\r
- {\r
- JLabel l = (JLabel) c;\r
- l.setHorizontalTextPosition(JLabel.LEFT);\r
- int modelColumn = table.convertColumnIndexToModel(column);\r
- l.setIcon(getHeaderRendererIcon(modelColumn, l.getFont().getSize()));\r
- }\r
- return c;\r
- }\r
- }\r
-\r
- private static class Directive\r
- {\r
- private int column;\r
-\r
- private int direction;\r
-\r
- public Directive(int column, int direction)\r
- {\r
- this.column = column;\r
- this.direction = direction;\r
- }\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.util;
+
+import java.util.*;
+import java.util.List;
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import javax.swing.table.*;
+
+/**
+ * TableSorter is a decorator for TableModels; adding sorting functionality to a
+ * supplied TableModel. TableSorter does not store or copy the data in its
+ * TableModel; instead it maintains a map from the row indexes of the view to
+ * the row indexes of the model. As requests are made of the sorter (like
+ * getValueAt(row, col)) they are passed to the underlying model after the row
+ * numbers have been translated via the internal mapping array. This way, the
+ * TableSorter appears to hold another copy of the table with the rows in a
+ * different order.
+ * <p/>
+ * TableSorter registers itself as a listener to the underlying model, just as
+ * the JTable itself would. Events recieved from the model are examined,
+ * sometimes manipulated (typically widened), and then passed on to the
+ * TableSorter's listeners (typically the JTable). If a change to the model has
+ * invalidated the order of TableSorter's rows, a note of this is made and the
+ * sorter will resort the rows the next time a value is requested.
+ * <p/>
+ * When the tableHeader property is set, either by using the setTableHeader()
+ * method or the two argument constructor, the table header may be used as a
+ * complete UI for TableSorter. The default renderer of the tableHeader is
+ * decorated with a renderer that indicates the sorting status of each column.
+ * In addition, a mouse listener is installed with the following behavior:
+ * <ul>
+ * <li>Mouse-click: Clears the sorting status of all other columns and advances
+ * the sorting status of that column through three values: {NOT_SORTED,
+ * ASCENDING, DESCENDING} (then back to NOT_SORTED again).
+ * <li>SHIFT-mouse-click: Clears the sorting status of all other columns and
+ * cycles the sorting status of the column through the same three values, in the
+ * opposite order: {NOT_SORTED, DESCENDING, ASCENDING}.
+ * <li>CONTROL-mouse-click and CONTROL-SHIFT-mouse-click: as above except that
+ * the changes to the column do not cancel the statuses of columns that are
+ * already sorting - giving a way to initiate a compound sort.
+ * </ul>
+ * <p/>
+ * This is a long overdue rewrite of a class of the same name that first
+ * appeared in the swing table demos in 1997.
+ *
+ * @author Philip Milne
+ * @author Brendon McLean
+ * @author Dan van Enckevort
+ * @author Parwinder Sekhon
+ * @version 2.0 02/27/04
+ */
+
+public class TableSorter extends AbstractTableModel
+{
+ protected TableModel tableModel;
+
+ public static final int DESCENDING = -1;
+
+ public static final int NOT_SORTED = 0;
+
+ public static final int ASCENDING = 1;
+
+ private static Directive EMPTY_DIRECTIVE = new Directive(-1, NOT_SORTED);
+
+ public static final Comparator COMPARABLE_COMAPRATOR = new Comparator()
+ {
+ public int compare(Object o1, Object o2)
+ {
+ return ((Comparable) o1).compareTo(o2);
+ }
+ };
+
+ public static final Comparator LEXICAL_COMPARATOR = new Comparator()
+ {
+ public int compare(Object o1, Object o2)
+ {
+ return o1.toString().compareTo(o2.toString());
+ }
+ };
+
+ private Row[] viewToModel;
+
+ private int[] modelToView;
+
+ private JTableHeader tableHeader;
+
+ private MouseListener mouseListener;
+
+ private TableModelListener tableModelListener;
+
+ private Map columnComparators = new HashMap();
+
+ private List sortingColumns = new ArrayList();
+
+ public TableSorter()
+ {
+ this.mouseListener = new MouseHandler();
+ this.tableModelListener = new TableModelHandler();
+ }
+
+ public TableSorter(TableModel tableModel)
+ {
+ this();
+ setTableModel(tableModel);
+ }
+
+ public TableSorter(TableModel tableModel, JTableHeader tableHeader)
+ {
+ this();
+ setTableHeader(tableHeader);
+ setTableModel(tableModel);
+ }
+
+ private void clearSortingState()
+ {
+ viewToModel = null;
+ modelToView = null;
+ }
+
+ public TableModel getTableModel()
+ {
+ return tableModel;
+ }
+
+ public void setTableModel(TableModel tableModel)
+ {
+ if (this.tableModel != null)
+ {
+ this.tableModel.removeTableModelListener(tableModelListener);
+ }
+
+ this.tableModel = tableModel;
+ if (this.tableModel != null)
+ {
+ this.tableModel.addTableModelListener(tableModelListener);
+ }
+
+ clearSortingState();
+ fireTableStructureChanged();
+ }
+
+ public JTableHeader getTableHeader()
+ {
+ return tableHeader;
+ }
+
+ public void setTableHeader(JTableHeader tableHeader)
+ {
+ if (this.tableHeader != null)
+ {
+ this.tableHeader.removeMouseListener(mouseListener);
+ TableCellRenderer defaultRenderer = this.tableHeader
+ .getDefaultRenderer();
+ if (defaultRenderer instanceof SortableHeaderRenderer)
+ {
+ this.tableHeader
+ .setDefaultRenderer(((SortableHeaderRenderer) defaultRenderer).tableCellRenderer);
+ }
+ }
+ this.tableHeader = tableHeader;
+ if (this.tableHeader != null)
+ {
+ this.tableHeader.addMouseListener(mouseListener);
+ this.tableHeader.setDefaultRenderer(new SortableHeaderRenderer(
+ this.tableHeader.getDefaultRenderer()));
+ }
+ }
+
+ public boolean isSorting()
+ {
+ return sortingColumns.size() != 0;
+ }
+
+ private Directive getDirective(int column)
+ {
+ for (int i = 0; i < sortingColumns.size(); i++)
+ {
+ Directive directive = (Directive) sortingColumns.get(i);
+ if (directive.column == column)
+ {
+ return directive;
+ }
+ }
+ return EMPTY_DIRECTIVE;
+ }
+
+ public int getSortingStatus(int column)
+ {
+ return getDirective(column).direction;
+ }
+
+ private void sortingStatusChanged()
+ {
+ clearSortingState();
+ fireTableDataChanged();
+ if (tableHeader != null)
+ {
+ tableHeader.repaint();
+ }
+ }
+
+ public void setSortingStatus(int column, int status)
+ {
+ Directive directive = getDirective(column);
+ if (directive != EMPTY_DIRECTIVE)
+ {
+ sortingColumns.remove(directive);
+ }
+ if (status != NOT_SORTED)
+ {
+ sortingColumns.add(new Directive(column, status));
+ }
+ sortingStatusChanged();
+ }
+
+ protected Icon getHeaderRendererIcon(int column, int size)
+ {
+ Directive directive = getDirective(column);
+ if (directive == EMPTY_DIRECTIVE)
+ {
+ return null;
+ }
+ return new Arrow(directive.direction == DESCENDING, size,
+ sortingColumns.indexOf(directive));
+ }
+
+ private void cancelSorting()
+ {
+ sortingColumns.clear();
+ sortingStatusChanged();
+ }
+
+ public void setColumnComparator(Class type, Comparator comparator)
+ {
+ if (comparator == null)
+ {
+ columnComparators.remove(type);
+ }
+ else
+ {
+ columnComparators.put(type, comparator);
+ }
+ }
+
+ protected Comparator getComparator(int column)
+ {
+ Class columnType = tableModel.getColumnClass(column);
+ Comparator comparator = (Comparator) columnComparators.get(columnType);
+ if (comparator != null)
+ {
+ return comparator;
+ }
+ if (Comparable.class.isAssignableFrom(columnType))
+ {
+ return COMPARABLE_COMAPRATOR;
+ }
+ return LEXICAL_COMPARATOR;
+ }
+
+ private Row[] getViewToModel()
+ {
+ if (viewToModel == null)
+ {
+ int tableModelRowCount = tableModel.getRowCount();
+ viewToModel = new Row[tableModelRowCount];
+ for (int row = 0; row < tableModelRowCount; row++)
+ {
+ viewToModel[row] = new Row(row);
+ }
+
+ if (isSorting())
+ {
+ Arrays.sort(viewToModel);
+ }
+ }
+ return viewToModel;
+ }
+
+ public int modelIndex(int viewIndex)
+ {
+ return getViewToModel()[viewIndex].modelIndex;
+ }
+
+ private int[] getModelToView()
+ {
+ if (modelToView == null)
+ {
+ int n = getViewToModel().length;
+ modelToView = new int[n];
+ for (int i = 0; i < n; i++)
+ {
+ modelToView[modelIndex(i)] = i;
+ }
+ }
+ return modelToView;
+ }
+
+ // TableModel interface methods
+
+ public int getRowCount()
+ {
+ return (tableModel == null) ? 0 : tableModel.getRowCount();
+ }
+
+ public int getColumnCount()
+ {
+ return (tableModel == null) ? 0 : tableModel.getColumnCount();
+ }
+
+ public String getColumnName(int column)
+ {
+ return tableModel.getColumnName(column);
+ }
+
+ public Class getColumnClass(int column)
+ {
+ return tableModel.getColumnClass(column);
+ }
+
+ public boolean isCellEditable(int row, int column)
+ {
+ return tableModel.isCellEditable(modelIndex(row), column);
+ }
+
+ public Object getValueAt(int row, int column)
+ {
+ return tableModel.getValueAt(modelIndex(row), column);
+ }
+
+ public void setValueAt(Object aValue, int row, int column)
+ {
+ tableModel.setValueAt(aValue, modelIndex(row), column);
+ }
+
+ // Helper classes
+
+ private class Row implements Comparable
+ {
+ private int modelIndex;
+
+ public Row(int index)
+ {
+ this.modelIndex = index;
+ }
+
+ public int compareTo(Object o)
+ {
+ int row1 = modelIndex;
+ int row2 = ((Row) o).modelIndex;
+
+ for (Iterator it = sortingColumns.iterator(); it.hasNext();)
+ {
+ Directive directive = (Directive) it.next();
+ int column = directive.column;
+ Object o1 = tableModel.getValueAt(row1, column);
+ Object o2 = tableModel.getValueAt(row2, column);
+
+ int comparison = 0;
+ // Define null less than everything, except null.
+ if (o1 == null && o2 == null)
+ {
+ comparison = 0;
+ }
+ else if (o1 == null)
+ {
+ comparison = -1;
+ }
+ else if (o2 == null)
+ {
+ comparison = 1;
+ }
+ else
+ {
+ comparison = getComparator(column).compare(o1, o2);
+ }
+ if (comparison != 0)
+ {
+ return directive.direction == DESCENDING ? -comparison
+ : comparison;
+ }
+ }
+ return 0;
+ }
+ }
+
+ private class TableModelHandler implements TableModelListener
+ {
+ public void tableChanged(TableModelEvent e)
+ {
+ // If we're not sorting by anything, just pass the event along.
+ if (!isSorting())
+ {
+ clearSortingState();
+ fireTableChanged(e);
+ return;
+ }
+
+ // If the table structure has changed, cancel the sorting; the
+ // sorting columns may have been either moved or deleted from
+ // the model.
+ if (e.getFirstRow() == TableModelEvent.HEADER_ROW)
+ {
+ cancelSorting();
+ fireTableChanged(e);
+ return;
+ }
+
+ // We can map a cell event through to the view without widening
+ // when the following conditions apply:
+ //
+ // a) all the changes are on one row (e.getFirstRow() == e.getLastRow())
+ // and,
+ // b) all the changes are in one column (column !=
+ // TableModelEvent.ALL_COLUMNS) and,
+ // c) we are not sorting on that column (getSortingStatus(column) ==
+ // NOT_SORTED) and,
+ // d) a reverse lookup will not trigger a sort (modelToView != null)
+ //
+ // Note: INSERT and DELETE events fail this test as they have column ==
+ // ALL_COLUMNS.
+ //
+ // The last check, for (modelToView != null) is to see if modelToView
+ // is already allocated. If we don't do this check; sorting can become
+ // a performance bottleneck for applications where cells
+ // change rapidly in different parts of the table. If cells
+ // change alternately in the sorting column and then outside of
+ // it this class can end up re-sorting on alternate cell updates -
+ // which can be a performance problem for large tables. The last
+ // clause avoids this problem.
+ int column = e.getColumn();
+ if (e.getFirstRow() == e.getLastRow()
+ && column != TableModelEvent.ALL_COLUMNS
+ && getSortingStatus(column) == NOT_SORTED
+ && modelToView != null)
+ {
+ int viewIndex = getModelToView()[e.getFirstRow()];
+ fireTableChanged(new TableModelEvent(TableSorter.this, viewIndex,
+ viewIndex, column, e.getType()));
+ return;
+ }
+
+ // Something has happened to the data that may have invalidated the row
+ // order.
+ clearSortingState();
+ fireTableDataChanged();
+ return;
+ }
+ }
+
+ private class MouseHandler extends MouseAdapter
+ {
+ public void mouseClicked(MouseEvent e)
+ {
+ JTableHeader h = (JTableHeader) e.getSource();
+ TableColumnModel columnModel = h.getColumnModel();
+ int viewColumn = columnModel.getColumnIndexAtX(e.getX());
+ int column = columnModel.getColumn(viewColumn).getModelIndex();
+ if (column != -1)
+ {
+ int status = getSortingStatus(column);
+ if (!e.isControlDown())
+ {
+ cancelSorting();
+ }
+ // Cycle the sorting states through {NOT_SORTED, ASCENDING, DESCENDING}
+ // or
+ // {NOT_SORTED, DESCENDING, ASCENDING} depending on whether shift is
+ // pressed.
+ status = status + (e.isShiftDown() ? -1 : 1);
+ status = (status + 4) % 3 - 1; // signed mod, returning {-1, 0, 1}
+ setSortingStatus(column, status);
+ }
+ }
+ }
+
+ private static class Arrow implements Icon
+ {
+ private boolean descending;
+
+ private int size;
+
+ private int priority;
+
+ public Arrow(boolean descending, int size, int priority)
+ {
+ this.descending = descending;
+ this.size = size;
+ this.priority = priority;
+ }
+
+ public void paintIcon(Component c, Graphics g, int x, int y)
+ {
+ Color color = c == null ? Color.GRAY : c.getBackground();
+ // In a compound sort, make each succesive triangle 20%
+ // smaller than the previous one.
+ int dx = (int) (size / 2 * Math.pow(0.8, priority));
+ int dy = descending ? dx : -dx;
+ // Align icon (roughly) with font baseline.
+ y = y + 5 * size / 6 + (descending ? -dy : 0);
+ int shift = descending ? 1 : -1;
+ g.translate(x, y);
+
+ // Right diagonal.
+ g.setColor(color.darker());
+ g.drawLine(dx / 2, dy, 0, 0);
+ g.drawLine(dx / 2, dy + shift, 0, shift);
+
+ // Left diagonal.
+ g.setColor(color.brighter());
+ g.drawLine(dx / 2, dy, dx, 0);
+ g.drawLine(dx / 2, dy + shift, dx, shift);
+
+ // Horizontal line.
+ if (descending)
+ {
+ g.setColor(color.darker().darker());
+ }
+ else
+ {
+ g.setColor(color.brighter().brighter());
+ }
+ g.drawLine(dx, 0, 0, 0);
+
+ g.setColor(color);
+ g.translate(-x, -y);
+ }
+
+ public int getIconWidth()
+ {
+ return size;
+ }
+
+ public int getIconHeight()
+ {
+ return size;
+ }
+ }
+
+ private class SortableHeaderRenderer implements TableCellRenderer
+ {
+ private TableCellRenderer tableCellRenderer;
+
+ public SortableHeaderRenderer(TableCellRenderer tableCellRenderer)
+ {
+ this.tableCellRenderer = tableCellRenderer;
+ }
+
+ public Component getTableCellRendererComponent(JTable table,
+ Object value, boolean isSelected, boolean hasFocus, int row,
+ int column)
+ {
+ Component c = tableCellRenderer.getTableCellRendererComponent(table,
+ value, isSelected, hasFocus, row, column);
+ if (c instanceof JLabel)
+ {
+ JLabel l = (JLabel) c;
+ l.setHorizontalTextPosition(JLabel.LEFT);
+ int modelColumn = table.convertColumnIndexToModel(column);
+ l.setIcon(getHeaderRendererIcon(modelColumn, l.getFont().getSize()));
+ }
+ return c;
+ }
+ }
+
+ private static class Directive
+ {
+ private int column;
+
+ private int direction;
+
+ public Directive(int column, int direction)
+ {
+ this.column = column;
+ this.direction = direction;
+ }
+ }
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.util;\r
-\r
-import java.util.Vector;\r
-\r
-public class UrlLink\r
-{\r
- /**\r
- * helper class to parse URL Link strings taken from applet parameters or\r
- * jalview properties file using the com.stevesoft.pat.Regex implementation.\r
- * Jalview 2.4 extension allows regular expressions to be used to parse ID\r
- * strings and replace the result in the URL. Regex's operate on the whole ID\r
- * string given to the matchURL method, if no regex is supplied, then only\r
- * text following the first pipe symbol will be susbstituted. Usage\r
- * documentation todo.\r
- */\r
- private String url_suffix, url_prefix, target, label, regexReplace;\r
-\r
- private boolean dynamic = false;\r
-\r
- private String invalidMessage = null;\r
-\r
- /**\r
- * parse the given linkString of the form '<label>|<url>' into parts url may\r
- * contain a string $SEQUENCE_ID<=optional regex=>$ where <=optional regex=>\r
- * must be of the form =/<perl style regex>/=$\r
- * \r
- * @param link\r
- */\r
- public UrlLink(String link)\r
- {\r
- int sep = link.indexOf("|"), psqid = link.indexOf("$SEQUENCE_ID");\r
- if (psqid > -1)\r
- {\r
- dynamic = true;\r
- int p = sep;\r
- do\r
- {\r
- sep = p;\r
- p = link.indexOf("|", sep + 1);\r
- } while (p > sep && p < psqid);\r
- // Assuming that the URL itself does not contain any '|' symbols\r
- // sep now contains last pipe symbol position prior to any regex symbols\r
- label = link.substring(0, sep);\r
- if (label.indexOf("|") > -1)\r
- {\r
- // | terminated database name / www target at start of Label\r
- target = label.substring(0, label.indexOf("|"));\r
- }\r
- else if (label.indexOf(" ") > 2)\r
- {\r
- // space separated Label - matches database name\r
- target = label.substring(0, label.indexOf(" "));\r
- }\r
- else\r
- {\r
- target = label;\r
- }\r
- // Parse URL : Whole URL string first\r
- url_prefix = link.substring(sep + 1, psqid);\r
- if (link.indexOf("$SEQUENCE_ID=/") == psqid\r
- && (p = link.indexOf("/=$", psqid + 14)) > psqid + 14)\r
- {\r
- // Extract Regex and suffix\r
- url_suffix = link.substring(p + 3);\r
- regexReplace = link.substring(psqid + 14, p);\r
- try\r
- {\r
- com.stevesoft.pat.Regex rg = com.stevesoft.pat.Regex.perlCode("/"\r
- + regexReplace + "/");\r
- if (rg == null)\r
- {\r
- invalidMessage = "Invalid Regular Expression : '"\r
- + regexReplace + "'\n";\r
- }\r
- } catch (Exception e)\r
- {\r
- invalidMessage = "Invalid Regular Expression : '" + regexReplace\r
- + "'\n";\r
- }\r
- }\r
- else\r
- {\r
- regexReplace = null;\r
- // verify format is really correct.\r
- if (link.indexOf("$SEQUENCE_ID$") == psqid)\r
- {\r
- url_suffix = link.substring(psqid + 13);\r
- regexReplace = null;\r
- }\r
- else\r
- {\r
- invalidMessage = "Warning: invalid regex structure for URL link : "\r
- + link;\r
- }\r
- }\r
- }\r
- else\r
- {\r
- target = link.substring(0, sep);\r
- label = link.substring(0, sep = link.lastIndexOf("|"));\r
- url_prefix = link.substring(sep + 1);\r
- regexReplace = null; // implies we trim any prefix if necessary //\r
- // regexReplace=".*\\|?(.*)";\r
- url_suffix = null;\r
- }\r
- }\r
-\r
- /**\r
- * @return the url_suffix\r
- */\r
- public String getUrl_suffix()\r
- {\r
- return url_suffix;\r
- }\r
-\r
- /**\r
- * @return the url_prefix\r
- */\r
- public String getUrl_prefix()\r
- {\r
- return url_prefix;\r
- }\r
-\r
- /**\r
- * @return the target\r
- */\r
- public String getTarget()\r
- {\r
- return target;\r
- }\r
-\r
- /**\r
- * @return the label\r
- */\r
- public String getLabel()\r
- {\r
- return label;\r
- }\r
-\r
- /**\r
- * @return the regexReplace\r
- */\r
- public String getRegexReplace()\r
- {\r
- return regexReplace;\r
- }\r
-\r
- /**\r
- * @return the invalidMessage\r
- */\r
- public String getInvalidMessage()\r
- {\r
- return invalidMessage;\r
- }\r
-\r
- /**\r
- * Check if URL string was parsed properly.\r
- * \r
- * @return boolean - if false then <code>getInvalidMessage</code> returns an\r
- * error message\r
- */\r
- public boolean isValid()\r
- {\r
- return invalidMessage == null;\r
- }\r
-\r
- /**\r
- * return one or more URL strings by applying regex to the given idstring\r
- * \r
- * @param idstring\r
- * @param onlyIfMatches\r
- * - when true url strings are only made if regex is defined and\r
- * matches\r
- * @return String[] { part of idstring substituted, full substituted url , ..\r
- * next part, next url..}\r
- */\r
- public String[] makeUrls(String idstring, boolean onlyIfMatches)\r
- {\r
- if (dynamic)\r
- {\r
- if (regexReplace != null)\r
- {\r
- com.stevesoft.pat.Regex rg = com.stevesoft.pat.Regex.perlCode("/"\r
- + regexReplace + "/");\r
- if (rg.search(idstring))\r
- {\r
- int ns = rg.numSubs();\r
- if (ns == 0)\r
- {\r
- // take whole regex\r
- return new String[]\r
- { rg.stringMatched(),\r
- url_prefix + rg.stringMatched() + url_suffix };\r
- } /*\r
- * else if (ns==1) { // take only subgroup match return new String[]\r
- * { rg.stringMatched(1), url_prefix+rg.stringMatched(1)+url_suffix\r
- * }; }\r
- */\r
- else\r
- {\r
- // debug\r
- for (int s = 0; s <= rg.numSubs(); s++)\r
- {\r
- System.err.println("Sub " + s + " : " + rg.matchedFrom(s)\r
- + " : " + rg.matchedTo(s) + " : '"\r
- + rg.stringMatched(s) + "'");\r
- }\r
- // try to collate subgroup matches\r
- Vector subs = new Vector();\r
- // have to loop through submatches, collating them at top level\r
- // match\r
- int s = 0; // 1;\r
- while (s <= ns)\r
- {\r
- if (s + 1 <= ns && rg.matchedTo(s) > -1\r
- && rg.matchedTo(s + 1) > -1\r
- && rg.matchedTo(s + 1) < rg.matchedTo(s))\r
- {\r
- // s is top level submatch. search for submatches enclosed by\r
- // this one\r
- int r = s + 1;\r
- String mtch = "";\r
- while (r <= ns && rg.matchedTo(r) <= rg.matchedTo(s))\r
- {\r
- if (rg.matchedFrom(r) > -1)\r
- {\r
- mtch += rg.stringMatched(r);\r
- }\r
- r++;\r
- }\r
- if (mtch.length() > 0)\r
- {\r
- subs.addElement(mtch);\r
- subs.addElement(url_prefix + mtch + url_suffix);\r
- }\r
- s = r;\r
- }\r
- else\r
- {\r
- if (rg.matchedFrom(s) > -1)\r
- {\r
- subs.addElement(rg.stringMatched(s));\r
- subs.addElement(url_prefix + rg.stringMatched(s)\r
- + url_suffix);\r
- }\r
- s++;\r
- }\r
- }\r
-\r
- String[] res = new String[subs.size()];\r
- for (int r = 0, rs = subs.size(); r < rs; r++)\r
- {\r
- res[r] = (String) subs.elementAt(r);\r
- }\r
- subs.removeAllElements();\r
- return res;\r
- }\r
- }\r
- if (onlyIfMatches)\r
- {\r
- return null;\r
- }\r
- }\r
- /* Otherwise - trim off any 'prefix' - pre 2.4 Jalview behaviour */\r
- if (idstring.indexOf("|") > -1)\r
- {\r
- idstring = idstring.substring(idstring.lastIndexOf("|") + 1);\r
- }\r
-\r
- // just return simple url substitution.\r
- return new String[]\r
- { idstring, url_prefix + idstring + url_suffix };\r
- }\r
- else\r
- {\r
- return new String[]\r
- { "", url_prefix };\r
- }\r
- }\r
-\r
- public String toString()\r
- {\r
- return label\r
- + "|"\r
- + url_prefix\r
- + (dynamic ? ("$SEQUENCE_ID" + ((regexReplace != null) ? "="\r
- + regexReplace + "=$" : "$")) : "")\r
- + ((url_suffix == null) ? "" : url_suffix);\r
-\r
- }\r
-\r
- private static void testUrls(UrlLink ul, String idstring, String[] urls)\r
- {\r
-\r
- if (urls == null)\r
- {\r
- System.out.println("Created NO urls.");\r
- }\r
- else\r
- {\r
- System.out.println("Created " + (urls.length / 2) + " Urls.");\r
- for (int uls = 0; uls < urls.length; uls += 2)\r
- {\r
- System.out.println("URL Replacement text : " + urls[uls]\r
- + " : URL : " + urls[uls + 1]);\r
- }\r
- }\r
- }\r
-\r
- public static void main(String argv[])\r
- {\r
- String[] links = new String[]\r
- {\r
- /*\r
- * "AlinkT|Target|http://foo.foo.soo/",\r
- * "myUrl1|http://$SEQUENCE_ID=/[0-9]+/=$.someserver.org/foo",\r
- * "myUrl2|http://$SEQUENCE_ID=/(([0-9]+).+([A-Za-z]+))/=$.someserver.org/foo"\r
- * ,\r
- * "myUrl3|http://$SEQUENCE_ID=/([0-9]+).+([A-Za-z]+)/=$.someserver.org/foo"\r
- * , "myUrl4|target|http://$SEQUENCE_ID$.someserver.org/foo|too",\r
- * "PF1|http://us.expasy.org/cgi-bin/niceprot.pl?$SEQUENCE_ID=/(?:PFAM:)?(.+)/=$"\r
- * ,\r
- * "PF2|http://us.expasy.org/cgi-bin/niceprot.pl?$SEQUENCE_ID=/(PFAM:)?(.+)/=$"\r
- * ,\r
- * "PF3|http://us.expasy.org/cgi-bin/niceprot.pl?$SEQUENCE_ID=/PFAM:(.+)/=$"\r
- * , "NOTFER|http://notfer.org/$SEQUENCE_ID=/(?<!\\s)(.+)/=$",\r
- */\r
- "NESTED|http://nested/$SEQUENCE_ID=/^(?:Label:)?(?:(?:gi\\|(\\d+))|([^:]+))/=$/nested" };\r
- String[] idstrings = new String[]\r
- {\r
- /*\r
- * //"LGUL_human", //"QWIQW_123123", "uniprot|why_do+_12313_foo",\r
- * //"123123312", "123123 ABCDE foo", "PFAM:PF23943",\r
- */\r
- "Label:gi|9234|pdb|102L|A" };\r
- // TODO: test the setLabel method.\r
- for (int i = 0; i < links.length; i++)\r
- {\r
- UrlLink ul = new UrlLink(links[i]);\r
- if (ul.isValid())\r
- {\r
- System.out.println("\n\n\n");\r
- System.out.println("Link " + i + " " + links[i] + " : "\r
- + ul.toString());\r
- System.out.println(" pref : "\r
- + ul.getUrl_prefix()\r
- + "\n suf : "\r
- + ul.getUrl_suffix()\r
- + "\n : "\r
- + ((ul.getRegexReplace() != null) ? ul.getRegexReplace()\r
- : ""));\r
- for (int ids = 0; ids < idstrings.length; ids++)\r
- {\r
- System.out.println("ID String : " + idstrings[ids]\r
- + "\nWithout onlyIfMatches:");\r
- String[] urls = ul.makeUrls(idstrings[ids], false);\r
- testUrls(ul, idstrings[ids], urls);\r
- System.out.println("With onlyIfMatches set.");\r
- urls = ul.makeUrls(idstrings[ids], true);\r
- testUrls(ul, idstrings[ids], urls);\r
- }\r
- }\r
- else\r
- {\r
- System.err.println("Invalid URLLink : " + links[i] + " : "\r
- + ul.getInvalidMessage());\r
- }\r
- }\r
- }\r
-\r
- public boolean isDynamic()\r
- {\r
- // TODO Auto-generated method stub\r
- return dynamic;\r
- }\r
-\r
- public void setLabel(String newlabel)\r
- {\r
- this.label = newlabel;\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.util;
+
+import java.util.Vector;
+
+public class UrlLink
+{
+ /**
+ * helper class to parse URL Link strings taken from applet parameters or
+ * jalview properties file using the com.stevesoft.pat.Regex implementation.
+ * Jalview 2.4 extension allows regular expressions to be used to parse ID
+ * strings and replace the result in the URL. Regex's operate on the whole ID
+ * string given to the matchURL method, if no regex is supplied, then only
+ * text following the first pipe symbol will be susbstituted. Usage
+ * documentation todo.
+ */
+ private String url_suffix, url_prefix, target, label, regexReplace;
+
+ private boolean dynamic = false;
+
+ private String invalidMessage = null;
+
+ /**
+ * parse the given linkString of the form '<label>|<url>' into parts url may
+ * contain a string $SEQUENCE_ID<=optional regex=>$ where <=optional regex=>
+ * must be of the form =/<perl style regex>/=$
+ *
+ * @param link
+ */
+ public UrlLink(String link)
+ {
+ int sep = link.indexOf("|"), psqid = link.indexOf("$SEQUENCE_ID");
+ if (psqid > -1)
+ {
+ dynamic = true;
+ int p = sep;
+ do
+ {
+ sep = p;
+ p = link.indexOf("|", sep + 1);
+ } while (p > sep && p < psqid);
+ // Assuming that the URL itself does not contain any '|' symbols
+ // sep now contains last pipe symbol position prior to any regex symbols
+ label = link.substring(0, sep);
+ if (label.indexOf("|") > -1)
+ {
+ // | terminated database name / www target at start of Label
+ target = label.substring(0, label.indexOf("|"));
+ }
+ else if (label.indexOf(" ") > 2)
+ {
+ // space separated Label - matches database name
+ target = label.substring(0, label.indexOf(" "));
+ }
+ else
+ {
+ target = label;
+ }
+ // Parse URL : Whole URL string first
+ url_prefix = link.substring(sep + 1, psqid);
+ if (link.indexOf("$SEQUENCE_ID=/") == psqid
+ && (p = link.indexOf("/=$", psqid + 14)) > psqid + 14)
+ {
+ // Extract Regex and suffix
+ url_suffix = link.substring(p + 3);
+ regexReplace = link.substring(psqid + 14, p);
+ try
+ {
+ com.stevesoft.pat.Regex rg = com.stevesoft.pat.Regex.perlCode("/"
+ + regexReplace + "/");
+ if (rg == null)
+ {
+ invalidMessage = "Invalid Regular Expression : '"
+ + regexReplace + "'\n";
+ }
+ } catch (Exception e)
+ {
+ invalidMessage = "Invalid Regular Expression : '" + regexReplace
+ + "'\n";
+ }
+ }
+ else
+ {
+ regexReplace = null;
+ // verify format is really correct.
+ if (link.indexOf("$SEQUENCE_ID$") == psqid)
+ {
+ url_suffix = link.substring(psqid + 13);
+ regexReplace = null;
+ }
+ else
+ {
+ invalidMessage = "Warning: invalid regex structure for URL link : "
+ + link;
+ }
+ }
+ }
+ else
+ {
+ target = link.substring(0, sep);
+ label = link.substring(0, sep = link.lastIndexOf("|"));
+ url_prefix = link.substring(sep + 1);
+ regexReplace = null; // implies we trim any prefix if necessary //
+ // regexReplace=".*\\|?(.*)";
+ url_suffix = null;
+ }
+ }
+
+ /**
+ * @return the url_suffix
+ */
+ public String getUrl_suffix()
+ {
+ return url_suffix;
+ }
+
+ /**
+ * @return the url_prefix
+ */
+ public String getUrl_prefix()
+ {
+ return url_prefix;
+ }
+
+ /**
+ * @return the target
+ */
+ public String getTarget()
+ {
+ return target;
+ }
+
+ /**
+ * @return the label
+ */
+ public String getLabel()
+ {
+ return label;
+ }
+
+ /**
+ * @return the regexReplace
+ */
+ public String getRegexReplace()
+ {
+ return regexReplace;
+ }
+
+ /**
+ * @return the invalidMessage
+ */
+ public String getInvalidMessage()
+ {
+ return invalidMessage;
+ }
+
+ /**
+ * Check if URL string was parsed properly.
+ *
+ * @return boolean - if false then <code>getInvalidMessage</code> returns an
+ * error message
+ */
+ public boolean isValid()
+ {
+ return invalidMessage == null;
+ }
+
+ /**
+ * return one or more URL strings by applying regex to the given idstring
+ *
+ * @param idstring
+ * @param onlyIfMatches
+ * - when true url strings are only made if regex is defined and
+ * matches
+ * @return String[] { part of idstring substituted, full substituted url , ..
+ * next part, next url..}
+ */
+ public String[] makeUrls(String idstring, boolean onlyIfMatches)
+ {
+ if (dynamic)
+ {
+ if (regexReplace != null)
+ {
+ com.stevesoft.pat.Regex rg = com.stevesoft.pat.Regex.perlCode("/"
+ + regexReplace + "/");
+ if (rg.search(idstring))
+ {
+ int ns = rg.numSubs();
+ if (ns == 0)
+ {
+ // take whole regex
+ return new String[]
+ { rg.stringMatched(),
+ url_prefix + rg.stringMatched() + url_suffix };
+ } /*
+ * else if (ns==1) { // take only subgroup match return new String[]
+ * { rg.stringMatched(1), url_prefix+rg.stringMatched(1)+url_suffix
+ * }; }
+ */
+ else
+ {
+ // debug
+ for (int s = 0; s <= rg.numSubs(); s++)
+ {
+ System.err.println("Sub " + s + " : " + rg.matchedFrom(s)
+ + " : " + rg.matchedTo(s) + " : '"
+ + rg.stringMatched(s) + "'");
+ }
+ // try to collate subgroup matches
+ Vector subs = new Vector();
+ // have to loop through submatches, collating them at top level
+ // match
+ int s = 0; // 1;
+ while (s <= ns)
+ {
+ if (s + 1 <= ns && rg.matchedTo(s) > -1
+ && rg.matchedTo(s + 1) > -1
+ && rg.matchedTo(s + 1) < rg.matchedTo(s))
+ {
+ // s is top level submatch. search for submatches enclosed by
+ // this one
+ int r = s + 1;
+ String mtch = "";
+ while (r <= ns && rg.matchedTo(r) <= rg.matchedTo(s))
+ {
+ if (rg.matchedFrom(r) > -1)
+ {
+ mtch += rg.stringMatched(r);
+ }
+ r++;
+ }
+ if (mtch.length() > 0)
+ {
+ subs.addElement(mtch);
+ subs.addElement(url_prefix + mtch + url_suffix);
+ }
+ s = r;
+ }
+ else
+ {
+ if (rg.matchedFrom(s) > -1)
+ {
+ subs.addElement(rg.stringMatched(s));
+ subs.addElement(url_prefix + rg.stringMatched(s)
+ + url_suffix);
+ }
+ s++;
+ }
+ }
+
+ String[] res = new String[subs.size()];
+ for (int r = 0, rs = subs.size(); r < rs; r++)
+ {
+ res[r] = (String) subs.elementAt(r);
+ }
+ subs.removeAllElements();
+ return res;
+ }
+ }
+ if (onlyIfMatches)
+ {
+ return null;
+ }
+ }
+ /* Otherwise - trim off any 'prefix' - pre 2.4 Jalview behaviour */
+ if (idstring.indexOf("|") > -1)
+ {
+ idstring = idstring.substring(idstring.lastIndexOf("|") + 1);
+ }
+
+ // just return simple url substitution.
+ return new String[]
+ { idstring, url_prefix + idstring + url_suffix };
+ }
+ else
+ {
+ return new String[]
+ { "", url_prefix };
+ }
+ }
+
+ public String toString()
+ {
+ return label
+ + "|"
+ + url_prefix
+ + (dynamic ? ("$SEQUENCE_ID" + ((regexReplace != null) ? "="
+ + regexReplace + "=$" : "$")) : "")
+ + ((url_suffix == null) ? "" : url_suffix);
+
+ }
+
+ private static void testUrls(UrlLink ul, String idstring, String[] urls)
+ {
+
+ if (urls == null)
+ {
+ System.out.println("Created NO urls.");
+ }
+ else
+ {
+ System.out.println("Created " + (urls.length / 2) + " Urls.");
+ for (int uls = 0; uls < urls.length; uls += 2)
+ {
+ System.out.println("URL Replacement text : " + urls[uls]
+ + " : URL : " + urls[uls + 1]);
+ }
+ }
+ }
+
+ public static void main(String argv[])
+ {
+ String[] links = new String[]
+ {
+ /*
+ * "AlinkT|Target|http://foo.foo.soo/",
+ * "myUrl1|http://$SEQUENCE_ID=/[0-9]+/=$.someserver.org/foo",
+ * "myUrl2|http://$SEQUENCE_ID=/(([0-9]+).+([A-Za-z]+))/=$.someserver.org/foo"
+ * ,
+ * "myUrl3|http://$SEQUENCE_ID=/([0-9]+).+([A-Za-z]+)/=$.someserver.org/foo"
+ * , "myUrl4|target|http://$SEQUENCE_ID$.someserver.org/foo|too",
+ * "PF1|http://us.expasy.org/cgi-bin/niceprot.pl?$SEQUENCE_ID=/(?:PFAM:)?(.+)/=$"
+ * ,
+ * "PF2|http://us.expasy.org/cgi-bin/niceprot.pl?$SEQUENCE_ID=/(PFAM:)?(.+)/=$"
+ * ,
+ * "PF3|http://us.expasy.org/cgi-bin/niceprot.pl?$SEQUENCE_ID=/PFAM:(.+)/=$"
+ * , "NOTFER|http://notfer.org/$SEQUENCE_ID=/(?<!\\s)(.+)/=$",
+ */
+ "NESTED|http://nested/$SEQUENCE_ID=/^(?:Label:)?(?:(?:gi\\|(\\d+))|([^:]+))/=$/nested" };
+ String[] idstrings = new String[]
+ {
+ /*
+ * //"LGUL_human", //"QWIQW_123123", "uniprot|why_do+_12313_foo",
+ * //"123123312", "123123 ABCDE foo", "PFAM:PF23943",
+ */
+ "Label:gi|9234|pdb|102L|A" };
+ // TODO: test the setLabel method.
+ for (int i = 0; i < links.length; i++)
+ {
+ UrlLink ul = new UrlLink(links[i]);
+ if (ul.isValid())
+ {
+ System.out.println("\n\n\n");
+ System.out.println("Link " + i + " " + links[i] + " : "
+ + ul.toString());
+ System.out.println(" pref : "
+ + ul.getUrl_prefix()
+ + "\n suf : "
+ + ul.getUrl_suffix()
+ + "\n : "
+ + ((ul.getRegexReplace() != null) ? ul.getRegexReplace()
+ : ""));
+ for (int ids = 0; ids < idstrings.length; ids++)
+ {
+ System.out.println("ID String : " + idstrings[ids]
+ + "\nWithout onlyIfMatches:");
+ String[] urls = ul.makeUrls(idstrings[ids], false);
+ testUrls(ul, idstrings[ids], urls);
+ System.out.println("With onlyIfMatches set.");
+ urls = ul.makeUrls(idstrings[ids], true);
+ testUrls(ul, idstrings[ids], urls);
+ }
+ }
+ else
+ {
+ System.err.println("Invalid URLLink : " + links[i] + " : "
+ + ul.getInvalidMessage());
+ }
+ }
+ }
+
+ public boolean isDynamic()
+ {
+ // TODO Auto-generated method stub
+ return dynamic;
+ }
+
+ public void setLabel(String newlabel)
+ {
+ this.label = newlabel;
+ }
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.util;\r
-\r
-import java.io.IOException;\r
-import java.util.jar.JarInputStream;\r
-\r
-/**\r
- * input stream provider interface to be implemented by any non-file or URL\r
- * datasources so that all Jar entries can be read from the datasource by\r
- * repeatedly re-opening the JarInputStream.\r
- * \r
- * This is a workaround necessary because castor's unmarshaller will close the\r
- * input stream after an unmarshalling session, which normally closes the whole\r
- * Jar input stream, not just the current JarEntry's stream.\r
- */\r
-public interface jarInputStreamProvider\r
-{\r
- /**\r
- * @return properly initialized jar input stream\r
- */\r
- JarInputStream getJarInputStream() throws IOException;\r
-\r
- /**\r
- * \r
- * @return human readable name for datasource used when reporting any problems\r
- * with it\r
- */\r
- String getFilename();\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.util;
+
+import java.io.IOException;
+import java.util.jar.JarInputStream;
+
+/**
+ * input stream provider interface to be implemented by any non-file or URL
+ * datasources so that all Jar entries can be read from the datasource by
+ * repeatedly re-opening the JarInputStream.
+ *
+ * This is a workaround necessary because castor's unmarshaller will close the
+ * input stream after an unmarshalling session, which normally closes the whole
+ * Jar input stream, not just the current JarEntry's stream.
+ */
+public interface jarInputStreamProvider
+{
+ /**
+ * @return properly initialized jar input stream
+ */
+ JarInputStream getJarInputStream() throws IOException;
+
+ /**
+ *
+ * @return human readable name for datasource used when reporting any problems
+ * with it
+ */
+ String getFilename();
+}
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
package jalview.viewmodel;
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
package jalview.viewmodel;
import java.util.Vector;
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
package jalview.workers;
import java.util.ArrayList;
-/**
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
*
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
package jalview.workers;
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
package jalview.workers;
import jalview.analysis.AAFrequency;
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
package jalview.workers;
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
package jalview.workers;
import java.util.Hashtable;
}
}
-}
\ No newline at end of file
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.ws;\r
-\r
-import jalview.analysis.AlignSeq;\r
-import jalview.bin.Cache;\r
-import jalview.datamodel.AlignmentI;\r
-import jalview.datamodel.DBRefEntry;\r
-import jalview.datamodel.DBRefSource;\r
-import jalview.datamodel.Mapping;\r
-import jalview.datamodel.SequenceFeature;\r
-import jalview.datamodel.SequenceI;\r
-import jalview.gui.AlignFrame;\r
-import jalview.gui.CutAndPasteTransfer;\r
-import jalview.gui.Desktop;\r
-import jalview.gui.IProgressIndicator;\r
-import jalview.gui.OOMWarning;\r
-import jalview.ws.dbsources.das.api.jalviewSourceI;\r
-import jalview.ws.seqfetcher.DbSourceProxy;\r
-\r
-import java.lang.reflect.Array;\r
-import java.util.ArrayList;\r
-import java.util.Enumeration;\r
-import java.util.Hashtable;\r
-import java.util.List;\r
-import java.util.StringTokenizer;\r
-import java.util.Vector;\r
-\r
-import uk.ac.ebi.picr.model.UPEntry;\r
-\r
-/**\r
- * Implements a runnable for validating a sequence against external databases\r
- * and then propagating references and features onto the sequence(s)\r
- * \r
- * @author $author$\r
- * @version $Revision$\r
- */\r
-public class DBRefFetcher implements Runnable\r
-{\r
- SequenceI[] dataset;\r
-\r
- IProgressIndicator af;\r
-\r
- CutAndPasteTransfer output = new CutAndPasteTransfer();\r
-\r
- StringBuffer sbuffer = new StringBuffer();\r
-\r
- boolean running = false;\r
-\r
- /**\r
- * picr client instance\r
- */\r
- uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperInterface picrClient = null;\r
-\r
- // /This will be a collection of Vectors of sequenceI refs.\r
- // The key will be the seq name or accession id of the seq\r
- Hashtable seqRefs;\r
-\r
- DbSourceProxy[] dbSources;\r
-\r
- SequenceFetcher sfetcher;\r
-\r
- private SequenceI[] alseqs;\r
-\r
- public DBRefFetcher()\r
- {\r
- }\r
-\r
- /**\r
- * Creates a new SequenceFeatureFetcher object and fetches from the currently\r
- * selected set of databases.\r
- * \r
- * @param seqs\r
- * fetch references for these sequences\r
- * @param af\r
- * the parent alignframe for progress bar monitoring.\r
- */\r
- public DBRefFetcher(SequenceI[] seqs, AlignFrame af)\r
- {\r
- this(seqs, af, null);\r
- }\r
-\r
- /**\r
- * Creates a new SequenceFeatureFetcher object and fetches from the currently\r
- * selected set of databases.\r
- * \r
- * @param seqs\r
- * fetch references for these sequences\r
- * @param af\r
- * the parent alignframe for progress bar monitoring.\r
- * @param sources\r
- * array of database source strings to query references from\r
- */\r
- public DBRefFetcher(SequenceI[] seqs, AlignFrame af,\r
- DbSourceProxy[] sources)\r
- {\r
- this.af = af;\r
- alseqs = new SequenceI[seqs.length];\r
- SequenceI[] ds = new SequenceI[seqs.length];\r
- for (int i = 0; i < seqs.length; i++)\r
- {\r
- alseqs[i] = seqs[i];\r
- if (seqs[i].getDatasetSequence() != null)\r
- ds[i] = seqs[i].getDatasetSequence();\r
- else\r
- ds[i] = seqs[i];\r
- }\r
- this.dataset = ds;\r
- // TODO Jalview 2.5 lots of this code should be in the gui package!\r
- sfetcher = jalview.gui.SequenceFetcher.getSequenceFetcherSingleton(af);\r
- if (sources == null)\r
- {\r
- // af.featureSettings_actionPerformed(null);\r
- String[] defdb = null, otherdb = sfetcher\r
- .getDbInstances(jalview.ws.dbsources.das.datamodel.DasSequenceSource.class);\r
- List<DbSourceProxy> selsources = new ArrayList<DbSourceProxy>();\r
- Vector dasselsrc = (af.featureSettings != null) ? af.featureSettings\r
- .getSelectedSources() : new jalview.gui.DasSourceBrowser()\r
- .getSelectedSources();\r
- Enumeration<jalviewSourceI> en = dasselsrc.elements();\r
- while (en.hasMoreElements())\r
- {\r
- jalviewSourceI src = en.nextElement();\r
- List<DbSourceProxy> sp = src.getSequenceSourceProxies();\r
- selsources.addAll(sp);\r
- if (sp.size() > 1)\r
- {\r
- Cache.log.debug("Added many Db Sources for :" + src.getTitle());\r
- }\r
- }\r
- // select appropriate databases based on alignFrame context.\r
- if (af.getViewport().getAlignment().isNucleotide())\r
- {\r
- defdb = DBRefSource.DNACODINGDBS;\r
- }\r
- else\r
- {\r
- defdb = DBRefSource.PROTEINDBS;\r
- }\r
- List<DbSourceProxy> srces = new ArrayList<DbSourceProxy>();\r
- for (String ddb : defdb)\r
- {\r
- List<DbSourceProxy> srcesfordb = sfetcher.getSourceProxy(ddb);\r
- if (srcesfordb != null)\r
- {\r
- srces.addAll(srcesfordb);\r
- }\r
- }\r
-\r
- // append the selected sequence sources to the default dbs\r
- srces.addAll(selsources);\r
- dbSources = srces.toArray(new DbSourceProxy[0]);\r
- }\r
- else\r
- {\r
- // we assume the caller knows what they're doing and ensured that all the\r
- // db source names are valid\r
- dbSources = sources;\r
- }\r
- }\r
-\r
- /**\r
- * retrieve all the das sequence sources and add them to the list of db\r
- * sources to retrieve from\r
- */\r
- public void appendAllDasSources()\r
- {\r
- if (dbSources == null)\r
- {\r
- dbSources = new DbSourceProxy[0];\r
- }\r
- // append additional sources\r
- DbSourceProxy[] otherdb = sfetcher\r
- .getDbSourceProxyInstances(jalview.ws.dbsources.das.datamodel.DasSequenceSource.class);\r
- if (otherdb != null && otherdb.length > 0)\r
- {\r
- DbSourceProxy[] newsrc = new DbSourceProxy[dbSources.length\r
- + otherdb.length];\r
- System.arraycopy(dbSources, 0, newsrc, 0, dbSources.length);\r
- System.arraycopy(otherdb, 0, newsrc, dbSources.length, otherdb.length);\r
- dbSources = newsrc;\r
- }\r
- }\r
-\r
- /**\r
- * start the fetcher thread\r
- * \r
- * @param waitTillFinished\r
- * true to block until the fetcher has finished\r
- */\r
- public void fetchDBRefs(boolean waitTillFinished)\r
- {\r
- Thread thread = new Thread(this);\r
- thread.start();\r
- running = true;\r
-\r
- if (waitTillFinished)\r
- {\r
- while (running)\r
- {\r
- try\r
- {\r
- Thread.sleep(500);\r
- } catch (Exception ex)\r
- {\r
- }\r
- }\r
- }\r
- }\r
-\r
- /**\r
- * The sequence will be added to a vector of sequences belonging to key which\r
- * could be either seq name or dbref id\r
- * \r
- * @param seq\r
- * SequenceI\r
- * @param key\r
- * String\r
- */\r
- void addSeqId(SequenceI seq, String key)\r
- {\r
- key = key.toUpperCase();\r
-\r
- Vector seqs;\r
- if (seqRefs.containsKey(key))\r
- {\r
- seqs = (Vector) seqRefs.get(key);\r
-\r
- if (seqs != null && !seqs.contains(seq))\r
- {\r
- seqs.addElement(seq);\r
- }\r
- else if (seqs == null)\r
- {\r
- seqs = new Vector();\r
- seqs.addElement(seq);\r
- }\r
-\r
- }\r
- else\r
- {\r
- seqs = new Vector();\r
- seqs.addElement(seq);\r
- }\r
-\r
- seqRefs.put(key, seqs);\r
- }\r
-\r
- /**\r
- * DOCUMENT ME!\r
- */\r
- public void run()\r
- {\r
- if (dbSources == null)\r
- {\r
- throw new Error("Implementation error. Must initialise dbSources");\r
- }\r
- running = true;\r
- long startTime = System.currentTimeMillis();\r
- af.setProgressBar("Fetching db refs", startTime);\r
- try\r
- {\r
- if (Cache.getDefault("DBREFFETCH_USEPICR", false))\r
- {\r
- picrClient = new uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperServiceLocator()\r
- .getAccessionMapperPort();\r
- }\r
- } catch (Exception e)\r
- {\r
- System.err.println("Couldn't locate PICR service instance.\n");\r
- e.printStackTrace();\r
- }\r
- int db = 0;\r
- Vector sdataset = new Vector();\r
- for (int s = 0; s < dataset.length; s++)\r
- {\r
- sdataset.addElement(dataset[s]);\r
- }\r
- while (sdataset.size() > 0 && db < dbSources.length)\r
- {\r
- int maxqlen = 1; // default number of queries made to at one time\r
- System.err.println("Verifying against " + dbSources[db].getDbName());\r
- boolean dn = false;\r
-\r
- // iterate through db for each remaining un-verified sequence\r
- SequenceI[] currSeqs = new SequenceI[sdataset.size()];\r
- sdataset.copyInto(currSeqs);// seqs that are to be validated against\r
- // dbSources[db]\r
- Vector queries = new Vector(); // generated queries curSeq\r
- seqRefs = new Hashtable();\r
-\r
- int seqIndex = 0;\r
-\r
- jalview.ws.seqfetcher.DbSourceProxy dbsource = dbSources[db];\r
- {\r
- // for moment, we dumbly iterate over all retrieval sources for a\r
- // particular database\r
- // TODO: introduce multithread multisource queries and logic to remove a\r
- // query from other sources if any source for a database returns a\r
- // record\r
- if (dbsource.getDbSourceProperties().containsKey(\r
- DBRefSource.MULTIACC))\r
- {\r
- maxqlen = ((Integer) dbsource.getDbSourceProperties().get(\r
- DBRefSource.MULTIACC)).intValue();\r
- }\r
- else\r
- {\r
- maxqlen = 1;\r
- }\r
- while (queries.size() > 0 || seqIndex < currSeqs.length)\r
- {\r
- if (queries.size() > 0)\r
- {\r
- // Still queries to make for current seqIndex\r
- StringBuffer queryString = new StringBuffer("");\r
- int numq = 0, nqSize = (maxqlen > queries.size()) ? queries\r
- .size() : maxqlen;\r
-\r
- while (queries.size() > 0 && numq < nqSize)\r
- {\r
- String query = (String) queries.elementAt(0);\r
- if (dbsource.isValidReference(query))\r
- {\r
- queryString.append((numq == 0) ? "" : dbsource\r
- .getAccessionSeparator());\r
- queryString.append(query);\r
- numq++;\r
- }\r
- // remove the extracted query string\r
- queries.removeElementAt(0);\r
- }\r
- // make the queries and process the response\r
- AlignmentI retrieved = null;\r
- try\r
- {\r
- if (jalview.bin.Cache.log.isDebugEnabled())\r
- {\r
- jalview.bin.Cache.log.debug("Querying "\r
- + dbsource.getDbName() + " with : '"\r
- + queryString.toString() + "'");\r
- }\r
- retrieved = dbsource.getSequenceRecords(queryString\r
- .toString());\r
- } catch (Exception ex)\r
- {\r
- ex.printStackTrace();\r
- } catch (OutOfMemoryError err)\r
- {\r
- new OOMWarning("retrieving database references ("\r
- + queryString.toString() + ")", err);\r
- }\r
- if (retrieved != null)\r
- {\r
- transferReferences(sdataset, dbsource.getDbSource(),\r
- retrieved);\r
- }\r
- }\r
- else\r
- {\r
- // make some more strings for use as queries\r
- for (int i = 0; (seqIndex < dataset.length) && (i < 50); seqIndex++, i++)\r
- {\r
- SequenceI sequence = dataset[seqIndex];\r
- DBRefEntry[] uprefs = jalview.util.DBRefUtils.selectRefs(\r
- sequence.getDBRef(), new String[]\r
- { dbsource.getDbSource() }); // jalview.datamodel.DBRefSource.UNIPROT\r
- // });\r
- // check for existing dbrefs to use\r
- if (uprefs != null && uprefs.length > 0)\r
- {\r
- for (int j = 0; j < uprefs.length; j++)\r
- {\r
- addSeqId(sequence, uprefs[j].getAccessionId());\r
- queries.addElement(uprefs[j].getAccessionId()\r
- .toUpperCase());\r
- }\r
- }\r
- else\r
- {\r
- // generate queries from sequence ID string\r
- StringTokenizer st = new StringTokenizer(\r
- sequence.getName(), "|");\r
- while (st.hasMoreTokens())\r
- {\r
- String token = st.nextToken();\r
- UPEntry[] presp = null;\r
- if (picrClient != null)\r
- {\r
- // resolve the string against PICR to recover valid IDs\r
- try\r
- {\r
- presp = picrClient.getUPIForAccession(token, null,\r
- picrClient.getMappedDatabaseNames(), null,\r
- true);\r
- } catch (Exception e)\r
- {\r
- System.err.println("Exception with Picr for '"\r
- + token + "'\n");\r
- e.printStackTrace();\r
- }\r
- }\r
- if (presp != null && presp.length > 0)\r
- {\r
- for (int id = 0; id < presp.length; id++)\r
- {\r
- // construct sequences from response if sequences are\r
- // present, and do a transferReferences\r
- // otherwise transfer non sequence x-references directly.\r
- }\r
- System.out\r
- .println("Validated ID against PICR... (for what its worth):"\r
- + token);\r
- addSeqId(sequence, token);\r
- queries.addElement(token.toUpperCase());\r
- }\r
- else\r
- {\r
- // if ()\r
- // System.out.println("Not querying source with token="+token+"\n");\r
- addSeqId(sequence, token);\r
- queries.addElement(token.toUpperCase());\r
- }\r
- }\r
- }\r
- }\r
- }\r
- }\r
- }\r
- // advance to next database\r
- db++;\r
- } // all databases have been queries.\r
- if (sbuffer.length() > 0)\r
- {\r
- output.setText("Your sequences have been verified against known sequence databases. Some of the ids have been\n"\r
- + "altered, most likely the start/end residue will have been updated.\n"\r
- + "Save your alignment to maintain the updated id.\n\n"\r
- + sbuffer.toString());\r
- Desktop.addInternalFrame(output, "Sequence names updated ", 600, 300);\r
- // The above is the dataset, we must now find out the index\r
- // of the viewed sequence\r
-\r
- }\r
-\r
- af.setProgressBar("DBRef search completed", startTime);\r
- // promptBeforeBlast();\r
-\r
- running = false;\r
-\r
- }\r
-\r
- /**\r
- * Verify local sequences in seqRefs against the retrieved sequence database\r
- * records.\r
- * \r
- */\r
- void transferReferences(Vector sdataset, String dbSource,\r
- AlignmentI retrievedAl) // File\r
- // file)\r
- {\r
- if (retrievedAl == null || retrievedAl.getHeight() == 0)\r
- {\r
- return;\r
- }\r
- SequenceI[] retrieved = recoverDbSequences(retrievedAl\r
- .getSequencesArray());\r
- SequenceI sequence = null;\r
- boolean transferred = false;\r
- StringBuffer messages = new StringBuffer();\r
-\r
- // Vector entries = new Uniprot().getUniprotEntries(file);\r
-\r
- int i, iSize = retrieved.length; // entries == null ? 0 : entries.size();\r
- // UniprotEntry entry;\r
- for (i = 0; i < iSize; i++)\r
- {\r
- SequenceI entry = retrieved[i]; // (UniprotEntry) entries.elementAt(i);\r
-\r
- // Work out which sequences this sequence matches,\r
- // taking into account all accessionIds and names in the file\r
- Vector sequenceMatches = new Vector();\r
- // look for corresponding accession ids\r
- DBRefEntry[] entryRefs = jalview.util.DBRefUtils.selectRefs(\r
- entry.getDBRef(), new String[]\r
- { dbSource });\r
- if (entryRefs == null)\r
- {\r
- System.err\r
- .println("Dud dbSource string ? no entryrefs selected for "\r
- + dbSource + " on " + entry.getName());\r
- continue;\r
- }\r
- for (int j = 0; j < entryRefs.length; j++)\r
- {\r
- String accessionId = entryRefs[j].getAccessionId(); // .getAccession().elementAt(j).toString();\r
- // match up on accessionId\r
- if (seqRefs.containsKey(accessionId.toUpperCase()))\r
- {\r
- Vector seqs = (Vector) seqRefs.get(accessionId);\r
- for (int jj = 0; jj < seqs.size(); jj++)\r
- {\r
- sequence = (SequenceI) seqs.elementAt(jj);\r
- if (!sequenceMatches.contains(sequence))\r
- {\r
- sequenceMatches.addElement(sequence);\r
- }\r
- }\r
- }\r
- }\r
- if (sequenceMatches.size() == 0)\r
- {\r
- // failed to match directly on accessionId==query so just compare all\r
- // sequences to entry\r
- Enumeration e = seqRefs.keys();\r
- while (e.hasMoreElements())\r
- {\r
- Vector sqs = (Vector) seqRefs.get(e.nextElement());\r
- if (sqs != null && sqs.size() > 0)\r
- {\r
- Enumeration sqe = sqs.elements();\r
- while (sqe.hasMoreElements())\r
- {\r
- sequenceMatches.addElement(sqe.nextElement());\r
- }\r
- }\r
- }\r
- }\r
- // look for corresponding names\r
- // this is uniprot specific ?\r
- // could be useful to extend this so we try to find any 'significant'\r
- // information in common between two sequence objects.\r
- /*\r
- * DBRefEntry[] entryRefs =\r
- * jalview.util.DBRefUtils.selectRefs(entry.getDBRef(), new String[] {\r
- * dbSource }); for (int j = 0; j < entry.getName().size(); j++) { String\r
- * name = entry.getName().elementAt(j).toString(); if\r
- * (seqRefs.containsKey(name)) { Vector seqs = (Vector) seqRefs.get(name);\r
- * for (int jj = 0; jj < seqs.size(); jj++) { sequence = (SequenceI)\r
- * seqs.elementAt(jj); if (!sequenceMatches.contains(sequence)) {\r
- * sequenceMatches.addElement(sequence); } } } }\r
- */\r
- // sequenceMatches now contains the set of all sequences associated with\r
- // the returned db record\r
- String entrySeq = entry.getSequenceAsString().toUpperCase();\r
- for (int m = 0; m < sequenceMatches.size(); m++)\r
- {\r
- sequence = (SequenceI) sequenceMatches.elementAt(m);\r
- // only update start and end positions and shift features if there are\r
- // no existing references\r
- // TODO: test for legacy where uniprot or EMBL refs exist but no\r
- // mappings are made (but content matches retrieved set)\r
- boolean updateRefFrame = sequence.getDBRef() == null\r
- || sequence.getDBRef().length == 0;\r
- // verify sequence against the entry sequence\r
-\r
- String nonGapped = AlignSeq.extractGaps("-. ",\r
- sequence.getSequenceAsString()).toUpperCase();\r
-\r
- int absStart = entrySeq.indexOf(nonGapped);\r
- int mapStart = entry.getStart();\r
- jalview.datamodel.Mapping mp;\r
-\r
- if (absStart == -1)\r
- {\r
- // Is local sequence contained in dataset sequence?\r
- absStart = nonGapped.indexOf(entrySeq);\r
- if (absStart == -1)\r
- { // verification failed.\r
- messages.append(sequence.getName()\r
- + " SEQUENCE NOT %100 MATCH \n");\r
- continue;\r
- }\r
- transferred = true;\r
- sbuffer.append(sequence.getName() + " HAS " + absStart\r
- + " PREFIXED RESIDUES COMPARED TO " + dbSource + "\n");\r
- //\r
- // + " - ANY SEQUENCE FEATURES"\r
- // + " HAVE BEEN ADJUSTED ACCORDINGLY \n");\r
- // absStart = 0;\r
- // create valid mapping between matching region of local sequence and\r
- // the mapped sequence\r
- mp = new Mapping(null, new int[]\r
- { sequence.getStart() + absStart,\r
- sequence.getStart() + absStart + entrySeq.length() - 1 },\r
- new int[]\r
- { entry.getStart(),\r
- entry.getStart() + entrySeq.length() - 1 }, 1, 1);\r
- updateRefFrame = false; // mapping is based on current start/end so\r
- // don't modify start and end\r
- }\r
- else\r
- {\r
- transferred = true;\r
- // update start and end of local sequence to place it in entry's\r
- // reference frame.\r
- // apply identity map map from whole of local sequence to matching\r
- // region of database\r
- // sequence\r
- mp = null; // Mapping.getIdentityMap();\r
- // new Mapping(null,\r
- // new int[] { absStart+sequence.getStart(),\r
- // absStart+sequence.getStart()+entrySeq.length()-1},\r
- // new int[] { entry.getStart(), entry.getEnd() }, 1, 1);\r
- // relocate local features for updated start\r
- if (updateRefFrame)\r
- {\r
- if (sequence.getSequenceFeatures() != null)\r
- {\r
- SequenceFeature[] sf = sequence.getSequenceFeatures();\r
- int start = sequence.getStart();\r
- int end = sequence.getEnd();\r
- int startShift = 1 - absStart - start; // how much the features\r
- // are\r
- // to be shifted by\r
- for (int sfi = 0; sfi < sf.length; sfi++)\r
- {\r
- if (sf[sfi].getBegin() >= start && sf[sfi].getEnd() <= end)\r
- {\r
- // shift feature along by absstart\r
- sf[sfi].setBegin(sf[sfi].getBegin() + startShift);\r
- sf[sfi].setEnd(sf[sfi].getEnd() + startShift);\r
- }\r
- }\r
- }\r
- }\r
- }\r
-\r
- System.out.println("Adding dbrefs to " + sequence.getName()\r
- + " from " + dbSource + " sequence : " + entry.getName());\r
- sequence.transferAnnotation(entry, mp);\r
- // unknownSequences.remove(sequence);\r
- int absEnd = absStart + nonGapped.length();\r
- absStart += 1;\r
- if (updateRefFrame)\r
- {\r
- // finally, update local sequence reference frame if we're allowed\r
- sequence.setStart(absStart);\r
- sequence.setEnd(absEnd);\r
- // search for alignment sequences to update coordinate frame for\r
- for (int alsq = 0; alsq < alseqs.length; alsq++)\r
- {\r
- if (alseqs[alsq].getDatasetSequence() == sequence)\r
- {\r
- String ngAlsq = AlignSeq.extractGaps("-. ",\r
- alseqs[alsq].getSequenceAsString()).toUpperCase();\r
- int oldstrt = alseqs[alsq].getStart();\r
- alseqs[alsq].setStart(sequence.getSequenceAsString()\r
- .toUpperCase().indexOf(ngAlsq)\r
- + sequence.getStart());\r
- if (oldstrt != alseqs[alsq].getStart())\r
- {\r
- alseqs[alsq].setEnd(ngAlsq.length()\r
- + alseqs[alsq].getStart() - 1);\r
- }\r
- }\r
- }\r
- // TODO: search for all other references to this dataset sequence, and\r
- // update start/end\r
- // TODO: update all AlCodonMappings which involve this alignment\r
- // sequence (e.g. Q30167 cdna translation from exon2 product (vamsas\r
- // demo)\r
- }\r
- // and remove it from the rest\r
- // TODO: decide if we should remove annotated sequence from set\r
- sdataset.remove(sequence);\r
- // TODO: should we make a note of sequences that have received new DB\r
- // ids, so we can query all enabled DAS servers for them ?\r
- }\r
- }\r
- if (!transferred)\r
- {\r
- // report the ID/sequence mismatches\r
- sbuffer.append(messages);\r
- }\r
- }\r
-\r
- /**\r
- * loop thru and collect additional sequences in Map.\r
- * \r
- * @param sequencesArray\r
- * @return\r
- */\r
- private SequenceI[] recoverDbSequences(SequenceI[] sequencesArray)\r
- {\r
- Vector nseq = new Vector();\r
- for (int i = 0; sequencesArray != null && i < sequencesArray.length; i++)\r
- {\r
- nseq.addElement(sequencesArray[i]);\r
- DBRefEntry dbr[] = sequencesArray[i].getDBRef();\r
- jalview.datamodel.Mapping map = null;\r
- for (int r = 0; (dbr != null) && r < dbr.length; r++)\r
- {\r
- if ((map = dbr[r].getMap()) != null)\r
- {\r
- if (map.getTo() != null && !nseq.contains(map.getTo()))\r
- {\r
- nseq.addElement(map.getTo());\r
- }\r
- }\r
- }\r
- }\r
- if (nseq.size() > 0)\r
- {\r
- sequencesArray = new SequenceI[nseq.size()];\r
- nseq.toArray(sequencesArray);\r
- }\r
- return sequencesArray;\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.ws;
+
+import jalview.analysis.AlignSeq;
+import jalview.bin.Cache;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.DBRefEntry;
+import jalview.datamodel.DBRefSource;
+import jalview.datamodel.Mapping;
+import jalview.datamodel.SequenceFeature;
+import jalview.datamodel.SequenceI;
+import jalview.gui.AlignFrame;
+import jalview.gui.CutAndPasteTransfer;
+import jalview.gui.Desktop;
+import jalview.gui.IProgressIndicator;
+import jalview.gui.OOMWarning;
+import jalview.ws.dbsources.das.api.jalviewSourceI;
+import jalview.ws.seqfetcher.DbSourceProxy;
+
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+import uk.ac.ebi.picr.model.UPEntry;
+
+/**
+ * Implements a runnable for validating a sequence against external databases
+ * and then propagating references and features onto the sequence(s)
+ *
+ * @author $author$
+ * @version $Revision$
+ */
+public class DBRefFetcher implements Runnable
+{
+ SequenceI[] dataset;
+
+ IProgressIndicator af;
+
+ CutAndPasteTransfer output = new CutAndPasteTransfer();
+
+ StringBuffer sbuffer = new StringBuffer();
+
+ boolean running = false;
+
+ /**
+ * picr client instance
+ */
+ uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperInterface picrClient = null;
+
+ // /This will be a collection of Vectors of sequenceI refs.
+ // The key will be the seq name or accession id of the seq
+ Hashtable seqRefs;
+
+ DbSourceProxy[] dbSources;
+
+ SequenceFetcher sfetcher;
+
+ private SequenceI[] alseqs;
+
+ public DBRefFetcher()
+ {
+ }
+
+ /**
+ * Creates a new SequenceFeatureFetcher object and fetches from the currently
+ * selected set of databases.
+ *
+ * @param seqs
+ * fetch references for these sequences
+ * @param af
+ * the parent alignframe for progress bar monitoring.
+ */
+ public DBRefFetcher(SequenceI[] seqs, AlignFrame af)
+ {
+ this(seqs, af, null);
+ }
+
+ /**
+ * Creates a new SequenceFeatureFetcher object and fetches from the currently
+ * selected set of databases.
+ *
+ * @param seqs
+ * fetch references for these sequences
+ * @param af
+ * the parent alignframe for progress bar monitoring.
+ * @param sources
+ * array of database source strings to query references from
+ */
+ public DBRefFetcher(SequenceI[] seqs, AlignFrame af,
+ DbSourceProxy[] sources)
+ {
+ this.af = af;
+ alseqs = new SequenceI[seqs.length];
+ SequenceI[] ds = new SequenceI[seqs.length];
+ for (int i = 0; i < seqs.length; i++)
+ {
+ alseqs[i] = seqs[i];
+ if (seqs[i].getDatasetSequence() != null)
+ ds[i] = seqs[i].getDatasetSequence();
+ else
+ ds[i] = seqs[i];
+ }
+ this.dataset = ds;
+ // TODO Jalview 2.5 lots of this code should be in the gui package!
+ sfetcher = jalview.gui.SequenceFetcher.getSequenceFetcherSingleton(af);
+ if (sources == null)
+ {
+ // af.featureSettings_actionPerformed(null);
+ String[] defdb = null, otherdb = sfetcher
+ .getDbInstances(jalview.ws.dbsources.das.datamodel.DasSequenceSource.class);
+ List<DbSourceProxy> selsources = new ArrayList<DbSourceProxy>();
+ Vector dasselsrc = (af.featureSettings != null) ? af.featureSettings
+ .getSelectedSources() : new jalview.gui.DasSourceBrowser()
+ .getSelectedSources();
+ Enumeration<jalviewSourceI> en = dasselsrc.elements();
+ while (en.hasMoreElements())
+ {
+ jalviewSourceI src = en.nextElement();
+ List<DbSourceProxy> sp = src.getSequenceSourceProxies();
+ selsources.addAll(sp);
+ if (sp.size() > 1)
+ {
+ Cache.log.debug("Added many Db Sources for :" + src.getTitle());
+ }
+ }
+ // select appropriate databases based on alignFrame context.
+ if (af.getViewport().getAlignment().isNucleotide())
+ {
+ defdb = DBRefSource.DNACODINGDBS;
+ }
+ else
+ {
+ defdb = DBRefSource.PROTEINDBS;
+ }
+ List<DbSourceProxy> srces = new ArrayList<DbSourceProxy>();
+ for (String ddb : defdb)
+ {
+ List<DbSourceProxy> srcesfordb = sfetcher.getSourceProxy(ddb);
+ if (srcesfordb != null)
+ {
+ srces.addAll(srcesfordb);
+ }
+ }
+
+ // append the selected sequence sources to the default dbs
+ srces.addAll(selsources);
+ dbSources = srces.toArray(new DbSourceProxy[0]);
+ }
+ else
+ {
+ // we assume the caller knows what they're doing and ensured that all the
+ // db source names are valid
+ dbSources = sources;
+ }
+ }
+
+ /**
+ * retrieve all the das sequence sources and add them to the list of db
+ * sources to retrieve from
+ */
+ public void appendAllDasSources()
+ {
+ if (dbSources == null)
+ {
+ dbSources = new DbSourceProxy[0];
+ }
+ // append additional sources
+ DbSourceProxy[] otherdb = sfetcher
+ .getDbSourceProxyInstances(jalview.ws.dbsources.das.datamodel.DasSequenceSource.class);
+ if (otherdb != null && otherdb.length > 0)
+ {
+ DbSourceProxy[] newsrc = new DbSourceProxy[dbSources.length
+ + otherdb.length];
+ System.arraycopy(dbSources, 0, newsrc, 0, dbSources.length);
+ System.arraycopy(otherdb, 0, newsrc, dbSources.length, otherdb.length);
+ dbSources = newsrc;
+ }
+ }
+
+ /**
+ * start the fetcher thread
+ *
+ * @param waitTillFinished
+ * true to block until the fetcher has finished
+ */
+ public void fetchDBRefs(boolean waitTillFinished)
+ {
+ Thread thread = new Thread(this);
+ thread.start();
+ running = true;
+
+ if (waitTillFinished)
+ {
+ while (running)
+ {
+ try
+ {
+ Thread.sleep(500);
+ } catch (Exception ex)
+ {
+ }
+ }
+ }
+ }
+
+ /**
+ * The sequence will be added to a vector of sequences belonging to key which
+ * could be either seq name or dbref id
+ *
+ * @param seq
+ * SequenceI
+ * @param key
+ * String
+ */
+ void addSeqId(SequenceI seq, String key)
+ {
+ key = key.toUpperCase();
+
+ Vector seqs;
+ if (seqRefs.containsKey(key))
+ {
+ seqs = (Vector) seqRefs.get(key);
+
+ if (seqs != null && !seqs.contains(seq))
+ {
+ seqs.addElement(seq);
+ }
+ else if (seqs == null)
+ {
+ seqs = new Vector();
+ seqs.addElement(seq);
+ }
+
+ }
+ else
+ {
+ seqs = new Vector();
+ seqs.addElement(seq);
+ }
+
+ seqRefs.put(key, seqs);
+ }
+
+ /**
+ * DOCUMENT ME!
+ */
+ public void run()
+ {
+ if (dbSources == null)
+ {
+ throw new Error("Implementation error. Must initialise dbSources");
+ }
+ running = true;
+ long startTime = System.currentTimeMillis();
+ af.setProgressBar("Fetching db refs", startTime);
+ try
+ {
+ if (Cache.getDefault("DBREFFETCH_USEPICR", false))
+ {
+ picrClient = new uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperServiceLocator()
+ .getAccessionMapperPort();
+ }
+ } catch (Exception e)
+ {
+ System.err.println("Couldn't locate PICR service instance.\n");
+ e.printStackTrace();
+ }
+ int db = 0;
+ Vector sdataset = new Vector();
+ for (int s = 0; s < dataset.length; s++)
+ {
+ sdataset.addElement(dataset[s]);
+ }
+ while (sdataset.size() > 0 && db < dbSources.length)
+ {
+ int maxqlen = 1; // default number of queries made to at one time
+ System.err.println("Verifying against " + dbSources[db].getDbName());
+ boolean dn = false;
+
+ // iterate through db for each remaining un-verified sequence
+ SequenceI[] currSeqs = new SequenceI[sdataset.size()];
+ sdataset.copyInto(currSeqs);// seqs that are to be validated against
+ // dbSources[db]
+ Vector queries = new Vector(); // generated queries curSeq
+ seqRefs = new Hashtable();
+
+ int seqIndex = 0;
+
+ jalview.ws.seqfetcher.DbSourceProxy dbsource = dbSources[db];
+ {
+ // for moment, we dumbly iterate over all retrieval sources for a
+ // particular database
+ // TODO: introduce multithread multisource queries and logic to remove a
+ // query from other sources if any source for a database returns a
+ // record
+ if (dbsource.getDbSourceProperties().containsKey(
+ DBRefSource.MULTIACC))
+ {
+ maxqlen = ((Integer) dbsource.getDbSourceProperties().get(
+ DBRefSource.MULTIACC)).intValue();
+ }
+ else
+ {
+ maxqlen = 1;
+ }
+ while (queries.size() > 0 || seqIndex < currSeqs.length)
+ {
+ if (queries.size() > 0)
+ {
+ // Still queries to make for current seqIndex
+ StringBuffer queryString = new StringBuffer("");
+ int numq = 0, nqSize = (maxqlen > queries.size()) ? queries
+ .size() : maxqlen;
+
+ while (queries.size() > 0 && numq < nqSize)
+ {
+ String query = (String) queries.elementAt(0);
+ if (dbsource.isValidReference(query))
+ {
+ queryString.append((numq == 0) ? "" : dbsource
+ .getAccessionSeparator());
+ queryString.append(query);
+ numq++;
+ }
+ // remove the extracted query string
+ queries.removeElementAt(0);
+ }
+ // make the queries and process the response
+ AlignmentI retrieved = null;
+ try
+ {
+ if (jalview.bin.Cache.log.isDebugEnabled())
+ {
+ jalview.bin.Cache.log.debug("Querying "
+ + dbsource.getDbName() + " with : '"
+ + queryString.toString() + "'");
+ }
+ retrieved = dbsource.getSequenceRecords(queryString
+ .toString());
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ } catch (OutOfMemoryError err)
+ {
+ new OOMWarning("retrieving database references ("
+ + queryString.toString() + ")", err);
+ }
+ if (retrieved != null)
+ {
+ transferReferences(sdataset, dbsource.getDbSource(),
+ retrieved);
+ }
+ }
+ else
+ {
+ // make some more strings for use as queries
+ for (int i = 0; (seqIndex < dataset.length) && (i < 50); seqIndex++, i++)
+ {
+ SequenceI sequence = dataset[seqIndex];
+ DBRefEntry[] uprefs = jalview.util.DBRefUtils.selectRefs(
+ sequence.getDBRef(), new String[]
+ { dbsource.getDbSource() }); // jalview.datamodel.DBRefSource.UNIPROT
+ // });
+ // check for existing dbrefs to use
+ if (uprefs != null && uprefs.length > 0)
+ {
+ for (int j = 0; j < uprefs.length; j++)
+ {
+ addSeqId(sequence, uprefs[j].getAccessionId());
+ queries.addElement(uprefs[j].getAccessionId()
+ .toUpperCase());
+ }
+ }
+ else
+ {
+ // generate queries from sequence ID string
+ StringTokenizer st = new StringTokenizer(
+ sequence.getName(), "|");
+ while (st.hasMoreTokens())
+ {
+ String token = st.nextToken();
+ UPEntry[] presp = null;
+ if (picrClient != null)
+ {
+ // resolve the string against PICR to recover valid IDs
+ try
+ {
+ presp = picrClient.getUPIForAccession(token, null,
+ picrClient.getMappedDatabaseNames(), null,
+ true);
+ } catch (Exception e)
+ {
+ System.err.println("Exception with Picr for '"
+ + token + "'\n");
+ e.printStackTrace();
+ }
+ }
+ if (presp != null && presp.length > 0)
+ {
+ for (int id = 0; id < presp.length; id++)
+ {
+ // construct sequences from response if sequences are
+ // present, and do a transferReferences
+ // otherwise transfer non sequence x-references directly.
+ }
+ System.out
+ .println("Validated ID against PICR... (for what its worth):"
+ + token);
+ addSeqId(sequence, token);
+ queries.addElement(token.toUpperCase());
+ }
+ else
+ {
+ // if ()
+ // System.out.println("Not querying source with token="+token+"\n");
+ addSeqId(sequence, token);
+ queries.addElement(token.toUpperCase());
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ // advance to next database
+ db++;
+ } // all databases have been queries.
+ if (sbuffer.length() > 0)
+ {
+ output.setText("Your sequences have been verified against known sequence databases. Some of the ids have been\n"
+ + "altered, most likely the start/end residue will have been updated.\n"
+ + "Save your alignment to maintain the updated id.\n\n"
+ + sbuffer.toString());
+ Desktop.addInternalFrame(output, "Sequence names updated ", 600, 300);
+ // The above is the dataset, we must now find out the index
+ // of the viewed sequence
+
+ }
+
+ af.setProgressBar("DBRef search completed", startTime);
+ // promptBeforeBlast();
+
+ running = false;
+
+ }
+
+ /**
+ * Verify local sequences in seqRefs against the retrieved sequence database
+ * records.
+ *
+ */
+ void transferReferences(Vector sdataset, String dbSource,
+ AlignmentI retrievedAl) // File
+ // file)
+ {
+ if (retrievedAl == null || retrievedAl.getHeight() == 0)
+ {
+ return;
+ }
+ SequenceI[] retrieved = recoverDbSequences(retrievedAl
+ .getSequencesArray());
+ SequenceI sequence = null;
+ boolean transferred = false;
+ StringBuffer messages = new StringBuffer();
+
+ // Vector entries = new Uniprot().getUniprotEntries(file);
+
+ int i, iSize = retrieved.length; // entries == null ? 0 : entries.size();
+ // UniprotEntry entry;
+ for (i = 0; i < iSize; i++)
+ {
+ SequenceI entry = retrieved[i]; // (UniprotEntry) entries.elementAt(i);
+
+ // Work out which sequences this sequence matches,
+ // taking into account all accessionIds and names in the file
+ Vector sequenceMatches = new Vector();
+ // look for corresponding accession ids
+ DBRefEntry[] entryRefs = jalview.util.DBRefUtils.selectRefs(
+ entry.getDBRef(), new String[]
+ { dbSource });
+ if (entryRefs == null)
+ {
+ System.err
+ .println("Dud dbSource string ? no entryrefs selected for "
+ + dbSource + " on " + entry.getName());
+ continue;
+ }
+ for (int j = 0; j < entryRefs.length; j++)
+ {
+ String accessionId = entryRefs[j].getAccessionId(); // .getAccession().elementAt(j).toString();
+ // match up on accessionId
+ if (seqRefs.containsKey(accessionId.toUpperCase()))
+ {
+ Vector seqs = (Vector) seqRefs.get(accessionId);
+ for (int jj = 0; jj < seqs.size(); jj++)
+ {
+ sequence = (SequenceI) seqs.elementAt(jj);
+ if (!sequenceMatches.contains(sequence))
+ {
+ sequenceMatches.addElement(sequence);
+ }
+ }
+ }
+ }
+ if (sequenceMatches.size() == 0)
+ {
+ // failed to match directly on accessionId==query so just compare all
+ // sequences to entry
+ Enumeration e = seqRefs.keys();
+ while (e.hasMoreElements())
+ {
+ Vector sqs = (Vector) seqRefs.get(e.nextElement());
+ if (sqs != null && sqs.size() > 0)
+ {
+ Enumeration sqe = sqs.elements();
+ while (sqe.hasMoreElements())
+ {
+ sequenceMatches.addElement(sqe.nextElement());
+ }
+ }
+ }
+ }
+ // look for corresponding names
+ // this is uniprot specific ?
+ // could be useful to extend this so we try to find any 'significant'
+ // information in common between two sequence objects.
+ /*
+ * DBRefEntry[] entryRefs =
+ * jalview.util.DBRefUtils.selectRefs(entry.getDBRef(), new String[] {
+ * dbSource }); for (int j = 0; j < entry.getName().size(); j++) { String
+ * name = entry.getName().elementAt(j).toString(); if
+ * (seqRefs.containsKey(name)) { Vector seqs = (Vector) seqRefs.get(name);
+ * for (int jj = 0; jj < seqs.size(); jj++) { sequence = (SequenceI)
+ * seqs.elementAt(jj); if (!sequenceMatches.contains(sequence)) {
+ * sequenceMatches.addElement(sequence); } } } }
+ */
+ // sequenceMatches now contains the set of all sequences associated with
+ // the returned db record
+ String entrySeq = entry.getSequenceAsString().toUpperCase();
+ for (int m = 0; m < sequenceMatches.size(); m++)
+ {
+ sequence = (SequenceI) sequenceMatches.elementAt(m);
+ // only update start and end positions and shift features if there are
+ // no existing references
+ // TODO: test for legacy where uniprot or EMBL refs exist but no
+ // mappings are made (but content matches retrieved set)
+ boolean updateRefFrame = sequence.getDBRef() == null
+ || sequence.getDBRef().length == 0;
+ // verify sequence against the entry sequence
+
+ String nonGapped = AlignSeq.extractGaps("-. ",
+ sequence.getSequenceAsString()).toUpperCase();
+
+ int absStart = entrySeq.indexOf(nonGapped);
+ int mapStart = entry.getStart();
+ jalview.datamodel.Mapping mp;
+
+ if (absStart == -1)
+ {
+ // Is local sequence contained in dataset sequence?
+ absStart = nonGapped.indexOf(entrySeq);
+ if (absStart == -1)
+ { // verification failed.
+ messages.append(sequence.getName()
+ + " SEQUENCE NOT %100 MATCH \n");
+ continue;
+ }
+ transferred = true;
+ sbuffer.append(sequence.getName() + " HAS " + absStart
+ + " PREFIXED RESIDUES COMPARED TO " + dbSource + "\n");
+ //
+ // + " - ANY SEQUENCE FEATURES"
+ // + " HAVE BEEN ADJUSTED ACCORDINGLY \n");
+ // absStart = 0;
+ // create valid mapping between matching region of local sequence and
+ // the mapped sequence
+ mp = new Mapping(null, new int[]
+ { sequence.getStart() + absStart,
+ sequence.getStart() + absStart + entrySeq.length() - 1 },
+ new int[]
+ { entry.getStart(),
+ entry.getStart() + entrySeq.length() - 1 }, 1, 1);
+ updateRefFrame = false; // mapping is based on current start/end so
+ // don't modify start and end
+ }
+ else
+ {
+ transferred = true;
+ // update start and end of local sequence to place it in entry's
+ // reference frame.
+ // apply identity map map from whole of local sequence to matching
+ // region of database
+ // sequence
+ mp = null; // Mapping.getIdentityMap();
+ // new Mapping(null,
+ // new int[] { absStart+sequence.getStart(),
+ // absStart+sequence.getStart()+entrySeq.length()-1},
+ // new int[] { entry.getStart(), entry.getEnd() }, 1, 1);
+ // relocate local features for updated start
+ if (updateRefFrame)
+ {
+ if (sequence.getSequenceFeatures() != null)
+ {
+ SequenceFeature[] sf = sequence.getSequenceFeatures();
+ int start = sequence.getStart();
+ int end = sequence.getEnd();
+ int startShift = 1 - absStart - start; // how much the features
+ // are
+ // to be shifted by
+ for (int sfi = 0; sfi < sf.length; sfi++)
+ {
+ if (sf[sfi].getBegin() >= start && sf[sfi].getEnd() <= end)
+ {
+ // shift feature along by absstart
+ sf[sfi].setBegin(sf[sfi].getBegin() + startShift);
+ sf[sfi].setEnd(sf[sfi].getEnd() + startShift);
+ }
+ }
+ }
+ }
+ }
+
+ System.out.println("Adding dbrefs to " + sequence.getName()
+ + " from " + dbSource + " sequence : " + entry.getName());
+ sequence.transferAnnotation(entry, mp);
+ // unknownSequences.remove(sequence);
+ int absEnd = absStart + nonGapped.length();
+ absStart += 1;
+ if (updateRefFrame)
+ {
+ // finally, update local sequence reference frame if we're allowed
+ sequence.setStart(absStart);
+ sequence.setEnd(absEnd);
+ // search for alignment sequences to update coordinate frame for
+ for (int alsq = 0; alsq < alseqs.length; alsq++)
+ {
+ if (alseqs[alsq].getDatasetSequence() == sequence)
+ {
+ String ngAlsq = AlignSeq.extractGaps("-. ",
+ alseqs[alsq].getSequenceAsString()).toUpperCase();
+ int oldstrt = alseqs[alsq].getStart();
+ alseqs[alsq].setStart(sequence.getSequenceAsString()
+ .toUpperCase().indexOf(ngAlsq)
+ + sequence.getStart());
+ if (oldstrt != alseqs[alsq].getStart())
+ {
+ alseqs[alsq].setEnd(ngAlsq.length()
+ + alseqs[alsq].getStart() - 1);
+ }
+ }
+ }
+ // TODO: search for all other references to this dataset sequence, and
+ // update start/end
+ // TODO: update all AlCodonMappings which involve this alignment
+ // sequence (e.g. Q30167 cdna translation from exon2 product (vamsas
+ // demo)
+ }
+ // and remove it from the rest
+ // TODO: decide if we should remove annotated sequence from set
+ sdataset.remove(sequence);
+ // TODO: should we make a note of sequences that have received new DB
+ // ids, so we can query all enabled DAS servers for them ?
+ }
+ }
+ if (!transferred)
+ {
+ // report the ID/sequence mismatches
+ sbuffer.append(messages);
+ }
+ }
+
+ /**
+ * loop thru and collect additional sequences in Map.
+ *
+ * @param sequencesArray
+ * @return
+ */
+ private SequenceI[] recoverDbSequences(SequenceI[] sequencesArray)
+ {
+ Vector nseq = new Vector();
+ for (int i = 0; sequencesArray != null && i < sequencesArray.length; i++)
+ {
+ nseq.addElement(sequencesArray[i]);
+ DBRefEntry dbr[] = sequencesArray[i].getDBRef();
+ jalview.datamodel.Mapping map = null;
+ for (int r = 0; (dbr != null) && r < dbr.length; r++)
+ {
+ if ((map = dbr[r].getMap()) != null)
+ {
+ if (map.getTo() != null && !nseq.contains(map.getTo()))
+ {
+ nseq.addElement(map.getTo());
+ }
+ }
+ }
+ }
+ if (nseq.size() > 0)
+ {
+ sequencesArray = new SequenceI[nseq.size()];
+ nseq.toArray(sequencesArray);
+ }
+ return sequencesArray;
+ }
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.ws;\r
-\r
-import jalview.bin.Cache;\r
-import jalview.datamodel.DBRefEntry;\r
-import jalview.datamodel.SequenceFeature;\r
-import jalview.datamodel.SequenceI;\r
-import jalview.gui.AlignFrame;\r
-import jalview.gui.Desktop;\r
-import jalview.gui.FeatureSettings;\r
-import jalview.util.UrlLink;\r
-import jalview.ws.dbsources.das.api.DasSourceRegistryI;\r
-import jalview.ws.dbsources.das.api.jalviewSourceI;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Arrays;\r
-import java.util.Enumeration;\r
-import java.util.HashMap;\r
-import java.util.HashSet;\r
-import java.util.Iterator;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.Set;\r
-import java.util.StringTokenizer;\r
-import java.util.Vector;\r
-\r
-import javax.swing.JOptionPane;\r
-\r
-import org.biodas.jdas.client.FeaturesClient;\r
-import org.biodas.jdas.client.adapters.features.DasGFFAdapter;\r
-import org.biodas.jdas.client.adapters.features.DasGFFAdapter.GFFAdapter;\r
-import org.biodas.jdas.client.threads.FeaturesClientMultipleSources;\r
-import org.biodas.jdas.schema.features.ERRORSEGMENT;\r
-import org.biodas.jdas.schema.features.FEATURE;\r
-import org.biodas.jdas.schema.features.LINK;\r
-import org.biodas.jdas.schema.features.SEGMENT;\r
-import org.biodas.jdas.schema.features.TYPE;\r
-import org.biodas.jdas.schema.features.UNKNOWNFEATURE;\r
-import org.biodas.jdas.schema.features.UNKNOWNSEGMENT;\r
-import org.biodas.jdas.schema.sources.COORDINATES;\r
-\r
-/**\r
- * DOCUMENT ME!\r
- * \r
- * @author $author$\r
- * @version $Revision$\r
- */\r
-public class DasSequenceFeatureFetcher\r
-{\r
- SequenceI[] sequences;\r
-\r
- AlignFrame af;\r
-\r
- FeatureSettings fsettings;\r
-\r
- StringBuffer sbuffer = new StringBuffer();\r
-\r
- List<jalviewSourceI> selectedSources;\r
-\r
- boolean cancelled = false;\r
-\r
- private void debug(String mesg)\r
- {\r
- debug(mesg, null);\r
- }\r
-\r
- private void debug(String mesg, Exception e)\r
- {\r
- if (Cache.log != null)\r
- {\r
- Cache.log.debug(mesg, e);\r
- }\r
- else\r
- {\r
- System.err.println(mesg);\r
- if (e != null)\r
- {\r
- e.printStackTrace();\r
- }\r
- }\r
- }\r
-\r
- long startTime;\r
-\r
- private DasSourceRegistryI sourceRegistry;\r
-\r
- private boolean useJDASMultiThread = true;\r
-\r
- /**\r
- * Creates a new SequenceFeatureFetcher object. Uses default\r
- * \r
- * @param align\r
- * DOCUMENT ME!\r
- * @param ap\r
- * DOCUMENT ME!\r
- */\r
- public DasSequenceFeatureFetcher(SequenceI[] sequences,\r
- FeatureSettings fsettings, Vector selectedSources)\r
- {\r
- this(sequences, fsettings, selectedSources, true, true, true);\r
- }\r
-\r
- public DasSequenceFeatureFetcher(SequenceI[] oursequences,\r
- FeatureSettings fsettings, List<jalviewSourceI> selectedSources2,\r
- boolean checkDbrefs, boolean promptFetchDbrefs)\r
- {\r
- this(oursequences, fsettings, selectedSources2, checkDbrefs,\r
- promptFetchDbrefs, true);\r
- }\r
-\r
- public DasSequenceFeatureFetcher(SequenceI[] oursequences,\r
- FeatureSettings fsettings, List<jalviewSourceI> selectedSources2,\r
- boolean checkDbrefs, boolean promptFetchDbrefs,\r
- boolean useJDasMultiThread)\r
- {\r
- this.useJDASMultiThread = useJDasMultiThread;\r
- this.selectedSources = new ArrayList<jalviewSourceI>();\r
- // filter both sequences and sources to eliminate duplicates\r
- for (jalviewSourceI src : selectedSources2)\r
- {\r
- if (!selectedSources.contains(src))\r
- {\r
- selectedSources.add(src);\r
- }\r
- ;\r
- }\r
- Vector sqs = new Vector();\r
- for (int i = 0; i < oursequences.length; i++)\r
- {\r
- if (!sqs.contains(oursequences[i]))\r
- {\r
- sqs.addElement(oursequences[i]);\r
- }\r
- }\r
- sequences = new SequenceI[sqs.size()];\r
- for (int i = 0; i < sequences.length; i++)\r
- {\r
- sequences[i] = (SequenceI) sqs.elementAt(i);\r
- }\r
- if (fsettings != null)\r
- {\r
- this.fsettings = fsettings;\r
- this.af = fsettings.af;\r
- af.setShowSeqFeatures(true);\r
- }\r
- int uniprotCount = 0;\r
- for (jalviewSourceI source : selectedSources)\r
- {\r
- for (COORDINATES coords : source.getVersion().getCOORDINATES())\r
- {\r
- // TODO: match UniProt coord system canonically (?) - does\r
- // UniProt==uniprot==UNIPROT ?\r
- if (coords.getAuthority().toLowerCase().equals("uniprot"))\r
- {\r
- uniprotCount++;\r
- break;\r
- }\r
- }\r
- }\r
-\r
- int refCount = 0;\r
- for (int i = 0; i < sequences.length; i++)\r
- {\r
- DBRefEntry[] dbref = sequences[i].getDBRef();\r
- if (dbref != null)\r
- {\r
- for (int j = 0; j < dbref.length; j++)\r
- {\r
- if (dbref[j].getSource().equals(\r
- jalview.datamodel.DBRefSource.UNIPROT))\r
- {\r
- refCount++;\r
- break;\r
- }\r
- }\r
- }\r
- }\r
-\r
- if (checkDbrefs && refCount < sequences.length && uniprotCount > 0)\r
- {\r
-\r
- int reply = JOptionPane.YES_OPTION;\r
- if (promptFetchDbrefs)\r
- {\r
- reply = JOptionPane\r
- .showInternalConfirmDialog(\r
- Desktop.desktop,\r
- "Do you want Jalview to find\n"\r
- + "Uniprot Accession ids for given sequence names?",\r
- "Find Uniprot Accession Ids",\r
- JOptionPane.YES_NO_OPTION,\r
- JOptionPane.QUESTION_MESSAGE);\r
- }\r
-\r
- if (reply == JOptionPane.YES_OPTION)\r
- {\r
- Thread thread = new Thread(new FetchDBRefs());\r
- thread.start();\r
- }\r
- else\r
- {\r
- _startFetching();\r
- }\r
- }\r
- else\r
- {\r
- _startFetching();\r
- }\r
-\r
- }\r
-\r
- private void _startFetching()\r
- {\r
- running = true;\r
- new Thread(new FetchSeqFeatures()).start();\r
- }\r
-\r
- class FetchSeqFeatures implements Runnable\r
- {\r
- public void run()\r
- {\r
- startFetching();\r
- setGuiFetchComplete();\r
- }\r
- }\r
-\r
- class FetchDBRefs implements Runnable\r
- {\r
- public void run()\r
- {\r
- running = true;\r
- new DBRefFetcher(sequences, af).fetchDBRefs(true);\r
- startFetching();\r
- setGuiFetchComplete();\r
- }\r
- }\r
-\r
- /**\r
- * Spawns Fetcher threads to add features to sequences in the dataset\r
- */\r
- void startFetching()\r
- {\r
- running = true;\r
- cancelled = false;\r
- startTime = System.currentTimeMillis();\r
- if (af != null)\r
- {\r
- af.setProgressBar("Fetching DAS Sequence Features", startTime);\r
- }\r
- if (sourceRegistry == null)\r
- {\r
- sourceRegistry = Cache.getDasSourceRegistry();\r
- }\r
- if (selectedSources == null || selectedSources.size() == 0)\r
- {\r
- try\r
- {\r
- jalviewSourceI[] sources = sourceRegistry.getSources().toArray(\r
- new jalviewSourceI[0]);\r
- String active = jalview.bin.Cache.getDefault("DAS_ACTIVE_SOURCE",\r
- "uniprot");\r
- StringTokenizer st = new StringTokenizer(active, "\t");\r
- selectedSources = new Vector();\r
- String token;\r
- while (st.hasMoreTokens())\r
- {\r
- token = st.nextToken();\r
- for (int i = 0; i < sources.length; i++)\r
- {\r
- if (sources[i].getTitle().equals(token))\r
- {\r
- selectedSources.add(sources[i]);\r
- break;\r
- }\r
- }\r
- }\r
- } catch (Exception ex)\r
- {\r
- debug("Exception whilst setting default feature sources from registry and local preferences.",\r
- ex);\r
- }\r
- }\r
-\r
- if (selectedSources == null || selectedSources.size() == 0)\r
- {\r
- System.out.println("No DAS Sources active");\r
- cancelled = true;\r
- setGuiNoDassourceActive();\r
- return;\r
- }\r
-\r
- sourcesRemaining = selectedSources.size();\r
- FeaturesClientMultipleSources fc = new FeaturesClientMultipleSources();\r
- fc.setConnProps(sourceRegistry.getSessionHandler());\r
- // Now sending requests one at a time to each server\r
- ArrayList<jalviewSourceI> srcobj = new ArrayList<jalviewSourceI>();\r
- ArrayList<String> src = new ArrayList<String>();\r
- List<List<String>> ids = new ArrayList<List<String>>();\r
- List<List<DBRefEntry>> idobj = new ArrayList<List<DBRefEntry>>();\r
- List<Map<String, SequenceI>> sqset = new ArrayList<Map<String, SequenceI>>();\r
- for (jalviewSourceI _sr : selectedSources)\r
- {\r
-\r
- Map<String, SequenceI> slist = new HashMap<String, SequenceI>();\r
- List<DBRefEntry> idob = new ArrayList<DBRefEntry>();\r
- List<String> qset = new ArrayList<String>();\r
-\r
- for (SequenceI seq : sequences)\r
- {\r
- Object[] idset = nextSequence(_sr, seq);\r
- if (idset != null)\r
- {\r
- List<DBRefEntry> _idob = (List<DBRefEntry>) idset[0];\r
- List<String> _qset = (List<String>) idset[1];\r
- if (_idob.size() > 0)\r
- {\r
- // add sequence's ref for each id derived from it\r
- // (space inefficient, but most unambiguous)\r
- // could replace with hash with _qset values as keys.\r
- Iterator<DBRefEntry> dbobj = _idob.iterator();\r
- for (String q : _qset)\r
- {\r
- SequenceI osq = slist.get(q);\r
- DBRefEntry dr = dbobj.next();\r
- if (osq != null && osq != seq)\r
- {\r
- // skip - non-canonical query\r
- }\r
- else\r
- {\r
- idob.add(dr);\r
- qset.add(q);\r
- slist.put(q, seq);\r
- }\r
- }\r
- }\r
- }\r
- }\r
- if (idob.size() > 0)\r
- {\r
- srcobj.add(_sr);\r
- src.add(_sr.getSourceURL());\r
- ids.add(qset);\r
- idobj.add(idob);\r
- sqset.add(slist);\r
- }\r
- }\r
- Map<String, Map<List<String>, Exception>> errors = new HashMap<String, Map<List<String>, Exception>>();\r
- Map<String, Map<List<String>, DasGFFAdapter>> results = new HashMap<String, Map<List<String>, DasGFFAdapter>>();\r
- if (!useJDASMultiThread)\r
- {\r
- Iterator<String> sources = src.iterator();\r
- // iterate over each query for each source and do each one individually\r
- for (List<String> idl : ids)\r
- {\r
- String source = sources.next();\r
- FeaturesClient featuresc = new FeaturesClient(sourceRegistry\r
- .getSessionHandler().getConnectionPropertyProviderFor(\r
- source));\r
- for (String id : idl)\r
- {\r
- List<String> qid = Arrays.asList(new String[]\r
- { id });\r
- try\r
- {\r
- DasGFFAdapter dga = featuresc.fetchData(source, qid);\r
- Map<List<String>, DasGFFAdapter> ers = results.get(source);\r
- if (ers == null)\r
- {\r
- results.put(source,\r
- ers = new HashMap<List<String>, DasGFFAdapter>());\r
- }\r
- ers.put(qid, dga);\r
- } catch (Exception ex)\r
- {\r
- Map<List<String>, Exception> ers = errors.get(source);\r
- if (ers == null)\r
- {\r
- errors.put(source,\r
- ers = new HashMap<List<String>, Exception>());\r
- }\r
- ers.put(qid, ex);\r
- }\r
- }\r
- }\r
- }\r
- else\r
- {\r
- // pass them all at once\r
- fc.fetchData(src, ids, false, results, errors);\r
- fc.shutDown();\r
- while (!fc.isTerminated())\r
- {\r
- try\r
- {\r
- Thread.sleep(200);\r
- } catch (InterruptedException x)\r
- {\r
-\r
- }\r
- }\r
- }\r
- Iterator<List<String>> idset = ids.iterator();\r
- Iterator<List<DBRefEntry>> idobjset = idobj.iterator();\r
- Iterator<Map<String, SequenceI>> seqset = sqset.iterator();\r
- for (jalviewSourceI source : srcobj)\r
- {\r
- processResponse(seqset.next(), source, idset.next(), idobjset.next(),\r
- results.get(source.getSourceURL()),\r
- errors.get(source.getSourceURL()));\r
- }\r
- }\r
-\r
- private void processResponse(Map<String, SequenceI> sequencemap,\r
- jalviewSourceI jvsource, List<String> ids,\r
- List<DBRefEntry> idobj, Map<List<String>, DasGFFAdapter> results,\r
- Map<List<String>, Exception> errors)\r
- {\r
- Set<SequenceI> sequences = new HashSet<SequenceI>();\r
- String source = jvsource.getSourceURL();\r
- // process features\r
- DasGFFAdapter result = (results == null) ? null : results.get(ids);\r
- Exception error = (errors == null) ? null : errors.get(ids);\r
- if (result == null)\r
- {\r
- debug("das source " + source + " could not be contacted. "\r
- + (error == null ? "" : error.toString()));\r
- }\r
- else\r
- {\r
-\r
- GFFAdapter gff = result.getGFF();\r
- List<SEGMENT> segments = gff.getSegments();\r
- List<ERRORSEGMENT> errorsegs = gff.getErrorSegments();\r
- List<UNKNOWNFEATURE> unkfeats = gff.getUnknownFeatures();\r
- List<UNKNOWNSEGMENT> unksegs = gff.getUnknownSegments();\r
- debug("das source " + source + " returned " + gff.getTotal()\r
- + " responses. " + (errorsegs != null ? errorsegs.size() : 0)\r
- + " were incorrect segment queries, "\r
- + (unkfeats != null ? unkfeats.size() : 0)\r
- + " were unknown features "\r
- + (unksegs != null ? unksegs.size() : 0)\r
- + " were unknown segments and "\r
- + (segments != null ? segments.size() : 0)\r
- + " were segment responses.");\r
- Iterator<DBRefEntry> dbr = idobj.iterator();\r
- if (segments != null)\r
- {\r
- for (SEGMENT seg : segments)\r
- {\r
- String id = seg.getId();\r
- if (ids.indexOf(id) == -1)\r
- {\r
- id = id.toUpperCase();\r
- }\r
- DBRefEntry dbref = idobj.get(ids.indexOf(id));\r
- SequenceI sequence = sequencemap.get(id);\r
- boolean added = false;\r
- sequences.add(sequence);\r
-\r
- for (FEATURE feat : seg.getFEATURE())\r
- {\r
- // standard DAS feature-> jalview sequence feature transformation\r
- SequenceFeature f = newSequenceFeature(feat,\r
- jvsource.getTitle());\r
- if (!parseSeqFeature(sequence, f, feat, jvsource))\r
- {\r
- if (dbref.getMap() != null && f.getBegin() > 0\r
- && f.getEnd() > 0)\r
- {\r
- debug("mapping from " + f.getBegin() + " - " + f.getEnd());\r
- SequenceFeature vf[] = null;\r
-\r
- try\r
- {\r
- vf = dbref.getMap().locateFeature(f);\r
- } catch (Exception ex)\r
- {\r
- Cache.log\r
- .info("Error in 'experimental' mapping of features. Please try to reproduce and then report info to jalview-discuss@jalview.org.");\r
- Cache.log.info("Mapping feature from " + f.getBegin()\r
- + " to " + f.getEnd() + " in dbref "\r
- + dbref.getAccessionId() + " in "\r
- + dbref.getSource());\r
- Cache.log.info("using das Source " + source);\r
- Cache.log.info("Exception", ex);\r
- }\r
-\r
- if (vf != null)\r
- {\r
- for (int v = 0; v < vf.length; v++)\r
- {\r
- debug("mapping to " + v + ": " + vf[v].getBegin()\r
- + " - " + vf[v].getEnd());\r
- sequence.addSequenceFeature(vf[v]);\r
- }\r
- }\r
- }\r
- else\r
- {\r
- sequence.addSequenceFeature(f);\r
- }\r
- }\r
- }\r
- }\r
- featuresAdded(sequences);\r
- }\r
- else\r
- {\r
- // System.out.println("No features found for " + seq.getName()\r
- // + " from: " + e.getDasSource().getNickname());\r
- }\r
- }\r
- }\r
-\r
- private void setGuiNoDassourceActive()\r
- {\r
-\r
- if (af != null)\r
- {\r
- af.setProgressBar("No DAS Sources Active", startTime);\r
- }\r
- if (getFeatSettings() != null)\r
- {\r
- fsettings.noDasSourceActive();\r
- }\r
- }\r
-\r
- /**\r
- * Update our fsettings dialog reference if we didn't have one when we were\r
- * first initialised.\r
- * \r
- * @return fsettings\r
- */\r
- private FeatureSettings getFeatSettings()\r
- {\r
- if (fsettings == null)\r
- {\r
- if (af != null)\r
- {\r
- fsettings = af.featureSettings;\r
- }\r
- }\r
- return fsettings;\r
- }\r
-\r
- public void cancel()\r
- {\r
- if (af != null)\r
- {\r
- af.setProgressBar("DAS Feature Fetching Cancelled", startTime);\r
- }\r
- cancelled = true;\r
- }\r
-\r
- int sourcesRemaining = 0;\r
-\r
- private boolean running = false;\r
-\r
- private void setGuiFetchComplete()\r
- {\r
- running = false;\r
- if (!cancelled && af != null)\r
- {\r
- // only update the progress bar if we've completed the fetch normally\r
- af.setProgressBar("DAS Feature Fetching Complete", startTime);\r
- }\r
-\r
- if (af != null && af.featureSettings != null)\r
- {\r
- af.featureSettings.setTableData();\r
- }\r
-\r
- if (getFeatSettings() != null)\r
- {\r
- fsettings.complete();\r
- }\r
- }\r
-\r
- void featuresAdded(Set<SequenceI> seqs)\r
- {\r
- if (af == null)\r
- {\r
- // no gui to update with features.\r
- return;\r
- }\r
- af.getFeatureRenderer().featuresAdded();\r
-\r
- int start = af.getViewport().getStartSeq();\r
- int end = af.getViewport().getEndSeq();\r
- int index;\r
- for (index = start; index < end; index++)\r
- {\r
- for (SequenceI seq : seqs)\r
- {\r
- if (seq == af.getViewport().getAlignment().getSequenceAt(index)\r
- .getDatasetSequence())\r
- {\r
- af.alignPanel.paintAlignment(true);\r
- index = end;\r
- break;\r
- }\r
- }\r
- }\r
- }\r
-\r
- Object[] nextSequence(jalviewSourceI dasSource, SequenceI seq)\r
- {\r
- if (cancelled)\r
- return null;\r
- DBRefEntry[] uprefs = jalview.util.DBRefUtils.selectRefs(\r
- seq.getDBRef(), new String[]\r
- {\r
- // jalview.datamodel.DBRefSource.PDB,\r
- jalview.datamodel.DBRefSource.UNIPROT,\r
- // jalview.datamodel.DBRefSource.EMBL - not tested on any EMBL coord\r
- // sys sources\r
- });\r
- // TODO: minimal list of DAS queries to make by querying with untyped ID if\r
- // distinct from any typed IDs\r
-\r
- List<DBRefEntry> ids = new ArrayList<DBRefEntry>();\r
- List<String> qstring = new ArrayList<String>();\r
- boolean dasCoordSysFound = false;\r
-\r
- if (uprefs != null)\r
- {\r
- // do any of these ids match the source's coordinate system ?\r
- for (int j = 0; !dasCoordSysFound && j < uprefs.length; j++)\r
- {\r
-\r
- for (COORDINATES csys : dasSource.getVersion().getCOORDINATES())\r
- {\r
- if (jalview.util.DBRefUtils.isDasCoordinateSystem(\r
- csys.getAuthority(), uprefs[j]))\r
- {\r
- debug("Launched fetcher for coordinate system "\r
- + csys.getAuthority());\r
- // Will have to pass any mapping information to the fetcher\r
- // - the start/end for the DBRefEntry may not be the same as the\r
- // sequence's start/end\r
-\r
- System.out.println(seq.getName() + " "\r
- + (seq.getDatasetSequence() == null) + " "\r
- + csys.getUri());\r
-\r
- dasCoordSysFound = true; // break's out of the loop\r
- ids.add(uprefs[j]);\r
- qstring.add(uprefs[j].getAccessionId());\r
- }\r
- else\r
- System.out.println("IGNORE " + csys.getAuthority());\r
- }\r
- }\r
- }\r
-\r
- if (!dasCoordSysFound)\r
- {\r
- String id = null;\r
- // try and use the name as the sequence id\r
- if (seq.getName().indexOf("|") > -1)\r
- {\r
- id = seq.getName().substring(seq.getName().lastIndexOf("|") + 1);\r
- if (id.trim().length() < 4)\r
- {\r
- // hack - we regard a significant ID as being at least 4\r
- // non-whitespace characters\r
- id = seq.getName().substring(0, seq.getName().lastIndexOf("|"));\r
- if (id.indexOf("|") > -1)\r
- {\r
- id = id.substring(id.lastIndexOf("|") + 1);\r
- }\r
- }\r
- }\r
- else\r
- {\r
- id = seq.getName();\r
- }\r
- if (id != null)\r
- {\r
- DBRefEntry dbre = new DBRefEntry();\r
- dbre.setAccessionId(id);\r
- // Should try to call a general feature fetcher that\r
- // queries many sources with name to discover applicable ID references\r
- ids.add(dbre);\r
- qstring.add(dbre.getAccessionId());\r
- }\r
- }\r
-\r
- return new Object[]\r
- { ids, qstring };\r
- }\r
-\r
- /**\r
- * examine the given sequence feature to determine if it should actually be\r
- * turned into sequence annotation or database cross references rather than a\r
- * simple sequence feature.\r
- * \r
- * @param seq\r
- * the sequence to annotate\r
- * @param f\r
- * the jalview sequence feature generated from the DAS feature\r
- * @param map\r
- * the sequence feature attributes\r
- * @param source\r
- * the source that emitted the feature\r
- * @return true if feature was consumed as another kind of annotation.\r
- */\r
- protected boolean parseSeqFeature(SequenceI seq, SequenceFeature f,\r
- FEATURE feature, jalviewSourceI source)\r
- {\r
- SequenceI mseq = seq;\r
- while (seq.getDatasetSequence() != null)\r
- {\r
- seq = seq.getDatasetSequence();\r
- }\r
- if (f.getType() != null)\r
- {\r
- String type = f.getType();\r
- if (type.equalsIgnoreCase("protein_name"))\r
- {\r
- // parse name onto the alignment sequence or the dataset sequence.\r
- if (seq.getDescription() == null\r
- || seq.getDescription().trim().length() == 0)\r
- {\r
- // could look at the note series to pick out the first long name, for\r
- // the moment just use the whole description string\r
- seq.setDescription(f.getDescription());\r
- }\r
- if (mseq.getDescription() == null\r
- || mseq.getDescription().trim().length() == 0)\r
- {\r
- // could look at the note series to pick out the first long name, for\r
- // the moment just use the whole description string\r
- mseq.setDescription(f.getDescription());\r
- }\r
- return true;\r
- }\r
- // check if source has biosapiens or other sequence ontology label\r
- if (type.equalsIgnoreCase("DBXREF") || type.equalsIgnoreCase("DBREF"))\r
- {\r
- // try to parse the accession out\r
-\r
- DBRefEntry dbr = new DBRefEntry();\r
- dbr.setVersion(source.getTitle());\r
- StringTokenizer st = new StringTokenizer(f.getDescription(), ":");\r
- if (st.hasMoreTokens())\r
- {\r
- dbr.setSource(st.nextToken());\r
- }\r
- if (st.hasMoreTokens())\r
- {\r
- dbr.setAccessionId(st.nextToken());\r
- }\r
- seq.addDBRef(dbr);\r
-\r
- if (f.links != null && f.links.size() > 0)\r
- {\r
- // feature is also appended to enable links to be seen.\r
- // TODO: consider extending dbrefs to have their own links ?\r
- // TODO: new feature: extract dbref links from DAS servers and add the\r
- // URL pattern to the list of DB name associated links in the user's\r
- // preferences ?\r
- // for the moment - just fix up the existing feature so it displays\r
- // correctly.\r
- // f.setType(dbr.getSource());\r
- // f.setDescription();\r
- f.setValue("linkonly", Boolean.TRUE);\r
- // f.setDescription("");\r
- Vector newlinks = new Vector();\r
- Enumeration it = f.links.elements();\r
- while (it.hasMoreElements())\r
- {\r
- String elm;\r
- UrlLink urllink = new UrlLink(elm = (String) it.nextElement());\r
- if (urllink.isValid())\r
- {\r
- urllink.setLabel(f.getDescription());\r
- newlinks.addElement(urllink.toString());\r
- }\r
- else\r
- {\r
- // couldn't parse the link properly. Keep it anyway - just in\r
- // case.\r
- debug("couldn't parse link string - " + elm);\r
- newlinks.addElement(elm);\r
- }\r
- }\r
- f.links = newlinks;\r
- seq.addSequenceFeature(f);\r
- }\r
- return true;\r
- }\r
- }\r
- return false;\r
- }\r
-\r
- /**\r
- * creates a jalview sequence feature from a das feature document\r
- * \r
- * @param feat\r
- * @return sequence feature object created using dasfeature information\r
- */\r
- SequenceFeature newSequenceFeature(FEATURE feat, String nickname)\r
- {\r
- if (feat == null)\r
- {\r
- return null;\r
- }\r
- try\r
- {\r
- /**\r
- * Different qNames for a DAS Feature - are string keys to the HashMaps in\r
- * features "METHOD") || qName.equals("TYPE") || qName.equals("START") ||\r
- * qName.equals("END") || qName.equals("NOTE") || qName.equals("LINK") ||\r
- * qName.equals("SCORE")\r
- */\r
- String desc = new String();\r
- if (feat.getNOTE() != null)\r
- {\r
- for (String note : feat.getNOTE())\r
- {\r
- desc += (String) note;\r
- }\r
- }\r
-\r
- int start = 0, end = 0;\r
- float score = 0f;\r
-\r
- try\r
- {\r
- start = Integer.parseInt(feat.getSTART().toString());\r
- } catch (Exception ex)\r
- {\r
- }\r
- try\r
- {\r
- end = Integer.parseInt(feat.getEND().toString());\r
- } catch (Exception ex)\r
- {\r
- }\r
- try\r
- {\r
- Object scr = feat.getSCORE();\r
- if (scr != null)\r
- {\r
- score = (float) Double.parseDouble(scr.toString());\r
-\r
- }\r
- } catch (Exception ex)\r
- {\r
- }\r
-\r
- SequenceFeature f = new SequenceFeature(\r
- getTypeString(feat.getTYPE()), desc, start, end, score,\r
- nickname);\r
-\r
- if (feat.getLINK() != null)\r
- {\r
- for (LINK link : feat.getLINK())\r
- {\r
- // Do not put feature extent in link text for non-positional features\r
- if (f.begin == 0 && f.end == 0)\r
- {\r
- f.addLink(f.getType() + " " + link.getContent() + "|"\r
- + link.getHref());\r
- }\r
- else\r
- {\r
- f.addLink(f.getType() + " " + f.begin + "_" + f.end + " "\r
- + link.getContent() + "|" + link.getHref());\r
- }\r
- }\r
- }\r
-\r
- return f;\r
- } catch (Exception e)\r
- {\r
- System.out.println("ERRR " + e);\r
- e.printStackTrace();\r
- System.out.println("############");\r
- debug("Failed to parse " + feat.toString(), e);\r
- return null;\r
- }\r
- }\r
-\r
- private String getTypeString(TYPE type)\r
- {\r
- return type.getContent();\r
- }\r
-\r
- public boolean isRunning()\r
- {\r
- return running;\r
- }\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.ws;
+
+import jalview.bin.Cache;
+import jalview.datamodel.DBRefEntry;
+import jalview.datamodel.SequenceFeature;
+import jalview.datamodel.SequenceI;
+import jalview.gui.AlignFrame;
+import jalview.gui.Desktop;
+import jalview.gui.FeatureSettings;
+import jalview.util.UrlLink;
+import jalview.ws.dbsources.das.api.DasSourceRegistryI;
+import jalview.ws.dbsources.das.api.jalviewSourceI;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+import javax.swing.JOptionPane;
+
+import org.biodas.jdas.client.FeaturesClient;
+import org.biodas.jdas.client.adapters.features.DasGFFAdapter;
+import org.biodas.jdas.client.adapters.features.DasGFFAdapter.GFFAdapter;
+import org.biodas.jdas.client.threads.FeaturesClientMultipleSources;
+import org.biodas.jdas.schema.features.ERRORSEGMENT;
+import org.biodas.jdas.schema.features.FEATURE;
+import org.biodas.jdas.schema.features.LINK;
+import org.biodas.jdas.schema.features.SEGMENT;
+import org.biodas.jdas.schema.features.TYPE;
+import org.biodas.jdas.schema.features.UNKNOWNFEATURE;
+import org.biodas.jdas.schema.features.UNKNOWNSEGMENT;
+import org.biodas.jdas.schema.sources.COORDINATES;
+
+/**
+ * DOCUMENT ME!
+ *
+ * @author $author$
+ * @version $Revision$
+ */
+public class DasSequenceFeatureFetcher
+{
+ SequenceI[] sequences;
+
+ AlignFrame af;
+
+ FeatureSettings fsettings;
+
+ StringBuffer sbuffer = new StringBuffer();
+
+ List<jalviewSourceI> selectedSources;
+
+ boolean cancelled = false;
+
+ private void debug(String mesg)
+ {
+ debug(mesg, null);
+ }
+
+ private void debug(String mesg, Exception e)
+ {
+ if (Cache.log != null)
+ {
+ Cache.log.debug(mesg, e);
+ }
+ else
+ {
+ System.err.println(mesg);
+ if (e != null)
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ long startTime;
+
+ private DasSourceRegistryI sourceRegistry;
+
+ private boolean useJDASMultiThread = true;
+
+ /**
+ * Creates a new SequenceFeatureFetcher object. Uses default
+ *
+ * @param align
+ * DOCUMENT ME!
+ * @param ap
+ * DOCUMENT ME!
+ */
+ public DasSequenceFeatureFetcher(SequenceI[] sequences,
+ FeatureSettings fsettings, Vector selectedSources)
+ {
+ this(sequences, fsettings, selectedSources, true, true, true);
+ }
+
+ public DasSequenceFeatureFetcher(SequenceI[] oursequences,
+ FeatureSettings fsettings, List<jalviewSourceI> selectedSources2,
+ boolean checkDbrefs, boolean promptFetchDbrefs)
+ {
+ this(oursequences, fsettings, selectedSources2, checkDbrefs,
+ promptFetchDbrefs, true);
+ }
+
+ public DasSequenceFeatureFetcher(SequenceI[] oursequences,
+ FeatureSettings fsettings, List<jalviewSourceI> selectedSources2,
+ boolean checkDbrefs, boolean promptFetchDbrefs,
+ boolean useJDasMultiThread)
+ {
+ this.useJDASMultiThread = useJDasMultiThread;
+ this.selectedSources = new ArrayList<jalviewSourceI>();
+ // filter both sequences and sources to eliminate duplicates
+ for (jalviewSourceI src : selectedSources2)
+ {
+ if (!selectedSources.contains(src))
+ {
+ selectedSources.add(src);
+ }
+ ;
+ }
+ Vector sqs = new Vector();
+ for (int i = 0; i < oursequences.length; i++)
+ {
+ if (!sqs.contains(oursequences[i]))
+ {
+ sqs.addElement(oursequences[i]);
+ }
+ }
+ sequences = new SequenceI[sqs.size()];
+ for (int i = 0; i < sequences.length; i++)
+ {
+ sequences[i] = (SequenceI) sqs.elementAt(i);
+ }
+ if (fsettings != null)
+ {
+ this.fsettings = fsettings;
+ this.af = fsettings.af;
+ af.setShowSeqFeatures(true);
+ }
+ int uniprotCount = 0;
+ for (jalviewSourceI source : selectedSources)
+ {
+ for (COORDINATES coords : source.getVersion().getCOORDINATES())
+ {
+ // TODO: match UniProt coord system canonically (?) - does
+ // UniProt==uniprot==UNIPROT ?
+ if (coords.getAuthority().toLowerCase().equals("uniprot"))
+ {
+ uniprotCount++;
+ break;
+ }
+ }
+ }
+
+ int refCount = 0;
+ for (int i = 0; i < sequences.length; i++)
+ {
+ DBRefEntry[] dbref = sequences[i].getDBRef();
+ if (dbref != null)
+ {
+ for (int j = 0; j < dbref.length; j++)
+ {
+ if (dbref[j].getSource().equals(
+ jalview.datamodel.DBRefSource.UNIPROT))
+ {
+ refCount++;
+ break;
+ }
+ }
+ }
+ }
+
+ if (checkDbrefs && refCount < sequences.length && uniprotCount > 0)
+ {
+
+ int reply = JOptionPane.YES_OPTION;
+ if (promptFetchDbrefs)
+ {
+ reply = JOptionPane
+ .showInternalConfirmDialog(
+ Desktop.desktop,
+ "Do you want Jalview to find\n"
+ + "Uniprot Accession ids for given sequence names?",
+ "Find Uniprot Accession Ids",
+ JOptionPane.YES_NO_OPTION,
+ JOptionPane.QUESTION_MESSAGE);
+ }
+
+ if (reply == JOptionPane.YES_OPTION)
+ {
+ Thread thread = new Thread(new FetchDBRefs());
+ thread.start();
+ }
+ else
+ {
+ _startFetching();
+ }
+ }
+ else
+ {
+ _startFetching();
+ }
+
+ }
+
+ private void _startFetching()
+ {
+ running = true;
+ new Thread(new FetchSeqFeatures()).start();
+ }
+
+ class FetchSeqFeatures implements Runnable
+ {
+ public void run()
+ {
+ startFetching();
+ setGuiFetchComplete();
+ }
+ }
+
+ class FetchDBRefs implements Runnable
+ {
+ public void run()
+ {
+ running = true;
+ new DBRefFetcher(sequences, af).fetchDBRefs(true);
+ startFetching();
+ setGuiFetchComplete();
+ }
+ }
+
+ /**
+ * Spawns Fetcher threads to add features to sequences in the dataset
+ */
+ void startFetching()
+ {
+ running = true;
+ cancelled = false;
+ startTime = System.currentTimeMillis();
+ if (af != null)
+ {
+ af.setProgressBar("Fetching DAS Sequence Features", startTime);
+ }
+ if (sourceRegistry == null)
+ {
+ sourceRegistry = Cache.getDasSourceRegistry();
+ }
+ if (selectedSources == null || selectedSources.size() == 0)
+ {
+ try
+ {
+ jalviewSourceI[] sources = sourceRegistry.getSources().toArray(
+ new jalviewSourceI[0]);
+ String active = jalview.bin.Cache.getDefault("DAS_ACTIVE_SOURCE",
+ "uniprot");
+ StringTokenizer st = new StringTokenizer(active, "\t");
+ selectedSources = new Vector();
+ String token;
+ while (st.hasMoreTokens())
+ {
+ token = st.nextToken();
+ for (int i = 0; i < sources.length; i++)
+ {
+ if (sources[i].getTitle().equals(token))
+ {
+ selectedSources.add(sources[i]);
+ break;
+ }
+ }
+ }
+ } catch (Exception ex)
+ {
+ debug("Exception whilst setting default feature sources from registry and local preferences.",
+ ex);
+ }
+ }
+
+ if (selectedSources == null || selectedSources.size() == 0)
+ {
+ System.out.println("No DAS Sources active");
+ cancelled = true;
+ setGuiNoDassourceActive();
+ return;
+ }
+
+ sourcesRemaining = selectedSources.size();
+ FeaturesClientMultipleSources fc = new FeaturesClientMultipleSources();
+ fc.setConnProps(sourceRegistry.getSessionHandler());
+ // Now sending requests one at a time to each server
+ ArrayList<jalviewSourceI> srcobj = new ArrayList<jalviewSourceI>();
+ ArrayList<String> src = new ArrayList<String>();
+ List<List<String>> ids = new ArrayList<List<String>>();
+ List<List<DBRefEntry>> idobj = new ArrayList<List<DBRefEntry>>();
+ List<Map<String, SequenceI>> sqset = new ArrayList<Map<String, SequenceI>>();
+ for (jalviewSourceI _sr : selectedSources)
+ {
+
+ Map<String, SequenceI> slist = new HashMap<String, SequenceI>();
+ List<DBRefEntry> idob = new ArrayList<DBRefEntry>();
+ List<String> qset = new ArrayList<String>();
+
+ for (SequenceI seq : sequences)
+ {
+ Object[] idset = nextSequence(_sr, seq);
+ if (idset != null)
+ {
+ List<DBRefEntry> _idob = (List<DBRefEntry>) idset[0];
+ List<String> _qset = (List<String>) idset[1];
+ if (_idob.size() > 0)
+ {
+ // add sequence's ref for each id derived from it
+ // (space inefficient, but most unambiguous)
+ // could replace with hash with _qset values as keys.
+ Iterator<DBRefEntry> dbobj = _idob.iterator();
+ for (String q : _qset)
+ {
+ SequenceI osq = slist.get(q);
+ DBRefEntry dr = dbobj.next();
+ if (osq != null && osq != seq)
+ {
+ // skip - non-canonical query
+ }
+ else
+ {
+ idob.add(dr);
+ qset.add(q);
+ slist.put(q, seq);
+ }
+ }
+ }
+ }
+ }
+ if (idob.size() > 0)
+ {
+ srcobj.add(_sr);
+ src.add(_sr.getSourceURL());
+ ids.add(qset);
+ idobj.add(idob);
+ sqset.add(slist);
+ }
+ }
+ Map<String, Map<List<String>, Exception>> errors = new HashMap<String, Map<List<String>, Exception>>();
+ Map<String, Map<List<String>, DasGFFAdapter>> results = new HashMap<String, Map<List<String>, DasGFFAdapter>>();
+ if (!useJDASMultiThread)
+ {
+ Iterator<String> sources = src.iterator();
+ // iterate over each query for each source and do each one individually
+ for (List<String> idl : ids)
+ {
+ String source = sources.next();
+ FeaturesClient featuresc = new FeaturesClient(sourceRegistry
+ .getSessionHandler().getConnectionPropertyProviderFor(
+ source));
+ for (String id : idl)
+ {
+ List<String> qid = Arrays.asList(new String[]
+ { id });
+ try
+ {
+ DasGFFAdapter dga = featuresc.fetchData(source, qid);
+ Map<List<String>, DasGFFAdapter> ers = results.get(source);
+ if (ers == null)
+ {
+ results.put(source,
+ ers = new HashMap<List<String>, DasGFFAdapter>());
+ }
+ ers.put(qid, dga);
+ } catch (Exception ex)
+ {
+ Map<List<String>, Exception> ers = errors.get(source);
+ if (ers == null)
+ {
+ errors.put(source,
+ ers = new HashMap<List<String>, Exception>());
+ }
+ ers.put(qid, ex);
+ }
+ }
+ }
+ }
+ else
+ {
+ // pass them all at once
+ fc.fetchData(src, ids, false, results, errors);
+ fc.shutDown();
+ while (!fc.isTerminated())
+ {
+ try
+ {
+ Thread.sleep(200);
+ } catch (InterruptedException x)
+ {
+
+ }
+ }
+ }
+ Iterator<List<String>> idset = ids.iterator();
+ Iterator<List<DBRefEntry>> idobjset = idobj.iterator();
+ Iterator<Map<String, SequenceI>> seqset = sqset.iterator();
+ for (jalviewSourceI source : srcobj)
+ {
+ processResponse(seqset.next(), source, idset.next(), idobjset.next(),
+ results.get(source.getSourceURL()),
+ errors.get(source.getSourceURL()));
+ }
+ }
+
+ private void processResponse(Map<String, SequenceI> sequencemap,
+ jalviewSourceI jvsource, List<String> ids,
+ List<DBRefEntry> idobj, Map<List<String>, DasGFFAdapter> results,
+ Map<List<String>, Exception> errors)
+ {
+ Set<SequenceI> sequences = new HashSet<SequenceI>();
+ String source = jvsource.getSourceURL();
+ // process features
+ DasGFFAdapter result = (results == null) ? null : results.get(ids);
+ Exception error = (errors == null) ? null : errors.get(ids);
+ if (result == null)
+ {
+ debug("das source " + source + " could not be contacted. "
+ + (error == null ? "" : error.toString()));
+ }
+ else
+ {
+
+ GFFAdapter gff = result.getGFF();
+ List<SEGMENT> segments = gff.getSegments();
+ List<ERRORSEGMENT> errorsegs = gff.getErrorSegments();
+ List<UNKNOWNFEATURE> unkfeats = gff.getUnknownFeatures();
+ List<UNKNOWNSEGMENT> unksegs = gff.getUnknownSegments();
+ debug("das source " + source + " returned " + gff.getTotal()
+ + " responses. " + (errorsegs != null ? errorsegs.size() : 0)
+ + " were incorrect segment queries, "
+ + (unkfeats != null ? unkfeats.size() : 0)
+ + " were unknown features "
+ + (unksegs != null ? unksegs.size() : 0)
+ + " were unknown segments and "
+ + (segments != null ? segments.size() : 0)
+ + " were segment responses.");
+ Iterator<DBRefEntry> dbr = idobj.iterator();
+ if (segments != null)
+ {
+ for (SEGMENT seg : segments)
+ {
+ String id = seg.getId();
+ if (ids.indexOf(id) == -1)
+ {
+ id = id.toUpperCase();
+ }
+ DBRefEntry dbref = idobj.get(ids.indexOf(id));
+ SequenceI sequence = sequencemap.get(id);
+ boolean added = false;
+ sequences.add(sequence);
+
+ for (FEATURE feat : seg.getFEATURE())
+ {
+ // standard DAS feature-> jalview sequence feature transformation
+ SequenceFeature f = newSequenceFeature(feat,
+ jvsource.getTitle());
+ if (!parseSeqFeature(sequence, f, feat, jvsource))
+ {
+ if (dbref.getMap() != null && f.getBegin() > 0
+ && f.getEnd() > 0)
+ {
+ debug("mapping from " + f.getBegin() + " - " + f.getEnd());
+ SequenceFeature vf[] = null;
+
+ try
+ {
+ vf = dbref.getMap().locateFeature(f);
+ } catch (Exception ex)
+ {
+ Cache.log
+ .info("Error in 'experimental' mapping of features. Please try to reproduce and then report info to jalview-discuss@jalview.org.");
+ Cache.log.info("Mapping feature from " + f.getBegin()
+ + " to " + f.getEnd() + " in dbref "
+ + dbref.getAccessionId() + " in "
+ + dbref.getSource());
+ Cache.log.info("using das Source " + source);
+ Cache.log.info("Exception", ex);
+ }
+
+ if (vf != null)
+ {
+ for (int v = 0; v < vf.length; v++)
+ {
+ debug("mapping to " + v + ": " + vf[v].getBegin()
+ + " - " + vf[v].getEnd());
+ sequence.addSequenceFeature(vf[v]);
+ }
+ }
+ }
+ else
+ {
+ sequence.addSequenceFeature(f);
+ }
+ }
+ }
+ }
+ featuresAdded(sequences);
+ }
+ else
+ {
+ // System.out.println("No features found for " + seq.getName()
+ // + " from: " + e.getDasSource().getNickname());
+ }
+ }
+ }
+
+ private void setGuiNoDassourceActive()
+ {
+
+ if (af != null)
+ {
+ af.setProgressBar("No DAS Sources Active", startTime);
+ }
+ if (getFeatSettings() != null)
+ {
+ fsettings.noDasSourceActive();
+ }
+ }
+
+ /**
+ * Update our fsettings dialog reference if we didn't have one when we were
+ * first initialised.
+ *
+ * @return fsettings
+ */
+ private FeatureSettings getFeatSettings()
+ {
+ if (fsettings == null)
+ {
+ if (af != null)
+ {
+ fsettings = af.featureSettings;
+ }
+ }
+ return fsettings;
+ }
+
+ public void cancel()
+ {
+ if (af != null)
+ {
+ af.setProgressBar("DAS Feature Fetching Cancelled", startTime);
+ }
+ cancelled = true;
+ }
+
+ int sourcesRemaining = 0;
+
+ private boolean running = false;
+
+ private void setGuiFetchComplete()
+ {
+ running = false;
+ if (!cancelled && af != null)
+ {
+ // only update the progress bar if we've completed the fetch normally
+ af.setProgressBar("DAS Feature Fetching Complete", startTime);
+ }
+
+ if (af != null && af.featureSettings != null)
+ {
+ af.featureSettings.setTableData();
+ }
+
+ if (getFeatSettings() != null)
+ {
+ fsettings.complete();
+ }
+ }
+
+ void featuresAdded(Set<SequenceI> seqs)
+ {
+ if (af == null)
+ {
+ // no gui to update with features.
+ return;
+ }
+ af.getFeatureRenderer().featuresAdded();
+
+ int start = af.getViewport().getStartSeq();
+ int end = af.getViewport().getEndSeq();
+ int index;
+ for (index = start; index < end; index++)
+ {
+ for (SequenceI seq : seqs)
+ {
+ if (seq == af.getViewport().getAlignment().getSequenceAt(index)
+ .getDatasetSequence())
+ {
+ af.alignPanel.paintAlignment(true);
+ index = end;
+ break;
+ }
+ }
+ }
+ }
+
+ Object[] nextSequence(jalviewSourceI dasSource, SequenceI seq)
+ {
+ if (cancelled)
+ return null;
+ DBRefEntry[] uprefs = jalview.util.DBRefUtils.selectRefs(
+ seq.getDBRef(), new String[]
+ {
+ // jalview.datamodel.DBRefSource.PDB,
+ jalview.datamodel.DBRefSource.UNIPROT,
+ // jalview.datamodel.DBRefSource.EMBL - not tested on any EMBL coord
+ // sys sources
+ });
+ // TODO: minimal list of DAS queries to make by querying with untyped ID if
+ // distinct from any typed IDs
+
+ List<DBRefEntry> ids = new ArrayList<DBRefEntry>();
+ List<String> qstring = new ArrayList<String>();
+ boolean dasCoordSysFound = false;
+
+ if (uprefs != null)
+ {
+ // do any of these ids match the source's coordinate system ?
+ for (int j = 0; !dasCoordSysFound && j < uprefs.length; j++)
+ {
+
+ for (COORDINATES csys : dasSource.getVersion().getCOORDINATES())
+ {
+ if (jalview.util.DBRefUtils.isDasCoordinateSystem(
+ csys.getAuthority(), uprefs[j]))
+ {
+ debug("Launched fetcher for coordinate system "
+ + csys.getAuthority());
+ // Will have to pass any mapping information to the fetcher
+ // - the start/end for the DBRefEntry may not be the same as the
+ // sequence's start/end
+
+ System.out.println(seq.getName() + " "
+ + (seq.getDatasetSequence() == null) + " "
+ + csys.getUri());
+
+ dasCoordSysFound = true; // break's out of the loop
+ ids.add(uprefs[j]);
+ qstring.add(uprefs[j].getAccessionId());
+ }
+ else
+ System.out.println("IGNORE " + csys.getAuthority());
+ }
+ }
+ }
+
+ if (!dasCoordSysFound)
+ {
+ String id = null;
+ // try and use the name as the sequence id
+ if (seq.getName().indexOf("|") > -1)
+ {
+ id = seq.getName().substring(seq.getName().lastIndexOf("|") + 1);
+ if (id.trim().length() < 4)
+ {
+ // hack - we regard a significant ID as being at least 4
+ // non-whitespace characters
+ id = seq.getName().substring(0, seq.getName().lastIndexOf("|"));
+ if (id.indexOf("|") > -1)
+ {
+ id = id.substring(id.lastIndexOf("|") + 1);
+ }
+ }
+ }
+ else
+ {
+ id = seq.getName();
+ }
+ if (id != null)
+ {
+ DBRefEntry dbre = new DBRefEntry();
+ dbre.setAccessionId(id);
+ // Should try to call a general feature fetcher that
+ // queries many sources with name to discover applicable ID references
+ ids.add(dbre);
+ qstring.add(dbre.getAccessionId());
+ }
+ }
+
+ return new Object[]
+ { ids, qstring };
+ }
+
+ /**
+ * examine the given sequence feature to determine if it should actually be
+ * turned into sequence annotation or database cross references rather than a
+ * simple sequence feature.
+ *
+ * @param seq
+ * the sequence to annotate
+ * @param f
+ * the jalview sequence feature generated from the DAS feature
+ * @param map
+ * the sequence feature attributes
+ * @param source
+ * the source that emitted the feature
+ * @return true if feature was consumed as another kind of annotation.
+ */
+ protected boolean parseSeqFeature(SequenceI seq, SequenceFeature f,
+ FEATURE feature, jalviewSourceI source)
+ {
+ SequenceI mseq = seq;
+ while (seq.getDatasetSequence() != null)
+ {
+ seq = seq.getDatasetSequence();
+ }
+ if (f.getType() != null)
+ {
+ String type = f.getType();
+ if (type.equalsIgnoreCase("protein_name"))
+ {
+ // parse name onto the alignment sequence or the dataset sequence.
+ if (seq.getDescription() == null
+ || seq.getDescription().trim().length() == 0)
+ {
+ // could look at the note series to pick out the first long name, for
+ // the moment just use the whole description string
+ seq.setDescription(f.getDescription());
+ }
+ if (mseq.getDescription() == null
+ || mseq.getDescription().trim().length() == 0)
+ {
+ // could look at the note series to pick out the first long name, for
+ // the moment just use the whole description string
+ mseq.setDescription(f.getDescription());
+ }
+ return true;
+ }
+ // check if source has biosapiens or other sequence ontology label
+ if (type.equalsIgnoreCase("DBXREF") || type.equalsIgnoreCase("DBREF"))
+ {
+ // try to parse the accession out
+
+ DBRefEntry dbr = new DBRefEntry();
+ dbr.setVersion(source.getTitle());
+ StringTokenizer st = new StringTokenizer(f.getDescription(), ":");
+ if (st.hasMoreTokens())
+ {
+ dbr.setSource(st.nextToken());
+ }
+ if (st.hasMoreTokens())
+ {
+ dbr.setAccessionId(st.nextToken());
+ }
+ seq.addDBRef(dbr);
+
+ if (f.links != null && f.links.size() > 0)
+ {
+ // feature is also appended to enable links to be seen.
+ // TODO: consider extending dbrefs to have their own links ?
+ // TODO: new feature: extract dbref links from DAS servers and add the
+ // URL pattern to the list of DB name associated links in the user's
+ // preferences ?
+ // for the moment - just fix up the existing feature so it displays
+ // correctly.
+ // f.setType(dbr.getSource());
+ // f.setDescription();
+ f.setValue("linkonly", Boolean.TRUE);
+ // f.setDescription("");
+ Vector newlinks = new Vector();
+ Enumeration it = f.links.elements();
+ while (it.hasMoreElements())
+ {
+ String elm;
+ UrlLink urllink = new UrlLink(elm = (String) it.nextElement());
+ if (urllink.isValid())
+ {
+ urllink.setLabel(f.getDescription());
+ newlinks.addElement(urllink.toString());
+ }
+ else
+ {
+ // couldn't parse the link properly. Keep it anyway - just in
+ // case.
+ debug("couldn't parse link string - " + elm);
+ newlinks.addElement(elm);
+ }
+ }
+ f.links = newlinks;
+ seq.addSequenceFeature(f);
+ }
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * creates a jalview sequence feature from a das feature document
+ *
+ * @param feat
+ * @return sequence feature object created using dasfeature information
+ */
+ SequenceFeature newSequenceFeature(FEATURE feat, String nickname)
+ {
+ if (feat == null)
+ {
+ return null;
+ }
+ try
+ {
+ /**
+ * Different qNames for a DAS Feature - are string keys to the HashMaps in
+ * features "METHOD") || qName.equals("TYPE") || qName.equals("START") ||
+ * qName.equals("END") || qName.equals("NOTE") || qName.equals("LINK") ||
+ * qName.equals("SCORE")
+ */
+ String desc = new String();
+ if (feat.getNOTE() != null)
+ {
+ for (String note : feat.getNOTE())
+ {
+ desc += (String) note;
+ }
+ }
+
+ int start = 0, end = 0;
+ float score = 0f;
+
+ try
+ {
+ start = Integer.parseInt(feat.getSTART().toString());
+ } catch (Exception ex)
+ {
+ }
+ try
+ {
+ end = Integer.parseInt(feat.getEND().toString());
+ } catch (Exception ex)
+ {
+ }
+ try
+ {
+ Object scr = feat.getSCORE();
+ if (scr != null)
+ {
+ score = (float) Double.parseDouble(scr.toString());
+
+ }
+ } catch (Exception ex)
+ {
+ }
+
+ SequenceFeature f = new SequenceFeature(
+ getTypeString(feat.getTYPE()), desc, start, end, score,
+ nickname);
+
+ if (feat.getLINK() != null)
+ {
+ for (LINK link : feat.getLINK())
+ {
+ // Do not put feature extent in link text for non-positional features
+ if (f.begin == 0 && f.end == 0)
+ {
+ f.addLink(f.getType() + " " + link.getContent() + "|"
+ + link.getHref());
+ }
+ else
+ {
+ f.addLink(f.getType() + " " + f.begin + "_" + f.end + " "
+ + link.getContent() + "|" + link.getHref());
+ }
+ }
+ }
+
+ return f;
+ } catch (Exception e)
+ {
+ System.out.println("ERRR " + e);
+ e.printStackTrace();
+ System.out.println("############");
+ debug("Failed to parse " + feat.toString(), e);
+ return null;
+ }
+ }
+
+ private String getTypeString(TYPE type)
+ {
+ return type.getContent();
+ }
+
+ public boolean isRunning()
+ {
+ return running;
+ }
+
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
package jalview.ws;\r
\r
import jalview.datamodel.Alignment;\r
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.ws.dbsources;\r
-\r
-import java.io.BufferedReader;\r
-import java.io.File;\r
-import java.io.FileReader;\r
-\r
-import com.stevesoft.pat.Regex;\r
-\r
-import jalview.datamodel.AlignmentI;\r
-import jalview.ws.seqfetcher.DbSourceProxyImpl;\r
-\r
-public abstract class EbiFileRetrievedProxy extends DbSourceProxyImpl\r
-{\r
-\r
- /**\r
- * temp path to retrieved file\r
- */\r
- protected String file = null;\r
-\r
- public StringBuffer getRawRecords()\r
- {\r
- if (file == null)\r
- return null;\r
- StringBuffer bf = null;\r
- try\r
- {\r
- File f = new File(file);\r
- if (f.exists())\r
- {\r
- bf = new StringBuffer();\r
- BufferedReader breader = new BufferedReader(new FileReader(f));\r
- String line = null;\r
- while (breader.ready() && (line = breader.readLine()) != null)\r
- {\r
- bf.append(line);\r
- }\r
- breader.close();\r
- }\r
- } catch (Exception e)\r
- {\r
- System.err.println("Warning: problems reading temp file " + file);\r
- return null;\r
- }\r
- return bf;\r
- }\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.ws.dbsources;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+
+import com.stevesoft.pat.Regex;
+
+import jalview.datamodel.AlignmentI;
+import jalview.ws.seqfetcher.DbSourceProxyImpl;
+
+public abstract class EbiFileRetrievedProxy extends DbSourceProxyImpl
+{
+
+ /**
+ * temp path to retrieved file
+ */
+ protected String file = null;
+
+ public StringBuffer getRawRecords()
+ {
+ if (file == null)
+ return null;
+ StringBuffer bf = null;
+ try
+ {
+ File f = new File(file);
+ if (f.exists())
+ {
+ bf = new StringBuffer();
+ BufferedReader breader = new BufferedReader(new FileReader(f));
+ String line = null;
+ while (breader.ready() && (line = breader.readLine()) != null)
+ {
+ bf.append(line);
+ }
+ breader.close();
+ }
+ } catch (Exception e)
+ {
+ System.err.println("Warning: problems reading temp file " + file);
+ return null;
+ }
+ return bf;
+ }
+
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.ws.dbsources;\r
-\r
-import java.util.Hashtable;\r
-\r
-import com.stevesoft.pat.Regex;\r
-\r
-import jalview.datamodel.AlignmentI;\r
-import jalview.datamodel.DBRefSource;\r
-import jalview.ws.seqfetcher.DbSourceProxy;\r
-\r
-public class EmblCdsSouce extends EmblXmlSource implements DbSourceProxy\r
-{\r
-\r
- public EmblCdsSouce()\r
- {\r
- super();\r
- addDbSourceProperty(DBRefSource.CODINGSEQDB);\r
- }\r
-\r
- public String getAccessionSeparator()\r
- {\r
- return null;\r
- }\r
-\r
- public Regex getAccessionValidator()\r
- {\r
- return new com.stevesoft.pat.Regex("^[A-Z]+[0-9]+");\r
- }\r
-\r
- public String getDbSource()\r
- {\r
- return DBRefSource.EMBLCDS;\r
- }\r
-\r
- public String getDbVersion()\r
- {\r
- return "0"; // TODO : this is dynamically set for a returned record - not\r
- // tied to proxy\r
- }\r
-\r
- public AlignmentI getSequenceRecords(String queries) throws Exception\r
- {\r
- if (queries.indexOf(".") > -1)\r
- {\r
- queries = queries.substring(0, queries.indexOf("."));\r
- }\r
- return getEmblSequenceRecords(DBRefSource.EMBLCDS, queries);\r
- }\r
-\r
- public boolean isValidReference(String accession)\r
- {\r
- // most embl CDS refs look like ..\r
- // TODO: improve EMBLCDS regex\r
- return (accession == null || accession.length() < 2) ? false\r
- : getAccessionValidator().search(accession);\r
- }\r
-\r
- /**\r
- * cDNA for LDHA_CHICK swissprot sequence\r
- */\r
- public String getTestQuery()\r
- {\r
- return "CAA37824";\r
- }\r
-\r
- public String getDbName()\r
- {\r
- return "EMBL (CDS)";\r
- }\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.ws.dbsources;
+
+import java.util.Hashtable;
+
+import com.stevesoft.pat.Regex;
+
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.DBRefSource;
+import jalview.ws.seqfetcher.DbSourceProxy;
+
+public class EmblCdsSouce extends EmblXmlSource implements DbSourceProxy
+{
+
+ public EmblCdsSouce()
+ {
+ super();
+ addDbSourceProperty(DBRefSource.CODINGSEQDB);
+ }
+
+ public String getAccessionSeparator()
+ {
+ return null;
+ }
+
+ public Regex getAccessionValidator()
+ {
+ return new com.stevesoft.pat.Regex("^[A-Z]+[0-9]+");
+ }
+
+ public String getDbSource()
+ {
+ return DBRefSource.EMBLCDS;
+ }
+
+ public String getDbVersion()
+ {
+ return "0"; // TODO : this is dynamically set for a returned record - not
+ // tied to proxy
+ }
+
+ public AlignmentI getSequenceRecords(String queries) throws Exception
+ {
+ if (queries.indexOf(".") > -1)
+ {
+ queries = queries.substring(0, queries.indexOf("."));
+ }
+ return getEmblSequenceRecords(DBRefSource.EMBLCDS, queries);
+ }
+
+ public boolean isValidReference(String accession)
+ {
+ // most embl CDS refs look like ..
+ // TODO: improve EMBLCDS regex
+ return (accession == null || accession.length() < 2) ? false
+ : getAccessionValidator().search(accession);
+ }
+
+ /**
+ * cDNA for LDHA_CHICK swissprot sequence
+ */
+ public String getTestQuery()
+ {
+ return "CAA37824";
+ }
+
+ public String getDbName()
+ {
+ return "EMBL (CDS)";
+ }
+
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.ws.dbsources;\r
-\r
-import java.io.File;\r
-import java.util.Hashtable;\r
-import java.util.Iterator;\r
-import java.util.StringTokenizer;\r
-\r
-import com.stevesoft.pat.Regex;\r
-\r
-import jalview.datamodel.Alignment;\r
-import jalview.datamodel.AlignmentI;\r
-import jalview.datamodel.DBRefSource;\r
-import jalview.datamodel.SequenceI;\r
-import jalview.datamodel.xdb.embl.EmblEntry;\r
-import jalview.ws.ebi.EBIFetchClient;\r
-import jalview.ws.seqfetcher.DbSourceProxy;\r
-import jalview.ws.seqfetcher.DbSourceProxyImpl;\r
-\r
-/**\r
- * @author JimP\r
- * \r
- */\r
-public class EmblSource extends EmblXmlSource implements DbSourceProxy\r
-{\r
-\r
- public EmblSource()\r
- {\r
- addDbSourceProperty(DBRefSource.DNASEQDB);\r
- addDbSourceProperty(DBRefSource.CODINGSEQDB);\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.ws.DbSourceProxy#getAccessionSeparator()\r
- */\r
- public String getAccessionSeparator()\r
- {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.ws.DbSourceProxy#getAccessionValidator()\r
- */\r
- public Regex getAccessionValidator()\r
- {\r
- return new com.stevesoft.pat.Regex("^[A-Z]+[0-9]+");\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.ws.DbSourceProxy#getDbSource()\r
- */\r
- public String getDbSource()\r
- {\r
- return DBRefSource.EMBL;\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.ws.DbSourceProxy#getDbVersion()\r
- */\r
- public String getDbVersion()\r
- {\r
- // TODO Auto-generated method stub\r
- return "0";\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.ws.DbSourceProxy#getSequenceRecords(java.lang.String[])\r
- */\r
- public AlignmentI getSequenceRecords(String queries) throws Exception\r
- {\r
- return getEmblSequenceRecords(DBRefSource.EMBL, queries);\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.ws.DbSourceProxy#isValidReference(java.lang.String)\r
- */\r
- public boolean isValidReference(String accession)\r
- {\r
- // most embl refs look like ..\r
-\r
- return (accession == null || accession.length() < 2) ? false\r
- : getAccessionValidator().search(accession);\r
-\r
- }\r
-\r
- /**\r
- * return LHD_CHICK coding gene\r
- */\r
- public String getTestQuery()\r
- {\r
- return "X53828";\r
- }\r
-\r
- public String getDbName()\r
- {\r
- return "EMBL"; // getDbSource();\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.ws.dbsources;
+
+import java.io.File;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.StringTokenizer;
+
+import com.stevesoft.pat.Regex;
+
+import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.DBRefSource;
+import jalview.datamodel.SequenceI;
+import jalview.datamodel.xdb.embl.EmblEntry;
+import jalview.ws.ebi.EBIFetchClient;
+import jalview.ws.seqfetcher.DbSourceProxy;
+import jalview.ws.seqfetcher.DbSourceProxyImpl;
+
+/**
+ * @author JimP
+ *
+ */
+public class EmblSource extends EmblXmlSource implements DbSourceProxy
+{
+
+ public EmblSource()
+ {
+ addDbSourceProperty(DBRefSource.DNASEQDB);
+ addDbSourceProperty(DBRefSource.CODINGSEQDB);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#getAccessionSeparator()
+ */
+ public String getAccessionSeparator()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#getAccessionValidator()
+ */
+ public Regex getAccessionValidator()
+ {
+ return new com.stevesoft.pat.Regex("^[A-Z]+[0-9]+");
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#getDbSource()
+ */
+ public String getDbSource()
+ {
+ return DBRefSource.EMBL;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#getDbVersion()
+ */
+ public String getDbVersion()
+ {
+ // TODO Auto-generated method stub
+ return "0";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#getSequenceRecords(java.lang.String[])
+ */
+ public AlignmentI getSequenceRecords(String queries) throws Exception
+ {
+ return getEmblSequenceRecords(DBRefSource.EMBL, queries);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#isValidReference(java.lang.String)
+ */
+ public boolean isValidReference(String accession)
+ {
+ // most embl refs look like ..
+
+ return (accession == null || accession.length() < 2) ? false
+ : getAccessionValidator().search(accession);
+
+ }
+
+ /**
+ * return LHD_CHICK coding gene
+ */
+ public String getTestQuery()
+ {
+ return "X53828";
+ }
+
+ public String getDbName()
+ {
+ return "EMBL"; // getDbSource();
+ }
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.ws.dbsources;\r
-\r
-import jalview.datamodel.Alignment;\r
-import jalview.datamodel.AlignmentI;\r
-import jalview.datamodel.SequenceI;\r
-import jalview.datamodel.xdb.embl.EmblEntry;\r
-import jalview.ws.ebi.EBIFetchClient;\r
-\r
-import java.io.File;\r
-import java.util.Iterator;\r
-import java.util.Vector;\r
-\r
-public abstract class EmblXmlSource extends EbiFileRetrievedProxy\r
-{\r
-\r
- /**\r
- * Last properly parsed embl file.\r
- */\r
- public jalview.datamodel.xdb.embl.EmblFile efile = null;\r
-\r
- public EmblXmlSource()\r
- {\r
- super();\r
- }\r
-\r
- /**\r
- * retrieve and parse an emblxml file\r
- * \r
- * @param emprefx\r
- * either EMBL or EMBLCDS strings are allowed - anything else will\r
- * not retrieve emblxml\r
- * @param query\r
- * @return\r
- * @throws Exception\r
- */\r
- public AlignmentI getEmblSequenceRecords(String emprefx, String query)\r
- throws Exception\r
- {\r
- startQuery();\r
- EBIFetchClient dbFetch = new EBIFetchClient();\r
- File reply;\r
- try\r
- {\r
- reply = dbFetch.fetchDataAsFile(\r
- emprefx.toLowerCase() + ":" + query.trim(), "emblxml", null);\r
- } catch (Exception e)\r
- {\r
- stopQuery();\r
- throw new Exception("EBI EMBL XML retrieval failed on "\r
- + emprefx.toLowerCase() + ":" + query.trim(), e);\r
- }\r
- return getEmblSequenceRecords(emprefx, query, reply);\r
- }\r
-\r
- /**\r
- * parse an emblxml file stored locally\r
- * \r
- * @param emprefx\r
- * either EMBL or EMBLCDS strings are allowed - anything else will\r
- * not retrieve emblxml\r
- * @param query\r
- * @param file\r
- * the EMBL XML file containing the results of a query\r
- * @return\r
- * @throws Exception\r
- */\r
- public AlignmentI getEmblSequenceRecords(String emprefx, String query,\r
- File reply) throws Exception\r
- {\r
- SequenceI seqs[] = null;\r
- StringBuffer result = new StringBuffer();\r
- if (reply != null && reply.exists())\r
- {\r
- efile = null;\r
- file = reply.getAbsolutePath();\r
- if (reply.length() > 25)\r
- {\r
- efile = jalview.datamodel.xdb.embl.EmblFile.getEmblFile(reply);\r
- }\r
- else\r
- {\r
- result.append("# No EMBL record retrieved for "\r
- + emprefx.toLowerCase() + ":" + query.trim());\r
- }\r
- }\r
- if (efile != null)\r
- {\r
- for (Iterator i = efile.getEntries().iterator(); i.hasNext();)\r
- {\r
- EmblEntry entry = (EmblEntry) i.next();\r
- SequenceI[] seqparts = entry.getSequences(false, true, emprefx); // TODO:\r
- // use\r
- // !fetchNa,!fetchPeptide\r
- // here\r
- // instead\r
- // -\r
- // see\r
- // todo\r
- // in\r
- // emblEntry\r
- if (seqparts != null)\r
- {\r
- SequenceI[] newseqs = null;\r
- int si = 0;\r
- if (seqs == null)\r
- {\r
- newseqs = new SequenceI[seqparts.length];\r
- }\r
- else\r
- {\r
- newseqs = new SequenceI[seqs.length + seqparts.length];\r
-\r
- for (; si < seqs.length; si++)\r
- {\r
- newseqs[si] = seqs[si];\r
- seqs[si] = null;\r
- }\r
- }\r
- for (int j = 0; j < seqparts.length; si++, j++)\r
- {\r
- newseqs[si] = seqparts[j].deriveSequence(); // place DBReferences on\r
- // dataset and refer\r
- }\r
- seqs = newseqs;\r
-\r
- }\r
- }\r
- }\r
- else\r
- {\r
- result = null;\r
- }\r
- AlignmentI al = null;\r
- if (seqs != null && seqs.length > 0)\r
- {\r
- al = new Alignment(seqs);\r
- result.append("# Successfully parsed the " + emprefx\r
- + " queries into an Alignment");\r
- results = result;\r
- }\r
- stopQuery();\r
- return al;\r
- }\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.ws.dbsources;
+
+import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.SequenceI;
+import jalview.datamodel.xdb.embl.EmblEntry;
+import jalview.ws.ebi.EBIFetchClient;
+
+import java.io.File;
+import java.util.Iterator;
+import java.util.Vector;
+
+public abstract class EmblXmlSource extends EbiFileRetrievedProxy
+{
+
+ /**
+ * Last properly parsed embl file.
+ */
+ public jalview.datamodel.xdb.embl.EmblFile efile = null;
+
+ public EmblXmlSource()
+ {
+ super();
+ }
+
+ /**
+ * retrieve and parse an emblxml file
+ *
+ * @param emprefx
+ * either EMBL or EMBLCDS strings are allowed - anything else will
+ * not retrieve emblxml
+ * @param query
+ * @return
+ * @throws Exception
+ */
+ public AlignmentI getEmblSequenceRecords(String emprefx, String query)
+ throws Exception
+ {
+ startQuery();
+ EBIFetchClient dbFetch = new EBIFetchClient();
+ File reply;
+ try
+ {
+ reply = dbFetch.fetchDataAsFile(
+ emprefx.toLowerCase() + ":" + query.trim(), "emblxml", null);
+ } catch (Exception e)
+ {
+ stopQuery();
+ throw new Exception("EBI EMBL XML retrieval failed on "
+ + emprefx.toLowerCase() + ":" + query.trim(), e);
+ }
+ return getEmblSequenceRecords(emprefx, query, reply);
+ }
+
+ /**
+ * parse an emblxml file stored locally
+ *
+ * @param emprefx
+ * either EMBL or EMBLCDS strings are allowed - anything else will
+ * not retrieve emblxml
+ * @param query
+ * @param file
+ * the EMBL XML file containing the results of a query
+ * @return
+ * @throws Exception
+ */
+ public AlignmentI getEmblSequenceRecords(String emprefx, String query,
+ File reply) throws Exception
+ {
+ SequenceI seqs[] = null;
+ StringBuffer result = new StringBuffer();
+ if (reply != null && reply.exists())
+ {
+ efile = null;
+ file = reply.getAbsolutePath();
+ if (reply.length() > 25)
+ {
+ efile = jalview.datamodel.xdb.embl.EmblFile.getEmblFile(reply);
+ }
+ else
+ {
+ result.append("# No EMBL record retrieved for "
+ + emprefx.toLowerCase() + ":" + query.trim());
+ }
+ }
+ if (efile != null)
+ {
+ for (Iterator i = efile.getEntries().iterator(); i.hasNext();)
+ {
+ EmblEntry entry = (EmblEntry) i.next();
+ SequenceI[] seqparts = entry.getSequences(false, true, emprefx); // TODO:
+ // use
+ // !fetchNa,!fetchPeptide
+ // here
+ // instead
+ // -
+ // see
+ // todo
+ // in
+ // emblEntry
+ if (seqparts != null)
+ {
+ SequenceI[] newseqs = null;
+ int si = 0;
+ if (seqs == null)
+ {
+ newseqs = new SequenceI[seqparts.length];
+ }
+ else
+ {
+ newseqs = new SequenceI[seqs.length + seqparts.length];
+
+ for (; si < seqs.length; si++)
+ {
+ newseqs[si] = seqs[si];
+ seqs[si] = null;
+ }
+ }
+ for (int j = 0; j < seqparts.length; si++, j++)
+ {
+ newseqs[si] = seqparts[j].deriveSequence(); // place DBReferences on
+ // dataset and refer
+ }
+ seqs = newseqs;
+
+ }
+ }
+ }
+ else
+ {
+ result = null;
+ }
+ AlignmentI al = null;
+ if (seqs != null && seqs.length > 0)
+ {
+ al = new Alignment(seqs);
+ result.append("# Successfully parsed the " + emprefx
+ + " queries into an Alignment");
+ results = result;
+ }
+ stopQuery();
+ return al;
+ }
+
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.ws.dbsources;\r
-\r
-import java.io.File;\r
-import java.util.Hashtable;\r
-import java.util.Iterator;\r
-import java.util.StringTokenizer;\r
-\r
-import com.stevesoft.pat.Regex;\r
-\r
-import jalview.datamodel.Alignment;\r
-import jalview.datamodel.AlignmentI;\r
-import jalview.datamodel.DBRefSource;\r
-import jalview.datamodel.SequenceI;\r
-import jalview.datamodel.xdb.embl.EmblEntry;\r
-import jalview.ws.ebi.EBIFetchClient;\r
-import jalview.ws.seqfetcher.DbSourceProxy;\r
-import jalview.ws.seqfetcher.DbSourceProxyImpl;\r
-\r
-/**\r
- * Test class for accessing GeneDB - not yet finished.\r
- * \r
- * @author JimP\r
- * \r
- */\r
-public class GeneDbSource extends EmblXmlSource implements DbSourceProxy\r
-{\r
-\r
- public GeneDbSource()\r
- {\r
- addDbSourceProperty(DBRefSource.DNASEQDB);\r
- addDbSourceProperty(DBRefSource.CODINGSEQDB);\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.ws.DbSourceProxy#getAccessionSeparator()\r
- */\r
- public String getAccessionSeparator()\r
- {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.ws.DbSourceProxy#getAccessionValidator()\r
- */\r
- public Regex getAccessionValidator()\r
- {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.ws.DbSourceProxy#getDbSource()\r
- */\r
- public String getDbSource()\r
- {\r
- return DBRefSource.GENEDB;\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.ws.DbSourceProxy#getDbVersion()\r
- */\r
- public String getDbVersion()\r
- {\r
- // TODO Auto-generated method stub\r
- return "0";\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.ws.DbSourceProxy#getSequenceRecords(java.lang.String[])\r
- */\r
- public AlignmentI getSequenceRecords(String queries) throws Exception\r
- {\r
- // query of form\r
- // http://www.genedb.org/genedb/ArtemisFormHandler?id=&dest=EMBL\r
- //\r
- return getEmblSequenceRecords(DBRefSource.GENEDB, queries);\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.ws.DbSourceProxy#isValidReference(java.lang.String)\r
- */\r
- public boolean isValidReference(String accession)\r
- {\r
- // TODO Auto-generated method stub\r
- return false;\r
- }\r
-\r
- /**\r
- * return T.Brucei Mannosyl-Transferase TbPIG-M\r
- */\r
- public String getTestQuery()\r
- {\r
- return "Tb927.6.3300";\r
- }\r
-\r
- public String getDbName()\r
- {\r
- return "GeneDB"; // getDbSource();\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.ws.dbsources;
+
+import java.io.File;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.StringTokenizer;
+
+import com.stevesoft.pat.Regex;
+
+import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.DBRefSource;
+import jalview.datamodel.SequenceI;
+import jalview.datamodel.xdb.embl.EmblEntry;
+import jalview.ws.ebi.EBIFetchClient;
+import jalview.ws.seqfetcher.DbSourceProxy;
+import jalview.ws.seqfetcher.DbSourceProxyImpl;
+
+/**
+ * Test class for accessing GeneDB - not yet finished.
+ *
+ * @author JimP
+ *
+ */
+public class GeneDbSource extends EmblXmlSource implements DbSourceProxy
+{
+
+ public GeneDbSource()
+ {
+ addDbSourceProperty(DBRefSource.DNASEQDB);
+ addDbSourceProperty(DBRefSource.CODINGSEQDB);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#getAccessionSeparator()
+ */
+ public String getAccessionSeparator()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#getAccessionValidator()
+ */
+ public Regex getAccessionValidator()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#getDbSource()
+ */
+ public String getDbSource()
+ {
+ return DBRefSource.GENEDB;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#getDbVersion()
+ */
+ public String getDbVersion()
+ {
+ // TODO Auto-generated method stub
+ return "0";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#getSequenceRecords(java.lang.String[])
+ */
+ public AlignmentI getSequenceRecords(String queries) throws Exception
+ {
+ // query of form
+ // http://www.genedb.org/genedb/ArtemisFormHandler?id=&dest=EMBL
+ //
+ return getEmblSequenceRecords(DBRefSource.GENEDB, queries);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#isValidReference(java.lang.String)
+ */
+ public boolean isValidReference(String accession)
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /**
+ * return T.Brucei Mannosyl-Transferase TbPIG-M
+ */
+ public String getTestQuery()
+ {
+ return "Tb927.6.3300";
+ }
+
+ public String getDbName()
+ {
+ return "GeneDB"; // getDbSource();
+ }
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.ws.dbsources;\r
-\r
-import jalview.datamodel.Alignment;\r
-import jalview.datamodel.DBRefEntry;\r
-import jalview.datamodel.DBRefSource;\r
-import jalview.datamodel.SequenceI;\r
-\r
-import java.io.BufferedInputStream;\r
-import java.io.InputStream;\r
-import java.io.InputStreamReader;\r
-import java.util.Hashtable;\r
-import java.util.Vector;\r
-\r
-import MCview.PDBChain;\r
-import MCview.PDBfile;\r
-\r
-import com.stevesoft.pat.Regex;\r
-\r
-import jalview.datamodel.AlignmentI;\r
-import jalview.io.FileParse;\r
-import jalview.ws.ebi.EBIFetchClient;\r
-import jalview.ws.seqfetcher.DbSourceProxy;\r
-import jalview.ws.seqfetcher.DbSourceProxyImpl;\r
-\r
-/**\r
- * @author JimP\r
- * \r
- */\r
-public class Pdb extends EbiFileRetrievedProxy implements DbSourceProxy\r
-{\r
- public Pdb()\r
- {\r
- super();\r
- addDbSourceProperty(DBRefSource.PROTSEQDB);\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.ws.DbSourceProxy#getAccessionSeparator()\r
- */\r
- public String getAccessionSeparator()\r
- {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.ws.DbSourceProxy#getAccessionValidator()\r
- */\r
- public Regex getAccessionValidator()\r
- {\r
- return new Regex("([1-9][0-9A-Za-z]{3}):?([ _A-Za-z0-9]?)");\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.ws.DbSourceProxy#getDbSource()\r
- */\r
- public String getDbSource()\r
- {\r
- return DBRefSource.PDB;\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.ws.DbSourceProxy#getDbVersion()\r
- */\r
- public String getDbVersion()\r
- {\r
- return "0";\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.ws.DbSourceProxy#getSequenceRecords(java.lang.String[])\r
- */\r
- public AlignmentI getSequenceRecords(String queries) throws Exception\r
- {\r
-\r
- Vector result = new Vector();\r
- String chain = null;\r
- String id = null;\r
- if (queries.indexOf(":") > -1)\r
- {\r
- chain = queries.substring(queries.indexOf(":") + 1);\r
- id = queries.substring(0, queries.indexOf(":"));\r
- }\r
- else\r
- {\r
- id = queries;\r
- }\r
- if (queries.length() > 4 && chain == null)\r
- {\r
- chain = queries.substring(4, 5);\r
- id = queries.substring(0, 4);\r
- }\r
- if (!isValidReference(id))\r
- {\r
- System.err.println("Ignoring invalid pdb query: '" + id + "'");\r
- stopQuery();\r
- return null;\r
- }\r
- EBIFetchClient ebi = new EBIFetchClient();\r
- file = ebi.fetchDataAsFile("pdb:" + id, "pdb", "raw").getAbsolutePath();\r
- stopQuery();\r
- if (file == null)\r
- {\r
- return null;\r
- }\r
- try\r
- {\r
-\r
- PDBfile pdbfile = new PDBfile(file,\r
- jalview.io.AppletFormatAdapter.FILE);\r
- for (int i = 0; i < pdbfile.chains.size(); i++)\r
- {\r
- if (chain == null\r
- || ((PDBChain) pdbfile.chains.elementAt(i)).id\r
- .toUpperCase().equals(chain))\r
- {\r
- PDBChain pdbchain = (PDBChain) pdbfile.chains.elementAt(i);\r
- // Get the Chain's Sequence - who's dataset includes any special\r
- // features added from the PDB file\r
- SequenceI sq = pdbchain.sequence;\r
- // Specially formatted name for the PDB chain sequences retrieved from\r
- // the PDB\r
- sq.setName(jalview.datamodel.DBRefSource.PDB + "|" + id + "|"\r
- + sq.getName());\r
- // Might need to add more metadata to the PDBEntry object\r
- // like below\r
- /*\r
- * PDBEntry entry = new PDBEntry(); // Construct the PDBEntry\r
- * entry.setId(id); if (entry.getProperty() == null)\r
- * entry.setProperty(new Hashtable());\r
- * entry.getProperty().put("chains", pdbchain.id + "=" + sq.getStart()\r
- * + "-" + sq.getEnd()); sq.getDatasetSequence().addPDBId(entry);\r
- */\r
- // Add PDB DB Refs\r
- // We make a DBRefEtntry because we have obtained the PDB file from a\r
- // verifiable source\r
- // JBPNote - PDB DBRefEntry should also carry the chain and mapping\r
- // information\r
- DBRefEntry dbentry = new DBRefEntry(getDbSource(),\r
- getDbVersion(), id + pdbchain.id);\r
- sq.addDBRef(dbentry);\r
- // and add seuqence to the retrieved set\r
- result.addElement(sq.deriveSequence());\r
- }\r
- }\r
-\r
- if (result.size() < 1)\r
- {\r
- throw new Exception("No PDB Records for " + id + " chain "\r
- + ((chain == null) ? "' '" : chain));\r
- }\r
- } catch (Exception ex) // Problem parsing PDB file\r
- {\r
- stopQuery();\r
- throw (ex);\r
- }\r
-\r
- SequenceI[] results = new SequenceI[result.size()];\r
- for (int i = 0, j = result.size(); i < j; i++)\r
- {\r
- results[i] = (SequenceI) result.elementAt(i);\r
- result.setElementAt(null, i);\r
- }\r
- return new Alignment(results);\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.ws.DbSourceProxy#isValidReference(java.lang.String)\r
- */\r
- public boolean isValidReference(String accession)\r
- {\r
- Regex r = getAccessionValidator();\r
- return r.search(accession.trim());\r
- }\r
-\r
- /**\r
- * obtain human glyoxalase chain A sequence\r
- */\r
- public String getTestQuery()\r
- {\r
- return "1QIPA";\r
- }\r
-\r
- public String getDbName()\r
- {\r
- return "PDB"; // getDbSource();\r
- }\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.ws.dbsources;
+
+import jalview.datamodel.Alignment;
+import jalview.datamodel.DBRefEntry;
+import jalview.datamodel.DBRefSource;
+import jalview.datamodel.SequenceI;
+
+import java.io.BufferedInputStream;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.Hashtable;
+import java.util.Vector;
+
+import MCview.PDBChain;
+import MCview.PDBfile;
+
+import com.stevesoft.pat.Regex;
+
+import jalview.datamodel.AlignmentI;
+import jalview.io.FileParse;
+import jalview.ws.ebi.EBIFetchClient;
+import jalview.ws.seqfetcher.DbSourceProxy;
+import jalview.ws.seqfetcher.DbSourceProxyImpl;
+
+/**
+ * @author JimP
+ *
+ */
+public class Pdb extends EbiFileRetrievedProxy implements DbSourceProxy
+{
+ public Pdb()
+ {
+ super();
+ addDbSourceProperty(DBRefSource.PROTSEQDB);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#getAccessionSeparator()
+ */
+ public String getAccessionSeparator()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#getAccessionValidator()
+ */
+ public Regex getAccessionValidator()
+ {
+ return new Regex("([1-9][0-9A-Za-z]{3}):?([ _A-Za-z0-9]?)");
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#getDbSource()
+ */
+ public String getDbSource()
+ {
+ return DBRefSource.PDB;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#getDbVersion()
+ */
+ public String getDbVersion()
+ {
+ return "0";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#getSequenceRecords(java.lang.String[])
+ */
+ public AlignmentI getSequenceRecords(String queries) throws Exception
+ {
+
+ Vector result = new Vector();
+ String chain = null;
+ String id = null;
+ if (queries.indexOf(":") > -1)
+ {
+ chain = queries.substring(queries.indexOf(":") + 1);
+ id = queries.substring(0, queries.indexOf(":"));
+ }
+ else
+ {
+ id = queries;
+ }
+ if (queries.length() > 4 && chain == null)
+ {
+ chain = queries.substring(4, 5);
+ id = queries.substring(0, 4);
+ }
+ if (!isValidReference(id))
+ {
+ System.err.println("Ignoring invalid pdb query: '" + id + "'");
+ stopQuery();
+ return null;
+ }
+ EBIFetchClient ebi = new EBIFetchClient();
+ file = ebi.fetchDataAsFile("pdb:" + id, "pdb", "raw").getAbsolutePath();
+ stopQuery();
+ if (file == null)
+ {
+ return null;
+ }
+ try
+ {
+
+ PDBfile pdbfile = new PDBfile(file,
+ jalview.io.AppletFormatAdapter.FILE);
+ for (int i = 0; i < pdbfile.chains.size(); i++)
+ {
+ if (chain == null
+ || ((PDBChain) pdbfile.chains.elementAt(i)).id
+ .toUpperCase().equals(chain))
+ {
+ PDBChain pdbchain = (PDBChain) pdbfile.chains.elementAt(i);
+ // Get the Chain's Sequence - who's dataset includes any special
+ // features added from the PDB file
+ SequenceI sq = pdbchain.sequence;
+ // Specially formatted name for the PDB chain sequences retrieved from
+ // the PDB
+ sq.setName(jalview.datamodel.DBRefSource.PDB + "|" + id + "|"
+ + sq.getName());
+ // Might need to add more metadata to the PDBEntry object
+ // like below
+ /*
+ * PDBEntry entry = new PDBEntry(); // Construct the PDBEntry
+ * entry.setId(id); if (entry.getProperty() == null)
+ * entry.setProperty(new Hashtable());
+ * entry.getProperty().put("chains", pdbchain.id + "=" + sq.getStart()
+ * + "-" + sq.getEnd()); sq.getDatasetSequence().addPDBId(entry);
+ */
+ // Add PDB DB Refs
+ // We make a DBRefEtntry because we have obtained the PDB file from a
+ // verifiable source
+ // JBPNote - PDB DBRefEntry should also carry the chain and mapping
+ // information
+ DBRefEntry dbentry = new DBRefEntry(getDbSource(),
+ getDbVersion(), id + pdbchain.id);
+ sq.addDBRef(dbentry);
+ // and add seuqence to the retrieved set
+ result.addElement(sq.deriveSequence());
+ }
+ }
+
+ if (result.size() < 1)
+ {
+ throw new Exception("No PDB Records for " + id + " chain "
+ + ((chain == null) ? "' '" : chain));
+ }
+ } catch (Exception ex) // Problem parsing PDB file
+ {
+ stopQuery();
+ throw (ex);
+ }
+
+ SequenceI[] results = new SequenceI[result.size()];
+ for (int i = 0, j = result.size(); i < j; i++)
+ {
+ results[i] = (SequenceI) result.elementAt(i);
+ result.setElementAt(null, i);
+ }
+ return new Alignment(results);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#isValidReference(java.lang.String)
+ */
+ public boolean isValidReference(String accession)
+ {
+ Regex r = getAccessionValidator();
+ return r.search(accession.trim());
+ }
+
+ /**
+ * obtain human glyoxalase chain A sequence
+ */
+ public String getTestQuery()
+ {
+ return "1QIPA";
+ }
+
+ public String getDbName()
+ {
+ return "PDB"; // getDbSource();
+ }
+
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.ws.dbsources;\r
-\r
-import java.util.Hashtable;\r
-\r
-import com.stevesoft.pat.Regex;\r
-\r
-import jalview.datamodel.AlignmentI;\r
-import jalview.datamodel.DBRefEntry;\r
-import jalview.io.AppletFormatAdapter;\r
-import jalview.io.FastaFile;\r
-import jalview.io.StockholmFile;\r
-import jalview.ws.seqfetcher.DbSourceProxy;\r
-import jalview.ws.seqfetcher.DbSourceProxyImpl;\r
-\r
-/**\r
- * TODO: later PFAM is a complex datasource - it could return a tree in addition\r
- * to an alignment TODO: create interface to pass alignment properties and tree\r
- * back to sequence fetcher\r
- * \r
- * @author JimP\r
- * \r
- */\r
-abstract public class Pfam extends Xfam implements DbSourceProxy\r
-{\r
-\r
- public Pfam()\r
- {\r
- super();\r
- // all extensions of this PFAM source base class are DOMAINDB sources\r
- addDbSourceProperty(jalview.datamodel.DBRefSource.DOMAINDB);\r
- addDbSourceProperty(jalview.datamodel.DBRefSource.ALIGNMENTDB);\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.ws.DbSourceProxy#getAccessionSeparator()\r
- */\r
- public String getAccessionSeparator()\r
- {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.ws.DbSourceProxy#getAccessionValidator()\r
- */\r
- public Regex getAccessionValidator()\r
- {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.ws.DbSourceProxy#getDbSource() public String getDbSource() { *\r
- * this doesn't work - DbSource is key for the hash of DbSourceProxy instances\r
- * - 1:many mapping for DbSource to proxy will be lost. * suggest : PFAM is an\r
- * 'alignment' source - means proxy is higher level than a sequence source.\r
- * return jalview.datamodel.DBRefSource.PFAM; }\r
- */\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.ws.DbSourceProxy#getDbSourceProperties() public Hashtable\r
- * getDbSourceProperties() {\r
- * \r
- * return null; }\r
- */\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.ws.DbSourceProxy#getDbVersion()\r
- */\r
- @Override\r
- public String getDbVersion()\r
- {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
- /**\r
- * Returns base URL for selected Pfam alignment type\r
- * \r
- * @return PFAM URL stub for this DbSource\r
- */\r
- @Override\r
- protected abstract String getXFAMURL();\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.ws.DbSourceProxy#getSequenceRecords(java.lang.String[])\r
- */\r
- public AlignmentI getSequenceRecords(String queries) throws Exception\r
- {\r
- // TODO: this is not a perfect implementation. We need to be able to add\r
- // individual references to each sequence in each family alignment that's\r
- // retrieved.\r
- startQuery();\r
- AlignmentI rcds = new jalview.io.FormatAdapter().readFile(getXFAMURL()\r
- + queries.trim().toUpperCase(), jalview.io.FormatAdapter.URL,\r
- "STH");\r
- for (int s = 0, sNum = rcds.getHeight(); s < sNum; s++)\r
- {\r
- rcds.getSequenceAt(s).addDBRef(\r
- new DBRefEntry(jalview.datamodel.DBRefSource.PFAM,\r
- // getDbSource(),\r
- getDbVersion(), queries.trim().toUpperCase()));\r
- if (!getDbSource().equals(jalview.datamodel.DBRefSource.PFAM))\r
- { // add the specific ref too\r
- rcds.getSequenceAt(s).addDBRef(\r
- new DBRefEntry(getDbSource(), getDbVersion(), queries\r
- .trim().toUpperCase()));\r
- }\r
- }\r
- stopQuery();\r
- return rcds;\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.ws.DbSourceProxy#isValidReference(java.lang.String)\r
- */\r
- public boolean isValidReference(String accession)\r
- {\r
- return accession.indexOf("PF") == 0;\r
- }\r
-\r
- /*\r
- * public String getDbName() { return "PFAM"; // getDbSource(); }\r
- */\r
-\r
- public String getXfamSource()\r
- {\r
- return jalview.datamodel.DBRefSource.PFAM;\r
- }\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.ws.dbsources;
+
+import java.util.Hashtable;
+
+import com.stevesoft.pat.Regex;
+
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.DBRefEntry;
+import jalview.io.AppletFormatAdapter;
+import jalview.io.FastaFile;
+import jalview.io.StockholmFile;
+import jalview.ws.seqfetcher.DbSourceProxy;
+import jalview.ws.seqfetcher.DbSourceProxyImpl;
+
+/**
+ * TODO: later PFAM is a complex datasource - it could return a tree in addition
+ * to an alignment TODO: create interface to pass alignment properties and tree
+ * back to sequence fetcher
+ *
+ * @author JimP
+ *
+ */
+abstract public class Pfam extends Xfam implements DbSourceProxy
+{
+
+ public Pfam()
+ {
+ super();
+ // all extensions of this PFAM source base class are DOMAINDB sources
+ addDbSourceProperty(jalview.datamodel.DBRefSource.DOMAINDB);
+ addDbSourceProperty(jalview.datamodel.DBRefSource.ALIGNMENTDB);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#getAccessionSeparator()
+ */
+ public String getAccessionSeparator()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#getAccessionValidator()
+ */
+ public Regex getAccessionValidator()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#getDbSource() public String getDbSource() { *
+ * this doesn't work - DbSource is key for the hash of DbSourceProxy instances
+ * - 1:many mapping for DbSource to proxy will be lost. * suggest : PFAM is an
+ * 'alignment' source - means proxy is higher level than a sequence source.
+ * return jalview.datamodel.DBRefSource.PFAM; }
+ */
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#getDbSourceProperties() public Hashtable
+ * getDbSourceProperties() {
+ *
+ * return null; }
+ */
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#getDbVersion()
+ */
+ @Override
+ public String getDbVersion()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /**
+ * Returns base URL for selected Pfam alignment type
+ *
+ * @return PFAM URL stub for this DbSource
+ */
+ @Override
+ protected abstract String getXFAMURL();
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#getSequenceRecords(java.lang.String[])
+ */
+ public AlignmentI getSequenceRecords(String queries) throws Exception
+ {
+ // TODO: this is not a perfect implementation. We need to be able to add
+ // individual references to each sequence in each family alignment that's
+ // retrieved.
+ startQuery();
+ AlignmentI rcds = new jalview.io.FormatAdapter().readFile(getXFAMURL()
+ + queries.trim().toUpperCase(), jalview.io.FormatAdapter.URL,
+ "STH");
+ for (int s = 0, sNum = rcds.getHeight(); s < sNum; s++)
+ {
+ rcds.getSequenceAt(s).addDBRef(
+ new DBRefEntry(jalview.datamodel.DBRefSource.PFAM,
+ // getDbSource(),
+ getDbVersion(), queries.trim().toUpperCase()));
+ if (!getDbSource().equals(jalview.datamodel.DBRefSource.PFAM))
+ { // add the specific ref too
+ rcds.getSequenceAt(s).addDBRef(
+ new DBRefEntry(getDbSource(), getDbVersion(), queries
+ .trim().toUpperCase()));
+ }
+ }
+ stopQuery();
+ return rcds;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#isValidReference(java.lang.String)
+ */
+ public boolean isValidReference(String accession)
+ {
+ return accession.indexOf("PF") == 0;
+ }
+
+ /*
+ * public String getDbName() { return "PFAM"; // getDbSource(); }
+ */
+
+ public String getXfamSource()
+ {
+ return jalview.datamodel.DBRefSource.PFAM;
+ }
+
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.ws.dbsources;\r
-\r
-import jalview.ws.seqfetcher.DbSourceProxy;\r
-\r
-/**\r
- * flyweight class specifying retrieval of Full family alignments from PFAM\r
- * \r
- */\r
-public class PfamFull extends Pfam implements DbSourceProxy\r
-{\r
- public PfamFull()\r
- {\r
- super();\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.ws.dbsources.Pfam#getPFAMURL()\r
- */\r
- protected String getXFAMURL()\r
- {\r
- return "http://pfam.sanger.ac.uk/family/alignment/download/format?alnType=full&format=stockholm&order=t&case=l&gaps=default&entry=";\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.ws.seqfetcher.DbSourceProxy#getDbName()\r
- */\r
- public String getDbName()\r
- {\r
- return "PFAM (Full)";\r
- }\r
-\r
- public String getDbSource()\r
- {\r
- return getDbName(); // so we have unique DbSource string.\r
- }\r
-\r
- public String getTestQuery()\r
- {\r
- return "PF03760";\r
- }\r
-\r
- public String getDbVersion()\r
- {\r
- return null;\r
- }\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.ws.dbsources;
+
+import jalview.ws.seqfetcher.DbSourceProxy;
+
+/**
+ * flyweight class specifying retrieval of Full family alignments from PFAM
+ *
+ */
+public class PfamFull extends Pfam implements DbSourceProxy
+{
+ public PfamFull()
+ {
+ super();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.dbsources.Pfam#getPFAMURL()
+ */
+ protected String getXFAMURL()
+ {
+ return "http://pfam.sanger.ac.uk/family/alignment/download/format?alnType=full&format=stockholm&order=t&case=l&gaps=default&entry=";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.seqfetcher.DbSourceProxy#getDbName()
+ */
+ public String getDbName()
+ {
+ return "PFAM (Full)";
+ }
+
+ public String getDbSource()
+ {
+ return getDbName(); // so we have unique DbSource string.
+ }
+
+ public String getTestQuery()
+ {
+ return "PF03760";
+ }
+
+ public String getDbVersion()
+ {
+ return null;
+ }
+
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.ws.dbsources;\r
-\r
-import jalview.ws.seqfetcher.DbSourceProxy;\r
-\r
-/**\r
- * flyweight class specifying retrieval of Seed alignments from PFAM\r
- * \r
- * @author JimP\r
- * \r
- */\r
-public class PfamSeed extends Pfam implements DbSourceProxy\r
-{\r
- public PfamSeed()\r
- {\r
- super();\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.ws.dbsources.Pfam#getPFAMURL()\r
- */\r
- protected String getXFAMURL()\r
- {\r
- return "http://pfam.sanger.ac.uk/family/alignment/download/format?alnType=seed&format=stockholm&order=t&case=l&gaps=default&entry=";\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.ws.seqfetcher.DbSourceProxy#getDbName()\r
- */\r
- public String getDbName()\r
- {\r
- return "PFAM (Seed)";\r
- }\r
-\r
- public String getDbSource()\r
- {\r
- return jalview.datamodel.DBRefSource.PFAM; // archetype source\r
- }\r
-\r
- public String getTestQuery()\r
- {\r
- return "PF03760";\r
- }\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.ws.dbsources;
+
+import jalview.ws.seqfetcher.DbSourceProxy;
+
+/**
+ * flyweight class specifying retrieval of Seed alignments from PFAM
+ *
+ * @author JimP
+ *
+ */
+public class PfamSeed extends Pfam implements DbSourceProxy
+{
+ public PfamSeed()
+ {
+ super();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.dbsources.Pfam#getPFAMURL()
+ */
+ protected String getXFAMURL()
+ {
+ return "http://pfam.sanger.ac.uk/family/alignment/download/format?alnType=seed&format=stockholm&order=t&case=l&gaps=default&entry=";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.seqfetcher.DbSourceProxy#getDbName()
+ */
+ public String getDbName()
+ {
+ return "PFAM (Seed)";
+ }
+
+ public String getDbSource()
+ {
+ return jalview.datamodel.DBRefSource.PFAM; // archetype source
+ }
+
+ public String getTestQuery()
+ {
+ return "PF03760";
+ }
+
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
*
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
-
package jalview.ws.dbsources;
import jalview.ws.seqfetcher.DbSourceProxy;
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.ws.dbsources;\r
-\r
-/**\r
- * Canonical Uniprot fetcher instance specifically retrieving UP_NAME\r
- * references.\r
- * \r
- * @author JimP\r
- * \r
- */\r
-public class UnprotName extends Uniprot implements\r
- jalview.ws.seqfetcher.DbSourceProxy\r
-{\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.ws.dbsources.Uniprot#getDbSource()\r
- */\r
- public String getDbSource()\r
- {\r
- return jalview.datamodel.DBRefSource.UP_NAME;\r
- }\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.ws.dbsources;
+
+/**
+ * Canonical Uniprot fetcher instance specifically retrieving UP_NAME
+ * references.
+ *
+ * @author JimP
+ *
+ */
+public class UnprotName extends Uniprot implements
+ jalview.ws.seqfetcher.DbSourceProxy
+{
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.dbsources.Uniprot#getDbSource()
+ */
+ public String getDbSource()
+ {
+ return jalview.datamodel.DBRefSource.UP_NAME;
+ }
+
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
return rcds;
}
-}
\ No newline at end of file
+}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
package jalview.ws.dbsources.das.api;
import java.util.Hashtable;
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
package jalview.ws.dbsources.das.api;
import java.util.List;
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.ws.dbsources.das.datamodel;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Arrays;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.StringTokenizer;\r
-import java.util.Vector;\r
-\r
-import org.biodas.jdas.client.ConnectionPropertyProviderI;\r
-import org.biodas.jdas.client.SequenceClient;\r
-import org.biodas.jdas.client.adapters.sequence.DasSequenceAdapter;\r
-import org.biodas.jdas.client.threads.MultipleConnectionPropertyProviderI;\r
-import org.biodas.jdas.client.threads.SequenceClientMultipleSources;\r
-import org.biodas.jdas.schema.sequence.SEQUENCE;\r
-import org.biodas.jdas.schema.sources.COORDINATES;\r
-import org.biodas.jdas.schema.sources.SOURCE;\r
-import org.biodas.jdas.schema.sources.VERSION;\r
-\r
-import com.stevesoft.pat.Regex;\r
-\r
-import jalview.ws.dbsources.das.api.jalviewSourceI;\r
-import jalview.ws.seqfetcher.*;\r
-import jalview.bin.Cache;\r
-import jalview.datamodel.Alignment;\r
-import jalview.datamodel.AlignmentI;\r
-import jalview.datamodel.DBRefEntry;\r
-import jalview.datamodel.Sequence;\r
-import jalview.datamodel.SequenceI;\r
-\r
-/**\r
- * an instance of this class is created for each unique DAS Sequence source (ie\r
- * one capable of handling the 'sequence' for a particular MapMaster)\r
- * \r
- * @author JimP\r
- * \r
- */\r
-public class DasSequenceSource extends DbSourceProxyImpl implements\r
- DbSourceProxy\r
-{\r
- private jalviewSourceI jsrc;\r
-\r
- protected SOURCE source = null;\r
-\r
- protected VERSION version = null;\r
-\r
- protected COORDINATES coordsys = null;\r
-\r
- protected String dbname = "DASCS";\r
-\r
- protected String dbrefname = "das:source";\r
-\r
- protected MultipleConnectionPropertyProviderI connprops = null;\r
-\r
- /**\r
- * create a new DbSource proxy for a DAS 1 source\r
- * \r
- * @param dbnbame\r
- * Human Readable Name to use when fetching from this source\r
- * @param dbrefname\r
- * DbRefName for DbRefs attached to sequences retrieved from this\r
- * source\r
- * @param source\r
- * Das1Source\r
- * @param coordsys\r
- * specific coordinate system to use for this source\r
- * @throws Exception\r
- * if source is not capable of the 'sequence' command\r
- */\r
- public DasSequenceSource(String dbname, String dbrefname, SOURCE source,\r
- VERSION version, COORDINATES coordsys,\r
- MultipleConnectionPropertyProviderI connprops) throws Exception\r
- {\r
- if (!(jsrc = new JalviewSource(source, connprops, false))\r
- .isSequenceSource())\r
- {\r
- throw new Exception("Source " + source.getTitle()\r
- + " does not support the sequence command.");\r
- }\r
- this.source = source;\r
- this.dbname = dbname;\r
- this.dbrefname = dbrefname.toUpperCase();\r
- if (coordsys != null)\r
- {\r
- this.coordsys = coordsys;\r
- }\r
- this.connprops = connprops;\r
- }\r
-\r
- public String getAccessionSeparator()\r
- {\r
- return "\t";\r
- }\r
-\r
- public Regex getAccessionValidator()\r
- {\r
- /** ? * */\r
- return Regex.perlCode("m/([^:]+)(:\\d+,\\d+)?/");\r
- }\r
-\r
- public String getDbName()\r
- {\r
- // TODO: map to\r
- return dbname + " (DAS)";\r
- }\r
-\r
- public String getDbSource()\r
- {\r
- return dbrefname;\r
- }\r
-\r
- public String getDbVersion()\r
- {\r
- return coordsys != null ? coordsys.getVersion() : "";\r
- }\r
-\r
- public AlignmentI getSequenceRecords(String queries) throws Exception\r
- {\r
- StringTokenizer st = new StringTokenizer(queries, "\t");\r
- List<String> toks = new ArrayList<String>(), src = new ArrayList<String>(), acIds = new ArrayList<String>();\r
- while (st.hasMoreTokens())\r
- {\r
- String t;\r
- toks.add(t = st.nextToken());\r
- acIds.add(t.replaceAll(":[0-9,]+", ""));\r
- }\r
- src.add(jsrc.getSourceURL());\r
- Map<String, Map<List<String>, DasSequenceAdapter>> resultset = new HashMap<String, Map<List<String>, DasSequenceAdapter>>();\r
- Map<String, Map<List<String>, Exception>> errors = new HashMap<String, Map<List<String>, Exception>>();\r
-\r
- // First try multiple sources\r
- boolean multiple = true, retry = false;\r
- do\r
- {\r
- if (!multiple)\r
- {\r
- retry = false;\r
- // slow, fetch one at a time.\r
- for (String sr : src)\r
- {\r
- System.err\r
- .println("Retrieving IDs individually from das source: "\r
- + sr);\r
- org.biodas.jdas.client.SequenceClient sq = new SequenceClient(\r
- connprops.getConnectionPropertyProviderFor(sr));\r
- for (String q : toks)\r
- {\r
- List<String> qset = Arrays.asList(new String[]\r
- { q });\r
- try\r
- {\r
- DasSequenceAdapter s = sq.fetchData(sr, qset);\r
- Map<List<String>, DasSequenceAdapter> dss = resultset.get(sr);\r
- if (dss == null)\r
- {\r
- resultset\r
- .put(sr,\r
- dss = new HashMap<List<String>, DasSequenceAdapter>());\r
- }\r
- dss.put(qset, s);\r
- } catch (Exception x)\r
- {\r
- Map<List<String>, Exception> ers = errors.get(sr);\r
- if (ers == null)\r
- {\r
- errors.put(sr, ers = new HashMap<List<String>, Exception>());\r
- }\r
- ers.put(qset, x);\r
- }\r
- }\r
- }\r
- }\r
- else\r
- {\r
- SequenceClientMultipleSources sclient;\r
- sclient = new SequenceClientMultipleSources();\r
- sclient.fetchData(src, toks, resultset, errors);\r
- sclient.shutDown();\r
- while (!sclient.isTerminated())\r
- {\r
- try\r
- {\r
- Thread.sleep(200);\r
-\r
- } catch (InterruptedException x)\r
- {\r
- }\r
- }\r
- if (resultset.isEmpty() && !errors.isEmpty())\r
- {\r
- retry = true;\r
- multiple = false;\r
- }\r
- }\r
- } while (retry);\r
-\r
- if (resultset.isEmpty())\r
- {\r
- System.err.println("Sequence Query to " + jsrc.getTitle() + " with '"\r
- + queries + "' returned no sequences.");\r
- return null;\r
- }\r
- else\r
- {\r
- Vector<SequenceI> seqs = null;\r
- for (Map.Entry<String, Map<List<String>, DasSequenceAdapter>> resset : resultset\r
- .entrySet())\r
- {\r
- for (Map.Entry<List<String>, DasSequenceAdapter> result : resset\r
- .getValue().entrySet())\r
- {\r
- DasSequenceAdapter dasseqresp = result.getValue();\r
- List<String> accessions = result.getKey();\r
- for (SEQUENCE e : dasseqresp.getSequence())\r
- {\r
- String lbl = e.getId();\r
-\r
- if (acIds.indexOf(lbl) == -1)\r
- {\r
- System.err\r
- .println("Warning - received sequence event for strange accession code ("\r
- + lbl + ")");\r
- }\r
- else\r
- {\r
- if (seqs == null)\r
- {\r
- if (e.getContent().length() == 0)\r
- {\r
- System.err\r
- .println("Empty sequence returned for accession code ("\r
- + lbl\r
- + ") from "\r
- + resset.getKey()\r
- + " (source is " + getDbName());\r
- continue;\r
- }\r
- }\r
- seqs = new java.util.Vector<SequenceI>();\r
- // JDAS returns a sequence complete with any newlines and spaces\r
- // in the XML\r
- Sequence sq = new Sequence(lbl, e.getContent().replaceAll(\r
- "\\s+", ""));\r
- sq.setStart(e.getStart().intValue());\r
- sq.addDBRef(new DBRefEntry(getDbSource(), getDbVersion()\r
- + ":" + e.getVersion(), lbl));\r
- seqs.addElement(sq);\r
- }\r
- }\r
- }\r
- }\r
-\r
- if (seqs == null || seqs.size() == 0)\r
- return null;\r
- SequenceI[] sqs = new SequenceI[seqs.size()];\r
- for (int i = 0, iSize = seqs.size(); i < iSize; i++)\r
- {\r
- sqs[i] = (SequenceI) seqs.elementAt(i);\r
- }\r
- Alignment al = new Alignment(sqs);\r
- if (jsrc.isFeatureSource())\r
- {\r
- java.util.Vector<jalviewSourceI> srcs = new java.util.Vector<jalviewSourceI>();\r
- srcs.addElement(jsrc);\r
- try\r
- {\r
- jalview.ws.DasSequenceFeatureFetcher dssf = new jalview.ws.DasSequenceFeatureFetcher(\r
- sqs, null, srcs, false, false, multiple);\r
- while (dssf.isRunning())\r
- {\r
- try\r
- {\r
- Thread.sleep(200);\r
- } catch (InterruptedException x)\r
- {\r
-\r
- }\r
- }\r
-\r
- } catch (Exception x)\r
- {\r
- Cache.log\r
- .error("Couldn't retrieve features for sequence from its source.",\r
- x);\r
- }\r
- }\r
-\r
- return al;\r
- }\r
- }\r
-\r
- public String getTestQuery()\r
- {\r
- return coordsys == null ? "" : coordsys.getTestRange();\r
- }\r
-\r
- public boolean isValidReference(String accession)\r
- {\r
- // TODO try to validate an accession against source\r
- // We don't really know how to do this without querying source\r
-\r
- return true;\r
- }\r
-\r
- /**\r
- * @return the source\r
- */\r
- public SOURCE getSource()\r
- {\r
- return source;\r
- }\r
-\r
- /**\r
- * @return the coordsys\r
- */\r
- public COORDINATES getCoordsys()\r
- {\r
- return coordsys;\r
- }\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.ws.dbsources.das.datamodel;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+import org.biodas.jdas.client.ConnectionPropertyProviderI;
+import org.biodas.jdas.client.SequenceClient;
+import org.biodas.jdas.client.adapters.sequence.DasSequenceAdapter;
+import org.biodas.jdas.client.threads.MultipleConnectionPropertyProviderI;
+import org.biodas.jdas.client.threads.SequenceClientMultipleSources;
+import org.biodas.jdas.schema.sequence.SEQUENCE;
+import org.biodas.jdas.schema.sources.COORDINATES;
+import org.biodas.jdas.schema.sources.SOURCE;
+import org.biodas.jdas.schema.sources.VERSION;
+
+import com.stevesoft.pat.Regex;
+
+import jalview.ws.dbsources.das.api.jalviewSourceI;
+import jalview.ws.seqfetcher.*;
+import jalview.bin.Cache;
+import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.DBRefEntry;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceI;
+
+/**
+ * an instance of this class is created for each unique DAS Sequence source (ie
+ * one capable of handling the 'sequence' for a particular MapMaster)
+ *
+ * @author JimP
+ *
+ */
+public class DasSequenceSource extends DbSourceProxyImpl implements
+ DbSourceProxy
+{
+ private jalviewSourceI jsrc;
+
+ protected SOURCE source = null;
+
+ protected VERSION version = null;
+
+ protected COORDINATES coordsys = null;
+
+ protected String dbname = "DASCS";
+
+ protected String dbrefname = "das:source";
+
+ protected MultipleConnectionPropertyProviderI connprops = null;
+
+ /**
+ * create a new DbSource proxy for a DAS 1 source
+ *
+ * @param dbnbame
+ * Human Readable Name to use when fetching from this source
+ * @param dbrefname
+ * DbRefName for DbRefs attached to sequences retrieved from this
+ * source
+ * @param source
+ * Das1Source
+ * @param coordsys
+ * specific coordinate system to use for this source
+ * @throws Exception
+ * if source is not capable of the 'sequence' command
+ */
+ public DasSequenceSource(String dbname, String dbrefname, SOURCE source,
+ VERSION version, COORDINATES coordsys,
+ MultipleConnectionPropertyProviderI connprops) throws Exception
+ {
+ if (!(jsrc = new JalviewSource(source, connprops, false))
+ .isSequenceSource())
+ {
+ throw new Exception("Source " + source.getTitle()
+ + " does not support the sequence command.");
+ }
+ this.source = source;
+ this.dbname = dbname;
+ this.dbrefname = dbrefname.toUpperCase();
+ if (coordsys != null)
+ {
+ this.coordsys = coordsys;
+ }
+ this.connprops = connprops;
+ }
+
+ public String getAccessionSeparator()
+ {
+ return "\t";
+ }
+
+ public Regex getAccessionValidator()
+ {
+ /** ? * */
+ return Regex.perlCode("m/([^:]+)(:\\d+,\\d+)?/");
+ }
+
+ public String getDbName()
+ {
+ // TODO: map to
+ return dbname + " (DAS)";
+ }
+
+ public String getDbSource()
+ {
+ return dbrefname;
+ }
+
+ public String getDbVersion()
+ {
+ return coordsys != null ? coordsys.getVersion() : "";
+ }
+
+ public AlignmentI getSequenceRecords(String queries) throws Exception
+ {
+ StringTokenizer st = new StringTokenizer(queries, "\t");
+ List<String> toks = new ArrayList<String>(), src = new ArrayList<String>(), acIds = new ArrayList<String>();
+ while (st.hasMoreTokens())
+ {
+ String t;
+ toks.add(t = st.nextToken());
+ acIds.add(t.replaceAll(":[0-9,]+", ""));
+ }
+ src.add(jsrc.getSourceURL());
+ Map<String, Map<List<String>, DasSequenceAdapter>> resultset = new HashMap<String, Map<List<String>, DasSequenceAdapter>>();
+ Map<String, Map<List<String>, Exception>> errors = new HashMap<String, Map<List<String>, Exception>>();
+
+ // First try multiple sources
+ boolean multiple = true, retry = false;
+ do
+ {
+ if (!multiple)
+ {
+ retry = false;
+ // slow, fetch one at a time.
+ for (String sr : src)
+ {
+ System.err
+ .println("Retrieving IDs individually from das source: "
+ + sr);
+ org.biodas.jdas.client.SequenceClient sq = new SequenceClient(
+ connprops.getConnectionPropertyProviderFor(sr));
+ for (String q : toks)
+ {
+ List<String> qset = Arrays.asList(new String[]
+ { q });
+ try
+ {
+ DasSequenceAdapter s = sq.fetchData(sr, qset);
+ Map<List<String>, DasSequenceAdapter> dss = resultset.get(sr);
+ if (dss == null)
+ {
+ resultset
+ .put(sr,
+ dss = new HashMap<List<String>, DasSequenceAdapter>());
+ }
+ dss.put(qset, s);
+ } catch (Exception x)
+ {
+ Map<List<String>, Exception> ers = errors.get(sr);
+ if (ers == null)
+ {
+ errors.put(sr, ers = new HashMap<List<String>, Exception>());
+ }
+ ers.put(qset, x);
+ }
+ }
+ }
+ }
+ else
+ {
+ SequenceClientMultipleSources sclient;
+ sclient = new SequenceClientMultipleSources();
+ sclient.fetchData(src, toks, resultset, errors);
+ sclient.shutDown();
+ while (!sclient.isTerminated())
+ {
+ try
+ {
+ Thread.sleep(200);
+
+ } catch (InterruptedException x)
+ {
+ }
+ }
+ if (resultset.isEmpty() && !errors.isEmpty())
+ {
+ retry = true;
+ multiple = false;
+ }
+ }
+ } while (retry);
+
+ if (resultset.isEmpty())
+ {
+ System.err.println("Sequence Query to " + jsrc.getTitle() + " with '"
+ + queries + "' returned no sequences.");
+ return null;
+ }
+ else
+ {
+ Vector<SequenceI> seqs = null;
+ for (Map.Entry<String, Map<List<String>, DasSequenceAdapter>> resset : resultset
+ .entrySet())
+ {
+ for (Map.Entry<List<String>, DasSequenceAdapter> result : resset
+ .getValue().entrySet())
+ {
+ DasSequenceAdapter dasseqresp = result.getValue();
+ List<String> accessions = result.getKey();
+ for (SEQUENCE e : dasseqresp.getSequence())
+ {
+ String lbl = e.getId();
+
+ if (acIds.indexOf(lbl) == -1)
+ {
+ System.err
+ .println("Warning - received sequence event for strange accession code ("
+ + lbl + ")");
+ }
+ else
+ {
+ if (seqs == null)
+ {
+ if (e.getContent().length() == 0)
+ {
+ System.err
+ .println("Empty sequence returned for accession code ("
+ + lbl
+ + ") from "
+ + resset.getKey()
+ + " (source is " + getDbName());
+ continue;
+ }
+ }
+ seqs = new java.util.Vector<SequenceI>();
+ // JDAS returns a sequence complete with any newlines and spaces
+ // in the XML
+ Sequence sq = new Sequence(lbl, e.getContent().replaceAll(
+ "\\s+", ""));
+ sq.setStart(e.getStart().intValue());
+ sq.addDBRef(new DBRefEntry(getDbSource(), getDbVersion()
+ + ":" + e.getVersion(), lbl));
+ seqs.addElement(sq);
+ }
+ }
+ }
+ }
+
+ if (seqs == null || seqs.size() == 0)
+ return null;
+ SequenceI[] sqs = new SequenceI[seqs.size()];
+ for (int i = 0, iSize = seqs.size(); i < iSize; i++)
+ {
+ sqs[i] = (SequenceI) seqs.elementAt(i);
+ }
+ Alignment al = new Alignment(sqs);
+ if (jsrc.isFeatureSource())
+ {
+ java.util.Vector<jalviewSourceI> srcs = new java.util.Vector<jalviewSourceI>();
+ srcs.addElement(jsrc);
+ try
+ {
+ jalview.ws.DasSequenceFeatureFetcher dssf = new jalview.ws.DasSequenceFeatureFetcher(
+ sqs, null, srcs, false, false, multiple);
+ while (dssf.isRunning())
+ {
+ try
+ {
+ Thread.sleep(200);
+ } catch (InterruptedException x)
+ {
+
+ }
+ }
+
+ } catch (Exception x)
+ {
+ Cache.log
+ .error("Couldn't retrieve features for sequence from its source.",
+ x);
+ }
+ }
+
+ return al;
+ }
+ }
+
+ public String getTestQuery()
+ {
+ return coordsys == null ? "" : coordsys.getTestRange();
+ }
+
+ public boolean isValidReference(String accession)
+ {
+ // TODO try to validate an accession against source
+ // We don't really know how to do this without querying source
+
+ return true;
+ }
+
+ /**
+ * @return the source
+ */
+ public SOURCE getSource()
+ {
+ return source;
+ }
+
+ /**
+ * @return the coordsys
+ */
+ public COORDINATES getCoordsys()
+ {
+ return coordsys;
+ }
+}
-/**
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
*
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
package jalview.ws.dbsources.das.datamodel;
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
package jalview.ws.dbsources.das.datamodel;
import java.text.ParseException;
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
package jalview.ws.ebi;\r
\r
import java.io.BufferedInputStream;\r
return null;\r
}\r
}\r
+
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ */
package jalview.ws.io.mime;
import java.net.ContentHandler;
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ */
package jalview.ws.io.mime;
import jalview.io.packed.DataProvider;
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ */
package jalview.ws.io.mime;
import jalview.io.packed.DataProvider.JvDataType;
}
return null;
}
-}
\ No newline at end of file
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
package jalview.ws.jws2;
import jalview.datamodel.AlignmentAnnotation;
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
package jalview.ws.jws2;
import jalview.api.AlignCalcWorkerI;
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ */
/**
*
*/
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
package jalview.ws.jws2;
import jalview.analysis.AlignSeq;
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-/**
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
*
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
package jalview.ws.jws2;
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
package jalview.ws.jws2.dm;
import java.util.ArrayList;
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
package jalview.ws.jws2.jabaws2;
import jalview.gui.AlignFrame;
{
return "java:" + serviceType;
}
-}
\ No newline at end of file
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
package jalview.ws.params;
import java.util.List;
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-/**
*
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
+
package jalview.ws.params;
/**
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ */
package jalview.ws.params.simple;
import java.net.URL;
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-/**
*
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
+
package jalview.ws.params.simple;
import jalview.ws.params.ParameterI;
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ */
package jalview.ws.params.simple;
import jalview.ws.params.OptionI;
Option opt = new Option(this);
return opt;
}
-}
\ No newline at end of file
+}
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ */
package jalview.ws.params.simple;
import jalview.ws.params.OptionI;
@Override
public abstract Parameter copy();
-}
\ No newline at end of file
+}
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ */
package jalview.ws.params.simple;
public class StringChoiceParameter extends Option
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ */
package jalview.ws.rest;
import jalview.datamodel.AlignmentI;
* @return al or a new alignment with appropriate attributes/order for input
*/
public AlignmentI prepareAlignment(AlignmentI al);
-}
\ No newline at end of file
+}
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ */
package jalview.ws.rest;
import jalview.bin.Cache;
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ */
package jalview.ws.rest;
import jalview.ws.params.ArgumentI;
curType == null ? "" : curType.toString(),
molType.toStringValues(), null);
}
-}
\ No newline at end of file
+}
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ */
package jalview.ws.rest;
/**
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-/**
*
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
package jalview.ws.rest;
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ */
package jalview.ws.rest;
import java.io.IOException;
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ */
package jalview.ws.rest;
import jalview.bin.Cache;
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ */
package jalview.ws.rest.params;
import jalview.datamodel.AlignmentI;
return lst;
}
-}
\ No newline at end of file
+}
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ */
package jalview.ws.rest.params;
import jalview.datamodel.AlignmentI;
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ */
package jalview.ws.rest.params;
import jalview.ws.params.OptionI;
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ */
package jalview.ws.rest.params;
import jalview.datamodel.AlignmentI;
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ */
package jalview.ws.rest.params;
import jalview.datamodel.AlignmentI;
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ */
package jalview.ws.rest.params;
import jalview.datamodel.AlignmentI;
return lst;
}
-}
\ No newline at end of file
+}
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
+ */
package jalview.ws.rest.params;
import jalview.datamodel.AlignmentI;
return getBaseOptions();
}
-}
\ No newline at end of file
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.ws.seqfetcher;\r
-\r
-import jalview.datamodel.AlignmentI;\r
-import jalview.datamodel.DBRefEntry;\r
-import jalview.datamodel.SequenceI;\r
-import jalview.util.DBRefUtils;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-import java.util.Enumeration;\r
-import java.util.HashSet;\r
-import java.util.Hashtable;\r
-import java.util.Iterator;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.Stack;\r
-import java.util.Vector;\r
-\r
-public class ASequenceFetcher\r
-{\r
-\r
- /**\r
- * set of databases we can retrieve entries from\r
- */\r
- protected Hashtable<String, Map<String, DbSourceProxy>> FETCHABLEDBS;\r
-\r
- public ASequenceFetcher()\r
- {\r
- super();\r
- }\r
-\r
- /**\r
- * get list of supported Databases\r
- * \r
- * @return database source string for each database - only the latest version\r
- * of a source db is bound to each source.\r
- */\r
- public String[] getSupportedDb()\r
- {\r
- if (FETCHABLEDBS == null)\r
- return null;\r
- String[] sf = new String[FETCHABLEDBS.size()];\r
- Enumeration e = FETCHABLEDBS.keys();\r
- int i = 0;\r
- while (e.hasMoreElements())\r
- {\r
- sf[i++] = (String) e.nextElement();\r
- }\r
- ;\r
- return sf;\r
- }\r
-\r
- public boolean isFetchable(String source)\r
- {\r
- Enumeration e = FETCHABLEDBS.keys();\r
- while (e.hasMoreElements())\r
- {\r
- String db = (String) e.nextElement();\r
- if (source.compareToIgnoreCase(db) == 0)\r
- return true;\r
- }\r
- jalview.bin.Cache.log.warn("isFetchable doesn't know about '" + source\r
- + "'");\r
- return false;\r
- }\r
-\r
- public SequenceI[] getSequences(jalview.datamodel.DBRefEntry[] refs)\r
- {\r
- SequenceI[] ret = null;\r
- Vector<SequenceI> rseqs = new Vector();\r
- Hashtable<String, List<String>> queries = new Hashtable();\r
- for (int r = 0; r < refs.length; r++)\r
- {\r
- if (!queries.containsKey(refs[r].getSource()))\r
- {\r
- queries.put(refs[r].getSource(), new ArrayList<String>());\r
- }\r
- List<String> qset = queries.get(refs[r].getSource());\r
- if (!qset.contains(refs[r].getAccessionId()))\r
- {\r
- qset.add(refs[r].getAccessionId());\r
- }\r
- }\r
- Enumeration<String> e = queries.keys();\r
- while (e.hasMoreElements())\r
- {\r
- List<String> query = null;\r
- String db = null;\r
- db = e.nextElement();\r
- query = queries.get(db);\r
- if (!isFetchable(db))\r
- {\r
- reportStdError(db, query, new Exception(\r
- "Don't know how to fetch from this database :" + db));\r
- continue;\r
- }\r
- Iterator<DbSourceProxy> fetchers = getSourceProxy(db).iterator();\r
- Stack<String> queriesLeft = new Stack<String>();\r
- // List<String> queriesFailed = new ArrayList<String>();\r
- queriesLeft.addAll(query);\r
- while (fetchers.hasNext())\r
- {\r
- List<String> queriesMade = new ArrayList<String>();\r
- HashSet queriesFound = new HashSet<String>();\r
- try\r
- {\r
- DbSourceProxy fetcher = fetchers.next();\r
- boolean doMultiple = fetcher.getAccessionSeparator() != null; // No\r
- // separator\r
- // - no\r
- // Multiple\r
- // Queries\r
- while (!queriesLeft.isEmpty())\r
- {\r
- StringBuffer qsb = new StringBuffer();\r
- do\r
- {\r
- if (qsb.length() > 0)\r
- {\r
- qsb.append(fetcher.getAccessionSeparator());\r
- }\r
- String q = queriesLeft.pop();\r
- queriesMade.add(q);\r
- qsb.append(q);\r
- } while (doMultiple && !queriesLeft.isEmpty());\r
-\r
- AlignmentI seqset = null;\r
- try\r
- {\r
- // create a fetcher and go to it\r
- seqset = fetcher.getSequenceRecords(qsb.toString()); // ,\r
- // queriesFailed);\r
- } catch (Exception ex)\r
- {\r
- System.err.println("Failed to retrieve the following from "\r
- + db);\r
- System.err.println(qsb);\r
- ex.printStackTrace(System.err);\r
- }\r
- // TODO: Merge alignment together - perhaps\r
- if (seqset != null)\r
- {\r
- SequenceI seqs[] = seqset.getSequencesArray();\r
- if (seqs != null)\r
- {\r
- for (int is = 0; is < seqs.length; is++)\r
- {\r
- rseqs.addElement(seqs[is]);\r
- DBRefEntry[] frefs = DBRefUtils.searchRefs(seqs[is]\r
- .getDBRef(), new DBRefEntry(db, null, null));\r
- if (frefs != null)\r
- {\r
- for (DBRefEntry dbr : frefs)\r
- {\r
- queriesFound.add(dbr.getAccessionId());\r
- queriesMade.remove(dbr.getAccessionId());\r
- }\r
- }\r
- seqs[is] = null;\r
- }\r
- }\r
- else\r
- {\r
- if (fetcher.getRawRecords() != null)\r
- {\r
- System.out.println("# Retrieved from " + db + ":"\r
- + qsb.toString());\r
- StringBuffer rrb = fetcher.getRawRecords();\r
- /*\r
- * for (int rr = 0; rr<rrb.length; rr++) {\r
- */\r
- String hdr;\r
- // if (rr<qs.length)\r
- // {\r
- hdr = "# " + db + ":" + qsb.toString();\r
- /*\r
- * } else { hdr = "# part "+rr; }\r
- */\r
- System.out.println(hdr);\r
- if (rrb != null)\r
- System.out.println(rrb);\r
- System.out.println("# end of " + hdr);\r
- }\r
-\r
- }\r
- }\r
-\r
- }\r
- } catch (Exception ex)\r
- {\r
- reportStdError(db, queriesMade, ex);\r
- }\r
- if (queriesMade.size() > 0)\r
- {\r
- System.out.println("# Adding " + queriesMade.size()\r
- + " ids back to queries list for searching again (" + db\r
- + ".");\r
- queriesLeft.addAll(queriesMade);\r
- }\r
- }\r
- }\r
- if (rseqs.size() > 0)\r
- {\r
- ret = new SequenceI[rseqs.size()];\r
- Enumeration sqs = rseqs.elements();\r
- int si = 0;\r
- while (sqs.hasMoreElements())\r
- {\r
- SequenceI s = (SequenceI) sqs.nextElement();\r
- ret[si++] = s;\r
- s.updatePDBIds();\r
- }\r
- }\r
- return ret;\r
- }\r
-\r
- public void reportStdError(String db, List<String> queriesMade,\r
- Exception ex)\r
- {\r
-\r
- System.err.println("Failed to retrieve the following references from "\r
- + db);\r
- int n = 0;\r
- for (String qv : queriesMade)\r
- {\r
- System.err.print(" " + qv + ";");\r
- if (n++ > 10)\r
- {\r
- System.err.println();\r
- n = 0;\r
- }\r
- }\r
- System.err.println();\r
- ex.printStackTrace();\r
- }\r
-\r
- /**\r
- * Retrieve an instance of the proxy for the given source\r
- * \r
- * @param db\r
- * database source string TODO: add version string/wildcard for\r
- * retrieval of specific DB source/version combinations.\r
- * @return an instance of DbSourceProxy for that db.\r
- */\r
- public List<DbSourceProxy> getSourceProxy(String db)\r
- {\r
- List<DbSourceProxy> dbs;\r
- Map<String, DbSourceProxy> dblist = FETCHABLEDBS.get(db);\r
- if (dblist == null)\r
- {\r
- return new ArrayList<DbSourceProxy>();\r
- }\r
- ;\r
- if (dblist.size() > 1)\r
- {\r
- DbSourceProxy[] l = dblist.values().toArray(new DbSourceProxy[0]);\r
- int i = 0;\r
- String[] nm = new String[l.length];\r
- for (DbSourceProxy s : l)\r
- {\r
- nm[i++] = s.getDbName().toLowerCase();\r
- }\r
- jalview.util.QuickSort.sort(nm, l);\r
- dbs = new ArrayList<DbSourceProxy>();\r
- for (i = l.length - 1; i >= 0; i--)\r
- {\r
- dbs.add(l[i]);\r
- }\r
- }\r
- else\r
- {\r
- dbs = new ArrayList<DbSourceProxy>(dblist.values());\r
- }\r
- return dbs;\r
- }\r
-\r
- /**\r
- * constructs and instance of the proxy and registers it as a valid\r
- * dbrefsource\r
- * \r
- * @param dbSourceProxy\r
- * reference for class implementing\r
- * jalview.ws.seqfetcher.DbSourceProxy\r
- * @throws java.lang.IllegalArgumentException\r
- * if class does not implement jalview.ws.seqfetcher.DbSourceProxy\r
- */\r
- protected void addDBRefSourceImpl(Class dbSourceProxy)\r
- throws java.lang.IllegalArgumentException\r
- {\r
- DbSourceProxy proxy = null;\r
- try\r
- {\r
- Object proxyObj = dbSourceProxy.getConstructor(null)\r
- .newInstance(null);\r
- if (!DbSourceProxy.class.isInstance(proxyObj))\r
- {\r
- throw new IllegalArgumentException(\r
- dbSourceProxy.toString()\r
- + " does not implement the jalview.ws.seqfetcher.DbSourceProxy");\r
- }\r
- proxy = (DbSourceProxy) proxyObj;\r
- } catch (IllegalArgumentException e)\r
- {\r
- throw e;\r
- } catch (Exception e)\r
- {\r
- // Serious problems if this happens.\r
- throw new Error("DBRefSource Implementation Exception", e);\r
- }\r
- addDbRefSourceImpl(proxy);\r
- }\r
-\r
- /**\r
- * add the properly initialised DbSourceProxy object 'proxy' to the list of\r
- * sequence fetchers\r
- * \r
- * @param proxy\r
- */\r
- protected void addDbRefSourceImpl(DbSourceProxy proxy)\r
- {\r
- if (proxy != null)\r
- {\r
- if (FETCHABLEDBS == null)\r
- {\r
- FETCHABLEDBS = new Hashtable<String, Map<String, DbSourceProxy>>();\r
- }\r
- Map<String, DbSourceProxy> slist = FETCHABLEDBS.get(proxy\r
- .getDbSource());\r
- if (slist == null)\r
- {\r
- FETCHABLEDBS.put(proxy.getDbSource(),\r
- slist = new Hashtable<String, DbSourceProxy>());\r
- }\r
- slist.put(proxy.getDbName(), proxy);\r
- }\r
- }\r
-\r
- /**\r
- * test if the database handler for dbName contains the given dbProperty when\r
- * a dbName resolves to a set of proxies - this method will return the result\r
- * of the test for the first instance. TODO implement additional method to\r
- * query all sources for a db to find one with a particular property\r
- * \r
- * @param dbName\r
- * @param dbProperty\r
- * @return true if proxy has the given property\r
- */\r
- public boolean hasDbSourceProperty(String dbName, String dbProperty)\r
- {\r
- // TODO: decide if invalidDbName exception is thrown here.\r
-\r
- List<DbSourceProxy> proxies = getSourceProxy(dbName);\r
- if (proxies != null)\r
- {\r
- for (DbSourceProxy proxy : proxies)\r
- {\r
- if (proxy.getDbSourceProperties() != null)\r
- {\r
- return proxy.getDbSourceProperties().containsKey(dbProperty);\r
- }\r
- }\r
- }\r
- return false;\r
- }\r
-\r
- /**\r
- * select sources which are implemented by instances of the given class\r
- * \r
- * @param class that implements DbSourceProxy\r
- * @return null or vector of source names for fetchers\r
- */\r
- public String[] getDbInstances(Class class1)\r
- {\r
- if (!jalview.ws.seqfetcher.DbSourceProxy.class.isAssignableFrom(class1))\r
- {\r
- throw new Error(\r
- "Implmentation Error - getDbInstances must be given a class that implements jalview.ws.seqfetcher.DbSourceProxy (was given '"\r
- + class1 + "')");\r
- }\r
- if (FETCHABLEDBS == null)\r
- {\r
- return null;\r
- }\r
- String[] sources = null;\r
- Vector src = new Vector();\r
- Enumeration dbs = FETCHABLEDBS.keys();\r
- while (dbs.hasMoreElements())\r
- {\r
- String dbn = (String) dbs.nextElement();\r
- for (DbSourceProxy dbp : FETCHABLEDBS.get(dbn).values())\r
- {\r
- if (class1.isAssignableFrom(dbp.getClass()))\r
- {\r
- src.addElement(dbn);\r
- }\r
- }\r
- }\r
- if (src.size() > 0)\r
- {\r
- src.copyInto(sources = new String[src.size()]);\r
- }\r
- return sources;\r
- }\r
-\r
- public DbSourceProxy[] getDbSourceProxyInstances(Class class1)\r
- {\r
- ArrayList<DbSourceProxy> prlist = new ArrayList<DbSourceProxy>();\r
- for (String fetchable : getSupportedDb())\r
- for (DbSourceProxy pr : getSourceProxy(fetchable))\r
- {\r
- if (class1.isInstance(pr))\r
- {\r
- prlist.add(pr);\r
- }\r
- }\r
- if (prlist.size() == 0)\r
- {\r
- return null;\r
- }\r
- return prlist.toArray(new DbSourceProxy[0]);\r
- }\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.ws.seqfetcher;
+
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.DBRefEntry;
+import jalview.datamodel.SequenceI;
+import jalview.util.DBRefUtils;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Stack;
+import java.util.Vector;
+
+public class ASequenceFetcher
+{
+
+ /**
+ * set of databases we can retrieve entries from
+ */
+ protected Hashtable<String, Map<String, DbSourceProxy>> FETCHABLEDBS;
+
+ public ASequenceFetcher()
+ {
+ super();
+ }
+
+ /**
+ * get list of supported Databases
+ *
+ * @return database source string for each database - only the latest version
+ * of a source db is bound to each source.
+ */
+ public String[] getSupportedDb()
+ {
+ if (FETCHABLEDBS == null)
+ return null;
+ String[] sf = new String[FETCHABLEDBS.size()];
+ Enumeration e = FETCHABLEDBS.keys();
+ int i = 0;
+ while (e.hasMoreElements())
+ {
+ sf[i++] = (String) e.nextElement();
+ }
+ ;
+ return sf;
+ }
+
+ public boolean isFetchable(String source)
+ {
+ Enumeration e = FETCHABLEDBS.keys();
+ while (e.hasMoreElements())
+ {
+ String db = (String) e.nextElement();
+ if (source.compareToIgnoreCase(db) == 0)
+ return true;
+ }
+ jalview.bin.Cache.log.warn("isFetchable doesn't know about '" + source
+ + "'");
+ return false;
+ }
+
+ public SequenceI[] getSequences(jalview.datamodel.DBRefEntry[] refs)
+ {
+ SequenceI[] ret = null;
+ Vector<SequenceI> rseqs = new Vector();
+ Hashtable<String, List<String>> queries = new Hashtable();
+ for (int r = 0; r < refs.length; r++)
+ {
+ if (!queries.containsKey(refs[r].getSource()))
+ {
+ queries.put(refs[r].getSource(), new ArrayList<String>());
+ }
+ List<String> qset = queries.get(refs[r].getSource());
+ if (!qset.contains(refs[r].getAccessionId()))
+ {
+ qset.add(refs[r].getAccessionId());
+ }
+ }
+ Enumeration<String> e = queries.keys();
+ while (e.hasMoreElements())
+ {
+ List<String> query = null;
+ String db = null;
+ db = e.nextElement();
+ query = queries.get(db);
+ if (!isFetchable(db))
+ {
+ reportStdError(db, query, new Exception(
+ "Don't know how to fetch from this database :" + db));
+ continue;
+ }
+ Iterator<DbSourceProxy> fetchers = getSourceProxy(db).iterator();
+ Stack<String> queriesLeft = new Stack<String>();
+ // List<String> queriesFailed = new ArrayList<String>();
+ queriesLeft.addAll(query);
+ while (fetchers.hasNext())
+ {
+ List<String> queriesMade = new ArrayList<String>();
+ HashSet queriesFound = new HashSet<String>();
+ try
+ {
+ DbSourceProxy fetcher = fetchers.next();
+ boolean doMultiple = fetcher.getAccessionSeparator() != null; // No
+ // separator
+ // - no
+ // Multiple
+ // Queries
+ while (!queriesLeft.isEmpty())
+ {
+ StringBuffer qsb = new StringBuffer();
+ do
+ {
+ if (qsb.length() > 0)
+ {
+ qsb.append(fetcher.getAccessionSeparator());
+ }
+ String q = queriesLeft.pop();
+ queriesMade.add(q);
+ qsb.append(q);
+ } while (doMultiple && !queriesLeft.isEmpty());
+
+ AlignmentI seqset = null;
+ try
+ {
+ // create a fetcher and go to it
+ seqset = fetcher.getSequenceRecords(qsb.toString()); // ,
+ // queriesFailed);
+ } catch (Exception ex)
+ {
+ System.err.println("Failed to retrieve the following from "
+ + db);
+ System.err.println(qsb);
+ ex.printStackTrace(System.err);
+ }
+ // TODO: Merge alignment together - perhaps
+ if (seqset != null)
+ {
+ SequenceI seqs[] = seqset.getSequencesArray();
+ if (seqs != null)
+ {
+ for (int is = 0; is < seqs.length; is++)
+ {
+ rseqs.addElement(seqs[is]);
+ DBRefEntry[] frefs = DBRefUtils.searchRefs(seqs[is]
+ .getDBRef(), new DBRefEntry(db, null, null));
+ if (frefs != null)
+ {
+ for (DBRefEntry dbr : frefs)
+ {
+ queriesFound.add(dbr.getAccessionId());
+ queriesMade.remove(dbr.getAccessionId());
+ }
+ }
+ seqs[is] = null;
+ }
+ }
+ else
+ {
+ if (fetcher.getRawRecords() != null)
+ {
+ System.out.println("# Retrieved from " + db + ":"
+ + qsb.toString());
+ StringBuffer rrb = fetcher.getRawRecords();
+ /*
+ * for (int rr = 0; rr<rrb.length; rr++) {
+ */
+ String hdr;
+ // if (rr<qs.length)
+ // {
+ hdr = "# " + db + ":" + qsb.toString();
+ /*
+ * } else { hdr = "# part "+rr; }
+ */
+ System.out.println(hdr);
+ if (rrb != null)
+ System.out.println(rrb);
+ System.out.println("# end of " + hdr);
+ }
+
+ }
+ }
+
+ }
+ } catch (Exception ex)
+ {
+ reportStdError(db, queriesMade, ex);
+ }
+ if (queriesMade.size() > 0)
+ {
+ System.out.println("# Adding " + queriesMade.size()
+ + " ids back to queries list for searching again (" + db
+ + ".");
+ queriesLeft.addAll(queriesMade);
+ }
+ }
+ }
+ if (rseqs.size() > 0)
+ {
+ ret = new SequenceI[rseqs.size()];
+ Enumeration sqs = rseqs.elements();
+ int si = 0;
+ while (sqs.hasMoreElements())
+ {
+ SequenceI s = (SequenceI) sqs.nextElement();
+ ret[si++] = s;
+ s.updatePDBIds();
+ }
+ }
+ return ret;
+ }
+
+ public void reportStdError(String db, List<String> queriesMade,
+ Exception ex)
+ {
+
+ System.err.println("Failed to retrieve the following references from "
+ + db);
+ int n = 0;
+ for (String qv : queriesMade)
+ {
+ System.err.print(" " + qv + ";");
+ if (n++ > 10)
+ {
+ System.err.println();
+ n = 0;
+ }
+ }
+ System.err.println();
+ ex.printStackTrace();
+ }
+
+ /**
+ * Retrieve an instance of the proxy for the given source
+ *
+ * @param db
+ * database source string TODO: add version string/wildcard for
+ * retrieval of specific DB source/version combinations.
+ * @return an instance of DbSourceProxy for that db.
+ */
+ public List<DbSourceProxy> getSourceProxy(String db)
+ {
+ List<DbSourceProxy> dbs;
+ Map<String, DbSourceProxy> dblist = FETCHABLEDBS.get(db);
+ if (dblist == null)
+ {
+ return new ArrayList<DbSourceProxy>();
+ }
+ ;
+ if (dblist.size() > 1)
+ {
+ DbSourceProxy[] l = dblist.values().toArray(new DbSourceProxy[0]);
+ int i = 0;
+ String[] nm = new String[l.length];
+ for (DbSourceProxy s : l)
+ {
+ nm[i++] = s.getDbName().toLowerCase();
+ }
+ jalview.util.QuickSort.sort(nm, l);
+ dbs = new ArrayList<DbSourceProxy>();
+ for (i = l.length - 1; i >= 0; i--)
+ {
+ dbs.add(l[i]);
+ }
+ }
+ else
+ {
+ dbs = new ArrayList<DbSourceProxy>(dblist.values());
+ }
+ return dbs;
+ }
+
+ /**
+ * constructs and instance of the proxy and registers it as a valid
+ * dbrefsource
+ *
+ * @param dbSourceProxy
+ * reference for class implementing
+ * jalview.ws.seqfetcher.DbSourceProxy
+ * @throws java.lang.IllegalArgumentException
+ * if class does not implement jalview.ws.seqfetcher.DbSourceProxy
+ */
+ protected void addDBRefSourceImpl(Class dbSourceProxy)
+ throws java.lang.IllegalArgumentException
+ {
+ DbSourceProxy proxy = null;
+ try
+ {
+ Object proxyObj = dbSourceProxy.getConstructor(null)
+ .newInstance(null);
+ if (!DbSourceProxy.class.isInstance(proxyObj))
+ {
+ throw new IllegalArgumentException(
+ dbSourceProxy.toString()
+ + " does not implement the jalview.ws.seqfetcher.DbSourceProxy");
+ }
+ proxy = (DbSourceProxy) proxyObj;
+ } catch (IllegalArgumentException e)
+ {
+ throw e;
+ } catch (Exception e)
+ {
+ // Serious problems if this happens.
+ throw new Error("DBRefSource Implementation Exception", e);
+ }
+ addDbRefSourceImpl(proxy);
+ }
+
+ /**
+ * add the properly initialised DbSourceProxy object 'proxy' to the list of
+ * sequence fetchers
+ *
+ * @param proxy
+ */
+ protected void addDbRefSourceImpl(DbSourceProxy proxy)
+ {
+ if (proxy != null)
+ {
+ if (FETCHABLEDBS == null)
+ {
+ FETCHABLEDBS = new Hashtable<String, Map<String, DbSourceProxy>>();
+ }
+ Map<String, DbSourceProxy> slist = FETCHABLEDBS.get(proxy
+ .getDbSource());
+ if (slist == null)
+ {
+ FETCHABLEDBS.put(proxy.getDbSource(),
+ slist = new Hashtable<String, DbSourceProxy>());
+ }
+ slist.put(proxy.getDbName(), proxy);
+ }
+ }
+
+ /**
+ * test if the database handler for dbName contains the given dbProperty when
+ * a dbName resolves to a set of proxies - this method will return the result
+ * of the test for the first instance. TODO implement additional method to
+ * query all sources for a db to find one with a particular property
+ *
+ * @param dbName
+ * @param dbProperty
+ * @return true if proxy has the given property
+ */
+ public boolean hasDbSourceProperty(String dbName, String dbProperty)
+ {
+ // TODO: decide if invalidDbName exception is thrown here.
+
+ List<DbSourceProxy> proxies = getSourceProxy(dbName);
+ if (proxies != null)
+ {
+ for (DbSourceProxy proxy : proxies)
+ {
+ if (proxy.getDbSourceProperties() != null)
+ {
+ return proxy.getDbSourceProperties().containsKey(dbProperty);
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * select sources which are implemented by instances of the given class
+ *
+ * @param class that implements DbSourceProxy
+ * @return null or vector of source names for fetchers
+ */
+ public String[] getDbInstances(Class class1)
+ {
+ if (!jalview.ws.seqfetcher.DbSourceProxy.class.isAssignableFrom(class1))
+ {
+ throw new Error(
+ "Implmentation Error - getDbInstances must be given a class that implements jalview.ws.seqfetcher.DbSourceProxy (was given '"
+ + class1 + "')");
+ }
+ if (FETCHABLEDBS == null)
+ {
+ return null;
+ }
+ String[] sources = null;
+ Vector src = new Vector();
+ Enumeration dbs = FETCHABLEDBS.keys();
+ while (dbs.hasMoreElements())
+ {
+ String dbn = (String) dbs.nextElement();
+ for (DbSourceProxy dbp : FETCHABLEDBS.get(dbn).values())
+ {
+ if (class1.isAssignableFrom(dbp.getClass()))
+ {
+ src.addElement(dbn);
+ }
+ }
+ }
+ if (src.size() > 0)
+ {
+ src.copyInto(sources = new String[src.size()]);
+ }
+ return sources;
+ }
+
+ public DbSourceProxy[] getDbSourceProxyInstances(Class class1)
+ {
+ ArrayList<DbSourceProxy> prlist = new ArrayList<DbSourceProxy>();
+ for (String fetchable : getSupportedDb())
+ for (DbSourceProxy pr : getSourceProxy(fetchable))
+ {
+ if (class1.isInstance(pr))
+ {
+ prlist.add(pr);
+ }
+ }
+ if (prlist.size() == 0)
+ {
+ return null;
+ }
+ return prlist.toArray(new DbSourceProxy[0]);
+ }
+
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.ws.seqfetcher;\r
-\r
-import jalview.datamodel.AlignmentI;\r
-\r
-import java.util.Hashtable;\r
-\r
-import com.stevesoft.pat.Regex;\r
-\r
-/**\r
- * generic Reference Retrieval interface for a particular database\r
- * source/version as cited in DBRefEntry. TODO: add/define property to describe\r
- * max number of queries that this source can cope with at once. TODO:\r
- * add/define mechanism for retrieval of Trees and distance matrices from a\r
- * database (unify with io)\r
- * \r
- * @author JimP TODO: promote to API\r
- */\r
-public interface DbSourceProxy\r
-{\r
- /**\r
- * \r
- * @return source string constant used for this DB source\r
- */\r
- public String getDbSource();\r
-\r
- /**\r
- * Short meaningful name for this data source for display in menus or\r
- * selection boxes.\r
- * \r
- * @return String\r
- */\r
- public String getDbName();\r
-\r
- /**\r
- * \r
- * @return version string for this database.\r
- */\r
- public String getDbVersion();\r
-\r
- /**\r
- * Separator between individual accession queries for a database that allows\r
- * multiple IDs to be fetched in a single query. Null implies that only a\r
- * single ID can be fetched at a time.\r
- * \r
- * @return string for separating concatenated queries (as individually\r
- * validated by the accession validator)\r
- */\r
- public String getAccessionSeparator();\r
-\r
- /**\r
- * Regular expression for checking form of query string understood by this\r
- * source. If the Regex includes parenthesis, then the first parenthesis\r
- * should yield the same accession string as the one used to annotate the\r
- * sequence. This is used to match query strings to returned sequences.\r
- * \r
- * @return null or a validation regex\r
- */\r
- public Regex getAccessionValidator();\r
-\r
- /**\r
- * DbSource properties hash - define the capabilities of this source Property\r
- * hash methods defined in DbSourceProxyImpl. See constants in\r
- * jalview.datamodel.DBRefSource for definition of properties.\r
- * \r
- * @return\r
- */\r
- public Hashtable getDbSourceProperties();\r
-\r
- /**\r
- * \r
- * @return a test/example query that can be used to validate retrieval and\r
- * parsing mechanisms\r
- */\r
- public String getTestQuery();\r
-\r
- /**\r
- * optionally implemented\r
- * \r
- * @param accession\r
- * @return\r
- */\r
- public boolean isValidReference(String accession);\r
-\r
- /**\r
- * make one or more queries to the database and attempt to parse the response\r
- * into an alignment\r
- * \r
- * @param queries\r
- * - one or more queries for database in expected form\r
- * @return null if queries were successful but result was not parsable\r
- * @throws Exception\r
- * - propagated from underlying transport to database (note -\r
- * exceptions are not raised if query not found in database)\r
- * \r
- */\r
- public AlignmentI getSequenceRecords(String queries) throws Exception;\r
-\r
- /**\r
- * \r
- * @return true if a query is currently being made\r
- */\r
- public boolean queryInProgress();\r
-\r
- /**\r
- * get the raw reponse from the last set of queries\r
- * \r
- * @return one or more string buffers for each individual query\r
- */\r
- public StringBuffer getRawRecords();\r
-\r
- /**\r
- * Find out more info about the source.\r
- * \r
- * @param dbsourceproperty\r
- * - one of the database reference source properties in\r
- * jalview.datamodel.DBRefSource\r
- * @return true if the source has this property\r
- */\r
- public boolean isA(Object dbsourceproperty);\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.ws.seqfetcher;
+
+import jalview.datamodel.AlignmentI;
+
+import java.util.Hashtable;
+
+import com.stevesoft.pat.Regex;
+
+/**
+ * generic Reference Retrieval interface for a particular database
+ * source/version as cited in DBRefEntry. TODO: add/define property to describe
+ * max number of queries that this source can cope with at once. TODO:
+ * add/define mechanism for retrieval of Trees and distance matrices from a
+ * database (unify with io)
+ *
+ * @author JimP TODO: promote to API
+ */
+public interface DbSourceProxy
+{
+ /**
+ *
+ * @return source string constant used for this DB source
+ */
+ public String getDbSource();
+
+ /**
+ * Short meaningful name for this data source for display in menus or
+ * selection boxes.
+ *
+ * @return String
+ */
+ public String getDbName();
+
+ /**
+ *
+ * @return version string for this database.
+ */
+ public String getDbVersion();
+
+ /**
+ * Separator between individual accession queries for a database that allows
+ * multiple IDs to be fetched in a single query. Null implies that only a
+ * single ID can be fetched at a time.
+ *
+ * @return string for separating concatenated queries (as individually
+ * validated by the accession validator)
+ */
+ public String getAccessionSeparator();
+
+ /**
+ * Regular expression for checking form of query string understood by this
+ * source. If the Regex includes parenthesis, then the first parenthesis
+ * should yield the same accession string as the one used to annotate the
+ * sequence. This is used to match query strings to returned sequences.
+ *
+ * @return null or a validation regex
+ */
+ public Regex getAccessionValidator();
+
+ /**
+ * DbSource properties hash - define the capabilities of this source Property
+ * hash methods defined in DbSourceProxyImpl. See constants in
+ * jalview.datamodel.DBRefSource for definition of properties.
+ *
+ * @return
+ */
+ public Hashtable getDbSourceProperties();
+
+ /**
+ *
+ * @return a test/example query that can be used to validate retrieval and
+ * parsing mechanisms
+ */
+ public String getTestQuery();
+
+ /**
+ * optionally implemented
+ *
+ * @param accession
+ * @return
+ */
+ public boolean isValidReference(String accession);
+
+ /**
+ * make one or more queries to the database and attempt to parse the response
+ * into an alignment
+ *
+ * @param queries
+ * - one or more queries for database in expected form
+ * @return null if queries were successful but result was not parsable
+ * @throws Exception
+ * - propagated from underlying transport to database (note -
+ * exceptions are not raised if query not found in database)
+ *
+ */
+ public AlignmentI getSequenceRecords(String queries) throws Exception;
+
+ /**
+ *
+ * @return true if a query is currently being made
+ */
+ public boolean queryInProgress();
+
+ /**
+ * get the raw reponse from the last set of queries
+ *
+ * @return one or more string buffers for each individual query
+ */
+ public StringBuffer getRawRecords();
+
+ /**
+ * Find out more info about the source.
+ *
+ * @param dbsourceproperty
+ * - one of the database reference source properties in
+ * jalview.datamodel.DBRefSource
+ * @return true if the source has this property
+ */
+ public boolean isA(Object dbsourceproperty);
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.ws.seqfetcher;\r
-\r
-import jalview.datamodel.Alignment;\r
-import jalview.datamodel.DBRefSource;\r
-import jalview.io.FormatAdapter;\r
-import jalview.io.IdentifyFile;\r
-\r
-import java.util.Hashtable;\r
-\r
-/**\r
- * common methods for implementations of the DbSourceProxy interface.\r
- * \r
- * @author JimP\r
- * \r
- */\r
-public abstract class DbSourceProxyImpl implements DbSourceProxy\r
-{\r
- public DbSourceProxyImpl()\r
- {\r
- // default constructor - do nothing probably.\r
- }\r
-\r
- private Hashtable props = null;\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.ws.DbSourceProxy#getDbSourceProperties()\r
- */\r
- public Hashtable getDbSourceProperties()\r
- {\r
- if (props == null)\r
- {\r
- props = new Hashtable();\r
- }\r
- return props;\r
- }\r
-\r
- protected void addDbSourceProperty(Object propname)\r
- {\r
- addDbSourceProperty(propname, propname);\r
- }\r
-\r
- protected void addDbSourceProperty(Object propname, Object propvalue)\r
- {\r
- if (props == null)\r
- {\r
- props = new Hashtable();\r
- }\r
- props.put(propname, propvalue);\r
- }\r
-\r
- boolean queryInProgress = false;\r
-\r
- protected StringBuffer results = null;\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.ws.DbSourceProxy#getRawRecords()\r
- */\r
- public StringBuffer getRawRecords()\r
- {\r
- return results;\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.ws.DbSourceProxy#queryInProgress()\r
- */\r
- public boolean queryInProgress()\r
- {\r
- return queryInProgress;\r
- }\r
-\r
- /**\r
- * call to set the queryInProgress flag\r
- * \r
- */\r
- protected void startQuery()\r
- {\r
- queryInProgress = true;\r
- }\r
-\r
- /**\r
- * call to clear the queryInProgress flag\r
- * \r
- */\r
- protected void stopQuery()\r
- {\r
- queryInProgress = false;\r
- }\r
-\r
- /**\r
- * create an alignment from raw text file...\r
- * \r
- * @param result\r
- * @return null or a valid alignment\r
- * @throws Exception\r
- */\r
- protected Alignment parseResult(String result) throws Exception\r
- {\r
- Alignment sequences = null;\r
- String format = new IdentifyFile().Identify(result, "Paste");\r
- if (FormatAdapter.isValidFormat(format))\r
- {\r
- sequences = new FormatAdapter().readFile(result.toString(), "Paste",\r
- format);\r
- }\r
- return sequences;\r
- }\r
-\r
- @Override\r
- public boolean isA(Object dbsourceproperty)\r
- {\r
- assert (dbsourceproperty != null);\r
- return (props == null) ? false : props.containsKey(dbsourceproperty);\r
- }\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.ws.seqfetcher;
+
+import jalview.datamodel.Alignment;
+import jalview.datamodel.DBRefSource;
+import jalview.io.FormatAdapter;
+import jalview.io.IdentifyFile;
+
+import java.util.Hashtable;
+
+/**
+ * common methods for implementations of the DbSourceProxy interface.
+ *
+ * @author JimP
+ *
+ */
+public abstract class DbSourceProxyImpl implements DbSourceProxy
+{
+ public DbSourceProxyImpl()
+ {
+ // default constructor - do nothing probably.
+ }
+
+ private Hashtable props = null;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#getDbSourceProperties()
+ */
+ public Hashtable getDbSourceProperties()
+ {
+ if (props == null)
+ {
+ props = new Hashtable();
+ }
+ return props;
+ }
+
+ protected void addDbSourceProperty(Object propname)
+ {
+ addDbSourceProperty(propname, propname);
+ }
+
+ protected void addDbSourceProperty(Object propname, Object propvalue)
+ {
+ if (props == null)
+ {
+ props = new Hashtable();
+ }
+ props.put(propname, propvalue);
+ }
+
+ boolean queryInProgress = false;
+
+ protected StringBuffer results = null;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#getRawRecords()
+ */
+ public StringBuffer getRawRecords()
+ {
+ return results;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#queryInProgress()
+ */
+ public boolean queryInProgress()
+ {
+ return queryInProgress;
+ }
+
+ /**
+ * call to set the queryInProgress flag
+ *
+ */
+ protected void startQuery()
+ {
+ queryInProgress = true;
+ }
+
+ /**
+ * call to clear the queryInProgress flag
+ *
+ */
+ protected void stopQuery()
+ {
+ queryInProgress = false;
+ }
+
+ /**
+ * create an alignment from raw text file...
+ *
+ * @param result
+ * @return null or a valid alignment
+ * @throws Exception
+ */
+ protected Alignment parseResult(String result) throws Exception
+ {
+ Alignment sequences = null;
+ String format = new IdentifyFile().Identify(result, "Paste");
+ if (FormatAdapter.isValidFormat(format))
+ {
+ sequences = new FormatAdapter().readFile(result.toString(), "Paste",
+ format);
+ }
+ return sequences;
+ }
+
+ @Override
+ public boolean isA(Object dbsourceproperty)
+ {
+ assert (dbsourceproperty != null);
+ return (props == null) ? false : props.containsKey(dbsourceproperty);
+ }
+
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package uk.ac.ebi.picr.model;\r
-\r
-public class CrossReference implements java.io.Serializable\r
-{\r
- private java.lang.String accession;\r
-\r
- private java.lang.String accessionVersion;\r
-\r
- private java.lang.String databaseDescription;\r
-\r
- private java.lang.String databaseName;\r
-\r
- private java.util.Calendar dateAdded;\r
-\r
- private java.util.Calendar dateDeleted;\r
-\r
- private boolean deleted;\r
-\r
- private java.lang.String gi;\r
-\r
- private java.lang.String taxonId;\r
-\r
- public CrossReference()\r
- {\r
- }\r
-\r
- public CrossReference(java.lang.String accession,\r
- java.lang.String accessionVersion,\r
- java.lang.String databaseDescription,\r
- java.lang.String databaseName, java.util.Calendar dateAdded,\r
- java.util.Calendar dateDeleted, boolean deleted,\r
- java.lang.String gi, java.lang.String taxonId)\r
- {\r
- this.accession = accession;\r
- this.accessionVersion = accessionVersion;\r
- this.databaseDescription = databaseDescription;\r
- this.databaseName = databaseName;\r
- this.dateAdded = dateAdded;\r
- this.dateDeleted = dateDeleted;\r
- this.deleted = deleted;\r
- this.gi = gi;\r
- this.taxonId = taxonId;\r
- }\r
-\r
- /**\r
- * Gets the accession value for this CrossReference.\r
- * \r
- * @return accession\r
- */\r
- public java.lang.String getAccession()\r
- {\r
- return accession;\r
- }\r
-\r
- /**\r
- * Sets the accession value for this CrossReference.\r
- * \r
- * @param accession\r
- */\r
- public void setAccession(java.lang.String accession)\r
- {\r
- this.accession = accession;\r
- }\r
-\r
- /**\r
- * Gets the accessionVersion value for this CrossReference.\r
- * \r
- * @return accessionVersion\r
- */\r
- public java.lang.String getAccessionVersion()\r
- {\r
- return accessionVersion;\r
- }\r
-\r
- /**\r
- * Sets the accessionVersion value for this CrossReference.\r
- * \r
- * @param accessionVersion\r
- */\r
- public void setAccessionVersion(java.lang.String accessionVersion)\r
- {\r
- this.accessionVersion = accessionVersion;\r
- }\r
-\r
- /**\r
- * Gets the databaseDescription value for this CrossReference.\r
- * \r
- * @return databaseDescription\r
- */\r
- public java.lang.String getDatabaseDescription()\r
- {\r
- return databaseDescription;\r
- }\r
-\r
- /**\r
- * Sets the databaseDescription value for this CrossReference.\r
- * \r
- * @param databaseDescription\r
- */\r
- public void setDatabaseDescription(java.lang.String databaseDescription)\r
- {\r
- this.databaseDescription = databaseDescription;\r
- }\r
-\r
- /**\r
- * Gets the databaseName value for this CrossReference.\r
- * \r
- * @return databaseName\r
- */\r
- public java.lang.String getDatabaseName()\r
- {\r
- return databaseName;\r
- }\r
-\r
- /**\r
- * Sets the databaseName value for this CrossReference.\r
- * \r
- * @param databaseName\r
- */\r
- public void setDatabaseName(java.lang.String databaseName)\r
- {\r
- this.databaseName = databaseName;\r
- }\r
-\r
- /**\r
- * Gets the dateAdded value for this CrossReference.\r
- * \r
- * @return dateAdded\r
- */\r
- public java.util.Calendar getDateAdded()\r
- {\r
- return dateAdded;\r
- }\r
-\r
- /**\r
- * Sets the dateAdded value for this CrossReference.\r
- * \r
- * @param dateAdded\r
- */\r
- public void setDateAdded(java.util.Calendar dateAdded)\r
- {\r
- this.dateAdded = dateAdded;\r
- }\r
-\r
- /**\r
- * Gets the dateDeleted value for this CrossReference.\r
- * \r
- * @return dateDeleted\r
- */\r
- public java.util.Calendar getDateDeleted()\r
- {\r
- return dateDeleted;\r
- }\r
-\r
- /**\r
- * Sets the dateDeleted value for this CrossReference.\r
- * \r
- * @param dateDeleted\r
- */\r
- public void setDateDeleted(java.util.Calendar dateDeleted)\r
- {\r
- this.dateDeleted = dateDeleted;\r
- }\r
-\r
- /**\r
- * Gets the deleted value for this CrossReference.\r
- * \r
- * @return deleted\r
- */\r
- public boolean isDeleted()\r
- {\r
- return deleted;\r
- }\r
-\r
- /**\r
- * Sets the deleted value for this CrossReference.\r
- * \r
- * @param deleted\r
- */\r
- public void setDeleted(boolean deleted)\r
- {\r
- this.deleted = deleted;\r
- }\r
-\r
- /**\r
- * Gets the gi value for this CrossReference.\r
- * \r
- * @return gi\r
- */\r
- public java.lang.String getGi()\r
- {\r
- return gi;\r
- }\r
-\r
- /**\r
- * Sets the gi value for this CrossReference.\r
- * \r
- * @param gi\r
- */\r
- public void setGi(java.lang.String gi)\r
- {\r
- this.gi = gi;\r
- }\r
-\r
- /**\r
- * Gets the taxonId value for this CrossReference.\r
- * \r
- * @return taxonId\r
- */\r
- public java.lang.String getTaxonId()\r
- {\r
- return taxonId;\r
- }\r
-\r
- /**\r
- * Sets the taxonId value for this CrossReference.\r
- * \r
- * @param taxonId\r
- */\r
- public void setTaxonId(java.lang.String taxonId)\r
- {\r
- this.taxonId = taxonId;\r
- }\r
-\r
- private java.lang.Object __equalsCalc = null;\r
-\r
- public synchronized boolean equals(java.lang.Object obj)\r
- {\r
- if (!(obj instanceof CrossReference))\r
- return false;\r
- CrossReference other = (CrossReference) obj;\r
- if (obj == null)\r
- return false;\r
- if (this == obj)\r
- return true;\r
- if (__equalsCalc != null)\r
- {\r
- return (__equalsCalc == obj);\r
- }\r
- __equalsCalc = obj;\r
- boolean _equals;\r
- _equals = true\r
- && ((this.accession == null && other.getAccession() == null) || (this.accession != null && this.accession\r
- .equals(other.getAccession())))\r
- && ((this.accessionVersion == null && other\r
- .getAccessionVersion() == null) || (this.accessionVersion != null && this.accessionVersion\r
- .equals(other.getAccessionVersion())))\r
- && ((this.databaseDescription == null && other\r
- .getDatabaseDescription() == null) || (this.databaseDescription != null && this.databaseDescription\r
- .equals(other.getDatabaseDescription())))\r
- && ((this.databaseName == null && other.getDatabaseName() == null) || (this.databaseName != null && this.databaseName\r
- .equals(other.getDatabaseName())))\r
- && ((this.dateAdded == null && other.getDateAdded() == null) || (this.dateAdded != null && this.dateAdded\r
- .equals(other.getDateAdded())))\r
- && ((this.dateDeleted == null && other.getDateDeleted() == null) || (this.dateDeleted != null && this.dateDeleted\r
- .equals(other.getDateDeleted())))\r
- && this.deleted == other.isDeleted()\r
- && ((this.gi == null && other.getGi() == null) || (this.gi != null && this.gi\r
- .equals(other.getGi())))\r
- && ((this.taxonId == null && other.getTaxonId() == null) || (this.taxonId != null && this.taxonId\r
- .equals(other.getTaxonId())));\r
- __equalsCalc = null;\r
- return _equals;\r
- }\r
-\r
- private boolean __hashCodeCalc = false;\r
-\r
- public synchronized int hashCode()\r
- {\r
- if (__hashCodeCalc)\r
- {\r
- return 0;\r
- }\r
- __hashCodeCalc = true;\r
- int _hashCode = 1;\r
- if (getAccession() != null)\r
- {\r
- _hashCode += getAccession().hashCode();\r
- }\r
- if (getAccessionVersion() != null)\r
- {\r
- _hashCode += getAccessionVersion().hashCode();\r
- }\r
- if (getDatabaseDescription() != null)\r
- {\r
- _hashCode += getDatabaseDescription().hashCode();\r
- }\r
- if (getDatabaseName() != null)\r
- {\r
- _hashCode += getDatabaseName().hashCode();\r
- }\r
- if (getDateAdded() != null)\r
- {\r
- _hashCode += getDateAdded().hashCode();\r
- }\r
- if (getDateDeleted() != null)\r
- {\r
- _hashCode += getDateDeleted().hashCode();\r
- }\r
- _hashCode += (isDeleted() ? Boolean.TRUE : Boolean.FALSE).hashCode();\r
- if (getGi() != null)\r
- {\r
- _hashCode += getGi().hashCode();\r
- }\r
- if (getTaxonId() != null)\r
- {\r
- _hashCode += getTaxonId().hashCode();\r
- }\r
- __hashCodeCalc = false;\r
- return _hashCode;\r
- }\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package uk.ac.ebi.picr.model;
+
+public class CrossReference implements java.io.Serializable
+{
+ private java.lang.String accession;
+
+ private java.lang.String accessionVersion;
+
+ private java.lang.String databaseDescription;
+
+ private java.lang.String databaseName;
+
+ private java.util.Calendar dateAdded;
+
+ private java.util.Calendar dateDeleted;
+
+ private boolean deleted;
+
+ private java.lang.String gi;
+
+ private java.lang.String taxonId;
+
+ public CrossReference()
+ {
+ }
+
+ public CrossReference(java.lang.String accession,
+ java.lang.String accessionVersion,
+ java.lang.String databaseDescription,
+ java.lang.String databaseName, java.util.Calendar dateAdded,
+ java.util.Calendar dateDeleted, boolean deleted,
+ java.lang.String gi, java.lang.String taxonId)
+ {
+ this.accession = accession;
+ this.accessionVersion = accessionVersion;
+ this.databaseDescription = databaseDescription;
+ this.databaseName = databaseName;
+ this.dateAdded = dateAdded;
+ this.dateDeleted = dateDeleted;
+ this.deleted = deleted;
+ this.gi = gi;
+ this.taxonId = taxonId;
+ }
+
+ /**
+ * Gets the accession value for this CrossReference.
+ *
+ * @return accession
+ */
+ public java.lang.String getAccession()
+ {
+ return accession;
+ }
+
+ /**
+ * Sets the accession value for this CrossReference.
+ *
+ * @param accession
+ */
+ public void setAccession(java.lang.String accession)
+ {
+ this.accession = accession;
+ }
+
+ /**
+ * Gets the accessionVersion value for this CrossReference.
+ *
+ * @return accessionVersion
+ */
+ public java.lang.String getAccessionVersion()
+ {
+ return accessionVersion;
+ }
+
+ /**
+ * Sets the accessionVersion value for this CrossReference.
+ *
+ * @param accessionVersion
+ */
+ public void setAccessionVersion(java.lang.String accessionVersion)
+ {
+ this.accessionVersion = accessionVersion;
+ }
+
+ /**
+ * Gets the databaseDescription value for this CrossReference.
+ *
+ * @return databaseDescription
+ */
+ public java.lang.String getDatabaseDescription()
+ {
+ return databaseDescription;
+ }
+
+ /**
+ * Sets the databaseDescription value for this CrossReference.
+ *
+ * @param databaseDescription
+ */
+ public void setDatabaseDescription(java.lang.String databaseDescription)
+ {
+ this.databaseDescription = databaseDescription;
+ }
+
+ /**
+ * Gets the databaseName value for this CrossReference.
+ *
+ * @return databaseName
+ */
+ public java.lang.String getDatabaseName()
+ {
+ return databaseName;
+ }
+
+ /**
+ * Sets the databaseName value for this CrossReference.
+ *
+ * @param databaseName
+ */
+ public void setDatabaseName(java.lang.String databaseName)
+ {
+ this.databaseName = databaseName;
+ }
+
+ /**
+ * Gets the dateAdded value for this CrossReference.
+ *
+ * @return dateAdded
+ */
+ public java.util.Calendar getDateAdded()
+ {
+ return dateAdded;
+ }
+
+ /**
+ * Sets the dateAdded value for this CrossReference.
+ *
+ * @param dateAdded
+ */
+ public void setDateAdded(java.util.Calendar dateAdded)
+ {
+ this.dateAdded = dateAdded;
+ }
+
+ /**
+ * Gets the dateDeleted value for this CrossReference.
+ *
+ * @return dateDeleted
+ */
+ public java.util.Calendar getDateDeleted()
+ {
+ return dateDeleted;
+ }
+
+ /**
+ * Sets the dateDeleted value for this CrossReference.
+ *
+ * @param dateDeleted
+ */
+ public void setDateDeleted(java.util.Calendar dateDeleted)
+ {
+ this.dateDeleted = dateDeleted;
+ }
+
+ /**
+ * Gets the deleted value for this CrossReference.
+ *
+ * @return deleted
+ */
+ public boolean isDeleted()
+ {
+ return deleted;
+ }
+
+ /**
+ * Sets the deleted value for this CrossReference.
+ *
+ * @param deleted
+ */
+ public void setDeleted(boolean deleted)
+ {
+ this.deleted = deleted;
+ }
+
+ /**
+ * Gets the gi value for this CrossReference.
+ *
+ * @return gi
+ */
+ public java.lang.String getGi()
+ {
+ return gi;
+ }
+
+ /**
+ * Sets the gi value for this CrossReference.
+ *
+ * @param gi
+ */
+ public void setGi(java.lang.String gi)
+ {
+ this.gi = gi;
+ }
+
+ /**
+ * Gets the taxonId value for this CrossReference.
+ *
+ * @return taxonId
+ */
+ public java.lang.String getTaxonId()
+ {
+ return taxonId;
+ }
+
+ /**
+ * Sets the taxonId value for this CrossReference.
+ *
+ * @param taxonId
+ */
+ public void setTaxonId(java.lang.String taxonId)
+ {
+ this.taxonId = taxonId;
+ }
+
+ private java.lang.Object __equalsCalc = null;
+
+ public synchronized boolean equals(java.lang.Object obj)
+ {
+ if (!(obj instanceof CrossReference))
+ return false;
+ CrossReference other = (CrossReference) obj;
+ if (obj == null)
+ return false;
+ if (this == obj)
+ return true;
+ if (__equalsCalc != null)
+ {
+ return (__equalsCalc == obj);
+ }
+ __equalsCalc = obj;
+ boolean _equals;
+ _equals = true
+ && ((this.accession == null && other.getAccession() == null) || (this.accession != null && this.accession
+ .equals(other.getAccession())))
+ && ((this.accessionVersion == null && other
+ .getAccessionVersion() == null) || (this.accessionVersion != null && this.accessionVersion
+ .equals(other.getAccessionVersion())))
+ && ((this.databaseDescription == null && other
+ .getDatabaseDescription() == null) || (this.databaseDescription != null && this.databaseDescription
+ .equals(other.getDatabaseDescription())))
+ && ((this.databaseName == null && other.getDatabaseName() == null) || (this.databaseName != null && this.databaseName
+ .equals(other.getDatabaseName())))
+ && ((this.dateAdded == null && other.getDateAdded() == null) || (this.dateAdded != null && this.dateAdded
+ .equals(other.getDateAdded())))
+ && ((this.dateDeleted == null && other.getDateDeleted() == null) || (this.dateDeleted != null && this.dateDeleted
+ .equals(other.getDateDeleted())))
+ && this.deleted == other.isDeleted()
+ && ((this.gi == null && other.getGi() == null) || (this.gi != null && this.gi
+ .equals(other.getGi())))
+ && ((this.taxonId == null && other.getTaxonId() == null) || (this.taxonId != null && this.taxonId
+ .equals(other.getTaxonId())));
+ __equalsCalc = null;
+ return _equals;
+ }
+
+ private boolean __hashCodeCalc = false;
+
+ public synchronized int hashCode()
+ {
+ if (__hashCodeCalc)
+ {
+ return 0;
+ }
+ __hashCodeCalc = true;
+ int _hashCode = 1;
+ if (getAccession() != null)
+ {
+ _hashCode += getAccession().hashCode();
+ }
+ if (getAccessionVersion() != null)
+ {
+ _hashCode += getAccessionVersion().hashCode();
+ }
+ if (getDatabaseDescription() != null)
+ {
+ _hashCode += getDatabaseDescription().hashCode();
+ }
+ if (getDatabaseName() != null)
+ {
+ _hashCode += getDatabaseName().hashCode();
+ }
+ if (getDateAdded() != null)
+ {
+ _hashCode += getDateAdded().hashCode();
+ }
+ if (getDateDeleted() != null)
+ {
+ _hashCode += getDateDeleted().hashCode();
+ }
+ _hashCode += (isDeleted() ? Boolean.TRUE : Boolean.FALSE).hashCode();
+ if (getGi() != null)
+ {
+ _hashCode += getGi().hashCode();
+ }
+ if (getTaxonId() != null)
+ {
+ _hashCode += getTaxonId().hashCode();
+ }
+ __hashCodeCalc = false;
+ return _hashCode;
+ }
+
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package uk.ac.ebi.picr.model;\r
-\r
-public class CrossReference_Helper\r
-{\r
- // Type metadata\r
- private static org.apache.axis.description.TypeDesc typeDesc = new org.apache.axis.description.TypeDesc(\r
- CrossReference.class, true);\r
-\r
- static\r
- {\r
- typeDesc.setXmlType(new javax.xml.namespace.QName(\r
- "http://model.picr.ebi.ac.uk", "CrossReference"));\r
- org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();\r
- elemField.setFieldName("accession");\r
- elemField.setXmlName(new javax.xml.namespace.QName(\r
- "http://model.picr.ebi.ac.uk", "accession"));\r
- elemField.setXmlType(new javax.xml.namespace.QName(\r
- "http://www.w3.org/2001/XMLSchema", "string"));\r
- typeDesc.addFieldDesc(elemField);\r
- elemField = new org.apache.axis.description.ElementDesc();\r
- elemField.setFieldName("accessionVersion");\r
- elemField.setXmlName(new javax.xml.namespace.QName(\r
- "http://model.picr.ebi.ac.uk", "accessionVersion"));\r
- elemField.setXmlType(new javax.xml.namespace.QName(\r
- "http://www.w3.org/2001/XMLSchema", "string"));\r
- typeDesc.addFieldDesc(elemField);\r
- elemField = new org.apache.axis.description.ElementDesc();\r
- elemField.setFieldName("databaseDescription");\r
- elemField.setXmlName(new javax.xml.namespace.QName(\r
- "http://model.picr.ebi.ac.uk", "databaseDescription"));\r
- elemField.setXmlType(new javax.xml.namespace.QName(\r
- "http://www.w3.org/2001/XMLSchema", "string"));\r
- typeDesc.addFieldDesc(elemField);\r
- elemField = new org.apache.axis.description.ElementDesc();\r
- elemField.setFieldName("databaseName");\r
- elemField.setXmlName(new javax.xml.namespace.QName(\r
- "http://model.picr.ebi.ac.uk", "databaseName"));\r
- elemField.setXmlType(new javax.xml.namespace.QName(\r
- "http://www.w3.org/2001/XMLSchema", "string"));\r
- typeDesc.addFieldDesc(elemField);\r
- elemField = new org.apache.axis.description.ElementDesc();\r
- elemField.setFieldName("dateAdded");\r
- elemField.setXmlName(new javax.xml.namespace.QName(\r
- "http://model.picr.ebi.ac.uk", "dateAdded"));\r
- elemField.setXmlType(new javax.xml.namespace.QName(\r
- "http://www.w3.org/2001/XMLSchema", "dateTime"));\r
- typeDesc.addFieldDesc(elemField);\r
- elemField = new org.apache.axis.description.ElementDesc();\r
- elemField.setFieldName("dateDeleted");\r
- elemField.setXmlName(new javax.xml.namespace.QName(\r
- "http://model.picr.ebi.ac.uk", "dateDeleted"));\r
- elemField.setXmlType(new javax.xml.namespace.QName(\r
- "http://www.w3.org/2001/XMLSchema", "dateTime"));\r
- typeDesc.addFieldDesc(elemField);\r
- elemField = new org.apache.axis.description.ElementDesc();\r
- elemField.setFieldName("deleted");\r
- elemField.setXmlName(new javax.xml.namespace.QName(\r
- "http://model.picr.ebi.ac.uk", "deleted"));\r
- elemField.setXmlType(new javax.xml.namespace.QName(\r
- "http://www.w3.org/2001/XMLSchema", "boolean"));\r
- typeDesc.addFieldDesc(elemField);\r
- elemField = new org.apache.axis.description.ElementDesc();\r
- elemField.setFieldName("gi");\r
- elemField.setXmlName(new javax.xml.namespace.QName(\r
- "http://model.picr.ebi.ac.uk", "gi"));\r
- elemField.setXmlType(new javax.xml.namespace.QName(\r
- "http://www.w3.org/2001/XMLSchema", "string"));\r
- typeDesc.addFieldDesc(elemField);\r
- elemField = new org.apache.axis.description.ElementDesc();\r
- elemField.setFieldName("taxonId");\r
- elemField.setXmlName(new javax.xml.namespace.QName(\r
- "http://model.picr.ebi.ac.uk", "taxonId"));\r
- elemField.setXmlType(new javax.xml.namespace.QName(\r
- "http://www.w3.org/2001/XMLSchema", "string"));\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
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package uk.ac.ebi.picr.model;
+
+public class CrossReference_Helper
+{
+ // Type metadata
+ private static org.apache.axis.description.TypeDesc typeDesc = new org.apache.axis.description.TypeDesc(
+ CrossReference.class, true);
+
+ static
+ {
+ typeDesc.setXmlType(new javax.xml.namespace.QName(
+ "http://model.picr.ebi.ac.uk", "CrossReference"));
+ org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
+ elemField.setFieldName("accession");
+ elemField.setXmlName(new javax.xml.namespace.QName(
+ "http://model.picr.ebi.ac.uk", "accession"));
+ elemField.setXmlType(new javax.xml.namespace.QName(
+ "http://www.w3.org/2001/XMLSchema", "string"));
+ typeDesc.addFieldDesc(elemField);
+ elemField = new org.apache.axis.description.ElementDesc();
+ elemField.setFieldName("accessionVersion");
+ elemField.setXmlName(new javax.xml.namespace.QName(
+ "http://model.picr.ebi.ac.uk", "accessionVersion"));
+ elemField.setXmlType(new javax.xml.namespace.QName(
+ "http://www.w3.org/2001/XMLSchema", "string"));
+ typeDesc.addFieldDesc(elemField);
+ elemField = new org.apache.axis.description.ElementDesc();
+ elemField.setFieldName("databaseDescription");
+ elemField.setXmlName(new javax.xml.namespace.QName(
+ "http://model.picr.ebi.ac.uk", "databaseDescription"));
+ elemField.setXmlType(new javax.xml.namespace.QName(
+ "http://www.w3.org/2001/XMLSchema", "string"));
+ typeDesc.addFieldDesc(elemField);
+ elemField = new org.apache.axis.description.ElementDesc();
+ elemField.setFieldName("databaseName");
+ elemField.setXmlName(new javax.xml.namespace.QName(
+ "http://model.picr.ebi.ac.uk", "databaseName"));
+ elemField.setXmlType(new javax.xml.namespace.QName(
+ "http://www.w3.org/2001/XMLSchema", "string"));
+ typeDesc.addFieldDesc(elemField);
+ elemField = new org.apache.axis.description.ElementDesc();
+ elemField.setFieldName("dateAdded");
+ elemField.setXmlName(new javax.xml.namespace.QName(
+ "http://model.picr.ebi.ac.uk", "dateAdded"));
+ elemField.setXmlType(new javax.xml.namespace.QName(
+ "http://www.w3.org/2001/XMLSchema", "dateTime"));
+ typeDesc.addFieldDesc(elemField);
+ elemField = new org.apache.axis.description.ElementDesc();
+ elemField.setFieldName("dateDeleted");
+ elemField.setXmlName(new javax.xml.namespace.QName(
+ "http://model.picr.ebi.ac.uk", "dateDeleted"));
+ elemField.setXmlType(new javax.xml.namespace.QName(
+ "http://www.w3.org/2001/XMLSchema", "dateTime"));
+ typeDesc.addFieldDesc(elemField);
+ elemField = new org.apache.axis.description.ElementDesc();
+ elemField.setFieldName("deleted");
+ elemField.setXmlName(new javax.xml.namespace.QName(
+ "http://model.picr.ebi.ac.uk", "deleted"));
+ elemField.setXmlType(new javax.xml.namespace.QName(
+ "http://www.w3.org/2001/XMLSchema", "boolean"));
+ typeDesc.addFieldDesc(elemField);
+ elemField = new org.apache.axis.description.ElementDesc();
+ elemField.setFieldName("gi");
+ elemField.setXmlName(new javax.xml.namespace.QName(
+ "http://model.picr.ebi.ac.uk", "gi"));
+ elemField.setXmlType(new javax.xml.namespace.QName(
+ "http://www.w3.org/2001/XMLSchema", "string"));
+ typeDesc.addFieldDesc(elemField);
+ elemField = new org.apache.axis.description.ElementDesc();
+ elemField.setFieldName("taxonId");
+ elemField.setXmlName(new javax.xml.namespace.QName(
+ "http://model.picr.ebi.ac.uk", "taxonId"));
+ elemField.setXmlType(new javax.xml.namespace.QName(
+ "http://www.w3.org/2001/XMLSchema", "string"));
+ 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);
+ }
+
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package uk.ac.ebi.picr.model;\r
-\r
-public class UPEntry implements java.io.Serializable\r
-{\r
- private java.lang.String CRC64;\r
-\r
- private java.lang.String UPI;\r
-\r
- private uk.ac.ebi.picr.model.CrossReference[] identicalCrossReferences;\r
-\r
- private uk.ac.ebi.picr.model.CrossReference[] logicalCrossReferences;\r
-\r
- private java.lang.String sequence;\r
-\r
- private java.util.Calendar timestamp;\r
-\r
- public UPEntry()\r
- {\r
- }\r
-\r
- public UPEntry(java.lang.String CRC64, java.lang.String UPI,\r
- uk.ac.ebi.picr.model.CrossReference[] identicalCrossReferences,\r
- uk.ac.ebi.picr.model.CrossReference[] logicalCrossReferences,\r
- java.lang.String sequence, java.util.Calendar timestamp)\r
- {\r
- this.CRC64 = CRC64;\r
- this.UPI = UPI;\r
- this.identicalCrossReferences = identicalCrossReferences;\r
- this.logicalCrossReferences = logicalCrossReferences;\r
- this.sequence = sequence;\r
- this.timestamp = timestamp;\r
- }\r
-\r
- /**\r
- * Gets the CRC64 value for this UPEntry.\r
- * \r
- * @return CRC64\r
- */\r
- public java.lang.String getCRC64()\r
- {\r
- return CRC64;\r
- }\r
-\r
- /**\r
- * Sets the CRC64 value for this UPEntry.\r
- * \r
- * @param CRC64\r
- */\r
- public void setCRC64(java.lang.String CRC64)\r
- {\r
- this.CRC64 = CRC64;\r
- }\r
-\r
- /**\r
- * Gets the UPI value for this UPEntry.\r
- * \r
- * @return UPI\r
- */\r
- public java.lang.String getUPI()\r
- {\r
- return UPI;\r
- }\r
-\r
- /**\r
- * Sets the UPI value for this UPEntry.\r
- * \r
- * @param UPI\r
- */\r
- public void setUPI(java.lang.String UPI)\r
- {\r
- this.UPI = UPI;\r
- }\r
-\r
- /**\r
- * Gets the identicalCrossReferences value for this UPEntry.\r
- * \r
- * @return identicalCrossReferences\r
- */\r
- public uk.ac.ebi.picr.model.CrossReference[] getIdenticalCrossReferences()\r
- {\r
- return identicalCrossReferences;\r
- }\r
-\r
- /**\r
- * Sets the identicalCrossReferences value for this UPEntry.\r
- * \r
- * @param identicalCrossReferences\r
- */\r
- public void setIdenticalCrossReferences(\r
- uk.ac.ebi.picr.model.CrossReference[] identicalCrossReferences)\r
- {\r
- this.identicalCrossReferences = identicalCrossReferences;\r
- }\r
-\r
- public uk.ac.ebi.picr.model.CrossReference getIdenticalCrossReferences(\r
- int i)\r
- {\r
- return this.identicalCrossReferences[i];\r
- }\r
-\r
- public void setIdenticalCrossReferences(int i,\r
- uk.ac.ebi.picr.model.CrossReference _value)\r
- {\r
- this.identicalCrossReferences[i] = _value;\r
- }\r
-\r
- /**\r
- * Gets the logicalCrossReferences value for this UPEntry.\r
- * \r
- * @return logicalCrossReferences\r
- */\r
- public uk.ac.ebi.picr.model.CrossReference[] getLogicalCrossReferences()\r
- {\r
- return logicalCrossReferences;\r
- }\r
-\r
- /**\r
- * Sets the logicalCrossReferences value for this UPEntry.\r
- * \r
- * @param logicalCrossReferences\r
- */\r
- public void setLogicalCrossReferences(\r
- uk.ac.ebi.picr.model.CrossReference[] logicalCrossReferences)\r
- {\r
- this.logicalCrossReferences = logicalCrossReferences;\r
- }\r
-\r
- public uk.ac.ebi.picr.model.CrossReference getLogicalCrossReferences(int i)\r
- {\r
- return this.logicalCrossReferences[i];\r
- }\r
-\r
- public void setLogicalCrossReferences(int i,\r
- uk.ac.ebi.picr.model.CrossReference _value)\r
- {\r
- this.logicalCrossReferences[i] = _value;\r
- }\r
-\r
- /**\r
- * Gets the sequence value for this UPEntry.\r
- * \r
- * @return sequence\r
- */\r
- public java.lang.String getSequence()\r
- {\r
- return sequence;\r
- }\r
-\r
- /**\r
- * Sets the sequence value for this UPEntry.\r
- * \r
- * @param sequence\r
- */\r
- public void setSequence(java.lang.String sequence)\r
- {\r
- this.sequence = sequence;\r
- }\r
-\r
- /**\r
- * Gets the timestamp value for this UPEntry.\r
- * \r
- * @return timestamp\r
- */\r
- public java.util.Calendar getTimestamp()\r
- {\r
- return timestamp;\r
- }\r
-\r
- /**\r
- * Sets the timestamp value for this UPEntry.\r
- * \r
- * @param timestamp\r
- */\r
- public void setTimestamp(java.util.Calendar timestamp)\r
- {\r
- this.timestamp = timestamp;\r
- }\r
-\r
- private java.lang.Object __equalsCalc = null;\r
-\r
- public synchronized boolean equals(java.lang.Object obj)\r
- {\r
- if (!(obj instanceof UPEntry))\r
- return false;\r
- UPEntry other = (UPEntry) obj;\r
- if (obj == null)\r
- return false;\r
- if (this == obj)\r
- return true;\r
- if (__equalsCalc != null)\r
- {\r
- return (__equalsCalc == obj);\r
- }\r
- __equalsCalc = obj;\r
- boolean _equals;\r
- _equals = true\r
- && ((this.CRC64 == null && other.getCRC64() == null) || (this.CRC64 != null && this.CRC64\r
- .equals(other.getCRC64())))\r
- && ((this.UPI == null && other.getUPI() == null) || (this.UPI != null && this.UPI\r
- .equals(other.getUPI())))\r
- && ((this.identicalCrossReferences == null && other\r
- .getIdenticalCrossReferences() == null) || (this.identicalCrossReferences != null && java.util.Arrays\r
- .equals(this.identicalCrossReferences,\r
- other.getIdenticalCrossReferences())))\r
- && ((this.logicalCrossReferences == null && other\r
- .getLogicalCrossReferences() == null) || (this.logicalCrossReferences != null && java.util.Arrays\r
- .equals(this.logicalCrossReferences,\r
- other.getLogicalCrossReferences())))\r
- && ((this.sequence == null && other.getSequence() == null) || (this.sequence != null && this.sequence\r
- .equals(other.getSequence())))\r
- && ((this.timestamp == null && other.getTimestamp() == null) || (this.timestamp != null && this.timestamp\r
- .equals(other.getTimestamp())));\r
- __equalsCalc = null;\r
- return _equals;\r
- }\r
-\r
- private boolean __hashCodeCalc = false;\r
-\r
- public synchronized int hashCode()\r
- {\r
- if (__hashCodeCalc)\r
- {\r
- return 0;\r
- }\r
- __hashCodeCalc = true;\r
- int _hashCode = 1;\r
- if (getCRC64() != null)\r
- {\r
- _hashCode += getCRC64().hashCode();\r
- }\r
- if (getUPI() != null)\r
- {\r
- _hashCode += getUPI().hashCode();\r
- }\r
- if (getIdenticalCrossReferences() != null)\r
- {\r
- for (int i = 0; i < java.lang.reflect.Array\r
- .getLength(getIdenticalCrossReferences()); i++)\r
- {\r
- java.lang.Object obj = java.lang.reflect.Array.get(\r
- getIdenticalCrossReferences(), i);\r
- if (obj != null && !obj.getClass().isArray())\r
- {\r
- _hashCode += obj.hashCode();\r
- }\r
- }\r
- }\r
- if (getLogicalCrossReferences() != null)\r
- {\r
- for (int i = 0; i < java.lang.reflect.Array\r
- .getLength(getLogicalCrossReferences()); i++)\r
- {\r
- java.lang.Object obj = java.lang.reflect.Array.get(\r
- getLogicalCrossReferences(), i);\r
- if (obj != null && !obj.getClass().isArray())\r
- {\r
- _hashCode += obj.hashCode();\r
- }\r
- }\r
- }\r
- if (getSequence() != null)\r
- {\r
- _hashCode += getSequence().hashCode();\r
- }\r
- if (getTimestamp() != null)\r
- {\r
- _hashCode += getTimestamp().hashCode();\r
- }\r
- __hashCodeCalc = false;\r
- return _hashCode;\r
- }\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package uk.ac.ebi.picr.model;
+
+public class UPEntry implements java.io.Serializable
+{
+ private java.lang.String CRC64;
+
+ private java.lang.String UPI;
+
+ private uk.ac.ebi.picr.model.CrossReference[] identicalCrossReferences;
+
+ private uk.ac.ebi.picr.model.CrossReference[] logicalCrossReferences;
+
+ private java.lang.String sequence;
+
+ private java.util.Calendar timestamp;
+
+ public UPEntry()
+ {
+ }
+
+ public UPEntry(java.lang.String CRC64, java.lang.String UPI,
+ uk.ac.ebi.picr.model.CrossReference[] identicalCrossReferences,
+ uk.ac.ebi.picr.model.CrossReference[] logicalCrossReferences,
+ java.lang.String sequence, java.util.Calendar timestamp)
+ {
+ this.CRC64 = CRC64;
+ this.UPI = UPI;
+ this.identicalCrossReferences = identicalCrossReferences;
+ this.logicalCrossReferences = logicalCrossReferences;
+ this.sequence = sequence;
+ this.timestamp = timestamp;
+ }
+
+ /**
+ * Gets the CRC64 value for this UPEntry.
+ *
+ * @return CRC64
+ */
+ public java.lang.String getCRC64()
+ {
+ return CRC64;
+ }
+
+ /**
+ * Sets the CRC64 value for this UPEntry.
+ *
+ * @param CRC64
+ */
+ public void setCRC64(java.lang.String CRC64)
+ {
+ this.CRC64 = CRC64;
+ }
+
+ /**
+ * Gets the UPI value for this UPEntry.
+ *
+ * @return UPI
+ */
+ public java.lang.String getUPI()
+ {
+ return UPI;
+ }
+
+ /**
+ * Sets the UPI value for this UPEntry.
+ *
+ * @param UPI
+ */
+ public void setUPI(java.lang.String UPI)
+ {
+ this.UPI = UPI;
+ }
+
+ /**
+ * Gets the identicalCrossReferences value for this UPEntry.
+ *
+ * @return identicalCrossReferences
+ */
+ public uk.ac.ebi.picr.model.CrossReference[] getIdenticalCrossReferences()
+ {
+ return identicalCrossReferences;
+ }
+
+ /**
+ * Sets the identicalCrossReferences value for this UPEntry.
+ *
+ * @param identicalCrossReferences
+ */
+ public void setIdenticalCrossReferences(
+ uk.ac.ebi.picr.model.CrossReference[] identicalCrossReferences)
+ {
+ this.identicalCrossReferences = identicalCrossReferences;
+ }
+
+ public uk.ac.ebi.picr.model.CrossReference getIdenticalCrossReferences(
+ int i)
+ {
+ return this.identicalCrossReferences[i];
+ }
+
+ public void setIdenticalCrossReferences(int i,
+ uk.ac.ebi.picr.model.CrossReference _value)
+ {
+ this.identicalCrossReferences[i] = _value;
+ }
+
+ /**
+ * Gets the logicalCrossReferences value for this UPEntry.
+ *
+ * @return logicalCrossReferences
+ */
+ public uk.ac.ebi.picr.model.CrossReference[] getLogicalCrossReferences()
+ {
+ return logicalCrossReferences;
+ }
+
+ /**
+ * Sets the logicalCrossReferences value for this UPEntry.
+ *
+ * @param logicalCrossReferences
+ */
+ public void setLogicalCrossReferences(
+ uk.ac.ebi.picr.model.CrossReference[] logicalCrossReferences)
+ {
+ this.logicalCrossReferences = logicalCrossReferences;
+ }
+
+ public uk.ac.ebi.picr.model.CrossReference getLogicalCrossReferences(int i)
+ {
+ return this.logicalCrossReferences[i];
+ }
+
+ public void setLogicalCrossReferences(int i,
+ uk.ac.ebi.picr.model.CrossReference _value)
+ {
+ this.logicalCrossReferences[i] = _value;
+ }
+
+ /**
+ * Gets the sequence value for this UPEntry.
+ *
+ * @return sequence
+ */
+ public java.lang.String getSequence()
+ {
+ return sequence;
+ }
+
+ /**
+ * Sets the sequence value for this UPEntry.
+ *
+ * @param sequence
+ */
+ public void setSequence(java.lang.String sequence)
+ {
+ this.sequence = sequence;
+ }
+
+ /**
+ * Gets the timestamp value for this UPEntry.
+ *
+ * @return timestamp
+ */
+ public java.util.Calendar getTimestamp()
+ {
+ return timestamp;
+ }
+
+ /**
+ * Sets the timestamp value for this UPEntry.
+ *
+ * @param timestamp
+ */
+ public void setTimestamp(java.util.Calendar timestamp)
+ {
+ this.timestamp = timestamp;
+ }
+
+ private java.lang.Object __equalsCalc = null;
+
+ public synchronized boolean equals(java.lang.Object obj)
+ {
+ if (!(obj instanceof UPEntry))
+ return false;
+ UPEntry other = (UPEntry) obj;
+ if (obj == null)
+ return false;
+ if (this == obj)
+ return true;
+ if (__equalsCalc != null)
+ {
+ return (__equalsCalc == obj);
+ }
+ __equalsCalc = obj;
+ boolean _equals;
+ _equals = true
+ && ((this.CRC64 == null && other.getCRC64() == null) || (this.CRC64 != null && this.CRC64
+ .equals(other.getCRC64())))
+ && ((this.UPI == null && other.getUPI() == null) || (this.UPI != null && this.UPI
+ .equals(other.getUPI())))
+ && ((this.identicalCrossReferences == null && other
+ .getIdenticalCrossReferences() == null) || (this.identicalCrossReferences != null && java.util.Arrays
+ .equals(this.identicalCrossReferences,
+ other.getIdenticalCrossReferences())))
+ && ((this.logicalCrossReferences == null && other
+ .getLogicalCrossReferences() == null) || (this.logicalCrossReferences != null && java.util.Arrays
+ .equals(this.logicalCrossReferences,
+ other.getLogicalCrossReferences())))
+ && ((this.sequence == null && other.getSequence() == null) || (this.sequence != null && this.sequence
+ .equals(other.getSequence())))
+ && ((this.timestamp == null && other.getTimestamp() == null) || (this.timestamp != null && this.timestamp
+ .equals(other.getTimestamp())));
+ __equalsCalc = null;
+ return _equals;
+ }
+
+ private boolean __hashCodeCalc = false;
+
+ public synchronized int hashCode()
+ {
+ if (__hashCodeCalc)
+ {
+ return 0;
+ }
+ __hashCodeCalc = true;
+ int _hashCode = 1;
+ if (getCRC64() != null)
+ {
+ _hashCode += getCRC64().hashCode();
+ }
+ if (getUPI() != null)
+ {
+ _hashCode += getUPI().hashCode();
+ }
+ if (getIdenticalCrossReferences() != null)
+ {
+ for (int i = 0; i < java.lang.reflect.Array
+ .getLength(getIdenticalCrossReferences()); i++)
+ {
+ java.lang.Object obj = java.lang.reflect.Array.get(
+ getIdenticalCrossReferences(), i);
+ if (obj != null && !obj.getClass().isArray())
+ {
+ _hashCode += obj.hashCode();
+ }
+ }
+ }
+ if (getLogicalCrossReferences() != null)
+ {
+ for (int i = 0; i < java.lang.reflect.Array
+ .getLength(getLogicalCrossReferences()); i++)
+ {
+ java.lang.Object obj = java.lang.reflect.Array.get(
+ getLogicalCrossReferences(), i);
+ if (obj != null && !obj.getClass().isArray())
+ {
+ _hashCode += obj.hashCode();
+ }
+ }
+ }
+ if (getSequence() != null)
+ {
+ _hashCode += getSequence().hashCode();
+ }
+ if (getTimestamp() != null)
+ {
+ _hashCode += getTimestamp().hashCode();
+ }
+ __hashCodeCalc = false;
+ return _hashCode;
+ }
+
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package uk.ac.ebi.picr.model;\r
-\r
-public class UPEntry_Helper\r
-{\r
- // Type metadata\r
- private static org.apache.axis.description.TypeDesc typeDesc = new org.apache.axis.description.TypeDesc(\r
- UPEntry.class, true);\r
-\r
- static\r
- {\r
- typeDesc.setXmlType(new javax.xml.namespace.QName(\r
- "http://model.picr.ebi.ac.uk", "UPEntry"));\r
- org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();\r
- elemField.setFieldName("CRC64");\r
- elemField.setXmlName(new javax.xml.namespace.QName(\r
- "http://model.picr.ebi.ac.uk", "CRC64"));\r
- elemField.setXmlType(new javax.xml.namespace.QName(\r
- "http://www.w3.org/2001/XMLSchema", "string"));\r
- typeDesc.addFieldDesc(elemField);\r
- elemField = new org.apache.axis.description.ElementDesc();\r
- elemField.setFieldName("UPI");\r
- elemField.setXmlName(new javax.xml.namespace.QName(\r
- "http://model.picr.ebi.ac.uk", "UPI"));\r
- elemField.setXmlType(new javax.xml.namespace.QName(\r
- "http://www.w3.org/2001/XMLSchema", "string"));\r
- typeDesc.addFieldDesc(elemField);\r
- elemField = new org.apache.axis.description.ElementDesc();\r
- elemField.setFieldName("identicalCrossReferences");\r
- elemField.setXmlName(new javax.xml.namespace.QName(\r
- "http://model.picr.ebi.ac.uk", "identicalCrossReferences"));\r
- elemField.setXmlType(new javax.xml.namespace.QName(\r
- "http://model.picr.ebi.ac.uk", "CrossReference"));\r
- elemField.setMinOccurs(0);\r
- typeDesc.addFieldDesc(elemField);\r
- elemField = new org.apache.axis.description.ElementDesc();\r
- elemField.setFieldName("logicalCrossReferences");\r
- elemField.setXmlName(new javax.xml.namespace.QName(\r
- "http://model.picr.ebi.ac.uk", "logicalCrossReferences"));\r
- elemField.setXmlType(new javax.xml.namespace.QName(\r
- "http://model.picr.ebi.ac.uk", "CrossReference"));\r
- elemField.setMinOccurs(0);\r
- typeDesc.addFieldDesc(elemField);\r
- elemField = new org.apache.axis.description.ElementDesc();\r
- elemField.setFieldName("sequence");\r
- elemField.setXmlName(new javax.xml.namespace.QName(\r
- "http://model.picr.ebi.ac.uk", "sequence"));\r
- elemField.setXmlType(new javax.xml.namespace.QName(\r
- "http://www.w3.org/2001/XMLSchema", "string"));\r
- typeDesc.addFieldDesc(elemField);\r
- elemField = new org.apache.axis.description.ElementDesc();\r
- elemField.setFieldName("timestamp");\r
- elemField.setXmlName(new javax.xml.namespace.QName(\r
- "http://model.picr.ebi.ac.uk", "timestamp"));\r
- elemField.setXmlType(new javax.xml.namespace.QName(\r
- "http://www.w3.org/2001/XMLSchema", "dateTime"));\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
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package uk.ac.ebi.picr.model;
+
+public class UPEntry_Helper
+{
+ // Type metadata
+ private static org.apache.axis.description.TypeDesc typeDesc = new org.apache.axis.description.TypeDesc(
+ UPEntry.class, true);
+
+ static
+ {
+ typeDesc.setXmlType(new javax.xml.namespace.QName(
+ "http://model.picr.ebi.ac.uk", "UPEntry"));
+ org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
+ elemField.setFieldName("CRC64");
+ elemField.setXmlName(new javax.xml.namespace.QName(
+ "http://model.picr.ebi.ac.uk", "CRC64"));
+ elemField.setXmlType(new javax.xml.namespace.QName(
+ "http://www.w3.org/2001/XMLSchema", "string"));
+ typeDesc.addFieldDesc(elemField);
+ elemField = new org.apache.axis.description.ElementDesc();
+ elemField.setFieldName("UPI");
+ elemField.setXmlName(new javax.xml.namespace.QName(
+ "http://model.picr.ebi.ac.uk", "UPI"));
+ elemField.setXmlType(new javax.xml.namespace.QName(
+ "http://www.w3.org/2001/XMLSchema", "string"));
+ typeDesc.addFieldDesc(elemField);
+ elemField = new org.apache.axis.description.ElementDesc();
+ elemField.setFieldName("identicalCrossReferences");
+ elemField.setXmlName(new javax.xml.namespace.QName(
+ "http://model.picr.ebi.ac.uk", "identicalCrossReferences"));
+ elemField.setXmlType(new javax.xml.namespace.QName(
+ "http://model.picr.ebi.ac.uk", "CrossReference"));
+ elemField.setMinOccurs(0);
+ typeDesc.addFieldDesc(elemField);
+ elemField = new org.apache.axis.description.ElementDesc();
+ elemField.setFieldName("logicalCrossReferences");
+ elemField.setXmlName(new javax.xml.namespace.QName(
+ "http://model.picr.ebi.ac.uk", "logicalCrossReferences"));
+ elemField.setXmlType(new javax.xml.namespace.QName(
+ "http://model.picr.ebi.ac.uk", "CrossReference"));
+ elemField.setMinOccurs(0);
+ typeDesc.addFieldDesc(elemField);
+ elemField = new org.apache.axis.description.ElementDesc();
+ elemField.setFieldName("sequence");
+ elemField.setXmlName(new javax.xml.namespace.QName(
+ "http://model.picr.ebi.ac.uk", "sequence"));
+ elemField.setXmlType(new javax.xml.namespace.QName(
+ "http://www.w3.org/2001/XMLSchema", "string"));
+ typeDesc.addFieldDesc(elemField);
+ elemField = new org.apache.axis.description.ElementDesc();
+ elemField.setFieldName("timestamp");
+ elemField.setXmlName(new javax.xml.namespace.QName(
+ "http://model.picr.ebi.ac.uk", "timestamp"));
+ elemField.setXmlType(new javax.xml.namespace.QName(
+ "http://www.w3.org/2001/XMLSchema", "dateTime"));
+ 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);
+ }
+
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package uk.ac.ebi.www.picr.AccessionMappingService;\r
-\r
-public class AccessionMapperBindingStub extends org.apache.axis.client.Stub\r
- implements\r
- uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperInterface\r
-{\r
- private java.util.Vector cachedSerClasses = new java.util.Vector();\r
-\r
- private java.util.Vector cachedSerQNames = new java.util.Vector();\r
-\r
- private java.util.Vector cachedSerFactories = new java.util.Vector();\r
-\r
- private java.util.Vector cachedDeserFactories = new java.util.Vector();\r
-\r
- static org.apache.axis.description.OperationDesc[] _operations;\r
-\r
- static\r
- {\r
- _operations = new org.apache.axis.description.OperationDesc[3];\r
- _initOperationDesc1();\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("getUPIForSequence");\r
- oper.addParameter(\r
- new javax.xml.namespace.QName(\r
- "http://www.ebi.ac.uk/picr/AccessionMappingService",\r
- "sequence"), new javax.xml.namespace.QName(\r
- "http://www.w3.org/2001/XMLSchema", "string"),\r
- java.lang.String.class,\r
- org.apache.axis.description.ParameterDesc.IN, false, false);\r
- oper.addParameter(new javax.xml.namespace.QName(\r
- "http://www.ebi.ac.uk/picr/AccessionMappingService",\r
- "searchDatabases"), new javax.xml.namespace.QName(\r
- "http://www.w3.org/2001/XMLSchema", "string"),\r
- java.lang.String[].class,\r
- org.apache.axis.description.ParameterDesc.IN, false, false);\r
- oper.addParameter(\r
- new javax.xml.namespace.QName(\r
- "http://www.ebi.ac.uk/picr/AccessionMappingService",\r
- "taxonId"), new javax.xml.namespace.QName(\r
- "http://www.w3.org/2001/XMLSchema", "string"),\r
- java.lang.String.class,\r
- org.apache.axis.description.ParameterDesc.IN, false, false);\r
- oper.addParameter(new javax.xml.namespace.QName(\r
- "http://www.ebi.ac.uk/picr/AccessionMappingService",\r
- "onlyActive"), new javax.xml.namespace.QName(\r
- "http://www.w3.org/2001/XMLSchema", "boolean"), boolean.class,\r
- org.apache.axis.description.ParameterDesc.IN, false, false);\r
- oper.setReturnType(new javax.xml.namespace.QName(\r
- "http://model.picr.ebi.ac.uk", "UPEntry"));\r
- oper.setReturnClass(uk.ac.ebi.picr.model.UPEntry.class);\r
- oper.setReturnQName(new javax.xml.namespace.QName(\r
- "http://www.ebi.ac.uk/picr/AccessionMappingService",\r
- "getUPIForSequenceReturn"));\r
- oper.setStyle(org.apache.axis.constants.Style.WRAPPED);\r
- oper.setUse(org.apache.axis.constants.Use.LITERAL);\r
- _operations[0] = oper;\r
-\r
- oper = new org.apache.axis.description.OperationDesc();\r
- oper.setName("getUPIForAccession");\r
- oper.addParameter(new javax.xml.namespace.QName(\r
- "http://www.ebi.ac.uk/picr/AccessionMappingService",\r
- "accession"), new javax.xml.namespace.QName(\r
- "http://www.w3.org/2001/XMLSchema", "string"),\r
- java.lang.String.class,\r
- org.apache.axis.description.ParameterDesc.IN, false, false);\r
- oper.addParameter(new javax.xml.namespace.QName(\r
- "http://www.ebi.ac.uk/picr/AccessionMappingService",\r
- "ac_version"), new javax.xml.namespace.QName(\r
- "http://www.w3.org/2001/XMLSchema", "string"),\r
- java.lang.String.class,\r
- org.apache.axis.description.ParameterDesc.IN, false, false);\r
- oper.addParameter(new javax.xml.namespace.QName(\r
- "http://www.ebi.ac.uk/picr/AccessionMappingService",\r
- "searchDatabases"), new javax.xml.namespace.QName(\r
- "http://www.w3.org/2001/XMLSchema", "string"),\r
- java.lang.String[].class,\r
- org.apache.axis.description.ParameterDesc.IN, false, false);\r
- oper.addParameter(\r
- new javax.xml.namespace.QName(\r
- "http://www.ebi.ac.uk/picr/AccessionMappingService",\r
- "taxonId"), new javax.xml.namespace.QName(\r
- "http://www.w3.org/2001/XMLSchema", "string"),\r
- java.lang.String.class,\r
- org.apache.axis.description.ParameterDesc.IN, false, false);\r
- oper.addParameter(new javax.xml.namespace.QName(\r
- "http://www.ebi.ac.uk/picr/AccessionMappingService",\r
- "onlyActive"), new javax.xml.namespace.QName(\r
- "http://www.w3.org/2001/XMLSchema", "boolean"), boolean.class,\r
- org.apache.axis.description.ParameterDesc.IN, false, false);\r
- oper.setReturnType(new javax.xml.namespace.QName(\r
- "http://model.picr.ebi.ac.uk", "UPEntry"));\r
- oper.setReturnClass(uk.ac.ebi.picr.model.UPEntry[].class);\r
- oper.setReturnQName(new javax.xml.namespace.QName(\r
- "http://www.ebi.ac.uk/picr/AccessionMappingService",\r
- "getUPIForAccessionReturn"));\r
- oper.setStyle(org.apache.axis.constants.Style.WRAPPED);\r
- oper.setUse(org.apache.axis.constants.Use.LITERAL);\r
- _operations[1] = oper;\r
-\r
- oper = new org.apache.axis.description.OperationDesc();\r
- oper.setName("getMappedDatabaseNames");\r
- oper.setReturnType(new javax.xml.namespace.QName(\r
- "http://www.w3.org/2001/XMLSchema", "string"));\r
- oper.setReturnClass(java.lang.String[].class);\r
- oper.setReturnQName(new javax.xml.namespace.QName(\r
- "http://www.ebi.ac.uk/picr/AccessionMappingService",\r
- "mappedDatabases"));\r
- oper.setStyle(org.apache.axis.constants.Style.WRAPPED);\r
- oper.setUse(org.apache.axis.constants.Use.LITERAL);\r
- _operations[2] = oper;\r
-\r
- }\r
-\r
- public AccessionMapperBindingStub() throws org.apache.axis.AxisFault\r
- {\r
- this(null);\r
- }\r
-\r
- public AccessionMapperBindingStub(java.net.URL endpointURL,\r
- javax.xml.rpc.Service service) throws org.apache.axis.AxisFault\r
- {\r
- this(service);\r
- super.cachedEndpoint = endpointURL;\r
- }\r
-\r
- public AccessionMapperBindingStub(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
- 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.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.ArraySerializerFactory.class;\r
- java.lang.Class arraydf = org.apache.axis.encoding.ser.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("http://model.picr.ebi.ac.uk",\r
- "UPEntry");\r
- cachedSerQNames.add(qName);\r
- cls = uk.ac.ebi.picr.model.UPEntry.class;\r
- cachedSerClasses.add(cls);\r
- cachedSerFactories.add(beansf);\r
- cachedDeserFactories.add(beandf);\r
-\r
- qName = new javax.xml.namespace.QName("http://model.picr.ebi.ac.uk",\r
- "CrossReference");\r
- cachedSerQNames.add(qName);\r
- cls = uk.ac.ebi.picr.model.CrossReference.class;\r
- cachedSerClasses.add(cls);\r
- cachedSerFactories.add(beansf);\r
- cachedDeserFactories.add(beandf);\r
-\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.service\r
- .createCall();\r
- if (super.maintainSessionSet)\r
- {\r
- _call.setMaintainSession(super.maintainSession);\r
- }\r
- if (super.cachedUsername != null)\r
- {\r
- _call.setUsername(super.cachedUsername);\r
- }\r
- if (super.cachedPassword != null)\r
- {\r
- _call.setPassword(super.cachedPassword);\r
- }\r
- if (super.cachedEndpoint != null)\r
- {\r
- _call.setTargetEndpointAddress(super.cachedEndpoint);\r
- }\r
- if (super.cachedTimeout != null)\r
- {\r
- _call.setTimeout(super.cachedTimeout);\r
- }\r
- if (super.cachedPortName != null)\r
- {\r
- _call.setPortName(super.cachedPortName);\r
- }\r
- java.util.Enumeration keys = super.cachedProperties.keys();\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
- // 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.setEncodingStyle(null);\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) cachedSerQNames\r
- .get(i);\r
- java.lang.Class sf = (java.lang.Class) cachedSerFactories\r
- .get(i);\r
- java.lang.Class df = (java.lang.Class) cachedDeserFactories\r
- .get(i);\r
- _call.registerTypeMapping(cls, qName, sf, df, false);\r
- }\r
- }\r
- }\r
- return _call;\r
- } catch (java.lang.Throwable _t)\r
- {\r
- throw new org.apache.axis.AxisFault(\r
- "Failure trying to get the Call object", _t);\r
- }\r
- }\r
-\r
- public uk.ac.ebi.picr.model.UPEntry getUPIForSequence(\r
- java.lang.String sequence, java.lang.String[] searchDatabases,\r
- java.lang.String taxonId, boolean onlyActive)\r
- throws java.rmi.RemoteException\r
- {\r
- if (super.cachedEndpoint == null)\r
- {\r
- throw new org.apache.axis.NoEndPointException();\r
- }\r
- org.apache.axis.client.Call _call = createCall();\r
- _call.setOperation(_operations[0]);\r
- _call.setUseSOAPAction(true);\r
- _call.setSOAPActionURI("getUPIForSequence");\r
- _call.setEncodingStyle(null);\r
- _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR,\r
- Boolean.FALSE);\r
- _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS,\r
- Boolean.FALSE);\r
- _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);\r
- _call.setOperationName(new javax.xml.namespace.QName(\r
- "http://www.ebi.ac.uk/picr/AccessionMappingService",\r
- "getUPIForSequence"));\r
-\r
- setRequestHeaders(_call);\r
- setAttachments(_call);\r
- java.lang.Object _resp = _call\r
- .invoke(new java.lang.Object[]\r
- { sequence, searchDatabases, taxonId,\r
- new java.lang.Boolean(onlyActive) });\r
-\r
- if (_resp instanceof java.rmi.RemoteException)\r
- {\r
- throw (java.rmi.RemoteException) _resp;\r
- }\r
- else\r
- {\r
- extractAttachments(_call);\r
- try\r
- {\r
- return (uk.ac.ebi.picr.model.UPEntry) _resp;\r
- } catch (java.lang.Exception _exception)\r
- {\r
- return (uk.ac.ebi.picr.model.UPEntry) org.apache.axis.utils.JavaUtils\r
- .convert(_resp, uk.ac.ebi.picr.model.UPEntry.class);\r
- }\r
- }\r
- }\r
-\r
- public uk.ac.ebi.picr.model.UPEntry[] getUPIForAccession(\r
- java.lang.String accession, java.lang.String ac_version,\r
- java.lang.String[] searchDatabases, java.lang.String taxonId,\r
- boolean onlyActive) throws java.rmi.RemoteException\r
- {\r
- if (super.cachedEndpoint == null)\r
- {\r
- throw new org.apache.axis.NoEndPointException();\r
- }\r
- org.apache.axis.client.Call _call = createCall();\r
- _call.setOperation(_operations[1]);\r
- _call.setUseSOAPAction(true);\r
- _call.setSOAPActionURI("getUPIForAccession");\r
- _call.setEncodingStyle(null);\r
- _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR,\r
- Boolean.FALSE);\r
- _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS,\r
- Boolean.FALSE);\r
- _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);\r
- _call.setOperationName(new javax.xml.namespace.QName(\r
- "http://www.ebi.ac.uk/picr/AccessionMappingService",\r
- "getUPIForAccession"));\r
-\r
- setRequestHeaders(_call);\r
- setAttachments(_call);\r
- java.lang.Object _resp = _call.invoke(new java.lang.Object[]\r
- { accession, ac_version, searchDatabases, taxonId,\r
- new java.lang.Boolean(onlyActive) });\r
-\r
- if (_resp instanceof java.rmi.RemoteException)\r
- {\r
- throw (java.rmi.RemoteException) _resp;\r
- }\r
- else\r
- {\r
- extractAttachments(_call);\r
- try\r
- {\r
- return (uk.ac.ebi.picr.model.UPEntry[]) _resp;\r
- } catch (java.lang.Exception _exception)\r
- {\r
- return (uk.ac.ebi.picr.model.UPEntry[]) org.apache.axis.utils.JavaUtils\r
- .convert(_resp, uk.ac.ebi.picr.model.UPEntry[].class);\r
- }\r
- }\r
- }\r
-\r
- public java.lang.String[] getMappedDatabaseNames()\r
- throws java.rmi.RemoteException\r
- {\r
- if (super.cachedEndpoint == null)\r
- {\r
- throw new org.apache.axis.NoEndPointException();\r
- }\r
- org.apache.axis.client.Call _call = createCall();\r
- _call.setOperation(_operations[2]);\r
- _call.setUseSOAPAction(true);\r
- _call.setSOAPActionURI("getMappedDatabaseNames");\r
- _call.setEncodingStyle(null);\r
- _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR,\r
- Boolean.FALSE);\r
- _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS,\r
- Boolean.FALSE);\r
- _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);\r
- _call.setOperationName(new javax.xml.namespace.QName(\r
- "http://www.ebi.ac.uk/picr/AccessionMappingService",\r
- "getMappedDatabaseNames"));\r
-\r
- setRequestHeaders(_call);\r
- setAttachments(_call);\r
- java.lang.Object _resp = _call.invoke(new java.lang.Object[]\r
- {});\r
-\r
- if (_resp instanceof java.rmi.RemoteException)\r
- {\r
- throw (java.rmi.RemoteException) _resp;\r
- }\r
- else\r
- {\r
- extractAttachments(_call);\r
- try\r
- {\r
- return (java.lang.String[]) _resp;\r
- } catch (java.lang.Exception _exception)\r
- {\r
- return (java.lang.String[]) org.apache.axis.utils.JavaUtils\r
- .convert(_resp, java.lang.String[].class);\r
- }\r
- }\r
- }\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package uk.ac.ebi.www.picr.AccessionMappingService;
+
+public class AccessionMapperBindingStub extends org.apache.axis.client.Stub
+ implements
+ uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperInterface
+{
+ 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();
+
+ static org.apache.axis.description.OperationDesc[] _operations;
+
+ static
+ {
+ _operations = new org.apache.axis.description.OperationDesc[3];
+ _initOperationDesc1();
+ }
+
+ private static void _initOperationDesc1()
+ {
+ org.apache.axis.description.OperationDesc oper;
+ oper = new org.apache.axis.description.OperationDesc();
+ oper.setName("getUPIForSequence");
+ oper.addParameter(
+ new javax.xml.namespace.QName(
+ "http://www.ebi.ac.uk/picr/AccessionMappingService",
+ "sequence"), 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.addParameter(new javax.xml.namespace.QName(
+ "http://www.ebi.ac.uk/picr/AccessionMappingService",
+ "searchDatabases"), 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.addParameter(
+ new javax.xml.namespace.QName(
+ "http://www.ebi.ac.uk/picr/AccessionMappingService",
+ "taxonId"), 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.addParameter(new javax.xml.namespace.QName(
+ "http://www.ebi.ac.uk/picr/AccessionMappingService",
+ "onlyActive"), new javax.xml.namespace.QName(
+ "http://www.w3.org/2001/XMLSchema", "boolean"), boolean.class,
+ org.apache.axis.description.ParameterDesc.IN, false, false);
+ oper.setReturnType(new javax.xml.namespace.QName(
+ "http://model.picr.ebi.ac.uk", "UPEntry"));
+ oper.setReturnClass(uk.ac.ebi.picr.model.UPEntry.class);
+ oper.setReturnQName(new javax.xml.namespace.QName(
+ "http://www.ebi.ac.uk/picr/AccessionMappingService",
+ "getUPIForSequenceReturn"));
+ oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
+ oper.setUse(org.apache.axis.constants.Use.LITERAL);
+ _operations[0] = oper;
+
+ oper = new org.apache.axis.description.OperationDesc();
+ oper.setName("getUPIForAccession");
+ oper.addParameter(new javax.xml.namespace.QName(
+ "http://www.ebi.ac.uk/picr/AccessionMappingService",
+ "accession"), 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.addParameter(new javax.xml.namespace.QName(
+ "http://www.ebi.ac.uk/picr/AccessionMappingService",
+ "ac_version"), 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.addParameter(new javax.xml.namespace.QName(
+ "http://www.ebi.ac.uk/picr/AccessionMappingService",
+ "searchDatabases"), 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.addParameter(
+ new javax.xml.namespace.QName(
+ "http://www.ebi.ac.uk/picr/AccessionMappingService",
+ "taxonId"), 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.addParameter(new javax.xml.namespace.QName(
+ "http://www.ebi.ac.uk/picr/AccessionMappingService",
+ "onlyActive"), new javax.xml.namespace.QName(
+ "http://www.w3.org/2001/XMLSchema", "boolean"), boolean.class,
+ org.apache.axis.description.ParameterDesc.IN, false, false);
+ oper.setReturnType(new javax.xml.namespace.QName(
+ "http://model.picr.ebi.ac.uk", "UPEntry"));
+ oper.setReturnClass(uk.ac.ebi.picr.model.UPEntry[].class);
+ oper.setReturnQName(new javax.xml.namespace.QName(
+ "http://www.ebi.ac.uk/picr/AccessionMappingService",
+ "getUPIForAccessionReturn"));
+ oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
+ oper.setUse(org.apache.axis.constants.Use.LITERAL);
+ _operations[1] = oper;
+
+ oper = new org.apache.axis.description.OperationDesc();
+ oper.setName("getMappedDatabaseNames");
+ oper.setReturnType(new javax.xml.namespace.QName(
+ "http://www.w3.org/2001/XMLSchema", "string"));
+ oper.setReturnClass(java.lang.String[].class);
+ oper.setReturnQName(new javax.xml.namespace.QName(
+ "http://www.ebi.ac.uk/picr/AccessionMappingService",
+ "mappedDatabases"));
+ oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
+ oper.setUse(org.apache.axis.constants.Use.LITERAL);
+ _operations[2] = oper;
+
+ }
+
+ public AccessionMapperBindingStub() throws org.apache.axis.AxisFault
+ {
+ this(null);
+ }
+
+ public AccessionMapperBindingStub(java.net.URL endpointURL,
+ javax.xml.rpc.Service service) throws org.apache.axis.AxisFault
+ {
+ this(service);
+ super.cachedEndpoint = endpointURL;
+ }
+
+ public AccessionMapperBindingStub(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("http://model.picr.ebi.ac.uk",
+ "UPEntry");
+ cachedSerQNames.add(qName);
+ cls = uk.ac.ebi.picr.model.UPEntry.class;
+ cachedSerClasses.add(cls);
+ cachedSerFactories.add(beansf);
+ cachedDeserFactories.add(beandf);
+
+ qName = new javax.xml.namespace.QName("http://model.picr.ebi.ac.uk",
+ "CrossReference");
+ cachedSerQNames.add(qName);
+ cls = uk.ac.ebi.picr.model.CrossReference.class;
+ cachedSerClasses.add(cls);
+ cachedSerFactories.add(beansf);
+ cachedDeserFactories.add(beandf);
+
+ }
+
+ 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.setEncodingStyle(null);
+ 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 uk.ac.ebi.picr.model.UPEntry getUPIForSequence(
+ java.lang.String sequence, java.lang.String[] searchDatabases,
+ java.lang.String taxonId, boolean onlyActive)
+ 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("getUPIForSequence");
+ _call.setEncodingStyle(null);
+ _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR,
+ Boolean.FALSE);
+ _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS,
+ Boolean.FALSE);
+ _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
+ _call.setOperationName(new javax.xml.namespace.QName(
+ "http://www.ebi.ac.uk/picr/AccessionMappingService",
+ "getUPIForSequence"));
+
+ setRequestHeaders(_call);
+ setAttachments(_call);
+ java.lang.Object _resp = _call
+ .invoke(new java.lang.Object[]
+ { sequence, searchDatabases, taxonId,
+ new java.lang.Boolean(onlyActive) });
+
+ if (_resp instanceof java.rmi.RemoteException)
+ {
+ throw (java.rmi.RemoteException) _resp;
+ }
+ else
+ {
+ extractAttachments(_call);
+ try
+ {
+ return (uk.ac.ebi.picr.model.UPEntry) _resp;
+ } catch (java.lang.Exception _exception)
+ {
+ return (uk.ac.ebi.picr.model.UPEntry) org.apache.axis.utils.JavaUtils
+ .convert(_resp, uk.ac.ebi.picr.model.UPEntry.class);
+ }
+ }
+ }
+
+ public uk.ac.ebi.picr.model.UPEntry[] getUPIForAccession(
+ java.lang.String accession, java.lang.String ac_version,
+ java.lang.String[] searchDatabases, java.lang.String taxonId,
+ boolean onlyActive) 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("getUPIForAccession");
+ _call.setEncodingStyle(null);
+ _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR,
+ Boolean.FALSE);
+ _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS,
+ Boolean.FALSE);
+ _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
+ _call.setOperationName(new javax.xml.namespace.QName(
+ "http://www.ebi.ac.uk/picr/AccessionMappingService",
+ "getUPIForAccession"));
+
+ setRequestHeaders(_call);
+ setAttachments(_call);
+ java.lang.Object _resp = _call.invoke(new java.lang.Object[]
+ { accession, ac_version, searchDatabases, taxonId,
+ new java.lang.Boolean(onlyActive) });
+
+ if (_resp instanceof java.rmi.RemoteException)
+ {
+ throw (java.rmi.RemoteException) _resp;
+ }
+ else
+ {
+ extractAttachments(_call);
+ try
+ {
+ return (uk.ac.ebi.picr.model.UPEntry[]) _resp;
+ } catch (java.lang.Exception _exception)
+ {
+ return (uk.ac.ebi.picr.model.UPEntry[]) org.apache.axis.utils.JavaUtils
+ .convert(_resp, uk.ac.ebi.picr.model.UPEntry[].class);
+ }
+ }
+ }
+
+ public java.lang.String[] getMappedDatabaseNames()
+ 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("getMappedDatabaseNames");
+ _call.setEncodingStyle(null);
+ _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR,
+ Boolean.FALSE);
+ _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS,
+ Boolean.FALSE);
+ _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
+ _call.setOperationName(new javax.xml.namespace.QName(
+ "http://www.ebi.ac.uk/picr/AccessionMappingService",
+ "getMappedDatabaseNames"));
+
+ setRequestHeaders(_call);
+ setAttachments(_call);
+ java.lang.Object _resp = _call.invoke(new java.lang.Object[]
+ {});
+
+ if (_resp instanceof java.rmi.RemoteException)
+ {
+ throw (java.rmi.RemoteException) _resp;
+ }
+ else
+ {
+ extractAttachments(_call);
+ try
+ {
+ return (java.lang.String[]) _resp;
+ } catch (java.lang.Exception _exception)
+ {
+ return (java.lang.String[]) org.apache.axis.utils.JavaUtils
+ .convert(_resp, java.lang.String[].class);
+ }
+ }
+ }
+
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package uk.ac.ebi.www.picr.AccessionMappingService;\r
-\r
-public interface AccessionMapperInterface extends java.rmi.Remote\r
-{\r
- public uk.ac.ebi.picr.model.UPEntry getUPIForSequence(\r
- java.lang.String sequence, java.lang.String[] searchDatabases,\r
- java.lang.String taxonId, boolean onlyActive)\r
- throws java.rmi.RemoteException;\r
-\r
- public uk.ac.ebi.picr.model.UPEntry[] getUPIForAccession(\r
- java.lang.String accession, java.lang.String ac_version,\r
- java.lang.String[] searchDatabases, java.lang.String taxonId,\r
- boolean onlyActive) throws java.rmi.RemoteException;\r
-\r
- public java.lang.String[] getMappedDatabaseNames()\r
- throws java.rmi.RemoteException;\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package uk.ac.ebi.www.picr.AccessionMappingService;
+
+public interface AccessionMapperInterface extends java.rmi.Remote
+{
+ public uk.ac.ebi.picr.model.UPEntry getUPIForSequence(
+ java.lang.String sequence, java.lang.String[] searchDatabases,
+ java.lang.String taxonId, boolean onlyActive)
+ throws java.rmi.RemoteException;
+
+ public uk.ac.ebi.picr.model.UPEntry[] getUPIForAccession(
+ java.lang.String accession, java.lang.String ac_version,
+ java.lang.String[] searchDatabases, java.lang.String taxonId,
+ boolean onlyActive) throws java.rmi.RemoteException;
+
+ public java.lang.String[] getMappedDatabaseNames()
+ throws java.rmi.RemoteException;
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package uk.ac.ebi.www.picr.AccessionMappingService;\r
-\r
-public interface AccessionMapperService extends javax.xml.rpc.Service\r
-{\r
- public java.lang.String getAccessionMapperPortAddress();\r
-\r
- public uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperInterface getAccessionMapperPort()\r
- throws javax.xml.rpc.ServiceException;\r
-\r
- public uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperInterface getAccessionMapperPort(\r
- java.net.URL portAddress) throws javax.xml.rpc.ServiceException;\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package uk.ac.ebi.www.picr.AccessionMappingService;
+
+public interface AccessionMapperService extends javax.xml.rpc.Service
+{
+ public java.lang.String getAccessionMapperPortAddress();
+
+ public uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperInterface getAccessionMapperPort()
+ throws javax.xml.rpc.ServiceException;
+
+ public uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperInterface getAccessionMapperPort(
+ java.net.URL portAddress) throws javax.xml.rpc.ServiceException;
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package uk.ac.ebi.www.picr.AccessionMappingService;\r
-\r
-public class AccessionMapperServiceLocator extends\r
- org.apache.axis.client.Service implements\r
- uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperService\r
-{\r
-\r
- public AccessionMapperServiceLocator()\r
- {\r
- }\r
-\r
- public AccessionMapperServiceLocator(\r
- org.apache.axis.EngineConfiguration config)\r
- {\r
- super(config);\r
- }\r
-\r
- // Use to get a proxy class for AccessionMapperPort\r
- private java.lang.String AccessionMapperPort_address = "http://www.ebi.ac.uk:80/Tools/picr/service";\r
-\r
- public java.lang.String getAccessionMapperPortAddress()\r
- {\r
- return AccessionMapperPort_address;\r
- }\r
-\r
- // The WSDD service name defaults to the port name.\r
- private java.lang.String AccessionMapperPortWSDDServiceName = "AccessionMapperPort";\r
-\r
- public java.lang.String getAccessionMapperPortWSDDServiceName()\r
- {\r
- return AccessionMapperPortWSDDServiceName;\r
- }\r
-\r
- public void setAccessionMapperPortWSDDServiceName(java.lang.String name)\r
- {\r
- AccessionMapperPortWSDDServiceName = name;\r
- }\r
-\r
- public uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperInterface getAccessionMapperPort()\r
- throws javax.xml.rpc.ServiceException\r
- {\r
- java.net.URL endpoint;\r
- try\r
- {\r
- endpoint = new java.net.URL(AccessionMapperPort_address);\r
- } catch (java.net.MalformedURLException e)\r
- {\r
- throw new javax.xml.rpc.ServiceException(e);\r
- }\r
- return getAccessionMapperPort(endpoint);\r
- }\r
-\r
- public uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperInterface getAccessionMapperPort(\r
- java.net.URL portAddress) throws javax.xml.rpc.ServiceException\r
- {\r
- try\r
- {\r
- uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperBindingStub _stub = new uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperBindingStub(\r
- portAddress, this);\r
- _stub.setPortName(getAccessionMapperPortWSDDServiceName());\r
- return _stub;\r
- } catch (org.apache.axis.AxisFault e)\r
- {\r
- return null;\r
- }\r
- }\r
-\r
- public void setAccessionMapperPortEndpointAddress(java.lang.String address)\r
- {\r
- AccessionMapperPort_address = address;\r
- }\r
-\r
- /**\r
- * For the given interface, get the stub implementation. If this service has\r
- * no port for the given interface, 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 (uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperInterface.class\r
- .isAssignableFrom(serviceEndpointInterface))\r
- {\r
- uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperBindingStub _stub = new uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperBindingStub(\r
- new java.net.URL(AccessionMapperPort_address), this);\r
- _stub.setPortName(getAccessionMapperPortWSDDServiceName());\r
- return _stub;\r
- }\r
- } catch (java.lang.Throwable t)\r
- {\r
- throw new javax.xml.rpc.ServiceException(t);\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. If this service has\r
- * no port for the given interface, 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
- java.lang.String inputPortName = portName.getLocalPart();\r
- if ("AccessionMapperPort".equals(inputPortName))\r
- {\r
- return getAccessionMapperPort();\r
- }\r
- else\r
- {\r
- java.rmi.Remote _stub = getPort(serviceEndpointInterface);\r
- ((org.apache.axis.client.Stub) _stub).setPortName(portName);\r
- return _stub;\r
- }\r
- }\r
-\r
- public javax.xml.namespace.QName getServiceName()\r
- {\r
- return new javax.xml.namespace.QName(\r
- "http://www.ebi.ac.uk/picr/AccessionMappingService",\r
- "AccessionMapperService");\r
- }\r
-\r
- private java.util.HashSet ports = null;\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(\r
- "http://www.ebi.ac.uk/picr/AccessionMappingService",\r
- "AccessionMapperPort"));\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) throws javax.xml.rpc.ServiceException\r
- {\r
- if ("AccessionMapperPort".equals(portName))\r
- {\r
- setAccessionMapperPortEndpointAddress(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) throws javax.xml.rpc.ServiceException\r
- {\r
- setEndpointAddress(portName.getLocalPart(), address);\r
- }\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package uk.ac.ebi.www.picr.AccessionMappingService;
+
+public class AccessionMapperServiceLocator extends
+ org.apache.axis.client.Service implements
+ uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperService
+{
+
+ public AccessionMapperServiceLocator()
+ {
+ }
+
+ public AccessionMapperServiceLocator(
+ org.apache.axis.EngineConfiguration config)
+ {
+ super(config);
+ }
+
+ // Use to get a proxy class for AccessionMapperPort
+ private java.lang.String AccessionMapperPort_address = "http://www.ebi.ac.uk:80/Tools/picr/service";
+
+ public java.lang.String getAccessionMapperPortAddress()
+ {
+ return AccessionMapperPort_address;
+ }
+
+ // The WSDD service name defaults to the port name.
+ private java.lang.String AccessionMapperPortWSDDServiceName = "AccessionMapperPort";
+
+ public java.lang.String getAccessionMapperPortWSDDServiceName()
+ {
+ return AccessionMapperPortWSDDServiceName;
+ }
+
+ public void setAccessionMapperPortWSDDServiceName(java.lang.String name)
+ {
+ AccessionMapperPortWSDDServiceName = name;
+ }
+
+ public uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperInterface getAccessionMapperPort()
+ throws javax.xml.rpc.ServiceException
+ {
+ java.net.URL endpoint;
+ try
+ {
+ endpoint = new java.net.URL(AccessionMapperPort_address);
+ } catch (java.net.MalformedURLException e)
+ {
+ throw new javax.xml.rpc.ServiceException(e);
+ }
+ return getAccessionMapperPort(endpoint);
+ }
+
+ public uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperInterface getAccessionMapperPort(
+ java.net.URL portAddress) throws javax.xml.rpc.ServiceException
+ {
+ try
+ {
+ uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperBindingStub _stub = new uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperBindingStub(
+ portAddress, this);
+ _stub.setPortName(getAccessionMapperPortWSDDServiceName());
+ return _stub;
+ } catch (org.apache.axis.AxisFault e)
+ {
+ return null;
+ }
+ }
+
+ public void setAccessionMapperPortEndpointAddress(java.lang.String address)
+ {
+ AccessionMapperPort_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 (uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperInterface.class
+ .isAssignableFrom(serviceEndpointInterface))
+ {
+ uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperBindingStub _stub = new uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperBindingStub(
+ new java.net.URL(AccessionMapperPort_address), this);
+ _stub.setPortName(getAccessionMapperPortWSDDServiceName());
+ 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 ("AccessionMapperPort".equals(inputPortName))
+ {
+ return getAccessionMapperPort();
+ }
+ 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(
+ "http://www.ebi.ac.uk/picr/AccessionMappingService",
+ "AccessionMapperService");
+ }
+
+ private java.util.HashSet ports = null;
+
+ public java.util.Iterator getPorts()
+ {
+ if (ports == null)
+ {
+ ports = new java.util.HashSet();
+ ports.add(new javax.xml.namespace.QName(
+ "http://www.ebi.ac.uk/picr/AccessionMappingService",
+ "AccessionMapperPort"));
+ }
+ 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 ("AccessionMapperPort".equals(portName))
+ {
+ setAccessionMapperPortEndpointAddress(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);
+ }
+
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package vamsas.objects.simple;\r
-\r
-public class SeqSearchResult extends vamsas.objects.simple.Result implements\r
- java.io.Serializable\r
-{\r
- private vamsas.objects.simple.Alignment alignment;\r
-\r
- private java.lang.String annotation;\r
-\r
- private java.lang.String features;\r
-\r
- private java.lang.String newickTree;\r
-\r
- public SeqSearchResult()\r
- {\r
- }\r
-\r
- public SeqSearchResult(vamsas.objects.simple.Alignment alignment,\r
- java.lang.String annotation, java.lang.String features,\r
- java.lang.String newickTree)\r
- {\r
- this.alignment = alignment;\r
- this.annotation = annotation;\r
- this.features = features;\r
- this.newickTree = newickTree;\r
- }\r
-\r
- /**\r
- * Gets the alignment value for this SeqSearchResult.\r
- * \r
- * @return alignment\r
- */\r
- public vamsas.objects.simple.Alignment getAlignment()\r
- {\r
- return alignment;\r
- }\r
-\r
- /**\r
- * Sets the alignment value for this SeqSearchResult.\r
- * \r
- * @param alignment\r
- */\r
- public void setAlignment(vamsas.objects.simple.Alignment alignment)\r
- {\r
- this.alignment = alignment;\r
- }\r
-\r
- /**\r
- * Gets the annotation value for this SeqSearchResult.\r
- * \r
- * @return annotation\r
- */\r
- public java.lang.String getAnnotation()\r
- {\r
- return annotation;\r
- }\r
-\r
- /**\r
- * Sets the annotation value for this SeqSearchResult.\r
- * \r
- * @param annotation\r
- */\r
- public void setAnnotation(java.lang.String annotation)\r
- {\r
- this.annotation = annotation;\r
- }\r
-\r
- /**\r
- * Gets the features value for this SeqSearchResult.\r
- * \r
- * @return features\r
- */\r
- public java.lang.String getFeatures()\r
- {\r
- return features;\r
- }\r
-\r
- /**\r
- * Sets the features value for this SeqSearchResult.\r
- * \r
- * @param features\r
- */\r
- public void setFeatures(java.lang.String features)\r
- {\r
- this.features = features;\r
- }\r
-\r
- /**\r
- * Gets the newickTree value for this SeqSearchResult.\r
- * \r
- * @return newickTree\r
- */\r
- public java.lang.String getNewickTree()\r
- {\r
- return newickTree;\r
- }\r
-\r
- /**\r
- * Sets the newickTree value for this SeqSearchResult.\r
- * \r
- * @param newickTree\r
- */\r
- public void setNewickTree(java.lang.String newickTree)\r
- {\r
- this.newickTree = newickTree;\r
- }\r
-\r
- private java.lang.Object __equalsCalc = null;\r
-\r
- public synchronized boolean equals(java.lang.Object obj)\r
- {\r
- if (!(obj instanceof SeqSearchResult))\r
- return false;\r
- SeqSearchResult other = (SeqSearchResult) obj;\r
- if (obj == null)\r
- return false;\r
- if (this == obj)\r
- return true;\r
- if (__equalsCalc != null)\r
- {\r
- return (__equalsCalc == obj);\r
- }\r
- __equalsCalc = obj;\r
- boolean _equals;\r
- _equals = super.equals(obj)\r
- && ((this.alignment == null && other.getAlignment() == null) || (this.alignment != null && this.alignment\r
- .equals(other.getAlignment())))\r
- && ((this.annotation == null && other.getAnnotation() == null) || (this.annotation != null && this.annotation\r
- .equals(other.getAnnotation())))\r
- && ((this.features == null && other.getFeatures() == null) || (this.features != null && this.features\r
- .equals(other.getFeatures())))\r
- && ((this.newickTree == null && other.getNewickTree() == null) || (this.newickTree != null && this.newickTree\r
- .equals(other.getNewickTree())));\r
- __equalsCalc = null;\r
- return _equals;\r
- }\r
-\r
- private boolean __hashCodeCalc = false;\r
-\r
- public synchronized int hashCode()\r
- {\r
- if (__hashCodeCalc)\r
- {\r
- return 0;\r
- }\r
- __hashCodeCalc = true;\r
- int _hashCode = super.hashCode();\r
- if (getAlignment() != null)\r
- {\r
- _hashCode += getAlignment().hashCode();\r
- }\r
- if (getAnnotation() != null)\r
- {\r
- _hashCode += getAnnotation().hashCode();\r
- }\r
- if (getFeatures() != null)\r
- {\r
- _hashCode += getFeatures().hashCode();\r
- }\r
- if (getNewickTree() != null)\r
- {\r
- _hashCode += getNewickTree().hashCode();\r
- }\r
- __hashCodeCalc = false;\r
- return _hashCode;\r
- }\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package vamsas.objects.simple;
+
+public class SeqSearchResult extends vamsas.objects.simple.Result implements
+ java.io.Serializable
+{
+ private vamsas.objects.simple.Alignment alignment;
+
+ private java.lang.String annotation;
+
+ private java.lang.String features;
+
+ private java.lang.String newickTree;
+
+ public SeqSearchResult()
+ {
+ }
+
+ public SeqSearchResult(vamsas.objects.simple.Alignment alignment,
+ java.lang.String annotation, java.lang.String features,
+ java.lang.String newickTree)
+ {
+ this.alignment = alignment;
+ this.annotation = annotation;
+ this.features = features;
+ this.newickTree = newickTree;
+ }
+
+ /**
+ * Gets the alignment value for this SeqSearchResult.
+ *
+ * @return alignment
+ */
+ public vamsas.objects.simple.Alignment getAlignment()
+ {
+ return alignment;
+ }
+
+ /**
+ * Sets the alignment value for this SeqSearchResult.
+ *
+ * @param alignment
+ */
+ public void setAlignment(vamsas.objects.simple.Alignment alignment)
+ {
+ this.alignment = alignment;
+ }
+
+ /**
+ * Gets the annotation value for this SeqSearchResult.
+ *
+ * @return annotation
+ */
+ public java.lang.String getAnnotation()
+ {
+ return annotation;
+ }
+
+ /**
+ * Sets the annotation value for this SeqSearchResult.
+ *
+ * @param annotation
+ */
+ public void setAnnotation(java.lang.String annotation)
+ {
+ this.annotation = annotation;
+ }
+
+ /**
+ * Gets the features value for this SeqSearchResult.
+ *
+ * @return features
+ */
+ public java.lang.String getFeatures()
+ {
+ return features;
+ }
+
+ /**
+ * Sets the features value for this SeqSearchResult.
+ *
+ * @param features
+ */
+ public void setFeatures(java.lang.String features)
+ {
+ this.features = features;
+ }
+
+ /**
+ * Gets the newickTree value for this SeqSearchResult.
+ *
+ * @return newickTree
+ */
+ public java.lang.String getNewickTree()
+ {
+ return newickTree;
+ }
+
+ /**
+ * Sets the newickTree value for this SeqSearchResult.
+ *
+ * @param newickTree
+ */
+ public void setNewickTree(java.lang.String newickTree)
+ {
+ this.newickTree = newickTree;
+ }
+
+ private java.lang.Object __equalsCalc = null;
+
+ public synchronized boolean equals(java.lang.Object obj)
+ {
+ if (!(obj instanceof SeqSearchResult))
+ return false;
+ SeqSearchResult other = (SeqSearchResult) 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.alignment == null && other.getAlignment() == null) || (this.alignment != null && this.alignment
+ .equals(other.getAlignment())))
+ && ((this.annotation == null && other.getAnnotation() == null) || (this.annotation != null && this.annotation
+ .equals(other.getAnnotation())))
+ && ((this.features == null && other.getFeatures() == null) || (this.features != null && this.features
+ .equals(other.getFeatures())))
+ && ((this.newickTree == null && other.getNewickTree() == null) || (this.newickTree != null && this.newickTree
+ .equals(other.getNewickTree())));
+ __equalsCalc = null;
+ return _equals;
+ }
+
+ private boolean __hashCodeCalc = false;
+
+ public synchronized int hashCode()
+ {
+ if (__hashCodeCalc)
+ {
+ return 0;
+ }
+ __hashCodeCalc = true;
+ int _hashCode = super.hashCode();
+ if (getAlignment() != null)
+ {
+ _hashCode += getAlignment().hashCode();
+ }
+ if (getAnnotation() != null)
+ {
+ _hashCode += getAnnotation().hashCode();
+ }
+ if (getFeatures() != null)
+ {
+ _hashCode += getFeatures().hashCode();
+ }
+ if (getNewickTree() != null)
+ {
+ _hashCode += getNewickTree().hashCode();
+ }
+ __hashCodeCalc = false;
+ return _hashCode;
+ }
+
+}
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package vamsas.objects.simple;\r
-\r
-public class SeqSearchResult_Helper\r
-{\r
- // Type metadata\r
- private static org.apache.axis.description.TypeDesc typeDesc = new org.apache.axis.description.TypeDesc(\r
- SeqSearchResult.class, true);\r
-\r
- static\r
- {\r
- typeDesc.setXmlType(new javax.xml.namespace.QName(\r
- "simple.objects.vamsas", "SeqSearchResult"));\r
- org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();\r
- elemField.setFieldName("alignment");\r
- elemField.setXmlName(new javax.xml.namespace.QName("", "alignment"));\r
- elemField.setXmlType(new javax.xml.namespace.QName(\r
- "simple.objects.vamsas", "Alignment"));\r
- typeDesc.addFieldDesc(elemField);\r
- elemField = new org.apache.axis.description.ElementDesc();\r
- elemField.setFieldName("annotation");\r
- elemField.setXmlName(new javax.xml.namespace.QName("", "annotation"));\r
- elemField.setXmlType(new javax.xml.namespace.QName(\r
- "http://schemas.xmlsoap.org/soap/encoding/", "string"));\r
- typeDesc.addFieldDesc(elemField);\r
- elemField = new org.apache.axis.description.ElementDesc();\r
- elemField.setFieldName("features");\r
- elemField.setXmlName(new javax.xml.namespace.QName("", "features"));\r
- elemField.setXmlType(new javax.xml.namespace.QName(\r
- "http://schemas.xmlsoap.org/soap/encoding/", "string"));\r
- typeDesc.addFieldDesc(elemField);\r
- elemField = new org.apache.axis.description.ElementDesc();\r
- elemField.setFieldName("newickTree");\r
- elemField.setXmlName(new javax.xml.namespace.QName("", "newickTree"));\r
- elemField.setXmlType(new javax.xml.namespace.QName(\r
- "http://schemas.xmlsoap.org/soap/encoding/", "string"));\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
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package vamsas.objects.simple;
+
+public class SeqSearchResult_Helper
+{
+ // Type metadata
+ private static org.apache.axis.description.TypeDesc typeDesc = new org.apache.axis.description.TypeDesc(
+ SeqSearchResult.class, true);
+
+ static
+ {
+ typeDesc.setXmlType(new javax.xml.namespace.QName(
+ "simple.objects.vamsas", "SeqSearchResult"));
+ org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
+ elemField.setFieldName("alignment");
+ elemField.setXmlName(new javax.xml.namespace.QName("", "alignment"));
+ elemField.setXmlType(new javax.xml.namespace.QName(
+ "simple.objects.vamsas", "Alignment"));
+ typeDesc.addFieldDesc(elemField);
+ elemField = new org.apache.axis.description.ElementDesc();
+ elemField.setFieldName("annotation");
+ elemField.setXmlName(new javax.xml.namespace.QName("", "annotation"));
+ elemField.setXmlType(new javax.xml.namespace.QName(
+ "http://schemas.xmlsoap.org/soap/encoding/", "string"));
+ typeDesc.addFieldDesc(elemField);
+ elemField = new org.apache.axis.description.ElementDesc();
+ elemField.setFieldName("features");
+ elemField.setXmlName(new javax.xml.namespace.QName("", "features"));
+ elemField.setXmlType(new javax.xml.namespace.QName(
+ "http://schemas.xmlsoap.org/soap/encoding/", "string"));
+ typeDesc.addFieldDesc(elemField);
+ elemField = new org.apache.axis.description.ElementDesc();
+ elemField.setFieldName("newickTree");
+ elemField.setXmlName(new javax.xml.namespace.QName("", "newickTree"));
+ elemField.setXmlType(new javax.xml.namespace.QName(
+ "http://schemas.xmlsoap.org/soap/encoding/", "string"));
+ 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);
+ }
+
+}
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
package jalview.io;
import static org.junit.Assert.*;
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
package jalview.schemes;
import java.util.Map;
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
package jalview.ws.gui;
import static org.junit.Assert.assertTrue;
<?xml version="1.0"?>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+
+ This file is part of Jalview.
+
+ Jalview is free software: you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+
+ Jalview is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty
+ of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
-->
<project name="jalviewInstallAnywhere" default="build" basedir=".">
<property name="IA_LOCATION" value="/homes/ws-dev1/Macrovision/InstallAnywhere_2008_VP1_Standard"/>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+
+ This file is part of Jalview.
+
+ Jalview is free software: you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+
+ Jalview is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty
+ of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
-->
<profiles version="11">
<profile kind="CodeFormatterProfile" name="Jalview" version="11">
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+#!/usr/bin/perl
#*******************************************************************************
-# Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
-# Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+# Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+# Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
#
# This file is part of Jalview.
#
#
# You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
#*******************************************************************************
-#!/usr/bin/perl
-# Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
-# Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
-#
-# This file is part of Jalview.
-#
-# Jalview is free software: you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
-#
-# Jalview is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty
-# of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-# PURPOSE. See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
-
use strict;
use warnings;
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-<html><head>
-<!--
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
--->
+<html>
+<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title></title><link rel="stylesheet" href="./docs/site.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"></head><body id="toppage" bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table width="700" border="0" cellpadding="0" cellspacing="0" align="center"><tr><td><table cellpadding="0" cellspacing="0" width="100%" style="border:1px solid #336699"><tbody><tr><td height="16"></td></tr><tr><td bgcolor="#3399cc" height="1"></td></tr><tr style="border:none"><td style="border:none"><table border="0" cellspacing="0" cellpadding="0"><tbody><tr><td class="logo">JALOPY</td><td class="sublogo" valign="bottom">Java Source Code Formatter Beautifier Pretty Printer</td></tr></tbody></table></td></tr><tr><td bgcolor="#3399cc" height="1"></td></tr><tr><td height="10"></td></tr><tr><td bgcolor="#ff8000" height="4"></td></tr><tr><td height="20" bgcolor="#336699" style="color:#ffffff;padding-left:10px"><a href="./docs/index.html" class="navlink">Overview</a> •
<a href="./docs/download.html" class="navlink">Download</a> •
+#!/usr/bin/perl
#*******************************************************************************
-# Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
-# Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+# Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+# Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
#
# This file is part of Jalview.
#
#
# You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
#*******************************************************************************
-#!/usr/bin/perl
use strict;
-# Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
-# Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
-#
-# This file is part of Jalview.
-#
-# Jalview is free software: you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
-#
-# Jalview is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty
-# of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-# PURPOSE. See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
-
-
# perverse script to get rid of unwanted jar signatures
use Cwd qw(abs_path);
use File::Temp qw(tempdir);
+#!/bin/perl
#*******************************************************************************
-# Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
-# Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+# Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+# Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
#
# This file is part of Jalview.
#
#
# You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
#*******************************************************************************
-#!/bin/perl
use strict;
use Env qw($GTID);
+#!/usr/bin/perl
#*******************************************************************************
# Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
# Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
#
# You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
#*******************************************************************************
-#!/usr/bin/perl\r
+\r
# Splits a concatenated set of Stockholm Files into several individual files.\r
\r
use strict;\r