<echo message="build - compiles all necessary files for Application" />
<echo message="makedist - compiles and places all necessary jar files into directory dist" />
<echo message="makefulldist - signs all jar files and builds jnlp file for full distribution" />
- <echo message=" this needs a keystore and key. Add -Dtimestamp to timestamp signed jars"/>
+ <echo message=" this needs a keystore and key."/>
+ <echo message=" Add -Dtimestamp to timestamp signed jars"/>
+ <echo message=" -Djalview.keyalg and -Djalview.keydig are SHA1/SHA1withRSA"/>
<echo message=" See docs/building.html for more information." />
<echo message="compileApplet - compiles all necessary files for Applet" />
<echo message="makeApplet - compiles, then packages and obfuscates the Applet" />
<!-- locally valid proxy for signing with external time server -->
<property name="proxyPort" value="80"/>
<property name="proxyHost" value="sqid"/>
+ <!-- key sign/digest algorithms -->
+ <property name="jalview.keyalg" value="SHA1withRSA" description="key algorithm for signing"/>
+ <property name="jalview.keydig" value="SHA1" description="algorithm for jar digest"/>
<!-- default TestNG groups to run -->
<property name="testng-groups" value="Functional" />
</target>
<target name="-jarsignwithtsa" depends="makedist,preparejnlp" if="timestamp">
- <signjar storepass="${jalview.keystore.pass}" keypass="${jalview.key.pass}" keystore="${jalview.keystore}" alias="${jalview.key}" lazy="false" verbose="false" sigalg="SHA1withRSA"
+ <signjar storepass="${jalview.keystore.pass}" keypass="${jalview.key.pass}" keystore="${jalview.keystore}" alias="${jalview.key}" lazy="false" verbose="false" sigalg="${jalview.keyalg}" digestalg="${jalview.keydig}"
tsaproxyhost="${proxyHost}" tsaproxyport="${proxyPort}" tsaurl="${jalview.tsaurl}">
<fileset dir="${packageDir}">
<include name="*.jar" />
</signjar>
</target>
<target name="-jarsignnotsa" depends="makedist,preparejnlp" unless="timestamp">
- <signjar storepass="${jalview.keystore.pass}" keypass="${jalview.key.pass}" keystore="${jalview.keystore}" alias="${jalview.key}" lazy="false" verbose="false" sigalg="SHA1withRSA">
+ <signjar storepass="${jalview.keystore.pass}" keypass="${jalview.key.pass}" keystore="${jalview.keystore}" alias="${jalview.key}" lazy="false" verbose="false" sigalg="${jalview.keyalg}" digestalg="${jalview.keydig}">
<fileset dir="${packageDir}">
<include name="*.jar" />
</fileset>
<p>
You will need the following (hopefully):<br>
<ul>
-<li>Java development kit (JDK1.6 is the recommended platform for developing with Jalview, although JDK1.7 seems to work too!).</li>
-<li>Ant (we think 1.5.4 is quite sufficient to use the simple build
-file supplied, and it seems to work with later versions e.g. 1.7).</li>
+<li>Java development kit (JDK1.8 is now the recommended platform for developing with Jalview.</li>
+<li>Ant (1.7 or later will be needed for some of the jarsigning tools).</li>
</ul>
With any luck, after setting your paths and JAVA_HOME correctly, you
just need to change to the Jalview directory and run ant (this works
-from JBuilder and eclipse too, but NetBeans is a bit trickier).
+from eclipse too, but NetBeans is a bit trickier).
<pre>
ant
</pre>
dist. But first you need to make your own key:
<p><strong>Making your own key</strong></p>
-<p>The ant 'makefulldist' target assumes that a keystore exists in a
-directory 'keys'. To make a key accessible using the default settings
-in the build.xml file then make the keys directory and add the
-jarsigner key with the following :
-</p>
-<pre>
-mkdir keys
-keytool -genkey -keystore keys/.keystore -keypass alignmentisfun
--storepass alignmentisfun -alias jalview
- (you will have to answer some personal questions here)
-ant makedist
- (should eventually generate a Jalview.jnlp file
- in ./dist along with a set of signed jars using the jalview
- key)
-</pre>
-
- <p>
+ <p>The ant 'makefulldist' target assumes that a keystore exists in
+ a directory 'keys'. To make a key accessible using the default
+ settings in the build.xml file then make the keys directory and add
+ the jarsigner key with the following :</p>
+ <pre>mkdir keys</pre>
+ <pre>keytool -genkey -keystore keys/.keystore -keypass alignmentisfun
+ -storepass alignmentisfun -sigalg SHA1withRSA -keyalg RSA -alias jalview</pre>
+ <em>(you will have to answer some personal questions here)</em>
+ <pre>ant makedist -DWebStartLocation="file://.pathtojalviewsource./dist" -Dapplication.codebase="*"</pre>
+ <p>This should eventually generate a jalview.jnlp file in ./dist
+ along with a set of signed jars using the jalview key). In order to
+ test locally via webstart you'll now need to add 'file:/' to your
+ java webstart security exception list. Then:</p>
+ <pre>javaws file://.pathtojalviewsource./dist/jalview.jnlp</pre>
+ <p>Please remember to remove that entry afterwards, since it will leave
+ your system vulnerable to malicious code.
+ </p>
+ <p>
<strong>Building the JalviewLite applet<br>
</strong> The JalviewLite applet is compiled using a subset of the packages in
the src directory (specifically: MCView, and jalview.{datamodel,
<div id="view_decorated" name="view_decorated" style="margin:8px; padding:10px; border: 2px solid red; text-align:center; display:none;"><b>Click <a href="index.html#appletDeployment"> here</a> to view decorated page</b></div>
<!-- content start -->
-<h2><a name="appletdeploymentnotes"/>Notes on applet deployment</h2>
+<h2><a name="appletDeployment"/>Notes on applet deployment</h2>
+<table width=80% border="1">
+ <tr><th colspan="2" align="center">Required Dependency Downloads</th></tr>
+ <tr>
+ <th>Dependency</th>
+ <th>Description</th>
+ </tr>
+ <tr>
+ <td><a href="http://www.jalview.org/builds/develop/examples/jalviewApplet.jar">JalviewApplet.jar</a> </td>
+ <td>Main Jalview Applet Jar</td>
+ </tr>
+ <tr>
+ <td><a href="http://www.jalview.org/builds/develop/examples/JmolApplet-14.2.14_2015.06.11.jar">JmolApplet-14.2.14_2015.06.11.jar</a> </td>
+ <td>Jmol Applet Jar</td>
+ </tr>
+ <tr>
+ <td><a href="http://www.jalview.org/builds/develop/examples/java-json.jar">java-json.jar</a></td>
+ <td>Required for BioJSON Generation</td>
+ </tr>
+ <tr>
+ <td><a href="http://www.jalview.org/builds/develop/examples/json_simple-1.1.jar">json_simple-1.1.jar</a></td>
+ <td>Required for BioJSON Generation</td>
+ </tr>
+</table>
+
<ul>
<li>Package all your data files into a single (or multiple) zip / jar
files. This is very useful to reduce download time of large data files.
the applet can be interacted with <em>via</em> its
<a href="javascript:doSubmit('jalviewLiteJs')">Javascript API</a>.
</p><p><strong>Issues arising from tightening of Java Security default settings</strong><br/>JalviewLite is provided as a signed applet with 'sandbox' permissions and wildcards that allow it to be run from any website. Unfortunately, earlier versions of Java may not be compatible with these settings. </p>
- <p>For additional deployment notes, <a href="#appletdeploymentnotes">see below</a>.</p>
+ <p>For additional deployment notes, <a href="javascript:doSubmit('appletDeployment')">see Applet Deployment</a>.</p>
<p><h2>Applet Parameters</h2><br/>The applet takes the following initialisation parameters.</p>
<a name="parameters"></a> <table width="97%" class="borderTable" align="center" >
<tr>
ST-MOTIF ac25a1
STARTGROUP uniprot
+<html><a href="http://pfam.xfam.org/family/PF00111">Pfam family</a></html> FER_CAPAA -1 0 0 Pfam
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
+<html>Fer2 Status: True Positive <a href="http://pfam.xfam.org/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
+<html>Fer2 Status: True Positive <a href="http://pfam.xfam.org/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
+<html>Fer2 Status: True Positive <a href="http://pfam.xfam.org/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
+<html>Fer2 Status: True Positive <a href="http://pfam.xfam.org/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
+<html>Fer2 Status: True Positive <a href="http://pfam.xfam.org/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
+<html>Fer2 Status: True Positive <a href="http://pfam.xfam.org/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
+<html>Fer2 Status: True Positive <a href="http://pfam.xfam.org/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
+<html>Fer2 Status: True Positive <a href="http://pfam.xfam.org/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
+<html>Fer2 Status: True Positive <a href="http://pfam.xfam.org/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
+<html>Fer2 Status: True Positive <a href="http://pfam.xfam.org/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
+<html>Fer2 Status: True Positive <a href="http://pfam.xfam.org/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
+<html>Fer2 Status: True Positive <a href="http://pfam.xfam.org/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
+<html>Fer2 Status: True Positive <a href="http://pfam.xfam.org/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
+<html>Fer2 Status: True Positive <a href="http://pfam.xfam.org/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
* The Jalview Authors are detailed in the 'AUTHORS' file.
*/
// do something groovy in jalview
-print "Hello World.\n";
-def alf = Jalview.getAlignFrames();
+println "Hello World.\n"
+println "First sequence is " + currentAlFrame.viewport.alignment.getSequenceAt(0).getDisplayId(true)
+
+def alf = Jalview.getAlignFrames()
for (ala in alf)
{
// ala is an jalview.gui.AlignFrame object
- print ala.getTitle()+"\n";
+ println ala.getTitle()
// get the parent jalview.datamodel.Alignment from the alignment viewport
- def alignment = ala.viewport.alignment;
+ def alignment = ala.viewport.alignment
// get the first sequence from the jalview.datamodel.Alignment object
- def seq = alignment.getSequenceAt(0);
+ def seq = alignment.getSequenceAt(0)
}
+Jalview.quit()
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>Description: Fer2 Status: True Positive <a href="http://pfam.sanger.ac.uk/family/PF00111">Pfam 8_83</a></html> FER_CAPAA -1 8 83 Pfam
+<html>Description: Fer2 Status: True Positive <a href="http://pfam.xfam.org/family/PF00111">Pfam 8_83</a></html> FER_CAPAA -1 8 83 Pfam
Chloroplast FER_CAPAN -1 1 47 TRANSIT
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
Phosphothreonine FER_CAPAN -1 136 136 MOD_RES
-<html>Description: Fer2 Status: True Positive <a href="http://pfam.sanger.ac.uk/family/PF00111">Pfam 55_130</a></html> FER_CAPAN -1 55 130 Pfam
+<html>Description: Fer2 Status: True Positive <a href="http://pfam.xfam.org/family/PF00111">Pfam 55_130</a></html> FER_CAPAN -1 55 130 Pfam
Chloroplast FER1_SOLLC -1 1 47 TRANSIT
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>Description: Fer2 Status: True Positive <a href="http://pfam.sanger.ac.uk/family/PF00111">Pfam 55_130</a></html> FER1_SOLLC -1 55 130 Pfam
+<html>Description: Fer2 Status: True Positive <a href="http://pfam.xfam.org/family/PF00111">Pfam 55_130</a></html> FER1_SOLLC -1 55 130 Pfam
Evidence: EI4 Q93XJ9_SOLTU -1 1 48 SIGNAL
-<html>Description: Fer2 Status: True Positive <a href="http://pfam.sanger.ac.uk/family/PF00111">Pfam 55_130</a></html> Q93XJ9_SOLTU -1 55 130 Pfam
+<html>Description: Fer2 Status: True Positive <a href="http://pfam.xfam.org/family/PF00111">Pfam 55_130</a></html> Q93XJ9_SOLTU -1 55 130 Pfam
Chloroplast FER1_PEA -1 1 52 TRANSIT
L -> I (in strain: cv. Onward) FER1_PEA -1 59 59 VARIANT
I -> L (in strain: cv. Onward) FER1_PEA -1 85 85 VARIANT
Iron-sulfur (2Fe-2S) FER1_PEA -1 99 99 METAL
Iron-sulfur (2Fe-2S) FER1_PEA -1 129 129 METAL
YPTS -> PPPA (in Ref. 2) FER1_PEA -1 132 135 CONFLICT
-<html>Description: Fer2 Status: True Positive <a href="http://pfam.sanger.ac.uk/family/PF00111">Pfam 60_135</a></html> FER1_PEA -1 60 135 Pfam
-<html>Description: Fer2 Status: True Positive <a href="http://pfam.sanger.ac.uk/family/PF00111">Pfam 63_138</a></html> Q7XA98_TRIPR -1 63 138 Pfam
+<html>Description: Fer2 Status: True Positive <a href="http://pfam.xfam.org/family/PF00111">Pfam 60_135</a></html> FER1_PEA -1 60 135 Pfam
+<html>Description: Fer2 Status: True Positive <a href="http://pfam.xfam.org/family/PF00111">Pfam 63_138</a></html> Q7XA98_TRIPR -1 63 138 Pfam
Chloroplast FER1_MESCR -1 1 51 TRANSIT
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>Description: Fer2 Status: True Positive <a href="http://pfam.sanger.ac.uk/family/PF00111">Pfam 59_134</a></html> FER1_MESCR -1 59 134 Pfam
+<html>Description: Fer2 Status: True Positive <a href="http://pfam.xfam.org/family/PF00111">Pfam 59_134</a></html> FER1_MESCR -1 59 134 Pfam
Chloroplast FER1_SPIOL -1 1 50 TRANSIT
STRAND FER1_SPIOL -1 52 59 STRAND
TURN FER1_SPIOL -1 60 61 TURN
STRAND FER1_SPIOL -1 130 133 STRAND
STRAND FER1_SPIOL -1 135 138 STRAND
HELIX FER1_SPIOL -1 142 144 HELIX
-<html>Description: Fer2 Status: True Positive <a href="http://pfam.sanger.ac.uk/family/PF00111">Pfam 58_133</a></html> FER1_SPIOL -1 58 133 Pfam
+<html>Description: Fer2 Status: True Positive <a href="http://pfam.xfam.org/family/PF00111">Pfam 58_133</a></html> FER1_SPIOL -1 58 133 Pfam
I -> V FER3_RAPSA -1 8 8 VARIANT
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 77 77 METAL
R -> K FER3_RAPSA -1 91 91 VARIANT
M -> V FER3_RAPSA -1 95 95 VARIANT
-<html>Description: Fer2 Status: True Positive <a href="http://pfam.sanger.ac.uk/family/PF00111">Pfam 8_83</a></html> FER3_RAPSA -1 8 83 Pfam
+<html>Description: Fer2 Status: True Positive <a href="http://pfam.xfam.org/family/PF00111">Pfam 8_83</a></html> FER3_RAPSA -1 8 83 Pfam
Chloroplast FER1_ARATH -1 1 52 TRANSIT
Iron-sulfur (2Fe-2S) FER1_ARATH -1 91 91 METAL
Iron-sulfur (2Fe-2S) FER1_ARATH -1 96 96 METAL
Iron-sulfur (2Fe-2S) FER1_ARATH -1 99 99 METAL
Iron-sulfur (2Fe-2S) FER1_ARATH -1 129 129 METAL
-<html>Description: Fer2 Status: True Positive <a href="http://pfam.sanger.ac.uk/family/PF00111">Pfam 60_135</a></html> FER1_ARATH -1 60 135 Pfam
+<html>Description: Fer2 Status: True Positive <a href="http://pfam.xfam.org/family/PF00111">Pfam 60_135</a></html> FER1_ARATH -1 60 135 Pfam
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>Description: Fer2 Status: True Positive <a href="http://pfam.sanger.ac.uk/family/PF00111">Pfam 8_83</a></html> FER_BRANA -1 8 83 Pfam
+<html>Description: Fer2 Status: True Positive <a href="http://pfam.xfam.org/family/PF00111">Pfam 8_83</a></html> FER_BRANA -1 8 83 Pfam
Chloroplast FER2_ARATH -1 1 52 TRANSIT
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>Description: Fer2 Status: True Positive <a href="http://pfam.sanger.ac.uk/family/PF00111">Pfam 60_135</a></html> FER2_ARATH -1 60 135 Pfam
-<html>Description: Fer2 Status: True Positive <a href="http://pfam.sanger.ac.uk/family/PF00111">Pfam 60_118</a></html> Q93Z60_ARATH -1 60 118 Pfam
+<html>Description: Fer2 Status: True Positive <a href="http://pfam.xfam.org/family/PF00111">Pfam 60_135</a></html> FER2_ARATH -1 60 135 Pfam
+<html>Description: Fer2 Status: True Positive <a href="http://pfam.xfam.org/family/PF00111">Pfam 60_118</a></html> Q93Z60_ARATH -1 60 118 Pfam
Chloroplast FER1_MAIZE -1 1 52 TRANSIT
STRAND FER1_MAIZE -1 57 59 STRAND
STRAND FER1_MAIZE -1 72 74 STRAND
STRAND FER1_MAIZE -1 132 135 STRAND
STRAND FER1_MAIZE -1 137 141 STRAND
TURN FER1_MAIZE -1 142 142 TURN
-<html>Description: Fer2 Status: True Positive <a href="http://pfam.sanger.ac.uk/family/PF00111">Pfam 60_135</a></html> FER1_MAIZE -1 60 135 Pfam
-<html>Description: Fer2 Status: True Positive <a href="http://pfam.sanger.ac.uk/family/PF00111">Pfam 52_127</a></html> O80429_MAIZE -1 52 127 Pfam
+<html>Description: Fer2 Status: True Positive <a href="http://pfam.xfam.org/family/PF00111">Pfam 60_135</a></html> FER1_MAIZE -1 60 135 Pfam
+<html>Description: Fer2 Status: True Positive <a href="http://pfam.xfam.org/family/PF00111">Pfam 52_127</a></html> O80429_MAIZE -1 52 127 Pfam
ENDGROUP uniprot
function() {
subCatContainer.scrollTop($(this).scrollTop());
});
-</script></hmtl>
\ No newline at end of file
+</script></html>
<strong>Normalise Consensus Logo</strong> to scale all columns of the
logo to the same height.
+ <p>
+ <strong>Group Consensus</strong><br>
+ If sequence groups have been defined, then selecting option 'Group Consensus' in the <a href="../menus/alwannotation.html">Annotations menu</a> will
+ result in Consensus being calculated for each group, as well as the alignment as a whole.
+ </p>
<p>
<strong>cDNA Consensus</strong>
</p>
(e.g. !proline).
</p>
<p>
- <em>Colouring an alignment by conservation</em><br>
+ <strong>Colouring an alignment by conservation</strong><br>
Conservation scores can be used to colour an alignment. This is
explained further in the help page for <a
href="../colourSchemes/conservation.html"
>conservation colouring</a>.
</p>
+ <p>
+ <strong>Group conservation</strong><br>
+ If sequence groups have been defined, then selecting option 'Group Conservation' in the <a href="../menus/alwannotation.html">Annotations menu</a> will
+ result in Conservation being calculated for each group, as well as the alignment as a whole.
+ </p>
</body>
</html>
href="../webServices/proteinDisorder.html">disordered region</a>
prediction methods.
</p>
+<p><strong>Sequence Group Annotation</strong>
+</p>
+<p>
+ If sequence groups are defined, <a href="../calculations/conservation.html">Conservation</a>
+ and <a href="../calculations/consensus.html">Consensus</a> annotation can be enabled
+ for each group from the <a href="../menus/alwannotation.html">Annotations menu</a>, or can
+ be imported from a Jalview <a href="annotationsFormat.html">Annotations file</a>.
+</p>
+<p><strong>Sequence Selection from Annotation</strong>
+</p>
+<p>
+ Sequences associated with sequence (or sequence group) annotations can be selected by
+ double-clicking the annotation label with these key combinations:
+ <ul>
+ <li>double-click - Select associated sequences (replaces current selection)</li>
+ <li>shift double-click - add sequences to selection</li>
+ <li>Ctrl (Mac CMD) double-click - toggles inclusion of associated sequences in the current selection</li>
+ </ul>
+ Note this also works in combination with manual sequence selection in the alignment.
<p><strong>Interactive Alignment Annotation</strong></p>
<p>
Annotation rows are added using the <strong>Annotation Label</strong>
followed by a <em>description</em> for the row, which is shown in a
tooltip when the user mouses over the annotation row's label. Since
Jalview 2.7, the description field may also contain HTML tags (in
- the same way as a <a href="featuresFile.html">sequence feature's</a>
+ the same way as a <a href="featuresFormat.html">sequence feature's</a>
label), providing the text is enclosed in an <html/> tag.
<ul>
<em>Please note: URL links embedded in HTML descriptions are
* The Jalview Authors are detailed in the 'AUTHORS' file.
-->
<head>
-<title>BioJSON in Jalviwe</title>
+<title>BioJSON in Jalview</title>
</head>
<body>
<p>
the bottom of the list is rendered <em>below</em> a feature higher
up in the list.<br> <em><strong>You can change
the order of a feature by dragging it up and down the list with
- the mouse</strong></em>.
+ the mouse (not applet)</strong></em>.
</p>
<p>
The <strong><em>Optimise order</em></strong> button (currently only
</em>
</p>
<p>
+ <strong>Executing a groovy script on a particular alignment</strong><br/>
+
+ <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
--- /dev/null
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="UTF-8">
+<title>mmCIF File Format</title>
+</head>
+<body>
+ <strong>mmCIF File Format</strong>
+ <p>The mmCIF file format (macromolecular Crystallographic
+ Information) was developed under the auspices of the International Union of Crystallography (IUCr) to extend the Crystallographic Information
+ File (CIF) data representation used for describing small molecule
+ structures and associated diffraction experiments.</p>
+ <strong>Merits of mmCIF file format</strong>
+ <ul>
+ <li>Large structures (containing >62 chains and/or 99999 ATOM
+ records) that cannot be fully represented in the PDB file format are
+ available in the PDB archive as single PDBx/mmCIF files.</li>
+ <li>PDBx/mmCIF file format provides richer data annotation</li>
+ <li>PDBx/mmCIF became the standard PDB archive format in 2014.
+ Since 2016 the PDB File Format is no longer being modified or
+ extended to support new content.
+ </li>
+ </ul>
+
+ <em>mmCIF file format support for importing 3D structure data from
+ flat file and EMBL-PDBe via mmCIF was added in Jalview 2.9.1</em>
+</body>
+</html>
\ No newline at end of file
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.
+ </p>
+ <p>In Jalview 2.9.1 <a href="siftsmapping.html">SIFTS Mapping</a> was added as a better means for explicitly identifying the coordinates corresponding to a displayed sequence when viewing a PDB structure associated with a sequence </p>
</body>
</html>
--- /dev/null
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="UTF-8">
+<title>SIFTS Mapping</title>
+</head>
+<body>
+
+ <p><strong>SIFTS Mapping</strong></p>
+
+ <p>
+ SIFTS (Structure integration with function, taxonomy
+ and sequences) provides an up-to-date resource for residue-level
+ mapping between Uniprot and PDB entries. The information is updated and
+ released weekly simultaneously with the release of new PDB entries.
+ SIFTS Entries are published as XML files and made publicly available via an FTP
+ site hosted at the European Bioinformatics Institute.
+ </p>
+
+ <p>
+ At the point of viewing a PDB structure, Jalview downloads a SIFTS file
+ for the target entry and uses it to accurately map the sequence residues with the
+ structure residue. Prior to SIFTS integration, Jalview uses Needleman and Wunsch
+ Alignment algorithm to map sequence residues to structure residues, and that may not
+ always result to a correct mapping since it is computational determined.
+ </p>
+
+ <p>
+ The default method for 'Sequence ↔ Structure' mapping can be configured
+ in the Structure tab in the <strong>Tools → Preferences</strong> dialog box. When 'SIFTS'
+ is enabled as the default, all mappings between 'Sequence ↔ Structure' is
+ performed via SIFTS provided that there is a valid SIFTS entry for PDB structure. If no
+ valid SIFTS resource is available, then the 'Sequence ↔ Structure' mapping falls
+ back to Needleman and Wunsch Alignment algorithm.
+ </p>
+
+ <p>To verify the mapping method used, you can view the mapping output via the structure viewer menu <strong>File → View mapping.</strong> A sample mapping output can be seen in the screenshot below. The highlighted position shows the method used. </p>
+ <p>
+ <img src="sifts_mapping_output.png" align="left" alt="SIFTS mapping output" />
+ </p>
+
+ <p><em>SIFTS Mapping integration was added in Jalview 2.9.1</em></p>
+
+</body>
+</html>
\ No newline at end of file
<li>On selecting rows, columns or regions in one alignment, the
corresponding selection is made in the other</li>
<li>Sequence ordering in one alignment (using the cursor, or <strong><a
- href="../calculate/sorting.html"
+ href="../calculations/sorting.html"
>"Calculate→Sort")</a></strong> is also applied to the other
</li>
<li>Editing (gap insertion / deletion) in the protein alignment
panels.</li>
<li>Panel heights are adjusted dragging the divider between
them using the mouse</li>
- <li><a href="menus/alwview.html"><strong>"View→New
+ <li><a href="../menus/alwview.html"><strong>"View→New
View / Expand Views / Gather Views"</strong></a> behave as for a normal
alignment window, but always create new views as Split Frames</li>
</ul>
--- /dev/null
+<html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>UniProtKB query fields</title>
+</head>
+
+<body>
+ <p>
+ <strong>UniProtKB query fields</strong>
+ </p>
+<p>Supported query fields for searching specific data in UniProtKB (see also <a href="text-search">query syntax</a>).</p>
+
+<table border="1" width="95%">
+ <tr>
+ <th>Field</th>
+ <th>Example</th>
+ <th>Description</th>
+ </tr>
+ <tr>
+ <td>accession</td>
+ <td>
+ <code>accession:P62988</code>
+ </td>
+ <td>
+ Lists all entries with the primary or secondary
+ accession number P62988.
+ </td>
+ </tr>
+ <tr>
+ <td>active</td>
+ <td>
+ <code>active:no </code>
+ </td>
+ <td>
+ Lists all obsolete entries.
+ </td>
+ </tr>
+ <tr>
+ <td>annotation</td>
+ <td>
+ <code>
+ annotation:(type:non-positional)
+ <br />
+ annotation:(type:positional)
+ <br />
+ annotation:(type:mod_res "Pyrrolidone carboxylic acid" evidence:experimental)
+ </code>
+ </td>
+ <td>
+ Lists all entries with:
+ <ul>
+ <li>any general annotation (comments [CC])</li>
+ <li>any sequence annotation (features [FT])</li>
+ <li>at least one amino acid modified with a Pyrrolidone carboxylic acid group</li>
+ </ul>
+ </td>
+ </tr>
+ <tr>
+ <td>author</td>
+ <td>
+ <code>
+ author:ashburner
+ </code>
+ </td>
+ <td>
+ Lists all entries with at least one reference co-authored by Michael Ashburner.
+ </td>
+ </tr>
+ <tr>
+ <td>cdantigen</td>
+ <td>
+ <code>
+ cdantigen:CD233
+ </code>
+ </td>
+ <td>
+ Lists all entries whose cluster of differentiation number is CD233.
+ </td>
+ </tr>
+ <tr>
+ <td>citation</td>
+ <td>
+ <code>
+ citation:("intracellular structural proteins")
+ <br />
+ citation:(author:ashburner journal:nature)
+ citation:9169874
+ </code>
+ </td>
+ <td>
+ Lists all entries with a literature citation:
+ <ul>
+ <li>containing the phrase "intracellular structural proteins" in either title or abstract</li>
+ <li>co-authored by Michael Ashburner and published in Nature</li>
+ <li>with the PubMed identifier 9169874</li>
+ </ul>
+ </td>
+ </tr>
+ <tr>
+ <td>cluster</td>
+ <td>
+ <code>
+ cluster:UniRef90_A5YMT3
+ </code>
+ </td>
+ <td>
+ Lists all entries in the UniRef 90% identity cluster whose
+ representative sequence is UniProtKB entry A5YMT3.
+ </td>
+ </tr>
+ <tr>
+ <td>count</td>
+ <td>
+ <code>
+ annotation:(type:transmem count:5)<br />
+ annotation:(type:transmem count:[5 TO *])<br />
+ annotation:(type:cofactor count:[3 TO *])
+ </code>
+ </td>
+ <td>Lists all entries with:
+ <ul>
+ <li>exactly 5 transmembrane regions</li>
+ <li>5 or more transmembrane regions</li>
+ <li>3 or more Cofactor comments</li>
+ </ul>
+ </td>
+ </tr>
+ <tr>
+ <td>created</td>
+ <td>
+ <code>
+ created:[20121001 TO *]<br />
+ reviewed:yes AND created:[current TO *]
+ </code>
+ </td>
+ <td>
+ Lists all entries created since October 1st 2012.<br />
+ Lists all new UniProtKB/Swiss-Prot entries in the last release.
+ </td>
+ </tr>
+ <tr>
+ <td>database</td>
+ <td>
+ <code>
+ database:(type:pfam)
+ <br />
+ database:(type:pdb 1aut)
+ </code>
+ </td>
+ <td>
+ Lists all entries with:
+ <ul>
+ <li>a cross-reference to the Pfam database</li>
+ <li>a cross-reference to the PDB database entry 1aut</li>
+ </ul>
+
+ </td>
+ </tr>
+ <tr>
+ <td>domain</td>
+ <td>
+ <code>
+ domain:VWFA
+ </code>
+ </td>
+ <td>
+ Lists all entries with a Von Willebrand factor type A domain described
+ in the 'Family and Domains' section.
+ </td>
+ </tr>
+ <tr>
+ <td>ec</td>
+ <td>
+ <code>
+ ec:3.2.1.23
+ </code>
+ </td>
+ <td>
+ Lists all beta-galactosidases.
+ </td>
+ </tr>
+ <tr>
+ <td>evidence</td>
+ <td>
+ <code>
+ annotation:(type:signal evidence:ECO_0000269)<br />
+ (type:mod_res phosphoserine evidence:ECO_0000269)<br />
+ annotation:(type:function AND evidence:ECO_0000255)
+ </code>
+ </td>
+ <td>Lists all entries with:
+ <ul>
+ <li>a signal sequence whose positions have been experimentally proven</li>
+ <li>experimentally proven phosphoserine sites</li>
+ <li>a function manually asserted according to rules</li>
+ </ul>
+ </td>
+ </tr>
+ <tr>
+ <td>family</td>
+ <td>
+ <code>
+ family:serpin
+ </code>
+ </td>
+ <td>
+ Lists all entries belonging to the Serpin family of proteins.
+ </td>
+ </tr>
+ <tr>
+ <td>fragment</td>
+ <td>
+ <code>
+ fragment:yes
+ </code>
+ </td>
+ <td>
+ Lists all entries with an incomplete sequence.
+ </td>
+ </tr>
+
+ <tr>
+ <td>gene</td>
+ <td>
+ <code>
+ gene:HSPC233
+ </code>
+ </td>
+ <td>
+ Lists all entries for proteins encoded by gene HSPC233.
+ </td>
+ </tr>
+ <tr>
+ <td>go</td>
+ <td>
+ <code>
+ go:cytoskeleton
+ <br />
+ go:0015629
+ </code>
+ </td>
+ <td>
+ Lists all entries associated with:
+ <ul>
+ <li>a GO term containing the word "cytoskeleton"</li>
+ <li>the GO term Actin cytoskeleton and any subclasses</li>
+ </ul>
+ </td>
+ </tr>
+ <tr>
+ <td>host</td>
+ <td>
+ <code>
+ host:mouse
+ <br />
+ host:10090
+ <br />
+ host:40674
+ </code>
+ </td>
+ <td>
+ Lists all entries for viruses infecting:
+ <ul>
+ <li>organisms with a name containing the word "mouse"</li>
+ <li>Mus musculus (Mouse)</li>
+ <li>all mammals (all taxa classified under the taxonomy node for Mammalia)</li>
+ </ul>
+ </td>
+ </tr>
+ <tr>
+ <td>id</td>
+ <td>
+ <code>id:P00750</code>
+ </td>
+ <td>
+ Returns the entry with the primary
+ accession number P00750.
+ </td>
+ </tr>
+ <tr>
+ <td>inn</td>
+ <td>
+ <code>
+ inn:Anakinra
+ </code>
+ </td>
+ <td>
+ Lists all entries whose "International Nonproprietary Name" is Anakinra.
+ </td>
+ </tr>
+ <tr>
+ <td>interactor</td>
+ <td>
+ <code>
+ interactor:P00520
+ </code>
+ </td>
+ <td>
+ Lists all entries describing interactions with the protein described by
+ entry P00520.
+ </td>
+ </tr>
+ <tr>
+ <td>keyword</td>
+ <td>
+ <code>
+ keyword:toxin
+ </code>
+ </td>
+ <td>
+ Lists all entries associated with the keyword Toxin.
+ </td>
+ </tr>
+ <tr>
+ <td>length</td>
+ <td>
+ <code>
+ length:[500 TO 700]
+ </code>
+ </td>
+ <td>
+ Lists all entries describing sequences of length between 500 and 700 residues.
+ </td>
+ </tr>
+ <tr>
+ <td>lineage</td>
+ <td />
+ <td>
+ This field is a synonym for the field <code>taxonomy</code>.
+ </td>
+ </tr>
+ <tr>
+ <td>mass</td>
+ <td>
+ <code>
+ mass:[500000 TO *]
+ </code>
+ </td>
+ <td>
+ Lists all entries describing sequences with a mass of at least 500,000 Da.
+ </td>
+ </tr>
+ <tr>
+ <td>method</td>
+ <td>
+ <code>
+ method:maldi
+ <br />
+ method:xray
+ </code>
+ </td>
+ <td>
+ Lists all entries for proteins identified by: matrix-assisted laser
+ desorption/ionization (MALDI), crystallography (X-Ray). The
+ <code>method</code> field searches names of physico-chemical
+ identification methods in the 'Biophysicochemical properties' subsection of the 'Function' section, the 'Publications' and
+ 'Cross-references' sections.
+ </td>
+ </tr>
+ <tr>
+ <td>mnemonic</td>
+ <td>
+ <code>
+ mnemonic:ATP6_HUMAN
+ </code>
+ </td>
+ <td>
+ Lists all entries with entry name (ID) ATP6_HUMAN. Searches also
+ obsolete entry names.
+ </td>
+ </tr>
+ <tr>
+ <td>modified</td>
+ <td>
+ <code>
+ modified:[20120101 TO 20120301]<br />
+ reviewed:yes AND modified:[current TO *]
+ </code>
+ </td>
+ <td>
+ Lists all entries that were last modified between January and March 2012.<br />
+ Lists all UniProtKB/Swiss-Prot entries modified in the last release.
+ </td>
+ </tr>
+ <tr>
+ <td>name</td>
+ <td>
+ <code>
+ name:"prion protein"
+ </code>
+ </td>
+ <td>
+ Lists all entries for prion proteins.
+ </td>
+ </tr>
+ <tr>
+ <td>organelle</td>
+ <td>
+ <code>
+ organelle:Mitochondrion
+ </code>
+ </td>
+ <td>
+ Lists all entries for proteins encoded by a gene of the mitochondrial
+ chromosome.
+ </td>
+ </tr>
+ <tr>
+ <td>organism</td>
+ <td>
+ <code>
+ organism:"Ovis aries"
+ <br />
+ organism:9940
+ <br />
+ organism:sheep
+ <br />
+ </code>
+ </td>
+ <td>
+ Lists all entries for proteins expressed in sheep (first 2 examples) and
+ organisms whose name contains the term "sheep".
+ </td>
+ </tr>
+
+ <tr>
+ <td>plasmid</td>
+ <td>
+ <code>
+ plasmid:ColE1
+ </code>
+ </td>
+ <td>
+ Lists all entries for proteins encoded by a gene of plasmid ColE1.
+ </td>
+ </tr>
+ <tr>
+ <td>proteome</td>
+ <td>
+ <code>
+ proteome:UP000005640
+ </code>
+ </td>
+ <td>
+ Lists all entries from the human proteome.
+ </td>
+ </tr>
+ <tr>
+ <td>proteomecomponent</td>
+ <td>
+ <code>
+ proteomecomponent:"chromosome 1" and organism:9606
+ </code>
+ </td>
+ <td>
+ Lists all entries from the human chromosome 1.
+ </td>
+ </tr>
+ <tr>
+ <td>replaces</td>
+ <td>
+ <code>
+ replaces:P02023
+ </code>
+ </td>
+ <td>
+ Lists all entries that were created from a merge with entry P02023.
+ </td>
+ </tr>
+ <tr>
+ <td>reviewed</td>
+ <td>
+ <code>
+ reviewed:yes
+ </code>
+ </td>
+ <td>
+ Lists all UniProtKB/Swiss-Prot entries.
+ </td>
+ </tr>
+ <tr>
+ <td>scope</td>
+ <td>
+ <code>
+ scope:mutagenesis
+ </code>
+ </td>
+ <td>
+ Lists all entries containing a reference that was used to gather
+ information about mutagenesis.
+ </td>
+ </tr>
+ <tr>
+ <td>sequence</td>
+ <td>
+ <code>
+ sequence:P05067-9
+ </code>
+ </td>
+ <td>
+ Lists all entries containing a link to isoform 9 of the sequence
+ described in entry P05067. Allows searching by specific sequence
+ identifier.
+ </td>
+ </tr>
+ <tr>
+ <td>sequence_modified</td>
+ <td>
+ <code>
+ sequence_modified:[20120101 TO 20120301]<br />
+ reviewed:yes AND sequence_modified:[current TO *]
+ </code>
+ </td>
+ <td>
+ Lists all entries whose sequences were last modified between January and March 2012.<br />
+ Lists all UniProtKB/Swiss-Prot entries whose sequences were modified in the last release.
+ </td>
+ </tr>
+ <tr>
+ <td>source</td>
+ <td>
+ <code>
+ source:intact
+ </code>
+ </td>
+ <td>
+ Lists all entries containing a GO term whose annotation source is the
+ IntAct database.
+ </td>
+ </tr>
+ <tr>
+ <td>strain</td>
+ <td>
+ <code>
+ strain:wistar
+ </code>
+ </td>
+ <td>
+ Lists all entries containing a reference relevant to strain wistar.
+ </td>
+ </tr>
+ <tr>
+ <td>taxonomy</td>
+ <td>
+ <code>
+ taxonomy:40674
+ </code>
+ </td>
+ <td>
+ Lists all entries for proteins expressed in Mammals. This field is used to retrieve
+ entries for all organisms classified below a given taxonomic node taxonomy classification).
+ </td>
+ </tr>
+ <tr>
+ <td>tissue</td>
+ <td>
+ <code>
+ tissue:liver
+ </code>
+ </td>
+ <td>
+ Lists all entries containing a reference describing the protein sequence
+ obtained from a clone isolated from liver.
+ </td>
+ </tr>
+ <tr>
+ <td>web</td>
+ <td>
+ <code>
+ web:wikipedia
+ </code>
+ </td>
+ <td>
+ Lists all entries for proteins that are described in Wikipedia.
+ </td>
+ </tr>
+</table>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>The Uniprot Free Text Search Interface</title>
+</head>
+<body>
+
+ <strong>The Uniprot Free Text Search Interface</strong>
+ <p>
+ Jalview provides a specialised interface that allows fast and
+ efficient discovery and retrieval of data from the Uniprot database.
+ It allows
+ interactive querying of Uniprot metadata with free text and structured
+ queries, so sequences can be located without prior knowledge of
+ their database accessions, or <em>via</em> manual cross-referencing
+ from Uniprot or other bioinformatics websites.
+ </p>
+ <p>
+ To open the UniProt Sequence Fetcher, select UniProt as the database from
+ any <a href="seqfetch.html">Sequence Fetcher</a> dialog (opened <em>via</em>
+ <strong>"File →Fetch Sequences"</strong>).
+ </p>
+ <p>
+ <img src="uniprotseqfetcher.png" align="left"
+ alt="Uniprot sequence fetcher (introduced in Jalview 2.9.1)"
+ />
+ </p>
+
+ <p>
+ <strong>Searching the Uniprot Database</strong>
+ </p>
+ <p>
+ To search the Uniprot, begin typing in the text box. The results of your
+ query are shown in the search results tab, which queries Uniprot after 1.5secs every time
+ you type in the search text box. You can sort results according to
+ the displayed columns, and select entries with the mouse or
+ keyboard. Once you have selected one or more entries, hit the <strong>OK</strong>
+ button to retrieve and visualise the sequences in Jalview Alignment interface.
+ </p>
+ <ul>
+ <li><strong>Searching a specific Uniprot field </strong> If you
+ want to find sequences based on a specific Uniprot metadata field,
+ you can select it from the drop-down menu.</li>
+
+
+ <li><strong>Bulk Uniprot retrieval</strong><br>
+ Firstly, switch the search target to Uniprot Id, then enter multiple IDs by separating them with a semi-colon.
+ e.g. fila_human; mnt_human; mnt_mouse.<br />Hitting Return or OK will automatically
+ fetch those IDs, like the default Sequence Fetcher interface.</li>
+
+ <li><strong>Advanced / Custom querying</strong>
+ The table below provides a brief overview of the supported Uniprot query syntax (see <a href="uniprotqueryfields.html">query fields for UniProtKB</a>):
+ <table border="1" width="95%">
+ <tr>
+ <td><code>human antigen</code></td>
+ <td rowspan="3">All entries containing both terms.</td>
+ </tr>
+ <tr>
+ <td><code>human AND antigen</code></td>
+ </tr>
+ <tr>
+ <td><code>human && antigen</code></td>
+ </tr>
+ <tr>
+ <td><code>"human antigen"</code></td>
+ <td>All entries containing both terms in the exact order.</td>
+ </tr>
+ <tr>
+ <td><code>human -antigen</code></td>
+ <td rowspan="3">All entries containing the term <code>human</code>
+ but not <code>antigen</code>.
+ </td>
+ </tr>
+ <tr>
+ <td><code>human NOT antigen</code></td>
+ </tr>
+ <tr>
+ <td><code>human ! antigen</code></td>
+ </tr>
+ <tr>
+ <td><code>human OR mouse</code></td>
+ <td rowspan="2">All entries containing either term.</td>
+ </tr>
+ <tr>
+ <td><code>human || mouse</code></td>
+ </tr>
+ <tr>
+ <td><code>antigen AND (human OR mouse)</code></td>
+ <td>Using parentheses to override boolean precedence rules.</td>
+ </tr>
+ <tr>
+ <td><code>anti*</code></td>
+ <td>All entries containing terms starting with <code>anti</code>.
+ Asterisks can also be used at the beginning and within terms. <strong>Note:</strong>
+ Terms starting with an asterisk or a single letter followed by an
+ asterisk can slow down queries considerably.
+ </td>
+ </tr>
+ <tr>
+ <td><code> author:Tiger*</code></td>
+ <td>Citations that have an author whose name starts with <code>Tiger</code>.
+ To search in a specific field of a dataset, you must prefix your
+ search term with the field name and a colon. To discover what
+ fields can be queried explicitly, observe the query hints that are
+ shown after submitting a query or use the query builder (see
+ below).
+ </td>
+ </tr>
+ <tr>
+ <td><code>length:[100 TO *]</code></td>
+ <td>All entries with a sequence of at least 100 amino acids.</td>
+ </tr>
+ <tr>
+ <td><code>citation:(author:Arai author:Chung)</code></td>
+ <td>All entries with a publication that was coauthored by two
+ specific authors.</td>
+ </tr>
+ </table>
+ </li>
+</ul>
+ <p>
+ <strong>Result pagination</strong>
+ </p>
+ The query results returned from the Uniprot server are paginated for performance optimisation.
+ The button labelled <strong>' << '</strong> and <strong>' >> '</strong> can be used to navigate to the next or previous result page respectively.
+ The page range is shown on the title bar of the Free Text Search interface. Jalview's pagination implementation supports multiple selection of entries across multiple pages.
+
+
+ <p>
+ <strong>Customising The Uniprot Sequence Fetcher</strong>
+ </p>
+ <p>
+ To change the displayed meta-data in the search result, click the
+ 'Customise Displayed Options' tab, and select the fields you'd like
+ to displayed or remove.
+ </p>
+ <p>
+ <em>The Uniprot Free Test Search Interface was introduced in
+ Jalview 2.9.1</em>
+ </p>
+</body>
+</html>
\ No newline at end of file
</p>
<p>
+ <strong>Importing PDB Entries or files in mmCIF format</strong><br>
+ <a href="mmcif.html">mmCIF file format</a> provides an alternative means for
+ importing 3D structure data from flat file and EMBL-PDBe
+ web-service. To enable mmCIF as the default format for
+ importing PBD sequences from the PDB sequence fetcher, add or modify the
+ property
+ <code>DEFAULT_STRUCTURE_FORMAT=mmCIF</code> in Jalview properties file.
+ Once this is done, the steps followed in retrieving PDB format files above can
+ be followed to obtain the same data with mmCIF. <em>mmCIF format file support was added in Jalview 2.9.1.</em></p>
+
+
+
+ <p>
<strong>Associating a large number of PDB files to
sequences in an alignment</strong><br /> It is often the case when working
with structure alignments that you will have a directory of PDB
<td>Both</td>
<td>Cuts the (fully) selected sequences from the alignment. <!-- not yet in this version
This will not happen if only some
-columns are selected, you should use the <a href="features/regionHiding.html">Hide Regions feature</a> instead.-->
+columns are selected, you should use the <a href="features/hiddenRegions.html">Hide Regions feature</a> instead.-->
</td>
</tr>
<tr>
<a href="../webServices/newsreader.html">Jalview News</a>
dialog box.
</em></li>
- <li><strong>Groovy Console...<em> (only
- available if groovy is on the classpath)</em><br></strong> <em>Opens
+ <li><strong>Groovy Console...<br></strong> <em>Opens
the <a href="../features/groovy.html">Groovy Console</a> for
interactive scripting.
</em><strong><br></strong></li>
and sequence description to be entered. Press OK to accept
your edit. To save sequence descriptions, you must save in
Fasta, PIR or Jalview File format.</em></li>
- <li><a href="sqaddrefannot"><strong>Add
- Reference Annotations<br>
- </strong><em>When enabled, copies any available alignment
+ <li><strong>Add <a href="../features/annotation.html#seqannots">Reference Annotations</a></strong><br>
+ <em>When enabled, copies any available alignment
annotation for this sequence to the current view.</em></li>
<li><strong>Set as Reference</strong> or <strong>Unmark
as Reference</strong><br /> Sets or unsets the reference sequence for
<tr>
<td width="60" nowrap>
<div align="center">
- <strong><a name="Jalview.2.9.1">2.9.1</a><br /> <em>1/6/2016</em></strong>
+ <strong><a name="Jalview.2.9.1">2.9.1</a><br /> <em>21/6/2016</em></strong>
</div>
</td>
<td><em>General</em>
<ul>
- <li></li>
+ <li><!-- JAL---></li>
+ <li><!-- JAL-192 --->Alignment ruler shows positions relative to reference sequence</li>
</ul> <em>Application</em>
<ul>
- <li></li>
+ <li><!-- JAL---></li>
+ <li><!-- JAL-2027-->Support for reverse-complement coding regions in ENA and EMBL</li>
+ <li><!-- JAL-1855, JAL-2113, JAL-2114-->Upgrade to EMBL XML 1.2 for ENA record retrieval</li>
+ <li><!-- JAL 1812 -->New 'execute Groovy script' option in an alignment window's Calculate menu</li>
+ <li><!-- JAL 1812 -->Allow groovy scripts that call Jalview.getAlignFrames() to run in headless mode</li>
+ <li><!-- JAL-1369 --->Store/restore reference sequence in Jalview projects</li>
+
</ul> <em>Applet</em>
<ul>
- <li></li>
+ <li><!-- JAL---></li>
</ul></td>
<td>
<div align="left">
<em>General</em>
<ul>
- <li></li>
+ <li><!-- JAL-2077 -->reinstate CTRL-click for opening pop-up menu on OSX</li>
+ <li><!-- JAL-2018-->Export features in Jalview format (again) includes graduated colourschemes</li>
+ <li><!-- JAL-1722, JAL-2001-->More responsive when working with big alignments and lots of hidden columns</li>
+ <li><!-- JAL-2053-->hidden column markers not always rendered at right of alignment window</li>
+ <li><!-- JAL-2067, JAL- -->Tidied up links in help file table of contents</li>
+ <li><!-- JAL-2072 -->Feature based tree calculation not shown for DNA alignments</li>
+ <li><!-- JAL-2075 -->Hidden columns ignored during feature based tree calculation</li>
+ <li><!-- JAL-2065 -->Alignment view stops updating when show unconserved enabled for group on alignment</li>
+ <li><!-- JAL-2086 -->Cannot insert gaps into sequence when set as reference</li>
+
</ul>
<em>Application</em>
<ul>
- <li></li>
+ <li><!-- JAL-1944 not yet fixed Error thrown when exporting a view with hidden sequences as flat-file alignment--></li>
+ <li><!-- JAL-1911-->Corrupt preferences for SVG, EPS & HTML output when running on non-gb/us i18n platforms</li>
+ <li><!-- JAL-1552-->URLs and links can imported by drag'n'drop on OSX webstart</li>
+ <li><!-- JAL-2030-->InstallAnywhere distribution fails when launching Chimera</li>
+ <li><!-- JAL-2080-->Jalview very slow to launch via webstart (also hotfix for 2.9.0b2)</li>
+ <li><!-- JAL-2085 -->Cannot save project when view has a reference sequence defined</li>
+ <li><!-- JAL-1011 -->Columns are suddenly selected in other alignments and views when revealing hidden columns</li>
+ <li><!-- JAL-1989 -->Hide columns not mirrored in complement view in a cDNA/Protein splitframe</li>
+ <!-- may exclude, this is an external service stability issue JAL-1941 /> RNA 3D structure not added via DSSR service</li> -->
</ul>
<em>Applet</em>
<ul>
- <li></li>
+ <li><!-- --></li>
</ul>
</div>
</td>
between different screens.</li>
<li>New preference items for sequence ID tooltip and
consensus annotation</li>
- <li>Client to submit sequences and IDs to <a
- href="webServices/index.html#envision2">Envision2</a>
- Workflows
- </li>
+ <li>Client to submit sequences and IDs to Envision2 Workflows</li>
<li><em>Vamsas Capabilities</em>
<ul>
<li>Improved VAMSAS synchronization (Jalview archive
Function, and Genetics</em> 43(2): 227-241. <a
href="http://www.ncbi.nlm.nih.gov/pubmed/12112692"
>PubMed</a> or available on the <a
- href="http://www.well.ox.ac.uk/~valdar/publications.html"
+ href="http://valdarlab.unc.edu/publications.html"
>Valdar Group publications page</a>), but the SMERFs score was
developed later and described by Manning et al. in 2008 (<a
href="http://www.biomedcentral.com/1471-2105/9/51"
>REST</a> web services exposing sequence alignment, analysis, and
secondary structure prediction programs. Originally, Jalview 2's
services were maintained by the Barton group at the University of
- Dundee, and ran programs on the Life Sciences High-performace
+ Dundee, and ran programs on the Life Sciences High-performance
Computing Cluster. With the advent of <a
href="http://www.compbio.dundee.ac.uk/JABAWS"
>JABAWS</a>, however, it is possible for anyone to host Jalview web
from the input</li>
<li><em>realignment</em> - where any aligned sequences will be
used by the service to construct a profile based alignment of the
- remaining unaligned sequences.</li>
+ remaining unaligned sequences</li>
</ul>
<strong>JABAWS Alignment services</strong>
<br> Most alignment services are provided by the
<a href="JABAWS.html">JABAWS framework</a>, which allows you to
customise the precise parameters used when running each alignment
- prgoram. In addition to the 'Default settings', you may choose from a
+ program. In addition to the 'Default settings', you may choose from a
range of alignment preset settings, or create your own using the
<a href="webServicesParams.html">'Edit Settings And Run ..' dialog
box</a>.
<ul>
<li><a href="http://www.clustal.org/">Clustal Omega and
Clustal W</a> (version 2.0.12)</li>
- <li><a href="http://align.bmr.kyushu-u.ac.jp/mafft/software/">Mafft</a>
+ <li><a href="http://mafft.cbrc.jp/alignment/software/">Mafft</a>
(version 6.8.57b)</li>
<li><a href="http://www.drive5.com/muscle">Muscle</a> (version
3.8.31)</li>
<em>Please Note:
<ul>
<li>The regular expressions supported by Jalview are those
- provided by the <a href="www.javaregex.com">Stevesoft
+ provided by the <a href="http://www.javaregex.com">Stevesoft
javaregex package</a>.
</li>
<li>Some characters must be escaped when specifying them as
<strong>What's new ?</strong>
</p>
<p>
- Jalview 2.9.0b2 is a bug fix release for Jalview 2.9.
- The release of Jalview 2.9 in September 2015 included
- a multitude of bug fixes and minor improvements (both small, and
- rather big!), it also brings major new capabilities for codon-level
- analysis of protein alignments and the retrieval and manipulation of
- structural data.</p><p>For the patches since version 2.9 was released, see the
- <a href="releases.html#Jalview.2.9.0b2">Jalview 2.9.0b2 Release Notes</a>.
+ Jalview 2.9.1 is the next major release in the Jalview 2.9 series. Full details are in the
+ <a href="releases.html#Jalview.2.9.1">Jalview 2.9.1 Release Notes</a>.
</p>
<p>
- <strong>Highlights in Jalview 2.9</strong>
+ <strong>Highlights in Jalview 2.9.1</strong>
<ul>
- <li><strong>Visualisation, editing and analysis of
- cDNA and Protein alignments</strong><br />A new <a
- href="features/splitView.html">Split View</a> window allows linked
- protein and nucleotide sequence alignments to be viewed, edited,
- and analysed as one. <br />cDNA alignments can also be
- reconstructed from protein alignments calculated by Jalview's web
- services, and update in response to edits in the amino acid view.<br />To
- start experimenting with cDNA/Protein analysis, jut drop a file
- containing cDNA sequences which code for proteins in an existing
- alignment, and Jalview will do the rest.</li>
- <li><strong>Enhanced Integration of UCSF Chimera</strong> <br>Jalview
- 2.9 provides full support for the use of Chimera to view 3D
- structures linked to alignment views in the Jalview Desktop. We've
- also included support for saving Chimera sessions in Jalview
- project files.<br />Jalview and Chimera communicate using local
- web server connections, which may cause firewall alerts on some
- systems, but has the advantage of allowing bidirectional
- communication. Communication between Jalview and Chimera is now
- much more responsive, and selected regions in Chimera are now
- shown as highlighted regions in the Jalview desktop.</li>
- <li><strong>Interactive querying of the PDBe</strong><br />Jalview
- users can now <a href="features/pdbsequencefetcher.html">browse</a> and <a href="features/viewingpdbs.html">retrieve 3D structure</a> data from the PDB
- via the <a href="http://www.ebi.ac.uk/pdbe/api/doc/search.html">PDBe
- Search API</a> (<a href="http://dx.doi.org/10.1093%2Fnar%2Fgkt1180">Gutmanas
- et al 2014</a>). Developed in collaboration with the PDBe group at
- EMBL-EBI, the interface allows both structured and free-text
- queries to be performed, and allows automatic selection of the
- most relevant structures for an alignment acording to a variety of
- criteria.</li>
- <li><strong>Improved support for RNA visualisation</strong><br />Jalview
- 2.9 integrates the latest version of the <a
- href="features/varna.html">VARNA RNA Viewer</a>, and VARNA views
- can also now be stored in Jalview projects. We've also dealt with
- a number of lingering bugs in the VARNA/Jalview interface,
- including the loss of pseudoknots when RNA secondary structure is
- shown VARNA.</li>
- <li><strong>Protein Secondary Structure predictions
- with JPred4</strong><br />Jalview includes a number of new features for
- working with secondary structure predictions from the JPred4
- server. These include new <a href="menus/popupMenu.html#hideinserts">popup menu actions</a> to automatically hide insertions and highlight
- mutations in an alignment with respect to a <a href="calculations/referenceseq.html">Reference
- Sequence</a>. Jalview 2.9's new <a href="io/export.html#htmlexport">scrollable
- SVG HTML export</a> was also developed specifically for the JPred4
- server.</li>
</ul>
</body>
<!--
History: Originally created from EMBL_common_V1.0
Updated on 24th April 2007 for WsDBFetch Service move to EMBL_Services_V1.1.xsd
+ Updated May 2016 for EMBL XML 1.2 JAL-2113 JAL-2114
+ see ftp://ftp.sra.ebi.ac.uk/meta/xsd/sra_1_5/ENA.embl.xsd
+ see http://www.ebi.ac.uk/ena/submit/data-formats
-->
<class name="jalview.datamodel.xdb.embl.EmblFile">
- <map-to xml="EMBL_Services"/>
+ <map-to xml="ROOT"/>
<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">
<field name="accession" type="string">
- <bind-xml location="accession" node="attribute"/>
+ <bind-xml name="accession" node="attribute"/>
</field>
- <!-- May 2015 changed from last-updated to match xml -->
- <field name="lastUpdated" type="string">
- <bind-xml location="lastUpdated" node="attribute"/>
+ <!--
+ in EMBL XML 1.2 sequence/@version became entry/version
+ entry/@version became entry/@entryVersion
+ -->
+ <field name="sequenceVersion" type="string">
+ <bind-xml name="version" node="attribute"/>
</field>
- <field name="version" type="string">
- <bind-xml location="version" node="attribute"/>
+ <field name="entryVersion" type="string">
+ <bind-xml name="entryVersion" node="attribute"/>
+ </field>
+ <field name="dataClass" type="string">
+ <bind-xml name="dataClass" node="attribute"/>
+ </field>
+ <field name="taxonomicDivision" type="string">
+ <bind-xml name="taxonomicDivision" node="attribute"/>
+ </field>
+ <field name="moleculeType" type="string">
+ <bind-xml name="moleculeType" node="attribute"/>
+ </field>
+ <field name="sequenceLength" type="string">
+ <bind-xml name="sequenceLength" node="attribute"/>
+ </field>
+ <field name="topology" type="string">
+ <bind-xml name="topology" node="attribute" location="type"/>
+ </field>
+ <field name="firstPublicDate" type="string">
+ <bind-xml name="firstPublic" node="attribute"/>
</field>
- <field name="rCreated" type="string">
- <bind-xml location="releaseCreated" node="attribute"/>
+ <field name="firstPublicRelease" type="string">
+ <bind-xml name="firstPublicRelease" node="attribute"/>
</field>
- <field name="rLastUpdated" type="string">
- <bind-xml location="releaseLastUpdated" node="attribute"/>
+ <field name="lastUpdatedDate" type="string">
+ <bind-xml name="lastUpdated" node="attribute"/>
</field>
- <field name="desc" type="string">
+ <field name="lastUpdatedRelease" type="string">
+ <bind-xml name="lastUpdatedRelease" node="attribute"/>
+ </field>
+ <field name="description" type="string">
<bind-xml name="description" node="element"/>
</field>
<field name="keywords" type="string" collection="vector">
<bind-xml name="feature"/>
</field>
<field name="dbRefs" type="jalview.datamodel.DBRefEntry" collection="vector">
- <bind-xml name="dbreference" />
+ <bind-xml name="xref" />
</field>
<field name="sequence" type="jalview.datamodel.xdb.embl.EmblSequence">
<bind-xml name="sequence"/>
</field>
</class>
<class name="jalview.datamodel.xdb.embl.EmblSequence">
- <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>
<field name="name" type="string">
<bind-xml name="name" node="attribute"/>
</field>
+ <field name="location" type="string">
+ <bind-xml name="location" node="attribute"/>
+ </field>
<field name="dbRefs" type="jalview.datamodel.DBRefEntry" collection="vector">
- <bind-xml name="dbreference" node="element"/>
+ <bind-xml name="xref" 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">
- <bind-xml name="primary" node="attribute"/>
+ <bind-xml name="id" node="attribute"/>
</field>
<field name="source" type="java.lang.String">
<bind-xml name="db" node="attribute"/>
</field>
<field name="version" type="string">
- <bind-xml name="secondary" node="attribute"/>
+ <bind-xml name="secondaryId" node="attribute"/>
</field>
</class>
<class name="jalview.datamodel.xdb.embl.Qualifier" verify-constructable="false">
<bind-xml name="value" node="element"/>
</field>
</class>
- <class name="jalview.datamodel.xdb.embl.EmblFeatureLocations">
- <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">
- <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">
- <field name="type">
- <bind-xml name="type" node="attribute"/>
- </field>
- <field name="pos">
- <bind-xml node="text"/>
- </field>
- </class>
</mapping>
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+
pdb_data_columns
#
_group.id
g1;Quality Measures;1
g2;Cross References;2
g3;Names & Taxonomy;3
-g4;Procedures & Softwares;4
+g4;Procedures & Software;4
g5;Date Of;5
-g6;Miscellenous;6
+g6;Miscellaneous;6
#
_data_column.primary_key;pdb_id
_data_column.default_response_page_size;100
_data_column.name
_data_column.code
_data_column.group_id
-_data_column.data_type
+_data_column.data_type | _data_column.isFormated | _data_column.significantDigit
_data_column.min_col_width
_data_column.max_col_width
_data_column.preferred_col_width
UniProt Accession;uniprot_accession;String;g2;50;400;95;false;false
UniProt Coverage;uniprot_coverage;String;g6;50;400;95;false;false
Uniprot Features;uniprot_features;String;g6;50;400;95;false;false
-R Factor;r_factor;Double;g1;50;150;85;false;false
-Resolution;resolution;Double;g1;50;150;85;true;false
-Data Quality;data_quality;Double;g1;50;150;85;false;false
-Overall Quality;overall_quality;Double;g1;50;150;85;false;false
+R Factor;r_factor;Double|T|3;g1;50;150;85;false;false
+Experimental Method;experimental_method;String;g4;50;400;105;true;false
+Resolution;resolution;Double|T|3;g1;50;150;85;true;false
+Data Quality;data_quality;Double|T|2;g1;50;150;85;false;false
+Overall Quality;overall_quality;Double|T|1;g1;50;150;85;false;false
Number of Polymers;number_of_polymers;int;g6;50;400;95;false;false
Number of Protein Chains;number_of_protein_chains;int;g6;50;400;95;false;false
Number of Bound Molecule;number_of_bound_molecules;int;g6;50;400;95;false;false
Number of Polymer Residue;number_of_polymer_residues;int;g6;50;400;95;false;false
GENUS;genus;String;g3;50;400;95;false;true
Gene Name;gene_name;String;g3;50;400;95;false;true
-Experimental Method;experimental_method;String;g4;50;400;95;false;false
GO Id;go_id;String;g2;50;400;95;false;false
Assembly Id;assembly_id;String;g2;50;400;95;false;false
Assembly Form;assembly_form;String;g6;50;400;95;false;false
Interacting Molecules;interacting_molecules;String;g6;50;400;95;false;false
Pubmed Id;pubmed_id;int;g2;50;400;95;false;false
Status;status;String;g6;50;400;95;false;false
-Model Quality;model_quality;Double;g1;50;150;85;false;false
-Pivot Resolution;pivot_resolution;Double;g1;50;150;85;false;false
+Model Quality;model_quality;Double|T|2;g1;50;150;85;false;false
+Pivot Resolution;pivot_resolution;Double|T|3;g1;50;150;85;false;false
Data reduction software;data_reduction_software;String;g4;50;400;95;false;false
-Max observed residues;max_observed_residues;String;g6;50;400;95;false;false
+Max observed residues;max_observed_residues;Integer|F;g6;50;400;95;false;false
Organism scientific name;organism_scientific_name;String;g3;50;400;95;false;false
Super kingdom;superkingdom;String;g3;50;400;95;false;false
Rank;rank;String;g3;50;400;95;false;false
Citation Title;citation_title;String;g6;50;400;95;false;false
Structure Solution Software;structure_solution_software;String;g4;50;400;95;false;false
Entry Entity;entry_entity;String;g6;50;400;95;false;false
-R Free;r_free;Double;g1;50;150;85;false;false
+R Free;r_free;Double|T|3;g1;50;150;85;false;false
Number of Polymer Entities;number_of_polymer_entities;int;g6;50;400;95;false;false
Number of Bound Entities;number_of_bound_entities;int;g6;50;400;95;false;false
Crystallisation Reservoir;crystallisation_reservoir;String;g6;50;400;95;false;false
Entity Id; entity_id;String;g2;50;400;95;false;false
Beam Source Name;beam_source_name;String;g3;50;400;95;false;false
Processing Site;processing_site;String;g6;50;400;95;false;false
-Entity Weight;entity_weight;Double;g6;50;400;95;false;false
-Version;_version_;String;g6;50;400;95;false;false
+Entity Weight;entity_weight;Double|T|0;g6;50;400;95;false;false
+Version;_version_;Double|F|0;g6;50;400;95;false;false
ALL;text;String;g6;50;400;95;false;true
#
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+
uniprot_data_columns
#
_group.id
g3;Names & Taxonomy;1
g4;Procedures & Softwares;4
g5;Date Of;5
-g6;Miscellenous;6
+g6;Miscellaneous;6
g7;Sequences;7
g8;Function;8
g9;Interaction;9
_data_column.is_shown_by_default
_data_column.is_searchable
Uniprot Id;id;String;g3;80;150;85;true;true
-Entry Name;entry name|name;String;g3;100;150;105;true;true
-Protein names;protein names|protein name;String;g3;300;1500;500;true;true
+Entry Name;entry name|mnemonic;String;g3;100;150;105;true;true
+Protein names;protein names|name;String;g3;300;1500;500;true;true
Gene Names;genes|gene;String;g3;100;1000;145;true;true
Organism;organism;String;g3;100;1000;200;true;true
-Organism ID;organism-id;int;g3;60;100;80;false;true
-Proteomes;proteome;String;g3;50;1000;95;false;true
-Taxonomic lineage (ALL);lineage(ALL);String;g3;50;400;95;false;false
-Virus hosts;virus hosts;String;g3;50;1000;95;false;true
-Fragment;fragment;String;g7;50;1000;95;false;true
-Gene encoded by;encodedon;String;g7;50;1000;95;false;true
+Organism ID;organism-id;int;g3;60;100;80;false;false
+Proteomes;proteome;String;g3;50;1000;95;false;false
+Taxonomic lineage (ALL);lineage(ALL)|taxonomy;String;g3;50;400;95;false;false
+Virus hosts;virus hosts|host;String;g3;50;1000;95;false;true
+Fragment;fragment;String;g7;50;1000;95;false;false
+Gene encoded by;encodedon;String;g7;50;1000;95;false;false
Alternative products (isoforms);comment(ALTERNATIVE PRODUCTS);String;g7;50;1000;95;false;false
Erroneous gene model prediction;comment(ERRONEOUS GENE MODEL PREDICTION);String;g7;50;1000;95;false;false
Erroneous initiation;comment(ERRONEOUS INITIATION);String;g7;50;1000;95;false;false
RNA editing;comment(RNA EDITING);String;g7;50;1000;95;false;false
Sequence caution;comment(SEQUENCE CAUTION);String;g7;50;1000;95;false;false
Status;reviewed;String;g6;50;100;95;true;true
-Length;length;int;g7;50;100;65;true;true
-Mass;mass;String;g7;50;100;80;false;true
-Sequence;sequence;String;g7;50;1000;95;false;true
+Length;length;int|T|0;g7;50;100;65;true;true
+Mass;mass;int|T|0;g7;50;100;80;false;true
+Sequence;sequence;String;g7;50;1000;95;false;false
Alternative sequence;feature(ALTERNATIVE SEQUENCE);String;g7;50;1000;95;false;false
Natural variant;feature(NATURAL VARIANT);String;g7;50;1000;95;false;false
Non-adjacent residues;feature(NON ADJACENT RESIDUES);String;g7;50;1000;95;false;false
Metal binding;feature(METAL BINDING);String;g8;50;1000;95;false;false
Nucleotide binding;feature(NP BIND);String;g8;50;1000;95;false;false
Site;feature(SITE);String;g8;50;1000;95;false;false
-Annotation;annotation score;String;g6;50;1000;95;false;true
-Features;features;String;g6;50;1000;95;false;true
+Annotation;annotation score;String;g6;50;1000;95;false;false
+Features;features;String;g6;50;1000;95;false;false
Caution;comment(CAUTION);String;g6;50;1000;95;false;false
Miscellaneous [CC];comment(GENERAL);String;g6;50;1000;95;false;false
-Keywords;keywords;String;g6;50;1000;95;false;true
+Keywords;keywords|keyword;String;g6;50;1000;95;false;true
Protein existence;existence;String;g6;50;1000;95;false;true
-ALL;Search All;String;g7;50;1000;95;false;true;
+ALL;Search All;String;g7;50;1000;95;false;true
Subunit structure [CC];comment(SUBUNIT);String;g9;50;1000;95;false;false
-Interacts with;interactor;String;g9;50;1000;95;false;true
+Interacts with;interactor;String;g9;50;1000;95;false;false
Developmental stage;comment(DEVELOPMENTAL STAGE);String;g10;50;1000;95;false;false
Induction;comment(INDUCTION);String;g10;50;1000;95;false;false
Tissue specificity;comment(TISSUE SPECIFICITY);String;g10;50;1000;95;false;false
Date of last modification;last-modified;String;g17;80;150;100;false;true
Date of last sequence modification;sequence-modified;String;g17;80;150;100;false;true
Version (entry);version(entry);int;g17;80;100;80;false;false
-Domain;comment(DOMAIN)|domain;String;g18;80;1000;95;false;true
+Domain [cc];comment(DOMAIN)|domain;String;g18;80;1000;95;false;true
Sequence similarities;comment(SIMILARITY);String;g18;50;1000;95;false;false
Protein families;families|family;String;g18;50;1000;95;false;true
Coiled coil;feature(COILED COIL);String;g18;50;1000;95;false;false
label.open_new_jmol_view_with_all_representative_structures_associated_current_selection_superimpose_using_alignment = Opens a new structure viewer with all representative structures\nassociated with the current selection\nsuperimposed with the current alignment.
label.associate_structure_with_sequence = Associate Structure with Sequence
label.from_file = From File
-label.enter_pdb_id = Enter PDB Id
+label.enter_pdb_id = Enter PDB Id (or pdbid:chaincode)
label.discover_pdb_ids = Discover PDB IDs
label.text_colour = Text Colour
action.set_text_colour = Text Colour...
error.png_generation_not_implemented = PNG Generation not yet implemented
error.try_join_vamsas_session_another = Trying to join a vamsas session when another is already connected
error.invalid_vamsas_session_id = Invalid vamsas session id
-error.implementation_error_cannot_create_groovyshell = Implementation Error. Cannot create groovyShell without Groovy on the classpath!
label.groovy_support_failed = Jalview Groovy Support Failed
label.couldnt_create_groovy_shell = Couldn't create the groovy Shell. Check the error log for the details of what went wrong.
error.unsupported_version_calcIdparam = Unsupported Version for calcIdparam {0}
label.nw_mapping = Needleman & Wunsch Alignment
label.sifts_mapping = SIFTs Mapping
label.mapping_method = Sequence \u27f7 Structure mapping method
-label.mapping_method = Sequence \u27f7 Structure mapping method
-status.waiting_for_user_to_select_output_file = Waiting for user to select {0} file.
-status.cancelled_image_export_operation = Cancelled {0} export operation.
-info.error_creating_file = Error creating {0} file.
+status.waiting_for_user_to_select_output_file = Waiting for user to select {0} file
+status.cancelled_image_export_operation = Cancelled {0} export operation
+info.error_creating_file = Error creating {0} file
exception.outofmemory_loading_mmcif_file = Out of memory loading mmCIF File
-info.error_creating_file = Error creating {0} file.
label.run_groovy = Run Groovy console script
label.run_groovy_tip = Run the script in the Groovy console over this alignment
label.couldnt_run_groovy_script = Failed to run Groovy script
label.uniprot_sequence_fetcher = UniProt Sequence Fetcher
action.next_page= >>
action.prev_page= <<
-label.next_page_tooltop=Next Page
-label.prev_page_tooltop=Previous Page
+label.next_page_tooltip=Next Page
+label.prev_page_tooltip=Previous Page
exception.bad_request=Bad request. There is a problem with your input.
exception.service_not_available=Service not available. The server is being updated, try again later.
+status.launching_3d_structure_viewer = Launching 3D Structure viewer...
+status.fetching_3d_structures_for_selected_entries = Fetching 3D Structures for selected entries...
+status.fetching_dbrefs_for_sequences_without_valid_refs = Fetching db refs for {0} sequence(s) without valid db ref required for SIFTS mapping
+status.fetching_3d_structures_for = Fetching 3D Structure for {0}
+status.obtaining_mapping_with_sifts = Obtaining mapping with SIFTS
+status.obtaining_mapping_with_nw_alignment = Obtaining mapping with NW alignment
+status.exporting_alignment_as_x_file = Exporting alignment as {0} file
label.html_content = <html>{0}</html>
label.paste_pdb_file= Pegar tu fichero PDB aquÃ.
label.paste_pdb_file_for_sequence = Pegar fichero PDB para la secuencia {0}
-label.could_not_parse_newick_file = No se pudo analizar el fichero Newick\\\!\\n {0}
+label.could_not_parse_newick_file = No se pudo analizar el fichero Newick\!\n {0}
label.successfully_pasted_tcoffee_scores_to_alignment= Pegada exitosamente la puntuación T-Coffee al alineamiento.
label.failed_add_tcoffee_scores = Fallo al añadir las puntuaciones T-Coffee:
label.successfully_pasted_annotation_to_alignment = Anotación pegada exitosamente al alineamiento.
label.select_vamsas_session_opened_as_new_vamsas_session= Selecciones una sesión vamsas para abrirla como una nueva sesión.
label.open_saved_vamsas_session = Abrir una sesión VAMSAS guardada
label.groovy_console = Consola Groovy
-label.lineart = lineart
+label.lineart = Lineart
label.dont_ask_me_again = No volver a preguntar
label.select_eps_character_rendering_style = Seleccionar el carácter EPS como estilo de visualización
label.invert_selection = Invertir selección
label.example_param = Ejemplo: {0}
label.select_file_format_before_saving = Debe seleccionar un formato de fichero antes de guardar!
label.file_format_not_specified = Formato de fichero no especificado
-label.alignment_contains_hidden_columns = El alineamiento contiene columnas ocultas.\\nQuieres guardar s\u00F3lo el alineamiento visible?
+label.alignment_contains_hidden_columns = El alineamiento contiene columnas ocultas.\nQuieres guardar s\u00F3lo el alineamiento visible?
label.couldnt_save_file = No se pudo guardar el fichero: {0}
label.error_saving_file = Error guardando el fichero
label.remove_from_default_list = eliminar de la lista de defectuosos?
label.remove_user_defined_colour = Eliminar el color definido por el usuario
label.you_must_select_least_two_sequences = Debes seleccionar al menos 2 secuencias.
label.invalid_selection = Selección inválida
-label.principal_component_analysis_must_take_least_four_input_sequences = El an\u00E1lisis de la componente principal debe tomar\\nal menos 4 secuencias de entrada.
+label.principal_component_analysis_must_take_least_four_input_sequences = El an\u00E1lisis de la componente principal debe tomar\nal menos 4 secuencias de entrada.
label.sequence_selection_insufficient = Selección de secuencias insuficiente
label.you_need_more_two_sequences_selected_build_tree = necesitas seleccionar más de dos secuencias para construir un árbol!
label.not_enough_sequences = No suficientes secuencias
-label.selected_region_to_tree_may_only_contain_residues_or_gaps = La regi\u00F3n seleccionada para construir un \u00E1rbol puede\\ncontener s\u00F3lo residuos o espacios.\\nPrueba usando la funci\u00F3n Pad en el men\u00FA de edici\u00F3n,\\n o uno de los m\u00FAltiples servicios web de alineamiento de secuencias.
+label.selected_region_to_tree_may_only_contain_residues_or_gaps = La regi\u00F3n seleccionada para construir un \u00E1rbol puede\ncontener s\u00F3lo residuos o espacios.\nPrueba usando la funci\u00F3n Pad en el men\u00FA de edici\u00F3n,\n o uno de los m\u00FAltiples servicios web de alineamiento de secuencias.
label.sequences_selection_not_aligned = Las secuencias seleccionadas no están alineadas
-label.sequences_must_be_aligned_before_creating_tree = Las secuencias deben estar alineadas antes de crear el \u00E1rbol.\\nPrueba usando la funci\u00F3n Pad en el men\u00FA de editar,\\n o uno de los m\u00FAltiples servicios web de alineamiento de secuencias.
+label.sequences_must_be_aligned_before_creating_tree = Las secuencias deben estar alineadas antes de crear el \u00E1rbol.\nPrueba usando la funci\u00F3n Pad en el men\u00FA de editar,\n o uno de los m\u00FAltiples servicios web de alineamiento de secuencias.
label.sequences_not_aligned = Secuencias no alineadas
label.problem_reading_tree_file = Problema al leer el fichero del árbol
label.possible_problem_with_tree_file = Posible problema con el fichero del árbol
label.select_at_least_three_bases_in_at_least_one_sequence_to_cDNA_translation = Por favor seleccionar al menos tres bases de al menos una secuencia para poder realizar la traducción de cDNA.
label.translation_failed = Translation Failed
-label.error_when_translating_sequences_submit_bug_report = Desafortunadamente, algo fue mal a la hora de traducir tus secuencias.\\nPor favor, revisa la consola Jalview java \\ny presenta un informe de error que incluya el seguimiento.
+label.error_when_translating_sequences_submit_bug_report = Desafortunadamente, algo fue mal a la hora de traducir tus secuencias.\nPor favor, revisa la consola Jalview java \ny presenta un informe de error que incluya el seguimiento.
label.implementation_error = Error de implementación:
label.automatically_associate_pdb_files_with_sequences_same_name = Quieres asociar automáticamente los {0} ficheros PDB con las secuencias del alineamiento que tengan el mismo nombre?
label.automatically_associate_pdb_files_by_name = Asociar los ficheros PDB por nombre automáticamente
label.enter_view_name = Introducir nombre visible (¿?)
label.enter_label = Introducir etiqueta
label.enter_label_for_the_structure = Introducir una etiqueta para la estructura?
-label.pdb_entry_is_already_displayed = {0} Ya est\u00E1 mostrado.\\nQuieres volver a usar este visor?
+label.pdb_entry_is_already_displayed = {0} Ya est\u00E1 mostrado.\nQuieres volver a usar este visor?
label.map_sequences_to_visible_window = Mapa de secuencias en ventana visible: {0}
-label.add_pdbentry_to_view = Quieres a\u00F1adir {0} a la vista llamada\\n{1}\\n
+label.add_pdbentry_to_view = Quieres a\u00F1adir {0} a la vista llamada\n{1}\n
label.align_to_existing_structure_view = Alinear a una estructura ya existente
-label.pdb_entries_couldnt_be_retrieved = Las siguientes entradas pdb no pueden ser extra\u00EDdas del PDB\\\:\\n{0}\\nPor favor, prueba descarg\u00E1ndolas manualmente.
+label.pdb_entries_couldnt_be_retrieved = Las siguientes entradas pdb no pueden ser extra\u00EDdas del PDB\:\n{0}\nPor favor, prueba descarg\u00E1ndolas manualmente.
label.couldnt_load_file = No se pudo cargar el fichero
label.couldnt_find_pdb_id_in_file = No se pudo encontrar un Id PDB en el fichero suministrado. Por favor, introduzca un Id para identificar esta estructura.
label.no_pdb_id_in_file = No hay un Id PDB en el fichero
label.error_loading_file = Error al cargar el fichero
label.problems_opening_file = Encontrados problemas al abrir el fichero {0}!!
label.file_open_error = Error al abrir el fichero
-label.no_das_sources_selected_warn = No han sido seleccionadas fuentes DAS.\\nPor favor, seleccione algunas fuentes y\\npruebe de nuevo.
+label.no_das_sources_selected_warn = No han sido seleccionadas fuentes DAS.\nPor favor, seleccione algunas fuentes y\npruebe de nuevo.
label.no_das_sources_selected_title = No han sido seleccionadas fuentes DAS
-label.colour_scheme_exists_overwrite = El esquema de colores {0} ya existe.\\nContinuar guardando el esquema de colores como {1}?
+label.colour_scheme_exists_overwrite = El esquema de colores {0} ya existe.\nContinuar guardando el esquema de colores como {1}?
label.duplicate_scheme_name = Duplicar nombre de esquema
-label.jalview_new_questionnaire = Hay un nuevo cuestionario disponible. Querr\u00EDa completarlo ahora ?\\n
+label.jalview_new_questionnaire = Hay un nuevo cuestionario disponible. Querr\u00EDa completarlo ahora ?\n
label.jalview_user_survey = Encuesta de usuario Jalview
label.alignment_properties = Propiedades del alineamiento: {0}
label.alignment_props = Propiedades del alineamiento
error.png_generation_not_implemented = La generación de PNG no se ha implementado todavÃa
error.try_join_vamsas_session_another = Tratando de establecer una sesión VAMSAS cuando ya habÃa otra conectada
error.invalid_vamsas_session_id = Identificador de sesión VAMSAS no válido
-error.implementation_error_cannot_create_groovyshell = Error de implementación:no se puede crear groovyShell sin Groovy en el classpath
label.groovy_support_failed = El soporte Groovy de Jalview ha fallado
label.couldnt_create_groovy_shell = No es posible crear el shell de Groovy. Compruebe el fichero de log para conocer los detalles.
error.unsupported_version_calcIdparam = Versión no soportada de {0}
error.implementation_error_cannot_find_service_url_in_given_set_param_store = Error de implementación: la URL del servicio en el conjunto de URL para este almacén de parámetros del servicio({0})
exception.jobsubmission_invalid_params_set = Conjunto de parámetros no válido. Comprueba la implementación de Jalview
exception.notvaliddata_group_contains_less_than_min_seqs = El grupo contiene menos de {0} secuencias.
-exception.outofmemory_loading_pdb_file = Sin menoria al cargar el fichero PDB
+exception.outofmemory_loading_pdb_file = Sin memoria al cargar el fichero PDB
exception.eps_coudnt_write_output_file = No es posible escribir el fichero de salida: {0}
exception.eps_method_not_supported = Método actualmente no suportado por la versión {0} de EpsGraphics2D
exception.eps_unable_to_get_inverse_matrix = Imposible obtener la inversa de la matrix: {0}
status.refreshing_news = Refrescando noticias
status.importing_vamsas_session_from = Importando sesión VAMSAS de {0}
status.opening_params = Abriendo {0}
-status.waiting_sequence_database_fetchers_init = Esperando la inicialización de los recuperadores de bases de datos de secuencias
+status.waiting_sequence_database_fetchers_init = Esperando inicialización de los recuperadores de bases de datos de secuencias
status.init_sequence_database_fetchers = Inicializando recuperadores de bases de datos de secuencias
status.fetching_sequence_queries_from = Recuperando {0} consultas de secuencias de {1}
status.finshed_querying = Consulta finalizada
label.chimera_missing=Visualizador de estructura Chimera no encontrado.<br/>Por favor, introduzca la ruta de Chimera,<br/>o descargar e instalar la UCSF Chimera.
label.save_as_biojs_html=Guardar como HTML BioJs
exception.pdb_rest_service_no_longer_available=Servicios Rest PDB ya no están disponibles!
+exception.fts_server_unreachable=Jalview no puede conectar con el servidor {0}. \nPor favor asegúrese de que está conectado a Internet y vuelva a intentarlo.
+exception.outofmemory_loading_mmcif_file=Sin memoria al cargar el fichero mmCIF
+label.hide_columns_not_containing=Ocultar las columnas que no contengan
+label.pdb_sequence_fetcher=Recuperador de secuencias PDB
+exception.fts_server_error=Parece que hay un error desde el servidor {0}
+exception.service_not_available=Servicio no disponible. El servidor se está actualizando, vuelva a intentarlo más tarde.
+status.waiting_for_user_to_select_output_file=Esperando que el usuario seleccione el fichero {0}
+action.prev_page=<<
+status.cancelled_image_export_operation=Operación de exportación {0} cancelada
+label.couldnt_run_groovy_script=No se ha podido ejecutar el script Groovy
+exception.bad_request=Solicitud incorrecta. Hay un problema con su entrada.
+label.run_groovy=Ejecutar script Groovy desde la consola
+action.next_page=>>
+label.uniprot_sequence_fetcher=Recuperador de secuencias UniProt
+label.prev_page_tooltip=Página anterior
+label.reverse=Invertir
+label.hide_columns_containing=Ocultar las columnas que contengan
+label.nucleotides=Nucleótidos
+label.run_groovy_tip = Ejecutar script Groovy desde la consola sobre este alineamiento
+label.nw_mapping=Alineamiento Needleman y Wunsch
+label.proteins=ProteÃna
+label.reverse_complement=Invertir y complementar
+label.next_page_tooltip=Página siguiente
+label.sifts_mapping=Mapeado SIFTs
+label.mapping_method=Método de mapeo de secuencia \u27F7 estructura
+info.error_creating_file=Error al crear fichero {0}
+exception.fts_rest_service_no_longer_available= Servicios Rest {0} ya no están disponibles!
+status.launching_3d_structure_viewer=Lanzando visualizador de estructura 3D...
+status.obtaining_mapping_with_sifts=Obteniendo mapeo por SIFTS
+status.fetching_3d_structures_for=Buscando la estructura 3D para {0}
+status.fetching_3d_structures_for_selected_entries=Buscando las estructuras 3D para entradas seleccionadas...
+status.fetching_dbrefs_for_sequences_without_valid_refs=Buscando referencias para {0} secuencia(s) sin referencia válida necesaria para mapeado SIFTS
+status.obtaining_mapping_with_nw_alignment=Obteniendo mapeo por alineamiento Needleman y Wunsch
\ No newline at end of file
<xs:attribute name="end" type="xs:int" use="required" />
<xs:attribute name="id" type="xs:string" use="required" />
<xs:attribute name="hidden" type="xs:boolean" />
+ <xs:attribute name="viewreference" type="xs:boolean" use="optional"/>
</xs:complexType>
</xs:element>
<xs:element name="JGroup" minOccurs="0" maxOccurs="unbounded">
{
EBIFetchClient ebi = new EBIFetchClient();
String query = "pdb:" + pdbentry.getId();
- pdbentry.setFile(ebi.fetchDataAsFile(query, "default", "raw", ".xml")
+ pdbentry.setFile(ebi.fetchDataAsFile(query, "default", ".xml")
.getAbsolutePath());
if (pdbentry.getFile() != null)
return null;
}
- List<ChimeraModel> newModelList = getModelList();
- for (ChimeraModel newModel : newModelList)
+ // patch for Jalview - set model name in Chimera
+ // TODO: find a variant that works for sub-models
+ for (ChimeraModel newModel : getModelList())
{
if (!modelList.contains(newModel))
{
"setattr M name " + modelName + " #"
+ newModel.getModelNumber(), false);
modelList.add(newModel);
-
}
}
// assign color and residues to open models
for (ChimeraModel chimeraModel : modelList)
{
- // // patch for Jalview - set model name in Chimera
- // // TODO: find a variant that works for sub-models
// get model color
Color modelColor = getModelColor(chimeraModel);
if (modelColor != null)
*/
public List<String> sendChimeraCommand(String command, boolean reply)
{
- // System.out.println("chimeradebug>> " + command);
+ // System.out.println("chimeradebug>> " + command);
if (!isChimeraLaunched() || command == null
|| "".equals(command.trim()))
{
import jalview.util.Comparison;
import jalview.util.MapList;
import jalview.util.MappingUtils;
+import jalview.util.StringUtils;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
.codonTranslate(codon));
if (trans != null && !trans.equals(residue))
{
- String desc = residue + "->" + trans;
+ String residue3Char = StringUtils
+ .toSentenceCase(ResidueProperties.aa2Triplet.get(residue));
+ String trans3Char = StringUtils
+ .toSentenceCase(ResidueProperties.aa2Triplet.get(trans));
+ String desc = "p." + residue3Char + peptidePos + trans3Char;
// set score to 0f so 'graduated colour' option is offered! JAL-2060
SequenceFeature sf = new SequenceFeature(
SequenceOntologyI.SEQUENCE_VARIANT, desc, peptidePos,
- peptidePos, 0f, null);
+ peptidePos, 0f, "Jalview");
StringBuilder attributes = new StringBuilder(32);
String id = (String) var.variant.getValue(ID);
if (id != null)
{
AlignmentI copy = new Alignment(new Alignment(seqs));
+ /*
+ * add mappings between sequences to the new alignment
+ */
+ AlignedCodonFrame mappings = new AlignedCodonFrame();
+ copy.addCodonFrame(mappings);
+ for (int i = 0; i < copy.getHeight(); i++)
+ {
+ SequenceI from = seqs[i];
+ SequenceI to = copy.getSequenceAt(i);
+ if (to.getDatasetSequence() != null)
+ {
+ to = to.getDatasetSequence();
+ }
+ int start = from.getStart();
+ int end = from.getEnd();
+ MapList map = new MapList(new int[] { start, end }, new int[] {
+ start, end }, 1, 1);
+ mappings.addMap(to, from, map);
+ }
+
SequenceIdMatcher matcher = new SequenceIdMatcher(seqs);
if (xrefs != null)
{
c = '-';
}
- if (!canonicaliseAa && 'a' <= c && c <= 'z')
- {
- c -= (32); // 32 = 'a' - 'A'
- }
+ c = toUpperCase(c);
}
values[c]++;
}
}
else
{
+ c = toUpperCase(c);
nres++;
if (nres == 1)
}
/**
+ * Returns the upper-cased character if between 'a' and 'z', else the
+ * unchanged value
+ *
+ * @param c
+ * @return
+ */
+ char toUpperCase(char c)
+ {
+ if ('a' <= c && c <= 'z')
+ {
+ c -= (32); // 32 = 'a' - 'A'
+ }
+ return c;
+ }
+
+ /**
* Calculates the conservation sequence
*
* @param consflag
{
if (s != null)
{
- id = new String(s);
+ id = new String(s.toLowerCase());
}
else
{
}
if (s instanceof SeqIdName)
{
- return this.equals(((SeqIdName) s).id);
+ return this.stringequals(((SeqIdName) s).id);
}
else
{
if (s instanceof String)
{
- return this.equals((String) s);
+ return this.stringequals(((String) s).toLowerCase());
}
}
* @param s
* @return boolean
*/
- public boolean equals(String s)
+ private boolean stringequals(String s)
{
if (id.length() > s.length())
{
* This method returns the visible alignment as text, as seen on the GUI, ie
* if columns are hidden they will not be returned in the result. Use this for
* calculating trees, PCA, redundancy etc on views which contain hidden
+ * columns. This method doesn't exclude hidden sequences from the output.
+ *
+ * @param selectedRegionOnly
+ * - determines if only the selected region or entire alignment is
+ * exported
+ * @return String[]
+ */
+ String[] getViewAsString(boolean selectedRegionOnly);
+
+ /**
+ * This method returns the visible alignment as text, as seen on the GUI, ie
+ * if columns are hidden they will not be returned in the result. Use this for
+ * calculating trees, PCA, redundancy etc on views which contain hidden
* columns.
*
+ * @param selectedRegionOnly
+ * - determines if only the selected region or entire alignment is
+ * exported
+ * @param isExportHiddenSeqs
+ * - determines if hidden sequences would be exported or not.
+ *
* @return String[]
*/
- String[] getViewAsString(boolean selectedRegionOnly);
+ String[] getViewAsString(boolean selectedRegionOnly, boolean isExportHiddenSeqs);
void setSelectionGroup(SequenceGroup sg);
*/
void setFollowHighlight(boolean b);
+
public void applyFeaturesStyle(FeatureSettingsModelI featureSettings);
}
import jalview.datamodel.Mapping;
+//JBPComment: this is a datamodel API - so it should be in datamodel (it's a peer of SequenceI)
public interface DBRefEntryI
{
*/
public int getEndRes();
+ /**
+ * access a mapping, if present that can be used to map positions from the
+ * associated dataset sequence to the DBRef's sequence frame.
+ *
+ * @return null or a valid mapping.
+ */
public Mapping getMap();
+
+ /**
+ * Answers true if this object is either equivalent to, or can be 'improved'
+ * by, the given entry. Specifically, answers true if
+ * <ul>
+ * <li>source and accession are identical</li>
+ * <li>version is identical, or this version is of the format "someSource:0",
+ * in which case the version for the other entry replaces it</li>
+ * <li>mappings are not compared but if this entry has no mapping, replace
+ * with that for the other entry</li>
+ * </ul>
+ *
+ * @param otherEntry
+ * @return
+ */
+ public boolean updateFrom(DBRefEntryI otherEntry);
}
import java.util.HashMap;
import java.util.HashSet;
+// JBPComment: this isn't a top-level Jalview API - should be in its own package api
+
public interface SiftsClientI
{
/**
return row;
}
+ @Override
public void actionPerformed(ActionEvent evt)
{
AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation();
boolean resizePanel = false;
+ @Override
public void mouseMoved(MouseEvent evt)
{
resizePanel = evt.getY() < 10 && evt.getX() < 14;
dragCancelled = true;
}
+ @Override
public void mouseDragged(MouseEvent evt)
{
if (dragCancelled)
}
}
+ @Override
public void mouseClicked(MouseEvent evt)
{
}
+ @Override
public void mouseReleased(MouseEvent evt)
{
if (!resizePanel && !dragCancelled)
ap.annotationPanel.repaint();
}
+ @Override
public void mouseEntered(MouseEvent evt)
{
if (evt.getY() < 10 && evt.getX() < 14)
}
}
+ @Override
public void mouseExited(MouseEvent evt)
{
dragCancelled = false;
repaint();
}
+ @Override
public void mousePressed(MouseEvent evt)
{
oldY = evt.getY();
final AlignmentAnnotation aaa = aa[selectedRow];
cbmi.addItemListener(new ItemListener()
{
+ @Override
public void itemStateChanged(ItemEvent e)
{
if (aaa.groupRef != null)
aa[selectedRow].groupRef.isShowConsensusHistogram());
chist.addItemListener(new ItemListener()
{
+ @Override
public void itemStateChanged(ItemEvent e)
{
// TODO: pass on reference
aa[selectedRow].groupRef.isShowSequenceLogo());
cprofl.addItemListener(new ItemListener()
{
+ @Override
public void itemStateChanged(ItemEvent e)
{
// TODO: pass on reference
aa[selectedRow].groupRef.isNormaliseSequenceLogo());
cprofn.addItemListener(new ItemListener()
{
+ @Override
public void itemStateChanged(ItemEvent e)
{
// TODO: pass on reference
av.isShowConsensusHistogram());
chist.addItemListener(new ItemListener()
{
+ @Override
public void itemStateChanged(ItemEvent e)
{
// TODO: pass on reference
av.isShowSequenceLogo());
cprof.addItemListener(new ItemListener()
{
+ @Override
public void itemStateChanged(ItemEvent e)
{
// TODO: pass on reference
av.isNormaliseSequenceLogo());
cprofn.addItemListener(new ItemListener()
{
+ @Override
public void itemStateChanged(ItemEvent e)
{
// TODO: pass on reference
// todo: make the ap scroll to the selection - not necessary, first
// click highlights/scrolls, second selects
ap.seqPanel.ap.idPanel.highlightSearchResults(null);
- ap.av.setSelectionGroup(// new SequenceGroup(
- aa[selectedRow].groupRef); // );
- ap.av.sendSelection();
+ // process modifiers
+ SequenceGroup sg = ap.av.getSelectionGroup();
+ if (sg == null
+ || sg == aa[selectedRow].groupRef
+ || !(jalview.util.Platform.isControlDown(evt) || evt
+ .isShiftDown()))
+ {
+ if (jalview.util.Platform.isControlDown(evt)
+ || evt.isShiftDown())
+ {
+ // clone a new selection group from the associated group
+ ap.av.setSelectionGroup(new SequenceGroup(
+ aa[selectedRow].groupRef));
+ }
+ else
+ {
+ // set selection to the associated group so it can be edited
+ ap.av.setSelectionGroup(aa[selectedRow].groupRef);
+ }
+ }
+ else
+ {
+ // modify current selection with associated group
+ int remainToAdd = aa[selectedRow].groupRef.getSize();
+ for (SequenceI sgs : aa[selectedRow].groupRef.getSequences())
+ {
+ if (jalview.util.Platform.isControlDown(evt))
+ {
+ sg.addOrRemove(sgs, --remainToAdd == 0);
+ }
+ else
+ {
+ // notionally, we should also add intermediate sequences from
+ // last added sequence ?
+ sg.addSequence(sgs, --remainToAdd == 0);
+ }
+ }
+ }
ap.paintAlignment(false);
PaintRefresher.Refresh(ap, ap.av.getSequenceSetId());
+ ap.av.sendSelection();
}
else
{
// we make a copy rather than edit the current selection if no
// modifiers pressed
// see Enhancement JAL-1557
- if (!(evt.isControlDown() || evt.isShiftDown()))
+ if (!(jalview.util.Platform.isControlDown(evt) || evt
+ .isShiftDown()))
{
sg = new SequenceGroup(sg);
sg.clear();
}
else
{
- if (evt.isControlDown())
+ if (jalview.util.Platform.isControlDown(evt))
{
sg.addOrRemove(aa[selectedRow].sequenceRef, true);
}
}
}
+ @Override
public void update(Graphics g)
{
paint(g);
}
+ @Override
public void paint(Graphics g)
{
int w = getSize().width;
Tooltip tooltip;
+ @Override
public void mouseMoved(MouseEvent e)
{
int seq = alignPanel.seqPanel.findSeq(e);
tooltiptext = null;
}
+ @Override
public void mouseDragged(MouseEvent e)
{
mouseDragging = true;
alignPanel.paintAlignment(false);
}
+ @Override
public void mouseClicked(MouseEvent e)
{
if (e.getClickCount() < 2)
}
}
+ @Override
public void mouseEntered(MouseEvent e)
{
if (scrollThread != null)
}
}
+ @Override
public void mouseExited(MouseEvent e)
{
if (av.getWrapAlignment())
}
}
+ @Override
public void mousePressed(MouseEvent e)
{
if (e.getClickCount() > 1)
}
if ((av.getSelectionGroup() == null)
- || ((!e.isControlDown() && !e.isShiftDown()) && av
+ || ((!jalview.util.Platform.isControlDown(e) && !e
+ .isShiftDown()) && av
.getSelectionGroup() != null))
{
av.setSelectionGroup(new SequenceGroup());
}
+ @Override
public void mouseReleased(MouseEvent e)
{
if (scrollThread != null)
running = false;
}
+ @Override
public void run()
{
running = true;
// do we want to thread this ? (contention with seqsel and colsel locks, I
// suspect)
- // rules are: colsel is copied if there is a real intersection between
- // sequence selection
- boolean repaint = false, copycolsel = true;
+ /*
+ * only copy colsel if there is a real intersection between
+ * sequence selection and this panel's alignment
+ */
+ boolean repaint = false;
+ boolean copycolsel = false;
if (av.getSelectionGroup() == null || !av.isSelectionGroupChanged(true))
{
SequenceGroup sgroup = null;
}
sgroup = seqsel.intersect(av.getAlignment(),
(av.hasHiddenRows()) ? av.getHiddenRepSequences() : null);
- if ((sgroup == null || sgroup.getSize() == 0)
- && (colsel == null || colsel.isEmpty()))
+ if ((sgroup != null && sgroup.getSize() > 0))
{
- // don't copy columns if the region didn't intersect.
- copycolsel = false;
+ copycolsel = true;
}
}
if (sgroup != null && sgroup.getSize() > 0)
ColumnSelection cs = MappingUtils.mapColumnSelection(colsel, sourceAv,
av);
av.setColumnSelection(cs);
- av.isColSelChanged(true);
ap.scalePanelHolder.repaint();
ap.repaint();
public class SequenceRenderer implements jalview.api.SequenceRenderer
{
+ final static int CHAR_TO_UPPER = 'A' - 'a';
+
AlignViewport av;
FontMetrics fm;
this.renderGaps = renderGaps;
}
+ @Override
public Color getResidueBoxColour(SequenceI seq, int i)
{
allGroups = av.getAlignment().findAllGroups(seq);
}
if (currentSequenceGroup.getShowNonconserved())
{
- s = getDisplayChar(srep, i, s, '.');
+ s = getDisplayChar(srep, i, s, '.', currentSequenceGroup);
}
}
else
}
if (av.getShowUnconserved())
{
- s = getDisplayChar(srep, i, s, '.');
+ s = getDisplayChar(srep, i, s, '.', null);
}
}
}
- private char getDisplayChar(final boolean usesrep, int position, char s,
- char c)
+ /**
+ * Returns 'conservedChar' to represent the given position if the sequence
+ * character at that position is equal to the consensus (ignoring case), else
+ * returns the sequence character
+ *
+ * @param usesrep
+ * @param position
+ * @param sequenceChar
+ * @param conservedChar
+ * @return
+ */
+ private char getDisplayChar(final boolean usesrep, int position,
+ char sequenceChar, char conservedChar, SequenceGroup currentGroup)
{
// TODO - use currentSequenceGroup rather than alignment
// currentSequenceGroup.getConsensus()
- char conschar = (usesrep) ? av.getAlignment().getSeqrep()
- .getCharAt(position)
- : av.getAlignmentConsensusAnnotation().annotations[position].displayCharacter
- .charAt(0);
- if (!jalview.util.Comparison.isGap(conschar) && s == conschar)
+ char conschar = (usesrep) ? (currentGroup == null
+ || position < currentGroup.getStartRes()
+ || position > currentGroup.getEndRes() ? av.getAlignment()
+ .getSeqrep().getCharAt(position)
+ : (currentGroup.getSeqrep() != null ? currentGroup.getSeqrep()
+ .getCharAt(position) : av.getAlignment().getSeqrep()
+ .getCharAt(position)))
+ : (currentGroup != null && currentGroup.getConsensus() != null
+ && position >= currentGroup.getStartRes()
+ && position <= currentGroup.getEndRes() && currentGroup
+ .getConsensus().annotations.length > position) ? currentGroup
+ .getConsensus().annotations[position].displayCharacter
+ .charAt(0)
+ : av.getAlignmentConsensusAnnotation().annotations[position].displayCharacter
+ .charAt(0);
+ if (!jalview.util.Comparison.isGap(conschar)
+ && (sequenceChar == conschar || sequenceChar + CHAR_TO_UPPER == conschar))
{
- s = c;
+ sequenceChar = conservedChar;
}
- return s;
+ return sequenceChar;
}
boolean inCurrentSequenceGroup(int res)
--- /dev/null
+package jalview.bin;
+
+import java.net.URLDecoder;
+import java.util.Vector;
+
+/**
+ * Notes: this argParser does not distinguish between parameter switches,
+ * parameter values and argument text. If an argument happens to be identical to
+ * a parameter, it will be taken as such (even though it didn't have a '-'
+ * prefixing it).
+ *
+ * @author Andrew Waterhouse and JBP documented.
+ *
+ */
+public class ArgsParser
+{
+ Vector<String> vargs = null;
+
+ public ArgsParser(String[] args)
+ {
+ vargs = new Vector<String>();
+ for (int i = 0; i < args.length; i++)
+ {
+ String arg = args[i].trim();
+ if (arg.charAt(0) == '-')
+ {
+ arg = arg.substring(1);
+ }
+ vargs.addElement(arg);
+ }
+ }
+
+ /**
+ * check for and remove first occurence of arg+parameter in arglist.
+ *
+ * @param arg
+ * @return return the argument following the given arg if arg was in list.
+ */
+ public String getValue(String arg)
+ {
+ return getValue(arg, false);
+ }
+
+ public String getValue(String arg, boolean utf8decode)
+ {
+ int index = vargs.indexOf(arg);
+ String dc = null, ret = null;
+ if (index != -1)
+ {
+ ret = vargs.elementAt(index + 1).toString();
+ vargs.removeElementAt(index);
+ vargs.removeElementAt(index);
+ if (utf8decode && ret != null)
+ {
+ try
+ {
+ dc = URLDecoder.decode(ret, "UTF-8");
+ ret = dc;
+ } catch (Exception e)
+ {
+ // TODO: log failure to decode
+ }
+ }
+ }
+ return ret;
+ }
+
+ /**
+ * check for and remove first occurence of arg in arglist.
+ *
+ * @param arg
+ * @return true if arg was present in argslist.
+ */
+ public boolean contains(String arg)
+ {
+ if (vargs.contains(arg))
+ {
+ vargs.removeElement(arg);
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ public String nextValue()
+ {
+ return vargs.remove(0);
+ }
+
+ public int getSize()
+ {
+ return vargs.size();
+ }
+
+}
\ No newline at end of file
System.out
.println("Jalview Version: " + codeVersion + codeInstallation);
- Pdb.setCurrentDefaultFomart(jalview.bin.Cache.getDefault(
+ Pdb.setCurrentDefaultFormat(jalview.bin.Cache.getDefault(
"DEFAULT_STRUCTURE_FORMAT", DEFAULT_STRUCTURE_FORMAT));
// jnlpVersion will be null if we're using InstallAnywhere
// Dont do this check if running in headless mode
*/
package jalview.bin;
+import groovy.lang.Binding;
+import groovy.util.GroovyScriptEngine;
+
import jalview.gui.AlignFrame;
import jalview.gui.Desktop;
+import jalview.gui.PromptUserConfig;
+import jalview.io.AppletFormatAdapter;
import jalview.io.BioJsHTMLOutput;
+import jalview.io.FileLoader;
+import jalview.io.FormatAdapter;
import jalview.io.HtmlSvgOutput;
+import jalview.io.IdentifyFile;
+import jalview.io.NewickFile;
+import jalview.schemes.ColourSchemeI;
+import jalview.schemes.ColourSchemeProperty;
+import jalview.schemes.UserColourScheme;
import jalview.util.MessageManager;
import jalview.util.Platform;
import jalview.ws.jws2.Jws2Discoverer;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
+import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
-import java.lang.reflect.Constructor;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
-import java.net.URLDecoder;
import java.security.AllPermission;
import java.security.CodeSource;
import java.security.PermissionCollection;
*/
public class Jalview
{
+ /*
+ * singleton instance of this class
+ */
+ private static Jalview instance;
+
+ private Desktop desktop;
+
+ public static AlignFrame currentAlignFrame;
+
static
{
// grab all the rights we can the JVM
}
/**
+ * keep track of feature fetching tasks.
+ *
+ * @author JimP
+ *
+ */
+ class FeatureFetcher
+ {
+ /*
+ * TODO: generalise to track all jalview events to orchestrate batch
+ * processing events.
+ */
+
+ private int queued = 0;
+
+ private int running = 0;
+
+ public FeatureFetcher()
+ {
+
+ }
+
+ public void addFetcher(final AlignFrame af,
+ final Vector<String> dasSources)
+ {
+ final long id = System.currentTimeMillis();
+ queued++;
+ final FeatureFetcher us = this;
+ new Thread(new Runnable()
+ {
+
+ @Override
+ public void run()
+ {
+ synchronized (us)
+ {
+ queued--;
+ running++;
+ }
+
+ af.setProgressBar(MessageManager
+ .getString("status.das_features_being_retrived"), id);
+ af.featureSettings_actionPerformed(null);
+ af.featureSettings.fetchDasFeatures(dasSources, true);
+ af.setProgressBar(null, id);
+ synchronized (us)
+ {
+ running--;
+ }
+ }
+ }).start();
+ }
+
+ public synchronized boolean allFinished()
+ {
+ return queued == 0 && running == 0;
+ }
+
+ }
+
+ public static Jalview getInstance()
+ {
+ return instance;
+ }
+
+ /**
* main class for Jalview application
*
* @param args
*/
public static void main(String[] args)
{
+ instance = new Jalview();
+ instance.doMain(args);
+ }
+
+ /**
+ * @param args
+ */
+ void doMain(String[] args)
+ {
System.setSecurityManager(null);
System.out.println("Java version: "
+ System.getProperty("java.version"));
try
{
Cache.initLogger();
- } catch (java.lang.NoClassDefFoundError error)
+ } catch (NoClassDefFoundError error)
{
error.printStackTrace();
System.out
System.exit(0);
}
- Desktop desktop = null;
+ desktop = null;
try
{
}
String file = null, protocol = null, format = null, data = null;
- jalview.io.FileLoader fileLoader = new jalview.io.FileLoader(!headless);
- Vector getFeatures = null; // vector of das source nicknames to fetch
+ FileLoader fileLoader = new FileLoader(!headless);
+ Vector<String> getFeatures = null; // vector of das source nicknames to
+ // fetch
// features from
// loading is done.
String groovyscript = null; // script to execute after all loading is
System.out.println("No files to open!");
System.exit(1);
}
- String vamsasImport = aparser.getValue("vdoc"), vamsasSession = aparser
- .getValue("vsess");
+ String vamsasImport = aparser.getValue("vdoc");
+ String vamsasSession = aparser.getValue("vsess");
if (vamsasImport != null || vamsasSession != null)
{
if (desktop == null || headless)
{
try
{
- String viprotocol = jalview.io.AppletFormatAdapter
+ String viprotocol = AppletFormatAdapter
.checkProtocol(vamsasImport);
if (viprotocol == jalview.io.FormatAdapter.FILE)
{
inSession = desktop.vamsasImport(new File(vamsasImport));
}
- else if (viprotocol == jalview.io.FormatAdapter.URL)
+ else if (viprotocol == FormatAdapter.URL)
{
inSession = desktop.vamsasImport(new URL(vamsasImport));
}
if (!file.startsWith("http://"))
{
- if (!(new java.io.File(file)).exists())
+ if (!(new File(file)).exists())
{
System.out.println("Can't find " + file);
if (headless)
}
}
- protocol = jalview.io.AppletFormatAdapter.checkProtocol(file);
+ protocol = AppletFormatAdapter.checkProtocol(file);
- format = new jalview.io.IdentifyFile().identify(file, protocol);
+ format = new IdentifyFile().identify(file, protocol);
AlignFrame af = fileLoader.LoadFileWaitTillLoaded(file, protocol,
format);
}
else
{
- Desktop.setCurrentAlignFrame(af);
+ setCurrentAlignFrame(af);
data = aparser.getValue("colour", true);
if (data != null)
{
data.replaceAll("%20", " ");
- jalview.schemes.ColourSchemeI cs = jalview.schemes.ColourSchemeProperty
- .getColour(af.getViewport().getAlignment(), data);
+ ColourSchemeI cs = ColourSchemeProperty.getColour(af
+ .getViewport().getAlignment(), data);
if (cs == null)
{
- jalview.schemes.UserColourScheme ucs = new jalview.schemes.UserColourScheme(
- "white");
+ UserColourScheme ucs = new UserColourScheme("white");
ucs.parseAppletParameter(data);
cs = ucs;
}
if (data != null)
{
af.parseFeaturesFile(data,
- jalview.io.AppletFormatAdapter.checkProtocol(data));
+ AppletFormatAdapter.checkProtocol(data));
// System.out.println("Added " + data);
System.out.println("CMD groups[-" + data
+ "] executed successfully!");
if (data != null)
{
af.parseFeaturesFile(data,
- jalview.io.AppletFormatAdapter.checkProtocol(data));
+ AppletFormatAdapter.checkProtocol(data));
// System.out.println("Added " + data);
System.out.println("CMD [-features " + data
+ "] executed successfully!");
{
System.out.println("CMD [-tree " + data
+ "] executed successfully!");
- fin = new jalview.io.NewickFile(data,
- jalview.io.AppletFormatAdapter.checkProtocol(data));
+ fin = new NewickFile(data,
+ AppletFormatAdapter.checkProtocol(data));
if (fin != null)
{
af.getViewport().setCurrentTree(
// Execute the groovy script after we've done all the rendering stuff
// and before any images or figures are generated.
System.out.println("Executing script " + groovyscript);
- executeGroovyScript(groovyscript, new Object[] { desktop, af });
+ executeGroovyScript(groovyscript, af);
System.out.println("CMD groovy[" + groovyscript
+ "] executed successfully!");
groovyscript = null;
if (format.equalsIgnoreCase("png"))
{
- af.createPNG(new java.io.File(file));
- imageName = (new java.io.File(file)).getName();
+ af.createPNG(new File(file));
+ imageName = (new File(file)).getName();
System.out.println("Creating PNG image: " + file);
continue;
}
else if (format.equalsIgnoreCase("svg"))
{
- File imageFile = new java.io.File(file);
+ File imageFile = new File(file);
imageName = imageFile.getName();
af.createSVG(imageFile);
System.out.println("Creating SVG image: " + file);
}
else if (format.equalsIgnoreCase("html"))
{
- File imageFile = new java.io.File(file);
+ File imageFile = new File(file);
imageName = imageFile.getName();
- new HtmlSvgOutput(new java.io.File(file), af.alignPanel);
+ new HtmlSvgOutput(new File(file), af.alignPanel);
System.out.println("Creating HTML image: " + file);
continue;
}
else if (format.equalsIgnoreCase("imgMap"))
{
- af.createImageMap(new java.io.File(file), imageName);
+ af.createImageMap(new File(file), imageName);
System.out.println("Creating image map: " + file);
continue;
}
else if (format.equalsIgnoreCase("eps"))
{
- File outputFile = new java.io.File(file);
+ File outputFile = new File(file);
System.out.println("Creating EPS file: "
+ outputFile.getAbsolutePath());
af.createEPS(outputFile);
}
else
{
- format = new jalview.io.IdentifyFile().identify(file, protocol);
+ format = new IdentifyFile().identify(file, protocol);
}
startUpAlframe = fileLoader.LoadFileWaitTillLoaded(file, protocol,
// Once all other stuff is done, execute any groovy scripts (in order)
if (groovyscript != null)
{
- if (jalview.bin.Cache.groovyJarsPresent())
+ if (Cache.groovyJarsPresent())
{
System.out.println("Executing script " + groovyscript);
- executeGroovyScript(groovyscript, new Object[] { desktop,
- startUpAlframe });
+ executeGroovyScript(groovyscript, startUpAlframe);
}
else
{
/**
* start a User Config prompt asking if we can log usage statistics.
*/
- jalview.gui.PromptUserConfig prompter = new jalview.gui.PromptUserConfig(
- desktop.desktop,
+ PromptUserConfig prompter = new PromptUserConfig(
+ Desktop.desktop,
"USAGESTATS",
"Jalview Usage Statistics",
"Do you want to help make Jalview better by enabling "
* the Jalview Desktop object passed in to the groovy binding as the
* 'Jalview' object.
*/
- private static void executeGroovyScript(String groovyscript,
- Object[] jalviewContext)
+ private void executeGroovyScript(String groovyscript, AlignFrame af)
{
- if (jalviewContext == null)
- {
- System.err
- .println("Sorry. Groovy support is currently only available when running with the Jalview GUI enabled.");
- }
/**
* for scripts contained in files
*/
tfile = File.createTempFile("jalview", "groovy");
PrintWriter outfile = new PrintWriter(new OutputStreamWriter(
new FileOutputStream(tfile)));
- BufferedReader br = new BufferedReader(
- new java.io.InputStreamReader(System.in));
+ BufferedReader br = new BufferedReader(new InputStreamReader(
+ System.in));
String line = null;
while ((line = br.readLine()) != null)
{
}
}
}
- boolean success = false;
try
{
- /*
- * The following code performs the GroovyScriptEngine invocation using
- * reflection, and is equivalent to this fragment from the embedding
- * groovy documentation on the groovy site: <code> import
- * groovy.lang.Binding; import groovy.util.GroovyScriptEngine;
- *
- * String[] roots = new String[] { "/my/groovy/script/path" };
- * GroovyScriptEngine gse = new GroovyScriptEngine(roots); Binding binding
- * = new Binding(); binding.setVariable("input", "world");
- * gse.run("hello.groovy", binding); </code>
- */
- Class<?>[] bspec;
- Object[] binding;
- int blen = ((jalviewContext[0] == null) ? 0 : 1)
- + ((jalviewContext[1] == null) ? 0 : 1);
- String cnames[] = new String[] { "Jalview", "currentAlFrame" };
- bspec = new Class[blen * 2];
- binding = new Object[blen * 2];
- blen = 0;
- ClassLoader cl = null;
Map<String, Object> vbinding = new HashMap<String, Object>();
- for (int jc = 0; jc < jalviewContext.length; jc++)
+ vbinding.put("Jalview", this);
+ if (af != null)
{
- if (jalviewContext[jc] != null)
- {
- if (cl == null)
- {
- cl = jalviewContext[jc].getClass().getClassLoader();
- }
- bspec[blen * 2] = String.class;
- bspec[blen * 2 + 1] = Object.class;
- binding[blen * 2] = cnames[jc];
- binding[blen * 2 + 1] = jalviewContext[jc];
- vbinding.put(cnames[jc], jalviewContext[jc]);
- blen++;
- }
+ vbinding.put("currentAlFrame", af);
}
- Class<?> gbindingc = cl.loadClass("groovy.lang.Binding");
- Constructor<?> gbcons;
- Object gbinding;
- try
- {
- gbcons = gbindingc.getConstructor(Map.class);
- gbinding = gbcons.newInstance(vbinding);
- } catch (NoSuchMethodException x)
+ Binding gbinding = new Binding(vbinding);
+ GroovyScriptEngine gse = new GroovyScriptEngine(new URL[] { sfile });
+ gse.run(sfile.toString(), gbinding);
+ if ("STDIN".equals(groovyscript))
{
- // old style binding config - using series of string/object values to
- // setVariable.
- gbcons = gbindingc.getConstructor();
- gbinding = gbcons.newInstance();
- java.lang.reflect.Method setvar = gbindingc.getMethod(
- "setVariable", bspec);
- setvar.invoke(gbinding, binding);
+ // delete temp file that we made -
+ // only if it was successfully executed
+ tfile.delete();
}
-
- Class<?> gsec = cl.loadClass("groovy.util.GroovyScriptEngine");
- Constructor<?> gseccons = gsec
- .getConstructor(new Class[] { URL[].class }); // String[].class
- // });
- Object gse = gseccons
- .newInstance(new Object[] { new URL[] { sfile } }); // .toString()
- // } });
- java.lang.reflect.Method run = gsec.getMethod("run", new Class[] {
- String.class, gbindingc });
- run.invoke(gse, new Object[] { sfile.toString(), gbinding });
- success = true;
} catch (Exception e)
{
System.err.println("Exception Whilst trying to execute file " + sfile
e.printStackTrace(System.err);
}
- if (success && groovyscript.equals("STDIN"))
- {
- // delete temp file that we made - but only if it was successfully
- // executed
- tfile.delete();
- }
}
/**
*
* @return vector of DAS source nicknames to retrieve from
*/
- private static Vector checkDasArguments(ArgsParser aparser)
+ private static Vector<String> checkDasArguments(ArgsParser aparser)
{
- Vector source = null;
+ Vector<String> source = null;
String data;
String locsources = Cache.getProperty(Cache.DAS_LOCAL_SOURCE);
while ((data = aparser.getValue("dasserver", true)) != null)
{
String nickname = null;
String url = null;
- boolean seq = false, feat = true;
int pos = data.indexOf('=');
// determine capabilities
if (pos > 0)
+ nickname + "|" + url);
if (source == null)
{
- source = new Vector();
+ source = new Vector<String>();
}
source.addElement(nickname);
}
System.out.println("adding source '" + data + "'");
if (source == null)
{
- source = new Vector();
+ source = new Vector<String>();
}
source.addElement(data);
}
*
* @param dasSources
*/
- private static FeatureFetcher startFeatureFetching(final Vector dasSources)
+ private FeatureFetcher startFeatureFetching(
+ final Vector<String> dasSources)
{
FeatureFetcher ff = new FeatureFetcher();
AlignFrame afs[] = Desktop.getAlignFrames();
}
return false;
}
-}
-
-/**
- * Notes: this argParser does not distinguish between parameter switches,
- * parameter values and argument text. If an argument happens to be identical to
- * a parameter, it will be taken as such (even though it didn't have a '-'
- * prefixing it).
- *
- * @author Andrew Waterhouse and JBP documented.
- *
- */
-
-class rnabuttonlistener implements ActionListener
-{
- @Override
- public void actionPerformed(ActionEvent arg0)
- {
- System.out.println("Good idea ! ");
-
- }
-}
-
-class pbuttonlistener implements ActionListener
-{
- @Override
- public void actionPerformed(ActionEvent arg0)
- {
-
- }
-}
-
-class ArgsParser
-{
- Vector vargs = null;
- public ArgsParser(String[] args)
- {
- vargs = new Vector();
- for (int i = 0; i < args.length; i++)
- {
- String arg = args[i].trim();
- if (arg.charAt(0) == '-')
- {
- arg = arg.substring(1);
- }
- vargs.addElement(arg);
- }
- }
-
- /**
- * check for and remove first occurence of arg+parameter in arglist.
- *
- * @param arg
- * @return return the argument following the given arg if arg was in list.
- */
- public String getValue(String arg)
+ public AlignFrame[] getAlignFrames()
{
- return getValue(arg, false);
- }
+ return desktop == null ? new AlignFrame[] { getCurrentAlignFrame() }
+ : Desktop.getAlignFrames();
- public String getValue(String arg, boolean utf8decode)
- {
- int index = vargs.indexOf(arg);
- String dc = null, ret = null;
- if (index != -1)
- {
- ret = vargs.elementAt(index + 1).toString();
- vargs.removeElementAt(index);
- vargs.removeElementAt(index);
- if (utf8decode && ret != null)
- {
- try
- {
- dc = URLDecoder.decode(ret, "UTF-8");
- ret = dc;
- } catch (Exception e)
- {
- // TODO: log failure to decode
- }
- }
- }
- return ret;
}
/**
- * check for and remove first occurence of arg in arglist.
- *
- * @param arg
- * @return true if arg was present in argslist.
+ * Quit method delegates to Desktop.quit - unless running in headless mode
+ * when it just ends the JVM
*/
- public boolean contains(String arg)
+ public void quit()
{
- if (vargs.contains(arg))
+ if (desktop != null)
{
- vargs.removeElement(arg);
- return true;
+ desktop.quit();
}
else
{
- return false;
+ System.exit(0);
}
}
- public String nextValue()
+ public static AlignFrame getCurrentAlignFrame()
{
- return vargs.remove(0).toString();
+ return Jalview.currentAlignFrame;
}
- public int getSize()
+ public static void setCurrentAlignFrame(AlignFrame currentAlignFrame)
{
- return vargs.size();
+ Jalview.currentAlignFrame = currentAlignFrame;
}
-
-}
-
-/**
- * keep track of feature fetching tasks.
- *
- * @author JimP
- *
- */
-class FeatureFetcher
-{
- /*
- * TODO: generalise to track all jalview events to orchestrate batch
- * processing events.
- */
-
- private int queued = 0;
-
- private int running = 0;
-
- public FeatureFetcher()
- {
-
- }
-
- public void addFetcher(final AlignFrame af, final Vector dasSources)
- {
- final long id = System.currentTimeMillis();
- queued++;
- final FeatureFetcher us = this;
- new Thread(new Runnable()
- {
-
- @Override
- public void run()
- {
- synchronized (us)
- {
- queued--;
- running++;
- }
-
- af.setProgressBar(MessageManager
- .getString("status.das_features_being_retrived"), id);
- af.featureSettings_actionPerformed(null);
- af.featureSettings.fetchDasFeatures(dasSources, true);
- af.setProgressBar(null, id);
- synchronized (us)
- {
- running--;
- }
- }
- }).start();
- }
-
- public synchronized boolean allFinished()
- {
- return queued == 0 && running == 0;
- }
-
}
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.Set;
}
}
+ /**
+ * adds a set of mappings (while ignoring any duplicates)
+ */
+ @Override
+ public void addCodonFrames(Iterable<AlignedCodonFrame> codons)
+ {
+ if (codons != null)
+ {
+ Iterator<AlignedCodonFrame> it = codons.iterator();
+ while (it.hasNext())
+ {
+ addCodonFrame(it.next());
+ }
+ }
+ }
+
/*
* (non-Javadoc)
*
void addCodonFrame(AlignedCodonFrame codons);
/**
+ * add a set of aligned codons mappings for this alignment, apart from any
+ * duplicates which are ignored
+ *
+ * @param codons
+ */
+ void addCodonFrames(Iterable<AlignedCodonFrame> codons);
+
+ /**
* remove a particular codon frame reference from this alignment
*
* @param codons
import java.util.Vector;
/**
- * NOTE: Columns are zero based.
+ * Data class holding the selected columns and hidden column ranges for a view.
+ * Ranges are base 1.
*/
public class ColumnSelection
{
+ /**
+ * A class to hold an efficient representation of selected columns
+ */
private class IntList
{
/*
}
return rlist;
}
+
+ @Override
+ public int hashCode()
+ {
+ // TODO Auto-generated method stub
+ return selected.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj instanceof IntList)
+ {
+ return ((IntList) obj).selected.equals(selected);
+ }
+ return false;
+ }
}
- IntList selected = new IntList();
+ IntList selection = new IntList();
/*
* list of hidden column [start, end] ranges; the list is maintained in
*/
public void addElement(int col)
{
- selected.add(col);
+ selection.add(col);
}
/**
*/
public void clear()
{
- selected.clear();
+ selection.clear();
}
/**
*/
public void removeElement(int col)
{
- selected.remove(col);
+ selection.remove(col);
}
/**
for (int i = start; i < end; i++)
{
colInt = new Integer(i);
- if (selected.contains(colInt))
+ if (selection.contains(colInt))
{
- selected.remove(colInt);
+ selection.remove(colInt);
}
}
}
*/
public List<Integer> getSelected()
{
- return selected.getList();
+ return selection.getList();
}
/**
*/
public List<int[]> getSelectedRanges()
{
- return selected.getRanges();
+ return selection.getRanges();
}
/**
*/
public boolean contains(int col)
{
- return (col > -1) ? selected.isSelected(col) : false;
+ return (col > -1) ? selection.isSelected(col) : false;
}
/**
*/
public boolean isEmpty()
{
- return selected == null || selected.isEmpty();
+ return selection == null || selection.isEmpty();
}
/**
*/
public int getMax()
{
- if (selected.isEmpty())
+ if (selection.isEmpty())
{
return -1;
}
- return selected.getMaxColumn();
+ return selection.getMaxColumn();
}
/**
*/
public int getMin()
{
- if (selected.isEmpty())
+ if (selection.isEmpty())
{
return 1000000000;
}
- return selected.getMinColumn();
+ return selection.getMinColumn();
}
/**
public List<int[]> compensateForEdit(int start, int change)
{
List<int[]> deletedHiddenColumns = null;
- selected.compensateForEdits(start, change);
+ selection.compensateForEdits(start, change);
if (hiddenColumns != null)
{
private void compensateForDelEdits(int start, int change)
{
- selected.compensateForEdits(start, change);
+ selection.compensateForEdits(start, change);
if (hiddenColumns != null)
{
hiddenColumns = null;
}
}
- if (selected != null && selected.size() > 0)
+ if (selection != null && selection.size() > 0)
{
- selected.pruneColumnList(shifts);
- if (selected != null && selected.size() == 0)
+ selection.pruneColumnList(shifts);
+ if (selection != null && selection.size() == 0)
{
- selected = null;
+ selection = null;
}
}
// and shift the rest.
public void hideSelectedColumns()
{
- synchronized (selected)
+ synchronized (selection)
{
- for (int[] selregions : selected.getRanges())
+ for (int[] selregions : selection.getRanges())
{
hideColumns(selregions[0], selregions[1]);
}
- selected.clear();
+ selection.clear();
}
}
{
if (copy != null)
{
- if (copy.selected != null)
+ if (copy.selection != null)
{
- selected = new IntList();
- for (int i = 0, j = copy.selected.size(); i < j; i++)
+ selection = new IntList();
+ for (int i = 0, j = copy.selection.size(); i < j; i++)
{
- selected.add(copy.selected.elementAt(i));
+ selection.add(copy.selection.elementAt(i));
}
}
if (copy.hiddenColumns != null)
{
if (hiddenColumns != null && isVisible(col.intValue()))
{
- selected.add(col);
+ selection.add(col);
}
}
}
*/
public void setElementsFrom(ColumnSelection colsel)
{
- selected = new IntList();
- if (colsel.selected != null && colsel.selected.size() > 0)
+ selection = new IntList();
+ if (colsel.selection != null && colsel.selection.size() > 0)
{
if (hiddenColumns != null && hiddenColumns.size() > 0)
{
*/
public boolean hasSelectedColumns()
{
- return (selected != null && selected.size() > 0);
+ return (selection != null && selection.size() > 0);
}
/**
return false;
}
+ /**
+ * Returns a hashCode built from selected columns and hidden column ranges
+ */
+ @Override
+ public int hashCode()
+ {
+ int hashCode = selection.hashCode();
+ if (hiddenColumns != null)
+ {
+ for (int[] hidden : hiddenColumns)
+ {
+ hashCode = 31 * hashCode + hidden[0];
+ hashCode = 31 * hashCode + hidden[1];
+ }
+ }
+ return hashCode;
+ }
+
+ /**
+ * Answers true if comparing to a ColumnSelection with the same selected
+ * columns and hidden columns, else false
+ */
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (!(obj instanceof ColumnSelection))
+ {
+ return false;
+ }
+ ColumnSelection that = (ColumnSelection) obj;
+
+ /*
+ * check columns selected are either both null, or match
+ */
+ if (this.selection == null)
+ {
+ if (that.selection != null)
+ {
+ return false;
+ }
+ }
+ if (!this.selection.equals(that.selection))
+ {
+ return false;
+ }
+
+ /*
+ * check hidden columns are either both null, or match
+ */
+ if (this.hiddenColumns == null)
+ {
+ return (that.hiddenColumns == null);
+ }
+ if (that.hiddenColumns == null
+ || that.hiddenColumns.size() != this.hiddenColumns.size())
+ {
+ return false;
+ }
+ int i = 0;
+ for (int[] thisRange : hiddenColumns)
+ {
+ int[] thatRange = that.hiddenColumns.get(i++);
+ if (thisRange[0] != thatRange[0] || thisRange[1] != thatRange[1])
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
}
}
/**
+ * Answers true if this object is either equivalent to, or can be 'improved'
+ * by, the given entry. Specifically, answers true if
+ * <ul>
+ * <li>source and accession are identical (ignoring case)</li>
+ * <li>version is identical (ignoring case), or this version is of the format
+ * "someSource:0", in which case the version for the other entry replaces it</li>
+ * <li>mappings are not compared but if this entry has no mapping, replace
+ * with that for the other entry</li>
+ * </ul>
+ *
+ * @param other
+ * @return
+ */
+ @Override
+ public boolean updateFrom(DBRefEntryI other)
+ {
+ if (other == null)
+ {
+ return false;
+ }
+ if (other == this)
+ {
+ return true;
+ }
+
+ /*
+ * source must either match or be both null
+ */
+ String otherSource = other.getSource();
+ if ((source == null && otherSource != null)
+ || (source != null && otherSource == null)
+ || (source != null && !source.equalsIgnoreCase(otherSource)))
+ {
+ return false;
+ }
+
+ /*
+ * accession id must either match or be both null
+ */
+ String otherAccession = other.getAccessionId();
+ if ((accessionId == null && otherAccession != null)
+ || (accessionId != null && otherAccession == null)
+ || (accessionId != null && !accessionId.equalsIgnoreCase(otherAccession)))
+ {
+ return false;
+ }
+
+ /*
+ * if my version is null, "0" or "source:0" then replace with other version,
+ * otherwise the versions have to match
+ */
+ String otherVersion = other.getVersion();
+ if ((version == null || version.equals("0") || version.endsWith(":0"))
+ && otherVersion != null)
+ {
+ setVersion(otherVersion);
+ }
+ else
+ {
+ if (!version.equalsIgnoreCase(otherVersion))
+ {
+ return false;
+ }
+ }
+
+ /*
+ * if I have no mapping, take that of the other dbref
+ */
+ if (map == null)
+ {
+ setMap(other.getMap());
+ }
+ return true;
+ }
+
+ /**
* test for similar DBRef attributes, except for the map object.
*
* @param entry
@Override
public boolean equalRef(DBRefEntryI entry)
{
+ // TODO is this method and equals() not needed?
if (entry == null)
{
return false;
*/
public static final String ENSEMBL = "ENSEMBL";
+ public static final String ENSEMBLGENOMES = "ENSEMBLGENOMES";
+
/**
* List of databases whose sequences might have coding regions annotated
*/
*/
public class FeatureProperties
{
-
- private static final String EMBL_CODING_FEATURE = "CDS";
+ public static final String EMBL_CODING_FEATURE = "CDS";
public static final String EXONPOS = "exon number";
return alignmentIndex;
}
+ /**
+ * makes a copy of the alignment with hidden sequences included. Using the
+ * copy for anything other than simple output is not recommended. Note - this
+ * method DOES NOT USE THE AlignmentI COPY CONSTRUCTOR!
+ * @return
+ */
public AlignmentI getFullAlignment()
{
int isize = hiddenSequences.length;
fAlignmt.alignmentProperties = alignment.getProperties();
fAlignmt.groups = alignment.getGroups();
fAlignmt.hasRNAStructure = alignment.hasRNAStructure();
+ fAlignmt.setSeqrep(alignment.getSeqrep());
return fAlignmt;
}
dbrefs = new DBRefEntry[0];
}
- int i, iSize = dbrefs.length;
-
- for (i = 0; i < iSize; i++)
+ for (DBRefEntryI dbr : dbrefs)
{
- if (dbrefs[i].equalRef(entry))
+ if (dbr.updateFrom(entry))
{
- if (entry.getMap() != null)
- {
- if (dbrefs[i].getMap() == null)
- {
- // overwrite with 'superior' entry that contains a mapping.
- dbrefs[i] = entry;
- }
- }
+ /*
+ * found a dbref that either matched, or could be
+ * updated from, the new entry - no need to add it
+ */
return;
}
}
- DBRefEntry[] temp = new DBRefEntry[iSize + 1];
- System.arraycopy(dbrefs, 0, temp, 0, iSize);
+ /*
+ * extend the array to make room for one more
+ */
+ // TODO use an ArrayList instead
+ int j = dbrefs.length;
+ DBRefEntry[] temp = new DBRefEntry[j + 1];
+ System.arraycopy(dbrefs, 0, temp, 0, j);
temp[temp.length - 1] = entry;
dbrefs = temp;
// private key for Phase designed not to conflict with real GFF data
private static final String PHASE = "!Phase";
+ // private key for ENA location designed not to conflict with real GFF data
+ private static final String LOCATION = "!Location";
+
/*
* ATTRIBUTES is reserved for the GFF 'column 9' data, formatted as
* name1=value1;name2=value2,value3;...etc
public String description;
+ /*
+ * a map of key-value pairs; may be populated from GFF 'column 9' data,
+ * other data sources (e.g. GenBank file), or programmatically
+ */
public Map<String, Object> otherDetails;
public Vector<String> links;
}
/**
+ * Sets the 'raw' ENA format location specifier e.g. join(12..45,89..121)
+ *
+ * @param loc
+ */
+ public void setEnaLocation(String loc)
+ {
+ setValue(LOCATION, loc);
+ }
+
+ /**
+ * Gets the 'raw' ENA format location specifier e.g. join(12..45,89..121)
+ *
+ * @param loc
+ */
+ public String getEnaLocation()
+ {
+ return (String) getValue(LOCATION);
+ }
+
+ /**
* Readable representation, for debug only, not guaranteed not to change
* between versions
*/
/**
* @return the representative sequence for this group
*/
+ @Override
public SequenceI getSeqrep()
{
return seqrep;
* @param seqrep
* the seqrep to set (null means no sequence representative)
*/
+ @Override
public void setSeqrep(SequenceI seqrep)
{
this.seqrep = seqrep;
*
* @return true if group has a sequence representative
*/
+ @Override
public boolean hasSeqrep()
{
return seqrep != null;
/**
*
- * @return automatically calculated consensus row
+ * @return automatically calculated consensus row note: the row is a stub if a
+ * consensus calculation has not yet been performed on the group
*/
public AlignmentAnnotation getConsensus()
{
*/
public PDBEntry getPDBEntry(String pdbId);
+ /**
+ * Set the distinct source database, and accession number from which a
+ * sequence and its start-end data were derived from. This is very important
+ * for SIFTS mappings and must be set prior to performing SIFTS mapping.
+ *
+ * @param dbRef
+ * the source dbRef for the sequence
+ */
public void setSourceDBRef(DBRefEntryI dbRef);
+ /**
+ * Get the distinct source database, and accession number from which a
+ * sequence and its start-end data were derived from.
+ *
+ * @return
+ */
public DBRefEntryI getSourceDBRef();
}
+++ /dev/null
-/*
- * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
- * Copyright (C) $$Year-Rel$$ The Jalview Authors
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3
- * of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- * The Jalview Authors are detailed in the 'AUTHORS' file.
- */
-package jalview.datamodel.xdb.embl;
-
-/**
- * Data model for a feature/location/locationElement/basePosition read from an
- * EMBL query reply
- *
- * @see embl_mapping.xml
- */
-public class BasePosition
-{
- String type;
-
- String pos;
-
- /**
- * @return the pos
- */
- public String getPos()
- {
- return pos;
- }
-
- /**
- * @param pos
- * the pos to set
- */
- public void setPos(String pos)
- {
- this.pos = pos;
- }
-
- /**
- * @return the type
- */
- public String getType()
- {
- return type;
- }
-
- /**
- * @param type
- * the type to set
- */
- public void setType(String type)
- {
- this.type = type;
- }
-}
package jalview.datamodel.xdb.embl;
import jalview.analysis.SequenceIdMatcher;
+import jalview.bin.Cache;
import jalview.datamodel.DBRefEntry;
import jalview.datamodel.DBRefSource;
import jalview.datamodel.FeatureProperties;
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceI;
import jalview.util.DBRefUtils;
+import jalview.util.DnaUtils;
import jalview.util.MapList;
import jalview.util.MappingUtils;
import jalview.util.StringUtils;
+import java.text.ParseException;
import java.util.Arrays;
import java.util.Hashtable;
import java.util.List;
String accession;
- String version;
+ String entryVersion;
- String taxDivision;
+ String sequenceVersion;
- String desc;
+ String dataClass;
- String rCreated;
+ String moleculeType;
- String rLastUpdated;
+ String topology;
- String lastUpdated;
+ String sequenceLength;
+
+ String taxonomicDivision;
+
+ String description;
+
+ String firstPublicDate;
+
+ String firstPublicRelease;
+
+ String lastUpdatedDate;
+
+ String lastUpdatedRelease;
Vector<String> keywords;
}
/**
- * @return the desc
- */
- public String getDesc()
- {
- return desc;
- }
-
- /**
- * @param desc
- * the desc to set
- */
- public void setDesc(String desc)
- {
- this.desc = desc;
- }
-
- /**
* @return the features
*/
public Vector<EmblFeature> getFeatures()
}
/**
- * @return the lastUpdated
- */
- public String getLastUpdated()
- {
- return lastUpdated;
- }
-
- /**
- * @param lastUpdated
- * the lastUpdated to set
- */
- public void setLastUpdated(String lastUpdated)
- {
- this.lastUpdated = lastUpdated;
- }
-
- /**
- * @return the releaseCreated
- */
- public String getRCreated()
- {
- return rCreated;
- }
-
- /**
- * @param releaseCreated
- * the releaseCreated to set
- */
- public void setRCreated(String releaseCreated)
- {
- this.rCreated = releaseCreated;
- }
-
- /**
- * @return the releaseLastUpdated
- */
- public String getRLastUpdated()
- {
- return rLastUpdated;
- }
-
- /**
- * @param releaseLastUpdated
- * the releaseLastUpdated to set
- */
- public void setRLastUpdated(String releaseLastUpdated)
- {
- this.rLastUpdated = releaseLastUpdated;
- }
-
- /**
* @return the sequence
*/
public EmblSequence getSequence()
}
/**
- * @return the taxDivision
- */
- public String getTaxDivision()
- {
- return taxDivision;
- }
-
- /**
- * @param taxDivision
- * the taxDivision to set
- */
- public void setTaxDivision(String taxDivision)
- {
- this.taxDivision = taxDivision;
- }
-
- /**
- * @return the version
- */
- public String getVersion()
- {
- return version;
- }
-
- /**
- * @param version
- * the version to set
- */
- public void setVersion(String version)
- {
- this.version = version;
- }
-
- /**
* Recover annotated sequences from EMBL file
*
* @param sourceDb
{
SequenceI dna = new Sequence(sourceDb + "|" + accession,
sequence.getSequence());
- dna.setDescription(desc);
- DBRefEntry retrievedref = new DBRefEntry(sourceDb, version, accession);
+ dna.setDescription(description);
+ DBRefEntry retrievedref = new DBRefEntry(sourceDb,
+ getSequenceVersion(), accession);
dna.addDBRef(retrievedref);
// add map to indicate the sequence is a valid coordinate frame for the
// dbref
retrievedref.setMap(new Mapping(null, new int[] { 1, dna.getLength() },
new int[] { 1, dna.getLength() }, 1, 1));
- // TODO: transform EMBL Database refs to canonical form
+
if (dbRefs != null)
{
for (DBRefEntry dbref : dbRefs)
}
}
+ SequenceIdMatcher matcher = new SequenceIdMatcher(peptides);
try
{
for (EmblFeature feature : features)
}
if (FeatureProperties.isCodingFeature(sourceDb, feature.getName()))
{
- parseCodingFeature(feature, sourceDb, dna, peptides);
+ parseCodingFeature(feature, sourceDb, dna, peptides, matcher);
}
}
} catch (Exception e)
* list of protein product sequences for Embl entry
*/
void parseCodingFeature(EmblFeature feature, String sourceDb,
- SequenceI dna, List<SequenceI> peptides)
+ SequenceI dna, List<SequenceI> peptides, SequenceIdMatcher matcher)
{
boolean isEmblCdna = sourceDb.equals(DBRefSource.EMBLCDS);
String prname = "";
String prid = null;
Map<String, String> vals = new Hashtable<String, String>();
- SequenceIdMatcher matcher = new SequenceIdMatcher(peptides);
/*
* codon_start 1/2/3 in EMBL corresponds to phase 0/1/2 in CDS
}
else if (qname.equals("protein_id"))
{
- prid = q.getValues()[0];
+ prid = q.getValues()[0].trim();
}
else if (qname.equals("codon_start"))
{
try
{
- codonStart = Integer.parseInt(q.getValues()[0]);
+ codonStart = Integer.parseInt(q.getValues()[0].trim());
} catch (NumberFormatException e)
{
System.err.println("Invalid codon_start in XML for "
else if (qname.equals("product"))
{
// sometimes name is returned e.g. for V00488
- prname = q.getValues()[0];
+ prname = q.getValues()[0].trim();
}
else
{
DBRefEntry pcdnaref = new DBRefEntry();
pcdnaref.setAccessionId(prid);
pcdnaref.setSource(DBRefSource.EMBLCDS);
- pcdnaref.setVersion(getVersion()); // same as parent EMBL version.
+ pcdnaref.setVersion(getSequenceVersion()); // same as parent EMBL
+ // version.
MapList mp = new MapList(new int[] { 1, prseq.length() },
new int[] { 1 + (codonStart - 1),
(codonStart - 1) + 3 * prseq.length() }, 1, 3);
SequenceFeature sf = makeCdsFeature(exon, xint, prname, prid, vals,
codonStart);
sf.setType(feature.getName()); // "CDS"
+ sf.setEnaLocation(feature.getLocation());
sf.setFeatureGroup(sourceDb);
dna.addSequenceFeature(sf);
}
if (map != null)
{
Mapping pmap = new Mapping(dna, map.getMap().getInverse());
- pref = new DBRefEntry(sourceDb, getVersion(),
+ pref = new DBRefEntry(sourceDb, getSequenceVersion(),
this.getAccession());
pref.setMap(pmap);
if (map.getTo() != null)
protEMBLCDS = new DBRefEntry();
protEMBLCDS.setAccessionId(prid);
protEMBLCDS.setSource(DBRefSource.EMBLCDSProduct);
- protEMBLCDS.setVersion(getVersion());
+ protEMBLCDS.setVersion(getSequenceVersion());
protEMBLCDS
.setMap(new Mapping(product, map.getMap().getInverse()));
}
}
/**
- * Returns the CDS positions as a list of [start, end, start, end...]
+ * Returns the CDS positions as a single array of [start, end, start, end...]
* positions. If on the reverse strand, these will be in descending order.
*
* @param feature
*/
protected int[] getCdsRanges(EmblFeature feature)
{
- if (feature.locations == null)
+ if (feature.location == null)
{
return new int[] {};
}
- int cdsBoundaryCount = 0; // count of all start/stop locations
- int[][] cdsLocations = new int[feature.locations.size()][];
- int locationNumber = 0;
- for (EmblFeatureLocations loc : feature.locations)
+
+ try
{
- int[] locationRanges = loc.getElementRanges(accession);
- cdsLocations[locationNumber++] = locationRanges;
- cdsBoundaryCount += locationRanges.length;
- }
- int[] cdsRanges = new int[cdsBoundaryCount];
- int copyTo = 0;
- for (int[] ranges : cdsLocations)
+ List<int[]> ranges = DnaUtils.parseLocation(feature.location);
+ return listToArray(ranges);
+ } catch (ParseException e)
{
- System.arraycopy(ranges, 0, cdsRanges, copyTo, ranges.length);
- copyTo += ranges.length;
+ Cache.log.warn(String.format(
+ "Not parsing inexact CDS location %s in ENA %s",
+ feature.location, this.accession));
+ return new int[] {};
}
- return cdsRanges;
+ }
+ /**
+ * Converts a list of [start, end] ranges to a single array of [start, end,
+ * start, end ...]
+ *
+ * @param ranges
+ * @return
+ */
+ int[] listToArray(List<int[]> ranges)
+ {
+ int[] result = new int[ranges.size() * 2];
+ int i = 0;
+ for (int[] range : ranges)
+ {
+ result[i++] = range[0];
+ result[i++] = range[1];
+ }
+ return result;
}
/**
}
return exon;
}
+
+ public String getSequenceVersion()
+ {
+ return sequenceVersion;
+ }
+
+ public void setSequenceVersion(String sequenceVersion)
+ {
+ this.sequenceVersion = sequenceVersion;
+ }
+
+ public String getSequenceLength()
+ {
+ return sequenceLength;
+ }
+
+ public void setSequenceLength(String sequenceLength)
+ {
+ this.sequenceLength = sequenceLength;
+ }
+
+ public String getEntryVersion()
+ {
+ return entryVersion;
+ }
+
+ public void setEntryVersion(String entryVersion)
+ {
+ this.entryVersion = entryVersion;
+ }
+
+ public String getMoleculeType()
+ {
+ return moleculeType;
+ }
+
+ public void setMoleculeType(String moleculeType)
+ {
+ this.moleculeType = moleculeType;
+ }
+
+ public String getTopology()
+ {
+ return topology;
+ }
+
+ public void setTopology(String topology)
+ {
+ this.topology = topology;
+ }
+
+ public String getTaxonomicDivision()
+ {
+ return taxonomicDivision;
+ }
+
+ public void setTaxonomicDivision(String taxonomicDivision)
+ {
+ this.taxonomicDivision = taxonomicDivision;
+ }
+
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public void setDescription(String description)
+ {
+ this.description = description;
+ }
+
+ public String getFirstPublicDate()
+ {
+ return firstPublicDate;
+ }
+
+ public void setFirstPublicDate(String firstPublicDate)
+ {
+ this.firstPublicDate = firstPublicDate;
+ }
+
+ public String getFirstPublicRelease()
+ {
+ return firstPublicRelease;
+ }
+
+ public void setFirstPublicRelease(String firstPublicRelease)
+ {
+ this.firstPublicRelease = firstPublicRelease;
+ }
+
+ public String getLastUpdatedDate()
+ {
+ return lastUpdatedDate;
+ }
+
+ public void setLastUpdatedDate(String lastUpdatedDate)
+ {
+ this.lastUpdatedDate = lastUpdatedDate;
+ }
+
+ public String getLastUpdatedRelease()
+ {
+ return lastUpdatedRelease;
+ }
+
+ public void setLastUpdatedRelease(String lastUpdatedRelease)
+ {
+ this.lastUpdatedRelease = lastUpdatedRelease;
+ }
+
+ public String getDataClass()
+ {
+ return dataClass;
+ }
+
+ public void setDataClass(String dataClass)
+ {
+ this.dataClass = dataClass;
+ }
}
Vector<Qualifier> qualifiers;
- Vector<EmblFeatureLocations> locations;
+ String location;
/**
* @return the dbRefs
}
/**
- * @return the locations
+ * @return the location
*/
- public Vector<EmblFeatureLocations> getLocations()
+ public String getLocation()
{
- return locations;
+ return location;
}
/**
- * @param locations
- * the locations to set
+ * @param loc
*/
- public void setLocations(Vector<EmblFeatureLocations> locations)
+ public void setLocation(String loc)
{
- this.locations = locations;
+ this.location = loc;
}
/**
+++ /dev/null
-/*
- * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
- * Copyright (C) $$Year-Rel$$ The Jalview Authors
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3
- * of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- * The Jalview Authors are detailed in the 'AUTHORS' file.
- */
-package jalview.datamodel.xdb.embl;
-
-/**
- * Data model for a feature/location/locationElement read from an EMBL query
- * reply
- *
- * @see embl_mapping.xml
- */
-public class EmblFeatureLocElement
-{
- String type;
-
- String accession;
-
- String version;
-
- boolean complement;
-
- BasePosition basePositions[];
-
- /**
- * @return the accession
- */
- public String getAccession()
- {
- return accession;
- }
-
- /**
- * @param accession
- * the accession to set
- */
- public void setAccession(String accession)
- {
- this.accession = accession;
- }
-
- /**
- * @return the basePositions
- */
- public BasePosition[] getBasePositions()
- {
- return basePositions;
- }
-
- /**
- * @param basePositions
- * the basePositions to set
- */
- public void setBasePositions(BasePosition[] basePositions)
- {
- this.basePositions = basePositions;
- }
-
- /**
- * @return the complement
- */
- public boolean isComplement()
- {
- return complement;
- }
-
- /**
- * @param complement
- * the complement to set
- */
- public void setComplement(boolean complement)
- {
- this.complement = complement;
- }
-
- /**
- * @return the type
- */
- public String getType()
- {
- return type;
- }
-
- /**
- * @param type
- * the type to set
- */
- public void setType(String type)
- {
- this.type = type;
- }
-
- /**
- * @return the version
- */
- public String getVersion()
- {
- return version;
- }
-
- /**
- * @param version
- * the version to set
- */
- public void setVersion(String version)
- {
- this.version = version;
- }
-}
+++ /dev/null
-/*
- * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
- * Copyright (C) $$Year-Rel$$ The Jalview Authors
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3
- * of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- * The Jalview Authors are detailed in the 'AUTHORS' file.
- */
-package jalview.datamodel.xdb.embl;
-
-import jalview.bin.Cache;
-import jalview.util.ArrayUtils;
-
-import java.util.Arrays;
-import java.util.Vector;
-
-/**
- * Data model for a <location> child element of a <feature> read
- * from an EMBL query reply
- *
- * @see embl_mapping.xml
- * @see http://www.insdc.org/files/feature_table.html#3.4.2
- */
-public class EmblFeatureLocations
-{
- Vector<EmblFeatureLocElement> locElements;
-
- String locationType;
-
- boolean locationComplement;
-
- /**
- * @return the locationComplement
- */
- public boolean isLocationComplement()
- {
- return locationComplement;
- }
-
- /**
- * @param locationComplement
- * the locationComplement to set
- */
- public void setLocationComplement(boolean locationComplement)
- {
- this.locationComplement = locationComplement;
- }
-
- /**
- * @return the locationType
- */
- public String getLocationType()
- {
- return locationType;
- }
-
- /**
- * @param locationType
- * the locationType to set
- */
- public void setLocationType(String locationType)
- {
- this.locationType = locationType;
- }
-
- /**
- * @return the locElements
- */
- public Vector<EmblFeatureLocElement> getLocElements()
- {
- return locElements;
- }
-
- /**
- * @param locElements
- * the locElements to set
- */
- public void setLocElements(Vector<EmblFeatureLocElement> locElements)
- {
- this.locElements = locElements;
- }
-
- /**
- * Return all location elements as start-end pairs (without accessions) TODO:
- * pass back complement and 'less than or more than' range information Note:
- * do not use this since it throws away any accessionIds associated with each
- * location!
- *
- * @return int[] { start1, end1, ... }
- */
- public int[] getElementRanges()
- {
- return getElementRanges(null);
- }
-
- /**
- * Return all location elements concerning given accession as start-end pairs.
- * If the CDS feature is on the forward strand, then start <= end, if on the
- * reverse strand then start > end.
- *
- * @param accession
- * the accession string for which locations are requested, or null
- * for all locations
- * @return int[] { start1, end1, ... }
- */
- int[] getElementRanges(String accession)
- {
- int sepos = 0;
- int[] se = new int[locElements.size() * 2];
- if ("single".equalsIgnoreCase(locationType)
- || "join".equalsIgnoreCase(locationType))
- {
- for (EmblFeatureLocElement loce : locElements)
- {
- if (accession == null || loce.accession != null
- && accession.equals(loce.accession))
- {
- BasePosition bp[] = loce.getBasePositions();
- if (bp.length == 2)
- {
- try
- {
- int start = Integer.parseInt(bp[0].getPos());
- int end = Integer.parseInt(bp[1].getPos());
- se[sepos++] = start;
- se[sepos++] = end;
- } catch (NumberFormatException e)
- {
- System.err
- .println("format error in EMBL CDS location basePosition: "
- + e.getMessage());
- }
- }
- else
- {
- System.err
- .println("format error in EMBL CDS location, basePosition count = "
- + bp.length);
- }
- }
- }
- }
- else if (locationType != null)
- {
- if (Cache.log != null)
- {
- Cache.log
- .error("EmblFeatureLocations.getElementRanges cannot deal with locationType=='"
- + locationType + "'");
- }
- else
- {
- System.err
- .println("EmblFeatureLocations.getElementRanges cannot deal with locationType=='"
- + locationType + "'");
- }
- }
-
- if (sepos != se.length)
- {
- /*
- * we failed to parse something - trim off null values
- */
- se = Arrays.copyOf(se, sepos);
- }
-
- /*
- * If on the complement, reverse the ranges to [end, start, ...end1, start1].
- * For an example of a joined complement, see (tRNA feature) CAGL0B00165r on
- * http://www.ebi.ac.uk/ena/data/view/CR380948&display=xml
- * http://www.ebi.ac.uk/Tools/dbfetch/dbfetch/embl/CR380948/emblxml
- */
- if (locationComplement)
- {
- ArrayUtils.reverseIntArray(se);
- }
- return se;
- }
-}
*/
public class EmblSequence
{
- String version;
-
String sequence;
- String type;
-
/**
* @return the sequence
*/
*/
public void setSequence(String sequence)
{
- this.sequence = sequence;
- }
-
- /**
- * @return the type
- */
- public String getType()
- {
- return type;
- }
-
- /**
- * @param type
- * the type to set
- */
- public void setType(String type)
- {
- this.type = type;
- }
-
- /**
- * @return the version
- */
- public String getVersion()
- {
- return version;
- }
-
- /**
- * @param version
- * the version to set
- */
- public void setVersion(String version)
- {
- this.version = version;
+ // remove spaces introduced by unmarshalling of newline characters
+ this.sequence = sequence.replace(" ", "");
}
}
--- /dev/null
+package jalview.ext.ensembl;
+
+/**
+ * A data class to model the data and rest version of one Ensembl domain,
+ * currently for rest.ensembl.org and rest.ensemblgenomes.org
+ *
+ * @author gmcarstairs
+ */
+class EnsemblInfo
+{
+ /*
+ * The http domain this object is holding data values for
+ */
+ String domain;
+
+ /*
+ * The latest version Jalview has tested for, e.g. "4.5"; a minor version change should be
+ * ok, a major version change may break stuff
+ */
+ String expectedRestVersion;
+
+ /*
+ * Major / minor / point version e.g. "4.5.1"
+ * @see http://rest.ensembl.org/info/rest/?content-type=application/json
+ */
+ String restVersion;
+
+ /*
+ * data version
+ * @see http://rest.ensembl.org/info/data/?content-type=application/json
+ */
+ String dataVersion;
+
+ /*
+ * true when http://rest.ensembl.org/info/ping/?content-type=application/json
+ * returns response code 200
+ */
+ boolean restAvailable;
+
+ /*
+ * absolute time when availability was last checked
+ */
+ long lastAvailableCheckTime;
+
+ /*
+ * absolute time when version numbers were last checked
+ */
+ long lastVersionCheckTime;
+
+ // flag set to true if REST major version is not the one expected
+ boolean restMajorVersionMismatch;
+
+ /*
+ * absolute time to wait till if we overloaded the REST service
+ */
+ long retryAfter;
+
+ /**
+ * Constructor given expected REST version number e.g 4.5 or 3.4.3
+ *
+ * @param restExpected
+ */
+ EnsemblInfo(String theDomain, String restExpected)
+ {
+ domain = theDomain;
+ expectedRestVersion = restExpected;
+ lastAvailableCheckTime = -1;
+ lastVersionCheckTime = -1;
+ }
+
+}
package jalview.ext.ensembl;
import jalview.io.FileParse;
+import jalview.util.StringUtils;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import javax.ws.rs.HttpMethod;
+import org.json.simple.JSONArray;
+import org.json.simple.JSONObject;
+import org.json.simple.parser.JSONParser;
+
import com.stevesoft.pat.Regex;
/**
*/
abstract class EnsemblRestClient extends EnsemblSequenceFetcher
{
- private final static String ENSEMBL_REST = "http://rest.ensembl.org";
+ /*
+ * update these constants when Jalview has been checked / updated for
+ * changes to Ensembl REST API
+ * @see https://github.com/Ensembl/ensembl-rest/wiki/Change-log
+ */
+ private static final String LATEST_ENSEMBLGENOMES_REST_VERSION = "4.4";
- protected final static String ENSEMBL_GENOMES_REST = "http://rest.ensemblgenomes.org";
+ private static final String LATEST_ENSEMBL_REST_VERSION = "4.5";
+
+ private static Map<String, EnsemblInfo> domainData;
// @see https://github.com/Ensembl/ensembl-rest/wiki/Output-formats
private static final String PING_URL = "http://rest.ensembl.org/info/ping.json";
- private final static long RETEST_INTERVAL = 10000L; // 10 seconds
+ private final static long AVAILABILITY_RETEST_INTERVAL = 10000L; // 10 seconds
+
+ private final static long VERSION_RETEST_INTERVAL = 1000L * 3600; // 1 hr
private static final Regex TRANSCRIPT_REGEX = new Regex(
"(ENS)([A-Z]{3}|)T[0-9]{11}$");
private static final Regex GENE_REGEX = new Regex(
"(ENS)([A-Z]{3}|)G[0-9]{11}$");
- private String domain = ENSEMBL_REST;
-
- private static boolean ensemblRestAvailable = false;
-
- private static long lastCheck = -1;
-
- /*
- * absolute time to wait till if we overloaded the REST service
- */
- private static long retryAfter;
+ static
+ {
+ domainData = new HashMap<String, EnsemblInfo>();
+ domainData.put(ENSEMBL_REST, new EnsemblInfo(ENSEMBL_REST,
+ LATEST_ENSEMBL_REST_VERSION));
+ domainData.put(ENSEMBL_GENOMES_REST, new EnsemblInfo(
+ ENSEMBL_GENOMES_REST, LATEST_ENSEMBLGENOMES_REST_VERSION));
+ }
protected volatile boolean inProgress = false;
*/
public EnsemblRestClient(String d)
{
- domain = d;
- }
-
- /**
- * Returns the domain name to query e.g. http://rest.ensembl.org or
- * http://rest.ensemblgenomes.org
- *
- * @return
- */
- String getDomain()
- {
- return domain;
- }
-
- void setDomain(String d)
- {
- domain = d;
+ setDomain(d);
}
/**
* POST method allows multiple queries in one request; it is supported for
* sequence queries, but not for overlap
*/
- boolean multipleIds = ids.size() > 1;// useGetRequest();
+ boolean multipleIds = ids != null && ids.size() > 1;
connection.setRequestMethod(multipleIds ? HttpMethod.POST
: HttpMethod.GET);
connection.setRequestProperty("Content-Type",
// to test:
// retryDelay = "5";
+ EnsemblInfo info = domainData.get(getDomain());
if (retryDelay != null)
{
System.err.println("Ensembl REST service rate limit exceeded, wait "
+ retryDelay + " seconds before retrying");
try
{
- retryAfter = System.currentTimeMillis()
+ info.retryAfter = System.currentTimeMillis()
+ (1000 * Integer.valueOf(retryDelay));
} catch (NumberFormatException e)
{
}
else
{
- retryAfter = 0;
+ info.retryAfter = 0;
// debug:
// System.out.println(String.format(
// "%s Ensembl requests remaining of %s (reset in %ss)",
// remaining, limit, reset));
}
}
+
/**
* Rechecks if Ensembl is responding, unless the last check was successful and
* the retest interval has not yet elapsed. Returns true if Ensembl is up,
- * else false.
+ * else false. Also retrieves and saves the current version of Ensembl data
+ * and REST services at intervals.
*
* @return
*/
protected boolean isEnsemblAvailable()
{
+ EnsemblInfo info = domainData.get(getDomain());
+
long now = System.currentTimeMillis();
/*
* check if we are waiting for 'Retry-After' to expire
*/
- if (retryAfter > now)
+ if (info.retryAfter > now)
{
- System.err.println("Still " + (1 + (retryAfter - now) / 1000)
+ System.err.println("Still " + (1 + (info.retryAfter - now) / 1000)
+ " secs to wait before retrying Ensembl");
return false;
}
else
{
- retryAfter = 0;
+ info.retryAfter = 0;
+ }
+
+ /*
+ * recheck if Ensembl is up if it was down, or the recheck period has elapsed
+ */
+ boolean retestAvailability = (now - info.lastAvailableCheckTime) > AVAILABILITY_RETEST_INTERVAL;
+ if (!info.restAvailable || retestAvailability)
+ {
+ info.restAvailable = checkEnsembl();
+ info.lastAvailableCheckTime = now;
}
- boolean retest = now - lastCheck > RETEST_INTERVAL;
- if (ensemblRestAvailable && !retest)
+ /*
+ * refetch Ensembl versions if the recheck period has elapsed
+ */
+ boolean refetchVersion = (now - info.lastVersionCheckTime) > VERSION_RETEST_INTERVAL;
+ if (refetchVersion)
{
- return true;
+ checkEnsemblRestVersion();
+ checkEnsemblDataVersion();
+ info.lastVersionCheckTime = now;
}
- ensemblRestAvailable = checkEnsembl();
- lastCheck = now;
- return ensemblRestAvailable;
+
+ return info.restAvailable;
}
/**
wr.close();
}
+ /**
+ * Fetches and checks Ensembl's REST version number
+ *
+ * @return
+ */
+ private void checkEnsemblRestVersion()
+ {
+ EnsemblInfo info = domainData.get(getDomain());
+
+ JSONParser jp = new JSONParser();
+ URL url = null;
+ try
+ {
+ url = new URL(getDomain()
+ + "/info/rest?content-type=application/json");
+ BufferedReader br = getHttpResponse(url, null);
+ JSONObject val = (JSONObject) jp.parse(br);
+ String version = val.get("release").toString();
+ String majorVersion = version.substring(0, version.indexOf("."));
+ String expected = info.expectedRestVersion;
+ String expectedMajorVersion = expected.substring(0,
+ expected.indexOf("."));
+ info.restMajorVersionMismatch = false;
+ try
+ {
+ /*
+ * if actual REST major version is ahead of what we expect,
+ * record this in case we want to warn the user
+ */
+ if (Float.valueOf(majorVersion) > Float
+ .valueOf(expectedMajorVersion))
+ {
+ info.restMajorVersionMismatch = true;
+ }
+ } catch (NumberFormatException e)
+ {
+ System.err.println("Error in REST version: " + e.toString());
+ }
+
+ /*
+ * check if REST version is later than what Jalview has tested against,
+ * if so warn; we don't worry if it is earlier (this indicates Jalview has
+ * been tested in advance against the next pending REST version)
+ */
+ boolean laterVersion = StringUtils.compareVersions(version, expected) == 1;
+ if (laterVersion)
+ {
+ System.err.println(String.format(
+ "Expected %s REST version %s but found %s", getDbSource(),
+ expected,
+ version));
+ }
+ info.restVersion = version;
+ } catch (Throwable t)
+ {
+ System.err.println("Error checking Ensembl REST version: "
+ + t.getMessage());
+ }
+ }
+
+ public boolean isRestMajorVersionMismatch()
+ {
+ return domainData.get(getDomain()).restMajorVersionMismatch;
+ }
+
+ /**
+ * Fetches and checks Ensembl's data version number
+ *
+ * @return
+ */
+ private void checkEnsemblDataVersion()
+ {
+ JSONParser jp = new JSONParser();
+ URL url = null;
+ try
+ {
+ url = new URL(getDomain()
+ + "/info/data?content-type=application/json");
+ BufferedReader br = getHttpResponse(url, null);
+ JSONObject val = (JSONObject) jp.parse(br);
+ JSONArray versions = (JSONArray) val.get("releases");
+ domainData.get(getDomain()).dataVersion = versions.get(0).toString();
+ } catch (Throwable t)
+ {
+ System.err.println("Error checking Ensembl data version: "
+ + t.getMessage());
+ }
+ }
+
+ public String getEnsemblDataVersion()
+ {
+ return domainData.get(getDomain()).dataVersion;
+ }
+
+ @Override
+ public String getDbVersion()
+ {
+ return getEnsemblDataVersion();
+ }
+
}
ds.setSourceDBRef(proteinSeq.getSourceDBRef());
Mapping map = new Mapping(ds, mapList);
- DBRefEntry dbr = new DBRefEntry(getDbSource(), getDbVersion(),
- proteinSeq.getName(), map);
+ DBRefEntry dbr = new DBRefEntry(getDbSource(),
+ getEnsemblDataVersion(), proteinSeq.getName(), map);
querySeq.getDatasetSequence().addDBRef(dbr);
/*
/*
* and add a reference to itself
*/
- DBRefEntry self = new DBRefEntry(getDbSource(), "0", seq.getName());
+ DBRefEntry self = new DBRefEntry(getDbSource(),
+ getEnsemblDataVersion(), seq.getName());
seq.addDBRef(self);
}
if (ids.contains(name)
|| ids.contains(name.replace("ENSP", "ENST")))
{
- DBRefUtils.parseToDbRef(sq, DBRefSource.ENSEMBL, "0", name);
+ DBRefUtils.parseToDbRef(sq, getDbSource(),
+ getEnsemblDataVersion(), name);
}
}
if (alignment == null)
private static final Regex ACCESSION_REGEX = new Regex(
"(ENS([A-Z]{3}|)[GTEP]{1}[0-9]{11}$)" + "|" + "(CCDS[0-9.]{3,}$)");
+ protected static final String ENSEMBL_GENOMES_REST = "http://rest.ensemblgenomes.org";
+
+ protected static final String ENSEMBL_REST = "http://rest.ensembl.org";
+
/*
* possible values for the 'feature' parameter of the /overlap REST service
* @see http://rest.ensembl.org/documentation/info/overlap_id
constrained, regulatory
}
+ private String domain = ENSEMBL_REST;
+
@Override
public String getDbSource()
{
// NB ensure Uniprot xrefs are canonicalised from "Ensembl" to "ENSEMBL"
- return DBRefSource.ENSEMBL; // "ENSEMBL"
- }
-
- @Override
- public String getDbVersion()
- {
- return "0";
+ if (ENSEMBL_GENOMES_REST.equals(getDomain()))
+ {
+ return DBRefSource.ENSEMBLGENOMES;
+ }
+ return DBRefSource.ENSEMBL;
}
@Override
{
return true;
}
+
+ /**
+ * Returns the domain name to query e.g. http://rest.ensembl.org or
+ * http://rest.ensemblgenomes.org
+ *
+ * @return
+ */
+ protected String getDomain()
+ {
+ return domain;
+ }
+
+ protected void setDomain(String d)
+ {
+ domain = d;
+ }
}
// and shut down jmol
viewer.evalStringQuiet("zap");
viewer.setJmolStatusListener(null);
+ viewer.dispose();
lastCommand = null;
viewer = null;
releaseUIResources();
*
* @author jimp
*
- * History: v1.0 revised from original due to refactoring of
- * paradise-ubmc.u-strasbg.fr/webservices/annotate3d to
- * http://arn-ibmc.in2p3.fr/api/compute/2d?tool=rnaview
+ * @version v1.0 revised from original due to refactoring of
+ * paradise-ubmc.u-strasbg.fr/webservices/annotate3d to
+ * http://arn-ibmc.in2p3.fr/api/compute/2d?tool=rnaview <br/>
+ * See also testing URL from fjossinet:<br/>
+ * http://charn2-ibmc.u-strasbg.fr:8080/api/compute/2d <br/>
+ * If in doubt, check against the REST client at:
+ * https://github.com/fjossinet/RNA-Science
+ * -Toolbox/blob/master/pyrna/restclient.py
*/
public class Annotate3D
{
- private static String twoDtoolsURL = "http://arn-ibmc.in2p3.fr/api/compute/2d";
+ // also test with
+ // "http://charn2-ibmc.u-strasbg.fr:8080/api/compute/2d";
+ private static String twoDtoolsURL = "http://arn-ibmc.in2p3.fr/api/compute/2d?tool=rnaview";
private static ContentHandler createContentHandler()
{
private String lastCommand;
- private boolean loadedInline;
-
- /**
+ /*
* current set of model filenames loaded
*/
String[] modelFileNames = null;
String lastHighlightCommand;
- private List<String> lastReply;
-
/*
* incremented every time a load notification is successfully handled -
* lightweight mechanism for other threads to detect when they can start
if (lastCommand == null || !lastCommand.equals(command))
{
// trim command or it may never find a match in the replyLog!!
- lastReply = viewer.sendChimeraCommand(command.trim(), logResponse);
+ List<String> lastReply = viewer.sendChimeraCommand(command.trim(),
+ logResponse);
if (logResponse && debug)
{
log("Response from command ('" + command + "') was:\n" + lastReply);
// End StructureListener
// //////////////////////////
- public Color getColour(int atomIndex, int pdbResNum, String chain,
- String pdbfile)
- {
- if (getModelNum(pdbfile) < 0)
- {
- return null;
- }
- log("get model / residue colour attribute unimplemented");
- return null;
- }
-
/**
* returns the current featureRenderer that should be used to colour the
* structures
}
/**
- * 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
*
AlignmentViewPanel alignment);
/**
- * Construct and send a command to highlight zero, one or more atoms.
- *
- * <pre>
- * Done by generating a command like (to 'highlight' positions 44 and 46)
- * show #0:44,46.C
- * </pre>
+ * Construct and send a command to highlight zero, one or more atoms. We do
+ * this by sending an "rlabel" command to show the residue label at that
+ * position.
*/
@Override
public void highlightAtoms(List<AtomSpec> atoms)
{
- if (atoms == null)
+ if (atoms == null || atoms.size() == 0)
{
return;
}
+
StringBuilder cmd = new StringBuilder(128);
boolean first = true;
boolean found = false;
{
if (first)
{
- cmd.append("show #").append(cms.get(0).getModelNumber())
+ cmd.append("rlabel #").append(cms.get(0).getModelNumber())
.append(":");
}
else
cmd.append(",");
}
first = false;
- cmd.append(cms.get(0).getModelNumber()).append(":");
cmd.append(pdbResNum);
if (!chain.equals(" "))
{
String command = cmd.toString();
/*
- * Avoid repeated commands for the same residue
+ * avoid repeated commands for the same residue
*/
if (command.equals(lastHighlightCommand))
{
return;
}
- viewerCommandHistory(false);
+ /*
+ * unshow the label for the previous residue
+ */
+ if (lastHighlightCommand != null)
+ {
+ viewer.sendChimeraCommand("~" + lastHighlightCommand, false);
+ }
if (found)
{
- viewer.sendChimeraCommand(command.toString(), false);
+ viewer.sendChimeraCommand(command, false);
}
- viewerCommandHistory(true);
this.lastHighlightCommand = command;
}
public boolean isVisibleByDefault();
/**
- * Returns the data column's data type class
+ * Returns the data column's FTS data column group
*
- * @return the Class for the data column's data type
+ * @return the FTSDataColumnGroupI for the column
*/
- public Class getDataColumnClass();
+ public FTSDataColumnGroupI getGroup();
/**
- * Returns the data colum's FTS data column group
+ * Returns the data columns data type POJO
*
- * @return the FTSDataColumnGroupI for the column
+ * @return the DataTypeI for the column
*/
- public FTSDataColumnGroupI getGroup();
+ public DataTypeI getDataType();
/**
* This interface provides a model for the dynamic data column group
*/
public int getSortOrder();
}
+
+ public interface DataTypeI
+ {
+ /**
+ * Returns the data column's data type class
+ *
+ * @return the Class for the data column's data type
+ */
+ public Class getDataTypeClass();
+
+ /**
+ * Checks if the numeric data column's data will be formated
+ *
+ * @return true means the numeric data column shall be formatted
+ */
+ public boolean isFormtted();
+
+ /**
+ * Returns the number of significant figure to be used for the numeric value
+ * formatting
+ *
+ * @return the number of significant figures
+ */
+ public int getSignificantFigures();
+ }
}
*
* @return list of columns to display by default
*/
- public Collection<FTSDataColumnI> getAllDefaulDisplayedDataColumns();
+ public Collection<FTSDataColumnI> getAllDefaultDisplayedFTSDataColumns();
/**
* Return list of FTSDataColumnI objects that can be used to perform a search
--- /dev/null
+package jalview.fts.core;
+
+import java.awt.Component;
+import java.text.DecimalFormat;
+
+import javax.swing.JLabel;
+import javax.swing.JTable;
+import javax.swing.table.DefaultTableCellRenderer;
+
+/**
+ * The class to handle the formatting of the double values for JTable cells.
+ */
+public class DecimalFormatTableCellRenderer extends
+ DefaultTableCellRenderer
+{
+ private DecimalFormat formatter;
+
+ public DecimalFormatTableCellRenderer(boolean isFormated,
+ int significantFigures)
+ {
+ String integerFormater = isFormated ? "###,##0" : "0";
+ String fractionFormater = isFormated ? "###,##0." : "0.";
+ if (significantFigures > 0)
+ {
+ StringBuilder significantFigureBuilder = new StringBuilder();
+ for (int x = 1; x <= significantFigures; ++x)
+ {
+ significantFigureBuilder.append("0");
+ }
+ formatter = new DecimalFormat(fractionFormater
+ + significantFigureBuilder.toString());
+ }
+ else
+ {
+ formatter = new DecimalFormat(integerFormater);
+ }
+ super.setHorizontalAlignment(JLabel.RIGHT);
+ }
+
+ public DecimalFormatTableCellRenderer()
+ {
+ super.setHorizontalAlignment(JLabel.RIGHT);
+ }
+
+ @Override
+ public Component getTableCellRendererComponent(JTable table,
+ Object value, boolean isSelected, boolean hasFocus, int row,
+ int column)
+ {
+ if (value == null)
+ {
+ return null;
+ }
+
+ value = formatter.format(value);
+
+ return super.getTableCellRendererComponent(table, value, isSelected,
+ hasFocus, row, column);
+ }
+}
\ No newline at end of file
import jalview.fts.api.FTSDataColumnI;
import jalview.fts.api.FTSDataColumnI.FTSDataColumnGroupI;
import jalview.fts.api.FTSRestClientI;
+import jalview.fts.service.pdb.PDBFTSRestClient;
import java.util.ArrayList;
import java.util.Collection;
FTSRestClientI ftsRestClient)
{
this.ftsRestClient = ftsRestClient;
- Collection<FTSDataColumnI> defaultCols = ftsRestClient
- .getAllDefaulDisplayedDataColumns();
-
- structSummaryColumns.addAll(defaultCols);
-
+ if (source.equals(PreferenceSource.STRUCTURE_CHOOSER)
+ || source.equals(PreferenceSource.PREFERENCES))
+ {
+ structSummaryColumns = ((PDBFTSRestClient) ftsRestClient)
+ .getAllDefaultDisplayedStructureDataColumns();
+ }
allFTSDataColumns.addAll(ftsRestClient.getAllFTSDataColumns());
tbl_FTSDataColumnPrefs.setAutoCreateRowSorter(true);
{
case SEARCH_SUMMARY:
data[x++] = new Object[] {
- ftsRestClient.getAllDefaulDisplayedDataColumns()
+ ftsRestClient.getAllDefaultDisplayedFTSDataColumns()
.contains(field),
field.getName(), field.getGroup() };
break;
break;
case PREFERENCES:
data[x++] = new Object[] { field.getName(),
- ftsRestClient.getAllDefaulDisplayedDataColumns()
+ ftsRestClient.getAllDefaultDisplayedFTSDataColumns()
.contains(field),
structSummaryColumns.contains(field) };
break;
if (currentSource == PreferenceSource.SEARCH_SUMMARY)
{
updatePrefs(ftsRestClient
- .getAllDefaulDisplayedDataColumns(), ftsDataColumn,
+ .getAllDefaultDisplayedFTSDataColumns(), ftsDataColumn,
selected);
}
else if (currentSource == PreferenceSource.STRUCTURE_CHOOSER)
if (col == 1)
{
updatePrefs(ftsRestClient
- .getAllDefaulDisplayedDataColumns(), ftsDataColumn,
+ .getAllDefaultDisplayedFTSDataColumns(), ftsDataColumn,
selected);
}
else if (col == 2)
}
@Override
- public Class<?> getDataColumnClass()
+ public DataTypeI getDataType()
{
- String classString = lineData[2];
- classString = classString.toUpperCase();
- switch (classString)
+ final String[] dataTypeString = lineData[2].split("\\|");
+ final String classString = dataTypeString[0].toUpperCase();
+
+ return new DataTypeI()
{
- case "INT":
- case "INTEGER":
- return Integer.class;
- case "DOUBLE":
- return Double.class;
- case "STRING":
- default:
- return String.class;
- }
+
+ @Override
+ public boolean isFormtted()
+ {
+ if (dataTypeString.length > 1
+ && dataTypeString[1] != null)
+ {
+ switch (dataTypeString[1].toUpperCase())
+ {
+ case "T":
+ case "TRUE":
+ return true;
+ case "F":
+ case "False":
+ default:
+ return false;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public int getSignificantFigures()
+ {
+ if (dataTypeString.length > 2
+ && dataTypeString[2] != null)
+ {
+ return Integer.valueOf(dataTypeString[2]);
+ }
+ return 0;
+ }
+
+ @Override
+ public Class getDataTypeClass()
+ {
+ switch (classString)
+ {
+ case "INT":
+ case "INTEGER":
+ return Integer.class;
+ case "DOUBLE":
+ return Double.class;
+ case "STRING":
+ default:
+ return String.class;
+ }
+ }
+ };
+
}
@Override
&& this.getGroup().equals(that.getGroup());
}
+
};
dataColumns.add(dataCol);
}
@Override
- public Collection<FTSDataColumnI> getAllDefaulDisplayedDataColumns()
+ public Collection<FTSDataColumnI> getAllDefaultDisplayedFTSDataColumns()
{
if (defaulDisplayedDataColumns == null
|| defaulDisplayedDataColumns.isEmpty())
{
return String.class;
}
- return cols[columnIndex - colOffset].getDataColumnClass();
+ return cols[columnIndex - colOffset].getDataType()
+ .getDataTypeClass();
}
};
{
e.printStackTrace();
}
+ if (wantedField.getDataType().getDataTypeClass() == Double.class)
+ {
+ DecimalFormatTableCellRenderer dfr = new DecimalFormatTableCellRenderer(
+ wantedField.getDataType().isFormtted(),
+ wantedField.getDataType().getSignificantFigures());
+ tbl_summary.getColumn(wantedField.getName()).setCellRenderer(dfr);
+ }
+ else if (wantedField.getDataType().getDataTypeClass() == Integer.class)
+ {
+ DecimalFormatTableCellRenderer dfr = new DecimalFormatTableCellRenderer(
+ wantedField.getDataType().isFormtted(),
+ wantedField.getDataType().getSignificantFigures());
+ tbl_summary.getColumn(wantedField.getName()).setCellRenderer(dfr);
+ }
}
}
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
+import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
protected HashSet<String> paginatorCart = new HashSet<String>();
+ protected static final DecimalFormat totalNumberformatter = new DecimalFormat(
+ "###,###");
+
private JTable tbl_summary = new JTable()
{
private boolean inLayout;
});
btn_next_page.setEnabled(false);
btn_next_page.setToolTipText(MessageManager
- .getString("label.next_page_tooltop"));
+ .getString("label.next_page_tooltip"));
btn_next_page.setFont(new java.awt.Font("Verdana", 0, 12));
btn_next_page.setText(MessageManager.getString("action.next_page"));
btn_next_page.addActionListener(new java.awt.event.ActionListener()
btn_prev_page.setEnabled(false);
btn_prev_page.setToolTipText(MessageManager
- .getString("label.prev_page_tooltop"));
+ .getString("label.prev_page_tooltip"));
btn_prev_page.setFont(new java.awt.Font("Verdana", 0, 12));
btn_prev_page.setText(MessageManager.getString("action.prev_page"));
btn_prev_page.addActionListener(new java.awt.event.ActionListener()
txt_search.setEnabled(false);
cmb_searchTarget.setEnabled(false);
previousWantedFields = getFTSRestClient()
- .getAllDefaulDisplayedDataColumns()
+ .getAllDefaultDisplayedFTSDataColumns()
.toArray(new Object[0]);
}
if (sourceTabbedPane.getTitleAt(index).equals(searchTabTitle))
}
return Arrays.equals(getFTSRestClient()
- .getAllDefaulDisplayedDataColumns()
+ .getAllDefaultDisplayedFTSDataColumns()
.toArray(new Object[0]), previousWantedFields) ? false
: true;
String searchTarget = ((FTSDataColumnI) cmb_searchTarget
.getSelectedItem()).getCode();
wantedFields = PDBFTSRestClient.getInstance()
- .getAllDefaulDisplayedDataColumns();
+ .getAllDefaultDisplayedFTSDataColumns();
String searchTerm = decodeSearchTerm(txt_search.getText(),
searchTarget);
if (isPaginationEnabled() && resultSetCount > 0)
{
updateSearchFrameTitle(defaultFTSFrameTitle + " - " + result
- + " " + (offSet + 1) + " to "
- + (offSet + resultSetCount) + " of "
- + totalResultSetCount
+ + " "
+ + totalNumberformatter.format((Number) (offSet + 1))
+ + " to "
+ + totalNumberformatter
+ .format((Number) (offSet + resultSetCount))
+ + " of "
+ + totalNumberformatter
+ .format((Number) totalResultSetCount)
+ " " + " (" + (endTime - startTime) + " milli secs)");
}
else
{
try
{
- summaryRowData[colCounter++] = (field.getDataColumnClass() == Integer.class) ? Integer
+ summaryRowData[colCounter++] = (field.getDataType()
+ .getDataTypeClass() == Integer.class) ? Integer
.valueOf(fieldData)
- : (field.getDataColumnClass() == Double.class) ? Double
+ : (field.getDataType()
+ .getDataTypeClass() == Double.class) ? Double
.valueOf(fieldData)
- : fieldData;
+ : sanitiseData(fieldData);
} catch (Exception e)
{
e.printStackTrace();
};
}
+ private static String sanitiseData(String data)
+ {
+ String cleanData = data.replaceAll("\\[\"", "").replaceAll("\\]\"", "")
+ .replaceAll("\\[", "").replaceAll("\\]", "")
+ .replaceAll("\",\"", ", ").replaceAll("\"", "");
+ return cleanData;
+ }
+
@Override
public String getColumnDataConfigFileName()
{
}
return instance;
}
+
+ private Collection<FTSDataColumnI> allDefaultDisplayedStructureDataColumns;
+
+ public Collection<FTSDataColumnI> getAllDefaultDisplayedStructureDataColumns()
+ {
+ if (allDefaultDisplayedStructureDataColumns == null
+ || allDefaultDisplayedStructureDataColumns.isEmpty())
+ {
+ allDefaultDisplayedStructureDataColumns = new ArrayList<FTSDataColumnI>();
+ allDefaultDisplayedStructureDataColumns.addAll(super
+ .getAllDefaultDisplayedFTSDataColumns());
+ }
+ return allDefaultDisplayedStructureDataColumns;
+ }
}
: uniportRestRequest.getResponseSize();
int offSet = uniportRestRequest.getOffSet();
+ String query;
+ if (isAdvancedQuery(uniportRestRequest.getSearchTerm()))
+ {
+ query = uniportRestRequest.getSearchTerm();
+ }
+ else
+ {
+ query = uniportRestRequest.getFieldToSearchBy().equalsIgnoreCase(
+ "Search All") ? uniportRestRequest.getSearchTerm()
+ + " or mnemonic:" + uniportRestRequest.getSearchTerm()
+ : uniportRestRequest.getFieldToSearchBy() + ":"
+ + uniportRestRequest.getSearchTerm();
+ }
- String query = uniportRestRequest.getFieldToSearchBy()
- .equalsIgnoreCase("Search All") ? uniportRestRequest
- .getSearchTerm() : uniportRestRequest.getFieldToSearchBy()
- + ":" + uniportRestRequest.getSearchTerm();
-
- // + (uniportRestRequest.isAllowUnpublishedEntries() ? ""
- // : " AND status:REL");
- // System.out.println(">>>>> Query : " + query);
- // System.out.println(">>>>> Columns : " + wantedFields);
- // System.out.println(">>>>> Response size: " + responseSize
- // + " offset : "
- // + offSet);
WebResource webResource = null;
webResource = client.resource(UNIPROT_SEARCH_ENDPOINT)
.queryParam("format", "tab")
}
}
+ public boolean isAdvancedQuery(String query)
+ {
+ if (query.contains(" AND ") || query.contains(" OR ")
+ || query.contains(" NOT ") || query.contains(" ! ")
+ || query.contains(" || ") || query.contains(" && ")
+ || query.contains(":") || query.contains("-"))
+ {
+ return true;
+ }
+ return false;
+ }
public FTSRestResponse parseUniprotResponse(
String uniProtTabDelimittedResponseString,
{
try
{
- summaryRowData[colCounter++] = (field.getDataColumnClass() == Integer.class) ? Integer
- .valueOf(fieldData)
- : (field.getDataColumnClass() == Double.class) ? Double
+ summaryRowData[colCounter++] = (field.getDataType()
+ .getDataTypeClass() == Integer.class) ? Integer
+ .valueOf(fieldData.replace(",", ""))
+ : (field.getDataType()
+ .getDataTypeClass() == Double.class) ? Double
.valueOf(fieldData) : fieldData;
} catch (Exception e)
{
.getSelectedItem()).getAltCode();
wantedFields = UniProtFTSRestClient.getInstance()
- .getAllDefaulDisplayedDataColumns();
+ .getAllDefaultDisplayedFTSDataColumns();
String searchTerm = decodeSearchTerm(txt_search.getText(),
searchTarget);
if (isPaginationEnabled() && resultSetCount > 0)
{
updateSearchFrameTitle(defaultFTSFrameTitle + " - " + result
- + " " + (offSet + 1) + " to "
- + (offSet + resultSetCount) + " of "
- + totalResultSetCount
+ + " "
+ + totalNumberformatter.format((Number) (offSet + 1))
+ + " to "
+ + totalNumberformatter
+ .format((Number) (offSet + resultSetCount))
+ + " of "
+ + totalNumberformatter
+ .format((Number) totalResultSetCount)
+ " " + " (" + (endTime - startTime) + " milli secs)");
}
else
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.StringSelection;
import java.awt.datatransfer.Transferable;
-import java.awt.dnd.DnDConstants;
import java.awt.dnd.DropTargetDragEvent;
import java.awt.dnd.DropTargetDropEvent;
import java.awt.dnd.DropTargetEvent;
@Override
public void focusGained(FocusEvent e)
{
- Desktop.setCurrentAlignFrame(AlignFrame.this);
+ Jalview.setCurrentAlignFrame(AlignFrame.this);
}
});
if (viewport.hasHiddenColumns() && !settings.isExportHiddenColumns())
{
- omitHidden = viewport.getViewAsString(false);
+ omitHidden = viewport.getViewAsString(false,
+ settings.isExportHiddenSequences());
}
int[] alignmentStartEnd = new int[2];
else
{
alignmentToExport = viewport.getAlignment();
- alignmentStartEnd = viewport.getAlignment()
- .getVisibleStartAndEndIndex(
- viewport
- .getColumnSelection().getHiddenColumns());
}
+ alignmentStartEnd = alignmentToExport
+ .getVisibleStartAndEndIndex(viewport.getColumnSelection()
+ .getHiddenColumns());
AlignmentExportData ed = new AlignmentExportData(alignmentToExport,
omitHidden, alignmentStartEnd, settings);
return ed;
}
-
/**
* DOCUMENT ME!
*
return showp;
}
+ /**
+ * Finds and displays cross-references for the selected sequences (protein
+ * products for nucleotide sequences, dna coding sequences for peptides).
+ *
+ * @param sel
+ * the sequences to show cross-references for
+ * @param dna
+ * true if from a nucleotide alignment (so showing proteins)
+ * @param source
+ * the database to show cross-references for
+ */
protected void showProductsFor(final SequenceI[] sel, final boolean dna,
final String source)
{
System.err.println("Failed to make CDS alignment");
}
al.getCodonFrames().clear();
- al.getCodonFrames().addAll(copyAlignment.getCodonFrames());
+ al.addCodonFrames(copyAlignment.getCodonFrames());
+ al.addCodonFrames(cf);
/*
* pending getting Embl transcripts to 'align',
{
copyAlignment = AlignmentUtils.makeCopyAlignment(
sequenceSelection, xrefs.getSequencesArray());
- copyAlignment.getCodonFrames().addAll(cf);
+ copyAlignment.addCodonFrames(cf);
+ al.addCodonFrames(copyAlignment.getCodonFrames());
+ al.addCodonFrames(cf);
}
copyAlignment.setGapCharacter(AlignFrame.this.viewport
.getGapCharacter());
}
} catch (Exception e)
{
- Cache.log.error(
- "Exception when finding crossreferences", e);
+ Cache.log.error("Exception when finding crossreferences", e);
} catch (OutOfMemoryError e)
{
new OOMWarning("whilst fetching crossreferences", e);
} catch (Throwable e)
{
- Cache.log.error("Error when finding crossreferences",
- e);
+ Cache.log.error("Error when finding crossreferences", e);
} finally
{
AlignFrame.this.setProgressBar(MessageManager.formatMessage(
.getString("label.error_when_translating_sequences_submit_bug_report");
final String errorTitle = MessageManager
.getString("label.implementation_error")
- + MessageManager.getString("translation_failed");
+ + MessageManager.getString("label.translation_failed");
JOptionPane.showMessageDialog(Desktop.desktop, msg, errorTitle,
JOptionPane.ERROR_MESSAGE);
return;
public void drop(DropTargetDropEvent evt)
{
Transferable t = evt.getTransferable();
- java.util.List files = null;
+ java.util.List<String> files = new ArrayList<String>(), protocols = new ArrayList<String>();
try
{
- DataFlavor uriListFlavor = new DataFlavor(
- "text/uri-list;class=java.lang.String");
- if (t.isDataFlavorSupported(DataFlavor.javaFileListFlavor))
- {
- // Works on Windows and MacOSX
- evt.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
- files = (java.util.List) t
- .getTransferData(DataFlavor.javaFileListFlavor);
- }
- else if (t.isDataFlavorSupported(uriListFlavor))
- {
- // This is used by Unix drag system
- evt.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
- String data = (String) t.getTransferData(uriListFlavor);
- files = new java.util.ArrayList(1);
- for (java.util.StringTokenizer st = new java.util.StringTokenizer(
- data, "\r\n"); st.hasMoreTokens();)
- {
- String s = st.nextToken();
- if (s.startsWith("#"))
- {
- // the line is a comment (as per the RFC 2483)
- continue;
- }
-
- java.net.URI uri = new java.net.URI(s);
- // check to see if we can handle this kind of URI
- if (uri.getScheme().toLowerCase().startsWith("http"))
- {
- files.add(uri.toString());
- }
- else
- {
- // otherwise preserve old behaviour: catch all for file objects
- java.io.File file = new java.io.File(uri);
- files.add(file.toString());
- }
- }
- }
+ Desktop.transferFromDropTarget(files, protocols, evt, t);
} catch (Exception e)
{
e.printStackTrace();
AlignFrame.this.setMenusForViewport();
}
});
- dbRefFetcher
- .fetchDBRefs(false);
+ dbRefFetcher.fetchDBRefs(false);
}
}).start();
try
{
Dna dna = new Dna(viewport, viewport.getViewAsVisibleContigs(true));
-
al = dna.reverseCdna(complement);
viewport.addAlignment(al, "");
+ addHistoryItem(new EditCommand(
+ MessageManager.getString("label.add_sequences"),
+ Action.PASTE, al.getSequencesArray(), 0, al.getWidth(),
+ viewport.getAlignment()));
} catch (Exception ex)
{
System.err.println(ex.getMessage());
@Override
protected void runGroovy_actionPerformed()
{
- Desktop.setCurrentAlignFrame(this);
+ Jalview.setCurrentAlignFrame(this);
groovy.ui.Console console = Desktop.getGroovyConsole();
if (console != null)
{
List<SequenceI[]> seqvectors = new ArrayList<SequenceI[]>();
for (PDBEntry pdb : pdbEntries)
{
- List<SequenceI> seqs = new ArrayList<SequenceI>();
+ List<SequenceI> choosenSeqs = new ArrayList<SequenceI>();
for (SequenceI sq : alignment.getSequences())
{
- Vector<PDBEntry> pdbs = sq.getDatasetSequence().getAllPDBEntries();
- if (pdbs == null)
+ Vector<PDBEntry> pdbRefEntries = sq.getDatasetSequence().getAllPDBEntries();
+ if (pdbRefEntries == null)
{
continue;
}
- for (PDBEntry p1 : pdbs)
+ for (PDBEntry pdbRefEntry : pdbRefEntries)
{
- if (p1.getId().equals(pdb.getId()))
+ if (pdbRefEntry.getId().equals(pdb.getId()))
{
- if (!seqs.contains(sq))
+ if (pdbRefEntry.getChainCode() != null
+ && pdb.getChainCode() != null)
{
- seqs.add(sq);
- continue;
+ if (pdbRefEntry.getChainCode().equalsIgnoreCase(
+ pdb.getChainCode())
+ && !choosenSeqs.contains(sq))
+ {
+ choosenSeqs.add(sq);
+ continue;
+ }
}
+ else
+ {
+ if (!choosenSeqs.contains(sq))
+ {
+ choosenSeqs.add(sq);
+ continue;
+ }
+ }
+
}
}
}
- seqvectors.add(seqs.toArray(new SequenceI[seqs.size()]));
+ seqvectors.add(choosenSeqs.toArray(new SequenceI[choosenSeqs.size()]));
}
return seqvectors.toArray(new SequenceI[seqvectors.size()][]);
}
*
* @param featureSettings
*/
+ @Override
public void applyFeaturesStyle(FeatureSettingsModelI featureSettings)
{
if (featureSettings == null)
// todo: make the ap scroll to the selection - not necessary, first
// click highlights/scrolls, second selects
ap.getSeqPanel().ap.getIdPanel().highlightSearchResults(null);
- ap.av.setSelectionGroup(// new SequenceGroup(
- aa[selectedRow].groupRef); // );
+ // process modifiers
+ SequenceGroup sg = ap.av.getSelectionGroup();
+ if (sg == null
+ || sg == aa[selectedRow].groupRef
+ || !(jalview.util.Platform.isControlDown(evt) || evt
+ .isShiftDown()))
+ {
+ if (jalview.util.Platform.isControlDown(evt)
+ || evt.isShiftDown())
+ {
+ // clone a new selection group from the associated group
+ ap.av.setSelectionGroup(new SequenceGroup(
+ aa[selectedRow].groupRef));
+ }
+ else
+ {
+ // set selection to the associated group so it can be edited
+ ap.av.setSelectionGroup(aa[selectedRow].groupRef);
+ }
+ }
+ else
+ {
+ // modify current selection with associated group
+ int remainToAdd = aa[selectedRow].groupRef.getSize();
+ for (SequenceI sgs : aa[selectedRow].groupRef.getSequences())
+ {
+ if (jalview.util.Platform.isControlDown(evt))
+ {
+ sg.addOrRemove(sgs, --remainToAdd == 0);
+ }
+ else
+ {
+ // notionally, we should also add intermediate sequences from
+ // last added sequence ?
+ sg.addSequence(sgs, --remainToAdd == 0);
+ }
+ }
+ }
+
ap.paintAlignment(false);
PaintRefresher.Refresh(ap, ap.av.getSequenceSetId());
ap.av.sendSelection();
// we make a copy rather than edit the current selection if no
// modifiers pressed
// see Enhancement JAL-1557
- if (!(evt.isControlDown() || evt.isShiftDown()))
+ if (!(jalview.util.Platform.isControlDown(evt) || evt
+ .isShiftDown()))
{
sg = new SequenceGroup(sg);
sg.clear();
}
else
{
- if (evt.isControlDown())
+ if (jalview.util.Platform.isControlDown(evt))
{
sg.addOrRemove(aa[selectedRow].sequenceRef, true);
}
sg.addSequence(aa[selectedRow].sequenceRef, false);
}
ap.av.setSelectionGroup(sg);
- ap.av.sendSelection();
ap.paintAlignment(false);
PaintRefresher.Refresh(ap, ap.av.getSequenceSetId());
+ ap.av.sendSelection();
}
}
static final int yOffset = 30;
- private static AlignFrame currentAlignFrame;
-
public static jalview.ws.jws1.Discoverer discoverer;
public static Object[] jalviewClipboard;
{
boolean success = true;
Transferable t = evt.getTransferable();
- java.util.List files = null;
- java.util.List protocols = null;
+ java.util.List<String> files = new ArrayList<String>();
+ java.util.List<String> protocols = new ArrayList<String>();
try
{
- DataFlavor uriListFlavor = new DataFlavor(
- "text/uri-list;class=java.lang.String");
- if (t.isDataFlavorSupported(DataFlavor.javaFileListFlavor))
- {
- // Works on Windows and MacOSX
- evt.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
- files = (java.util.List) t
- .getTransferData(DataFlavor.javaFileListFlavor);
- }
- else if (t.isDataFlavorSupported(uriListFlavor))
- {
- // This is used by Unix drag system
- evt.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
- String data = (String) t.getTransferData(uriListFlavor);
- files = new java.util.ArrayList(1);
- protocols = new java.util.ArrayList(1);
- for (java.util.StringTokenizer st = new java.util.StringTokenizer(
- data, "\r\n"); st.hasMoreTokens();)
- {
- String s = st.nextToken();
- if (s.startsWith("#"))
- {
- // the line is a comment (as per the RFC 2483)
- continue;
- }
- java.net.URI uri = new java.net.URI(s);
- if (uri.getScheme().toLowerCase().startsWith("http"))
- {
- protocols.add(FormatAdapter.URL);
- files.add(uri.toString());
- }
- else
- {
- // otherwise preserve old behaviour: catch all for file objects
- java.io.File file = new java.io.File(uri);
- protocols.add(FormatAdapter.FILE);
- files.add(file.toString());
- }
- }
- }
+ Desktop.transferFromDropTarget(files, protocols, evt, t);
} catch (Exception e)
{
+ e.printStackTrace();
success = false;
}
if (Jalview.isHeadlessMode())
{
// Desktop.desktop is null in headless mode
- return new AlignFrame[] { currentAlignFrame };
+ return new AlignFrame[] { Jalview.currentAlignFrame };
}
JInternalFrame[] frames = Desktop.desktop.getAllFrames();
@Override
public void windowClosed(WindowEvent e)
{
- groovyShell.setEnabled(true);
enableExecuteGroovy(false);
}
});
* if we got this far, enable 'Run Groovy' in AlignFrame menus
* and disable opening a second console
*/
- groovyShell.setEnabled(false);
enableExecuteGroovy(true);
}
* Enable or disable 'Run Groovy script' in AlignFrame calculate menus
*
* @param enabled
+ * true if Groovy console is open
*/
public void enableExecuteGroovy(boolean enabled)
{
+ /*
+ * disable opening a second Groovy console
+ * (or re-enable when the console is closed)
+ */
+ groovyShell.setEnabled(!enabled);
+
AlignFrame[] alignFrames = getAlignFrames();
if (alignFrames != null)
{
* The dust settles...give focus to the tab we did this from.
*/
myTopFrame.setDisplayedView(myTopFrame.alignPanel);
-
}
- public static AlignFrame getCurrentAlignFrame()
+ public static groovy.ui.Console getGroovyConsole()
{
- return currentAlignFrame;
+ return groovyConsole;
}
- public static void setCurrentAlignFrame(AlignFrame currentAlignFrame)
+ public static void transferFromDropTarget(List<String> files,
+ List<String> protocols, DropTargetDropEvent evt, Transferable t)
+ throws Exception
{
- Desktop.currentAlignFrame = currentAlignFrame;
- }
- public static groovy.ui.Console getGroovyConsole()
- {
- return groovyConsole;
+ DataFlavor uriListFlavor = new DataFlavor(
+ "text/uri-list;class=java.lang.String");
+ if (t.isDataFlavorSupported(DataFlavor.javaFileListFlavor))
+ {
+ // Works on Windows and MacOSX
+ Cache.log.debug("Drop handled as javaFileListFlavor");
+ evt.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
+ for (Object file : (List) t
+ .getTransferData(DataFlavor.javaFileListFlavor))
+ {
+ files.add(((File)file).toString());
+ protocols.add(FormatAdapter.FILE);
+ }
+ }
+ else
+ {
+ // Unix like behaviour
+ boolean added = false;
+ String data = null;
+ if (t.isDataFlavorSupported(uriListFlavor))
+ {
+ Cache.log.debug("Drop handled as uriListFlavor");
+ // This is used by Unix drag system
+ evt.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
+ data = (String) t.getTransferData(uriListFlavor);
+ }
+ if (data == null)
+ {
+ // fallback to text: workaround - on OSX where there's a JVM bug
+ Cache.log.debug("standard URIListFlavor failed. Trying text");
+ // try text fallback
+ data = (String) t.getTransferData(new DataFlavor(
+ "text/plain;class=java.lang.String"));
+ if (Cache.log.isDebugEnabled())
+ {
+ Cache.log.debug("fallback returned " + data);
+ }
+ }
+ while (protocols.size() < files.size())
+ {
+ Cache.log.debug("Adding missing FILE protocol for "
+ + files.get(protocols.size()));
+ protocols.add(FormatAdapter.FILE);
+ }
+ for (java.util.StringTokenizer st = new java.util.StringTokenizer(
+ data, "\r\n"); st.hasMoreTokens();)
+ {
+ added = true;
+ String s = st.nextToken();
+ if (s.startsWith("#"))
+ {
+ // the line is a comment (as per the RFC 2483)
+ continue;
+ }
+ java.net.URI uri = new java.net.URI(s);
+ if (uri.getScheme().toLowerCase().startsWith("http"))
+ {
+ protocols.add(FormatAdapter.URL);
+ files.add(uri.toString());
+ }
+ else
+ {
+ // otherwise preserve old behaviour: catch all for file objects
+ java.io.File file = new java.io.File(uri);
+ protocols.add(FormatAdapter.FILE);
+ files.add(file.toString());
+ }
+ }
+ if (Cache.log.isDebugEnabled())
+ {
+ if (data == null || !added)
+ {
+ Cache.log
+ .debug("Couldn't resolve drop data. Here are the supported flavors:");
+ for (DataFlavor fl : t.getTransferDataFlavors())
+ {
+ Cache.log.debug("Supported transfer dataflavor: "
+ + fl.toString());
+ evt.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
+ Object df = t.getTransferData(fl);
+ if (df != null)
+ {
+ Cache.log.debug("Retrieves: " + df);
+ }
+ else
+ {
+ Cache.log.debug("Retrieved nothing");
+ }
+ }
+ }
+ }
+ }
}
-
}
return;
}
-
if ((av.getSelectionGroup() == null)
- || ((!e.isControlDown() && !e.isShiftDown()) && av
- .getSelectionGroup() != null))
+ || (!jalview.util.Platform.isControlDown(e)
+ && !e.isShiftDown() && av.getSelectionGroup() != null))
{
av.setSelectionGroup(new SequenceGroup());
av.getSelectionGroup().setStartRes(0);
import java.awt.BorderLayout;
import java.awt.Component;
-import java.awt.Container;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.GridLayout;
@Override
public void actionPerformed(ActionEvent arg0)
{
- showDialog(null);
+ showDialog();
}
});
return viewdbs;
jc.validate();
// j.setPreferredSize(new Dimension(300,50));
add(jc, BorderLayout.CENTER);
+ ok.setEnabled(false);
j.add(ok);
j.add(cancel);
add(j, BorderLayout.SOUTH);
closeDialog();
}
- private void showDialog(Container parent)
+ void showDialog()
{
oldselection = selection;
oldtsel = tsel;
{
return;
}
+ ok.setEnabled(false);
if (dbviews.getSelectionCount() == 0)
{
selection = null;
}
+
tsel = dbviews.getSelectionPaths();
boolean forcedFirstChild = false;
List<DbSourceProxy> srcs = new ArrayList<DbSourceProxy>();
.getLastPathComponent();
if (dmt.getUserObject() != null)
{
+ /*
+ * enable OK button once a selection has been made
+ */
+ ok.setEnabled(true);
if (dmt.getUserObject() instanceof DbSourceProxy)
{
srcs.add((DbSourceProxy) dmt.getUserObject());
}
}
+ dbstatex.setText(" ");
if (allowMultiSelections)
{
dbstatus.setText(MessageManager.formatMessage(
(srcs.size() == 1 ? "" : "s"),
(srcs.size() > 0 ? " with " + x + " test quer"
+ (x == 1 ? "y" : "ies") : ".") }));
- dbstatex.setText(" ");
}
else
{
dbstatex.setText(MessageManager.formatMessage(
"label.example_param", new String[] { qr }));
}
- else
- {
- dbstatex.setText(" ");
- }
}
else
{
import jalview.structures.models.AAStructureBindingModel;
import jalview.util.MessageManager;
import jalview.util.Platform;
+import jalview.util.StringUtils;
import jalview.util.jarInputStreamProvider;
import jalview.viewmodel.AlignmentViewport;
import jalview.viewmodel.seqfeatures.FeatureRendererSettings;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
-import java.util.StringTokenizer;
import java.util.Vector;
import java.util.jar.JarEntry;
import java.util.jar.JarInputStream;
object.setVersion(jalview.bin.Cache.getDefault("VERSION",
"Development Build"));
- jalview.datamodel.AlignmentI jal = av.getAlignment();
+ /**
+ * rjal is full height alignment, jal is actual alignment with full metadata
+ * but excludes hidden sequences.
+ */
+ jalview.datamodel.AlignmentI rjal = av.getAlignment(), jal = rjal;
if (av.hasHiddenRows())
{
- jal = jal.getHiddenSequences().getFullAlignment();
+ rjal = jal.getHiddenSequences().getFullAlignment();
}
SequenceSet vamsasSet = new SequenceSet();
{
// switch jal and the dataset
jal = jal.getDataset();
+ rjal = jal;
}
}
if (jal.getProperties() != null)
Set<String> calcIdSet = new HashSet<String>();
// SAVE SEQUENCES
- for (int i = 0; i < jal.getHeight(); i++)
+ for (int i = 0; i < rjal.getHeight(); i++)
{
- final SequenceI jds = jal.getSequenceAt(i);
+ final SequenceI jds = rjal.getSequenceAt(i);
final SequenceI jdatasq = jds.getDatasetSequence() == null ? jds
: jds.getDatasetSequence();
String id = seqHash(jds);
// Store any sequences this sequence represents
if (av.hasHiddenRows())
{
+ // use rjal, contains the full height alignment
jseq.setHidden(av.getAlignment().getHiddenSequences()
.isHidden(jds));
- if (av.isHiddenRepSequence(jal.getSequenceAt(i)))
+ if (av.isHiddenRepSequence(rjal.getSequenceAt(i)))
{
jalview.datamodel.SequenceI[] reps = av
- .getRepresentedSequences(jal.getSequenceAt(i))
- .getSequencesInOrder(jal);
+ .getRepresentedSequences(rjal.getSequenceAt(i))
+ .getSequencesInOrder(rjal);
for (int h = 0; h < reps.length; h++)
{
- if (reps[h] != jal.getSequenceAt(i))
+ if (reps[h] != rjal.getSequenceAt(i))
{
- jseq.addHiddenSequences(jal.findIndex(reps[h]));
+ jseq.addHiddenSequences(rjal.findIndex(reps[h]));
}
}
}
}
+ // mark sequence as reference - if it is the reference for this view
+ if (jal.hasSeqrep())
+ {
+ jseq.setViewreference(rjal.getSequenceAt(i) == jal.getSeqrep());
+ }
}
+ // TODO: omit sequence features from each alignment view's XML dump if we
+ // are storing dataset
if (jds.getSequenceFeatures() != null)
{
jalview.datamodel.SequenceFeature[] sf = jds.getSequenceFeatures();
alc.addAlcodMap(alcmap);
}
}
-
+ // TODO: delete this ? dead code from 2.8.3->2.9 ?
// {
// AlcodonFrame alc = new AlcodonFrame();
// vamsasSet.addAlcodonFrame(alc);
List<SequenceI> tmpseqs = new ArrayList<SequenceI>();
boolean multipleView = false;
-
+ SequenceI referenceseqForView = null;
JSeq[] jseqs = object.getJalviewModelSequence().getJSeq();
int vi = 0; // counter in vamsasSeq array
for (int i = 0; i < jseqs.length; i++)
vi++;
}
+ if (jseqs[i].hasViewreference() && jseqs[i].getViewreference())
+ {
+ referenceseqForView = tmpseqs.get(tmpseqs.size() - 1);
+ }
+
if (jseqs[i].getHidden())
{
if (hiddenSeqs == null)
hiddenSeqs.add(seqRefIds.get(seqId));
}
-
}
// /
Alignment al = new Alignment(orderedSeqs);
+ if (referenceseqForView != null)
+ {
+ al.setSeqrep(referenceseqForView);
+ }
// / Add the alignment properties
for (int i = 0; i < vamsasSet.getSequenceSetPropertiesCount(); i++)
{
}
/**
+ * Answers true if 'version' is equal to or later than 'supported', where each
+ * is formatted as major/minor versions like "2.8.3" or "2.3.4b1" for bugfix
+ * changes. Development and test values for 'version' are leniently treated
+ * i.e. answer true.
*
* @param supported
* - minimum version we are comparing against
* @param version
- * - version of data being processsed.
- * @return true if version is development/null or evaluates to the same or
- * later X.Y.Z (where X,Y,Z are like [0-9]+b?[0-9]*)
+ * - version of data being processsed
+ * @return
*/
public static boolean isVersionStringLaterThan(String supported,
String version)
{
- if (version == null || version.equalsIgnoreCase("DEVELOPMENT BUILD")
+ if (supported == null || version == null
+ || version.equalsIgnoreCase("DEVELOPMENT BUILD")
|| version.equalsIgnoreCase("Test")
|| version.equalsIgnoreCase("AUTOMATED BUILD"))
{
}
else
{
- StringTokenizer currentV = new StringTokenizer(supported, "."), fileV = new StringTokenizer(
- version, ".");
- while (currentV.hasMoreTokens() && fileV.hasMoreTokens())
- {
- // convert b to decimal to catch bugfix releases within a series
- String curT = currentV.nextToken().toLowerCase().replace('b', '.');
- String fileT = fileV.nextToken().toLowerCase().replace('b', '.');
- try
- {
- float supportedVersionToken = Float.parseFloat(curT);
- float myVersiontoken = Float.parseFloat(fileT);
- if (supportedVersionToken > myVersiontoken)
- {
- // current version is newer than the version that wrote the file
- return false;
- }
- if (supportedVersionToken < myVersiontoken)
- {
- // current version is older than the version that wrote the file
- return true;
- }
- } catch (NumberFormatException nfe)
- {
- System.err
- .println("** WARNING: Version comparison failed for tokens ("
- + curT
- + ") and ("
- + fileT
- + ")\n** Current: '"
- + supported + "' and Version: '" + version + "'");
- }
- }
- if (currentV.hasMoreElements())
- {
- // fileV has no minor version but identical series to current
- return false;
- }
+ return StringUtils.compareVersions(version, supported, "b") >= 0;
}
- return true;
}
Vector<JalviewStructureDisplayI> newStructureViewers = null;
.getSequenceAt(i), new java.awt.Color(JSEQ[i].getColour()));
}
+ if (al.hasSeqrep())
+ {
+ af.getViewport().setColourByReferenceSeq(true);
+ af.getViewport().setDisplayReferenceSeq(true);
+ }
+
af.viewport.setGatherViewsHere(view.getGatheredViews());
if (view.getSequenceSetId() != null)
.wrapTooltip(
true,
((desc == null || desc.trim().length() == 0) ? MessageManager
- .getString("label.opt_and_params_further_details ")
+ .getString("label.opt_and_params_further_details")
: desc)
+ "<br><img src=\"" + linkImageURL + "\"/>"));
enabled.addMouseListener(this);
+ linkImageURL
+ "\"/>"
+ MessageManager
- .getString("label.opt_and_params_further_detail")
+ .getString("label.opt_and_params_further_details")
: "")));
}
ap, true));
}
- public void enterPDB_actionPerformed()
- {
- String id = JOptionPane.showInternalInputDialog(Desktop.desktop,
- MessageManager.getString("label.enter_pdb_id"),
- MessageManager.getString("label.enter_pdb_id"),
- JOptionPane.QUESTION_MESSAGE);
-
- if (id != null && id.length() > 0)
- {
- PDBEntry entry = new PDBEntry();
- entry.setId(id.toUpperCase());
- sequence.getDatasetSequence().addPDBId(entry);
- }
- }
-
- public void discoverPDB_actionPerformed()
- {
-
- final SequenceI[] sequences = ((ap.av.getSelectionGroup() == null) ? new SequenceI[]
- { sequence }
- : ap.av.getSequenceSelection());
- Thread discpdb = new Thread(new Runnable()
- {
- @Override
- public void run()
- {
- boolean isNuclueotide = ap.alignFrame.getViewport().getAlignment()
- .isNucleotide();
-
- new jalview.ws.DBRefFetcher(sequences, ap.alignFrame, null,
- ap.alignFrame.featureSettings, isNuclueotide)
- .fetchDBRefs(false);
-
- }
-
- });
- discpdb.start();
- }
-
public void sequenceFeature_actionPerformed()
{
SequenceGroup sg = ap.av.getSelectionGroup();
private WsPreferences wsPrefs;
+ private OptionsParam promptEachTimeOpt = new OptionsParam(
+ MessageManager.getString("label.prompt_each_time"),
+ "Prompt each time");
+
+ private OptionsParam lineArtOpt = new OptionsParam(
+ MessageManager.getString("label.lineart"), "Lineart");
+
+ private OptionsParam textOpt = new OptionsParam(
+ MessageManager.getString("action.text"), "Text");
+
/**
* Creates a new Preferences object.
*/
/*
* Set Output tab defaults
*/
- epsRendering
- .addItem(MessageManager.getString("label.prompt_each_time"));
- epsRendering.addItem(MessageManager.getString("label.lineart"));
- epsRendering.addItem(MessageManager.getString("action.text"));
- epsRendering.setSelectedItem(Cache.getDefault("EPS_RENDERING",
- "Prompt each time"));
+ epsRendering.addItem(promptEachTimeOpt);
+ epsRendering.addItem(lineArtOpt);
+ epsRendering.addItem(textOpt);
+ String defaultEPS = Cache.getDefault("EPS_RENDERING",
+ "Prompt each time");
+ if (defaultEPS.equalsIgnoreCase("Text"))
+ {
+ epsRendering.setSelectedItem(textOpt);
+ }
+ else if (defaultEPS.equalsIgnoreCase("Lineart"))
+ {
+ epsRendering.setSelectedItem(lineArtOpt);
+ }
+ else
+ {
+ epsRendering.setSelectedItem(promptEachTimeOpt);
+ }
autoIdWidth.setSelected(Cache.getDefault("FIGURE_AUTOIDWIDTH", false));
userIdWidth.setEnabled(!autoIdWidth.isSelected());
userIdWidthlabel.setEnabled(!autoIdWidth.isSelected());
/*
* Save Output settings
*/
- if (epsRendering.getSelectedItem().equals("Prompt each time"))
- {
- Cache.applicationProperties.remove("EPS_RENDERING");
- }
- else
- {
- Cache.applicationProperties.setProperty("EPS_RENDERING", epsRendering
- .getSelectedItem().toString());
- }
+ Cache.applicationProperties.setProperty("EPS_RENDERING",
+ ((OptionsParam) epsRendering.getSelectedItem()).getCode());
/*
* Save Connections settings
}
}
+ public class OptionsParam
+ {
+ private String name;
+
+ private String code;
+
+ public OptionsParam(String name, String code)
+ {
+ this.name = name;
+ this.code = code;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getCode()
+ {
+ return code;
+ }
+
+ public void setCode(String code)
+ {
+ this.code = code;
+ }
+
+ @Override
+ public String toString()
+ {
+ return name;
+ }
+
+ @Override
+ public boolean equals(Object that)
+ {
+ if (!(that instanceof OptionsParam))
+ {
+ return false;
+ }
+ return this.code.equalsIgnoreCase(((OptionsParam) that).code);
+ }
+
+ @Override
+ public int hashCode(){
+ return name.hashCode() + code.hashCode();
+ }
+ }
}
import javax.swing.ToolTipManager;
/**
- * DOCUMENT ME!
- *
- * @author $author$
- * @version $Revision$
+ * The panel containing the sequence ruler (when not in wrapped mode), and
+ * supports a range of mouse operations to select, hide or reveal columns.
*/
public class ScalePanel extends JPanel implements MouseMotionListener,
MouseListener
{
protected int offy = 4;
- /** DOCUMENT ME!! */
public int width;
protected AlignViewport av;
boolean stretchingGroup = false;
- int min; // used by mouseDragged to see if user
+ /*
+ * min, max hold the extent of a mouse drag action
+ */
+ int min;
- int max; // used by mouseDragged to see if user
+ int max;
boolean mouseDragging = false;
- // wants to delete columns
+ /*
+ * holds a hidden column range when the mouse is over an adjacent column
+ */
+ int[] reveal;
+
+ /**
+ * Constructor
+ *
+ * @param av
+ * @param ap
+ */
public ScalePanel(AlignViewport av, AlignmentPanel ap)
{
this.av = av;
@Override
public void mouseMoved(MouseEvent evt)
{
+ this.setToolTipText(null);
+ reveal = null;
if (!av.hasHiddenColumns())
{
return;
res = av.getColumnSelection().adjustForHiddenColumns(res);
- reveal = null;
if (av.getColumnSelection().getHiddenColumns() != null)
{
for (int[] region : av.getColumnSelection().getHiddenColumns())
.getString("label.reveal_hidden_columns"));
break;
}
- else
- {
- this.setToolTipText(null);
- }
}
}
repaint();
}
- int[] reveal;
-
/**
* DOCUMENT ME!
*
// do we want to thread this ? (contention with seqsel and colsel locks, I
// suspect)
- // rules are: colsel is copied if there is a real intersection between
- // sequence selection
+ /*
+ * only copy colsel if there is a real intersection between
+ * sequence selection and this panel's alignment
+ */
boolean repaint = false;
- boolean copycolsel = true;
+ boolean copycolsel = false;
SequenceGroup sgroup = null;
if (seqsel != null && seqsel.getSize() > 0)
}
sgroup = seqsel.intersect(av.getAlignment(),
(av.hasHiddenRows()) ? av.getHiddenRepSequences() : null);
- if ((sgroup == null || sgroup.getSize() == 0)
- || (colsel == null || colsel.isEmpty()))
+ if ((sgroup != null && sgroup.getSize() > 0))
{
- // don't copy columns if the region didn't intersect.
- copycolsel = false;
+ copycolsel = true;
}
}
if (sgroup != null && sgroup.getSize() > 0)
ColumnSelection cs = MappingUtils.mapColumnSelection(colsel, sourceAv,
av);
av.setColumnSelection(cs);
- av.isColSelChanged(true);
PaintRefresher.Refresh(this, av.getSequenceSetId());
import jalview.io.gff.SequenceOntologyI;
import jalview.util.DBRefUtils;
import jalview.util.MessageManager;
+import jalview.util.Platform;
import jalview.ws.dbsources.das.api.DasSourceRegistryI;
import jalview.ws.seqfetcher.DbSourceProxy;
frame = new JInternalFrame();
frame.setContentPane(this);
- if (new jalview.util.Platform().isAMac())
+ if (Platform.isAMac())
{
- Desktop.addInternalFrame(frame, getFrameTitle(), 400, 240);
+ Desktop.addInternalFrame(frame, getFrameTitle(), false, 400, 240);
}
else
{
- Desktop.addInternalFrame(frame, getFrameTitle(), 400, 180);
+ Desktop.addInternalFrame(frame, getFrameTitle(), false, 400, 180);
}
}
jPanel1.add(close);
jPanel3.add(jPanel2, java.awt.BorderLayout.CENTER);
jPanel2.setLayout(borderLayout3);
- databaseButt = database.getDatabaseSelectorButton();
+ databaseButt = /*database.getDatabaseSelectorButton();
+ final JButton viewdbs =*/new JButton(
+ MessageManager.getString("action.select_ddbb"));
+ databaseButt.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent arg0)
+ {
+ hidePanel();
+ database.showDialog();
+ }
+ });
databaseButt.setFont(JvSwingUtils.getLabelFont());
database.addActionListener(new ActionListener()
{
{
debounceTrap++;
String currentSelection = database.getSelectedItem();
+ if (currentSelection == null)
+ {
+ close_actionPerformed(null);
+ }
+
+ showPanel();
if (currentSelection.equalsIgnoreCase("pdb")
&& (database.action == KeyEvent.VK_ENTER || ((debounceTrap % 2) == 0)))
this.add(jPanel2, java.awt.BorderLayout.NORTH);
jScrollPane1.getViewport().add(textArea);
+ /*
+ * open the database tree
+ */
+ database.waitForInput();
}
private void pdbSourceAction()
{
this.progressIndicator = progressIndicator;
}
+
+ /**
+ * Make this panel visible (after a selection has been made in the database
+ * chooser)
+ */
+ void showPanel()
+ {
+ frame.setVisible(true);
+ }
+
+ /**
+ * Hide this panel (on clicking the database button to open the database
+ * chooser)
+ */
+ void hidePanel()
+ {
+ frame.setVisible(false);
+ }
}
import java.awt.FontMetrics;
import java.awt.Graphics;
-/**
- * DOCUMENT ME!
- *
- * @author $author$
- * @version $Revision$
- */
public class SequenceRenderer implements jalview.api.SequenceRenderer
{
final static int CHAR_TO_UPPER = 'A' - 'a';
}
if (!isarep && av.getShowUnconserved())
{
- s = getDisplayChar(srep, i, s, '.', currentSequenceGroup);
+ s = getDisplayChar(srep, i, s, '.', null);
}
{
// TODO - use currentSequenceGroup rather than alignment
// currentSequenceGroup.getConsensus()
- char conschar = (usesrep) ? (currentGroup == null ? av.getAlignment()
+ char conschar = (usesrep) ? (currentGroup == null
+ || position < currentGroup.getStartRes()
+ || position > currentGroup.getEndRes() ? av.getAlignment()
.getSeqrep().getCharAt(position)
: (currentGroup.getSeqrep() != null ? currentGroup.getSeqrep()
.getCharAt(position) : av.getAlignment().getSeqrep()
.getCharAt(position)))
- : (currentGroup != null && currentGroup.getConsensus() != null) ? currentGroup
+ : (currentGroup != null && currentGroup.getConsensus() != null
+ && position >= currentGroup.getStartRes()
+ && position <= currentGroup.getEndRes() && currentGroup
+ .getConsensus().annotations.length > position) ? currentGroup
.getConsensus().annotations[position].displayCharacter
.charAt(0)
: av.getAlignmentConsensusAnnotation().annotations[position].displayCharacter
import jalview.jbgui.GStructureChooser;
import jalview.structure.StructureSelectionManager;
import jalview.util.MessageManager;
+import jalview.ws.DBRefFetcher;
import jalview.ws.sifts.SiftsSettings;
import java.awt.event.ItemEvent;
{
long startTime = System.currentTimeMillis();
pdbRestCleint = PDBFTSRestClient.getInstance();
- Collection<FTSDataColumnI> wantedFields = pdbRestCleint
- .getAllDefaulDisplayedDataColumns();
+ Collection<FTSDataColumnI> wantedFields = pdbDocFieldPrefs
+ .getStructureSummaryFields();
discoveredStructuresSet = new LinkedHashSet<FTSData>();
HashSet<String> errors = new HashSet<String>();
if (discoveredStructuresSet != null
&& !discoveredStructuresSet.isEmpty())
{
- tbl_summary.setModel(FTSRestResponse.getTableModel(lastPdbRequest,
+ getResultTable().setModel(
+ FTSRestResponse.getTableModel(lastPdbRequest,
discoveredStructuresSet));
structuresDiscovered = true;
noOfStructuresFound = discoveredStructuresSet.size();
}
/**
- * Remove the following special characters from input string +, -, &, |, !, (,
- * ), {, }, [, ], ^, ", ~, *, ?, :, \
+ * Remove the following special characters from input string +, -, &, !, (, ),
+ * {, }, [, ], ^, ", ~, *, ?, :, \
*
* @param seqName
* @return
*/
- private static String sanitizeSeqName(String seqName)
+ static String sanitizeSeqName(String seqName)
{
Objects.requireNonNull(seqName);
return seqName.replaceAll("\\[\\d*\\]", "")
- .replaceAll("[^\\dA-Za-z|]", "").replaceAll("\\s+", "+");
+ .replaceAll("[^\\dA-Za-z|_]", "").replaceAll("\\s+", "+");
}
long startTime = System.currentTimeMillis();
pdbRestCleint = PDBFTSRestClient.getInstance();
lbl_loading.setVisible(true);
- Collection<FTSDataColumnI> wantedFields = pdbRestCleint
- .getAllDefaulDisplayedDataColumns();
+ Collection<FTSDataColumnI> wantedFields = pdbDocFieldPrefs
+ .getStructureSummaryFields();
Collection<FTSData> filteredResponse = new HashSet<FTSData>();
HashSet<String> errors = new HashSet<String>();
FTSRestRequest pdbRequest = new FTSRestRequest();
if (fieldToFilterBy.equalsIgnoreCase("uniprot_coverage"))
{
- System.out.println(">>>>>> Filtering with uniprot coverate");
pdbRequest.setAllowEmptySeq(false);
pdbRequest.setResponseSize(1);
pdbRequest.setFieldToSearchBy("(");
Collection<FTSData> reorderedStructuresSet = new LinkedHashSet<FTSData>();
reorderedStructuresSet.addAll(filteredResponse);
reorderedStructuresSet.addAll(discoveredStructuresSet);
- tbl_summary.setModel(FTSRestResponse.getTableModel(
+ getResultTable().setModel(
+ FTSRestResponse.getTableModel(
lastPdbRequest, reorderedStructuresSet));
- FTSRestResponse.configureTableColumn(tbl_summary, wantedFields);
- tbl_summary.getColumn("Ref Sequence").setPreferredWidth(120);
- tbl_summary.getColumn("Ref Sequence").setMinWidth(100);
- tbl_summary.getColumn("Ref Sequence").setMaxWidth(200);
+ FTSRestResponse.configureTableColumn(getResultTable(),
+ wantedFields);
+ getResultTable().getColumn("Ref Sequence").setPreferredWidth(120);
+ getResultTable().getColumn("Ref Sequence").setMinWidth(100);
+ getResultTable().getColumn("Ref Sequence").setMaxWidth(200);
// Update table selection model here
- tbl_summary.addRowSelectionInterval(0, filterResponseCount - 1);
+ getResultTable().addRowSelectionInterval(0,
+ filterResponseCount - 1);
mainFrame.setTitle(MessageManager.formatMessage(
"label.structure_chooser_filter_time", totalTime));
}
{
cmb_filterOption.addItem(new FilterOption("Best Quality",
"overall_quality", VIEWS_FILTER));
- cmb_filterOption.addItem(new FilterOption("Most UniProt Coverage",
- "uniprot_coverage", VIEWS_FILTER));
cmb_filterOption.addItem(new FilterOption("Best Resolution",
"resolution", VIEWS_FILTER));
cmb_filterOption.addItem(new FilterOption("Most Protein Chain",
String currentView = selectedFilterOpt.getView();
if (currentView == VIEWS_FILTER)
{
- if (tbl_summary.getSelectedRows().length > 0)
+ if (getResultTable().getSelectedRows().length > 0)
{
btn_view.setEnabled(true);
}
String currentView = selectedFilterOpt.getView();
if (currentView == VIEWS_FILTER)
{
- int pdbIdColIndex = tbl_summary.getColumn("PDB Id")
+ int pdbIdColIndex = getResultTable().getColumn("PDB Id")
.getModelIndex();
- int refSeqColIndex = tbl_summary.getColumn("Ref Sequence")
+ int refSeqColIndex = getResultTable().getColumn("Ref Sequence")
.getModelIndex();
- int[] selectedRows = tbl_summary.getSelectedRows();
+ int[] selectedRows = getResultTable().getSelectedRows();
PDBEntry[] pdbEntriesToView = new PDBEntry[selectedRows.length];
int count = 0;
ArrayList<SequenceI> selectedSeqsToView = new ArrayList<SequenceI>();
for (int row : selectedRows)
{
- String pdbIdStr = tbl_summary.getValueAt(row, pdbIdColIndex)
+ String pdbIdStr = getResultTable().getValueAt(row,
+ pdbIdColIndex)
.toString();
- SequenceI selectedSeq = (SequenceI) tbl_summary.getValueAt(row,
+ SequenceI selectedSeq = (SequenceI) getResultTable()
+ .getValueAt(row,
refSeqColIndex);
selectedSeqsToView.add(selectedSeq);
PDBEntry pdbEntry = selectedSeq.getPDBEntry(pdbIdStr);
if (pdbEntry == null)
{
pdbEntry = new PDBEntry();
- pdbEntry.setId(pdbIdStr);
+ if (pdbIdStr.split(":").length > 1)
+ {
+ pdbEntry.setId(pdbIdStr.split(":")[0]);
+ pdbEntry.setChainCode(pdbIdStr.split(":")[1].toUpperCase());
+ }
+ else
+ {
+ pdbEntry.setId(pdbIdStr);
+ }
pdbEntry.setType(PDBEntry.Type.PDB);
selectedSequence.getDatasetSequence().addPDBId(pdbEntry);
}
final PDBEntry[] pdbEntriesToView,
final AlignmentPanel alignPanel, SequenceI[] sequences)
{
- ssm.setProgressBar("Launching PDB structure viewer..");
+ ssm.setProgressBar(MessageManager
+ .getString("status.launching_3d_structure_viewer"));
final StructureViewer sViewer = new StructureViewer(ssm);
if (SiftsSettings.isMapWithSifts())
{
+ ArrayList<SequenceI> seqsWithoutSourceDBRef = new ArrayList<SequenceI>();
for (SequenceI seq : sequences)
{
- if (seq.getSourceDBRef() == null)
+ if (seq.getSourceDBRef() == null && seq.getDBRefs() == null)
+ {
+ seqsWithoutSourceDBRef.add(seq);
+ continue;
+ }
+ }
+ if (!seqsWithoutSourceDBRef.isEmpty())
+ {
+ int y = seqsWithoutSourceDBRef.size();
+ ssm.setProgressBar(null);
+ ssm.setProgressBar(MessageManager.formatMessage(
+ "status.fetching_dbrefs_for_sequences_without_valid_refs",
+ y));
+ SequenceI[] seqWithoutSrcDBRef = new SequenceI[y];
+ int x = 0;
+ for (SequenceI fSeq : seqsWithoutSourceDBRef)
{
- ssm.setProgressBar(null);
- ssm.setProgressBar("Fetching Database refs..");
- new jalview.ws.DBRefFetcher(sequences, null, null, null, false)
- .fetchDBRefs(true);
- break;
+ seqWithoutSrcDBRef[x++] = fSeq;
}
+ new DBRefFetcher(seqWithoutSrcDBRef).fetchDBRefs(true);
}
}
- if (pdbEntriesToView.length > 1)
- {
- ArrayList<SequenceI[]> seqsMap = new ArrayList<SequenceI[]>();
- for (SequenceI seq : sequences)
- {
- seqsMap.add(new SequenceI[] { seq });
- }
- SequenceI[][] collatedSeqs = seqsMap.toArray(new SequenceI[0][0]);
+ if (pdbEntriesToView.length > 1)
+ {
+ ArrayList<SequenceI[]> seqsMap = new ArrayList<SequenceI[]>();
+ for (SequenceI seq : sequences)
+ {
+ seqsMap.add(new SequenceI[] { seq });
+ }
+ SequenceI[][] collatedSeqs = seqsMap.toArray(new SequenceI[0][0]);
ssm.setProgressBar(null);
- ssm.setProgressBar("Fetching PDB Structures for selected entries..");
- sViewer.viewStructures(pdbEntriesToView, collatedSeqs, alignPanel);
- }
- else
- {
+ ssm.setProgressBar(MessageManager
+ .getString("status.fetching_3d_structures_for_selected_entries"));
+ sViewer.viewStructures(pdbEntriesToView, collatedSeqs, alignPanel);
+ }
+ else
+ {
ssm.setProgressBar(null);
- ssm.setProgressBar("Fetching PDB Structure for "
- + pdbEntriesToView[0].getId());
- sViewer.viewStructures(pdbEntriesToView[0], sequences, alignPanel);
- }
+ ssm.setProgressBar(MessageManager.formatMessage(
+ "status.fetching_3d_structures_for",
+ pdbEntriesToView[0].getId()));
+ sViewer.viewStructures(pdbEntriesToView[0], sequences, alignPanel);
+ }
}
/**
isValidPBDEntry = false;
if (txt_search.getText().length() > 0)
{
+ String searchTerm = txt_search.getText().toLowerCase();
+ searchTerm = searchTerm.split(":")[0];
+ // System.out.println(">>>>> search term : " + searchTerm);
List<FTSDataColumnI> wantedFields = new ArrayList<FTSDataColumnI>();
FTSRestRequest pdbRequest = new FTSRestRequest();
pdbRequest.setAllowEmptySeq(false);
pdbRequest.setFieldToSearchBy("(pdb_id:");
pdbRequest.setWantedFields(wantedFields);
pdbRequest
- .setSearchTerm(txt_search.getText().toLowerCase() + ")");
+.setSearchTerm(searchTerm + ")");
pdbRequest.setAssociatedSequence(selectedSequence);
pdbRestCleint = PDBFTSRestClient.getInstance();
wantedFields.add(pdbRestCleint.getPrimaryKeyColumn());
final JPanel col2 = new JPanel();
col2.setPreferredSize(new Dimension(40, 20));
col2.setBorder(BorderFactory.createEtchedBorder());
- col2.setToolTipText(MessageManager.getString("label.ligth_colour"));
+ col2.setToolTipText(MessageManager.getString("label.light_colour"));
col2.setBackground(new Color(original2));
final JPanel bigpanel = new JPanel(new BorderLayout());
JPanel panel = new JPanel();
col1.addMouseListener(new MouseAdapter()
{
+ @Override
public void mousePressed(MouseEvent e)
{
Color col = JColorChooser.showDialog(bigpanel,
col2.addMouseListener(new MouseAdapter()
{
+ @Override
public void mousePressed(MouseEvent e)
{
Color col = JColorChooser.showDialog(bigpanel,
slider.addChangeListener(new ChangeListener()
{
+ @Override
public void stateChanged(ChangeEvent evt)
{
thresholdChanged(slider.getValue());
av.addPropertyChangeListener(new java.beans.PropertyChangeListener()
{
+ @Override
public void propertyChange(PropertyChangeEvent evt)
{
if (evt.getPropertyName().equals("alignment"))
}
+ @Override
public void viewMenu_menuSelected()
{
buildAssociatedViewMenu();
buttonGroup.add(item);
item.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent evt)
{
treeCanvas.applyToAllViews = false;
itemf.setSelected(treeCanvas.applyToAllViews);
itemf.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent evt)
{
treeCanvas.applyToAllViews = itemf.isSelected();
}
}
+ @Override
public void run()
{
* @param e
* DOCUMENT ME!
*/
+ @Override
public void textbox_actionPerformed(ActionEvent e)
{
CutAndPasteTransfer cap = new CutAndPasteTransfer();
* @param e
* DOCUMENT ME!
*/
+ @Override
public void saveAsNewick_actionPerformed(ActionEvent e)
{
JalviewFileChooser chooser = new JalviewFileChooser(
* @param e
* DOCUMENT ME!
*/
+ @Override
public void printMenu_actionPerformed(ActionEvent e)
{
// Putting in a thread avoids Swing painting problems
treeCanvas.startPrinting();
}
+ @Override
public void originalSeqData_actionPerformed(ActionEvent e)
{
if (!tree.hasOriginalSequenceData())
* @param e
* DOCUMENT ME!
*/
+ @Override
public void fitToWindow_actionPerformed(ActionEvent e)
{
treeCanvas.fitToWindow = fitToWindow.isSelected();
* @param e
* DOCUMENT ME!
*/
+ @Override
public void font_actionPerformed(ActionEvent e)
{
if (treeCanvas == null)
* @param e
* DOCUMENT ME!
*/
+ @Override
public void distanceMenu_actionPerformed(ActionEvent e)
{
treeCanvas.setShowDistances(distanceMenu.isSelected());
* @param e
* DOCUMENT ME!
*/
+ @Override
public void bootstrapMenu_actionPerformed(ActionEvent e)
{
treeCanvas.setShowBootstrap(bootstrapMenu.isSelected());
* @param e
* DOCUMENT ME!
*/
+ @Override
public void placeholdersMenu_actionPerformed(ActionEvent e)
{
treeCanvas.setMarkPlaceholders(placeholdersMenu.isSelected());
* @param e
* DOCUMENT ME!
*/
+ @Override
public void epsTree_actionPerformed(ActionEvent e)
{
boolean accurateText = true;
* @param e
* DOCUMENT ME!
*/
+ @Override
public void pngTree_actionPerformed(ActionEvent e)
{
int width = treeCanvas.getWidth();
tree.applyToNodes(new NodeTransformI()
{
+ @Override
public void transform(BinaryNode node)
{
if (node instanceof SequenceNode
AlignmentPanel ap;
+ private IProgressIndicator pIndicator;
+
+ private long pSessionId;
+
+ private boolean headless;
+
+
public HtmlSvgOutput(File file, AlignmentPanel ap)
{
this.av = ap.av;
public void generateHtmlSvgOutput(File file)
{
- IProgressIndicator pIndicator = ap.alignFrame;
- long pSessionId = System.currentTimeMillis();
+ pIndicator = ap.alignFrame;
+ pSessionId = System.currentTimeMillis();
try
{
- boolean headless = (System.getProperty("java.awt.headless") != null && System
+ headless = (System.getProperty("java.awt.headless") != null && System
.getProperty("java.awt.headless").equals("true"));
if (file == null)
{
- if (pIndicator != null && !headless)
- {
- pIndicator.setProgressBar(MessageManager.formatMessage(
- "status.waiting_for_user_to_select_output_file", "HTML"),
- pSessionId);
- }
+ setProgressMessage(MessageManager.formatMessage(
+ "status.waiting_for_user_to_select_output_file", "HTML"));
JalviewFileChooser chooser = getHTMLChooser();
chooser.setFileView(new jalview.io.JalviewFileView());
chooser.setDialogTitle(ap.alignFrame.getTitle());
jalview.bin.Cache.setProperty("LAST_DIRECTORY", chooser
.getSelectedFile().getParent());
file = chooser.getSelectedFile();
+ ap.alignFrame.repaint();
}
else
{
-
- if (pIndicator != null && !headless)
- {
- pIndicator.setProgressBar(MessageManager.formatMessage(
- "status.cancelled_image_export_operation", "HTML"),
- pSessionId);
- }
+ setProgressMessage(MessageManager.formatMessage(
+ "status.cancelled_image_export_operation", "HTML"));
return;
}
}
-
- AlignmentDimension aDimension = ap.getAlignmentDimension();
- SVGGraphics2D g1 = new SVGGraphics2D(aDimension.getWidth(),
- aDimension.getHeight());
- SVGGraphics2D g2 = new SVGGraphics2D(aDimension.getWidth(),
- aDimension.getHeight());
-
- String renderStyle = jalview.bin.Cache.getDefault("HTML_RENDERING",
- "Prompt each time");
-
- // If we need to prompt, and if the GUI is visible then
- // Prompt for rendering style
- if (renderStyle.equalsIgnoreCase("Prompt each time")
- && !(System.getProperty("java.awt.headless") != null && System
- .getProperty("java.awt.headless").equals("true")))
- {
- HTMLOptions svgOption = new HTMLOptions();
- renderStyle = svgOption.getValue();
-
- if (renderStyle == null || svgOption.cancelled)
- {
- return;
- }
- }
-
- if (renderStyle.equalsIgnoreCase("lineart"))
- {
- g1.setRenderingHint(SVGHints.KEY_DRAW_STRING_TYPE,
- SVGHints.VALUE_DRAW_STRING_TYPE_VECTOR);
- g2.setRenderingHint(SVGHints.KEY_DRAW_STRING_TYPE,
- SVGHints.VALUE_DRAW_STRING_TYPE_VECTOR);
- }
- printUnwrapped(aDimension.getWidth(), aDimension.getHeight(), 0, g1,
- g2);
-
- String titleSvgData = g1.getSVGDocument();
- String alignSvgData = g2.getSVGDocument();
- String jsonData = null;
- boolean isEmbbedBioJSON = Boolean.valueOf(jalview.bin.Cache
- .getDefault("EXPORT_EMBBED_BIOJSON", "true"));
- if (isEmbbedBioJSON)
+ } catch (Exception e)
+ {
+ pIndicator.setProgressBar(MessageManager.formatMessage(
+ "info.error_creating_file", "HTML"), pSessionId);
+ e.printStackTrace();
+ return;
+ }
+ final File fileX = file;
+ new Thread()
+ {
+ @Override
+ public void run()
{
- AlignExportSettingI exportSettings = new AlignExportSettingI()
+ try
{
- @Override
- public boolean isExportHiddenSequences()
+ setProgressMessage(null);
+ setProgressMessage(MessageManager
+.formatMessage(
+ "status.exporting_alignment_as_x_file", "HTML"));
+ AlignmentDimension aDimension = ap.getAlignmentDimension();
+ SVGGraphics2D g1 = new SVGGraphics2D(aDimension.getWidth(),
+ aDimension.getHeight());
+ SVGGraphics2D g2 = new SVGGraphics2D(aDimension.getWidth(),
+ aDimension.getHeight());
+
+ String renderStyle = jalview.bin.Cache.getDefault(
+ "HTML_RENDERING", "Prompt each time");
+
+ // If we need to prompt, and if the GUI is visible then
+ // Prompt for rendering style
+ if (renderStyle.equalsIgnoreCase("Prompt each time")
+ && !(System.getProperty("java.awt.headless") != null && System
+ .getProperty("java.awt.headless").equals("true")))
{
- return true;
+ HTMLOptions svgOption = new HTMLOptions();
+ renderStyle = svgOption.getValue();
+
+ if (renderStyle == null || svgOption.cancelled)
+ {
+ setProgressMessage(MessageManager.formatMessage(
+ "status.cancelled_image_export_operation", "HTML"));
+ return;
+ }
}
- @Override
- public boolean isExportHiddenColumns()
+ if (renderStyle.equalsIgnoreCase("Lineart"))
{
- return true;
+ g1.setRenderingHint(SVGHints.KEY_DRAW_STRING_TYPE,
+ SVGHints.VALUE_DRAW_STRING_TYPE_VECTOR);
+ g2.setRenderingHint(SVGHints.KEY_DRAW_STRING_TYPE,
+ SVGHints.VALUE_DRAW_STRING_TYPE_VECTOR);
}
-
- @Override
- public boolean isExportAnnotations()
+ printUnwrapped(aDimension.getWidth(), aDimension.getHeight(), 0,
+ g1, g2);
+
+ String titleSvgData = g1.getSVGDocument();
+ String alignSvgData = g2.getSVGDocument();
+ String jsonData = null;
+ boolean isEmbbedBioJSON = Boolean.valueOf(jalview.bin.Cache
+ .getDefault("EXPORT_EMBBED_BIOJSON", "true"));
+ if (isEmbbedBioJSON)
{
- return true;
+ AlignExportSettingI exportSettings = new AlignExportSettingI()
+ {
+ @Override
+ public boolean isExportHiddenSequences()
+ {
+ return true;
+ }
+
+ @Override
+ public boolean isExportHiddenColumns()
+ {
+ return true;
+ }
+
+ @Override
+ public boolean isExportAnnotations()
+ {
+ return true;
+ }
+
+ @Override
+ public boolean isExportFeatures()
+ {
+ return true;
+ }
+
+ @Override
+ public boolean isExportGroups()
+ {
+ return true;
+ }
+
+ @Override
+ public boolean isCancelled()
+ {
+ return false;
+ }
+
+ };
+ AlignmentExportData exportData = jalview.gui.AlignFrame
+ .getAlignmentForExport(JSONFile.FILE_DESC, av,
+ exportSettings);
+ jsonData = new FormatAdapter(ap, exportData.getSettings())
+ .formatSequences(JSONFile.FILE_DESC,
+ exportData.getAlignment(),
+ exportData.getOmitHidden(),
+ exportData.getStartEndPostions(),
+ av.getColumnSelection());
}
-
- @Override
- public boolean isExportFeatures()
- {
- return true;
- }
-
- @Override
- public boolean isExportGroups()
+ String htmlData = getHtml(titleSvgData, alignSvgData, jsonData);
+ FileOutputStream out = new FileOutputStream(fileX);
+ out.write(htmlData.getBytes());
+ out.flush();
+ out.close();
+ if (!(System.getProperty("java.awt.headless") != null && System
+ .getProperty("java.awt.headless").equals("true")))
{
- return true;
+ jalview.util.BrowserLauncher.openURL("file:///" + fileX);
}
+ } catch (OutOfMemoryError err)
+ {
+ System.out.println("########################\n"
+ + "OUT OF MEMORY " + fileX + "\n"
+ + "########################");
+ new OOMWarning("Creating Image for " + fileX, err);
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ pIndicator.setProgressBar(MessageManager.formatMessage(
+ "info.error_creating_file", "HTML"), pSessionId);
+ }
+ setProgressMessage(MessageManager.formatMessage(
+ "status.export_complete", "HTML"));
+ }
+ }.start();
- @Override
- public boolean isCancelled()
- {
- return false;
- }
+ }
- };
- AlignmentExportData exportData = jalview.gui.AlignFrame
- .getAlignmentForExport(JSONFile.FILE_DESC, av,
- exportSettings);
- jsonData = new FormatAdapter(ap, exportData.getSettings())
- .formatSequences(JSONFile.FILE_DESC,
- exportData.getAlignment(),
- exportData.getOmitHidden(),
- exportData.getStartEndPostions(),
- av.getColumnSelection());
- }
- String htmlData = getHtml(titleSvgData, alignSvgData, jsonData);
- FileOutputStream out = new FileOutputStream(file);
- out.write(htmlData.getBytes());
- out.flush();
- out.close();
- if (!(System.getProperty("java.awt.headless") != null && System
- .getProperty("java.awt.headless").equals("true")))
- {
- jalview.util.BrowserLauncher.openURL("file:///" + file);
- }
- if (pIndicator != null && !headless)
- {
- pIndicator.setProgressBar(MessageManager.formatMessage(
- "status.export_complete", "HTML"), pSessionId);
- }
- } catch (OutOfMemoryError err)
+ private void setProgressMessage(String message)
+ {
+ if (pIndicator != null && !headless)
{
- System.out.println("########################\n" + "OUT OF MEMORY "
- + file + "\n" + "########################");
- new OOMWarning("Creating Image for " + file, err);
- } catch (Exception e)
+ pIndicator.setProgressBar(message, pSessionId);
+ }
+ else
{
- e.printStackTrace();
- pIndicator.setProgressBar(MessageManager.formatMessage(
- "info.error_creating_file", "HTML"), pSessionId);
+ System.out.println(message);
}
}
private String id;
private String dbRefType;
+
/**
* set to true to add derived sequence annotations (temp factor read from
* file, or computed secondary structure) to the alignment
sourceDBRef.setSource(DBRefSource.PDB);
sourceDBRef.setStartRes(pdbSequence.getStart());
sourceDBRef.setEndRes(pdbSequence.getEnd());
-
- SequenceI chainseq = pdbSequence.deriveSequence();
- chainseq.setSourceDBRef(sourceDBRef);
- chainseq.addPDBId(entry);
- chainseq.addDBRef(sourceDBRef);
-
+ pdbSequence.setSourceDBRef(sourceDBRef);
+ pdbSequence.addPDBId(entry);
+ pdbSequence.addDBRef(sourceDBRef);
+ SequenceI chainseq = pdbSequence;
seqs.addElement(chainseq);
-
AlignmentAnnotation[] chainannot = chainseq.getAnnotation();
if (chainannot != null && visibleChainAnnotation)
@SuppressWarnings("unchecked")
protected void replaceAndUpdateChains(List<SequenceI> prot,
- AlignmentI al,
- String pep, boolean b)
+ AlignmentI al, String pep, boolean b)
{
List<List<? extends Object>> replaced = AlignSeq
.replaceMatchingSeqsWith(seqs, annotations, prot, al, pep,
}
@SuppressWarnings({ "unchecked", "rawtypes" })
- private void processWithJmolParser(List<SequenceI> prot)
- throws Exception
+ private void processWithJmolParser(List<SequenceI> prot) throws Exception
{
try
{
Class cl = Class.forName("jalview.ext.jmol.JmolParser");
if (cl != null)
{
- final Constructor constructor = cl
-.getConstructor(new Class[] {
+ final Constructor constructor = cl.getConstructor(new Class[] {
boolean.class, boolean.class, boolean.class, FileParse.class });
final Object[] args = new Object[] { visibleChainAnnotation,
predictSecondaryStructure, externalSecondaryStructure,
- new FileParse(getDataName(),
- type) };
+ new FileParse(getDataName(), type) };
StructureViewSettings.setShowSeqFeatures(false);
StructureViewSettings.setVisibleChainAnnotation(false);
} catch (ClassNotFoundException q)
{
}
+ StructureViewSettings.setShowSeqFeatures(true);
}
public PDBChain findChain(String id) throws Exception
/*
* Output tab components
*/
- protected JComboBox<String> epsRendering = new JComboBox<String>();
+ protected JComboBox<Object> epsRendering = new JComboBox<Object>();
protected JLabel userIdWidthlabel = new JLabel();
.getString("label.open_overview"));
openoverv.setHorizontalAlignment(SwingConstants.RIGHT);
openoverv.setHorizontalTextPosition(SwingConstants.LEFT);
- openoverv.setText(MessageManager.getString(("label.open_overview")));
+ openoverv.setText(MessageManager.getString("label.open_overview"));
JPanel jPanel2 = new JPanel();
jPanel2.setBounds(new Rectangle(7, 17, 158, 310));
jPanel2.setLayout(new GridLayout(14, 1));
private JTabbedPane pnl_filter = new JTabbedPane();
- private FTSDataColumnPreferences pdbDocFieldPrefs = new FTSDataColumnPreferences(
+ protected FTSDataColumnPreferences pdbDocFieldPrefs = new FTSDataColumnPreferences(
PreferenceSource.STRUCTURE_CHOOSER,
PDBFTSRestClient.getInstance());
protected FTSDataColumnI[] previousWantedFields;
- protected JTable tbl_summary = new JTable()
+ private JTable tbl_summary = new JTable()
{
private boolean inLayout;
}
});
- scrl_foundStructures.setPreferredSize(new Dimension(500, 300));
- scrl_foundStructures
- .setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ scrl_foundStructures.setPreferredSize(new Dimension(800, 400));
- scrl_localPDB.setPreferredSize(new Dimension(500, 300));
+ scrl_localPDB.setPreferredSize(new Dimension(800, 400));
scrl_localPDB
.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
chk_invertFilter.setFont(new java.awt.Font("Verdana", 0, 12));
chk_rememberSettings.setFont(new java.awt.Font("Verdana", 0, 12));
chk_rememberSettings.setVisible(false);
-
- txt_search.setToolTipText(MessageManager
- .getString("label.enter_pdb_id"));
+ txt_search.setToolTipText(JvSwingUtils.wrapTooltip(true,
+ MessageManager.getString("label.enter_pdb_id")));
cmb_filterOption.setToolTipText(MessageManager
.getString("info.select_filter_option"));
txt_search.getDocument().addDocumentListener(new DocumentListener()
btn_cancel.setEnabled(false);
btn_view.setVisible(false);
btn_cancel.setVisible(false);
- previousWantedFields = PDBFTSRestClient.getInstance()
- .getAllDefaulDisplayedDataColumns()
- .toArray(new FTSDataColumnI[0]);
+ previousWantedFields = pdbDocFieldPrefs
+ .getStructureSummaryFields().toArray(
+ new FTSDataColumnI[0]);
}
if (sourceTabbedPane.getTitleAt(index)
.equals(foundStructureSummary))
}
};
pnl_filter.addChangeListener(changeListener);
- pnl_filter.setPreferredSize(new Dimension(500, 300));
+ pnl_filter.setPreferredSize(new Dimension(800, 400));
pnl_filter.add(foundStructureSummary, scrl_foundStructures);
pnl_filter.add(configureCols, pdbDocFieldPrefs);
mainFrame.setVisible(true);
mainFrame.setContentPane(this);
mainFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
- Desktop.addInternalFrame(mainFrame, frameTitle, 800, 400);
+ Desktop.addInternalFrame(mainFrame, frameTitle, 900, 500);
}
public boolean wantedFieldsUpdated()
{
return true;
}
-
- return Arrays.equals(
- PDBFTSRestClient.getInstance()
- .getAllDefaulDisplayedDataColumns()
- .toArray(new FTSDataColumnI[0]),
- previousWantedFields) ? false : true;
+
+ FTSDataColumnI[] currentWantedFields = pdbDocFieldPrefs
+ .getStructureSummaryFields()
+ .toArray(new FTSDataColumnI[0]);
+ return Arrays.equals(currentWantedFields, previousWantedFields) ? false
+ : true;
}
}
}
+ public JTable getResultTable()
+ {
+ return tbl_summary;
+ }
public JComboBox<FilterOption> getCmbFilterOption()
{
return cmb_filterOption;
-#Thu Sep 03 10:55:37 BST 2015
+#Mon Jun 20 15:44:52 BST 2016
jalview.schemabinding.version2.ThresholdLine=jalview.schemabinding.version2.descriptors.ThresholdLineDescriptor
jalview.schemabinding.version2.SequenceSetProperties=jalview.schemabinding.version2.descriptors.SequenceSetPropertiesDescriptor
jalview.schemabinding.version2.StructureState=jalview.schemabinding.version2.descriptors.StructureStateDescriptor
private boolean _has_hidden;
/**
+ * Field _viewreference.
+ */
+ private boolean _viewreference;
+
+ /**
+ * keeps track of state for field: _viewreference
+ */
+ private boolean _has_viewreference;
+
+ /**
* Field _featuresList.
*/
private java.util.Vector _featuresList;
}
/**
+ */
+ public void deleteViewreference()
+ {
+ this._has_viewreference = false;
+ }
+
+ /**
* Method enumerateFeatures.
*
* @return an Enumeration over all jalview.schemabinding.version2.Features
}
/**
+ * Returns the value of field 'viewreference'.
+ *
+ * @return the value of field 'Viewreference'.
+ */
+ public boolean getViewreference()
+ {
+ return this._viewreference;
+ }
+
+ /**
* Method hasColour.
*
* @return true if at least one Colour has been added
}
/**
+ * Method hasViewreference.
+ *
+ * @return true if at least one Viewreference has been added
+ */
+ public boolean hasViewreference()
+ {
+ return this._has_viewreference;
+ }
+
+ /**
* Returns the value of field 'hidden'.
*
* @return the value of field 'Hidden'.
}
/**
+ * Returns the value of field 'viewreference'.
+ *
+ * @return the value of field 'Viewreference'.
+ */
+ public boolean isViewreference()
+ {
+ return this._viewreference;
+ }
+
+ /**
*
*
* @param out
}
/**
+ * Sets the value of field 'viewreference'.
+ *
+ * @param viewreference
+ * the value of field 'viewreference'.
+ */
+ public void setViewreference(final boolean viewreference)
+ {
+ this._viewreference = viewreference;
+ this._has_viewreference = true;
+ }
+
+ /**
* Method unmarshal.
*
* @param reader
//- Imported classes and packages -/
//---------------------------------/
+import jalview.schemabinding.version2.AnnotationColours;
+
/**
* Class AnnotationColoursDescriptor.
*
//- Imported classes and packages -/
//---------------------------------/
+import jalview.schemabinding.version2.Features;
+
/**
* Class FeaturesDescriptor.
*
fieldValidator.setValidator(typeValidator);
}
desc.setValidator(fieldValidator);
+ // -- _viewreference
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_viewreference", "viewreference",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ JSeq target = (JSeq) object;
+ if (!target.hasViewreference())
+ {
+ return null;
+ }
+ return (target.getViewreference() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ JSeq target = (JSeq) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteViewreference();
+ return;
+ }
+ target.setViewreference(((java.lang.Boolean) value)
+ .booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _viewreference
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
+ }
+ desc.setValidator(fieldValidator);
// -- initialize element descriptors
// -- _featuresList
desc.setImmutable(true);
handler = new org.exolab.castor.xml.XMLFieldHandler()
{
+ @Override
public java.lang.Object getValue(java.lang.Object object)
throws IllegalStateException
{
return target.getSchemeName();
}
+ @Override
public void setValue(java.lang.Object object, java.lang.Object value)
throws IllegalStateException, IllegalArgumentException
{
}
}
+ @Override
public java.lang.Object newInstance(java.lang.Object parent)
{
return null;
desc.setImmutable(true);
handler = new org.exolab.castor.xml.XMLFieldHandler()
{
+ @Override
public java.lang.Object getValue(java.lang.Object object)
throws IllegalStateException
{
return target.getVersion();
}
+ @Override
public void setValue(java.lang.Object object, java.lang.Object value)
throws IllegalStateException, IllegalArgumentException
{
}
}
+ @Override
public java.lang.Object newInstance(java.lang.Object parent)
{
return null;
org.exolab.castor.xml.NodeType.Element);
handler = new org.exolab.castor.xml.XMLFieldHandler()
{
+ @Override
public java.lang.Object getValue(java.lang.Object object)
throws IllegalStateException
{
return target.getColour();
}
+ @Override
public void setValue(java.lang.Object object, java.lang.Object value)
throws IllegalStateException, IllegalArgumentException
{
}
}
+ @Override
public void resetValue(Object object) throws IllegalStateException,
IllegalArgumentException
{
}
}
+ @Override
public java.lang.Object newInstance(java.lang.Object parent)
{
return new Colour();
*
* @return the access mode specified for this class.
*/
+ @Override
public org.exolab.castor.mapping.AccessMode getAccessMode()
{
return null;
*
* @return the identity field, null if this class has no identity.
*/
+ @Override
public org.exolab.castor.mapping.FieldDescriptor getIdentity()
{
return super.getIdentity();
*
* @return the Java class represented by this descriptor.
*/
+ @Override
public java.lang.Class getJavaClass()
{
return jalview.schemabinding.version2.JalviewUserColours.class;
*
* @return the namespace prefix to use when marshaling as XML.
*/
+ @Override
public java.lang.String getNameSpacePrefix()
{
return _nsPrefix;
*
* @return the namespace URI used when marshaling and unmarshaling as XML.
*/
+ @Override
public java.lang.String getNameSpaceURI()
{
return _nsURI;
* @return a specific validator for the class described by this
* ClassDescriptor.
*/
+ @Override
public org.exolab.castor.xml.TypeValidator getValidator()
{
return this;
*
* @return the XML Name for the Class being described.
*/
+ @Override
public java.lang.String getXMLName()
{
return _xmlName;
* @return true if XML schema definition of this Class is that of a global
* element or element with anonymous type definition.
*/
+ @Override
public boolean isElementDefinition()
{
return _elementDefinition;
//- Imported classes and packages -/
//---------------------------------/
+import jalview.schemabinding.version2.UserColourScheme;
+
/**
* Class UserColourSchemeDescriptor.
*
//- Imported classes and packages -/
//---------------------------------/
+import jalview.schemabinding.version2.VamsasModel;
+
/**
* Class VamsasModelDescriptor.
*
if (isMapUsingSIFTs)
{
setProgressBar(null);
- setProgressBar("Obtaining mapping with SIFTS");
+ setProgressBar(MessageManager
+ .getString("status.obtaining_mapping_with_sifts"));
jalview.datamodel.Mapping sqmpping = maxAlignseq
.getMappingFromS1(false);
if (targetChainId != null && !targetChainId.trim().isEmpty())
{
- StructureMapping mapping = getStructureMapping(seq, pdbFile,
- targetChainId, pdb, maxChain, sqmpping, maxAlignseq);
- seqToStrucMapping.add(mapping);
+ StructureMapping siftsMapping;
+ try
+ {
+ siftsMapping = getStructureMapping(seq, pdbFile, targetChainId,
+ pdb, maxChain, sqmpping, maxAlignseq);
+ seqToStrucMapping.add(siftsMapping);
+ maxChain.makeExactMapping(maxAlignseq, seq);
+ maxChain.transferRESNUMFeatures(seq, null);
+ maxChain.transferResidueAnnotation(siftsMapping, sqmpping);
+ } catch (SiftsException e)
+ {
+ // fall back to NW alignment
+ System.err.println(e.getMessage());
+ StructureMapping nwMapping = getNWMappings(seq, pdbFile,
+ targetChainId, maxChain, pdb, maxAlignseq);
+ seqToStrucMapping.add(nwMapping);
+ }
}
else
{
+ ArrayList<StructureMapping> foundSiftsMappings = new ArrayList<StructureMapping>();
for (PDBChain chain : pdb.getChains())
{
- StructureMapping mapping = getStructureMapping(seq, pdbFile,
- chain.id, pdb, chain, sqmpping, maxAlignseq);
- seqToStrucMapping.add(mapping);
+ try
+ {
+ StructureMapping siftsMapping = getStructureMapping(seq,
+ pdbFile,
+ chain.id, pdb, chain, sqmpping, maxAlignseq);
+ foundSiftsMappings.add(siftsMapping);
+ } catch (SiftsException e)
+ {
+ System.err.println(e.getMessage());
+ }
+ }
+ if (!foundSiftsMappings.isEmpty())
+ {
+ seqToStrucMapping.addAll(foundSiftsMappings);
+ maxChain.makeExactMapping(maxAlignseq, seq);
+ maxChain.transferRESNUMFeatures(seq, null);
+ maxChain.transferResidueAnnotation(foundSiftsMappings.get(0),
+ sqmpping);
+ }
+ else
+ {
+ StructureMapping nwMapping = getNWMappings(seq, pdbFile,
+ maxChainId, maxChain, pdb, maxAlignseq);
+ seqToStrucMapping.add(nwMapping);
}
}
}
else
{
setProgressBar(null);
- setProgressBar("Obtaining mapping with NW alignment");
+ setProgressBar(MessageManager
+ .getString("status.obtaining_mapping_with_nw_alignment"));
seqToStrucMapping.add(getNWMappings(seq, pdbFile, maxChainId,
maxChain, pdb, maxAlignseq));
}
private StructureMapping getStructureMapping(SequenceI seq,
String pdbFile, String targetChainId, StructureFile pdb,
PDBChain maxChain, jalview.datamodel.Mapping sqmpping,
- AlignSeq maxAlignseq)
+ AlignSeq maxAlignseq) throws SiftsException
{
- String maxChainId = targetChainId;
- try
- {
StructureMapping curChainMapping = siftsClient
.getSiftsStructureMapping(seq, pdbFile, targetChainId);
try
e.printStackTrace();
}
return curChainMapping;
- } catch (SiftsException e)
- {
- System.err.println(e.getMessage());
- System.err.println(">>> Now switching mapping with NW alignment...");
- setProgressBar(null);
- setProgressBar(">>> Now switching mapping with NW alignment...");
- return getNWMappings(seq, pdbFile, maxChainId, maxChain, pdb,
- maxAlignseq);
- }
}
private StructureMapping getNWMappings(SequenceI seq,
for (String file : files)
{
notLoaded = file;
+ if (file == null)
+ {
+ continue;
+ }
try
{
StructureMapping[] sm = getSsm().getMapping(file);
--- /dev/null
+package jalview.util;
+
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+public class DnaUtils
+{
+
+ /**
+ * Parses an ENA/GenBank format location specifier and returns a list of
+ * [start, end] ranges. Throws an exception if not able to parse.
+ * <p>
+ * Currently we do not parse "order()" specifiers, or indeterminate ranges of
+ * the format "<start..end" or "start..>end" or "start.end" or
+ * "start^end"
+ *
+ * @param location
+ * @return
+ * @throws ParseException
+ * if unable to parse the location (the exception message is the
+ * location specifier being parsed); we use ParseException in
+ * preference to the unchecked IllegalArgumentException
+ * @see http://www.insdc.org/files/feature_table.html#3.4
+ */
+ public static List<int[]> parseLocation(String location)
+ throws ParseException
+ {
+ if (location.startsWith("join("))
+ {
+ return parseJoin(location);
+ }
+ else if (location.startsWith("complement("))
+ {
+ return parseComplement(location);
+ }
+ if (location.startsWith("order("))
+ {
+ throw new ParseException(location, 0);
+ }
+
+ /*
+ * try to parse m..n (or simply m)
+ */
+ String[] range = location.split("\\.\\.");
+ if (range.length == 1 || range.length == 2)
+ {
+ try
+ {
+ int start = Integer.valueOf(range[0]);
+ int end = range.length == 1 ? start : Integer.valueOf(range[1]);
+ return Collections.singletonList(new int[] { start, end });
+ } catch (NumberFormatException e)
+ {
+ /*
+ * could be a location like <1..888 or 1..>888
+ */
+ throw new ParseException(location, 0);
+ }
+ }
+ else
+ {
+ /*
+ * could be a location like 102.110 or 123^124
+ */
+ throw new ParseException(location, 0);
+ }
+ }
+
+ /**
+ * Parses a complement(locationSpec) into a list of start-end ranges
+ *
+ * @param location
+ * @return
+ * @throws ParseException
+ */
+ static List<int[]> parseComplement(String location) throws ParseException
+ {
+ /*
+ * take what is inside complement()
+ */
+ if (!location.endsWith(")"))
+ {
+ throw new ParseException(location, 0);
+ }
+ String toComplement = location.substring("complement(".length(),
+ location.length() - 1);
+ List<int[]> ranges = parseLocation(toComplement);
+
+ /*
+ * reverse the order and direction of ranges
+ */
+ Collections.reverse(ranges);
+ for (int[] range : ranges)
+ {
+ int temp = range[0];
+ range[0] = range[1];
+ range[1] = temp;
+ }
+ return ranges;
+ }
+
+ /**
+ * Parses a join(loc1,loc2,...,locn) into a list of start-end ranges
+ *
+ * @param location
+ * @return
+ * @throws ParseException
+ */
+ static List<int[]> parseJoin(String location) throws ParseException
+ {
+ List<int[]> ranges = new ArrayList<int[]>();
+
+ /*
+ * take what is inside join()
+ */
+ if (!location.endsWith(")"))
+ {
+ throw new ParseException(location, 0);
+ }
+ String joinedLocs = location.substring("join(".length(),
+ location.length() - 1);
+ String[] locations = joinedLocs.split(",");
+ for (String loc : locations)
+ {
+ List<int[]> range = parseLocation(loc);
+ ranges.addAll(range);
+ }
+ return ranges;
+ }
+
+}
TYPE type;
+ private IProgressIndicator pIndicator;
+
+ private long pSessionId;
+
+ private boolean headless;
+
public enum TYPE
{
EPS("EPS", MessageManager.getString("label.eps_file"), getEPSChooser()), PNG(
int height, File file, String fileTitle,
IProgressIndicator pIndicator, long pSessionId, boolean headless)
{
+ this.pIndicator = pIndicator;
this.type = type;
-
+ this.pSessionId = pSessionId;
+ this.headless = headless;
if (file == null)
{
- if (pIndicator != null && !headless)
- {
- pIndicator.setProgressBar(
- MessageManager.formatMessage(
- "status.waiting_for_user_to_select_output_file",
- type.name), pSessionId);
- }
+ setProgressMessage(MessageManager.formatMessage(
+ "status.waiting_for_user_to_select_output_file", type.name));
JalviewFileChooser chooser;
chooser = type.getChooser();
chooser.setFileView(new jalview.io.JalviewFileView());
}
else
{
- if (pIndicator != null && !headless)
- {
- pIndicator.setProgressBar(MessageManager.formatMessage(
- "status.cancelled_image_export_operation", type.name),
- pSessionId);
- }
+ setProgressMessage(MessageManager.formatMessage(
+ "status.cancelled_image_export_operation", type.name));
}
}
try
{
out = new FileOutputStream(file);
+ setProgressMessage(null);
+ setProgressMessage(MessageManager.formatMessage(
+ "status.exporting_alignment_as_x_file", type.getName()));
if (type == TYPE.SVG)
{
setupSVG(width, height, fileTitle);
{
setupPNG(width, height);
}
- if (pIndicator != null && !headless)
- {
- pIndicator.setProgressBar(
-MessageManager.formatMessage(
- "status.export_complete", type.getName()),
- pSessionId);
- }
+
} catch (Exception ex)
{
System.out.println("Error creating " + type.getName() + " file.");
- pIndicator.setProgressBar(MessageManager.formatMessage(
- "info.error_creating_file", type.getName()), pSessionId);
+ setProgressMessage(MessageManager.formatMessage(
+ "info.error_creating_file", type.getName()));
}
}
}
if (renderStyle == null || eps.cancelled)
{
+ setProgressMessage(MessageManager.formatMessage(
+ "status.cancelled_image_export_operation", "EPS"));
return;
}
}
pg.setAccurateTextMode(accurateText);
graphics = pg;
+ setProgressMessage(MessageManager.formatMessage(
+ "status.export_complete", type.getName()));
} catch (Exception ex)
{
}
Graphics2D ig2 = (Graphics2D) graphics;
ig2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
+ setProgressMessage(MessageManager.formatMessage(
+ "status.export_complete", type.getName()));
}
if (renderStyle == null || svgOption.cancelled)
{
+ setProgressMessage(MessageManager.formatMessage(
+ "status.cancelled_image_export_operation", "SVG"));
return;
}
}
- if (renderStyle.equalsIgnoreCase("lineart"))
+ if (renderStyle.equalsIgnoreCase("Lineart"))
{
ig2.setRenderingHint(SVGHints.KEY_DRAW_STRING_TYPE,
SVGHints.VALUE_DRAW_STRING_TYPE_VECTOR);
}
+ setProgressMessage(MessageManager.formatMessage(
+ "status.export_complete", type.getName()));
graphics = g2;
}
"Encapsulated Postscript");
}
+ private void setProgressMessage(String message)
+ {
+ if (pIndicator != null && !headless)
+ {
+ pIndicator.setProgressBar(message, pSessionId);
+ }
+ }
+
static JalviewFileChooser getSVGChooser()
{
if (Jalview.isHeadlessMode())
*/
package jalview.util;
+import java.awt.Toolkit;
+import java.awt.event.MouseEvent;
+
/**
* System platform information used by Applet and Application
*
f.append(file.substring(lastp));
return f.toString();
}
+
+ public static boolean isControlDown(MouseEvent e)
+ {
+ return (jalview.util.Platform.isAMac() ? (Toolkit.getDefaultToolkit()
+ .getMenuShortcutKeyMask() & e.getModifiers()) != 0 : e
+ .isControlDown());
+ }
}
}
return result;
}
+
+ /**
+ * Compares two versions formatted as e.g. "3.4.5" and returns -1, 0 or 1 as
+ * the first version precedes, is equal to, or follows the second
+ *
+ * @param v1
+ * @param v2
+ * @return
+ */
+ public static int compareVersions(String v1, String v2)
+ {
+ return compareVersions(v1, v2, null);
+ }
+
+ /**
+ * Compares two versions formatted as e.g. "3.4.5b1" and returns -1, 0 or 1 as
+ * the first version precedes, is equal to, or follows the second
+ *
+ * @param v1
+ * @param v2
+ * @param pointSeparator
+ * a string used to delimit point increments in sub-tokens of the
+ * version
+ * @return
+ */
+ public static int compareVersions(String v1, String v2,
+ String pointSeparator)
+ {
+ if (v1 == null || v2 == null)
+ {
+ return 0;
+ }
+ String[] toks1 = v1.split("\\.");
+ String[] toks2 = v2.split("\\.");
+ int i = 0;
+ for (; i < toks1.length; i++)
+ {
+ if (i >= toks2.length)
+ {
+ /*
+ * extra tokens in v1
+ */
+ return 1;
+ }
+ String tok1 = toks1[i];
+ String tok2 = toks2[i];
+ if (pointSeparator != null)
+ {
+ /*
+ * convert e.g. 5b2 into decimal 5.2 for comparison purposes
+ */
+ tok1 = tok1.replace(pointSeparator, ".");
+ tok2 = tok2.replace(pointSeparator, ".");
+ }
+ try
+ {
+ float f1 = Float.valueOf(tok1);
+ float f2 = Float.valueOf(tok2);
+ int comp = Float.compare(f1, f2);
+ if (comp != 0)
+ {
+ return comp;
+ }
+ } catch (NumberFormatException e)
+ {
+ System.err.println("Invalid version format found: "
+ + e.getMessage());
+ return 0;
+ }
+ }
+
+ if (i < toks2.length)
+ {
+ /*
+ * extra tokens in v2
+ */
+ return -1;
+ }
+
+ /*
+ * same length, all tokens match
+ */
+ return 0;
+ }
+
+ /**
+ * Converts the string to all lower-case except the first character which is
+ * upper-cased
+ *
+ * @param s
+ * @return
+ */
+ public static String toSentenceCase(String s)
+ {
+ if (s == null)
+ {
+ return s;
+ }
+ if (s.length() <= 1)
+ {
+ return s.toUpperCase();
+ }
+ return s.substring(0, 1).toUpperCase() + s.substring(1).toLowerCase();
+ }
}
{
updateHiddenColumns();
}
+ isColSelChanged(true);
}
/**
*/
public boolean isColSelChanged(boolean b)
{
- int hc = (colSel == null || colSel.isEmpty()) ? -1 : colSel
- .hashCode();
+ int hc = (colSel == null || colSel.isEmpty()) ? -1 : colSel.hashCode();
if (hc != -1 && hc != colselhash)
{
if (b)
colSel.hideSelectedColumns();
setSelectionGroup(null);
-
+ isColSelChanged(true);
}
public void hideColumns(int start, int end)
{
colSel.hideColumns(start, end);
}
+ isColSelChanged(true);
}
public void showColumn(int col)
{
colSel.revealHiddenColumns(col);
-
+ isColSelChanged(true);
}
public void showAllHiddenColumns()
{
colSel.revealAllHiddenColumns();
+ isColSelChanged(true);
}
// common hide/show seq stuff
@Override
public String[] getViewAsString(boolean selectedRegionOnly)
{
+ return getViewAsString(selectedRegionOnly, true);
+ }
+
+ @Override
+ public String[] getViewAsString(boolean selectedRegionOnly,
+ boolean exportHiddenSeqs)
+ {
String[] selection = null;
SequenceI[] seqs = null;
int i, iSize;
}
else
{
- if (hasHiddenRows())
+ if (hasHiddenRows() && exportHiddenSeqs)
{
- iSize = alignment.getHiddenSequences().getFullAlignment()
- .getHeight();
- seqs = alignment.getHiddenSequences().getFullAlignment()
- .getSequencesArray();
- end = alignment.getHiddenSequences().getFullAlignment().getWidth();
+ AlignmentI fullAlignment = alignment.getHiddenSequences()
+ .getFullAlignment();
+ iSize = fullAlignment.getHeight();
+ seqs = fullAlignment.getSequencesArray();
+ end = fullAlignment.getWidth();
}
else
{
}
}
}
+
+
}
package jalview.workers;
+import jalview.bin.Jalview;
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.Annotation;
import jalview.gui.AlignFrame;
-import jalview.gui.Desktop;
import java.awt.Color;
*/
public static void newCalculator(FeatureCounterI counter)
{
- if (Desktop.getCurrentAlignFrame() != null)
+ if (Jalview.getCurrentAlignFrame() != null)
{
- newCalculator(Desktop.getCurrentAlignFrame(), counter);
+ newCalculator(Jalview.getCurrentAlignFrame(), counter);
}
else
{
*/
public static void newCalculator(AnnotationProviderI calculator)
{
- if (Desktop.getCurrentAlignFrame() != null)
+ if (Jalview.getCurrentAlignFrame() != null)
{
- newCalculator(Desktop.getCurrentAlignFrame(), calculator);
+ newCalculator(Jalview.getCurrentAlignFrame(), calculator);
}
else
{
String[] defdb = null, otherdb = sfetcher
.getDbInstances(jalview.ws.dbsources.das.datamodel.DasSequenceSource.class);
List<DbSourceProxy> selsources = new ArrayList<DbSourceProxy>();
- Vector dasselsrc = (featureSettings != null) ? featureSettings
+ Vector<jalviewSourceI> dasselsrc = (featureSettings != null) ? featureSettings
.getSelectedSources() : new jalview.gui.DasSourceBrowser()
.getSelectedSources();
Enumeration<jalviewSourceI> en = dasselsrc.elements();
}
/**
+ * Constructor with only sequences provided
+ *
+ * @param sequences
+ */
+ public DBRefFetcher(SequenceI[] sequences)
+ {
+ this(sequences, null, null, null, false);
+ }
+
+ /**
* Add a listener to be notified when sequence fetching is complete
*
* @param l
import jalview.bin.Cache;
import jalview.datamodel.DBRefEntry;
+import jalview.datamodel.DBRefSource;
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceI;
import jalview.gui.AlignFrame;
import jalview.gui.Desktop;
import jalview.gui.FeatureSettings;
+import jalview.util.DBRefUtils;
import jalview.util.MessageManager;
import jalview.util.UrlLink;
import jalview.ws.dbsources.das.api.DasSourceRegistryI;
{
for (int j = 0; j < dbref.length; j++)
{
- if (dbref[j].getSource().equals(
- jalview.datamodel.DBRefSource.UNIPROT))
+ if (dbref[j].getSource().equals(DBRefSource.UNIPROT))
{
refCount++;
break;
public void run()
{
running = true;
- boolean isNuclueotide = af.getViewport().getAlignment()
+ boolean isNucleotide = af.getViewport().getAlignment()
.isNucleotide();
- new jalview.ws.DBRefFetcher(sequences, af, null, af.featureSettings,
- isNuclueotide).fetchDBRefs(true);
+ new DBRefFetcher(sequences, af, null, af.featureSettings,
+ isNucleotide).fetchDBRefs(true);
startFetching();
setGuiFetchComplete();
{
jalviewSourceI[] sources = sourceRegistry.getSources().toArray(
new jalviewSourceI[0]);
- String active = jalview.bin.Cache.getDefault("DAS_ACTIVE_SOURCE",
+ String active = Cache.getDefault("DAS_ACTIVE_SOURCE",
"uniprot");
StringTokenizer st = new StringTokenizer(active, "\t");
selectedSources = new Vector();
{
return null;
}
- DBRefEntry[] uprefs = jalview.util.DBRefUtils.selectRefs(
+ DBRefEntry[] uprefs = DBRefUtils.selectRefs(
seq.getDBRefs(), new String[] {
// jalview.datamodel.DBRefSource.PDB,
- jalview.datamodel.DBRefSource.UNIPROT,
+ DBRefSource.UNIPROT,
// jalview.datamodel.DBRefSource.EMBL - not tested on any EMBL coord
// sys sources
});
for (COORDINATES csys : dasSource.getVersion().getCOORDINATES())
{
- if (jalview.util.DBRefUtils.isDasCoordinateSystem(
+ if (DBRefUtils.isDasCoordinateSystem(
csys.getAuthority(), uprefs[j]))
{
debug("Launched fetcher for coordinate system "
try
{
reply = dbFetch.fetchDataAsFile(
- emprefx.toLowerCase() + ":" + query.trim(), "emblxml", null,
+ emprefx.toLowerCase() + ":" + query.trim(), "display=xml",
".xml");
} catch (Exception e)
{
+
/*
* Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
* Copyright (C) $$Year-Rel$$ The Jalview Authors
public static final String FEATURE_RES_NUM = "RESNUM";
- private static String currentDefaultFomart = DBRefSource.PDB;
+ private static String currentDefaultFormat = DBRefSource.PDB;
/*
* (non-Javadoc)
stopQuery();
return null;
}
- String ext = getCurrentDefaultFomart().equalsIgnoreCase("mmcif") ? ".cif"
+ String ext = getCurrentDefaultFormat().equalsIgnoreCase("mmcif") ? ".cif"
: ".xml";
EBIFetchClient ebi = new EBIFetchClient();
file = ebi.fetchDataAsFile("pdb:" + id,
- getCurrentDefaultFomart().toLowerCase(), "raw", ext)
+ getCurrentDefaultFormat().toLowerCase(), ext)
.getAbsolutePath();
stopQuery();
if (file == null)
pdbAlignment = new FormatAdapter().readFile(file,
jalview.io.AppletFormatAdapter.FILE,
- getCurrentDefaultFomart());
+ getCurrentDefaultFormat());
if (pdbAlignment != null)
{
List<SequenceI> toremove = new ArrayList<SequenceI>();
}
/**
- * obtain human glyoxalase chain A sequence
+ * human glyoxalase
*/
@Override
public String getTestQuery()
{
- return "1QIPA";
+ return "1QIP";
}
@Override
return 0;
}
- public static String getCurrentDefaultFomart()
+ public static String getCurrentDefaultFormat()
{
- return currentDefaultFomart;
+ return currentDefaultFormat;
}
- public static void setCurrentDefaultFomart(String currentDefaultFomart)
+ public static void setCurrentDefaultFormat(String currentDefaultFomart)
{
- Pdb.currentDefaultFomart = currentDefaultFomart;
+ Pdb.currentDefaultFormat = currentDefaultFomart;
}
/**
// uniprotxml parameter required since december 2007
// uniprotkb dbname changed introduced december 2008
File file = ebi.fetchDataAsFile("uniprotkb:" + queries, "uniprotxml",
- null, ".xml");
+ ".xml");
Vector<UniprotEntry> entries = getUniprotEntries(new FileReader(file));
if (entries != null)
*/
public class EBIFetchClient
{
- String format = "default";
-
- String style = "raw";
/**
* Creates a new EBIFetchClient object.
* the query formatted as db:query1;query2;query3
* @param format
* the format wanted
- * @param s
- * - unused parameter
+ * @param extension
+ * for the temporary file to hold response
* @return the file holding the response
* @throws OutOfMemoryError
*/
- public File fetchDataAsFile(String ids, String format, String s,
- String ext)
+ public File fetchDataAsFile(String ids, String format, String ext)
throws OutOfMemoryError
{
File outFile = null;
{
outFile = File.createTempFile("jalview", ext);
outFile.deleteOnExit();
- fetchData(ids, format, s, outFile);
+ fetchData(ids, format, outFile);
if (outFile.length() == 0)
{
outFile.delete();
}
/**
- * Single DB multiple record retrieval
+ * Fetches queries and either saves the response to a file or returns as
+ * string data
*
* @param ids
- * db:query1;query2;query3
* @param format
- * raw/xml
- * @param s
- * not used - remove?
- *
- * @return Raw string array result of query set
+ * @param outFile
+ * @return
+ * @throws OutOfMemoryError
*/
- public String[] fetchData(String ids, String format, String s)
+ String[] fetchData(String ids, String format, File outFile)
throws OutOfMemoryError
{
- return fetchData(ids, format, s, null);
+ StringBuilder querystring = new StringBuilder(ids.length());
+ String database = parseIds(ids, querystring);
+ if (database == null)
+ {
+ System.err.println("Invalid Query string : '" + ids + "'");
+ System.err.println("Should be of form 'dbname:q1;q2;q3;q4'");
+ return null;
+ }
+
+ // note: outFile is currently always specified, so return value is null
+ String[] rslt = fetchBatch(querystring.toString(), database, format, outFile);
+
+ return (rslt != null && rslt.length > 0 ? rslt : null);
}
- String[] fetchData(String ids, String f, String s, File outFile)
- throws OutOfMemoryError
+ /**
+ * Parses ids formatted as dbname:q1;q2;q3, returns the dbname and adds
+ * queries as comma-separated items to the querystring. dbname must be
+ * specified for at least one queryId. Returns null if a mixture of different
+ * dbnames is found (ignoring case).
+ *
+ * @param ids
+ * @param queryString
+ * @return
+ */
+ static String parseIds(String ids, StringBuilder queryString)
{
- // Need to split
- // ids of the form uniprot:25KD_SARPE;ADHR_DROPS;
- String[] rslts = new String[0];
+ String database = null;
StringTokenizer queries = new StringTokenizer(ids, ";");
- String db = null;
- StringBuffer querystring = null;
- int nq = 0;
+ boolean appending = queryString.length() > 0;
while (queries.hasMoreTokens())
{
String query = queries.nextToken();
- int p;
- if ((p = query.indexOf(':')) > -1)
+ int p = query.indexOf(':');
+ if (p > -1)
{
- db = query.substring(0, p);
+ String db = query.substring(0, p);
+ if (database != null && !db.equalsIgnoreCase(database))
+ {
+ /*
+ * different databases mixed in together - invalid
+ */
+ return null;
+ }
+ database = db;
query = query.substring(p + 1);
}
- if (querystring == null)
- {
- querystring = new StringBuffer(query);
- nq++;
- }
- else
- {
- querystring.append("," + query);
- nq++;
- }
- }
- if (db == null)
- {
- System.err.println("Invalid Query string : '" + ids
- + "'\nShould be of form 'dbname:q1;q2;q3;q4'");
- return null;
- }
- String[] rslt = fetchBatch(querystring.toString(), db, f, s, outFile);
- if (rslt != null)
- {
- String[] nrslts = new String[rslt.length + rslts.length];
- System.arraycopy(rslts, 0, nrslts, 0, rslts.length);
- System.arraycopy(rslt, 0, nrslts, rslts.length, rslt.length);
- rslts = nrslts;
+ queryString.append(appending ? "," : "");
+ queryString.append(query);
+ appending = true;
}
-
- return (rslts.length == 0 ? null : rslts);
+ return database;
}
- public String[] fetchBatch(String ids, String dbPath, String format, String s,
+ /**
+ * Fetches queries and either saves the response to a file or (if no file
+ * specified) returns as string data
+ *
+ * @param ids
+ * @param database
+ * @param format
+ * @param outFile
+ * @return
+ * @throws OutOfMemoryError
+ */
+ String[] fetchBatch(String ids, String database, String format,
File outFile) throws OutOfMemoryError
{
// long time = System.currentTimeMillis();
- /*
- * JAL-1855 dbfetch from ena_sequence, ena_coding
- */
- if (dbPath.equalsIgnoreCase(DBRefSource.EMBL))
- {
- dbPath = "ena_sequence";
- }
- else if (dbPath.equalsIgnoreCase(DBRefSource.EMBLCDS))
- {
- dbPath = "ena_coding";
- }
+ String url = buildUrl(ids, database, format);
try
{
- URL rcall = new URL("http://www.ebi.ac.uk/Tools/dbfetch/dbfetch/"
- + dbPath.toLowerCase() + "/" + ids.toLowerCase()
- + (format != null ? "/" + format : ""));
+ URL rcall = new URL(url);
InputStream is = new BufferedInputStream(rcall.openStream());
if (outFile != null)
}
} catch (OutOfMemoryError er)
{
-
- System.out.println("OUT OF MEMORY DOWNLOADING QUERY FROM " + dbPath
+ System.out.println("OUT OF MEMORY DOWNLOADING QUERY FROM " + database
+ ":\n" + ids);
throw er;
} catch (Exception ex)
return null;
}
System.err.println("Unexpected exception when retrieving from "
- + dbPath
+ + database
+ "\nQuery was : '" + ids + "'");
ex.printStackTrace(System.err);
return null;
}
return null;
}
+
+ /**
+ * Constructs the URL to fetch from
+ *
+ * @param ids
+ * @param database
+ * @param format
+ * @return
+ */
+ static String buildUrl(String ids, String database, String format)
+ {
+ String url;
+ if (database.equalsIgnoreCase(DBRefSource.EMBL)
+ || database.equalsIgnoreCase(DBRefSource.EMBLCDS))
+ {
+ url = "http://www.ebi.ac.uk/ena/data/view/" + ids.toLowerCase()
+ + (format != null ? "&" + format : "");
+ }
+ else
+ {
+ url = "http://www.ebi.ac.uk/Tools/dbfetch/dbfetch/"
+ + database.toLowerCase() + "/" + ids.toLowerCase()
+ + (format != null ? "/" + format : "");
+ }
+ return url;
+ }
}
});
wsmenu.add(aaConEnabled);
final JMenuItem modifyParams = new JMenuItem(aaui.getAAeditSettings());
- modifyParams
- .setToolTipText("<html><p>"
- + JvSwingUtils.wrapTooltip(false,
- aaui.getAAeditSettingsTooltip() + "</p>")
- + "</html>");
+ modifyParams.setToolTipText(JvSwingUtils.wrapTooltip(true,
+ aaui.getAAeditSettingsTooltip()));
modifyParams.addActionListener(new ActionListener()
{
return (WebServiceName.indexOf("lustal") > -1); // cheat!
}
+ @Override
public void attachWSMenuEntry(JMenu rmsawsmenu,
final Jws2Instance service, final AlignFrame alignFrame)
{
method.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
AlignmentView msa = alignFrame.gatherSequencesForAlignment();
method.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
AlignmentView msa = alignFrame.gatherSequencesForAlignment();
}
});
- methodR.setToolTipText(JvSwingUtils.wrapTooltip(
+ String tooltip = JvSwingUtils.wrapTooltip(
true,
- "<p><strong>"
+ "<strong>"
+ (preset.isModifiable() ? MessageManager
.getString("label.user_preset")
: MessageManager
.getString("label.service_preset"))
- + "</strong><br/>" + preset.getDescription()
- + "</p>"));
+ + "</strong><br/>"
+ + preset.getDescription());
+ methodR.setToolTipText(tooltip);
methodR.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
AlignmentView msa = alignFrame
private static final int PDB_ATOM_POS = 1;
- private static final String NOT_FOUND = "Not_Found";
-
private static final String NOT_OBSERVED = "Not_Observed";
- private static final String SIFTS_FTP_BASE_URL = "ftp://ftp.ebi.ac.uk/pub/databases/msd/sifts/xml/";
+ private static final String SIFTS_FTP_BASE_URL = "http://ftp.ebi.ac.uk/pub/databases/msd/sifts/xml/";
private final static String NEWLINE = System.lineSeparator();
*/
public static File getSiftsFile(String pdbId) throws SiftsException
{
- File siftsFile = new File(SiftsSettings.getSiftDownloadDirectory()
- + pdbId.toLowerCase() + ".xml.gz");
+ String siftsFileName = SiftsSettings.getSiftDownloadDirectory()
+ + pdbId.toLowerCase() + ".xml.gz";
+ File siftsFile = new File(siftsFileName);
if (siftsFile.exists())
{
// The line below is required for unit testing... don't comment it out!!!
if (isFileOlderThanThreshold(siftsFile,
SiftsSettings.getCacheThresholdInDays()))
{
- // System.out.println("Downloaded file is out of date, hence re-downloading...");
- siftsFile = downloadSiftsFile(pdbId.toLowerCase());
+ File oldSiftsFile = new File(siftsFileName + "_old");
+ siftsFile.renameTo(oldSiftsFile);
+ try
+ {
+ siftsFile = downloadSiftsFile(pdbId.toLowerCase());
+ oldSiftsFile.delete();
+ return siftsFile;
+ } catch (IOException e)
+ {
+ e.printStackTrace();
+ oldSiftsFile.renameTo(siftsFile);
+ return new File(siftsFileName);
+ }
}
- return siftsFile;
}
- siftsFile = downloadSiftsFile(pdbId.toLowerCase());
+ try
+ {
+ siftsFile = downloadSiftsFile(pdbId.toLowerCase());
+ } catch (IOException e)
+ {
+ throw new SiftsException(e.getMessage());
+ }
return siftsFile;
}
* @param pdbId
* @return downloaded SIFTs XML file
* @throws SiftsException
+ * @throws IOException
*/
- public static File downloadSiftsFile(String pdbId) throws SiftsException
+ public static File downloadSiftsFile(String pdbId) throws SiftsException,
+ IOException
{
if (pdbId.contains(".cif"))
{
{
siftsDownloadDir.mkdirs();
}
- try
- {
// System.out.println(">> Download ftp url : " + siftsFileFTPURL);
URL url = new URL(siftsFileFTPURL);
URLConnection conn = url.openConnection();
outputStream.close();
inputStream.close();
// System.out.println(">>> File downloaded : " + downloadedSiftsFile);
- } catch (IOException ex)
- {
- throw new SiftsException(ex.getMessage());
- }
return new File(downloadedSiftsFile);
}
DBRefEntry[] dbRefs = seq.getDBRefs();
if (dbRefs == null || dbRefs.length < 1)
{
- throw new SiftsException("Could not get source DB Ref");
+ throw new SiftsException(
+ "Source DBRef could not be determined. DBRefs might not have been retrieved.");
}
for (DBRefEntryI dbRef : dbRefs)
&& (dbRef.getSource().equalsIgnoreCase(DBRefSource.UNIPROT) || dbRef
.getSource().equalsIgnoreCase(DBRefSource.PDB)))
{
+ seq.setSourceDBRef(dbRef);
return dbRef;
}
}
.getMapRegion();
for (MapRegion mapRegion : mapRegions)
{
- accessions.add(mapRegion.getDb().getDbAccessionId());
+ accessions
+ .add(mapRegion.getDb().getDbAccessionId().toLowerCase());
}
}
}
jalview.util.Comparison.GapChars, seq.getSequenceAsString());
HashMap<Integer, int[]> mapping = new HashMap<Integer, int[]>();
DBRefEntryI sourceDBRef = seq.getSourceDBRef();
- if (sourceDBRef == null)
- {
- sourceDBRef = getValidSourceDBRef(seq);
- // TODO ensure sequence start/end is in the same coordinate system and
- // consistent with the choosen sourceDBRef
- }
+ sourceDBRef = getValidSourceDBRef(seq);
+ // TODO ensure sequence start/end is in the same coordinate system and
+ // consistent with the choosen sourceDBRef
// set sequence coordinate system - default value is UniProt
if (sourceDBRef.getSource().equalsIgnoreCase(DBRefSource.PDB))
private boolean isFoundInSiftsEntry(String accessionId)
{
+ HashSet<String> siftsDBRefs = getAllMappingAccession();
return accessionId != null
- && getAllMappingAccession().contains(accessionId);
+ && siftsDBRefs.contains(accessionId.toLowerCase());
}
/**
SequenceFeature sf = sfs[0];
assertEquals(1, sf.getBegin());
assertEquals(1, sf.getEnd());
- assertEquals("K->E", sf.getDescription());
+ assertEquals("p.Lys1Glu", sf.getDescription());
assertEquals("var1.125A>G", sf.getValue("ID"));
assertNull(sf.getValue("clinical_significance"));
assertEquals("ID=var1.125A>G", sf.getAttributes());
assertEquals(1, sf.links.size());
// link to variation is urlencoded
assertEquals(
- "K->E var1.125A>G|http://www.ensembl.org/Homo_sapiens/Variation/Summary?v=var1.125A%3EG",
+ "p.Lys1Glu var1.125A>G|http://www.ensembl.org/Homo_sapiens/Variation/Summary?v=var1.125A%3EG",
sf.links.get(0));
+ assertEquals("Jalview", sf.getFeatureGroup());
sf = sfs[1];
assertEquals(1, sf.getBegin());
assertEquals(1, sf.getEnd());
- assertEquals("K->Q", sf.getDescription());
+ assertEquals("p.Lys1Gln", sf.getDescription());
assertEquals("var2", sf.getValue("ID"));
assertEquals("Dodgy", sf.getValue("clinical_significance"));
assertEquals("ID=var2;clinical_significance=Dodgy", sf.getAttributes());
assertEquals(1, sf.links.size());
assertEquals(
- "K->Q var2|http://www.ensembl.org/Homo_sapiens/Variation/Summary?v=var2",
+ "p.Lys1Gln var2|http://www.ensembl.org/Homo_sapiens/Variation/Summary?v=var2",
sf.links.get(0));
+ assertEquals("Jalview", sf.getFeatureGroup());
sf = sfs[2];
assertEquals(1, sf.getBegin());
assertEquals(1, sf.getEnd());
- assertEquals("K->N", sf.getDescription());
+ assertEquals("p.Lys1Asn", sf.getDescription());
assertEquals("var4", sf.getValue("ID"));
assertEquals("Benign", sf.getValue("clinical_significance"));
assertEquals("ID=var4;clinical_significance=Benign", sf.getAttributes());
assertEquals(1, sf.links.size());
assertEquals(
- "K->N var4|http://www.ensembl.org/Homo_sapiens/Variation/Summary?v=var4",
+ "p.Lys1Asn var4|http://www.ensembl.org/Homo_sapiens/Variation/Summary?v=var4",
sf.links.get(0));
+ assertEquals("Jalview", sf.getFeatureGroup());
sf = sfs[3];
assertEquals(3, sf.getBegin());
assertEquals(3, sf.getEnd());
- assertEquals("P->H", sf.getDescription());
+ assertEquals("p.Pro3His", sf.getDescription());
assertEquals("var6", sf.getValue("ID"));
assertEquals("Good", sf.getValue("clinical_significance"));
assertEquals("ID=var6;clinical_significance=Good", sf.getAttributes());
assertEquals(1, sf.links.size());
assertEquals(
- "P->H var6|http://www.ensembl.org/Homo_sapiens/Variation/Summary?v=var6",
+ "p.Pro3His var6|http://www.ensembl.org/Homo_sapiens/Variation/Summary?v=var6",
sf.links.get(0));
// var5 generates two distinct protein variant features
+ assertEquals("Jalview", sf.getFeatureGroup());
sf = sfs[4];
assertEquals(3, sf.getBegin());
assertEquals(3, sf.getEnd());
- assertEquals("P->R", sf.getDescription());
+ assertEquals("p.Pro3Arg", sf.getDescription());
assertEquals("var6", sf.getValue("ID"));
assertEquals("Good", sf.getValue("clinical_significance"));
assertEquals("ID=var6;clinical_significance=Good", sf.getAttributes());
assertEquals(1, sf.links.size());
assertEquals(
- "P->R var6|http://www.ensembl.org/Homo_sapiens/Variation/Summary?v=var6",
+ "p.Pro3Arg var6|http://www.ensembl.org/Homo_sapiens/Variation/Summary?v=var6",
sf.links.get(0));
+ assertEquals("Jalview", sf.getFeatureGroup());
}
/**
assertTrue(testee.equals("A12345,"));
assertTrue(testee.equals("A12345?"));
assertTrue(testee.equals("A12345_"));
+ /*
+ * case insensitive matching
+ */
+ assertTrue(testee.equals("a12345"));
/*
* matcher name = target name + word separator...
assertTrue(testee.equals("A12345"));
/*
+ * case insensitive matching
+ */
+ assertTrue(testee.equals("a12345"));
+
+ /*
* miscellaneous failing cases
*/
testee = sequenceIdMatcher.new SeqIdName("A12345");
assertFalse(testee.equals((Object) null));
assertFalse(testee.equals(""));
- assertFalse(testee.equals("a12345"));
assertFalse(testee.equals("A12346|A12345"));
+ /*
+ * case insensitive matching
+ */
+ assertTrue(testee.equals("a12345"));
testee = sequenceIdMatcher.new SeqIdName("A12345?B23456");
assertFalse(testee.equals("B23456"));
testee = sequenceIdMatcher.new SeqIdName("A12345<");
assertFalse(testee.equals("A12345?"));
assertTrue(testee.equals("A12345<")); // bug? inconsistent
+ /*
+ * case insensitive matching
+ */
+ assertTrue(testee.equals("a12345"));
}
}
--- /dev/null
+package jalview.bin;
+
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertFalse;
+import static org.testng.AssertJUnit.assertNull;
+import static org.testng.AssertJUnit.assertTrue;
+
+import org.testng.annotations.Test;
+
+public class ArgsParserTest
+{
+ @Test(groups = "Functional")
+ public void testGetValue()
+ {
+ ArgsParser ap = new ArgsParser(new String[] { "-name", "Henry", "-job",
+ "Tester" });
+ assertEquals(4, ap.getSize());
+ assertNull(ap.getValue("rubbish"));
+ assertEquals("Tester", ap.getValue("job"));
+ // call to getValue removes the argument and its value
+ assertEquals(2, ap.getSize());
+ assertNull(ap.getValue("job"));
+ assertFalse(ap.contains("job"));
+ assertFalse(ap.contains("Tester"));
+
+ assertEquals("Henry", ap.getValue("name"));
+ assertEquals(0, ap.getSize());
+ assertNull(ap.getValue("name"));
+ }
+
+ @Test(groups = "Functional")
+ public void testGetValue_decoded()
+ {
+ ArgsParser ap = new ArgsParser(new String[] { "-name%241", "Henry",
+ "-job", "Test%203%2a" });
+ // parameter value is decoded
+ assertEquals("Test 3*", ap.getValue("job", true));
+ // parameter name is not decoded
+ assertNull(ap.getValue("name$1", true));
+ assertEquals("Henry", ap.getValue("name%241", true));
+ }
+
+ @Test(groups = "Functional")
+ public void testNextValue()
+ {
+ ArgsParser ap = new ArgsParser(new String[] { "-name", "Henry", "-job",
+ "Tester" });
+ assertEquals("name", ap.nextValue());
+ assertEquals("Henry", ap.nextValue());
+ assertEquals("job", ap.nextValue());
+ assertEquals("Tester", ap.nextValue());
+ }
+
+ @Test(groups = "Functional")
+ public void testContains()
+ {
+ ArgsParser ap = new ArgsParser(new String[] { "-name", "Henry", "-job",
+ "Tester" });
+ assertFalse(ap.contains("Susan"));
+ assertFalse(ap.contains("-name"));
+ assertTrue(ap.contains("name"));
+ // testing for contains removes the argument
+ assertFalse(ap.contains("name"));
+ }
+}
cs.addElement(0);
assertEquals(0, cs.getMin());
}
+
+ @Test(groups = { "Functional" })
+ public void testEquals()
+ {
+ ColumnSelection cs = new ColumnSelection();
+ cs.addElement(0);
+ cs.addElement(513);
+ cs.addElement(1);
+ cs.hideColumns(3);
+ cs.hideColumns(7);
+ cs.hideColumns(5,9);
+
+ // same selections added in a different order
+ ColumnSelection cs2 = new ColumnSelection();
+ cs2.addElement(1);
+ cs2.addElement(513);
+ cs2.addElement(0);
+
+ // with no hidden columns
+ assertFalse(cs.equals(cs2));
+ assertFalse(cs2.equals(cs));
+
+ // with hidden columns added in a different order
+ cs2.hideColumns(6, 9);
+ cs2.hideColumns(5, 8);
+ cs2.hideColumns(3);
+
+ assertTrue(cs.equals(cs2));
+ assertTrue(cs.equals(cs));
+ assertTrue(cs2.equals(cs));
+ assertTrue(cs2.equals(cs2));
+
+ cs2.addElement(12);
+ assertFalse(cs.equals(cs2));
+ assertFalse(cs2.equals(cs));
+
+ cs2.removeElement(12);
+ assertTrue(cs.equals(cs2));
+
+ cs2.hideColumns(88);
+ assertFalse(cs.equals(cs2));
+ /*
+ * unhiding a column adds it to selection!
+ */
+ cs2.revealHiddenColumns(88);
+ assertFalse(cs.equals(cs2));
+ cs.addElement(88);
+ assertTrue(cs.equals(cs2));
+ }
}
*/
package jalview.datamodel;
+import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertFalse;
+import static org.testng.AssertJUnit.assertSame;
import static org.testng.AssertJUnit.assertTrue;
import jalview.util.MapList;
assertTrue(ref1.equalRef(ref2));
assertTrue(ref2.equalRef(ref1));
}
+
+ /**
+ * Tests for the method that may update a DBRefEntry from another with a
+ * mapping or 'real' version
+ */
+ @Test(groups = { "Functional" })
+ public void testUpdateFrom()
+ {
+ DBRefEntry ref1 = new DBRefEntry("UNIPROT", "1", "V71633");
+
+ assertFalse(ref1.updateFrom(null));
+
+ /*
+ * equivalent other dbref
+ */
+ DBRefEntry ref2 = new DBRefEntry("uniprot", "1", "v71633");
+ assertTrue(ref1.updateFrom(ref2));
+ assertEquals("UNIPROT", ref1.getSource()); // unchanged
+ assertEquals("V71633", ref1.getAccessionId()); // unchanged
+
+ /*
+ * ref1 has no mapping, acquires mapping from ref2
+ */
+ Mapping map = new Mapping(new MapList(new int[] { 1, 3 }, new int[] {
+ 1, 1 }, 3, 1));
+ ref2.setMap(map);
+ assertTrue(ref1.updateFrom(ref2));
+ assertSame(map, ref1.getMap()); // null mapping updated
+
+ /*
+ * ref1 has a mapping, does not acquire mapping from ref2
+ */
+ ref2.setMap(new Mapping(map));
+ assertTrue(ref1.updateFrom(ref2));
+ assertSame(map, ref1.getMap()); // non-null mapping not updated
+
+ /*
+ * ref2 has a different source, accession or version
+ */
+ ref2.setSource("pdb");
+ assertFalse(ref1.updateFrom(ref2));
+ ref2.setSource(ref1.getSource());
+ ref2.setAccessionId("P12345");
+ assertFalse(ref1.updateFrom(ref2));
+ ref2.setAccessionId(ref1.getAccessionId());
+ ref1.setVersion("2");
+ assertFalse(ref1.updateFrom(ref2));
+
+ /*
+ * a non-null version supersedes "0" or "source:0"
+ */
+ ref2.setVersion(null);
+ assertFalse(ref1.updateFrom(ref2));
+ assertEquals("2", ref1.getVersion());
+ ref2.setVersion("3");
+ ref1.setVersion("0");
+ assertTrue(ref1.updateFrom(ref2));
+ assertEquals("3", ref1.getVersion());
+ ref1.setVersion("UNIPROT:0");
+ assertTrue(ref1.updateFrom(ref2));
+ assertEquals("3", ref1.getVersion());
+
+ /*
+ * version "source:n" with n>0 is not superseded
+ */
+ ref1.setVersion("UNIPROT:1");
+ assertFalse(ref1.updateFrom(ref2));
+ assertEquals("UNIPROT:1", ref1.getVersion());
+
+ /*
+ * version "10" is not superseded
+ */
+ ref1.setVersion("10");
+ assertFalse(ref1.updateFrom(ref2));
+ assertEquals("10", ref1.getVersion());
+ }
}
{
}
- @AfterMethod
+ @AfterMethod(alwaysRun = true)
public void tearDown() throws Exception
{
}
import static org.testng.internal.junit.ArrayAsserts.assertArrayEquals;
import jalview.datamodel.PDBEntry.Type;
+import jalview.util.MapList;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Vector;
+import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
sq.setStart(3);
sq.setEnd(4);
+ sq.setDescription("Test sequence description..");
+ sq.setVamsasId("TestVamsasId");
+ sq.setSourceDBRef(new DBRefEntry("PDB", "version0", "1TST"));
+
+ sq.addDBRef(new DBRefEntry("PDB", "version1", "1Tst"));
+ sq.addDBRef(new DBRefEntry("PDB", "version2", "2Tst"));
+ sq.addDBRef(new DBRefEntry("PDB", "version3", "3Tst"));
+ sq.addDBRef(new DBRefEntry("PDB", "version4", "4Tst"));
+
+ sq.addPDBId(new PDBEntry("1PDB", "A", Type.PDB, "filePath/test1"));
+ sq.addPDBId(new PDBEntry("1PDB", "B", Type.PDB, "filePath/test1"));
+ sq.addPDBId(new PDBEntry("2PDB", "A", Type.MMCIF, "filePath/test2"));
+ sq.addPDBId(new PDBEntry("2PDB", "B", Type.MMCIF, "filePath/test2"));
+
+ sq.getDatasetSequence().addDBRef(
+ new DBRefEntry("PDB", "version1", "1Tst"));
+ sq.getDatasetSequence().addDBRef(
+ new DBRefEntry("PDB", "version2", "2Tst"));
+ sq.getDatasetSequence().addDBRef(
+ new DBRefEntry("PDB", "version3", "3Tst"));
+ sq.getDatasetSequence().addDBRef(
+ new DBRefEntry("PDB", "version4", "4Tst"));
+
+ sq.getDatasetSequence().addPDBId(
+ new PDBEntry("1PDB", "A", Type.PDB, "filePath/test1"));
+ sq.getDatasetSequence().addPDBId(
+ new PDBEntry("1PDB", "B", Type.PDB, "filePath/test1"));
+ sq.getDatasetSequence().addPDBId(
+ new PDBEntry("2PDB", "A", Type.MMCIF, "filePath/test2"));
+ sq.getDatasetSequence().addPDBId(
+ new PDBEntry("2PDB", "B", Type.MMCIF, "filePath/test2"));
+
+ ArrayList<Annotation> annotsList = new ArrayList<Annotation>();
+ System.out.println(">>>>>> " + sq.getSequenceAsString().length());
+ annotsList.add(new Annotation("A", "A", 'X', 0.1f));
+ annotsList.add(new Annotation("A", "A", 'X', 0.1f));
+ Annotation[] annots = annotsList.toArray(new Annotation[0]);
+ sq.addAlignmentAnnotation(new AlignmentAnnotation("Test annot",
+ "Test annot description", annots));
+ sq.getDatasetSequence().addAlignmentAnnotation(
+ new AlignmentAnnotation("Test annot", "Test annot description",
+ annots));
+ Assert.assertEquals(sq.getDescription(), "Test sequence description..");
+ Assert.assertEquals(sq.getDBRefs().length, 4);
+ Assert.assertEquals(sq.getAllPDBEntries().size(), 4);
+ Assert.assertNotNull(sq.getAnnotation());
+ Assert.assertEquals(sq.getAnnotation()[0].annotations.length, 2);
+ Assert.assertEquals(sq.getDatasetSequence().getDBRefs().length, 4);
+ Assert.assertEquals(sq.getDatasetSequence().getAllPDBEntries().size(),
+ 4);
+ Assert.assertNotNull(sq.getDatasetSequence().getAnnotation());
+
Sequence derived = (Sequence) sq.deriveSequence();
+
+ Assert.assertEquals(derived.getDescription(),
+ "Test sequence description..");
+ Assert.assertEquals(derived.getDBRefs().length, 4);
+ Assert.assertEquals(derived.getAllPDBEntries().size(), 4);
+ Assert.assertNotNull(derived.getAnnotation());
+ Assert.assertEquals(derived.getAnnotation()[0].annotations.length, 2);
+ Assert.assertEquals(derived.getDatasetSequence().getDBRefs().length, 4);
+ Assert.assertEquals(derived.getDatasetSequence().getAllPDBEntries()
+ .size(), 4);
+ Assert.assertNotNull(derived.getDatasetSequence().getAnnotation());
+
assertEquals("CD", derived.getSequenceAsString());
assertSame(sq.getDatasetSequence(), derived.getDatasetSequence());
assertEquals(' ', sq.getCharAt(5));
assertEquals(' ', sq.getCharAt(-1));
}
+
+ /**
+ * Tests for adding (or updating) dbrefs
+ *
+ * @see DBRefEntry#updateFrom(DBRefEntry)
+ */
+ @Test(groups = { "Functional" })
+ public void testAddDBRef()
+ {
+ SequenceI sq = new Sequence("", "abcde");
+ assertNull(sq.getDBRefs());
+ DBRefEntry dbref = new DBRefEntry("Uniprot", "1", "P00340");
+ sq.addDBRef(dbref);
+ assertEquals(1, sq.getDBRefs().length);
+ assertSame(dbref, sq.getDBRefs()[0]);
+
+ /*
+ * change of version - new entry
+ */
+ DBRefEntry dbref2 = new DBRefEntry("Uniprot", "2", "P00340");
+ sq.addDBRef(dbref2);
+ assertEquals(2, sq.getDBRefs().length);
+ assertSame(dbref, sq.getDBRefs()[0]);
+ assertSame(dbref2, sq.getDBRefs()[1]);
+
+ /*
+ * matches existing entry - not added
+ */
+ sq.addDBRef(new DBRefEntry("UNIPROT", "1", "p00340"));
+ assertEquals(2, sq.getDBRefs().length);
+
+ /*
+ * different source = new entry
+ */
+ DBRefEntry dbref3 = new DBRefEntry("UniRef", "1", "p00340");
+ sq.addDBRef(dbref3);
+ assertEquals(3, sq.getDBRefs().length);
+ assertSame(dbref3, sq.getDBRefs()[2]);
+
+ /*
+ * different ref = new entry
+ */
+ DBRefEntry dbref4 = new DBRefEntry("UniRef", "1", "p00341");
+ sq.addDBRef(dbref4);
+ assertEquals(4, sq.getDBRefs().length);
+ assertSame(dbref4, sq.getDBRefs()[3]);
+
+ /*
+ * matching ref with a mapping - map updated
+ */
+ DBRefEntry dbref5 = new DBRefEntry("UniRef", "1", "p00341");
+ Mapping map = new Mapping(new MapList(new int[] { 1, 3 }, new int[] {
+ 1, 1 }, 3, 1));
+ dbref5.setMap(map);
+ sq.addDBRef(dbref5);
+ assertEquals(4, sq.getDBRefs().length);
+ assertSame(dbref4, sq.getDBRefs()[3]);
+ assertSame(map, dbref4.getMap());
+
+ /*
+ * 'real' version replaces "0" version
+ */
+ dbref2.setVersion("0");
+ DBRefEntry dbref6 = new DBRefEntry(dbref2.getSource(), "3",
+ dbref2.getAccessionId());
+ sq.addDBRef(dbref6);
+ assertEquals(4, sq.getDBRefs().length);
+ assertSame(dbref2, sq.getDBRefs()[1]);
+ assertEquals("3", dbref2.getVersion());
+
+ /*
+ * 'real' version replaces "source:0" version
+ */
+ dbref3.setVersion("Uniprot:0");
+ DBRefEntry dbref7 = new DBRefEntry(dbref3.getSource(), "3",
+ dbref3.getAccessionId());
+ sq.addDBRef(dbref7);
+ assertEquals(4, sq.getDBRefs().length);
+ assertSame(dbref3, sq.getDBRefs()[2]);
+ assertEquals("3", dbref2.getVersion());
+ }
}
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertSame;
-import jalview.util.MappingUtils;
+import jalview.analysis.SequenceIdMatcher;
+import jalview.datamodel.DBRefEntry;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceI;
+import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Vector;
+import java.util.List;
import org.testng.annotations.Test;
* Make a (CDS) Feature with 4 locations
*/
EmblFeature cds = new EmblFeature();
- Vector<EmblFeatureLocations> locs = new Vector<EmblFeatureLocations>();
- cds.setLocations(locs);
-
- /*
- * single range [10-20]
- */
- EmblFeatureLocations loc = new EmblFeatureLocations();
- loc.setLocationType("single");
- loc.setLocationComplement(false);
- Vector<EmblFeatureLocElement> elements = new Vector<EmblFeatureLocElement>();
- EmblFeatureLocElement locElement = new EmblFeatureLocElement();
- BasePosition b1 = new BasePosition();
- b1.setPos("10");
- BasePosition b2 = new BasePosition();
- b2.setPos("20");
- locElement.setBasePositions(new BasePosition[] { b1, b2 });
- elements.add(locElement);
- loc.setLocElements(elements);
- locs.add(loc);
-
- /*
- * complement range [30-40]
- */
- loc = new EmblFeatureLocations();
- loc.setLocationType("single");
- loc.setLocationComplement(true);
- elements = new Vector<EmblFeatureLocElement>();
- locElement = new EmblFeatureLocElement();
- b1 = new BasePosition();
- b1.setPos("30");
- b2 = new BasePosition();
- b2.setPos("40");
- locElement.setBasePositions(new BasePosition[] { b1, b2 });
- elements.add(locElement);
- loc.setLocElements(elements);
- locs.add(loc);
-
- /*
- * join range [50-60], [70-80]
- */
- loc = new EmblFeatureLocations();
- loc.setLocationType("join");
- loc.setLocationComplement(false);
- elements = new Vector<EmblFeatureLocElement>();
- locElement = new EmblFeatureLocElement();
- b1 = new BasePosition();
- b1.setPos("50");
- b2 = new BasePosition();
- b2.setPos("60");
- locElement.setBasePositions(new BasePosition[] { b1, b2 });
- elements.add(locElement);
- locElement = new EmblFeatureLocElement();
- b1 = new BasePosition();
- b1.setPos("70");
- b2 = new BasePosition();
- b2.setPos("80");
- locElement.setBasePositions(new BasePosition[] { b1, b2 });
- elements.add(locElement);
- loc.setLocElements(elements);
- locs.add(loc);
-
- /*
- * complement range [90-100], [110-120]
- * this should be the same as complement(join(90..100,110.120))
- * which is "join 90-100 and 110-120, then complement"
- */
- loc = new EmblFeatureLocations();
- loc.setLocationType("join");
- loc.setLocationComplement(true);
- elements = new Vector<EmblFeatureLocElement>();
- locElement = new EmblFeatureLocElement();
- b1 = new BasePosition();
- b1.setPos("90");
- b2 = new BasePosition();
- b2.setPos("100");
- locElement.setBasePositions(new BasePosition[] { b1, b2 });
- elements.add(locElement);
- locElement = new EmblFeatureLocElement();
- b1 = new BasePosition();
- b1.setPos("110");
- b2 = new BasePosition();
- b2.setPos("120");
- locElement.setBasePositions(new BasePosition[] { b1, b2 });
- elements.add(locElement);
- loc.setLocElements(elements);
- locs.add(loc);
+ cds.setLocation("join(10..20,complement(30..40),50..60,70..80,complement(110..120))");
int[] exons = testee.getCdsRanges(cds);
- assertEquals("[10, 20, 40, 30, 50, 60, 70, 80, 120, 110, 100, 90]",
+ assertEquals("[10, 20, 40, 30, 50, 60, 70, 80, 120, 110]",
Arrays.toString(exons));
}
@Test(groups = "Functional")
- public void testGetCdsRanges_badData()
+ public void testParseCodingFeature()
{
- EmblEntry testee = new EmblEntry();
+ // not the whole sequence but enough for this test...
+ SequenceI dna = new Sequence("J03321", "GGATCCGTAAGTTAGACGAAATT");
+ List<SequenceI> peptides = new ArrayList<SequenceI>();
+ SequenceIdMatcher matcher = new SequenceIdMatcher(peptides);
+ EmblFile ef = EmblTestHelper.getEmblFile();
/*
- * Make a (CDS) Feature with 4 locations
- */
- EmblFeature cds = new EmblFeature();
- Vector<EmblFeatureLocations> locs = new Vector<EmblFeatureLocations>();
- cds.setLocations(locs);
-
- /*
- * single range [10-20]
- */
- EmblFeatureLocations loc = new EmblFeatureLocations();
- loc.setLocationType("single");
- loc.setLocationComplement(false);
- Vector<EmblFeatureLocElement> elements = new Vector<EmblFeatureLocElement>();
- EmblFeatureLocElement locElement = new EmblFeatureLocElement();
- BasePosition b1 = new BasePosition();
- b1.setPos("10");
- BasePosition b2 = new BasePosition();
- b2.setPos("20");
- locElement.setBasePositions(new BasePosition[] { b1, b2 });
- elements.add(locElement);
- loc.setLocElements(elements);
- locs.add(loc);
-
- /*
- * single range with missing end position - should be skipped
- */
- loc = new EmblFeatureLocations();
- loc.setLocationType("single");
- loc.setLocationComplement(false);
- elements = new Vector<EmblFeatureLocElement>();
- locElement = new EmblFeatureLocElement();
- b1 = new BasePosition();
- b1.setPos("30");
- locElement.setBasePositions(new BasePosition[] { b1 });
- elements.add(locElement);
- loc.setLocElements(elements);
- locs.add(loc);
-
- /*
- * single range with extra base position - should be skipped
+ * parse two CDS features, one with two Uniprot cross-refs,
+ * the other with one
*/
- loc = new EmblFeatureLocations();
- loc.setLocationType("single");
- loc.setLocationComplement(false);
- elements = new Vector<EmblFeatureLocElement>();
- locElement = new EmblFeatureLocElement();
- b1 = new BasePosition();
- b1.setPos("30");
- locElement.setBasePositions(new BasePosition[] { b1, b1, b1 });
- elements.add(locElement);
- loc.setLocElements(elements);
- locs.add(loc);
-
- /*
- * single valid range [50-60] to finish
- */
- loc = new EmblFeatureLocations();
- loc.setLocationType("single");
- loc.setLocationComplement(false);
- elements = new Vector<EmblFeatureLocElement>();
- locElement = new EmblFeatureLocElement();
- b1 = new BasePosition();
- b1.setPos("50");
- b2 = new BasePosition();
- b2.setPos("60");
- locElement.setBasePositions(new BasePosition[] { b1, b2 });
- elements.add(locElement);
- loc.setLocElements(elements);
- locs.add(loc);
-
- int[] exons = testee.getCdsRanges(cds);
- assertEquals("[10, 20, 50, 60]", Arrays.toString(exons));
- }
-
- /**
- * Test retrieval of exon locations matching an accession id
- */
- @Test(groups = "Functional")
- public void testGetCdsRanges_forAccession()
- {
EmblEntry testee = new EmblEntry();
- String accession = "A1234";
- testee.setAccession(accession);
- /*
- * Make a (CDS) Feature with 4 locations
- */
- EmblFeature cds = new EmblFeature();
- Vector<EmblFeatureLocations> locs = new Vector<EmblFeatureLocations>();
- cds.setLocations(locs);
-
- /*
- * single range [10-20] for 'this' accession
- */
- EmblFeatureLocations loc = new EmblFeatureLocations();
- loc.setLocationType("single");
- loc.setLocationComplement(false);
- Vector<EmblFeatureLocElement> elements = new Vector<EmblFeatureLocElement>();
- EmblFeatureLocElement locElement = new EmblFeatureLocElement();
- locElement.setAccession(accession);
- BasePosition b1 = new BasePosition();
- b1.setPos("10");
- BasePosition b2 = new BasePosition();
- b2.setPos("20");
- locElement.setBasePositions(new BasePosition[] { b1, b2 });
- elements.add(locElement);
- loc.setLocElements(elements);
- locs.add(loc);
-
- /*
- * complement range [30-40] - no accession
- */
- loc = new EmblFeatureLocations();
- loc.setLocationType("single");
- loc.setLocationComplement(true);
- elements = new Vector<EmblFeatureLocElement>();
- locElement = new EmblFeatureLocElement();
- b1 = new BasePosition();
- b1.setPos("30");
- b2 = new BasePosition();
- b2.setPos("40");
- locElement.setBasePositions(new BasePosition[] { b1, b2 });
- elements.add(locElement);
- loc.setLocElements(elements);
- locs.add(loc);
-
- /*
- * join range [50-60] this accession, [70-80] another
- */
- loc = new EmblFeatureLocations();
- loc.setLocationType("join");
- loc.setLocationComplement(false);
- elements = new Vector<EmblFeatureLocElement>();
- locElement = new EmblFeatureLocElement();
- locElement.setAccession(accession);
- b1 = new BasePosition();
- b1.setPos("50");
- b2 = new BasePosition();
- b2.setPos("60");
- locElement.setBasePositions(new BasePosition[] { b1, b2 });
- elements.add(locElement);
- locElement = new EmblFeatureLocElement();
- locElement.setAccession("notme");
- b1 = new BasePosition();
- b1.setPos("70");
- b2 = new BasePosition();
- b2.setPos("80");
- locElement.setBasePositions(new BasePosition[] { b1, b2 });
- elements.add(locElement);
- loc.setLocElements(elements);
- locs.add(loc);
-
- /*
- * complement range [90-100] wrong accession, [110-120] good
- * this should be the same as complement(join(90..100,110.120))
- * which is "join 90-100 and 110-120, then complement"
- */
- loc = new EmblFeatureLocations();
- loc.setLocationType("join");
- loc.setLocationComplement(true);
- elements = new Vector<EmblFeatureLocElement>();
- locElement = new EmblFeatureLocElement();
- locElement.setAccession("wrong");
- b1 = new BasePosition();
- b1.setPos("90");
- b2 = new BasePosition();
- b2.setPos("100");
- locElement.setBasePositions(new BasePosition[] { b1, b2 });
- elements.add(locElement);
- locElement = new EmblFeatureLocElement();
- locElement.setAccession(accession);
- b1 = new BasePosition();
- b1.setPos("110");
- b2 = new BasePosition();
- b2.setPos("120");
- locElement.setBasePositions(new BasePosition[] { b1, b2 });
- elements.add(locElement);
- loc.setLocElements(elements);
- locs.add(loc);
-
- /*
- * verify we pick out only ranges for A1234
- */
- int[] exons = testee.getCdsRanges(cds);
- assertEquals("[10, 20, 50, 60, 120, 110]",
- Arrays.toString(exons));
+ for (EmblFeature feature : ef.getEntries().get(0).getFeatures())
+ {
+ if ("CDS".equals(feature.getName()))
+ {
+ testee.parseCodingFeature(feature, "EMBL", dna, peptides, matcher);
+ }
+ }
+
+ /*
+ * peptides should now have five entries:
+ * EMBL product and two Uniprot accessions for the first CDS / translation
+ * EMBL product and one Uniprot accession for the second CDS / translation
+ */
+ assertEquals(5, peptides.size());
+ assertEquals("CAA30420.1", peptides.get(0).getName());
+ assertEquals("MLCF", peptides.get(0).getSequenceAsString());
+ assertEquals("UNIPROT|B0BCM4", peptides.get(1).getName());
+ assertEquals("MLCF", peptides.get(1).getSequenceAsString());
+ assertEquals("UNIPROT|P0CE20", peptides.get(2).getName());
+ assertEquals("MLCF", peptides.get(2).getSequenceAsString());
+ assertEquals("CAA30421.1", peptides.get(3).getName());
+ assertEquals("MSSS", peptides.get(3).getSequenceAsString());
+ assertEquals("UNIPROT|B0BCM3", peptides.get(4).getName());
+ assertEquals("MSSS", peptides.get(4).getSequenceAsString());
+
+ /*
+ * verify dna sequence has dbrefs with mappings to the peptide 'products'
+ */
+ DBRefEntry[] dbrefs = dna.getDBRefs();
+ assertEquals(3, dbrefs.length);
+ DBRefEntry dbRefEntry = dbrefs[0];
+ assertEquals("UNIPROT", dbRefEntry.getSource());
+ assertEquals("B0BCM4", dbRefEntry.getAccessionId());
+ assertSame(peptides.get(1), dbRefEntry.getMap().getTo());
+ List<int[]> fromRanges = dbRefEntry.getMap().getMap().getFromRanges();
+ assertEquals(1, fromRanges.size());
+ assertEquals(57, fromRanges.get(0)[0]);
+ assertEquals(46, fromRanges.get(0)[1]);
+ List<int[]> toRanges = dbRefEntry.getMap().getMap().getToRanges();
+ assertEquals(1, toRanges.size());
+ assertEquals(1, toRanges.get(0)[0]);
+ assertEquals(4, toRanges.get(0)[1]);
+
+ dbRefEntry = dbrefs[1];
+ assertEquals("UNIPROT", dbRefEntry.getSource());
+ assertEquals("P0CE20", dbRefEntry.getAccessionId());
+ assertSame(peptides.get(2), dbRefEntry.getMap().getTo());
+ fromRanges = dbRefEntry.getMap().getMap().getFromRanges();
+ assertEquals(1, fromRanges.size());
+ assertEquals(57, fromRanges.get(0)[0]);
+ assertEquals(46, fromRanges.get(0)[1]);
+ toRanges = dbRefEntry.getMap().getMap().getToRanges();
+ assertEquals(1, toRanges.size());
+ assertEquals(1, toRanges.get(0)[0]);
+ assertEquals(4, toRanges.get(0)[1]);
+
+ dbRefEntry = dbrefs[2];
+ assertEquals("UNIPROT", dbRefEntry.getSource());
+ assertEquals("B0BCM3", dbRefEntry.getAccessionId());
+ assertSame(peptides.get(4), dbRefEntry.getMap().getTo());
+ fromRanges = dbRefEntry.getMap().getMap().getFromRanges();
+ assertEquals(1, fromRanges.size());
+ assertEquals(4, fromRanges.get(0)[0]);
+ assertEquals(15, fromRanges.get(0)[1]);
+ toRanges = dbRefEntry.getMap().getMap().getToRanges();
+ assertEquals(1, toRanges.size());
+ assertEquals(1, toRanges.get(0)[0]);
+ assertEquals(4, toRanges.get(0)[1]);
}
}
package jalview.datamodel.xdb.embl;
import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.assertTrue;
import jalview.datamodel.DBRefEntry;
-import java.io.StringReader;
import java.util.Vector;
import org.testng.annotations.Test;
public class EmblFileTest
{
- // adapted from http://www.ebi.ac.uk/Tools/dbfetch/dbfetch/embl/x53828/emblxml
- private static final String TESTDATA = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"
- + "<EMBL_Services>"
- + "<entry accession=\"X53828\" version=\"3\" lastUpdated=\"2005-04-18\" releaseCreated=\"25\" releaseLastUpdated=\"83\">"
- + "<description>Chicken LDH-A mRNA for lactate dehydrogenase A chain (EC 1.1.1.27)</description>"
- + "<keyword>L-lactate dehydrogenase</keyword><keyword>chutney</keyword>"
- + "<dbreference db=\"EuropePMC\" primary=\"PMC1460223\" secondary=\"9649548\" />"
- + "<dbreference db=\"MD5\" primary=\"d3b68\" />"
- + "<feature name=\"CDS\"><dbreference db=\"GOA\" primary=\"P00340\" secondary=\"2.1\" /><dbreference db=\"InterPro\" primary=\"IPR001236\" />"
- + "<qualifier name=\"note\"><value>L-lactate dehydrogenase A-chain</value><value>pickle</value></qualifier>"
- + "<qualifier name=\"translation\"><value>MSLKDHLIHN</value><evidence>Keith</evidence></qualifier>"
- + "<location type=\"single\" complement=\"true\">"
- + "<locationElement type=\"range\" accession=\"X53828\" version=\"1\" complement=\"false\">"
- + "<basePosition type=\"simple\">60</basePosition><basePosition type=\"join\">1058</basePosition>"
- + "</locationElement></location></feature>"
- + "<sequence type=\"mRNA\" version=\"2\">GTGACG</sequence></entry></EMBL_Services>";
@Test(groups = { "Functional" })
public void testGetEmblFile()
{
- Vector<EmblEntry> entries = EmblFile.getEmblFile(
- new StringReader(TESTDATA)).getEntries();
+ Vector<EmblEntry> entries = EmblTestHelper.getEmblFile().getEntries();
assertEquals(1, entries.size());
EmblEntry entry = entries.get(0);
- assertEquals("X53828", entry.getAccession());
- assertEquals(
- "Chicken LDH-A mRNA for lactate dehydrogenase A chain (EC 1.1.1.27)",
- entry.getDesc());
- assertEquals("2005-04-18", entry.getLastUpdated());
+ assertEquals("X07547", entry.getAccession());
+ assertEquals("C. trachomatis plasmid", entry.getDescription());
+ assertEquals("STD", entry.getDataClass());
+ assertEquals("PRO", entry.getTaxonomicDivision());
+ assertEquals("1999-02-10", entry.getLastUpdatedDate());
+ assertEquals("58", entry.getLastUpdatedRelease());
+ assertEquals("1988-11-10", entry.getFirstPublicDate());
+ assertEquals("18", entry.getFirstPublicRelease());
+ assertEquals("genomic DNA", entry.getMoleculeType());
+ assertEquals("1", entry.getSequenceVersion());
+ assertEquals("8", entry.getEntryVersion());
+ assertEquals("linear", entry.getTopology());
+ assertEquals("7499", entry.getSequenceLength());
/*
* FIXME these assertions fail - values are null - why?? Adding or removing
* attributes in the test XML modifies behaviour. eg. inserting an attribute
* _before_ lastUpdated results in a null value in this field.
*/
- // assertEquals("25", entry.getRCreated());
- // assertEquals("83", entry.getRLastUpdated());
+ assertEquals("1988-11-10", entry.getFirstPublicDate());
+ assertEquals("18", entry.getFirstPublicRelease());
assertEquals(2, entry.getKeywords().size());
- assertEquals("L-lactate dehydrogenase", entry.getKeywords().get(0));
- assertEquals("chutney", entry.getKeywords().get(1));
+ assertEquals("plasmid", entry.getKeywords().get(0));
+ assertEquals("unidentified reading frame", entry.getKeywords().get(1));
/*
* dbrefs
assertEquals(2, entry.getDbRefs().size());
DBRefEntry dbref = entry.getDbRefs().get(0);
assertEquals("EuropePMC", dbref.getSource());
- assertEquals("PMC1460223", dbref.getAccessionId());
- assertEquals("9649548", dbref.getVersion());
+ assertEquals("PMC107176", dbref.getAccessionId());
+ assertEquals("9573186", dbref.getVersion());
dbref = entry.getDbRefs().get(1);
assertEquals("MD5", dbref.getSource());
- assertEquals("d3b68", dbref.getAccessionId());
+ assertEquals("ac73317", dbref.getAccessionId());
// blank version has been converted to "0"
assertEquals("0", dbref.getVersion());
/*
- * sequence features
+ * two sequence features for CDS
+ */
+ assertEquals(2, entry.getFeatures().size());
+ /*
+ * first CDS
*/
- assertEquals(1, entry.getFeatures().size());
EmblFeature ef = entry.getFeatures().get(0);
assertEquals("CDS", ef.getName());
+ assertEquals("complement(46..57)", ef.getLocation());
assertEquals(2, ef.getDbRefs().size());
dbref = ef.getDbRefs().get(0);
- assertEquals("GOA", dbref.getSource());
- assertEquals("P00340", dbref.getAccessionId());
+ assertEquals("UniProtKB/Swiss-Prot", dbref.getSource());
+ assertEquals("B0BCM4", dbref.getAccessionId());
assertEquals("2.1", dbref.getVersion());
dbref = ef.getDbRefs().get(1);
- assertEquals("InterPro", dbref.getSource());
- assertEquals("IPR001236", dbref.getAccessionId());
- // blank version converted to "0":
+ assertEquals("UniProtKB/Swiss-Prot", dbref.getSource());
+ assertEquals("P0CE20", dbref.getAccessionId());
+ // blank version gets converted to "0":
assertEquals("0", dbref.getVersion());
- assertEquals(2, ef.getQualifiers().size());
-
- // feature qualifiers
+ // CDS feature qualifiers
+ assertEquals(3, ef.getQualifiers().size());
Qualifier q = ef.getQualifiers().get(0);
assertEquals("note", q.getName());
assertEquals(2, q.getValues().length);
- assertEquals("L-lactate dehydrogenase A-chain", q.getValues()[0]);
+ assertEquals("ORF 8 (AA 1-330)", q.getValues()[0]);
assertEquals("pickle", q.getValues()[1]);
assertNull(q.getEvidence());
q = ef.getQualifiers().get(1);
+ assertEquals("protein_id", q.getName());
+ assertEquals(1, q.getValues().length);
+ assertEquals("CAA30420.1", q.getValues()[0]);
+ q = ef.getQualifiers().get(2);
assertEquals("translation", q.getName());
assertEquals(1, q.getValues().length);
- assertEquals("MSLKDHLIHN", q.getValues()[0]);
+ assertEquals("MLCF", q.getValues()[0]);
assertEquals(1, q.getEvidence().length);
assertEquals("Keith", q.getEvidence()[0]);
- // feature locations
- assertEquals(1, ef.getLocations().size());
- EmblFeatureLocations fl = ef.getLocations().get(0);
- assertEquals("single", fl.getLocationType());
- assertTrue(fl.isLocationComplement());
- assertEquals(1, fl.getLocElements().size());
- EmblFeatureLocElement le = fl.getLocElements().get(0);
- assertEquals("range", le.getType());
- assertEquals("X53828", le.getAccession());
- assertEquals("1", le.getVersion());
- assertFalse(le.isComplement());
- assertEquals(2, le.getBasePositions().length);
- BasePosition bp = le.getBasePositions()[0];
- assertEquals("simple", bp.getType());
- assertEquals("60", bp.getPos());
- bp = le.getBasePositions()[1];
- assertEquals("join", bp.getType());
- assertEquals("1058", bp.getPos());
+ /*
+ * second CDS
+ */
+ ef = entry.getFeatures().get(1);
+ assertEquals("CDS", ef.getName());
+ assertEquals("4..15", ef.getLocation());
+ assertEquals(1, ef.getDbRefs().size());
+ dbref = ef.getDbRefs().get(0);
+ assertEquals("UniProtKB/Swiss-Prot", dbref.getSource());
+ assertEquals("B0BCM3", dbref.getAccessionId());
+ assertEquals("0", dbref.getVersion());
+ assertEquals(2, ef.getQualifiers().size());
+ q = ef.getQualifiers().get(0);
+ assertEquals("protein_id", q.getName());
+ assertEquals(1, q.getValues().length);
+ assertEquals("CAA30421.1", q.getValues()[0]);
+ q = ef.getQualifiers().get(1);
+ assertEquals("translation", q.getName());
+ assertEquals(1, q.getValues().length);
+ assertEquals("MSSS", q.getValues()[0]);
/*
- * Sequence
+ * Sequence - verify newline not converted to space (JAL-2029)
*/
EmblSequence seq = entry.getSequence();
- assertEquals("mRNA", seq.getType());
- assertEquals("2", seq.getVersion());
- assertEquals("GTGACG", seq.getSequence());
+ assertEquals(
+ "GGTATGTCCTCTAGTACAAACACCCCCAATATTGTGATATAATTAAAAACATAGCAT",
+ seq.getSequence());
/*
* getSequence() converts empty DBRefEntry.version to "0"
--- /dev/null
+package jalview.datamodel.xdb.embl;
+
+import java.io.StringReader;
+
+public class EmblTestHelper
+{
+ // adapted from http://www.ebi.ac.uk/ena/data/view/X07547&display=xml
+ // dna and translations truncated for convenience
+ private static final String TESTDATA = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"
+ + "<ROOT>"
+ + "<entry accession=\"X07547\" version=\"1\" entryVersion=\"8\""
+ + " dataClass=\"STD\" taxonomicDivision=\"PRO\""
+ + " moleculeType=\"genomic DNA\" sequenceLength=\"7499\" topology=\"linear\""
+ + " firstPublic=\"1988-11-10\" firstPublicRelease=\"18\""
+ + " lastUpdated=\"1999-02-10\" lastUpdatedRelease=\"58\">"
+ + "<secondaryAccession>X07574</secondaryAccession>"
+ + "<description>C. trachomatis plasmid</description>"
+ + "<keyword>plasmid</keyword><keyword>unidentified reading frame</keyword>"
+ + "<xref db=\"EuropePMC\" id=\"PMC107176\" secondaryId=\"9573186\" />"
+ + "<xref db=\"MD5\" id=\"ac73317\" />"
+ /*
+ * first CDS (range and translation changed to keep test data manageable)
+ */
+ + "<feature name=\"CDS\" location=\"complement(46..57)\">"
+ // test the case of >1 cross-ref to the same database (JAL-2029)
+ + "<xref db=\"UniProtKB/Swiss-Prot\" id=\"B0BCM4\" secondaryId=\"2.1\" />"
+ + "<xref db=\"UniProtKB/Swiss-Prot\" id=\"P0CE20\" />"
+ + "<qualifier name=\"note\"><value>ORF 8 (AA 1-330)</value><value>pickle</value></qualifier>"
+ + "<qualifier name=\"protein_id\"><value>CAA30420.1</value></qualifier>"
+ + "<qualifier name=\"translation\"><value>MLCF</value><evidence>Keith</evidence></qualifier>"
+ + "</feature>"
+ /*
+ * second CDS (range and translation changed to keep test data manageable)
+ */
+ + "<feature name=\"CDS\" location=\"4..15\">"
+ + "<xref db=\"UniProtKB/Swiss-Prot\" id=\"B0BCM3\" />"
+ + "<qualifier name=\"protein_id\"><value>CAA30421.1</value></qualifier>"
+ + "<qualifier name=\"translation\"><value>MSSS</value></qualifier>"
+ + "</feature>"
+ /*
+ * sequence (modified for test purposes)
+ * emulates EMBL XML 1.2 which splits sequence data every 60 characters
+ * see EmblSequence.setSequence
+ */
+ + "<sequence>GGTATGTCCTCTAGTACAAAC\n"
+ + "ACCCCCAATATTGTGATATAATTAAAAACATAGCAT"
+ + "</sequence></entry></ROOT>";
+
+ static EmblFile getEmblFile()
+ {
+ return EmblFile.getEmblFile(new StringReader(TESTDATA));
+ }
+}
public class EnsemblCdnaTest
{
- @BeforeClass
+ @BeforeClass(alwaysRun = true)
public void setUp()
{
SequenceOntologyFactory.setInstance(new SequenceOntologyLite());
}
- @AfterClass
+ @AfterClass(alwaysRun = true)
public void tearDown()
{
SequenceOntologyFactory.setInstance(null);
public class EnsemblCdsTest
{
- @BeforeClass
+ @BeforeClass(alwaysRun = true)
public void setUp()
{
SequenceOntologyFactory.setInstance(new SequenceOntologyLite());
}
- @AfterClass
+ @AfterClass(alwaysRun = true)
public void tearDown()
{
SequenceOntologyFactory.setInstance(null);
public class EnsemblGeneTest
{
- @BeforeClass
+ @BeforeClass(alwaysRun = true)
public void setUp()
{
SequenceOntologyFactory.setInstance(new SequenceOntologyLite());
}
- @AfterClass
+ @AfterClass(alwaysRun = true)
public void tearDown()
{
SequenceOntologyFactory.setInstance(null);
public class EnsemblGenomeTest
{
- @BeforeClass
+ @BeforeClass(alwaysRun = true)
public void setUp()
{
SequenceOntologyFactory.setInstance(new SequenceOntologyLite());
}
- @AfterClass
+ @AfterClass(alwaysRun = true)
public void tearDown()
{
SequenceOntologyFactory.setInstance(null);
{
@Test(suiteName = "live")
- public void testLiveCheckEnsembl()
+ public void testIsEnsemblAvailable()
{
EnsemblRestClient sf = new EnsemblRestClient()
{
import static org.testng.internal.junit.ArrayAsserts.assertArrayEquals;
import jalview.datamodel.Alignment;
-import jalview.datamodel.AlignmentI;
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceI;
import jalview.io.AppletFormatAdapter;
import jalview.io.gff.SequenceOntologyLite;
import java.lang.reflect.Method;
-import java.net.MalformedURLException;
-import java.net.URL;
import java.util.Arrays;
-import java.util.List;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
+ "NRDQIIFMVGRGYLSPDLSKVRSNCPKAMKRLMAECLKKKRDERPLFPQILASIELLARS\n"
+ "LPKIHRSASEPSLNRAGFQTEDFSLYACASPKTPIQAGGYGAFPVH" } };
- @BeforeClass
+ @BeforeClass(alwaysRun = true)
public void setUp()
{
SequenceOntologyFactory.setInstance(new SequenceOntologyLite());
}
- @AfterClass
+ @AfterClass(alwaysRun = true)
public void tearDown()
{
SequenceOntologyFactory.setInstance(null);
}
}
- @Test(suiteName = "live")
- public void testLiveCheckEnsembl()
- {
- EnsemblRestClient sf = new EnsemblRestClient()
- {
-
- @Override
- public String getDbName()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public AlignmentI getSequenceRecords(String queries) throws Exception
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- protected URL getUrl(List<String> ids) throws MalformedURLException
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- protected boolean useGetRequest()
- {
- // TODO Auto-generated method stub
- return false;
- }
-
- @Override
- protected String getRequestMimeType(boolean b)
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- protected String getResponseMimeType()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- };
- boolean isAvailable = sf.isEnsemblAvailable();
- System.out.println("Ensembl is "
- + (isAvailable ? "UP!"
- : "DOWN or unreachable ******************* BAD!"));
- }
-
@Test(groups = "Functional")
public void getGenomicRangesFromFeatures()
{
/**
* @throws java.lang.Exception
*/
- @AfterClass
+ @AfterClass(alwaysRun = true)
public static void tearDownAfterClass() throws Exception
{
jalview.gui.Desktop.instance.closeAll_actionPerformed(null);
public class TestAnnotate3D
{
- @Test(groups = { "Functional" }, enabled = false)
+ @Test(groups = { "Network" }, enabled = true)
public void test1GIDbyId() throws Exception
{
// use same ID as standard tests given at
testRNAMLcontent(ids, null);
}
- @Test(groups = { "Functional" }, enabled = false)
+ @Test(groups = { "Network" }, enabled = true)
public void testIdVsContent2GIS() throws Exception
{
Iterator<Reader> ids = Annotate3D.getRNAMLForPDBId("2GIS");
*
* @throws Exception
*/
- @Test(groups = { "Functional" }, enabled = false)
+ @Test(groups = { "Network" }, enabled = true)
public void testPDBfileVsRNAML() throws Exception
{
PDBfile pdbf = new PDBfile(true, false, true, "examples/2GIS.pdb",
testRNAMLcontent(readers, pdbf);
}
- @Test(groups = { "Functional" }, enabled = false)
private void testRNAMLcontent(Iterator<Reader> readers, PDBfile pdbf)
throws Exception
{
/**
* @throws java.lang.Exception
*/
- @AfterClass
+ @AfterClass(alwaysRun = true)
public static void tearDownAfterClass() throws Exception
{
jalview.gui.Desktop.instance.closeAll_actionPerformed(null);
import static org.testng.AssertJUnit.assertFalse;
import static org.testng.AssertJUnit.assertTrue;
-import jalview.ext.so.SequenceOntology;
import jalview.io.gff.SequenceOntologyFactory;
import jalview.io.gff.SequenceOntologyI;
{
private SequenceOntologyI so;
- @BeforeClass
+ @BeforeClass(alwaysRun = true)
public void setUp() {
long now = System.currentTimeMillis();
SequenceOntologyFactory.setInstance(new SequenceOntology());
so = SequenceOntologyFactory.getInstance();
}
- @AfterClass
+ @AfterClass(alwaysRun = true)
public void tearDown()
{
SequenceOntologyFactory.setInstance(null);
public void getPrimaryKeyColumIndexTest()
{
Collection<FTSDataColumnI> wantedFields = ftsRestClient
- .getAllDefaulDisplayedDataColumns();
+ .getAllDefaultDisplayedFTSDataColumns();
int foundIndex = -1;
try
{
@Test(groups = { "Functional" })
public void getAllDefaulDisplayedDataColumns()
{
- Assert.assertNotNull(ftsRestClient.getAllDefaulDisplayedDataColumns());
- Assert.assertTrue(!ftsRestClient.getAllDefaulDisplayedDataColumns()
+ Assert.assertNotNull(ftsRestClient.getAllDefaultDisplayedFTSDataColumns());
+ Assert.assertTrue(!ftsRestClient.getAllDefaultDisplayedFTSDataColumns()
.isEmpty());
- Assert.assertEquals(ftsRestClient.getAllDefaulDisplayedDataColumns()
+ Assert.assertEquals(ftsRestClient.getAllDefaultDisplayedFTSDataColumns()
.size(), 7);
}
public void getDataColumnsFieldsAsCommaDelimitedString()
{
Collection<FTSDataColumnI> wantedFields = ftsRestClient
- .getAllDefaulDisplayedDataColumns();
+ .getAllDefaultDisplayedFTSDataColumns();
String actual = ftsRestClient
.getDataColumnsFieldsAsCommaDelimitedString(wantedFields);
Assert.assertEquals(actual,
- "id,entry name,protein names,genes,organism,length,reviewed");
+ "id,entry name,protein names,genes,organism,reviewed,length");
}
Collection<FTSDataColumnI> searchalbeFields = ftsRestClient
.getSearchableDataColumns();
Assert.assertNotNull(searchalbeFields);
- Assert.assertEquals(searchalbeFields.size(), 30);
+ Assert.assertEquals(searchalbeFields.size(), 22);
}
@Test(groups = { "Functional" })
public void getDefaultResponsePageSize()
{
int defaultResSize = ftsRestClient.getDefaultResponsePageSize();
- Assert.assertEquals(defaultResSize, 100);
+ Assert.assertEquals(defaultResSize, 500);
}
@Test(groups = { "Functional" })
FTSDataColumnI foundDataCol = ftsRestClient
.getDataColumnByNameOrCode("Protein names");
Assert.assertNotNull(foundDataCol);
- Assert.assertEquals(foundDataCol.getDataColumnClass(), String.class);
+ Assert.assertEquals(foundDataCol.getDataType().getDataTypeClass(),
+ String.class);
foundDataCol = ftsRestClient.getDataColumnByNameOrCode("length");
Assert.assertNotNull(foundDataCol);
- Assert.assertEquals(foundDataCol.getDataColumnClass(), Integer.class);
+ Assert.assertEquals(foundDataCol.getDataType().getDataTypeClass(),
+ Integer.class);
// foundDataCol = ftsRestClient.getDataColumnByNameOrCode("length");
// Assert.assertNotNull(foundDataCol);
// Assert.assertEquals(foundDataCol.getDataColumnClass(), Double.class);
.getSearchableDataColumns();
for (FTSDataColumnI foundCol : searchableCols)
{
+ System.out.println(foundCol.toString());
uniqueSet.add(foundCol);
uniqueSet.add(foundCol);
}
Assert.assertTrue(!uniqueSet.isEmpty());
- Assert.assertEquals(uniqueSet.size(), 30);
+ Assert.assertEquals(uniqueSet.size(), 22);
}
@Test(groups = { "Functional" })
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertTrue;
-import jalview.fts.service.pdb.PDBFTSPanel;
-
import javax.swing.JInternalFrame;
import javax.swing.JTextField;
{
}
- @AfterMethod
+ @AfterMethod(alwaysRun = true)
public void tearDown() throws Exception
{
}
{
}
- @AfterMethod
+ @AfterMethod(alwaysRun = true)
public void tearDown() throws Exception
{
}
{
}
- @AfterClass
+ @AfterClass(alwaysRun = true)
public static void tearDownAfterClass() throws Exception
{
}
PaintRefresher.components.clear();
}
- @AfterMethod
+ @AfterMethod(alwaysRun = true)
public void tearDown()
{
PaintRefresher.components.clear();
seq.setPDBId(pdbIds);
}
- @AfterMethod
+ @AfterMethod(alwaysRun = true)
public void tearDown() throws Exception
{
seq = null;
assertTrue(sc.getDiscoveredStructuresSet().size() > 0);
}
+
+ @Test(groups = { "Functional" })
+ public void sanitizeSeqNameTest()
+ {
+ String name = "ab_cdEF|fwxyz012349";
+ assertEquals(name, StructureChooser.sanitizeSeqName(name));
+
+ // remove a [nn] substring
+ name = "abcde12[345]fg";
+ assertEquals("abcde12fg", StructureChooser.sanitizeSeqName(name));
+
+ // remove characters other than a-zA-Z0-9 | or _
+ name = "ab[cd],.\t£$*!- \\\"@:e";
+ assertEquals("abcde", StructureChooser.sanitizeSeqName(name));
+
+ name = "abcde12[345a]fg";
+ assertEquals("abcde12345afg", StructureChooser.sanitizeSeqName(name));
+ }
}
/**
* @throws java.lang.Exception
*/
- @AfterClass
+ @AfterClass(alwaysRun = true)
public static void tearDownAfterClass() throws Exception
{
jalview.gui.Desktop.instance.closeAll_actionPerformed(null);
*/
SequenceFeature[] sfs = al.getSequenceAt(0).getDatasetSequence()
.getSequenceFeatures(); // FER_CAPAA
- assertEquals(7, sfs.length);
+ assertEquals(8, sfs.length);
SequenceFeature sf = sfs[0];
+ assertEquals("Pfam family%LINK%", sf.description);
+ assertEquals(0, sf.begin);
+ assertEquals(0, sf.end);
+ assertEquals("uniprot", sf.featureGroup);
+ assertEquals("Pfam", sf.type);
+ assertEquals(1, sf.links.size());
+ assertEquals("Pfam family|http://pfam.xfam.org/family/PF00111",
+ sf.links.get(0));
+
+ sf = sfs[1];
assertEquals("Iron-sulfur (2Fe-2S)", sf.description);
assertEquals(39, sf.begin);
assertEquals(39, sf.end);
assertEquals("uniprot", sf.featureGroup);
assertEquals("METAL", sf.type);
- sf = sfs[1];
+ sf = sfs[2];
assertEquals("Iron-sulfur (2Fe-2S)", sf.description);
assertEquals(44, sf.begin);
assertEquals(44, sf.end);
assertEquals("uniprot", sf.featureGroup);
assertEquals("METAL", sf.type);
- sf = sfs[2];
+ sf = sfs[3];
assertEquals("Iron-sulfur (2Fe-2S)", sf.description);
assertEquals(47, sf.begin);
assertEquals(47, sf.end);
assertEquals("uniprot", sf.featureGroup);
assertEquals("METAL", sf.type);
- sf = sfs[3];
+ sf = sfs[4];
assertEquals("Iron-sulfur (2Fe-2S)", sf.description);
assertEquals(77, sf.begin);
assertEquals(77, sf.end);
assertEquals("uniprot", sf.featureGroup);
assertEquals("METAL", sf.type);
- sf = sfs[4];
+ sf = sfs[5];
assertEquals("Fer2 Status: True Positive Pfam 8_8%LINK%",
sf.description);
- assertEquals("Pfam 8_8|http://pfam.sanger.ac.uk/family/PF00111",
- sf.links.get(0).toString());
+ assertEquals("Pfam 8_8|http://pfam.xfam.org/family/PF00111",
+ sf.links.get(0));
assertEquals(8, sf.begin);
assertEquals(83, sf.end);
assertEquals("uniprot", sf.featureGroup);
assertEquals("Pfam", sf.type);
- sf = sfs[5];
+ sf = sfs[6];
assertEquals("Ferredoxin_fold Status: True Positive ", sf.description);
assertEquals(3, sf.begin);
assertEquals(93, sf.end);
assertEquals("uniprot", sf.featureGroup);
assertEquals("Cath", sf.type);
- sf = sfs[6];
+ sf = sfs[7];
assertEquals(
"High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (T) 89_8%LINK%",
sf.description);
assertEquals(
"PHOSPHORYLATION (T) 89_8|http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P83527&service=NetPhos-2.0",
- sf.links.get(0).toString());
+ sf.links.get(0));
assertEquals(89, sf.begin);
assertEquals(89, sf.end);
assertEquals("netphos", sf.featureGroup);
+ "STARTGROUP\tuniprot\n"
+ "Iron\tFER_CAPAA\t-1\t39\t39\tMETAL\n"
+ "Turn\tFER_CAPAA\t-1\t36\t38\tGAMMA-TURN\n"
- + "<html>Pfam domain<a href=\"http://pfam.sanger.ac.uk/family/PF00111\">Pfam_3_4</a></html>\tFER_CAPAA\t-1\t20\t20\tPfam\n"
+ + "<html>Pfam domain<a href=\"http://pfam.xfam.org/family/PF00111\">Pfam_3_4</a></html>\tFER_CAPAA\t-1\t20\t20\tPfam\n"
+ "ENDGROUP\tuniprot\n";
FeaturesFile featuresFile = new FeaturesFile(features,
FormatAdapter.PASTE);
+ "\nSTARTGROUP\tuniprot\n"
+ "Iron\tFER_CAPAA\t-1\t39\t39\tMETAL\t0.0\n"
+ "Turn\tFER_CAPAA\t-1\t36\t38\tGAMMA-TURN\t0.0\n"
- + "<html>Pfam domain<a href=\"http://pfam.sanger.ac.uk/family/PF00111\">Pfam_3_4</a></html>\tFER_CAPAA\t-1\t20\t20\tPfam\t0.0\n"
+ + "<html>Pfam domain<a href=\"http://pfam.xfam.org/family/PF00111\">Pfam_3_4</a></html>\tFER_CAPAA\t-1\t20\t20\tPfam\t0.0\n"
+ "ENDGROUP\tuniprot\n";
assertEquals(expected, exported);
}
/**
* @throws java.lang.Exception
*/
- @AfterClass
+ @AfterClass(alwaysRun = true)
public static void tearDownAfterClass() throws Exception
{
}
passedCount = 0;
}
- @AfterTest
+ @AfterTest(alwaysRun = true)
public void tearDown() throws Exception
{
testJsonFile = null;
import jalview.schemes.ColourSchemeI;
import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
import org.testng.Assert;
import org.testng.AssertJUnit;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
+@Test(singleThreaded = true)
public class Jalview2xmlTests
{
/**
* @throws java.lang.Exception
*/
- @AfterClass
+ @AfterClass(alwaysRun = true)
public static void tearDownAfterClass() throws Exception
{
jalview.gui.Desktop.instance.closeAll_actionPerformed(null);
Desktop.getAlignmentPanels(af.getViewport().getSequenceSetId()).length);
}
+ /**
+ * based on above test store and recovery of expanded views.
+ *
+ * @throws Exception
+ */
+ @Test(groups = { "Functional" })
+ public void testStoreAndRecoverReferenceSeqSettings() throws Exception
+ {
+ Desktop.instance.closeAll_actionPerformed(null);
+ String afid = "";
+ {
+ AlignFrame af = new jalview.io.FileLoader().LoadFileWaitTillLoaded(
+ "examples/exampleFile_2_7.jar", FormatAdapter.FILE);
+ assertTrue("Didn't read in the example file correctly.", af != null);
+ afid = af.getViewport().getSequenceSetId();
+ }
+ Map<String, SequenceI> refs = new HashMap<String, SequenceI>();
+ int n = 1;
+ for (AlignmentViewPanel ap : Desktop.getAlignmentPanels(afid))
+ {
+ // mark representative
+ SequenceI rep = ap.getAlignment().getSequenceAt(
+ n++ % ap.getAlignment().getHeight());
+ refs.put(ap.getViewName(), rep);
+ // code from mark/unmark sequence as reference in jalview.gui.PopupMenu
+ // todo refactor the to an alignment view controller
+ ap.getAlignViewport().setDisplayReferenceSeq(true);
+ ap.getAlignViewport().setColourByReferenceSeq(true);
+ ap.getAlignViewport().getAlignment().setSeqrep(rep);
+ }
+ File tfile = File.createTempFile("testStoreAndRecoverReferenceSeq",
+ ".jvp");
+ try
+ {
+ new Jalview2XML(false).saveState(tfile);
+ } catch (Error e)
+ {
+ Assert.fail("Didn't save the expanded view state", e);
+ } catch (Exception e)
+ {
+ Assert.fail("Didn't save the expanded view state", e);
+ }
+ Desktop.instance.closeAll_actionPerformed(null);
+ if (Desktop.getAlignFrames() != null)
+ {
+ Assert.assertEquals(Desktop.getAlignFrames().length, 0);
+ }
+ {
+ AlignFrame af = new jalview.io.FileLoader().LoadFileWaitTillLoaded(
+ tfile.getAbsolutePath(), FormatAdapter.FILE);
+ afid = af.getViewport().getSequenceSetId();
+ }
+ for (AlignmentViewPanel ap : Desktop.getAlignmentPanels(afid))
+ {
+ // check representative
+ SequenceI rep = ap.getAlignment().getSeqrep();
+ Assert.assertNotNull(rep,
+ "Couldn't restore sequence representative from project");
+ // can't use a strong equals here, because by definition, the sequence IDs
+ // will be different.
+ // could set vamsas session save/restore flag to preserve IDs across
+ // load/saves.
+ Assert.assertEquals(refs.get(ap.getViewName()).toString(),
+ rep.toString(),
+ "Representative wasn't the same when recovered.");
+ Assert.assertTrue(ap.getAlignViewport().isDisplayReferenceSeq(),
+ "Display reference sequence view setting not set.");
+ Assert.assertTrue(ap.getAlignViewport().isColourByReferenceSeq(),
+ "Colour By Reference Seq view setting not set.");
+ }
+ }
+
@Test(groups = { "Functional" })
public void testIsVersionStringLaterThan()
{
*/
assertTrue(Jalview2XML.isVersionStringLaterThan(null, null));
assertTrue(Jalview2XML.isVersionStringLaterThan("2.8.3", null));
+ assertTrue(Jalview2XML.isVersionStringLaterThan(null, "2.8.3"));
assertTrue(Jalview2XML.isVersionStringLaterThan(null,
"Development Build"));
assertTrue(Jalview2XML.isVersionStringLaterThan(null,
/**
* @throws java.lang.Exception
*/
- @AfterClass
+ @AfterClass(alwaysRun = true)
public static void tearDownAfterClass() throws Exception
{
jalview.gui.Desktop.instance.closeAll_actionPerformed(null);
/**
* @throws java.lang.Exception
*/
- @AfterClass
+ @AfterClass(alwaysRun = true)
public static void tearDownAfterClass() throws Exception
{
}
{
}
- @AfterClass
+ @AfterClass(alwaysRun = true)
public static void tearDownAfterClass() throws Exception
{
}
--- /dev/null
+package jalview.util;
+
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertNull;
+import static org.testng.AssertJUnit.fail;
+
+import java.text.ParseException;
+import java.util.List;
+
+import org.testng.annotations.Test;
+
+public class DnaUtilsTest
+{
+ /**
+ * Tests for parsing an ENA/GenBank location specifier
+ *
+ * @throws ParseException
+ *
+ * @see http://www.insdc.org/files/feature_table.html#3.4
+ */
+ @Test(groups = { "Functional" })
+ public void testParseLocation() throws ParseException
+ {
+ /*
+ * single locus
+ */
+ List<int[]> ranges = DnaUtils.parseLocation("467");
+ assertEquals(1, ranges.size());
+ assertEquals(467, ranges.get(0)[0]);
+ assertEquals(467, ranges.get(0)[1]);
+
+ /*
+ * simple range
+ */
+ ranges = DnaUtils.parseLocation("12..78");
+ assertEquals(1, ranges.size());
+ assertEquals(12, ranges.get(0)[0]);
+ assertEquals(78, ranges.get(0)[1]);
+
+ /*
+ * join of simple ranges
+ */
+ ranges = DnaUtils.parseLocation("join(12..78,134..202,322..345)");
+ assertEquals(3, ranges.size());
+ assertEquals(12, ranges.get(0)[0]);
+ assertEquals(78, ranges.get(0)[1]);
+ assertEquals(134, ranges.get(1)[0]);
+ assertEquals(202, ranges.get(1)[1]);
+ assertEquals(322, ranges.get(2)[0]);
+ assertEquals(345, ranges.get(2)[1]);
+
+ /*
+ * complement of a simple range
+ */
+ ranges = DnaUtils.parseLocation("complement(34..126)");
+ assertEquals(1, ranges.size());
+ assertEquals(126, ranges.get(0)[0]);
+ assertEquals(34, ranges.get(0)[1]);
+
+ /*
+ * complement of a join
+ */
+ ranges = DnaUtils
+ .parseLocation("complement(join(2691..4571,4918..5163))");
+ assertEquals(2, ranges.size());
+ assertEquals(5163, ranges.get(0)[0]);
+ assertEquals(4918, ranges.get(0)[1]);
+ assertEquals(4571, ranges.get(1)[0]);
+ assertEquals(2691, ranges.get(1)[1]);
+
+ /*
+ * join of two complements
+ */
+ ranges = DnaUtils
+ .parseLocation("join(complement(4918..5163),complement(2691..4571))");
+ assertEquals(2, ranges.size());
+ assertEquals(5163, ranges.get(0)[0]);
+ assertEquals(4918, ranges.get(0)[1]);
+ assertEquals(4571, ranges.get(1)[0]);
+ assertEquals(2691, ranges.get(1)[1]);
+
+ /*
+ * join complement to non-complement
+ * @see http://www.ncbi.nlm.nih.gov/genbank/genomesubmit_annotation/ Transpliced Genes
+ */
+ ranges = DnaUtils
+ .parseLocation("join(complement(36618..36700),86988..87064)");
+ assertEquals(2, ranges.size());
+ assertEquals(36700, ranges.get(0)[0]);
+ assertEquals(36618, ranges.get(0)[1]);
+ assertEquals(86988, ranges.get(1)[0]);
+ assertEquals(87064, ranges.get(1)[1]);
+
+ /*
+ * valid things we don't yet handle
+ */
+ checkForParseException("<34..126");
+ checkForParseException("35..>126");
+ checkForParseException("34.126");
+ checkForParseException("34^126");
+ checkForParseException("order(34..126,130..180)");
+
+ /*
+ * invalid things
+ */
+ checkForParseException("");
+ checkForParseException("JOIN(1..2)");
+ checkForParseException("join(1..2");
+ checkForParseException("join(1..2(");
+ checkForParseException("complement(1..2");
+ checkForParseException("complement(1..2(");
+ try
+ {
+ assertNull(DnaUtils.parseLocation(null));
+ fail("Expected exception");
+ } catch (NullPointerException e)
+ {
+ // expected
+ }
+
+ /*
+ * nested joins are not allowed; just as well since this fails to parse
+ * (splitting tokens by comma fragments the inner join expression)
+ */
+ checkForParseException("join(1..2,join(4..5,10..12),18..22)");
+ /*
+ * complement may not enclose multiple ranges
+ * parsing fails for the same reason
+ */
+ checkForParseException("join(complement(36618..36700,4000..4200),86988..87064)");
+ }
+
+ /**
+ * Verifies that a ParseException is thrown when the given location is parsed
+ *
+ * @param location
+ */
+ void checkForParseException(String location)
+ {
+ try
+ {
+ DnaUtils.parseLocation(location);
+ fail("Expected exception");
+ } catch (ParseException e)
+ {
+ // expected;
+ }
+ }
+
+}
assertEquals(0,
StringUtils.parseInt(String.valueOf(Integer.MAX_VALUE) + "1"));
}
+
+ @Test(groups = { "Functional" })
+ public void testCompareVersions()
+ {
+ assertEquals(0, StringUtils.compareVersions(null, null));
+ assertEquals(0, StringUtils.compareVersions("2.8.3", null));
+
+ /*
+ * same version returns 0
+ */
+ assertEquals(0, StringUtils.compareVersions("2.8", "2.8"));
+ assertEquals(0, StringUtils.compareVersions("2.8.3", "2.8.3"));
+ assertEquals(0, StringUtils.compareVersions("2.8.3b1", "2.8.3b1", "b"));
+ assertEquals(0, StringUtils.compareVersions("2.8.3B1", "2.8.3b1", "b"));
+ assertEquals(0, StringUtils.compareVersions("2.8.3b1", "2.8.3B1", "b"));
+
+ /*
+ * v1 < v2 returns -1
+ */
+ assertEquals(-1, StringUtils.compareVersions("2.8.3", "2.8.4"));
+ assertEquals(-1, StringUtils.compareVersions("2.8.3", "2.9"));
+ assertEquals(-1, StringUtils.compareVersions("2.8.3", "2.9.2"));
+ assertEquals(-1, StringUtils.compareVersions("2.8", "2.8.3"));
+ assertEquals(-1, StringUtils.compareVersions("2.8.3", "2.8.3b1", "b"));
+ assertEquals(-1, StringUtils.compareVersions("2.8.3b1", "2.8.3b2", "b"));
+ assertEquals(-1, StringUtils.compareVersions("2.8", "2.8.0", "b"));
+ assertEquals(-1, StringUtils.compareVersions("2", "12"));
+ assertEquals(-1, StringUtils.compareVersions("3.2.4", "3.12.11"));
+
+ /*
+ * v1 > v2 returns +1
+ */
+ assertEquals(1, StringUtils.compareVersions("2.8.3", "2.8"));
+ assertEquals(1, StringUtils.compareVersions("2.8.0", "2.8"));
+ assertEquals(1, StringUtils.compareVersions("2.8.4", "2.8.3"));
+ assertEquals(1, StringUtils.compareVersions("2.8.3b1", "2.8.3", "b"));
+ assertEquals(1, StringUtils.compareVersions("2.8.3", "2.8.2b1", "b"));
+ assertEquals(1, StringUtils.compareVersions("2.8.0b2", "2.8.0b1", "b"));
+ assertEquals(1, StringUtils.compareVersions("12", "2"));
+ assertEquals(1, StringUtils.compareVersions("3.12.11", "3.2.4"));
+ }
+
+ @Test(groups = { "Functional" })
+ public void testToSentenceCase()
+ {
+ assertEquals("John", StringUtils.toSentenceCase("john"));
+ assertEquals("John", StringUtils.toSentenceCase("JOHN"));
+ assertEquals("John and james",
+ StringUtils.toSentenceCase("JOHN and JAMES"));
+ assertEquals("J", StringUtils.toSentenceCase("j"));
+ assertEquals("", StringUtils.toSentenceCase(""));
+ assertNull(StringUtils.toSentenceCase(null));
+ }
}
}
}
+ @Test(groups = { "Network" }, enabled = true)
+ public void testPdbSeqRetrieve() throws Exception
+ {
+ Cache.applicationProperties.setProperty("STRUCT_FROM_PDB",
+ Boolean.TRUE.toString());
+ testRetrieveProteinSeqFromPDB();
+ }
+
+ @Test(groups = { "Network" }, enabled = true)
+ public void testmmCifSeqRetrieve() throws Exception
+ {
+ Cache.applicationProperties.setProperty("STRUCT_FROM_PDB",
+ Boolean.FALSE.toString());
+ testRetrieveProteinSeqFromPDB();
+ }
+
+ private void testRetrieveProteinSeqFromPDB() throws Exception
+ {
+ List<DbSourceProxy> sps = sf.getSourceProxy("PDB");
+ AlignmentI response = sps.get(0).getSequenceRecords("1QIP");
+ assertTrue(response != null);
+ assertTrue(response.getHeight() == 4);
+ for (SequenceI sq : response.getSequences())
+ {
+ assertTrue("No annotation transfered to sequence.",
+ sq.getAnnotation().length > 0);
+ assertTrue("No PDBEntry on sequence.",
+ sq.getAllPDBEntries().size() > 0);
+ org.testng.Assert
+ .assertEquals(sq.getEnd() - sq.getStart() + 1,
+ sq.getLength(),
+ "Sequence start/end doesn't match number of residues in sequence");
+ }
+ }
+
}
--- /dev/null
+package jalview.ws.ebi;
+
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertNull;
+
+import org.testng.annotations.Test;
+
+public class EBIFetchClientTest
+{
+ /**
+ * Test method that constructs URL to fetch from
+ */
+ @Test(groups = "Functional")
+ public void testBuildUrl()
+ {
+ /*
+ * EMBL
+ */
+ assertEquals("http://www.ebi.ac.uk/ena/data/view/x53838&display=xml",
+ EBIFetchClient.buildUrl("X53838", "EMBL", "display=xml"));
+
+ /*
+ * EMBLCDS
+ */
+ assertEquals("http://www.ebi.ac.uk/ena/data/view/caa37824&display=xml",
+ EBIFetchClient.buildUrl("CAA37824", "EMBL", "display=xml"));
+
+ /*
+ * Uniprot
+ */
+ assertEquals(
+ "http://www.ebi.ac.uk/Tools/dbfetch/dbfetch/uniprot/p00340/uniprotxml",
+ EBIFetchClient.buildUrl("P00340", "UNIPROT", "uniprotxml"));
+
+ /*
+ * PDB / pdb
+ */
+ assertEquals("http://www.ebi.ac.uk/Tools/dbfetch/dbfetch/pdb/3a6s/pdb",
+ EBIFetchClient.buildUrl("3A6S", "PDB", "pdb"));
+
+ /*
+ * PDB / mmCIF
+ */
+ assertEquals(
+ "http://www.ebi.ac.uk/Tools/dbfetch/dbfetch/pdb/3a6s/mmCIF",
+ EBIFetchClient.buildUrl("3A6S", "PDB", "mmCIF"));
+ }
+
+ /**
+ * Test method that parses db:id;id;id
+ */
+ @Test(groups = "Functional")
+ public void testParseIds()
+ {
+ /*
+ * pdb, two accessions
+ */
+ StringBuilder queries = new StringBuilder();
+ String db = EBIFetchClient.parseIds("pdb:3a6s;1A70", queries);
+ assertEquals("pdb", db);
+ assertEquals("3a6s,1A70", queries.toString());
+
+ /*
+ * pdb specified on second accession
+ */
+ queries.setLength(0);
+ queries = new StringBuilder();
+ db = EBIFetchClient.parseIds("3a6s;pdb:1A70", queries);
+ assertEquals("pdb", db);
+ assertEquals("3a6s,1A70", queries.toString());
+
+ /*
+ * uniprot, one accession
+ */
+ queries.setLength(0);
+ db = EBIFetchClient.parseIds("uniprot:P00340", queries);
+ assertEquals("uniprot", db);
+ assertEquals("P00340", queries.toString());
+
+ /*
+ * uniprot, one accession, appending to existing queries
+ */
+ queries.setLength(0);
+ queries.append("P30419");
+ db = EBIFetchClient.parseIds("uniprot:P00340", queries);
+ assertEquals("uniprot", db);
+ assertEquals("P30419,P00340", queries.toString());
+
+ /*
+ * pdb and uniprot mixed - rejected
+ */
+ queries.setLength(0);
+ db = EBIFetchClient.parseIds("pdb:3a6s;1a70;uniprot:P00340", queries);
+ assertNull(db);
+ assertEquals("3a6s,1a70", queries.toString());
+
+ /*
+ * pdb and PDB mixed - ok
+ */
+ queries.setLength(0);
+ db = EBIFetchClient.parseIds("pdb:3a6s;pdb:1a70;PDB:1QIP", queries);
+ assertEquals("PDB", db);
+ assertEquals("3a6s,1a70,1QIP", queries.toString());
+
+ /*
+ * no database (improper format)
+ */
+ queries.setLength(0);
+ db = EBIFetchClient.parseIds("P00340", queries);
+ assertNull(db);
+ assertEquals("P00340", queries.toString());
+ }
+}
{
}
- @AfterClass
+ @AfterClass(alwaysRun = true)
public static void tearDownAfterClass() throws Exception
{
}
assertNotNull("Couldn't load test data ('" + testseqs + "')", af);
}
- @AfterClass
+ @AfterClass(alwaysRun = true)
public static void tearDownAfterClass() throws Exception
{
if (af != null)
// public?
}
- @AfterClass
+ @AfterClass(alwaysRun = true)
public static void tearDownAfterClass() throws Exception
{
if (af != null)
/**
* @throws java.lang.Exception
*/
- @AfterClass
+ @AfterClass(alwaysRun = true)
public static void tearDownAfterClass() throws Exception
{
}
import java.io.ByteArrayOutputStream;
import java.io.File;
+import java.io.IOException;
import java.io.PrintStream;
import java.util.HashMap;
// Assert that file isn't yet downloaded - if already downloaded, assert it
// is deleted
Assert.assertTrue(SiftsClient.deleteSiftsFileByPDBId(testPDBId));
- File siftsFile = SiftsClient.downloadSiftsFile(testPDBId);
- FileAssert.assertFile(siftsFile);
- SiftsClient.downloadSiftsFile(testPDBId);
+ File siftsFile;
+ try
+ {
+ siftsFile = SiftsClient.downloadSiftsFile(testPDBId);
+ FileAssert.assertFile(siftsFile);
+ SiftsClient.downloadSiftsFile(testPDBId);
+ } catch (IOException e)
+ {
+ e.printStackTrace();
+ }
}
@Test(groups = { "Functional" })
--- /dev/null
+
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * A class to check help file cross-references, and external URLs if internet
+ * access is available
+ *
+ * @author gmcarstairs
+ *
+ */
+public class HelpLinksChecker
+{
+ private static final String HELP_HS = "help.hs";
+
+ private static final String HELP_TOC_XML = "helpTOC.xml";
+
+ private static final String HELP_JHM = "help.jhm";
+
+ private static boolean internetAvailable = true;
+
+ private int targetCount = 0;
+
+ private int mapCount = 0;
+
+ private int internalHrefCount = 0;
+
+ private int anchorRefCount = 0;
+
+ private int externalHrefCount = 0;
+
+ private int invalidMapUrlCount = 0;
+
+ private int invalidTargetCount = 0;
+
+ private int invalidImageCount = 0;
+
+ private int invalidInternalHrefCount = 0;
+
+ private int invalidExternalHrefCount = 0;
+
+ /**
+ * The only parameter should be a path to the root of the help directory in
+ * the workspace
+ *
+ * @param args
+ * [0] path to the /html folder in the workspace
+ * @param args
+ * [1] (optional) -nointernet to suppress external link checking for
+ * a fast check of internal links only
+ * @throws IOException
+ */
+ public static void main(String[] args) throws IOException
+ {
+ if (args.length == 0 || args.length > 2
+ || (args.length == 2 && !args[1].equals("-nointernet")))
+ {
+ System.out.println("Usage: <pathToHelpFolder> [-nointernet]");
+ return;
+ }
+
+ if (args.length == 2)
+ {
+ internetAvailable = false;
+ }
+
+ new HelpLinksChecker().checkLinks(args[0]);
+ }
+
+ /**
+ * Checks help links and reports results
+ *
+ * @param helpDirectoryPath
+ * @throws IOException
+ */
+ void checkLinks(String helpDirectoryPath) throws IOException
+ {
+ System.out.println("Checking help file links");
+ File helpFolder = new File(helpDirectoryPath);
+ if (!helpFolder.exists())
+ {
+ System.out.println("Can't find " + helpDirectoryPath);
+ return;
+ }
+
+ internetAvailable &= connectToUrl("http://www.example.com");
+
+ Map<String, String> tocTargets = checkHelpMappings(helpFolder);
+
+ Map<String, String> unusedTargets = new HashMap<String, String>(
+ tocTargets);
+
+ checkTableOfContents(helpFolder, tocTargets, unusedTargets);
+
+ checkHelpSet(helpFolder, tocTargets, unusedTargets);
+
+ checkHtmlFolder(new File(helpFolder, "html"));
+
+ reportResults(unusedTargets);
+ }
+
+ /**
+ * Checks all html files in the given directory or its sub-directories
+ *
+ * @param folder
+ * @throws IOException
+ */
+ private void checkHtmlFolder(File folder) throws IOException
+ {
+ File[] files = folder.listFiles();
+ for (File f : files)
+ {
+ if (f.isDirectory())
+ {
+ checkHtmlFolder(f);
+ }
+ else
+ {
+ if (f.getAbsolutePath().endsWith(".html"))
+ {
+ checkHtmlFile(f, folder);
+ }
+ }
+ }
+ }
+
+ /**
+ * Checks that any image attribute in help.hs is a valid target
+ *
+ * @param helpFolder
+ * @param tocTargets
+ * @param unusedTargets
+ * used targets are removed from here
+ */
+ private void checkHelpSet(File helpFolder,
+ Map<String, String> tocTargets, Map<String, String> unusedTargets)
+ throws IOException
+ {
+ BufferedReader br = new BufferedReader(new FileReader(new File(
+ helpFolder, HELP_HS)));
+ String data = br.readLine();
+ int lineNo = 0;
+
+ while (data != null)
+ {
+ lineNo++;
+ String image = getAttribute(data, "image");
+ if (image != null)
+ {
+ unusedTargets.remove(image);
+ if (!tocTargets.containsKey(image))
+ {
+ System.out.println(String.format(
+ "Invalid image '%s' at line %d of %s", image, lineNo,
+ HELP_HS));
+ invalidImageCount++;
+ }
+ }
+ data = br.readLine();
+ }
+ br.close();
+ }
+
+ /**
+ * Print counts to sysout
+ *
+ * @param unusedTargets
+ */
+ private void reportResults(Map<String, String> unusedTargets)
+ {
+ System.out.println("\nResults:");
+ System.out.println(targetCount + " distinct help targets");
+ System.out.println(mapCount + " help mappings");
+ System.out.println(invalidTargetCount + " invalid targets");
+ System.out.println(unusedTargets.size() + " unused targets");
+ for (String target : unusedTargets.keySet())
+ {
+ System.out.println(String.format(" %s: %s", target,
+ unusedTargets.get(target)));
+ }
+ System.out.println(invalidMapUrlCount + " invalid map urls");
+ System.out.println(invalidImageCount + " invalid image attributes");
+ System.out.println(String.format(
+ "%d internal href links (%d with anchors - not checked)",
+ internalHrefCount, anchorRefCount));
+ System.out.println(invalidInternalHrefCount
+ + " invalid internal href links");
+ System.out.println(externalHrefCount + " external href links");
+ if (internetAvailable)
+ {
+ System.out.println(invalidExternalHrefCount
+ + " invalid external href links");
+ }
+ else
+ {
+ System.out
+ .println("External links not verified as internet not available");
+ }
+
+ }
+
+ /**
+ * Reads the given html file and checks any href attibute values are either
+ * <ul>
+ * <li>a valid relative file path, or</li>
+ * <li>a valid absolute URL (if external link checking is enabled)</li>
+ * </ul>
+ *
+ * @param htmlFile
+ * @param htmlFolder
+ * the parent folder (for validation of relative paths)
+ */
+ private void checkHtmlFile(File htmlFile, File htmlFolder)
+ throws IOException
+ {
+ BufferedReader br = new BufferedReader(new FileReader(htmlFile));
+ String data = br.readLine();
+ int lineNo = 0;
+ while (data != null)
+ {
+ lineNo++;
+ String href = getAttribute(data, "href");
+ if (href != null)
+ {
+ String anchor = null;
+ int anchorPos = href.indexOf("#");
+ if (anchorPos != -1)
+ {
+ anchor = href.substring(anchorPos + 1);
+ href = href.substring(0, anchorPos);
+ }
+ boolean badLink = false;
+ if (href.startsWith("http"))
+ {
+ externalHrefCount++;
+ if (internetAvailable)
+ {
+ if (!connectToUrl(href))
+ {
+ badLink = true;
+ invalidExternalHrefCount++;
+ }
+ }
+ }
+ else
+ {
+ internalHrefCount++;
+ File hrefFile = href.equals("") ? htmlFile : new File(htmlFolder,
+ href);
+ if (!hrefFile.exists())
+ {
+ badLink = true;
+ invalidInternalHrefCount++;
+ }
+ if (anchor != null)
+ {
+ anchorRefCount++;
+ if (!badLink)
+ {
+ if (!checkAnchorExists(hrefFile, anchor))
+ {
+ System.out.println(String.format(
+ "Invalid anchor: %s at line %d of %s", anchor,
+ lineNo, getPath(htmlFile)));
+ }
+ }
+ }
+ }
+ if (badLink)
+ {
+ System.out.println(String.format(
+ "Invalid href %s at line %d of %s", href, lineNo,
+ getPath(htmlFile)));
+ }
+ }
+ data = br.readLine();
+ }
+ br.close();
+ }
+
+ /**
+ * Reads the file and checks for the presence of the given html anchor
+ *
+ * @param hrefFile
+ * @param anchor
+ * @return true if anchor is found else false
+ */
+ private boolean checkAnchorExists(File hrefFile, String anchor)
+ {
+ String nameAnchor = "<a name=\"" + anchor + "\"";
+ String idAnchor = "<a id=\"" + anchor + "\"";
+ boolean found = false;
+ try
+ {
+ BufferedReader br = new BufferedReader(new FileReader(hrefFile));
+ String data = br.readLine();
+ while (data != null)
+ {
+ if (data.contains(nameAnchor) || data.contains(idAnchor))
+ {
+ found = true;
+ break;
+ }
+ data = br.readLine();
+ }
+ br.close();
+ } catch (IOException e)
+ {
+ // ignore
+ }
+ return found;
+ }
+
+ /**
+ * Returns the part of the file path starting from /help/
+ *
+ * @param helpFile
+ * @return
+ */
+ private String getPath(File helpFile)
+ {
+ String path = helpFile.getPath();
+ int helpPos = path.indexOf("/help/");
+ return helpPos == -1 ? path : path.substring(helpPos);
+ }
+
+ /**
+ * Returns true if the URL returns an input stream, or false if the URL
+ * returns an error code or we cannot connect to it (e.g. no internet
+ * available)
+ *
+ * @param url
+ * @return
+ */
+ private boolean connectToUrl(String url)
+ {
+ try
+ {
+ URL u = new URL(url);
+ InputStream connection = u.openStream();
+ connection.close();
+ return true;
+ } catch (Throwable t)
+ {
+ return false;
+ }
+ }
+
+ /**
+ * Reads file help.jhm and checks that
+ * <ul>
+ * <li>each target attribute is in tocTargets</li>
+ * <li>each url attribute is a valid relative file link</li>
+ * </ul>
+ *
+ * @param helpFolder
+ */
+ private Map<String, String> checkHelpMappings(File helpFolder)
+ throws IOException
+ {
+ Map<String, String> targets = new HashMap<String, String>();
+ BufferedReader br = new BufferedReader(new FileReader(new File(
+ helpFolder, HELP_JHM)));
+ String data = br.readLine();
+ int lineNo = 0;
+ while (data != null)
+ {
+ lineNo++;
+
+ /*
+ * record target, check for duplicates
+ */
+ String target = getAttribute(data, "target");
+ if (target != null)
+ {
+ mapCount++;
+ if (targets.containsKey(target))
+ {
+ System.out.println(String.format(
+ "Duplicate target mapping to %s at line %d of %s",
+ target, lineNo, HELP_JHM));
+ }
+ else
+ {
+ targetCount++;
+ }
+ }
+
+ /*
+ * validate url
+ */
+ String url = getAttribute(data, "url");
+ if (url != null)
+ {
+ targets.put(target, url);
+ int anchorPos = url.indexOf("#");
+ if (anchorPos != -1)
+ {
+ url = url.substring(0, anchorPos);
+ }
+ if (!new File(helpFolder, url).exists())
+ {
+ System.out.println(String.format(
+ "Invalid url path '%s' at line %d of %s", url, lineNo,
+ HELP_JHM));
+ invalidMapUrlCount++;
+ }
+ }
+ data = br.readLine();
+ }
+ br.close();
+ return targets;
+ }
+
+ /**
+ * Reads file helpTOC.xml and reports any invalid targets
+ *
+ * @param helpFolder
+ * @param tocTargets
+ * @param unusedTargets
+ * used targets are removed from this map
+ *
+ * @return
+ * @throws IOException
+ */
+ private void checkTableOfContents(File helpFolder,
+ Map<String, String> tocTargets, Map<String, String> unusedTargets)
+ throws IOException
+ {
+ BufferedReader br = new BufferedReader(new FileReader(new File(
+ helpFolder, HELP_TOC_XML)));
+ String data = br.readLine();
+ int lineNo = 0;
+ while (data != null)
+ {
+ lineNo++;
+ /*
+ * assuming no more than one "target" per line of file here
+ */
+ String target = getAttribute(data, "target");
+ if (target != null)
+ {
+ unusedTargets.remove(target);
+ if (!tocTargets.containsKey(target))
+ {
+ System.out.println(String.format(
+ "Invalid target '%s' at line %d of %s", target, lineNo,
+ HELP_TOC_XML));
+ invalidTargetCount++;
+ }
+ }
+ data = br.readLine();
+ }
+ br.close();
+ }
+
+ /**
+ * Returns the value of an attribute if found in the data, else null
+ *
+ * @param data
+ * @param attName
+ * @return
+ */
+ private static String getAttribute(String data, String attName)
+ {
+ /*
+ * make a partial attempt at ignoring within <!-- html comments -->
+ * (doesn't work if multi-line)
+ */
+ int commentStartPos = data.indexOf("<!--");
+ int commentEndPos = commentStartPos == -1 ? -1 : data.substring(
+ commentStartPos + 4).indexOf("-->");
+ String value = null;
+ String match = attName + "=\"";
+ int attPos = data.indexOf(match);
+ if (attPos > 0
+ && (commentStartPos == -1 || attPos < commentStartPos || attPos > commentEndPos))
+ {
+ data = data.substring(attPos + match.length());
+ value = data.substring(0, data.indexOf("\""));
+ }
+ return value;
+ }
+}
</property>
</object>
</method>
+ <method name="addElement">
+ <object class="com.zerog.ia.installer.actions.InstallZipfile" objectID="1000ddddfab939">
+ <property name="belongsToUninstallPhase">
+ <boolean>false</boolean>
+ </property>
+ <property name="rollbackEnabledCancel">
+ <boolean>true</boolean>
+ </property>
+ <property name="rollbackEnabledError">
+ <boolean>true</boolean>
+ </property>
+ <property name="ruleExpression">
+ <string><![CDATA[]]></string>
+ </property>
+ <property name="unixPermissions">
+ <string><![CDATA[664]]></string>
+ </property>
+ <property name="sourceName">
+ <string><![CDATA[servlet-api-3.1.jar]]></string>
+ </property>
+ <property name="overrideUnixPermissions">
+ <boolean>false</boolean>
+ </property>
+ <property name="sourcePath">
+ <string><![CDATA[/home/cruisecontrol/jalview/lib/]]></string>
+ </property>
+ <property name="shouldUninstall">
+ <boolean>true</boolean>
+ </property>
+ <property name="rollbackEnabledCancel">
+ <boolean>true</boolean>
+ </property>
+ <property name="rollbackEnabledError">
+ <boolean>true</boolean>
+ </property>
+ <property name="destinationName">
+ <string><![CDATA[servlet-api-3.1.jar]]></string>
+ </property>
+ <property name="fileSize">
+ <long>16046</long>
+ </property>
+ <property name="macBinary">
+ <boolean>false</boolean>
+ </property>
+ <property name="targetCheckKind">
+ <int>0</int>
+ </property>
+ <property name="ruleExpression">
+ <string><![CDATA[]]></string>
+ </property>
+ </object>
+ </method>
</object>
</property>
<property name="rulesFailedMessage">
<object refID="1f46efeefab93"/>
<object refID="1936efeefab93"/>
<object refID="1000ddddfab93"/>
+ <object refID="1000ddddfab939"/>
<object refID="10936efeefab93"/>
<object refID="11936efeefab93"/>
<object refID="12936efeefab93"/>
<object refID="1f46efeefab93"/>
<object refID="1936efeefab93"/>
<object refID="1000ddddfab93"/>
+ <object refID="1000ddddfab939"/>
<object refID="10936efeefab93"/>
<object refID="11936efeefab93"/>
<object refID="12936efeefab93"/>
--- /dev/null
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Properties;
+import java.util.TreeSet;
+
+/**
+ * This class scans Java source files for calls to MessageManager and reports
+ * <ul>
+ * <li>calls using keys not found in Messages.properties</li>
+ * <li>any unused keys in Messages.properties</li>
+ * </ul>
+ * It does not handle dynamically constructed keys, these are reported as
+ * possible errors for manual inspection. <br>
+ * For comparing translated bundles with Messages.properties, see i18nAnt.xml
+ *
+ * @author gmcarstairs
+ *
+ */
+public class MessageBundleChecker
+{
+ /*
+ * number of text lines to read at a time in order to parse
+ * code that is split over several lines
+ */
+ static int bufferSize = 3;
+
+ static final String METHOD1 = "MessageManager.getString(";
+
+ static final String METHOD2 = "MessageManager.getStringOrReturn(";
+
+ static final String METHOD3 = "MessageManager.formatMessage(";
+
+ static final String[] METHODS = { METHOD1, METHOD2, METHOD3 };
+
+ /*
+ * root of the Java source folders we want to scan
+ */
+ String sourcePath;
+
+ /*
+ * contents of Messages.properties
+ */
+ private Properties messages;
+
+ /*
+ * keys from Messages.properties
+ * we remove entries from here as they are found to be used
+ * any left over are unused entries
+ */
+ private TreeSet<String> messageKeys;
+
+ private int javaCount;
+
+ private HashSet<String> invalidKeys;
+
+ /**
+ * Runs the scan given the path to the root of Java source directories
+ *
+ * @param args
+ * [0] path to the source folder to scan
+ * @param args
+ * [1] (optional) read buffer size (default is 3); increasing this
+ * may detect more results but will give higher error counts due to
+ * double counting of the same code
+ * @throws IOException
+ */
+ public static void main(String[] args) throws IOException
+ {
+ if (args.length != 1 && args.length != 2)
+ {
+ System.out.println("Usage: <pathToSourceFolder> [readBufferSize]");
+ return;
+ }
+ if (args.length == 2)
+ {
+ bufferSize = Integer.valueOf(args[1]);
+ }
+ new MessageBundleChecker().doMain(args[0]);
+ }
+
+ /**
+ * Main method to perform the work
+ *
+ * @param srcPath
+ * @throws IOException
+ */
+ private void doMain(String srcPath) throws IOException
+ {
+ System.out.println("Scanning " + srcPath
+ + " for calls to MessageManager");
+ sourcePath = srcPath;
+ loadMessages();
+ File dir = new File(srcPath);
+ if (!dir.exists())
+ {
+ System.out.println(srcPath + " not found");
+ return;
+ }
+ invalidKeys = new HashSet<String>();
+ if (dir.isDirectory())
+ {
+ scanDirectory(dir);
+ }
+ else
+ {
+ scanFile(dir);
+ }
+ reportResults();
+ }
+
+ /**
+ * Prints out counts to sysout
+ */
+ private void reportResults()
+ {
+ System.out.println("\nScanned " + javaCount + " source files");
+ System.out.println("Message.properties has " + messages.size()
+ + " keys");
+ System.out.println("Found " + invalidKeys.size()
+ + " possibly invalid parameter calls");
+
+ System.out.println(messageKeys.size()
+ + " keys not found, possibly unused");
+ for (String key : messageKeys)
+ {
+ System.out.println(" " + key);
+ }
+ }
+
+ /**
+ * Scan all files within a directory
+ *
+ * @param dir
+ * @throws IOException
+ */
+ private void scanDirectory(File dir) throws IOException
+ {
+ File[] files = dir.listFiles();
+ if (files != null)
+ {
+ for (File f : files)
+ {
+ if (f.isDirectory())
+ {
+ scanDirectory(f);
+ }
+ else
+ {
+ scanFile(f);
+ }
+ }
+ }
+ }
+
+ /**
+ * Scan a Java file
+ *
+ * @param f
+ */
+ private void scanFile(File f) throws IOException
+ {
+ String path = f.getPath();
+ if (!path.endsWith(".java"))
+ {
+ return;
+ }
+ javaCount++;
+
+ String[] lines = new String[bufferSize];
+ BufferedReader br = new BufferedReader(new FileReader(f));
+ for (int i = 0; i < bufferSize; i++)
+ {
+ String readLine = br.readLine();
+ lines[i] = stripCommentsAndTrim(readLine);
+ }
+
+ int lineNo = 0;
+
+ while (lines[bufferSize - 1] != null)
+ {
+ lineNo++;
+ inspectSourceLines(path, lineNo, lines);
+
+ for (int i = 0; i < bufferSize - 1; i++)
+ {
+ lines[i] = lines[i + 1];
+ }
+ lines[bufferSize - 1] = stripCommentsAndTrim(br.readLine());
+ }
+ br.close();
+
+ }
+
+ /*
+ * removes anything after (and including) '//'
+ */
+ private String stripCommentsAndTrim(String line)
+ {
+ if (line != null)
+ {
+ int pos = line.indexOf("//");
+ if (pos != -1)
+ {
+ line = line.substring(0, pos);
+ }
+ line = line.replace("\t", " ").trim();
+ }
+ return line;
+ }
+
+ /**
+ * Look for calls to MessageManager methods, possibly split over two or more
+ * lines
+ *
+ * @param path
+ * @param lineNo
+ * @param lines
+ */
+ private void inspectSourceLines(String path, int lineNo, String[] lines)
+ {
+ String lineNos = String.format("%d-%d", lineNo, lineNo + lines.length
+ - 1);
+ String combined = combineLines(lines);
+ for (String method : METHODS)
+ {
+ int pos = combined.indexOf(method);
+ if (pos == -1)
+ {
+ continue;
+ }
+ String methodArgs = combined.substring(pos + method.length());
+ if ("".equals(methodArgs))
+ {
+ /*
+ * continues on next line - catch in the next read loop iteration
+ */
+ continue;
+ }
+ if (!methodArgs.startsWith("\""))
+ {
+ System.out.println(String.format(
+ "Possible dynamic key at %s line %s %s",
+ path.substring(sourcePath.length()), lineNos, combined));
+ continue;
+ }
+ methodArgs = methodArgs.substring(1);
+ int quotePos = methodArgs.indexOf("\"");
+ if (quotePos == -1)
+ {
+ System.out.println(String.format("Trouble parsing %s line %s %s",
+ path.substring(sourcePath.length()), lineNos, combined));
+ continue;
+ }
+ String messageKey = methodArgs.substring(0, quotePos);
+ if (!this.messages.containsKey(messageKey))
+ {
+ System.out.println(String.format(
+ "Unmatched key '%s' at line %s of %s", messageKey, lineNos,
+ path.substring(sourcePath.length())));
+ if (!invalidKeys.contains(messageKey))
+ {
+ invalidKeys.add(messageKey);
+ }
+ }
+ messageKeys.remove(messageKey);
+ }
+ }
+
+ private String combineLines(String[] lines)
+ {
+ String combined = "";
+ if (lines != null)
+ {
+ for (String line : lines)
+ {
+ if (line != null)
+ {
+ combined += line;
+ }
+ }
+ }
+ return combined;
+ }
+
+ /**
+ * Loads properties from Message.properties
+ *
+ * @throws IOException
+ */
+ void loadMessages() throws IOException
+ {
+ messages = new Properties();
+ FileReader reader = new FileReader(new File(sourcePath,
+ "../resources/lang/Messages.properties"));
+ messages.load(reader);
+ reader.close();
+
+ messageKeys = new TreeSet<String>();
+ for (Object key : messages.keySet())
+ {
+ messageKeys.add((String) key);
+ }
+
+ }
+
+}